[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Fri Mar 19 03:34:26 MDT 2010


The branch, master has been updated
       via  53d35fc... s3-selftest: rearrange uid/gid calculation to achieve correct membership.
       via  20d73f7... s3-selftest: rearrange uid/gid calculation to achieve correct membership.
       via  f067796... nss_wrapper.pl: allow to specify gid for new users.
      from  e7cc45c... error_codes: fix NT_STATUS_RPC_UNKNOWN_IF typo.

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


- Log -----------------------------------------------------------------
commit 53d35fc9587234c4d72b9622fc5144d50ba47a80
Author: Günther Deschner <gd at samba.org>
Date:   Fri Mar 19 10:33:54 2010 +0100

    s3-selftest: rearrange uid/gid calculation to achieve correct membership.
    
    (make test variant)
    
    Guenther

commit 20d73f768d002faf62f760f99c608f139b229491
Author: Günther Deschner <gd at samba.org>
Date:   Fri Mar 19 10:23:39 2010 +0100

    s3-selftest: rearrange uid/gid calculation to achieve correct membership.
    
    Guenther

commit f06779629db8f810f1ff8ad8f16ac2b580052b2c
Author: Günther Deschner <gd at samba.org>
Date:   Fri Mar 19 09:50:56 2010 +0100

    nss_wrapper.pl: allow to specify gid for new users.
    
    Guenther

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

Summary of changes:
 lib/nss_wrapper/nss_wrapper.pl   |   45 +++++++++++++++-------------
 selftest/target/Samba3.pm        |   58 +++++++++++++++++++++----------------
 source3/script/tests/selftest.sh |   46 ++++++++++++++++-------------
 3 files changed, 82 insertions(+), 67 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/nss_wrapper/nss_wrapper.pl b/lib/nss_wrapper/nss_wrapper.pl
index 1f1aef1..48fa2c5 100644
--- a/lib/nss_wrapper/nss_wrapper.pl
+++ b/lib/nss_wrapper/nss_wrapper.pl
@@ -13,18 +13,19 @@ my $opt_action = undef;
 my $opt_type = undef;
 my $opt_name = undef;
 my $opt_member = undef;
+my $opt_gid = 65534;# nogroup gid
 
 my $passwdfn = undef;
 my $groupfn = undef;
 my $memberfn = undef;
 my $actionfn = undef;
 
-sub passwd_add($$$$);
-sub passwd_delete($$$$);
-sub group_add($$$$);
-sub group_delete($$$$);
-sub member_add($$$$);
-sub member_delete($$$$);
+sub passwd_add($$$$$);
+sub passwd_delete($$$$$);
+sub group_add($$$$$);
+sub group_delete($$$$$);
+sub member_add($$$$$);
+sub member_delete($$$$$);
 
 sub check_path($$);
 
@@ -35,7 +36,8 @@ my $result = GetOptions(
 	'action=s'	=> \$opt_action,
 	'type=s'	=> \$opt_type,
 	'name=s'	=> \$opt_name,
-	'member=s'	=> \$opt_member
+	'member=s'	=> \$opt_member,
+	'gid=i'		=> \$opt_gid
 );
 
 sub usage($;$)
@@ -58,6 +60,8 @@ sub usage($;$)
 	--name <name>		The name of the object.
 
 	--member <member>	The name of the member.
+
+	--gid <gid>		Primary Group ID for new users.
 ";
 	exit($ret);
 }
@@ -110,7 +114,7 @@ if ($opt_name eq "") {
 	usage(1, "invalid: --name <name>");
 }
 
-exit $actionfn->($opt_fullpath_passwd, $opt_member, $opt_fullpath_group, $opt_name);
+exit $actionfn->($opt_fullpath_passwd, $opt_member, $opt_fullpath_group, $opt_name, $opt_gid);
 
 sub check_path($$)
 {
@@ -388,9 +392,9 @@ sub group_save($)
 	rename($tmppath, $path) or die("Unable to rename $tmppath => $path");
 }
 
-sub passwd_add($$$$)
+sub passwd_add($$$$$)
 {
-	my ($path, $dummy, $dummy2, $name) = @_;
+	my ($path, $dummy, $dummy2, $name, $gid) = @_;
 
 	#print "passwd_add: '$name' in '$path'\n";
 
@@ -400,7 +404,6 @@ sub passwd_add($$$$)
 	die("account[$name] already exists in '$path'") if defined($e);
 
 	my $uid = passwd_get_free_uid($passwd);
-	my $gid = 65534;# nogroup gid
 
 	my $pwent = $name.":x:".$uid.":".$gid.":".$name." gecos:/nodir:/bin/false";
 
@@ -411,9 +414,9 @@ sub passwd_add($$$$)
 	return 0;
 }
 
