[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Tue Dec 19 17:08:02 UTC 2023


The branch, master has been updated
       via  6d3146f94b2 smbd: Modernize a few DEBUG statements
       via  9beb22a28eb smbd: Remove an unused function prototype
       via  a22aeed277f smbd: Slightly simplify smbd_smb2_query_directory_send()
       via  c00bec4ae80 smbd: Give source3/smbd/dir.c its own header file
       via  3046b8b502f smbd: Remove unused srv_put_dos_date2()
       via  abf323d03e3 smbd: Use srv_put_dos_date2_ts() in reply_printqueue()
       via  d5a0d6f7e9d smbd: Introduce srv_put_dos_date2_ts()
       via  e3b4073d3c7 profile: Fix rusage reporting
       via  8c08b70503e profile: Fix a small memleak
       via  201d113d1e6 smbd: Remove "conn" from struct dptr_struct
       via  ed6a659f5ed lib: Remove duplicate prototypes
       via  99c61fa8513 lib: Fix some whitespace
      from  4b7329f1582 ctdb-server: Drop unnecessary copy of destination address

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6d3146f94b22a6c3df0effa738c893220f843f8a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 29 16:54:45 2023 +0100

    smbd: Modernize a few DEBUG statements
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Tue Dec 19 17:07:04 UTC 2023 on atb-devel-224

commit 9beb22a28eb04199bcfff3e6c18385bd58da9c7e
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 27 14:54:19 2023 +0100

    smbd: Remove an unused function prototype
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit a22aeed277f84dfefaef6e8157843991bdda60dc
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 27 10:51:45 2023 +0100

    smbd: Slightly simplify smbd_smb2_query_directory_send()
    
    Avoid an if-statement when just assigning the result of the
    if-condition to a boolean.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit c00bec4ae8023c9e3cb890e989a3c98971926aee
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 27 14:53:07 2023 +0100

    smbd: Give source3/smbd/dir.c its own header file
    
    The prototypes were spread across 3 different files.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 3046b8b502f41c00747c48f1ed7ce87dc92fe8fb
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Nov 26 16:20:44 2023 +0100

    smbd: Remove unused srv_put_dos_date2()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit abf323d03e3ed2b66e3d40b3add26feee2c351e4
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Nov 26 16:17:07 2023 +0100

    smbd: Use srv_put_dos_date2_ts() in reply_printqueue()
    
    srv_put_dos_date2_ts() uses convert_timespec_to_time_t() on the passed
    timespec, which for ts_nsec==0 returns just tv_sec.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit d5a0d6f7e9d8ee09facf248bb3394ea3b164ee5b
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Nov 26 15:17:45 2023 +0100

    smbd: Introduce srv_put_dos_date2_ts()
    
    All but one uses of srv_put_dos_date2() converted from struct
    timespec. Put that into a new routine.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit e3b4073d3c7c50e63f2214912d091264c8c94035
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 24 16:27:42 2023 +0100

    profile: Fix rusage reporting
    
    getrusage already gives accumulated values, so add them to the tdb
    record after smbprofile_stats_accumulate. Maybe we should not zero out
    our internal copy after writing the tdb, this would save a call to
    smbprofile_stats_accumulate() once a second.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 8c08b70503e8168a864db2d612b247c853821fd0
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 20 15:53:48 2023 +0100

    profile: Fix a small memleak
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 201d113d1e6cc7e8fa072d69a64aace4c8e35f17
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 29 13:30:23 2023 +0100

    smbd: Remove "conn" from struct dptr_struct
    
    We have it available behind "dir_hnd".
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit ed6a659f5ed2e1c9f46942316779b5c672657475
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Nov 26 12:36:33 2023 +0100

    lib: Remove duplicate prototypes
    
    They also exist in lib/util/time.h
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 99c61fa85131af2d21d53dc0e949607833fb3a0c
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 29 16:35:20 2023 +0100

    lib: Fix some whitespace
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/include/proto.h              |   6 +-
 source3/lib/system_smbd.c            |  10 +--
 source3/lib/time.c                   |   3 +-
 source3/modules/vfs_ceph_snapshots.c |   1 +
 source3/modules/vfs_fruit.c          |   1 +
 source3/modules/vfs_shadow_copy.c    |   1 +
 source3/modules/vfs_streams_depot.c  |   1 +
 source3/modules/vfs_syncops.c        |   1 +
 source3/profile/profile.c            |  21 +++---
 source3/smbd/close.c                 |   1 +
 source3/smbd/dir.c                   |  21 +++---
 source3/smbd/dir.h                   |  89 +++++++++++++++++++++++
 source3/smbd/file_access.c           |   1 +
 source3/smbd/filename.c              |   1 +
 source3/smbd/globals.h               |  24 -------
 source3/smbd/msdfs.c                 |   1 +
 source3/smbd/open.c                  |   1 +
 source3/smbd/proto.h                 |  47 -------------
 source3/smbd/smb1_reply.c            |  20 ++++--
 source3/smbd/smb1_trans2.c           |   6 +-
 source3/smbd/smb2_process.c          |   1 +
 source3/smbd/smb2_query_directory.c  |  10 +--
 source3/smbd/smb2_reply.c            |   1 +
 source3/smbd/smb2_trans2.c           | 132 +++++++++++++++++------------------
 source3/torture/cmd_vfs.c            |   1 +
 25 files changed, 219 insertions(+), 183 deletions(-)
 create mode 100644 source3/smbd/dir.h


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index 3ed35054708..5c1ba851287 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -229,9 +229,6 @@ void register_msg_pool_usage(TALLOC_CTX *mem_ctx,
 
 /* The following definitions come from lib/time.c  */
 
-void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
-void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
-void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
 uint32_t convert_time_t_to_uint32_t(time_t t);
 time_t convert_uint32_t_to_time_t(uint32_t u);
 bool nt_time_is_zero(const NTTIME *nt);
@@ -241,7 +238,7 @@ int set_server_zone_offset(time_t t);
 char *timeval_string(TALLOC_CTX *ctx, const struct timeval *tp, bool hires);
 char *current_timestring(TALLOC_CTX *ctx, bool hires);
 void srv_put_dos_date(char *buf,int offset,time_t unixdate);
-void srv_put_dos_date2(char *buf,int offset, time_t unixdate);
+void srv_put_dos_date2_ts(char *buf, int offset, struct timespec unix_ts);
 void srv_put_dos_date3(char *buf,int offset,time_t unixdate);
 void round_timespec(enum timestamp_set_resolution res, struct timespec *ts);
 void put_long_date_timespec(enum timestamp_set_resolution res, char *p, struct timespec ts);
@@ -751,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);
diff --git a/source3/lib/system_smbd.c b/source3/lib/system_smbd.c
index 73bffe05f7a..4a14744f724 100644
--- a/source3/lib/system_smbd.c
+++ b/source3/lib/system_smbd.c
@@ -1,4 +1,4 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    system call wrapper interface.
    Copyright (C) Andrew Tridgell 2002
@@ -8,19 +8,19 @@
    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/>.
 */
 
-/* 
+/*
    This file may assume linkage with smbd - for things like become_root()
-   etc. 
+   etc.
 */
 
 #include "includes.h"
diff --git a/source3/lib/time.c b/source3/lib/time.c
index ec93f6c5347..420b5f700d9 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -129,8 +129,9 @@ void srv_put_dos_date(char *buf,int offset,time_t unixdate)
 	push_dos_date((uint8_t *)buf, offset, unixdate, server_zone_offset);
 }
 
