# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_auth.sh,v 1.2 2005-04-13 18:55:25 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} [ -n "${ALX_AUTH_SAMBA_PW}" ] && \ smbpasswd -a root ${ALX_AUTH_SAMBA_PW} # unset vars unset ALX_AUTH_SHELL_PW unset ALX_AUTH_VNC_PW unset ALX_AUTH_SAMBA_PW unset ALX_AUTH_STATION_PW }