]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Add smb2_create_blob_remove()
authorVolker Lendecke <vl@samba.org>
Tue, 4 Feb 2020 15:18:41 +0000 (17:18 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 7 Feb 2020 21:01:31 +0000 (21:01 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libcli/smb/smb2_create_blob.c
libcli/smb/smb2_create_blob.h

index 57c7a9d1150c4c469863a0166fa66a2afeffde4b..ecd61e0c9b2cd2a51477c97ead1abbaed960ac0f 100644 (file)
@@ -225,3 +225,18 @@ struct smb2_create_blob *smb2_create_blob_find(const struct smb2_create_blobs *b
 
        return NULL;
 }
+
+void smb2_create_blob_remove(struct smb2_create_blobs *b, const char *tag)
+{
+       struct smb2_create_blob *blob = smb2_create_blob_find(b, tag);
+
+       if (blob == NULL) {
+               return;
+       }
+
+       TALLOC_FREE(blob->tag);
+       data_blob_free(&blob->data);
+
+       *blob = b->blobs[b->num_blobs-1];
+       b->num_blobs -= 1;
+}
index 000fd7469fa2e3d94c006ccc183785941c0e39f8..f41e77edc3de47aa3d038ad71656cea911b7f326 100644 (file)
@@ -71,4 +71,6 @@ NTSTATUS smb2_create_blob_add(TALLOC_CTX *mem_ctx, struct smb2_create_blobs *b,
 struct smb2_create_blob *smb2_create_blob_find(const struct smb2_create_blobs *b,
                                               const char *tag);
 
+void smb2_create_blob_remove(struct smb2_create_blobs *b, const char *tag);
+
 #endif /* _LIBCLI_SMB_SMB2_CREATE_BLOB_H_ */