From 2ba48f76ecaab3ddcd5d030a1dab3b5a889532b6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 17 Jul 2019 11:00:06 -0700 Subject: [PATCH] s3: smbd: Add dptr_fsp() to return any stored files_struct pointer. Will allow [find/search]_next() calls to find and close any associated fsp. This function is temporary and will eventually go away once I modify dptr_fetch() to return an fsp. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/smbd/dir.c | 16 ++++++++++++++++ source3/smbd/proto.h | 1 + 2 files changed, 17 insertions(+) diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 03411cbe002..b885769fff7 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -169,6 +169,22 @@ uint16_t dptr_attr(struct smbd_server_connection *sconn, int key) return(0); } +/**************************************************************************** + Get the fsp stored in a dptr->dir_hnd. +****************************************************************************/ + +files_struct *dptr_fsp(struct smbd_server_connection *sconn, int key) +{ + struct dptr_struct *dptr = dptr_get(sconn, key); + if (dptr == NULL) { + return NULL; + } + if (dptr->dir_hnd == NULL) { + return NULL; + } + return dptr->dir_hnd->fsp; +} + /**************************************************************************** Close a dptr (internal func). ****************************************************************************/ diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 1bdf1b03760..9e1675204bb 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -183,6 +183,7 @@ bool init_dptrs(struct smbd_server_connection *sconn); const char *dptr_path(struct smbd_server_connection *sconn, int key); const char *dptr_wcard(struct smbd_server_connection *sconn, int key); uint16_t dptr_attr(struct smbd_server_connection *sconn, int key); +files_struct *dptr_fsp(struct smbd_server_connection *sconn, int key); void dptr_close(struct smbd_server_connection *sconn, int *key); void dptr_closecnum(connection_struct *conn); bool dptr_activecnum(const struct smbd_server_connection *sconn, -- 2.47.3