diff options
author | Katze Miau <miaukatzemiau@priveasy.de> | 2011-12-20 16:57:45 (GMT) |
---|---|---|
committer | Katze Miau <miaukatzemiau@priveasy.de> | 2011-12-20 16:57:45 (GMT) |
commit | d7e1ba6fbf5d4c6ea4f72c604338aba73f1464e7 (patch) | |
tree | a775c702cd72566c55d3eea5fe8c86b4c65ef73d | |
parent | 8ebdb23cff88abd518c8f631eb5e8cc65036d08e (diff) |
cosmetic fixes missed in the previous commit
-rw-r--r-- | files/common/etc/splash.sh | 18 | ||||
-rwxr-xr-x | files/common/sbin/splash_sync | 2 | ||||
-rwxr-xr-x | files/common/www/service/cgi-bin/splash | 2 | ||||
-rwxr-xr-x | files/common/www/service/cgi-bin/splash_click | 3 |
4 files changed, 21 insertions, 4 deletions
diff --git a/files/common/etc/splash.sh b/files/common/etc/splash.sh new file mode 100644 index 0000000..b56ddb5 --- /dev/null +++ b/files/common/etc/splash.sh @@ -0,0 +1,18 @@ +timeout=6000 +chain_prefix=splash_db_ +chain_id_file=/tmp/splash_chain_id + +chain_id=$(cat $chain_id_file 2>/dev/null || true) +if ! [ "$chain_id" -gt 0 ] &>/dev/null; then + chain_id=1 + echo $chain_id > $chain_id_file +fi + +lockSplash () { + exec 666<$chain_id_file + flock -x 666 +} + +unlockSplash () { + exec 666<&- +} diff --git a/files/common/sbin/splash_sync b/files/common/sbin/splash_sync index 978583f..992ec3f 100755 --- a/files/common/sbin/splash_sync +++ b/files/common/sbin/splash_sync @@ -13,7 +13,7 @@ splash_check() { iptables -t nat -I $chain -m mac --mac-source $mac -j ACCEPT else # user is no longer splashed / must click again - uci delete splash_users.@user[$x] + uci delete splash_users.@user[$x] fi let x=$x+1 } diff --git a/files/common/www/service/cgi-bin/splash b/files/common/www/service/cgi-bin/splash index 086fa82..1237ce0 100755 --- a/files/common/www/service/cgi-bin/splash +++ b/files/common/www/service/cgi-bin/splash @@ -4,4 +4,4 @@ echo -en "Content-Type: text/html\r\n" echo -en "\r\n" targeturl="$(echo "$QUERY_STRING" | tr -d '/')" -sed "s/targeturl/"$targeturl"/g" splash.html +sed "s/targeturl/$targeturl/g" splash.html diff --git a/files/common/www/service/cgi-bin/splash_click b/files/common/www/service/cgi-bin/splash_click index d7e3f2f..1eb4e85 100755 --- a/files/common/www/service/cgi-bin/splash_click +++ b/files/common/www/service/cgi-bin/splash_click @@ -7,7 +7,6 @@ echo -en "Content-Type: text/html\r\n" echo -en "\r\n" # decode request params -# url is decoded twice, as it is encoded by the browser and once by us URL="http://$(sed 's/target_url=//g' | urldecode)" USER_MAC=$(grep ^$REMOTE_HOST </proc/net/arp \ | awk 'BEGIN { FS = " " } ; { print $4 }') @@ -34,5 +33,5 @@ if [ $ISSPLASHED -eq 0 ]; then fi unlockSplash -# send response +# send response (encode / to not confuse sed) sed "s/targeturl/$(echo "$URL" | sed 's#/#\\/#g')/g" iframe.html |