-void srv_put_dos_date2(char *buf,int offset, time_t unixdate)
+void srv_put_dos_date2_ts(char *buf, int offset, struct timespec unix_ts)
 {
+	time_t unixdate = convert_timespec_to_time_t(unix_ts);
 	push_dos_date2((uint8_t *)buf, offset, unixdate, server_zone_offset);
 }
 
diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c
index f9ae977918c..98b8f5f6b5d 100644
--- a/source3/modules/vfs_ceph_snapshots.c
+++ b/source3/modules/vfs_ceph_snapshots.c
@@ -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
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index b3dd6016ae3..4ab0f46a4e6 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -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
diff --git a/source3/modules/vfs_shadow_copy.c b/source3/modules/vfs_shadow_copy.c
index e87cefbb694..62b92918886 100644
--- a/source3/modules/vfs_shadow_copy.c
+++ b/source3/modules/vfs_shadow_copy.c
@@ -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.
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index 2a46d5b12b2..f9701cc66ed 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -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
diff --git a/source3/modules/vfs_syncops.c b/source3/modules/vfs_syncops.c
index 94dcd7b846e..a0d98093296 100644
--- a/source3/modules/vfs_syncops.c
+++ b/source3/modules/vfs_syncops.c
@@ -22,6 +22,7 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "smbd/smbd.h"
+#include "source3/smbd/dir.h"
 
 /*
 
diff --git a/source3/profile/profile.c b/source3/profile/profile.c
index 6decb855282..0b02e36fcd0 100644
--- a/source3/profile/profile.c
+++ b/source3/profile/profile.c
@@ -137,6 +137,7 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
 		NULL, db_name, 0,
 		rdonly ? 0 : TDB_CLEAR_IF_FIRST|TDB_MUTEX_LOCKING,
 		O_CREAT | (rdonly ? O_RDONLY : O_RDWR), 0644);
+	TALLOC_FREE(db_name);
 	if (smbprofile_state.internal.db == NULL) {
 		return false;
 	}
@@ -232,6 +233,16 @@ void smbprofile_dump(void)
 
 	pid = tevent_cached_getpid();
 
+	ret = tdb_chainlock(smbprofile_state.internal.db->tdb, key);
+	if (ret != 0) {
+		return;
+	}
+
+	tdb_parse_record(smbprofile_state.internal.db->tdb,
+			 key, profile_stats_parser, &s);
+
+	smbprofile_stats_accumulate(profile_p, &s);
+
 #ifdef HAVE_GETRUSAGE
 	ret = getrusage(RUSAGE_SELF, &rself);
 	if (ret != 0) {
@@ -246,16 +257,6 @@ void smbprofile_dump(void)
 		rself.ru_stime.tv_usec;
 #endif /* HAVE_GETRUSAGE */
 
