fixes
fix opendoor syntax made magic_run portable, but is now linux specific :-( mix add_token
This commit is contained in:
parent
f7d3297796
commit
f800860a9e
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
f=`basename $0`
|
f=`basename $0`
|
||||||
cd /home/cricket/door/
|
MAGIC=`readlink /proc/$$/fd/255`
|
||||||
|
cd `dirname $MAGIC`
|
||||||
lua $f.lua
|
lua $f.lua
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,9 @@ function add_token(con, token, gpg_id) -- add token to the database
|
||||||
local prefix = token:sub(1, config.prefix_len)
|
local prefix = token:sub(1, config.prefix_len)
|
||||||
if not gpg_id then
|
if not gpg_id then
|
||||||
gpg_id = con:execute("select trim(gpg_id) from tokens where prefix='"..prefix.."';"):fetch()
|
gpg_id = con:execute("select trim(gpg_id) from tokens where prefix='"..prefix.."';"):fetch()
|
||||||
|
if not gpg_id then
|
||||||
|
gpg_id = ""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local ttl = now + config.ttl + math.floor(math.random() * config.ruttl)
|
local ttl = now + config.ttl + math.floor(math.random() * config.ruttl)
|
||||||
|
|
13
www/opendoor
13
www/opendoor
|
@ -7,7 +7,7 @@ WLAN_NAME="<<</>>"
|
||||||
PREFIX_LEN=4
|
PREFIX_LEN=4
|
||||||
|
|
||||||
# END CONFIG
|
# END CONFIG
|
||||||
PORT=8888
|
PORT=80
|
||||||
STORE_ENC="$STORE.enc"
|
STORE_ENC="$STORE.enc"
|
||||||
STORE_TMP="$STORE.tmp"
|
STORE_TMP="$STORE.tmp"
|
||||||
|
|
||||||
|
@ -69,8 +69,13 @@ do_pgp() {
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
CSUM=`head -n 1 $STORE_ENC`
|
if [ -e $STORE ]; then
|
||||||
OSUM=`cat $STORE | cut -c1-${#CSUM}`
|
CSUM=`head -n 1 $STORE_ENC`
|
||||||
|
OSUM=`cat $STORE | cut -c1-${#CSUM}`
|
||||||
|
else
|
||||||
|
CSUM="1"
|
||||||
|
OSUM="2"
|
||||||
|
fi
|
||||||
if [ "x$CSUM" != "x$OSUM" ] || [ $FORCE_PGP != 0 ]; then
|
if [ "x$CSUM" != "x$OSUM" ] || [ $FORCE_PGP != 0 ]; then
|
||||||
rm -f $STORE_TMP
|
rm -f $STORE_TMP
|
||||||
tail -n +3 $STORE_ENC | gpg --decrypt --output $STORE_TMP
|
tail -n +3 $STORE_ENC | gpg --decrypt --output $STORE_TMP
|
||||||
|
@ -126,7 +131,7 @@ fi
|
||||||
|
|
||||||
|
|
||||||
do_pgp
|
do_pgp
|
||||||
if [[ $? -gt 2 ]]; then
|
if [ $? -gt 2 ]; then
|
||||||
echo "fatal error"
|
echo "fatal error"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue