Annotation of /alx-src/trunk/tinyalxconfig-ng/functions/config_auth.sh
Parent Directory | Revision Log
Revision 537 -
(hide annotations)
(download)
(as text)
Mon Jan 26 17:16:32 2009 UTC (15 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 970 byte(s)
Mon Jan 26 17:16:32 2009 UTC (15 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 970 byte(s)
-fixed header
1 | niro | 537 | # $Id$ |
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 | niro | 473 | evaluate_table_xml client_auth |
44 | niro | 460 | |
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 | } |