-	ret = tdb_chainlock(smbprofile_state.internal.db->tdb, key);
-	if (ret != 0) {
-		return;
-	}
-
-	tdb_parse_record(smbprofile_state.internal.db->tdb,
-			 key, profile_stats_parser, &s);
-
-	smbprofile_stats_accumulate(profile_p, &s);
-
 	tdb_store(smbprofile_state.internal.db->tdb, key,
 		  (TDB_DATA) {
 			.dptr = (uint8_t *)profile_p,
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index f1f5e41a43f..538435ca834 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -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.
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 8fb4476d4ab..800b7221cfd 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -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.
@@ -54,7 +55,6 @@ struct smb_Dir {
 struct dptr_struct {
 	struct dptr_struct *next, *prev;
 	int dnum;
-	struct connection_struct *conn;
 	struct smb_Dir *dir_hnd;
 	char *wcard;
 	uint32_t attr;
@@ -174,7 +174,7 @@ void dptr_closecnum(connection_struct *conn)
 
 	for(dptr = sconn->searches.dirptrs; dptr; dptr = next) {
 		next = dptr->next;
-		if (dptr->conn == conn) {
+		if (dptr->dir_hnd->conn == conn) {
 			/*
 			 * Need to make a copy, "dptr" will be gone
 			 * after close_file_free() returns
@@ -236,7 +236,6 @@ NTSTATUS dptr_create(connection_struct *conn,
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	dptr->conn = conn;
 	dptr->dir_hnd = dir_hnd;
 	dptr->wcard = talloc_strdup(dptr, wcard);
 	if (!dptr->wcard) {
@@ -319,7 +318,7 @@ void dptr_CloseDir(files_struct *fsp)
 	if (fsp->dptr == NULL) {
 		return;
 	}
-	sconn = fsp->dptr->conn->sconn;
+	sconn = fsp->conn->sconn;
 
 	/*
 	 * The destructor for the struct smb_Dir (fsp->dptr->dir_hnd)
@@ -439,7 +438,8 @@ char *dptr_ReadDirName(TALLOC_CTX *ctx, struct dptr_struct *dptr)
 		flags |= AT_SYMLINK_NOFOLLOW;
 	}
 
-	ret = SMB_VFS_FSTATAT(dptr->conn, dir_fsp, &smb_fname_base, &st, flags);
+	ret = SMB_VFS_FSTATAT(
+		dir_hnd->conn, dir_fsp, &smb_fname_base, &st, flags);
 	if (ret == 0) {
 		return talloc_strdup(ctx, dptr->wcard);
 	}
@@ -456,16 +456,17 @@ char *dptr_ReadDirName(TALLOC_CTX *ctx, struct dptr_struct *dptr)
 	 * A scan will find the long version of a mangled name as
 	 * wildcard.
 	 */
-	retry_scanning |= mangle_is_mangled(dptr->wcard, dptr->conn->params);
+	retry_scanning |= mangle_is_mangled(dptr->wcard,
+					    dir_hnd->conn->params);
 
 	/*
 	 * Also retry scanning if the client requested case
 	 * insensitive semantics and the file system does not provide
 	 * it.
 	 */
-	retry_scanning |=
-		(!dir_hnd->case_sensitive &&
-		 (dptr->conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH));
+	retry_scanning |= (!dir_hnd->case_sensitive &&
+			   (dir_hnd->conn->fs_capabilities &
+			    FILE_CASE_SENSITIVE_SEARCH));
 
 	if (retry_scanning) {
 		char *found_name = NULL;
@@ -522,8 +523,8 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
 			   struct smb_filename **_smb_fname,
 			   uint32_t *_mode)
 {
-	connection_struct *conn = dirptr->conn;
 	struct smb_Dir *dir_hnd = dirptr->dir_hnd;
+	connection_struct *conn = dir_hnd->conn;
 	struct smb_filename *dir_fname = dir_hnd->dir_smb_fname;
 	bool posix = (dir_fname->flags & SMB_FILENAME_POSIX_PATH);
 	const bool toplevel = ISDOT(dir_fname->base_name);
diff --git a/source3/smbd/dir.h b/source3/smbd/dir.h
new file mode 100644
index 00000000000..d520d1380b5
--- /dev/null
+++ b/source3/smbd/dir.h
@@ -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
diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c
index 0ddad227ca1..9ad9173e49c 100644
--- a/source3/smbd/file_access.c
+++ b/source3/smbd/file_access.c
@@ -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
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 5219fcd721e..2ec073b2154 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -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)
 {
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 119483377c0..4928d1f4fb8 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -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,
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index 2772ece19f1..4a322d129c6 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -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)
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 30d0d3ab728..d34d0354ff7 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -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;
 
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 870e6417b2b..2875fcf562b 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -175,53 +175,6 @@ uint64_t get_dfree_info(connection_struct *conn, struct smb_filename *fname,
 			uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
 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;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list