1 |
|
# $Id$ |
2 |
|
|
3 |
validate_client() |
validate_client() |
4 |
{ |
{ |
5 |
local mac_address="$1" |
local mac_address="$1" |
6 |
local serial |
local serial |
7 |
|
local mtime |
8 |
|
|
9 |
if [[ -z ${mac_address} ]] |
if [[ -z ${mac_address} ]] |
10 |
then |
then |
17 |
|
|
18 |
if [[ -z ${serial} ]] |
if [[ -z ${serial} ]] |
19 |
then |
then |
20 |
|
mtime=$(date +%s) |
21 |
|
|
22 |
# request a new serial; one command now (cause must be done in the same session) |
# request a new serial; one command now (cause must be done in the same session) |
23 |
serial=$(mysqldo "insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}'); select last_insert_id();") |
serial=$(mysqldo "insert into client_serials (mtime, mac) values('${mtime}','${mac_address}'); select last_insert_id();") |
24 |
fi |
fi |
25 |
|
|
26 |
echo "serial='${serial}'" |
if [[ -z ${serial} ]] |
27 |
|
then |
28 |
|
return 1 |
29 |
|
else |
30 |
|
echo "serial='${serial}'" |
31 |
|
return 0 |
32 |
|
fi |
33 |
} |
} |
34 |
|
|
35 |
register_client() |
register_client() |
50 |
echo "DEBUG: mac_address='${mac_address}'" |
echo "DEBUG: mac_address='${mac_address}'" |
51 |
|
|
52 |
echo "register '${mac_address}'" |
echo "register '${mac_address}'" |
53 |
|
nsslsay_fingerprint "register '${mac_address}'" |
54 |
} |
} |