summaryrefslogtreecommitdiff
path: root/files/common/www/service/cgi-bin/splash_click
diff options
context:
space:
mode:
authorKatze Miau <miaukatzemiau@priveasy.de>2011-12-11 15:42:01 (GMT)
committerKatze Miau <miaukatzemiau@priveasy.de>2011-12-11 15:42:01 (GMT)
commit9809a97ce4ac8f5b374c7b1d91b5d4571dbf6392 (patch)
treeb30dbdb81a1b1f446f440a22037b2fc4192bda4e /files/common/www/service/cgi-bin/splash_click
parented254615ad04befe9f847879b3d78567c51f673b (diff)
split /www into subdirs for several services; adapt uhttpd config
This patch splits the single uhttpd instance into two uhttpd instances with www root /www/<servicename> for the following purposes: - service :: self-service / debugging / status.xml - redirection :: use for splash/robinson redirection The uhttpd uci config is adapted: by default all instances declared there are disabled; They shall be enabled by the FSM inetable. To this end a listen_http directive will be added and the config type will be changed from 'disabled' to 'uhttpd' by state transition scripts.
Diffstat (limited to 'files/common/www/service/cgi-bin/splash_click')
-rwxr-xr-xfiles/common/www/service/cgi-bin/splash_click38
1 files changed, 38 insertions, 0 deletions
diff --git a/files/common/www/service/cgi-bin/splash_click b/files/common/www/service/cgi-bin/splash_click
new file mode 100755
index 0000000..d08af6a
--- /dev/null
+++ b/files/common/www/service/cgi-bin/splash_click
@@ -0,0 +1,38 @@
+#!/bin/sh
+echo -en "Status: 200 OK\r\n"
+echo -en "Content-Type: text/html\r\n"
+echo -en "\r\n"
+TEST=`cat `
+TEST=`echo $TEST | sed 's/'target_url='/''/g'`
+TEST=`/bin/urldecode "$TEST"`
+TEST=`echo $TEST | sed 's/%2F/\//g'`
+USER_MAC=`cat /proc/net/arp | grep $REMOTE_HOST | awk 'BEGIN { FS = " " } ; { print $4 }'`
+
+. $IPKG_INSTROOT/etc/functions.sh
+ISSPLASHED=0
+config_load splash_users
+is_mac() {
+ config_get mac "$1" mac
+ if [ "$mac" == "$USER_MAC" ]; then
+ ISSPLASHED=1
+ fi
+}
+#check if user is alredy splashed
+config_foreach is_mac user
+sed 's/targeturl/'"$(echo $TEST| sed 's#/#\\/#g')"'/g' /www/iframe.html
+
+if [ $ISSPLASHED -eq 1 ]; then
+ exit
+fi
+#User is now free to go
+iptables -t nat -I ffj_splash 1 -m --mac-source $USER_MAC -j ACCEPT
+
+uci -q add splash_users user
+uci -q set splash_users.@user[-1].mac=$USER_MAC
+uci -q set splash_users.@user[-1].time=`date +%s`
+
+exit 0
+
+
+
+
contact: Jan Huwald // Impressum