Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 460 - (hide annotations) (download) (as text)
Thu Jun 5 20:39:40 2008 UTC (15 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 1076 byte(s)
- massive changes:
- make use of new the mysql-function evaluate_table()
- do not split in a retrieve information and configure function; doing it directly

1 niro 460 # $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_auth.sh,v 1.3 2008-06-05 20:39:40 niro Exp $
2 niro 386 # configures the system authentification via mysql db settings
3    
4 niro 460 set_shadow_pass()
5 niro 386 {
6 niro 460 local user="$1"
7     local pass="$2"
8     [[ -z ${user} ]] && return 1
9     [[ -z ${pass} ]] && return 1
10 niro 386
11 niro 460 # NULL is forbidden too!
12     [[ ${pass} = NULL ]] && return 1
13 niro 386
14 niro 460 # update pass
15     (echo "${pass}"; sleep 1; echo "${pass}") | passwd ${user} &> /dev/null
16     return 0
17 niro 386 }
18    
19 niro 460 set_vnc_pass()
20 niro 386 {
21 niro 460 local user="$1"
22     local pass="$2"
23 niro 386
24 niro 460 [[ -z ${user} ]] && return 1
25     [[ -z ${pass} ]] && return 1
26 niro 386
27 niro 460 # NULL is forbidden too!
28     [[ ${pass} = NULL ]] && return 1
29 niro 386
30 niro 460 local homedir=/home/${user}
31     [[ ${user} = root ]] && homedir=/${user}
32 niro 386
33 niro 460 # pipe it 2x; 1st for new pw, 2nd to validate
34     HOME="${homedir}" vncpasswd &> /dev/null << EOF
35     ${pass}
36     ${pass}
37 niro 386 EOF
38 niro 460 }
39 niro 386
40 niro 460 config_auth()
41     {
42     # first of all get the vars
43     evaluate_table 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 niro 386 }