summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/proto.h1
-rw-r--r--source3/smbd/vfs.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 6358286ab98..693a498026b 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -1149,6 +1149,7 @@ void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
files_struct *fsp, size_t ext_size,
void (*destroy_fn)(void *p_data));
void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
+void vfs_remove_all_fsp_extensions(struct files_struct *fsp);
void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
bool smbd_vfs_init(connection_struct *conn);
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 2be6c54a881..60320e60692 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -261,6 +261,27 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
}
}
+void vfs_remove_all_fsp_extensions(files_struct *fsp)
+{
+ struct vfs_fsp_data *curr;
+ struct vfs_fsp_data *prev;
+
+ for (curr = fsp->vfs_extension, prev = NULL;
+ curr;
+ prev = curr, curr = curr->next)
+ {
+ if (prev) {
+ prev->next = curr->next;
+ } else {
+ fsp->vfs_extension = curr->next;
+ }
+ if (curr->destroy) {
+ curr->destroy(EXT_DATA_AREA(curr));
+ }
+ TALLOC_FREE(curr);
+ }
+}
+
void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
{
struct vfs_fsp_data *head;