Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/include/sessionauth.global.class.in

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

mcore-src/trunk/mcore-tools/daemon/include/sessionauth.global.class revision 1248 by niro, Wed Feb 2 20:20:24 2011 UTC mcore-src/trunk/mcore-tools/src/include/sessionauth.global.class revision 2207 by niro, Fri Jan 10 14:57:04 2014 UTC
# Line 50  mcorepasswd() Line 50  mcorepasswd()
50    
51  }  }
52    
 ## validate_auth $user $pass  
 #validate_auth()  
 #{  
 # local user="$1"  
 # local pass="$2"  
 # local dbuser  
 #  
 # # return 0 if ${valid_auth=yes} - user alread authenticated  
 # validate_session && return 0  
 #  
 # if [[ ${DEBUG} = 1 ]]  
 # then  
 # echo "user=${user}" >> /root/lala.log  
 # echo "pass=${pass}" >> /root/lala.log  
 # echo "mysqldo \"select user from control_auth where pass=MD5('${pass}')\"" >> /root/lala.log  
 # echo $(mysqldo "select user from control_auth where pass=MD5('${pass}')") >> /root/lala.log  
 # fi  
 #  
 # dbuser=$(mysqldo "select user from control_auth where pass=MD5('${pass}')")  
 # if [[ ! -z ${dbuser} ]]  
 # then  
 # # check if the returned username is equal the given one  
 # if [[ ${dbuser} = ${user} ]]  
 # then  
 # # register a valid session  
 # echo "auth valid"  
 # export valid_session=yes  
 # return 0  
 # fi  
 # fi  
 #  
 # # if we get here, the auth is invalid  
 # echo "auth invalid"  
 # export valid_session=no  
 # return 1  
 #}  
   
   
53  validate_auth()  validate_auth()
54  {  {
55   local user="$1"   local user="$1"
# Line 97  validate_auth() Line 59  validate_auth()
59   local passwdpass   local passwdpass
60    
61   # return 0 if ${valid_auth=yes} - user alread authenticated   # return 0 if ${valid_auth=yes} - user alread authenticated
62   validate_session && return 0   valid_session && return 0
63    
64   if [[ ! -f ${PASSWD} ]]   if [[ ! -f ${PASSWD} ]]
65   then   then
66   echo "passwd '${PASSWD}' does not exist!"   eecho "passwd '${PASSWD}' does not exist!"
67   return 1   return 1
68   fi   fi
69    
# Line 112  validate_auth() Line 74  validate_auth()
74   then   then
75   if [[ $(md5crypt ${pass}) == ${passwdpass} ]]   if [[ $(md5crypt ${pass}) == ${passwdpass} ]]
76   then   then
77   echo "password for user '${user}' is valid!"   mecho "password for user '${user}' is valid!"
78   mecho "Successfully logged in. Type 'help' for more information."   mecho "Successfully logged in. Type 'help' for more information."
79   export valid_session="yes"   export valid_session="yes"
80   return 0   return 0
81   else   else
82   echo "password for user '${user}' is invalid!"   mecho "password for user '${user}' is invalid!"
83   export valid_session="no"   export valid_session="no"
84   return 1   return 1
85   fi   fi
86   else   else
87   echo "User '${user}' unkown."   eecho "User '${user}' unkown."
88   export valid_session="no"   export valid_session="no"
89   return 1   return 1
90   fi   fi
91  }  }
92    
93  validate_session()  valid_session()
94  {  {
95   if [[ ${valid_session} = yes ]]   if [[ ${valid_session} = yes ]]
96   then   then
# Line 142  invalid_session() Line 104  invalid_session()
104  {  {
105   if [[ ${valid_session} != yes ]]   if [[ ${valid_session} != yes ]]
106   then   then
107   echo "not logged in..."   eecho "not logged in..."
108   # export quit signal   # export quit signal
109   export run=quit   export run=quit
110   fi   fi

Legend:
Removed from v.1248  
changed lines
  Added in v.2207