python: Add a simple pam_winbind test
[kai/samba-autobuild/.git] / python / samba / tests / test_pam_winbind.sh
1 #!/bin/sh
2
3 PYTHON="$1"
4 PAM_WRAPPER_SO_PATH="$2"
5 shift 2
6
7 PAM_WRAPPER_PATH="$BINDIR/default/lib/pam_wrapper"
8
9 pam_winbind="$BINDIR/shared/pam_winbind.so"
10 service_dir="$SELFTEST_TMPDIR/pam_services"
11 service_file="$service_dir/samba"
12
13 mkdir $service_dir
14 echo "auth        required    $pam_winbind debug debug_state" > $service_file
15 echo "account     required    $pam_winbind debug debug_state" >> $service_file
16 echo "password    required    $pam_winbind debug debug_state" >> $service_file
17 echo "session     required    $pam_winbind debug debug_state" >> $service_file
18
19 PAM_WRAPPER="1"
20 export PAM_WRAPPER
21 PAM_WRAPPER_SERVICE_DIR="$service_dir"
22 export PAM_WRAPPER_SERVICE_DIR
23 LD_PRELOAD="$LD_PRELOAD:$PAM_WRAPPER_SO_PATH"
24 export LD_PRELOAD
25
26 PAM_WRAPPER_DEBUGLEVEL=${PAM_WRAPPER_DEBUGLEVEL:="2"}
27 export PAM_WRAPPER_DEBUGLEVEL
28
29 PYTHONPATH="$PYTHONPATH:$PAM_WRAPPER_PATH:$(dirname $0)" $PYTHON -m samba.subunit.run samba.tests.pam_winbind
30 exit_code=$?
31
32 rm -rf $service_dir
33
34 exit_code=0
35 exit $exit_code