From cd3e658d8251de17f3657670f2026d8b22e6a376 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 4 Jun 2012 17:54:41 +0200 Subject: [PATCH] s3:smbd: add vfs_remove_all_fsp_extensions() metze --- source3/smbd/proto.h | 1 + source3/smbd/vfs.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) 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; -- 2.11.4.GIT