Magellan Linux

Contents of /alx-src/trunk/tinyalxconfig-ng/functions/config_auth.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 537 - (show annotations) (download) (as text)
Mon Jan 26 17:16:32 2009 UTC (15 years, 3 months ago) by niro
File MIME type: application/x-sh
File size: 970 byte(s)
-fixed header
1 # $Id$
2 # configures the system authentification via mysql db settings
3
4 set_shadow_pass()
5 {
6 local user="$1"
7 local pass="$2"
8 [[ -z ${user} ]] && return 1
9 [[ -z ${pass} ]] && return 1
10
11 # NULL is forbidden too!
12 [[ ${pass} = NULL ]] && return 1
13
14 # update pass
15 (echo "${pass}"; sleep 1; echo "${pass}") | passwd ${user} &> /dev/null
16 return 0
17 }
18
19 set_vnc_pass()
20 {
21 local user="$1"
22 local pass="$2"
23
24 [[ -z ${user} ]] && return 1
25 [[ -z ${pass} ]] && return 1
26
27 # NULL is forbidden too!
28 [[ ${pass} = NULL ]] && return 1
29
30 local homedir=/home/${user}
31 [[ ${user} = root ]] && homedir=/${user}
32
33 # pipe it 2x; 1st for new pw, 2nd to validate
34 HOME="${homedir}" vncpasswd &> /dev/null << EOF
35 ${pass}
36 ${pass}
37 EOF
38 }
39
40 config_auth()
41 {
42 # first of all get the vars
43 evaluate_table_xml client_auth
44
45 set_shadow_pass root "${client_auth_shell}"
46 set_shadow_pass "${ALX_UNPRIV_USER}" "${client_auth_station}"
47
48 # vnc passwd (min 6 chars)
49 set_vnc_pass root "${client_auth_vnc}"
50 }