# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_auth.sh,v 1.3 2005-08-28 19:28:16 niro Exp $ # configures the system authentification via mysql db settings get_auth_settings() { local x i all count #all arrays: # -> session1 session2 ... sessionN #get settings from database ALX_AUTH_SHELL_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ "select shell from client_auth where serial='${ALX_SERIAL}'") ALX_AUTH_VNC_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ "select vnc from client_auth where serial='${ALX_SERIAL}'") ALX_AUTH_SAMBA_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ "select samba from client_auth where serial='${ALX_SERIAL}'") ALX_AUTH_STATION_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ "select station from client_auth where serial='${ALX_SERIAL}'") export ALX_AUTH_SHELL_PW export ALX_AUTH_VNC_PW export ALX_AUTH_SAMBA_PW export ALX_AUTH_STATION_PW } config_auth() { #first of all get the vars get_auth_settings [ -n "${ALX_AUTH_SHELL_PW}" ] && \ usermod -p $(perl -e "printf(crypt('${ALX_AUTH_SHELL_PW}','AD'))") root [ -n "${ALX_AUTH_STATION_PW}" ] && \ usermod -p $(perl -e "printf(crypt('${ALX_AUTH_SHELL_PW}','AD'))") ${ALX_UNPRIV_USER} if [ -n "${ALX_AUTH_SAMBA_PW}" ] then # >smb3 smbpasswd -a user password does not work anymore if [[ $(smbd --version | cut -d' ' -f2) > 2.999 ]] then smbpasswd -a root -s << EOF ${ALX_AUTH_SAMBA_PW} ${ALX_AUTH_SAMBA_PW} EOF else smbpasswd -a root ${ALX_AUTH_SAMBA_PW} fi fi # unset vars unset ALX_AUTH_SHELL_PW unset ALX_AUTH_VNC_PW unset ALX_AUTH_SAMBA_PW unset ALX_AUTH_STATION_PW }