2 # Blackbox tests for pdbtest
3 # Copyright (C) 2006-2007 Jelmer Vernooij <jelmer@samba.org>
4 # Copyright (C) 2006-2012 Andrew Bartlett <abartlet@samba.org>
8 Usage: test_pdbtest.sh SERVER PREFIX USER SMBCLIENT SMB_CONF
21 samba4bindir
="$BINDIR"
22 pdbtest
="$samba4bindir/pdbtest"
23 pdbedit
="$samba4bindir/pdbedit"
24 net
="$samba4bindir/net"
25 smbpasswd
="$samba4bindir/smbpasswd"
26 texpect
="$samba4bindir/texpect"
28 .
`dirname $0`/subunit.sh
36 $VALGRIND $smbclient $CONFIGURATION //$SERVER/tmp
-c "$cmd" $@
38 if [ x
$status = x0
]; then
47 export UID_WRAPPER_ROOT
49 testit
"pdbtest" $VALGRIND $BINDIR/pdbtest
-u $USER $@ || failed
=`expr $failed + 1`
51 NEWUSERPASS
=testPaSS@
01%
53 echo "set password with pdbedit"
54 cat > .
/tmpsmbpasswdscript
<<EOF
57 expect retype new password:
61 testit
"create user with pdbedit" $texpect .
/tmpsmbpasswdscript
$VALGRIND $pdbedit -a $USER --account-desc="pdbedit-test-user" $@ || failed
=`expr $failed + 1`
64 test_smbclient
"Test login with user (ntlm)" 'ls' -k no
-U$USER%$NEWUSERPASS $@ || failed
=`expr $failed + 1`
66 testit
"modify user" $VALGRIND $pdbedit --modify $USER --drive="D:" $@ || failed
=`expr $failed + 1`
68 test_smbclient
"Test login with user (ntlm)" 'ls' -k no
-U$USER%$NEWUSERPASS $@|| failed
=`expr $failed + 1`
70 NEWUSERPASS
=testPaSS@
02%
72 echo "set password with smbpasswd"
73 cat > .
/tmpsmbpasswdscript
<<EOF
74 expect New SMB password:
76 expect Retype new SMB password:
80 testit
"set user password with smbpasswd" $texpect .
/tmpsmbpasswdscript
$smbpasswd -L $USER -c $SMB_CONF || failed
=`expr $failed + 1`
83 test_smbclient
"Test login with user (ntlm)" 'ls' -k no
-U$USER%$NEWUSERPASS $@|| failed
=`expr $failed + 1`
85 testit
"modify user - disabled" $VALGRIND $net sam
set disabled
$USER yes $@ || failed
=`expr $failed + 1`
87 testit_expect_failure
"Test login with disabled suer" $VALGRIND $smbclient //$SERVER/tmp
-c 'ls' -k no
-U$USER@
%$USERPASS && failed
=`expr $failed + 1`
89 testit
"modify user - enabled" $VALGRIND $net sam
set disabled
$USER no $@ || failed
=`expr $failed + 1`
91 test_smbclient
"Test login with re-enabled user (ntlm)" 'ls' -k no
-U$USER%$NEWUSERPASS || failed
=`expr $failed + 1`
93 testit
"modify user - must change password now" $VALGRIND $net sam
set pwdmustchangenow
$USER yes $@ || failed
=`expr $failed + 1`
95 testit_expect_failure
"Test login with expired password" $VALGRIND $smbclient //$SERVER/tmp
-c 'ls' -k no
-U$USER@
%$USERPASS && failed
=`expr $failed + 1`
97 testit
"modify user - disable password expiry" $VALGRIND $net sam
set pwnoexp
$USER yes $@ || failed
=`expr $failed + 1`
99 test_smbclient
"Test login with no expiry (ntlm)" 'ls' -k no
-U$USER%$NEWUSERPASS || failed
=`expr $failed + 1`
101 testit
"del user" $VALGRIND $pdbedit -x $USER $@ || failed
=`expr $failed + 1`
103 rm .
/tmpsmbpasswdscript