[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Mon Dec 12 22:15:01 UTC 2022


The branch, master has been updated
       via  5d82af05f31 smbd: Remove a few "extern userdom_struct current_user_info"
       via  8cc0489c804 lib: Add get_current_user_info_domain()
       via  46ce8a47109 lib: Make substitute.c's "remote_proto" static
       via  06408707a2e vfs: Remove an unnecessary if statement
       via  0b070db63b9 lib: Remove unused octal_string()
       via  3f7c6467749 lib: Remove fstring_sub() that was used just once
       via  f9c982b5a96 smbd: Simplify dos_mode_msdfs()
       via  080ded09102 cldap_server: Align integer types
       via  f30f5dd2453 smbd: Simplify is_visible_fsp()
       via  1625dc4b568 tsocket: Fix the build on FreeBSD
       via  6d365777158 nsswitch: Align integer types
       via  c8a37a24f71 smbd: Fix whitespace
      from  4bb3e4df3e4 torture: test that a find with a mangled name works

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


- Log -----------------------------------------------------------------
commit 5d82af05f31bab9bea3de6b6a650a5bcc68e00af
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 30 18:47:21 2022 +0100

    smbd: Remove a few "extern userdom_struct current_user_info"
    
    get_current_username() returns current_user_info.smb_name
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Mon Dec 12 22:14:20 UTC 2022 on sn-devel-184

commit 8cc0489c8040b1c8836e7a54e0561ed69cb87fec
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 30 18:45:06 2022 +0100

    lib: Add get_current_user_info_domain()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 46ce8a47109f3b92ac32d951e414b2e8c80cb5da
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 30 16:28:56 2022 +0100

    lib: Make substitute.c's "remote_proto" static
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 06408707a2e7153668d91eddd6e1d482f843af92
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 30 15:14:08 2022 +0100

    vfs: Remove an unnecessary if statement
    
    get_local_machine_name() already does exactly this
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0b070db63b95cff0dbc055c199890b70b10f7d4b
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 30 14:17:29 2022 +0100

    lib: Remove unused octal_string()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3f7c6467749f868bae66178e34f1badc57be54b1
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 30 14:14:43 2022 +0100

    lib: Remove fstring_sub() that was used just once
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f9c982b5a96bed750bdff0a5243dda73c3d17587
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Dec 6 10:54:48 2022 +0100

    smbd: Simplify dos_mode_msdfs()
    
    Use ISDOT[DOT]
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 080ded091025a4208625eccb142cac5b3c46d320
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 9 16:25:25 2022 +0100

    cldap_server: Align integer types
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f30f5dd24537bc6bb252a141d4f0b6773302335f
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Dec 7 10:49:47 2022 +0100

    smbd: Simplify is_visible_fsp()
    
    We don't need the wrapping if-statement, we check for the individual
    flags. The compiler should be smart enough so that this is not a
    difference in execution speed.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1625dc4b5683ddc06fa6bf77b5b21eed7093862d
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 9 14:48:06 2022 +0100

    tsocket: Fix the build on FreeBSD
    
    FreeBSD does not have TCP_USER_TIMEOUT
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6d365777158e141384acf43667cf6a599c183356
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 9 14:36:04 2022 +0100

    nsswitch: Align integer types
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c8a37a24f716dc98670c3a39b4dc0a3ae4f3852c
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 12 12:53:22 2022 +0100

    smbd: Fix whitespace
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 lib/tsocket/wscript                         | 36 +++++++++++++++++++
 lib/tsocket/wscript_build                   | 21 -----------
 nsswitch/libwbclient/wbc_sid.c              |  3 +-
 selftest/tests.py                           |  7 ++--
 source3/auth/pampass.c                      |  2 +-
 source3/include/proto.h                     |  2 --
 source3/lib/substitute.c                    | 12 ++++++-
 source3/lib/substitute.h                    |  2 ++
 source3/lib/substitute_generic.c            |  5 ---
 source3/lib/util_str.c                      | 18 ----------
 source3/modules/vfs_virusfilter_common.h    |  3 --
 source3/modules/vfs_virusfilter_utils.c     |  6 +---
 source3/param/loadparm.c                    | 14 ++++----
 source3/printing/printing.c                 |  6 ++--
 source3/rpc_server/netlogon/srv_netlog_nt.c |  2 --
 source3/smbd/dir.c                          | 56 ++++++++++++-----------------
 source3/smbd/dosmode.c                      |  3 +-
 source3/smbd/smb1_message.c                 |  6 ++--
 source3/smbd/smb1_negprot.c                 |  5 ++-
 source3/smbd/smb2_negprot.c                 | 16 +++++----
 source3/smbd/smb2_trans2.c                  | 30 ++++++++--------
 source4/cldap_server/rootdse.c              |  2 +-
 wscript                                     |  1 +
 23 files changed, 120 insertions(+), 138 deletions(-)
 create mode 100644 lib/tsocket/wscript
 delete mode 100644 lib/tsocket/wscript_build


Changeset truncated at 500 lines:

diff --git a/lib/tsocket/wscript b/lib/tsocket/wscript
new file mode 100644
index 00000000000..fa284a78f25
--- /dev/null
+++ b/lib/tsocket/wscript
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+def configure(conf):
+    conf.CHECK_CODE('''
+                    #include <netinet/tcp.h>
+                    int main(void) { return TCP_USER_TIMEOUT; }
+                    ''',
+                    'HAVE_TCP_USER_TIMEOUT',
+                    addmain=False,
+                    msg='Checking for TCP_USER_TIMEOUT')
+
+def build(bld):
+    bld.SAMBA_SUBSYSTEM(
+        'LIBTSOCKET',
+	source='tsocket.c tsocket_helpers.c tsocket_bsd.c',
+	public_deps='talloc tevent iov_buf socket-blocking',
+	public_headers='tsocket.h tsocket_internal.h'
+    )
+
+    bld.SAMBA_BINARY(
+        'test_tsocket_bsd_addr',
+        source='tests/test_bsd_addr.c',
+        deps='cmocka replace LIBTSOCKET',
+        local_include=False,
+        for_selftest=True
+    )
+
+    bld.SAMBA_BINARY(
+        'test_tstream',
+        source='tests/test_tstream.c tests/socketpair_tcp.c',
+        deps='cmocka replace LIBTSOCKET',
+        local_include=False,
+        enabled=bld.CONFIG_SET('HAVE_TCP_USER_TIMEOUT'),
+        for_selftest=True
+    )
+
diff --git a/lib/tsocket/wscript_build b/lib/tsocket/wscript_build
deleted file mode 100644
index 73adcb9628d..00000000000
--- a/lib/tsocket/wscript_build
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env python
-
-
-bld.SAMBA_SUBSYSTEM('LIBTSOCKET',
-	source='tsocket.c tsocket_helpers.c tsocket_bsd.c',
-	public_deps='talloc tevent iov_buf socket-blocking',
-	public_headers='tsocket.h tsocket_internal.h',
-	)
-
-bld.SAMBA_BINARY('test_tsocket_bsd_addr',
-                 source='tests/test_bsd_addr.c',
-                 deps='cmocka replace LIBTSOCKET',
-                 local_include=False,
-                 for_selftest=True)
-
-bld.SAMBA_BINARY('test_tstream',
-                 source='tests/test_tstream.c tests/socketpair_tcp.c',
-                 deps='cmocka replace LIBTSOCKET',
-                 local_include=False,
-                 for_selftest=True)
-
diff --git a/nsswitch/libwbclient/wbc_sid.c b/nsswitch/libwbclient/wbc_sid.c
index e4b6376adf3..fd825102950 100644
--- a/nsswitch/libwbclient/wbc_sid.c
+++ b/nsswitch/libwbclient/wbc_sid.c
@@ -529,7 +529,8 @@ wbcErr wbcCtxLookupRids(struct wbcContext *ctx, struct wbcDomainSid *dom_sid,
 		     const char ***pnames,
 		     enum wbcSidType **ptypes)
 {
-	size_t i, len, ridbuf_size;
+	int i;
+	size_t  len, ridbuf_size;
 	char *ridlist;
 	char *p;
 	int error = 0;
diff --git a/selftest/tests.py b/selftest/tests.py
index 60efa5679f8..2cafe2faa4e 100644
--- a/selftest/tests.py
+++ b/selftest/tests.py
@@ -469,9 +469,10 @@ plantestsuite("samba.unittests.credentials", "none",
               [os.path.join(bindir(), "default/auth/credentials/test_creds")])
 plantestsuite("samba.unittests.tsocket_bsd_addr", "none",
               [os.path.join(bindir(), "default/lib/tsocket/test_tsocket_bsd_addr")])
-plantestsuite("samba.unittests.tsocket_tstream", "none",
-              [os.path.join(bindir(), "default/lib/tsocket/test_tstream")],
-              environ={'SOCKET_WRAPPER_DIR': ''})
+if ("HAVE_TCP_USER_TIMEOUT" in config_hash):
+    plantestsuite("samba.unittests.tsocket_tstream", "none",
+                  [os.path.join(bindir(), "default/lib/tsocket/test_tstream")],
+                  environ={'SOCKET_WRAPPER_DIR': ''})
 plantestsuite("samba.unittests.adouble", "none",
               [os.path.join(bindir(), "test_adouble")])
 plantestsuite("samba.unittests.gnutls_aead_aes_256_cbc_hmac_sha512", "none",
diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c
index c3c3d82c77d..c761d3e4fda 100644
--- a/source3/auth/pampass.c
+++ b/source3/auth/pampass.c
@@ -204,7 +204,7 @@ static void special_char_sub(char *buf)
 
 static void pwd_sub(char *buf, const char *username, const char *oldpass, const char *newpass)
 {
-	fstring_sub(buf, "%u", username);
+	string_sub(buf, "%u", username, sizeof(fstring));
 	all_string_sub(buf, "%o", oldpass, sizeof(fstring));
 	all_string_sub(buf, "%n", newpass, sizeof(fstring));
 }
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 8582830d558..3d3cd93d5bc 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -531,7 +531,6 @@ bool trim_char(char *s,char cfront,char cback);
 bool strhasupper(const char *s);
 bool strhaslower(const char *s);
 bool in_list(const char *s, const char *list, bool casesensitive);
-void fstring_sub(char *s,const char *pattern,const char *insert);
 char *realloc_string_sub2(char *string,
 			const char *pattern,
 			const char *insert,
@@ -541,7 +540,6 @@ char *realloc_string_sub(char *string,
 			const char *pattern,
 			const char *insert);
 void all_string_sub(char *s,const char *pattern,const char *insert, size_t len);
-char *octal_string(int i);
 char *string_truncate(char *s, unsigned int length);
 char *strchr_m(const char *src, char c);
 char *strrchr_m(const char *s, char c);
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index a941b89f82a..09cf898ddff 100644
--- a/source3/lib/substitute.c
+++ b/source3/lib/substitute.c
@@ -33,7 +33,12 @@ static char local_machine[MACHINE_NAME_SIZE];
 static char remote_machine[MACHINE_NAME_SIZE];
 
 userdom_struct current_user_info;
-fstring remote_proto="UNKNOWN";
+static fstring remote_proto="UNKNOWN";
+
+void set_remote_proto(const char *proto)
+{
+	fstrcpy(remote_proto, proto);
+}
 
 /**
  * Set the 'local' machine name
@@ -181,6 +186,11 @@ const char *get_current_username(void)
 	return current_user_info.smb_name;
 }
 
+const char *get_current_user_info_domain(void)
+{
+	return current_user_info.domain;
+}
+
 /*******************************************************************
  Given a pointer to a %$(NAME) in p and the whole string in str
  expand it as an environment variable.
diff --git a/source3/lib/substitute.h b/source3/lib/substitute.h
index 2056d163dd7..6596ffdbf0c 100644
--- a/source3/lib/substitute.h
+++ b/source3/lib/substitute.h
@@ -21,6 +21,7 @@
 #ifndef SUBSTITUTE_H
 #define SUBSTITUTE_H
 
+void set_remote_proto(const char *proto);
 bool set_local_machine_name(const char *local_name, bool perm);
 const char *get_local_machine_name(void);
 bool set_remote_machine_name(const char *remote_name, bool perm);
@@ -31,6 +32,7 @@ void set_current_user_info(const char *smb_name,
 			   const char *unix_name,
 			   const char *domain);
 const char *get_current_username(void);
+const char *get_current_user_info_domain(void);
 void standard_sub_basic(const char *smb_name,
 			const char *domain_name,
 			char *str,
diff --git a/source3/lib/substitute_generic.c b/source3/lib/substitute_generic.c
index 0498cd03833..26c5ee761f8 100644
--- a/source3/lib/substitute_generic.c
+++ b/source3/lib/substitute_generic.c
@@ -24,11 +24,6 @@
 
 #include "includes.h"
 
-void fstring_sub(char *s,const char *pattern,const char *insert)
-{
-	string_sub(s, pattern, insert, sizeof(fstring));
-}
-
 /**
  Similar to string_sub2, but it will accept only allocated strings
  and may realloc them so pay attention at what you pass on no
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 9362969795e..3ac1e554246 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -181,24 +181,6 @@ bool in_list(const char *s, const char *list, bool casesensitive)
 	return ret;
 }
 
-/**
- Write an octal as a string.
-**/
-
-char *octal_string(int i)
-{
-	char *result;
-	if (i == -1) {
-		result = talloc_strdup(talloc_tos(), "-1");
-	}
-	else {
-		result = talloc_asprintf(talloc_tos(), "0%o", i);
-	}
-	SMB_ASSERT(result != NULL);
-	return result;
-}
-
-
 /**
  Truncate a string at a specified length.
 **/
diff --git a/source3/modules/vfs_virusfilter_common.h b/source3/modules/vfs_virusfilter_common.h
index 463a9d74e9c..24359bf5a3a 100644
--- a/source3/modules/vfs_virusfilter_common.h
+++ b/source3/modules/vfs_virusfilter_common.h
@@ -39,9 +39,6 @@
 #define DBGC_CLASS virusfilter_debug_class
 extern int virusfilter_debug_class;
 
-/* Samba's global variable */
-extern userdom_struct current_user_info;
-
 #define VIRUSFILTER_VERSION "0.1.5"
 
 /* ====================================================================== */
diff --git a/source3/modules/vfs_virusfilter_utils.c b/source3/modules/vfs_virusfilter_utils.c
index b8b44eb203b..4da0503eef0 100644
--- a/source3/modules/vfs_virusfilter_utils.c
+++ b/source3/modules/vfs_virusfilter_utils.c
@@ -956,10 +956,6 @@ int virusfilter_shell_set_conn_env(
 	fstring pidstr;
 	int ret;
 
-	if (local_machine_name == NULL || *local_machine_name == '\0') {
-		local_machine_name = lp_netbios_name();
-	}
-
 	server_addr_p = tsocket_address_inet_addr_string(
 				conn->sconn->local_address, talloc_tos());
 
@@ -1009,7 +1005,7 @@ int virusfilter_shell_set_conn_env(
 	virusfilter_env_set(mem_ctx, env_list, "VIRUSFILTER_USER_NAME",
 			    get_current_username());
 	virusfilter_env_set(mem_ctx, env_list, "VIRUSFILTER_USER_DOMAIN",
-			    current_user_info.domain);
+			    get_current_user_info_domain());
 
 	return 0;
 }
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 79041908e3d..3429ecbe5e4 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -85,8 +85,6 @@
 
 bool bLoaded = false;
 
-extern userdom_struct current_user_info;
-
 /* the special value for the include parameter
  * to be interpreted not as a file name but to
  * trigger loading of the global smb.conf options
@@ -1051,14 +1049,14 @@ static char *loadparm_s3_global_substitution_fn(
 
 	ret = talloc_sub_basic(mem_ctx,
 			get_current_username(),
-			current_user_info.domain,
+			get_current_user_info_domain(),
 			s);
 	if (trim_char(ret, '\"', '\"')) {
 		if (strchr(ret,'\"') != NULL) {
 			TALLOC_FREE(ret);
 			ret = talloc_sub_basic(mem_ctx,
 					get_current_username(),
-					current_user_info.domain,
+					get_current_user_info_domain(),
 					s);
 		}
 	}
@@ -2411,7 +2409,7 @@ bool lp_file_list_changed(void)
 
 			n2 = talloc_sub_basic(talloc_tos(),
 					      get_current_username(),
-					      current_user_info.domain,
+					      get_current_user_info_domain(),
 					      f->name);
 			if (!n2) {
 				return false;
@@ -2499,7 +2497,7 @@ bool lp_include(struct loadparm_context *lp_ctx, struct loadparm_service *servic
 	}
 
 	fname = talloc_sub_basic(talloc_tos(), get_current_username(),
-				 current_user_info.domain,
+				 get_current_user_info_domain(),
 				 pszParmValue);
 
 	add_to_file_list(NULL, &file_lists, pszParmValue, fname);
@@ -4002,7 +4000,7 @@ static bool lp_load_ex(const char *pszFname,
 
 	if (lp_config_backend_is_file()) {
 		n2 = talloc_sub_basic(talloc_tos(), get_current_username(),
-					current_user_info.domain,
+					get_current_user_info_domain(),
 					pszFname);
 		if (!n2) {
 			smb_panic("lp_load_ex: out of memory");
@@ -4318,7 +4316,7 @@ int lp_servicenumber(const char *pszServiceName)
 			 */
 			fstrcpy(serviceName, ServicePtrs[iService]->szService);
 			standard_sub_basic(get_current_username(),
-					   current_user_info.domain,
+					   get_current_user_info_domain(),
 					   serviceName,sizeof(serviceName));
 			if (strequal(serviceName, pszServiceName)) {
 				break;
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index dbe5a20e382..f7911244398 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1592,7 +1592,7 @@ static void print_queue_update(struct messaging_context *msg_ctx,
 			"",
 			get_current_gid(NULL),
 			get_current_username(),
-			current_user_info.domain,
+			get_current_user_info_domain(),
 			lpqcommand);
 	if (!lpqcommand) {
 		return;
@@ -1612,7 +1612,7 @@ static void print_queue_update(struct messaging_context *msg_ctx,
 			"",
 			get_current_gid(NULL),
 			get_current_username(),
-			current_user_info.domain,
+			get_current_user_info_domain(),
 			lprmcommand);
 	if (!lprmcommand) {
 		return;
@@ -2850,7 +2850,7 @@ NTSTATUS print_job_end(struct messaging_context *msg_ctx, int snum,
 				      "",
 				      get_current_gid(NULL),
 				      get_current_username(),
-				      current_user_info.domain,
+				      get_current_user_info_domain(),
 				      lpq_cmd);
 	if (lpq_cmd == NULL) {
 		status = NT_STATUS_PRINT_CANCELLED;
diff --git a/source3/rpc_server/netlogon/srv_netlog_nt.c b/source3/rpc_server/netlogon/srv_netlog_nt.c
index cc92c84cc07..ba169fbbe52 100644
--- a/source3/rpc_server/netlogon/srv_netlog_nt.c
+++ b/source3/rpc_server/netlogon/srv_netlog_nt.c
@@ -52,8 +52,6 @@
 #include "lib/util/util_str_escape.h"
 #include "source3/lib/substitute.h"
 
-extern userdom_struct current_user_info;
-
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_SRV
 
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 96885f89d9e..eb263132adf 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1423,42 +1423,30 @@ bool is_visible_fsp(struct files_struct *fsp)
 		return true;
 	}
 
-	if (hide_unreadable ||
-	    hide_unwriteable ||
-	    hide_special ||
-	    (hide_new_files_timeout != 0))
-	{
-		/* Honour _hide unreadable_ option */
-		if (hide_unreadable &&
-		    !user_can_read_fsp(fsp))
-		{
-			DBG_DEBUG("file %s is unreadable.\n",
-				 fsp_str_dbg(fsp));
-			return false;
-		}
-		/* Honour _hide unwriteable_ option */
-		if (hide_unwriteable &&
-		    !user_can_write_fsp(fsp))
-		{
-			DBG_DEBUG("file %s is unwritable.\n",
-				 fsp_str_dbg(fsp));
-			return false;
-		}
-		/* Honour _hide_special_ option */
-		if (hide_special && file_is_special(fsp->conn, fsp->fsp_name)) {
-			DBG_DEBUG("file %s is special.\n",
-				 fsp_str_dbg(fsp));
-			return false;
-		}
+	/* Honour _hide unreadable_ option */
+	if (hide_unreadable && !user_can_read_fsp(fsp)) {
+		DBG_DEBUG("file %s is unreadable.\n", fsp_str_dbg(fsp));
+		return false;
+	}
 
-		if ((hide_new_files_timeout != 0) &&
-		    !S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
-			double age = timespec_elapsed(
-				&fsp->fsp_name->st.st_ex_mtime);
+	/* Honour _hide unwriteable_ option */
+	if (hide_unwriteable && !user_can_write_fsp(fsp)) {
+		DBG_DEBUG("file %s is unwritable.\n", fsp_str_dbg(fsp));
+		return false;
+	}
 
-			if (age < (double)hide_new_files_timeout) {
-				return false;
-			}
+	/* Honour _hide_special_ option */
+	if (hide_special && file_is_special(fsp->conn, fsp->fsp_name)) {
+		DBG_DEBUG("file %s is special.\n", fsp_str_dbg(fsp));
+		return false;
+	}
+
+	if ((hide_new_files_timeout != 0) &&
+	    !S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
+		double age = timespec_elapsed(&fsp->fsp_name->st.st_ex_mtime);
+
+		if (age < (double)hide_new_files_timeout) {
+			return false;
 		}
 	}
 
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 2e3aa0934a7..4168eb209c7 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -554,8 +554,7 @@ uint32_t dos_mode_msdfs(connection_struct *conn,
 		}
 
 		/* Only . and .. are not hidden. */
-		if (p[0] == '.' && !((p[1] == '\0') ||
-				(p[1] == '.' && p[2] == '\0'))) {
+		if ((p[0] == '.') && !(ISDOT(p) || ISDOTDOT(p))) {
 			result |= FILE_ATTRIBUTE_HIDDEN;
 		}
 	}
diff --git a/source3/smbd/smb1_message.c b/source3/smbd/smb1_message.c
index 6894aa52ec0..928be77f854 100644
--- a/source3/smbd/smb1_message.c
+++ b/source3/smbd/smb1_message.c
@@ -29,8 +29,6 @@
 #include "smbprofile.h"
 #include "source3/lib/substitute.h"
 
-extern userdom_struct current_user_info;
-
 struct msg_state {
 	char *from;
 	char *to;
@@ -122,8 +120,8 @@ static void msg_deliver(struct msg_state *state)
 		goto done;
 	}
 
-	s = talloc_sub_basic(talloc_tos(), current_user_info.smb_name,
-			     current_user_info.domain, s);
+	s = talloc_sub_basic(talloc_tos(), get_current_username(),
+			     get_current_user_info_domain(), s);
 	if (s == NULL) {
 		goto done;
 	}
diff --git a/source3/smbd/smb1_negprot.c b/source3/smbd/smb1_negprot.c
index 45d991b0dcd..db6cf629d9c 100644
--- a/source3/smbd/smb1_negprot.c
+++ b/source3/smbd/smb1_negprot.c
@@ -28,6 +28,7 @@
 #include "auth/gensec/gensec.h"
 #include "../libcli/smb/smb_signing.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 /*
  * MS-CIFS, 2.2.4.52.2 SMB_COM_NEGOTIATE Response:
@@ -36,8 +37,6 @@
  */
 #define NO_PROTOCOL_CHOSEN	0xffff
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list