[package] support pre-md5summed passwords in 6in4 scripts
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 4 Sep 2010 16:03:14 +0000 (16:03 +0000)
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 4 Sep 2010 16:03:14 +0000 (16:03 +0000)
The he.net ipv6 tunnels require that a user supply the md5sum of his password
when updating the ipv4 tunnel endpoint. the 6in4 package supports this well,
but requires that a user store his password in plaintext in uci. this patch
tries to detect whether the password in uci is already an md5sum
(32 characters containing only [a-z0-9]), so users can avoid storing plaintext
passwords.

Signed-off-by: Steven Brudenell <steven.brudenell@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22889 3c298f89-4303-0410-b956-a3cf2f4a3e73

package/6in4/files/6in4.hotplug

index 96b046d..b695b52 100644 (file)
@@ -32,7 +32,9 @@ if [ "$ACTION" = ifup ]; then
                        config_get password "$cfg" password
 
                        [ -n "$tunnelid" ] && [ -n "$username" ] && [ -n "$password" ] && {
-                               password="$(echo -n "$password" | md5sum)"; password="${password%% *}"
+                               [ "${#password}" != 32 ] || [ -n "$(echo "$password" | sed 's/[a-z0-9]//g')" ] && {
+                                       password="$(echo -n "$password" | md5sum)"; password="${password%% *}"
+                               }
                                uci_set_state network "$cfg" ipaddr "$wanip"
 
                                ( wget -qO/dev/null "http://ipv4.tunnelbroker.net/ipv4_end.php?ipv4b=AUTO&user_id=$username&pass=$password&tunnel_id=$tunnelid" && ifup "$cfg" )&
This page took 0.023847 seconds and 4 git commands to generate.