s3: smbd: OpenDir() is merely a wrapper around open_dir_safely().
authorJeremy Allison <jra@samba.org>
Wed, 17 Jul 2019 15:56:49 +0000 (08:56 -0700)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 24 Jul 2019 07:40:23 +0000 (07:40 +0000)
Preparatory work.

Separate these out internal to source3/smbd/dir.c so I can
give the internal and external uses separate destructor functions
to allow all client requested directory enumeration to move to handle
based functions.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/smbd/dir.c

index 2c59cb898ec064142c28be82d96efbdf721447d5..bf829e75286b01b02428f6303402cbc6c200909a 100644 (file)
@@ -85,6 +85,12 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn,
 
 static void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset);
 
+static struct smb_Dir *open_dir_safely(TALLOC_CTX *ctx,
+                                       connection_struct *conn,
+                                       const struct smb_filename *smb_dname,
+                                       const char *wcard,
+                                       uint32_t attr);
+
 #define INVALID_DPTR_KEY (-3)
 
 /****************************************************************************
@@ -334,7 +340,7 @@ static struct smb_Dir *open_dir_with_privilege(connection_struct *conn,
                goto out;
        }
 
-       dir_hnd = OpenDir(NULL, conn, smb_fname_cwd, wcard, attr);
+       dir_hnd = open_dir_safely(NULL, conn, smb_fname_cwd, wcard, attr);
 
   out:
 
@@ -431,7 +437,7 @@ NTSTATUS dptr_create(connection_struct *conn,
                                                wcard,
                                                attr);
                } else {
-                       dir_hnd = OpenDir(NULL,
+                       dir_hnd = open_dir_safely(NULL,
                                        conn,
                                        smb_dname_cp,
                                        wcard,