Magellan Linux

Diff of /alx-src/branches/alxconf-060/functions/config_auth.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

alx-src/trunk/alxconfig-ng/functions/config_auth.sh revision 330 by niro, Wed Sep 7 19:14:24 2005 UTC alx-src/branches/alxconf-060/functions/config_auth.sh revision 2023 by niro, Tue May 10 16:29:13 2011 UTC
# Line 1  Line 1 
1  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_auth.sh,v 1.5 2005-09-07 19:14:24 niro Exp $  # $Id$
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    
  # all arrays:  
  # ->  session1 session2 ... sessionN  
   
8   # get settings from database   # get settings from database
9   ALX_AUTH_SHELL_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   ALX_AUTH_SHELL_PW=$(mysqldo "select shell from client_auth where serial='${ALX_SERIAL}'")
10   "select shell from client_auth where serial='${ALX_SERIAL}'")   ALX_AUTH_VNC_PW=$(mysqldo "select vnc from client_auth where serial='${ALX_SERIAL}'")
11   ALX_AUTH_VNC_PW=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   ALX_AUTH_STATION_PW=$(mysqldo "select station from client_auth where serial='${ALX_SERIAL}'")
  "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}'")  
12    
13   export ALX_AUTH_SHELL_PW   export ALX_AUTH_SHELL_PW
14   export ALX_AUTH_VNC_PW   export ALX_AUTH_VNC_PW
  export ALX_AUTH_SAMBA_PW  
15   export ALX_AUTH_STATION_PW   export ALX_AUTH_STATION_PW
16  }  }
17    
# Line 29  config_auth() Line 20  config_auth()
20   # first of all get the vars   # first of all get the vars
21   get_auth_settings   get_auth_settings
22    
23   [ -n "${ALX_AUTH_SHELL_PW}" ] && \   if [[ ! -z ${ALX_AUTH_SHELL_PW} ]]
24   usermod -p $(perl -e "printf(crypt('${ALX_AUTH_SHELL_PW}','AD'))") root   then
25     ( echo "${ALX_AUTH_SHELL_PW}"; sleep 0.1; echo "${ALX_AUTH_SHELL_PW}" ) | passwd root
26   [ -n "${ALX_AUTH_STATION_PW}" ] && \   fi
  usermod -p $(perl -e "printf(crypt('${ALX_AUTH_SHELL_PW}','AD'))") ${ALX_UNPRIV_USER}  
27    
28   if [ -n "${ALX_AUTH_SAMBA_PW}" ]   if [[ ! -z ${ALX_AUTH_STATION_PW} ]]
29   then   then
30   # >smb3 smbpasswd -a user password does not work anymore   ( echo "${ALX_AUTH_STATION_PW}"; sleep 0.1; echo "${ALX_AUTH_STATION_PW}" ) | passwd ${ALX_UNPRIV_USER}
  if [[ $(smbd --version | cut -d' ' -f2) > 2.999 ]]  
  then  
  smbpasswd -a root -s << EOF  
 ${ALX_AUTH_SAMBA_PW}  
 ${ALX_AUTH_SAMBA_PW}  
 EOF  
  else  
  smbpasswd -a root ${ALX_AUTH_SAMBA_PW}  
  fi  
31   fi   fi
32    
33   # vnc passwd (min 6 chars)   # vnc passwd (min 6 chars)
34   if [ -n "${ALX_AUTH_VNC_PW}" ]   if [[ ! -z ${ALX_AUTH_VNC_PW} ]]
35   then   then
36   # pipe it 2x; 1st for new pw, 2nd to validate   # pipe it 2x; 1st for new pw, 2nd to validate
37   HOME=/root vncpasswd &> /dev/null << EOF   HOME=/root vncpasswd &> /dev/null << EOF
# Line 58  ${ALX_AUTH_VNC_PW} Line 39  ${ALX_AUTH_VNC_PW}
39  ${ALX_AUTH_VNC_PW}  ${ALX_AUTH_VNC_PW}
40  EOF  EOF
41   fi   fi
42    
43   # unset vars   # unset vars
44   unset ALX_AUTH_SHELL_PW   unset ALX_AUTH_SHELL_PW
45   unset ALX_AUTH_VNC_PW   unset ALX_AUTH_VNC_PW
  unset ALX_AUTH_SAMBA_PW  
46   unset ALX_AUTH_STATION_PW   unset ALX_AUTH_STATION_PW
47  }  }
   

Legend:
Removed from v.330  
changed lines
  Added in v.2023