s3-selftest: include addprinter/deleteprinter command.
[abartlet/samba.git/.git] / source3 / script / tests / selftest.sh
index 60b71a5adcbd40581382b53b68428f7981ffdb93..e6e3c2915bb402f3ca0f60e8fbaa21cc6a721bd9 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
@@ -72,15 +80,17 @@ SAMBA4CONFFILE=$LIBDIR/samba4client.conf
 SERVERCONFFILE=$LIBDIR/server.conf
 COMMONCONFFILE=$LIBDIR/common.conf
 PRIVATEDIR=$PREFIX_ABS/private
+NCALRPCDIR=$PREFIX_ABS/ncalrpc
 LOCKDIR=$PREFIX_ABS/lockdir
 LOGDIR=$PREFIX_ABS/logs
-SOCKET_WRAPPER_DIR=$PREFIX/sw
+SOCKET_WRAPPER_DIR=$PREFIX_ABS/sw
 CONFIGURATION="--configfile $CONFFILE"
 SAMBA4CONFIGURATION="-s $SAMBA4CONFFILE"
 NSS_WRAPPER_PASSWD="$PRIVATEDIR/passwd"
 NSS_WRAPPER_GROUP="$PRIVATEDIR/group"
 WINBINDD_SOCKET_DIR=$PREFIX_ABS/winbindd
 WINBINDD_PRIV_PIPE_DIR=$LOCKDIR/winbindd_privileged
+TEST_DIRECTORY=$DIRECTORY
 
 export PREFIX PREFIX_ABS
 export CONFIGURATION CONFFILE SAMBA4CONFIGURATION SAMBA4CONFFILE
@@ -91,6 +101,7 @@ export USERNAME PASSWORD
 export WORKGROUP SERVER SERVER_IP
 export NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
 export WINBINDD_SOCKET_DIR WINBINDD_PRIV_PIPE_DIR
+export TEST_DIRECTORY
 
 PATH=bin:$PATH
 export PATH
@@ -139,7 +150,7 @@ fi
 ##
 printf "%s" "CREATE TEST ENVIRONMENT IN '$PREFIX'"...
 /bin/rm -rf $PREFIX/*
-mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR
+mkdir -p $PRIVATEDIR $NCALRPCDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR
 mkdir -p $SOCKET_WRAPPER_DIR
 mkdir -p $WINBINDD_SOCKET_DIR
 chmod 755 $WINBINDD_SOCKET_DIR
@@ -196,6 +207,7 @@ cat >$SAMBA4CONFFILE<<EOF
        panic action = $SCRIPTDIR/gdb_backtrace %PID% %PROG%
        include = $COMMONCONFFILE
        modules dir = $SRCDIR/bin/modules
+       ncalrpc dir = $NCALRPCDIR
 EOF
 
 cat >$SERVERCONFFILE<<EOF
@@ -213,11 +225,19 @@ 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
+
+       addprinter command =            $PERL $SRCDIR/../source3/script/tests/printing/modprinter.pl -a -s $SERVERCONFFILE --
+       deleteprinter command =         $PERL $SRCDIR/../source3/script/tests/printing/modprinter.pl -d -s $SERVERCONFFILE --
 
        kernel oplocks = no
        kernel change notify = no
@@ -229,15 +249,20 @@ cat >$SERVERCONFFILE<<EOF
        winbindd:socket dir = $WINBINDD_SOCKET_DIR
        idmap uid = 100000-200000
        idmap gid = 100000-200000
+       winbind enum users = yes
+       winbind enum groups = yes
 
 #      min receivefile size = 4000
 
        read only = no
        smbd:sharedelay = 100000
-       smbd:writetimeupdatedelay = 500000
-       map hidden = yes
-       map system = yes
+#      smbd:writetimeupdatedelay = 500000
+       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
@@ -248,13 +273,24 @@ cat >$SERVERCONFFILE<<EOF
 [hideunread]
        copy = tmp
        hide unreadable = yes
+[tmpcase]
+       copy = tmp
+       case sensitive = yes
 [hideunwrite]
        copy = tmp
        hide unwriteable files = yes
 [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]
@@ -276,6 +312,7 @@ EOF
 cat >$NSS_WRAPPER_GROUP<<EOF
 nobody:x:65533:
 nogroup:x:65534:nobody
+root:x:65532:
 $USERNAME-group:x:$GROUPID:
 EOF
 
@@ -317,6 +354,7 @@ TORTURE4_OPTIONS="$SAMBA4CONFIGURATION"
 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --maximum-runtime=$TORTURE_MAXTIME"
 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --target=samba3"
 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:localdir=$SHRDIR"
+TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:winbindd_netbios_name=$SERVER"
 export TORTURE4_OPTIONS
 
 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then