[SCM] Samba Shared Repository - branch v4-11-test updated

Karolin Seeger kseeger at samba.org
Mon Nov 4 09:32:02 UTC 2019


The branch, v4-11-test has been updated
       via  2958016c30a replace: Only link libnsl and libsocket if requrired
       via  4aa37b8e722 s3: torture: Ensure SMB1 cli_qpathinfo2() doesn't return an inode number.
       via  509f11547f3 s3: libsmb: Ensure SMB1 cli_qpathinfo2() doesn't return an inode number.
      from  e704eee3083 VERSION: Bump version up to 4.11.3.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-11-test


- Log -----------------------------------------------------------------
commit 2958016c30a8d9f80a45b64e91a20d8ebf995d85
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Oct 21 17:08:08 2019 +0200

    replace: Only link libnsl and libsocket if requrired
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14168
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Wed Oct 23 08:23:13 UTC 2019 on sn-devel-184
    
    (cherry picked from commit 263bec1b8d0744da73dd92e4a361fb7430289ab3)
    
    Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-11-test): Mon Nov  4 09:31:23 UTC 2019 on sn-devel-184

commit 4aa37b8e722d0ee7c7417b33ea62e7a66151a867
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Oct 17 12:41:08 2019 -0700

    s3: torture: Ensure SMB1 cli_qpathinfo2() doesn't return an inode number.
    
    Piggyback on existing tests, ensure we don't regress on:
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14161
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit 8e55a8562951924e4b1aad5a6d67fc8b309590c1)

commit 509f11547f3eee151e16f14a17c58d193cf81993
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Oct 17 11:39:02 2019 -0700

    s3: libsmb: Ensure SMB1 cli_qpathinfo2() doesn't return an inode number.
    
    The info level it uses doesn't return that, previously we
    were using the field that is returned as the EA size as
    the inode number (which is usually zero, so the code in
    libsmbclient would then synthesize an inode number from
    a hash of the pathname, which is all it can do for SMB1).
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14161
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit d495074ee27a5f528d5156a69800ee58d799b1eb)

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

Summary of changes:
 lib/replace/wscript       | 36 +++++++++++++++++++++++++++++-----
 source3/libsmb/clirap.c   | 10 +++++++++-
 source3/torture/torture.c | 49 +++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 87 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/replace/wscript b/lib/replace/wscript
index 240d730cbee..56e2a22de49 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -190,10 +190,35 @@ def configure(conf):
     conf.CHECK_TYPE_IN('sig_atomic_t', 'signal.h', define='HAVE_SIG_ATOMIC_T_TYPE')
     conf.CHECK_FUNCS('sigsetmask siggetmask sigprocmask sigblock sigaction sigset')
 
-    conf.CHECK_FUNCS_IN('''inet_ntoa inet_aton inet_ntop inet_pton connect gethostbyname
-                           getaddrinfo getnameinfo freeaddrinfo gai_strerror socketpair''',
-                        'socket nsl', checklibc=True,
-                        headers='sys/socket.h netinet/in.h arpa/inet.h netdb.h')
+    # Those functions are normally available in libc
+    if not conf.CHECK_FUNCS('''
+                            inet_ntoa
+                            inet_aton
+                            inet_ntop
+                            inet_pton
+                            connect
+                            gethostbyname
+                            getaddrinfo
+                            getnameinfo
+                            freeaddrinfo
+                            gai_strerror
+                            socketpair''',
+                            headers='sys/socket.h netinet/in.h arpa/inet.h netdb.h'):
+        conf.CHECK_FUNCS_IN('''
+                            inet_ntoa
+                            inet_aton
+                            inet_ntop
+                            inet_pton
+                            connect
+                            gethostbyname
+                            getaddrinfo
+                            getnameinfo
+                            freeaddrinfo
+                            gai_strerror
+                            socketpair''',
+                            'socket nsl',
+                            headers='sys/socket.h netinet/in.h arpa/inet.h netdb.h')
+        conf.DEFINE('REPLACE_REQUIRES_LIBSOCKET_LIBNSL', 1)
 
     conf.CHECK_FUNCS('memset_s memset_explicit')
 
@@ -836,6 +861,7 @@ def build(bld):
     extra_libs = ''
     if bld.CONFIG_SET('HAVE_LIBBSD'): extra_libs += ' bsd'
     if bld.CONFIG_SET('HAVE_LIBRT'): extra_libs += ' rt'
