summaryrefslogtreecommitdiff
path: root/source3/script/tests
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-03-19 10:33:54 +0100
committerGünther Deschner <gd@samba.org>2010-03-19 10:33:54 +0100
commit53d35fc9587234c4d72b9622fc5144d50ba47a80 (patch)
tree7361f6098c7c4697b0e16c97fa04ddcfabd2cdec /source3/script/tests
parent20d73f768d002faf62f760f99c608f139b229491 (diff)
downloadsamba-53d35fc9587234c4d72b9622fc5144d50ba47a80.tar.gz
samba-53d35fc9587234c4d72b9622fc5144d50ba47a80.tar.bz2
samba-53d35fc9587234c4d72b9622fc5144d50ba47a80.zip
s3-selftest: rearrange uid/gid calculation to achieve correct membership.
(make test variant) Guenther
Diffstat (limited to 'source3/script/tests')
-rwxr-xr-xsource3/script/tests/selftest.sh46
1 files changed, 25 insertions, 21 deletions
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index b4ef432d88..d06af60521 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