smbd: Give source3/smbd/dir.c its own header file
authorVolker Lendecke <vl@samba.org>
Mon, 27 Nov 2023 13:53:07 +0000 (14:53 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 19 Dec 2023 16:05:36 +0000 (16:05 +0000)
The prototypes were spread across 3 different files.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
22 files changed:
source3/include/proto.h
source3/modules/vfs_ceph_snapshots.c
source3/modules/vfs_fruit.c
source3/modules/vfs_shadow_copy.c
source3/modules/vfs_streams_depot.c
source3/modules/vfs_syncops.c
source3/smbd/close.c
source3/smbd/dir.c
source3/smbd/dir.h [new file with mode: 0644]
source3/smbd/file_access.c
source3/smbd/filename.c
source3/smbd/globals.h
source3/smbd/msdfs.c
source3/smbd/open.c
source3/smbd/proto.h
source3/smbd/smb1_reply.c
source3/smbd/smb1_trans2.c
source3/smbd/smb2_process.c
source3/smbd/smb2_query_directory.c
source3/smbd/smb2_reply.c
source3/smbd/smb2_trans2.c
source3/torture/cmd_vfs.c

index f8f23efecadfba056f2250e5bb363dfe50f87cad..5c1ba8512873bd128d35fbc871168419ec532428 100644 (file)
@@ -748,7 +748,6 @@ void unbecome_root(void);
 int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out);
 bool lp_allow_local_address(
        int snum, const struct tsocket_address *local_address);
-NTSTATUS can_delete_directory_fsp(files_struct *fsp);
 bool change_to_root_user(void);
 bool become_authenticated_pipe_user(struct auth_session_info *session_info);
 bool unbecome_authenticated_pipe_user(void);
index f9ae977918c5ba73f5af271fef9fe821c2fe7230..98b8f5f6b5d9744ad069cf9cc0ba57f18d97232d 100644 (file)
@@ -28,6 +28,7 @@
 #include "smbd/smbd.h"
 #include "lib/util/tevent_ntstatus.h"
 #include "lib/util/smb_strtox.h"
+#include "source3/smbd/dir.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
index b3dd6016ae36a2b639ca3c1648f3af3546d13670..4ab0f46a4e62f01d216182507b62435b43fe86fe 100644 (file)
@@ -35,6 +35,7 @@
 #include "hash_inode.h"
 #include "lib/adouble.h"
 #include "lib/util_macstreams.h"
