slitaz-forge rev 584
ns.slitaz.org: add ipv6 support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Dec 06 21:55:31 2014 +0100 (2014-12-06) |
parents | 62c8bc6c4e36 |
children | 8c2372deec88 |
files | ns/web/index.cgi |
line diff
1.1 --- a/ns/web/index.cgi Sat Dec 06 14:45:30 2014 +0100 1.2 +++ b/ns/web/index.cgi Sat Dec 06 21:55:31 2014 +0100 1.3 @@ -9,14 +9,15 @@ 1.4 name="$(GET name)" 1.5 name="${name%.by.slitaz.org}" 1.6 if [ "$name" -a "$REMOTE_USER" ]; then 1.7 - if grep -qs ^$name $OWNERFILE ; then 1.8 + header 1.9 + if grep -qs "^$name " $OWNERFILE ; then 1.10 owner="$(sed "/^$name /!d;s/.* //" $OWNERFILE)" 1.11 if [ "$owner" != "$REMOTE_USER" ]; then 1.12 echo "$name is already used by $owner. Abort." 1.13 exit 1 1.14 fi 1.15 else 1.16 - echo "$name $REMOTE_USER" >> $OWNERFILE 1.17 + echo "$name $(date -u) $REMOTE_USER" >> $OWNERFILE 1.18 fi 1.19 addip=yes 1.20 case " $(GET) " in 1.21 @@ -24,10 +25,12 @@ 1.22 addip= 1.23 sed -i "/^$name /d" $OWNERFILE 1.24 esac 1.25 + type="A" 1.26 + echo "$ip" | grep -q : && type="AAAA" 1.27 req="server 127.0.0.1 1.28 -update delete $name.by.slitaz.org A" 1.29 +update delete $name.by.slitaz.org $type" 1.30 [ "$addip" ] && req="$req 1.31 -update add $name.by.slitaz.org 900 A $ip" 1.32 +update add $name.by.slitaz.org 900 $type $ip" 1.33 case " $(GET) " in 1.34 *\ mx\ *) 1.35 mx="$(GET mx)" 1.36 @@ -38,7 +41,7 @@ 1.37 update add $name.by.slitaz.org 900 MX 10 $mx" 1.38 esac 1.39 echo "$req 1.40 -send" | nsupdate 1.41 +send" | nsupdate 2>&1 1.42 else 1.43 #header "text/html; charset=utf-8" 1.44 cat <<EOT 1.45 @@ -74,7 +77,7 @@ 1.46 <div id="network"> 1.47 <a href="http://www.slitaz.org/">Home</a> 1.48 <a href="http://bugs.slitaz.org/">Bugs</a> 1.49 - <a href="http://hg.slitaz.org/wok/">Hg</a> 1.50 + <a href="http://hg.slitaz.org/?sort=lastchange">Hg</a> 1.51 <a href="http://forum.slitaz.org/">Forum</a> 1.52 <a href="http://roadmap.slitaz.org/">Roadmap</a> 1.53 <a href="http://pizza.slitaz.me/">Pizza</a> 1.54 @@ -90,11 +93,11 @@ 1.55 cat <<EOT 1.56 <h3>Status</h3> 1.57 $REMOTE_USER has $(grep " $REMOTE_USER$" $OWNERFILE | wc -l) names 1.58 -the in by.slitaz.org domain. 1.59 +in the by.slitaz.org domain. 1.60 <pre> 1.61 EOT 1.62 for i in $(grep " $REMOTE_USER$" $OWNERFILE | sed 's/ .*//'); do 1.63 - grep "^$i " /etc/bind/by.slitaz.org 1.64 + dig @127.0.0.1 $i.by.slitaz.org ANY | grep ^$i 1.65 done 1.66 cat <<EOT 1.67 </pre>