summaryrefslogtreecommitdiff
path: root/package/6in4
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2010-09-04 16:03:14 +0000
committerFlorian Fainelli <florian@openwrt.org>2010-09-04 16:03:14 +0000
commitf7538b68649edff265c4fbc1dfa9de97003ad08b (patch)
treef6903c27533da7571af2824fa8d8701b7d7b8d0e /package/6in4
parentca5bf9e291d7ba8cbd6bd287cec22298809fba81 (diff)
downloadmtk-20170518-f7538b68649edff265c4fbc1dfa9de97003ad08b.zip
mtk-20170518-f7538b68649edff265c4fbc1dfa9de97003ad08b.tar.gz
mtk-20170518-f7538b68649edff265c4fbc1dfa9de97003ad08b.tar.bz2
support pre-md5summed passwords in 6in4 scripts
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> SVN-Revision: 22889
Diffstat (limited to 'package/6in4')
-rw-r--r--package/6in4/files/6in4.hotplug4
1 files changed, 3 insertions, 1 deletions
diff --git a/package/6in4/files/6in4.hotplug b/package/6in4/files/6in4.hotplug
index 96b046d..b695b52 100644
--- a/package/6in4/files/6in4.hotplug
+++ b/package/6in4/files/6in4.hotplug
@@ -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" )&