[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Wed Jul 4 21:56:03 UTC 2018


The branch, master has been updated
       via  9f28d30 s3:winbind: Do not lookup local system accounts in AD
       via  8e96e9e nsswitch: Add tests to lookup user via getpwnam
       via  e311801 lib: smb_threads: fix access before init bug
      from  a958dc3 samba-gpupdate: Change machine option to target

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


- Log -----------------------------------------------------------------
commit 9f28d30633af721efec02d8816a9fa48f795a01c
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Jul 2 16:38:01 2018 +0200

    s3:winbind: Do not lookup local system accounts in AD
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13503
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Wed Jul  4 23:55:56 CEST 2018 on sn-devel-144

commit 8e96e9ea46351de34ad5cac9a9a9ece4226b462c
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Jul 2 16:18:52 2018 +0200

    nsswitch: Add tests to lookup user via getpwnam
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13503
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit e311801e0e7171a2b50e39d3e0c2d2137f8b3d7e
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Jul 3 15:30:33 2018 +0200

    lib: smb_threads: fix access before init bug
    
    talloc_stackframe_internal() calls SMB_THREAD_GET_TLS(global_ts)  which
    calls smb_get_tls_pthread() in the POSIX pthread wrapper implementation.
    
    If SMB_THREAD_SET_TLS() hasn't been called before, global_ts is NULL and
    smb_get_tls_pthread dereferences it so it crashes.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13505
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 lib/util/smb_threads.h                  |  3 ++
 nsswitch/tests/test_wbinfo_user_info.sh | 71 ++++++++++++++++++++++++++++-----
 source3/selftest/tests.py               |  4 +-
 source3/winbindd/winbindd_util.c        |  2 +
 4 files changed, 69 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/smb_threads.h b/lib/util/smb_threads.h
index 9a09616..67d05b8 100644
--- a/lib/util/smb_threads.h
+++ b/lib/util/smb_threads.h
@@ -119,6 +119,9 @@ static int smb_set_tls_pthread(void *pkey, const void *pval, const char *locatio
  \
 static void *smb_get_tls_pthread(void *pkey, const char *location) \
 { \
+	if (pkey == NULL) { \
+		return NULL; \
+	} \
         return pthread_getspecific(*(pthread_key_t *)pkey); \
 } \
  \
diff --git a/nsswitch/tests/test_wbinfo_user_info.sh b/nsswitch/tests/test_wbinfo_user_info.sh
index 2803ac1..da30f97 100755
--- a/nsswitch/tests/test_wbinfo_user_info.sh
+++ b/nsswitch/tests/test_wbinfo_user_info.sh
@@ -2,19 +2,20 @@
 # Blackbox test for wbinfo lookup for account name and upn
 # Copyright (c) 2018 Andreas Schneider <asn at samba.org>
 
-if [ $# -lt 5 ]; then
+if [ $# -lt 6 ]; then
 cat <<EOF
-Usage: $(basename $0) DOMAIN REALM USERNAME1 UPN_NAME1 USERNAME2 UPN_NAME2
+Usage: $(basename $0) DOMAIN REALM OWN_DOMAIN USERNAME1 UPN_NAME1 USERNAME2 UPN_NAME2
 EOF
 exit 1;
 fi
 
 DOMAIN=$1
 REALM=$2
-USERNAME1=$3
-UPN_NAME1=$4
-USERNAME2=$5
-UPN_NAME2=$6
+OWN_DOMAIN=$3
+USERNAME1=$4
+UPN_NAME1=$5
+USERNAME2=$6
+UPN_NAME2=$7
 shift 6
 
 failed=0
@@ -31,9 +32,9 @@ test_user_info()
 {
 	local cmd out ret user domain upn userinfo
 
-	domain="$1"
-	user="$2"
-	upn="$3"
+	local domain="$1"
+	local user="$2"
+	local upn="$3"
 
 	if [ $# -lt 3 ]; then
 		userinfo="$domain/$user"
@@ -62,6 +63,39 @@ test_user_info()
 	return 0
 }
 
+test_getpwnam()
+{
+	local cmd out ret
+
+	local lookup_username=$1
+	local expected_return=$2
+	local expected_output=$3
+
+	cmd='getent passwd $lookup_username'
+	eval echo "$cmd"
+	out=$(eval $cmd)
+	ret=$?
+
+	if [ $ret -ne $expected_return ]; then
+		echo "return code: $ret, expected return code is: $expected_return"
+		echo "$out"
+		return 1
+	fi
+
+	if [ -n "$expected_output" ]; then
+		echo "$out" | grep "$expected_output"
+		ret=$?
+
+		if [ $ret -ne 0 ]; then
+			echo "Unable to find $expected_output in:"
+			echo "$out"
+			return 1
+		fi
+	fi
+
+	return 0
+}
+
 testit "name_to_sid.domain.$USERNAME1" $wbinfo_tool --name-to-sid $DOMAIN/$USERNAME1 || failed=$(expr $failed + 1)
 testit "name_to_sid.upn.$UPN_NAME1" $wbinfo_tool --name-to-sid $UPN1 || failed=$(expr $failed + 1)
 
@@ -80,4 +114,23 @@ UPN3="$UPN_NAME3@${REALM}.upn"
 testit "name_to_sid.upn.$UPN_NAME3" $wbinfo_tool --name-to-sid $UPN3 || failed=$(expr $failed + 1)
 testit "user_info.upn.$UPN_NAME3" test_user_info $DOMAIN $USERNAME3 $UPN3 || failed=$(expr $failed + 1)
 
+testit "getpwnam.domain.$DOMAIN.$USERNAME1" test_getpwnam "$DOMAIN/$USERNAME1" 0 "$DOMAIN/$USERNAME1" || failed=$(expr $failed + 1)
+
+testit "getpwnam.upn.$UPN_NAME1" test_getpwnam "$UPN1" 0 "$DOMAIN/$USERNAME1" || failed=$(expr $failed + 1)
+
+# We should not be able to lookup the user just by the name
+test_ret=0
+test_output="$DOMAIN/$USERNAME1"
+
+if [ "$ENVNAME" = "ad_member" ]; then
+	test_ret=2
+	test_output=""
+fi
+if [ "$ENVNAME" = "fl2008r2dc" ]; then
+	test_ret=0
+	test_output="$OWN_DOMAIN/$USERNAME1"
+fi
+
+testit "getpwnam.local.$USERNAME1" test_getpwnam "$USERNAME1" $test_ret $test_output || failed=$(expr $failed + 1)
+
 exit $failed
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 983f0ac..c5356d8 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -219,13 +219,13 @@ env = "ad_member:local"
 plantestsuite("samba3.wbinfo_user_info", env,
               [ os.path.join(srcdir(),
                             "nsswitch/tests/test_wbinfo_user_info.sh"),
-                '$DOMAIN', '$REALM', 'alice', 'alice', 'jane', 'jane.doe' ])
+                '$DOMAIN', '$REALM', '$DOMAIN', 'alice', 'alice', 'jane', 'jane.doe' ])
 
 env = "fl2008r2dc:local"
 plantestsuite("samba3.wbinfo_user_info", env,
               [ os.path.join(srcdir(),
                             "nsswitch/tests/test_wbinfo_user_info.sh"),
-                '$TRUST_DOMAIN', '$TRUST_REALM', 'alice', 'alice', 'jane', 'jane.doe' ])
+                '$TRUST_DOMAIN', '$TRUST_REALM', '$DOMAIN', 'alice', 'alice', 'jane', 'jane.doe' ])
 
 env = "ad_member"
 t = "WBCLIENT-MULTI-PING"
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index 71735ed..f913d39 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -1605,6 +1605,8 @@ bool parse_domain_user(const char *domuser,
 		} else if (assume_domain(lp_workgroup())) {
 			fstrcpy(domain, lp_workgroup());
 			fstrcpy(namespace, domain);
+		} else {
+			fstrcpy(namespace, lp_netbios_name());
 		}
 	}
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list