summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsource3/script/tests/selftest.sh46
1 files changed, 31 insertions, 15 deletions
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index e481c7e1c9..b4ef432d88 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