+#include "source3/smbd/dir.h"
 
 /*
  * Enhanced OS X and Netatalk compatibility
index e87cefbb6945ccd9240608273d1a35651405f3b2..62b929188861a90cc227080bf8fd22aed1546f9c 100644 (file)
@@ -20,6 +20,7 @@
 #include "includes.h"
 #include "smbd/smbd.h"
 #include "ntioctl.h"
+#include "source3/smbd/dir.h"
 
 /*
     Please read the VFS module Samba-HowTo-Collection.
index 2a46d5b12b213144b773c5dd097988557211ae02..f9701cc66ed77c0cb4a2a4695761fe15fd2ca97c 100644 (file)
@@ -20,6 +20,7 @@
 #include "includes.h"
 #include "smbd/smbd.h"
 #include "system/filesys.h"
+#include "source3/smbd/dir.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
index 94dcd7b846eda3fb665010ea8855e528c3339fcb..a0d9809329683a6c94866e54b5b6944d233f3b9e 100644 (file)
@@ -22,6 +22,7 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "smbd/smbd.h"
+#include "source3/smbd/dir.h"
 
 /*
 
index f1f5e41a43fa296dac82aed9db01c71d787ca952..538435ca834cc37c17122b50ad6746463732bea3 100644 (file)
@@ -34,6 +34,7 @@
 #include "messages.h"
 #include "../librpc/gen_ndr/open_files.h"
 #include "lib/util/tevent_ntstatus.h"
+#include "source3/smbd/dir.h"
 
 /****************************************************************************
  Run a file if it is a magic script.
index 6f58f8321303d6cab84ab1ee12f1900b31f7a5c8..800b7221cfd0b323ac886f64efd18b89222b95fc 100644 (file)
@@ -29,6 +29,7 @@
 #include "../librpc/gen_ndr/open_files.h"
 #include "lib/util/string_wrappers.h"
 #include "libcli/smb/reparse.h"
+#include "source3/smbd/dir.h"
 
 /*
    This module implements directory related functions for Samba.
diff --git a/source3/smbd/dir.h b/source3/smbd/dir.h
new file mode 100644 (file)
index 0000000..d520d13
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Unix SMB/Netbios implementation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _SOURCE3_SMBD_DIR_H_
+#define _SOURCE3_SMBD_DIR_H_
+
+#include "includes.h"
+
+struct smb_Dir;
+struct dptr_struct;
+
+NTSTATUS can_delete_directory_fsp(files_struct *fsp);
+struct files_struct *dir_hnd_fetch_fsp(struct smb_Dir *dir_hnd);
+uint16_t dptr_attr(struct smbd_server_connection *sconn, int key);
+bool dptr_case_sensitive(struct dptr_struct *dptr);
+void dptr_closecnum(connection_struct *conn);
+void dptr_CloseDir(files_struct *fsp);
+NTSTATUS dptr_create(connection_struct *conn,
+                    struct smb_request *req,
+                    files_struct *fsp,
+                    bool old_handle,
+                    const char *wcard,
+                    uint32_t attr,
+                    struct dptr_struct **dptr_ret);
+int dptr_dnum(struct dptr_struct *dptr);
+files_struct *dptr_fetch_lanman2_fsp(struct smbd_server_connection *sconn,
+                                    int dptr_num);
+unsigned int dptr_FileNumber(struct dptr_struct *dptr);
+bool dptr_get_priv(struct dptr_struct *dptr);
+bool dptr_has_wild(struct dptr_struct *dptr);
+const char *dptr_path(struct smbd_server_connection *sconn, int key);
+char *dptr_ReadDirName(TALLOC_CTX *ctx, struct dptr_struct *dptr);
+void dptr_RewindDir(struct dptr_struct *dptr);
+void dptr_set_priv(struct dptr_struct *dptr);
+const char *dptr_wcard(struct smbd_server_connection *sconn, int key);
+bool have_file_open_below(connection_struct *conn,
+                         const struct smb_filename *name);
+bool init_dptrs(struct smbd_server_connection *sconn);
+bool is_visible_fsp(files_struct *fsp);
+NTSTATUS OpenDir(TALLOC_CTX *mem_ctx,
+                connection_struct *conn,
+                const struct smb_filename *smb_dname,
+                const char *mask,
+                uint32_t attr,
+                struct smb_Dir **_dir_hnd);
+NTSTATUS OpenDir_from_pathref(TALLOC_CTX *mem_ctx,
+                             struct files_struct *dirfsp,
+                             const char *mask,
+                             uint32_t attr,
+                             struct smb_Dir **_dir_hnd);
+const char *ReadDirName(struct smb_Dir *dir_hnd, char **talloced);
+void RewindDir(struct smb_Dir *dir_hnd);
+bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
+                          struct dptr_struct *dirptr,
+                          const char *mask,
+                          uint32_t dirtype,
+                          bool dont_descend,
+                          bool ask_sharemode,
+                          bool get_dosmode,
+                          bool (*match_fn)(TALLOC_CTX *ctx,
+                                           void *private_data,
+                                           const char *dname,
+                                           const char *mask,
+                                           char **_fname),
+                          void *private_data,
+                          char **_fname,
+                          struct smb_filename **_smb_fname,
+                          uint32_t *_mode);
+char *smbd_dirptr_get_last_name_sent(struct dptr_struct *dirptr);
+void smbd_dirptr_push_overflow(struct dptr_struct *dirptr,
+                              char **_fname,
+                              struct smb_filename **_smb_fname,
+                              uint32_t mode);
+void smbd_dirptr_set_last_name_sent(struct dptr_struct *dirptr, char **_fname);
+#endif
index 0ddad227ca1bf106e7363f2c4b9ff20edf7e4ed7..9ad9173e49ca186524e72b6870c03e7349f94aad 100644 (file)
@@ -23,6 +23,7 @@
 #include "../libcli/security/security.h"
 #include "../librpc/gen_ndr/ndr_security.h"
 #include "smbd/smbd.h"
+#include "source3/smbd/dir.h"
 
 #undef  DBGC_CLASS
 #define DBGC_CLASS DBGC_ACLS
index 5219fcd721eeda4824395556467d9df5d79a1f0c..2ec073b21546b5bf6462e51500f8c3b1e59435e9 100644 (file)
@@ -30,6 +30,7 @@
 #include "smbd/smbd.h"
 #include "smbd/globals.h"
 #include "libcli/smb/reparse.h"
+#include "source3/smbd/dir.h"
 
 uint32_t ucf_flags_from_smb_request(struct smb_request *req)
 {
index 119483377c0e4fb05be1d2a9f76b3f590ccd0bae..4928d1f4fb809129931cb11437009a5e45a94fda 100644 (file)
@@ -160,30 +160,6 @@ NTSTATUS smbd_do_qfsinfo(struct smbXsrv_connection *xconn,
                         char **ppdata,
                         int *ret_data_len);
 
-bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
-                          struct dptr_struct *dirptr,
-                          const char *mask,
-                          uint32_t dirtype,
-                          bool dont_descend,
-                          bool ask_sharemode,
-                          bool get_dosmode,
-                          bool (*match_fn)(TALLOC_CTX *ctx,
-                                           void *private_data,
-                                           const char *dname,
-                                           const char *mask,
-                                           char **_fname),
-                          void *private_data,
-                          char **_fname,
-                          struct smb_filename **_smb_fname,
-                          uint32_t *_mode);
-void smbd_dirptr_push_overflow(struct dptr_struct *dirptr,
-                              char **_fname,
-                              struct smb_filename **_smb_fname,
-                              uint32_t mode);
-void smbd_dirptr_set_last_name_sent(struct dptr_struct *dirptr,
-                                   char **_fname);
-char *smbd_dirptr_get_last_name_sent(struct dptr_struct *dirptr);
-
 NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
                               connection_struct *conn,
                               struct dptr_struct *dirptr,
index 2772ece19f1308c1a215ab06708d222e61c69643..4a322d129c65a793762e0e6910f13e154195589e 100644 (file)
@@ -35,6 +35,7 @@
 #include "lib/tsocket/tsocket.h"
 #include "lib/global_contexts.h"
 #include "source3/lib/substitute.h"
+#include "source3/smbd/dir.h"
 
 /**********************************************************************
  Parse a DFS pathname of the form(s)
index 30d0d3ab7285dfa15afd603c0d2ff6edc890aab3..d34d0354ff7aa151d3b5818f5cc3c4565a0a2657 100644 (file)
@@ -41,6 +41,7 @@
 #include "locking/leases_db.h"
 #include "librpc/gen_ndr/ndr_leases_db.h"
 #include "lib/util/time_basic.h"
+#include "source3/smbd/dir.h"
 
 extern const struct generic_mapping file_generic_mapping;
 
index 870e6417b2b02036ee4fb263593b8d585967907f..93d91c7b696316d1add31a3638020effe5e7a01e 100644 (file)
@@ -177,50 +177,8 @@ void flush_dfree_cache(void);
 
 /* The following definitions come from smbd/dir.c  */
 
