Magellan Linux

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

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

revision 2445 by niro, Thu Sep 3 13:36:12 2015 UTC revision 2461 by niro, Mon Sep 7 08:48:22 2015 UTC
# Line 6  validate_client() Line 6  validate_client()
6   local ip_address="$2"   local ip_address="$2"
7   local serial   local serial
8   local mtime   local mtime
9   local cmd   local serial_id
10    
11   if [[ -z ${mac_address} ]]   if [[ -z ${mac_address} ]]
12   then   then
# Line 41  validate_client() Line 41  validate_client()
41   decho "serial='${serial}'"   decho "serial='${serial}'"
42   rvecho "${serial}"   rvecho "${serial}"
43    
  cmd+="quiet"  
  cmd+="register '${serial}'"  
44   SSLSAY_IP="${ip_address}"   SSLSAY_IP="${ip_address}"
45   SSLSAY_PORT="6666"   SSLSAY_PORT="6666"
46   nsslsay_fingerprint ${cmd}   nsslsay_fingerprint "register '${serial}'"
47    
48     # register the client as online
49     serial_id=$(mysqldo "select serial from state_connected where serial=${serial};")
50     if [[ -n ${serial_id} ]]
51     then
52     mysqldo "update state_connected set ip='${ip_address}', mac='${mac_address}', mtime='${mtime}' where serial=${serial};"
53     else
54     mysqldo "insert into state_connected(serial,ip,mac,mtime) values('${serial}','${ip_address}','${mac_address}','${mtime}');"
55     fi
56    
57   return 0   return 0
58   fi   fi
# Line 57  register_client() Line 64  register_client()
64   local iface_ip   local iface_ip
65   local iface   local iface
66   local mac_address   local mac_address
  local cmd  
67    
68   control_server_ip=$(dns_to_ip ${MCORE_CONTROL_SERVER})   control_server_ip=$(dns_to_ip ${MCORE_CONTROL_SERVER})
69   iface_ip=$(iface_for_remote_addr ${control_server_ip})   iface_ip=$(iface_for_remote_addr ${control_server_ip})
# Line 70  register_client() Line 76  register_client()
76   decho "mac_address='${mac_address}'"   decho "mac_address='${mac_address}'"
77    
78   decho "register '${mac_address}'"   decho "register '${mac_address}'"
79     nsslsay_fingerprint "register '${mac_address}' '${iface_ip}'"
  cmd+="quiet"  
  cmd+="register '${mac_address}' '${iface_ip}'"  
  nsslsay_fingerprint ${cmd}  
80  }  }
81    
82  register_client_local()  register_client_local()
# Line 86  register_client_local() Line 89  register_client_local()
89   return 1   return 1
90   fi   fi
91    
92     install -d "${MCORE_CONFIG_PATH}"
93   CONFIG="${MCORE_CONFIG_PATH}/serial"   CONFIG="${MCORE_CONFIG_PATH}/serial"
94   clearconfig   clearconfig
95   addconfig "CLIENT_SERIAL=\"${serial}\""   addconfig "CLIENT_SERIAL=\"${serial}\""

Legend:
Removed from v.2445  
changed lines
  Added in v.2461