diff options
author | Günther Deschner <gd@samba.org> | 2010-03-18 11:27:36 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-03-18 15:08:26 +0100 |
commit | 38a46fa32bfd8007f0fb3e2b607d0e57a012ae95 (patch) | |
tree | 920ee1a5051d19906b2e957bd20c6ae00b002bfa /source3 | |
parent | 6a1f8e67eb6e15bbafca570ac9b3714681025a1f (diff) | |
download | samba-38a46fa32bfd8007f0fb3e2b607d0e57a012ae95.tar.gz samba-38a46fa32bfd8007f0fb3e2b607d0e57a012ae95.tar.bz2 samba-38a46fa32bfd8007f0fb3e2b607d0e57a012ae95.zip |
s3-selftest: make sure we do not have duplicate uids/gids in nsswrapper.
Guenther
Diffstat (limited to 'source3')
-rwxr-xr-x | source3/script/tests/selftest.sh | 46 |
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 |