s3: smbd: Add dptr_fsp() to return any stored files_struct pointer.
authorJeremy Allison <jra@samba.org>
Wed, 17 Jul 2019 18:00:06 +0000 (11:00 -0700)
committerRalph Boehme <slow@samba.org>
Tue, 6 Aug 2019 14:23:33 +0000 (14:23 +0000)
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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/dir.c
source3/smbd/proto.h

index 03411cbe0023151512f4369e054ce5e7ce8be33b..b885769fff788be6550a9ff4551d10793a85ba7f 100644 (file)
@@ -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).
 ****************************************************************************/
index 1bdf1b03760cc0c88a8412800ceb7195ecf26479..9e1675204bbd7aa32241981817cbe92a5f7ee906 100644 (file)
@@ -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,