/usr/share/sadms-2.0.15/_test-smb.sh is in sadms 2.0.15.repack-0ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | #!/bin/bash
# bbou@ac-toulouse.fr
# 2007-05-22 16:31:22
# _test-smb.sh
### P A R A M S
MYVERBOSE=
if [ "$1" = "-v" ]; then
MYVERBOSE="True"
shift
fi
MYSERVER="$1"
MYSHARE="$2"
MYDOMAIN="$3"
MYUSER="$4"
MYUSERPWD="$5"
#echo "server=${MYSERVER}"
#echo "share=${MYSHARE}"
#echo "domain=${MYDOMAIN}"
#echo "user=${MYUSER}"
#echo "password=${MYUSERPWD}"
### I N C L U D E
. ./_include.sh
### O T H E R
share="//${MYSERVER}/${MYSHARE}"
### S T A R T
guest=`testparm -sv 2> /dev/null | grep 'guest account' | awk '{print $4}'`
echo "--------------------------------------------------------------------------------"
echo "SMB TEST"
echo "--------------------------------------------------------------------------------"
if ! type smbstatus > /dev/null; then
exit 1
fi
if ! type smbclient > /dev/null; then
exit 1
fi
echo "+STATUS"
if ! smbstatus >/dev/null 2>/dev/null; then
echo 'status failed' >&2
else
smbstatus 2>&1 | grep -v "^$"
fi
echo "+BROWSE"
echo "+browse localhost anonymously"
#smbclient -L localhost -U%
if smbclient -L localhost -U% > /dev/null 2> /dev/null; then
echo 'ok'
else
echo 'fail'
echo "browse localhost anonymously failed" >&2
fi
echo "+browse localhost as guest ${guest}"
#smbclient -L localhost -U ${guest}%
if smbclient -L localhost -U ${guest}% > /dev/null 2> /dev/null; then
echo 'ok'
else
echo 'fail'
echo "browse localhost as guest ${guest} failed" >&2
fi
if [ ! "${MYUSER}" = "" ]; then
echo "+browse localhost as ${MYUSER} with password ${MYUSERPWD}"
e="smbclient -L localhost -U '${MYUSER}%${MYUSERPWD}'"
if eval $e > /dev/null 2> /dev/null; then
echo 'ok'
else
echo 'fail'
echo "browse localhost as ${MYUSER} with password ${MYUSERPWD} failed" >&2
fi
fi
echo "+CONNECT"
echo "+connect anonymously to ${share}"
#smbclient ${share} -U% -c "exit"
if smbclient ${share} -U% -c "exit" > /dev/null 2> /dev/null; then
echo "ok"
else
echo 'fail'
echo "connect anonymously to ${share} failed" >&2
fi
echo "+connect as guest (${guest}) to ${share}"
#smbclient ${share} -U ${guest}% -c "exit"
if smbclient ${share} -U ${guest}% -c "exit" > /dev/null 2> /dev/null; then
echo "ok"
else
echo 'fail'
echo "connect as guest ${guest} to ${share} failed" >&2
fi
if [ ! "${MYUSER}" = "" ]; then
echo "+connect as ${MYUSER} with password ${MYUSERPWD} to ${share}"
e="smbclient ${share} -U '${MYUSER}%${MYUSERPWD}' -c 'exit'"
if eval $e > /dev/null 2> /dev/null; then
echo "ok"
else
echo 'fail'
echo "connect as ${MYUSER} with password ${MYUSERPWD} to ${share} failed" >&2
fi
fi
exit 0
|