-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);
-void dptr_closecnum(connection_struct *conn);
-NTSTATUS dptr_create(connection_struct *conn,
-               struct smb_request *req,
-               files_struct *fsp,
-               bool old_handle,
-               const char *wcard,
-               uint32_t attr,
-               struct dptr_struct **dptr_ret);
-void dptr_CloseDir(files_struct *fsp);
-void dptr_RewindDir(struct dptr_struct *dptr);
-unsigned int dptr_FileNumber(struct dptr_struct *dptr);
-bool dptr_has_wild(struct dptr_struct *dptr);
-int dptr_dnum(struct dptr_struct *dptr);
-bool dptr_get_priv(struct dptr_struct *dptr);
-void dptr_set_priv(struct dptr_struct *dptr);
-bool dptr_case_sensitive(struct dptr_struct *dptr);
-char *dptr_ReadDirName(TALLOC_CTX *ctx, struct dptr_struct *dptr);
-struct smb_Dir;
-struct files_struct *dir_hnd_fetch_fsp(struct smb_Dir *dir_hnd);
-files_struct *dptr_fetch_lanman2_fsp(struct smbd_server_connection *sconn,
-                                      int dptr_num);
-struct smb_Dir;
-bool is_visible_fsp(files_struct *fsp);
-NTSTATUS OpenDir(TALLOC_CTX *mem_ctx,
-                connection_struct *conn,
-                const struct smb_filename *smb_dname,
-                const char *mask,
-                uint32_t attr,
-                struct smb_Dir **_dir_hnd);
-NTSTATUS OpenDir_from_pathref(TALLOC_CTX *mem_ctx,
-                             struct files_struct *dirfsp,
-                             const char *mask,
-                             uint32_t attr,
-                             struct smb_Dir **_dir_hnd);
-const char *ReadDirName(struct smb_Dir *dir_hnd, char **talloced);
-void RewindDir(struct smb_Dir *dir_hnd);
 NTSTATUS can_delete_directory(struct connection_struct *conn,
                                const char *dirname);
