Use the method used by build_env.sh to discover the user name.
[ira/wip.git] / source3 / script / tests / selftest.sh
index c02e0ee1830984753d581cff213321fd3a3d4830..43e7bf173181b0886194efc788e6003714438b48 100755 (executable)
@@ -57,7 +57,15 @@ export TORTURE_MAXTIME
 WORKGROUP=SAMBA-TEST
 SERVER=localhost2
 SERVER_IP=127.0.0.2
-USERNAME=`PATH=/usr/ucb:$PATH whoami`
+if [ ! "x$USER" = "x" ]; then
+    USERNAME=$USER
+else
+    if [ ! "x$LOGNAME" = "x" ]; then
+        USERNAME=$LOGNAME
+    else
+        USERNAME=`PATH=/usr/ucb:$PATH whoami || id -un`
+    fi
+fi
 USERID=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f1 | sed -e 's/uid=\([0-9]*\).*/\1/g'`
 GROUPID=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f2 | sed -e 's/gid=\([0-9]*\).*/\1/g'`
 PASSWORD=test
@@ -104,13 +112,14 @@ SAMBA4SHAREDDIR="$SAMBA4BINDIR/shared"
 export SAMBA4SHAREDDIR
 export SMBTORTURE4
 
-if test x"$LD_LIBRARY_PATH" != x""; then
-       LD_LIBRARY_PATH="$BINDIR:$SAMBA4SHAREDDIR:$LD_LIBRARY_PATH"
-else
-       LD_LIBRARY_PATH="$BINDIR:$SAMBA4SHAREDDIR"
+if [ -z "$LIB_PATH_VAR" ] ; then
+       echo "Warning: LIB_PATH_VAR not set. Using best guess LD_LIBRARY_PATH." >&2
+       LIB_PATH_VAR=LD_LIBRARY_PATH
+       export LIB_PATH_VAR
 fi
-echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
-export LD_LIBRARY_PATH
+
+eval $LIB_PATH_VAR=$BINDIR:$SAMBA4SHAREDDIR:\$$LIB_PATH_VAR
+export $LIB_PATH_VAR
 
 ##
 ## verify that we were built with --enable-socket-wrapper
@@ -212,11 +221,16 @@ cat >$SERVERCONFFILE<<EOF
 
        domain master = yes
        domain logons = yes
+       lanman auth = yes
        time server = yes
 
-       add user script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
-       add machine script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
-       delete user script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action delete --name %u
+       add user script =               $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --passwd_path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
+       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
+       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
 
        kernel oplocks = no
        kernel change notify = no
@@ -234,9 +248,12 @@ cat >$SERVERCONFFILE<<EOF
        read only = no
        smbd:sharedelay = 100000
        smbd:writetimeupdatedelay = 500000
-       map hidden = yes
-       map system = yes
+       map hidden = no
+       map system = no
+       map readonly = no
+       store dos attributes = yes
        create mask = 755
+       store create time = yes
        vfs objects = $BINDIR/xattr_tdb.so $BINDIR/streams_depot.so
 
        #Include user defined custom parameters if set
@@ -253,7 +270,15 @@ cat >$SERVERCONFFILE<<EOF
 [print1]
        copy = tmp
        printable = yes
-       printing = test
+       printing = vlp
+       print command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb print %p %s
+       lpq command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb lpq %p
+       lp rm command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb lprm %p %j
+       lp pause command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb lppause %p %j
+       lp resume command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb lpresume %p %j
+       queue pause command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb queuepause %p
+       queue resume command = $BINDIR/vlp tdbfile=$LOCKDIR/vlp.tdb queueresume %p
+
 [print2]
        copy = print1
 [print3]
@@ -267,6 +292,7 @@ EOF
 ##
 
 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
 $USERNAME:x:$USERID:$GROUPID:$USERNAME gecos:$PREFIX_ABS:/bin/false
 EOF
@@ -274,6 +300,7 @@ EOF
 cat >$NSS_WRAPPER_GROUP<<EOF
 nobody:x:65533:
 nogroup:x:65534:nobody
+root:x:65532:
 $USERNAME-group:x:$GROUPID:
 EOF
 
@@ -281,7 +308,7 @@ MAKE_TEST_BINARY="bin/smbpasswd"
 export MAKE_TEST_BINARY
 
 (echo $PASSWORD; echo $PASSWORD) | \
-       bin/smbpasswd -c $CONFFILE -L -s -a $USERNAME >/dev/null || exit 1
+       bin/smbpasswd -c $SERVERCONFFILE -L -s -a $USERNAME >/dev/null || exit 1
 
 echo "DONE";
 
@@ -345,13 +372,6 @@ START=`date`
  bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
  MAKE_TEST_BINARY=""
 
- MAKE_TEST_BINARY="bin/net"
- printf "%s" "creating BUILTIN\\Administrators..."
- bin/net -s $SERVERCONFFILE sam createbuiltingroup \
-   Administrators > /dev/null 2>&1 ||  exit 1
- echo "DONE"
- MAKE_TEST_BINARY=""
-
  failed=0
 
  . $SCRIPTDIR/tests_$SUBTESTS.sh