1 |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_auth.sh,v 1.3 2005-08-28 19:28:16 niro Exp $ |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_auth.sh,v 1.4 2005-09-07 18:41:29 niro Exp $ |
2 |
# configures the system authentification via mysql db settings |
# configures the system authentification via mysql db settings |
3 |
|
|
4 |
get_auth_settings() |
get_auth_settings() |
5 |
{ |
{ |
6 |
local x i all count |
local x i all count |
7 |
|
|
8 |
#all arrays: |
# all arrays: |
9 |
# -> session1 session2 ... sessionN |
# -> session1 session2 ... sessionN |
10 |
|
|
11 |
#get settings from database |
# get settings from database |
12 |
ALX_AUTH_SHELL_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
ALX_AUTH_SHELL_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
13 |
"select shell from client_auth where serial='${ALX_SERIAL}'") |
"select shell from client_auth where serial='${ALX_SERIAL}'") |
14 |
ALX_AUTH_VNC_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
ALX_AUTH_VNC_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
26 |
|
|
27 |
config_auth() |
config_auth() |
28 |
{ |
{ |
29 |
#first of all get the vars |
# first of all get the vars |
30 |
get_auth_settings |
get_auth_settings |
31 |
|
|
32 |
[ -n "${ALX_AUTH_SHELL_PW}" ] && \ |
[ -n "${ALX_AUTH_SHELL_PW}" ] && \ |
49 |
fi |
fi |
50 |
fi |
fi |
51 |
|
|
52 |
|
# vnc passwd (min 6 chars) |
53 |
|
if [ -n "${ALX_AUTH_VNC_PW}" ] |
54 |
|
then |
55 |
|
# pipe it 2x; 1st for new pw, 2nd to validate |
56 |
|
vncpasswd &> /dev/null << EOF |
57 |
|
${ALX_AUTH_VNC_PW} |
58 |
|
${ALX_AUTH_VNC_PW} |
59 |
|
EOF |
60 |
|
fi |
61 |
# unset vars |
# unset vars |
62 |
unset ALX_AUTH_SHELL_PW |
unset ALX_AUTH_SHELL_PW |
63 |
unset ALX_AUTH_VNC_PW |
unset ALX_AUTH_VNC_PW |
64 |
unset ALX_AUTH_SAMBA_PW |
unset ALX_AUTH_SAMBA_PW |
65 |
unset ALX_AUTH_STATION_PW |
unset ALX_AUTH_STATION_PW |
66 |
} |
} |
67 |
|
|