+    if bld.CONFIG_SET('REPLACE_REQUIRES_LIBSOCKET_LIBNSL'): extra_libs += ' socket nsl'
 
     bld.SAMBA_SUBSYSTEM('LIBREPLACE_HOSTCC',
         REPLACE_HOSTCC_SOURCE,
@@ -876,7 +902,7 @@ def build(bld):
                       # at the moment:
                       # hide_symbols=bld.BUILTIN_LIBRARY('replace'),
                       private_library=True,
-                      deps='crypt dl nsl socket attr' + extra_libs)
+                      deps='crypt dl attr' + extra_libs)
 
     replace_test_cflags = ''
     if bld.CONFIG_SET('HAVE_WNO_FORMAT_TRUNCATION'):
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index e80dfc92a77..b4b40ebdab4 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -855,7 +855,15 @@ NTSTATUS cli_qpathinfo2_recv(struct tevent_req *req,
                 *size = IVAL2_TO_SMB_BIG_UINT(state->data,48);
 	}
 	if (ino) {
-		*ino = IVAL(state->data, 64);
+		/*
+		 * SMB1 qpathinfo2 uses SMB_QUERY_FILE_ALL_INFO
+		 * which doesn't return an inode number (fileid).
+		 * We can't change this to one of the FILE_ID
+		 * info levels as only Win2003 and above support
+		 * these [MS-SMB: 2.2.2.3.1] and the SMB1 code
+		 * needs to support older servers.
+		 */
+		*ino = 0;
 	}
 	return NT_STATUS_OK;
 }
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 66dc0cf4d1c..a795e61125f 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -4211,6 +4211,7 @@ static bool run_trans2test(int dummy)
 	bool correct = True;
 	NTSTATUS status;
 	uint32_t fs_attr;
+	uint64_t ino;
 
 	printf("starting trans2 test\n");
 
@@ -4218,6 +4219,14 @@ static bool run_trans2test(int dummy)
 		return False;
 	}
 
+	if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
+		/* Ensure ino is zero, SMB2 gets a real one. */
+		ino = 0;
+	} else {
+		/* Ensure ino is -1, SMB1 never gets a real one. */
+		ino = (uint64_t)-1;
+	}
+
 	status = cli_get_fs_attr_info(cli, &fs_attr);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("ERROR: cli_get_fs_attr_info returned %s\n",
@@ -4289,7 +4298,7 @@ static bool run_trans2test(int dummy)
 			O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum);
 	cli_close(cli, fnum);
 	status = cli_qpathinfo2(cli, fname, &c_time_ts, &a_time_ts, &w_time_ts,
-				&m_time_ts, &size, NULL, NULL);
+				&m_time_ts, &size, NULL, &ino);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("ERROR: qpathinfo2 failed (%s)\n", nt_errstr(status));
 		correct = False;
@@ -4299,6 +4308,19 @@ static bool run_trans2test(int dummy)
 			printf("This system appears to set a initial 0 write time\n");
 			correct = False;
 		}
+		if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
+			/* SMB2 should always return an inode. */
+			if (ino == 0) {
+				printf("SMB2 bad inode (0)\n");
+				correct = false;
+			}
+		} else {
+			/* SMB1 must always return zero here. */
+			if (ino != 0) {
+				printf("SMB1 bad inode (!0)\n");
+				correct = false;
+			}
+		}
 	}
 
 	cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
@@ -11593,11 +11615,20 @@ static bool run_dir_createtime(int dummy)
 	struct timespec create_time1;
 	uint16_t fnum;
 	bool ret = false;
+	uint64_t ino;
 
 	if (!torture_open_connection(&cli, 0)) {
 		return false;
 	}
 
+	if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
+		/* Ensure ino is zero, SMB2 gets a real one. */
+		ino = 0;
+	} else {
+		/* Ensure ino is -1, SMB1 never gets a real one. */
+		ino = (uint64_t)-1;
+	}
+
 	cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 	cli_rmdir(cli, dname);
 
@@ -11608,13 +11639,27 @@ static bool run_dir_createtime(int dummy)
 	}
 
 	status = cli_qpathinfo2(cli, dname, &create_time, NULL, NULL, NULL,
-				NULL, NULL, NULL);
+				NULL, NULL, &ino);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("cli_qpathinfo2 returned %s\n",
 		       nt_errstr(status));
 		goto out;
 	}
 
+	if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
+		/* SMB2 should always return an inode. */
+		if (ino == 0) {
+			printf("SMB2 bad inode (0)\n");
+			goto out;
+		}
+	} else {
+		/* SMB1 must always return zero here. */
+		if (ino != 0) {
+			printf("SMB1 bad inode (!0)\n");
+			goto out;
+		}
+	}
+
 	/* Sleep 3 seconds, then create a file. */
 	sleep(3);
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list