-bool have_file_open_below(connection_struct *conn,
-                       const struct smb_filename *name);
 
 /* The following definitions come from smbd/dmapi.c  */
 
index ed5bbdd96398bb44b65cd23154834894374baa9d..cc1b1311cf13b28a7203be6bbbb0d0264aec43f7 100644 (file)
@@ -51,6 +51,7 @@
 #include "lib/util/string_wrappers.h"
 #include "source3/printing/rap_jobid.h"
 #include "source3/lib/substitute.h"
+#include "source3/smbd/dir.h"
 
 /****************************************************************************
  Check if we have a correct fsp pointing to a file. Basic check for open fsp.
index b068982529e1600a92a90da38e590d4f9de0d9c1..16dff34381a5b4f703b37afede97125bff616bc6 100644 (file)
@@ -46,6 +46,7 @@
 #include "lib/util/string_wrappers.h"
 #include "source3/lib/substitute.h"
 #include "source3/lib/adouble.h"
+#include "source3/smbd/dir.h"
 
 #define DIR_ENTRY_SAFETY_MARGIN 4096
 
index fbbe4ef399245037a2c54aa0649e3299fd26c3da..9aefea8a41e5351b610fc1eb13c4ce5d567f8bca 100644 (file)
@@ -47,6 +47,7 @@
 #include "libcli/smb/smbXcli_base.h"
 #include "lib/util/time_basic.h"
 #include "source3/lib/substitute.h"
+#include "source3/smbd/dir.h"
 
 /* Internal message queue for deferred opens. */
 struct pending_message_list {
index bae5780eafcf1f5969aa49cea234bc85ae0f458f..5f1a52c194c3210d64ab31524273bedc488d3e75 100644 (file)
@@ -27,6 +27,7 @@
 #include "../lib/util/tevent_ntstatus.h"
 #include "system/filesys.h"
 #include "lib/pthreadpool/pthreadpool_tevent.h"
+#include "source3/smbd/dir.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_SMB2
index 269482f11ec74a3ff1908f216f545ce0ac31a427..729bb21f09b4a24d94c9c0273957bed41e2c5710 100644 (file)
@@ -51,6 +51,7 @@
 #include "lib/util/string_wrappers.h"
 #include "source3/printing/rap_jobid.h"
 #include "source3/lib/substitute.h"
+#include "source3/smbd/dir.h"
 
 /****************************************************************************
  Ensure we check the path in *exactly* the same way as W2K for a findfirst/findnext
index e0411da4d680813d472c1d45bd05695c3ef199d6..7e11df00d22a1165ef02f857d1a02d80fa37f8ab 100644 (file)
@@ -47,6 +47,7 @@
 #include "lib/util/string_wrappers.h"
 #include "source3/lib/substitute.h"
 #include "source3/lib/adouble.h"
+#include "source3/smbd/dir.h"
 
 #define DIR_ENTRY_SAFETY_MARGIN 4096
 
index 9127a99f8e78d2785208df3e03323084c250bbf6..95b1e21a22f5d63d12fa32d7ec4e747287cfd548 100644 (file)
@@ -27,6 +27,7 @@
 #include "../lib/util/util_pw.h"
 #include "libcli/security/security.h"
 #include "passdb/machine_sid.h"
+#include "source3/smbd/dir.h"
 
 static const char *null_string = "";