libcli/smb: add smb2_create_blob_find()
authorStefan Metzmacher <metze@samba.org>
Wed, 12 Aug 2009 18:38:45 +0000 (20:38 +0200)
committerStefan Metzmacher <metze@samba.org>
Sat, 15 Aug 2009 08:46:35 +0000 (10:46 +0200)
metze

libcli/smb/smb2_create_blob.c
libcli/smb/smb2_create_blob.h

index 0dad2240d06aec79d5c197420092e9556f63c1c6..444dc840afee8f7d0327056fe4e2485746c2dfc7 100644 (file)
@@ -184,3 +184,20 @@ NTSTATUS smb2_create_blob_add(TALLOC_CTX *mem_ctx, struct smb2_create_blobs *b,
 
        return NT_STATUS_OK;
 }
+
+/*
+ * return the first blob with the given tag
+ */
+struct smb2_create_blob *smb2_create_blob_find(const struct smb2_create_blobs *b,
+                                              const char *tag)
+{
+       uint32_t i;
+
+       for (i=0; i < b->num_blobs; i++) {
+               if (strcmp(b->blobs[i].tag, tag) == 0) {
+                       return &b->blobs[i];
+               }
+       }
+
+       return NULL;
+}
index e8b8f12fe34a01ed8f51124b744c46968e34e60e..008befe41a56d99bc1393aa4a17bd2c3a3e87fe5 100644 (file)
@@ -48,4 +48,10 @@ NTSTATUS smb2_create_blob_push(TALLOC_CTX *mem_ctx, DATA_BLOB *buffer,
 NTSTATUS smb2_create_blob_add(TALLOC_CTX *mem_ctx, struct smb2_create_blobs *b,
                              const char *tag, DATA_BLOB data);
 
+/*
+ * return the first blob with the given tag
+ */
+struct smb2_create_blob *smb2_create_blob_find(const struct smb2_create_blobs *b,
+                                              const char *tag);
+
 #endif /* _LIBCLI_SMB_SMB2_CREATE_BLOB_H_ */