-sub passwd_delete($$$$)
+sub passwd_delete($$$$$)
 {
-	my ($path, $dummy, $dummy2, $name) = @_;
+	my ($path, $dummy, $dummy2, $name, $dummy3) = @_;
 
 	#print "passwd_delete: '$name' in '$path'\n";
 
@@ -429,9 +432,9 @@ sub passwd_delete($$$$)
 	return 0;
 }
 
-sub group_add($$$$)
+sub group_add($$$$$)
 {
-	my ($dummy, $dummy2, $path, $name) = @_;
+	my ($dummy, $dummy2, $path, $name, $dummy3) = @_;
 
 	#print "group_add: '$name' in '$path'\n";
 
@@ -453,9 +456,9 @@ sub group_add($$$$)
 	return 0;
 }
 
-sub group_delete($$$$)
+sub group_delete($$$$$)
 {
-	my ($dummy, $dummy2, $path, $name) = @_;
+	my ($dummy, $dummy2, $path, $name, $dummy3) = @_;
 
 	#print "group_delete: '$name' in '$path'\n";
 
@@ -471,9 +474,9 @@ sub group_delete($$$$)
 	return 0;
 }
 
-sub member_add($$$$)
+sub member_add($$$$$)
 {
-	my ($passwd_path, $username, $group_path, $groupname) = @_;
+	my ($passwd_path, $username, $group_path, $groupname, $dummy) = @_;
 
 	#print "member_add: adding '$username' in '$passwd_path' to '$groupname' in '$group_path'\n";
 
@@ -494,9 +497,9 @@ sub member_add($$$$)
 	return 0;
 }
 
-sub member_delete($$$$)
+sub member_delete($$$$$)
 {
-	my ($passwd_path, $username, $group_path, $groupname) = @_;
+	my ($passwd_path, $username, $group_path, $groupname, $dummy) = @_;
 
 	#print "member_delete: removing '$username' in '$passwd_path' from '$groupname' in '$group_path'\n";
 
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 18e3483..94c2f95 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -443,6 +443,37 @@ sub provision($$$$$$)
 
 	my @eventlog_list = ("dns server", "application");
 
+	##
+	## calculate uids and gids
+	##
+
+	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;
+
+	##
+	## create conffile
+	##
+
 	open(CONF, ">$conffile") or die("Unable to open $conffile");
 	print CONF "
 [global]
@@ -468,9 +499,9 @@ sub provision($$$$$$)
 
 	time server = yes
 
-	add user script =		$nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u
+	add user script =		$nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u --gid $gid_nogroup
 	add group script =		$nss_wrapper_pl --group_path  $nss_wrapper_group  --type group  --action add --name %g
-	add machine script =		$nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u
+	add machine script =		$nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u --gid $gid_nogroup
 	add user to group script =	$nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type member --action add --member %u --name %g --group_path $nss_wrapper_group
 	delete user script =		$nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action delete --name %u
 	delete group script =		$nss_wrapper_pl --group_path  $nss_wrapper_group  --type group  --action delete --name %g
@@ -549,29 +580,6 @@ 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:$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
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index b4ef432..d06af60 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -229,6 +229,29 @@ cat >$SAMBA4CONFFILE<<EOF
 	ncalrpc dir = $NCALRPCDIR
 EOF
 
+##
+## calculate uids and gids
+##
+
+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 >$SERVERCONFFILE<<EOF
 [global]
 	netbios name = $SERVER
@@ -247,10 +270,10 @@ cat >$SERVERCONFFILE<<EOF
 	lanman auth = yes
 	time server = yes
 
-	add user script =		$PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --passwd_path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
+	add user script =		$PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --passwd_path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u --gid $GID_NOGROUP
 	add group script =		$PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --group_path  $NSS_WRAPPER_GROUP  --type group  --action add --name %g
 	add user to group script =	$PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --group_path  $NSS_WRAPPER_GROUP  --type member --action add --name %g --member %u --passwd_path $NSS_WRAPPER_PASSWD
-	add machine script =		$PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --passwd_path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
+	add machine script =		$PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --passwd_path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u --gid $GID_NOGROUP
 	delete user script =		$PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --passwd_path $NSS_WRAPPER_PASSWD --type passwd --action delete --name %u
 	delete group script =		$PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --group_path  $NSS_WRAPPER_GROUP  --type group  --action delete --name %g
 	delete user from group script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --group_path  $NSS_WRAPPER_GROUP  --type member --action delete --name %g --member %u --passwd_path $NSS_WRAPPER_PASSWD
@@ -325,25 +348,6 @@ EOF
 ## create a test account
 ##
 
-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
 nobody:x:$UID_NOBODY:$GID_NOBODY:nobody gecos:$PREFIX_ABS:/bin/false
 $USERNAME:x:$USERID:$GROUPID:$USERNAME gecos:$PREFIX_ABS:/bin/false


-- 
Samba Shared Repository


More information about the samba-cvs mailing list