[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Thu Mar 18 08:08:35 MDT 2010


The branch, master has been updated
       via  05cad2e... s3-selftest: make sure we do not have duplicate uids/gids in nsswrapper.
       via  38a46fa... s3-selftest: make sure we do not have duplicate uids/gids in nsswrapper.
      from  6a1f8e6... libcli/util: add more NT_STATUS_RPC_* defines

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


- Log -----------------------------------------------------------------
commit 05cad2ea2f0963e7845b451d97830528c86e2cda
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 18 12:12:58 2010 +0100

    s3-selftest: make sure we do not have duplicate uids/gids in nsswrapper.
    
    Also make sure we only add root user when needed, Jeremy please check.
    
    Guenther

commit 38a46fa32bfd8007f0fb3e2b607d0e57a012ae95
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 18 11:27:36 2010 +0100

    s3-selftest: make sure we do not have duplicate uids/gids in nsswrapper.
    
    Guenther

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

Summary of changes:
 selftest/target/Samba3.pm        |   38 +++++++++++++++++++++++++++----
 source3/script/tests/selftest.sh |   46 +++++++++++++++++++++++++------------
 2 files changed, 64 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index cc7713d..a3faafc 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -549,19 +549,47 @@ sub provision($$$$$$)
 	## create a test account
 	##
 
+	my $max_uid, $max_gid;
+	my $uid_nobody, $uid_root;
+	my $gid_nobody, $gid_nogroup, $gid_root;
+
+	if ($unix_uid < 0xffff - 2) {
+		$max_uid = 0xffff;
+	} else {
+		$max_uid = $unix_uid;
+	}
+
+	$uid_root = $max_uid - 1;
+	$uid_nobody = $max_uid - 2;
+
+	if ($unix_gids[0] < 0xffff - 3) {
+		$max_gid = 0xffff;
+	} else {
+		$max_gid = $unix_gids[0];
+	}
+
+	$gid_nobody = $max_gid - 1;
+	$gid_nogroup = $max_gid - 2;
+	$gid_root = $max_gid - 3;
+
 	open(PASSWD, ">$nss_wrapper_passwd") or die("Unable to open $nss_wrapper_passwd");
-	print PASSWD "nobody:x:65534:65533:nobody gecos:$prefix_abs:/bin/false
-root:x:65533:65532:root gecos:$prefix_abs:/bin/false
+	print PASSWD "nobody:x:$uid_nobody:$gid_nobody:nobody gecos:$prefix_abs:/bin/false
 $unix_name:x:$unix_uid:$unix_gids[0]:$unix_name gecos:$prefix_abs:/bin/false
 ";
+	if ($unix_uid != 0) {
+		print PASSWD "root:x:$uid_root:$gid_root:root gecos:$prefix_abs:/bin/false";
+	}
 	close(PASSWD);
 
 	open(GROUP, ">$nss_wrapper_group") or die("Unable to open $nss_wrapper_group");
-	print GROUP "nobody:x:65533:
-nogroup:x:65534:nobody
-root:x:65532:
+	print GROUP "nobody:x:$gid_nobody:
+nogroup:x:$gid_nogroup:nobody
 $unix_name-group:x:$unix_gids[0]:
 ";
+	if ($unix_gids[0] != 0) {
+		print GROUP "root:x:$gid_root:";
+	}
+
 	close(GROUP);
 
 	foreach my $evlog (@eventlog_list) {
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index e481c7e..b4ef432 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -325,33 +325,49 @@ EOF
 ## create a test account
 ##
 
-if [ "$USERID" != 0 ]; then
+if [ $USERID -lt $(( 0xffff - 2 )) ]; then
+	MAXUID=0xffff
+else
+	MAXUID=$USERID
+fi
+
+UID_ROOT=$(( $MAXUID - 1 ))
+UID_NOBODY=$(( MAXUID - 2 ))
+
+if [ $GROUPID -lt $(( 0xffff - 3 )) ]; then
+	MAXGID=0xffff
+else
+	MAXGID=$GROUPID
+fi
+
+GID_NOBODY=$(( $MAXGID - 3 ))
+GID_NOGROUP=$(( $MAXGID - 2 ))
+GID_ROOT=$(( $MAXGID - 1 ))
+
 cat >$NSS_WRAPPER_PASSWD<<EOF
-root:x:65533:65532:root gecos:$PREFIX_ABS:/bin/false
-nobody:x:65534:65533:nobody gecos:$PREFIX_ABS:/bin/false
+nobody:x:$UID_NOBODY:$GID_NOBODY:nobody gecos:$PREFIX_ABS:/bin/false
 $USERNAME:x:$USERID:$GROUPID:$USERNAME gecos:$PREFIX_ABS:/bin/false
 EOF
 
 cat >$NSS_WRAPPER_GROUP<<EOF
-nobody:x:65533:
-nogroup:x:65534:nobody
-root:x:65532:
+nobody:x:$GID_NOBODY:
+nogroup:x:$GID_NOGROUP:nobody
 $USERNAME-group:x:$GROUPID:
 EOF
-else
+
 ##
-## Running as root...
+## add fake root user when not running as root
 ##
-cat >$NSS_WRAPPER_PASSWD<<EOF
-$USERNAME:x:$USERID:$GROUPID:$USERNAME gecos:$PREFIX_ABS:/bin/false
-nobody:x:65534:65533:nobody gecos:$PREFIX_ABS:/bin/false
+if [ "$USERID" != 0 ]; then
+
+cat >>$NSS_WRAPPER_PASSWD<<EOF
+root:x:$UID_ROOT:$GID_ROOT:root gecos:$PREFIX_ABS:/bin/false
 EOF
 
-cat >$NSS_WRAPPER_GROUP<<EOF
-$USERNAME-group:x:$GROUPID:
-nobody:x:65533:
-nogroup:x:65534:nobody
+cat >>$NSS_WRAPPER_GROUP<<EOF
+root:x:$GID_ROOT:
 EOF
+
 fi
 
 touch $EVENTLOGDIR/dns\ server.tdb


-- 
Samba Shared Repository


More information about the samba-cvs mailing list