summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2020-02-04 17:18:41 +0200
committerJeremy Allison <jra@samba.org>2020-02-07 21:01:31 +0000
commitf6fe7c39cdaeb9b415c36f7ae9a8baf45dddc5b0 (patch)
tree6e62c5cac395616a0cffa46544a5a84ee44488a5 /libcli
parent23db731593614c1427066091090fd13ccebed2aa (diff)
downloadsamba-f6fe7c39cdaeb9b415c36f7ae9a8baf45dddc5b0.tar.gz
libsmb: Add smb2_create_blob_remove()
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libcli')
-rw-r--r--libcli/smb/smb2_create_blob.c15
-rw-r--r--libcli/smb/smb2_create_blob.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/libcli/smb/smb2_create_blob.c b/libcli/smb/smb2_create_blob.c
index 57c7a9d1150..ecd61e0c9b2 100644
--- a/libcli/smb/smb2_create_blob.c
+++ b/libcli/smb/smb2_create_blob.c
@@ -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;
+}
diff --git a/libcli/smb/smb2_create_blob.h b/libcli/smb/smb2_create_blob.h
index 000fd7469fa..f41e77edc3d 100644
--- a/libcli/smb/smb2_create_blob.h
+++ b/libcli/smb/smb2_create_blob.h
@@ -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_ */