8
redirection='> /dev/null'
9
if [ "$1" = "-v" ]; then
18
# organizational unit to put computer in
19
#echo "realm=${MYREALM}"
21
#echo "admin=${MYADMIN}"
22
#echo "admin password=${MYADMINPWD}"
31
if echo "${MYADMINPWD}" | ${KINIT} ${MYADMIN}@${MYREALM} > /dev/null; then
32
echo "kerberos authentication of ${MYADMIN}@${MYREALM} succeeded"
35
echo "kerberos authentication of ${MYADMIN}@${MYREALM} failed"
42
echo "+test domain membership"
43
e="net ads testjoin 2>&1 ${redirection}"
53
# different net ads join OU syntax as of 3.0.23
54
echo "+get current samba version for join domain syntax"
55
sambapkg="${SAMBAPKG}"
56
sambaversion=`${PACKAGEVERSION} ${sambapkg} | sed 's/^[^:]://'`
57
sambamajorversion=`echo "${sambaversion}" | sed 's/^\([0-9]\).*$/\1/g'`
58
sambaminorversion=`echo "${sambaversion}" | sed 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*$/\1/g'`
59
echo "samba minor version is ${sambaminorversion}"
60
if (( $((sambaminorversion)) < 23 )); then
63
ouswitch=createcomputer=
65
#echo "ouswitch=${ouswitch}"
66
#echo net ads join ${ouswitch}"${MYOU}"
69
#echo "+get administrator credentials"
74
if [ ! -z "${MYOU}" ]; then
75
echo "+join domain to ${MYOU}"
76
joinparam="${ouswitch}\"${MYOU}\""
82
e="net ads join ${joinparam} -U '${MYADMIN}%${MYADMINPWD}' ${redirection}"
87
echo "join failed and returned $?"