|
Last change
on this file since 13371 was 13371, checked in by rick, 10 years ago |
|
Use headers since they are now served by httpd
|
-
Property svn:executable
set to
*
|
|
File size:
811 bytes
|
| Line | |
|---|
| 1 | #!/bin/sh
|
|---|
| 2 | #
|
|---|
| 3 | # CGI which process the request of the user _before_ he/she has pressed continue
|
|---|
| 4 | #
|
|---|
| 5 | # Rick van der Zwet <info@rickvanderzwet.nl>
|
|---|
| 6 | #
|
|---|
| 7 | PATH=$PATH:/usr/sbin:/usr/bin:/sbin
|
|---|
| 8 | DB=/tmp/authenticated.txt
|
|---|
| 9 | AUTOLOGIN_DB=/tmp/autologin.txt
|
|---|
| 10 |
|
|---|
| 11 | REMOTE_MAC=`arp -n $REMOTE_ADDR | awk '{print $4}'`
|
|---|
| 12 |
|
|---|
| 13 | # Make sure databases exists
|
|---|
| 14 | touch $DB $AUTOLOGIN_DB
|
|---|
| 15 |
|
|---|
| 16 | # Check user state
|
|---|
| 17 | if grep -q $REMOTE_MAC $DB; then
|
|---|
| 18 | # User has already been here (ones) continue authention directly
|
|---|
| 19 | ./login/index.cgi
|
|---|
| 20 | elif grep -q $REMOTE_MAC $AUTOLOGIN_DB; then
|
|---|
| 21 | # Device is marked as special, continue with autologin
|
|---|
| 22 | ./login/index.cgi
|
|---|
| 23 | else
|
|---|
| 24 | echo 'Content-Type: text/html'
|
|---|
| 25 | echo ''
|
|---|
| 26 | # User is new, present welcome page
|
|---|
| 27 | sed -e "s/\$REMOTE_ADDR/$REMOTE_ADDR/" \
|
|---|
| 28 | -e "s/\$REMOTE_MAC/$REMOTE_MAC/" \
|
|---|
| 29 | `dirname $0`/index.html.tmpl
|
|---|
| 30 | fi
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.