[packages] ddns-scripts: fix escaping of option values (closes: #5327)
authorNicolas Thill <nico@openwrt.org>
Tue, 29 Sep 2009 03:43:43 +0000 (03:43 +0000)
committerNicolas Thill <nico@openwrt.org>
Tue, 29 Sep 2009 03:43:43 +0000 (03:43 +0000)
SVN-Revision: 17798

net/ddns-scripts/Makefile
net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh
net/ddns-scripts/files/usr/lib/ddns/url_escape.sed [new file with mode: 0644]

index 97c3d96d4b14aa1b0625bf47ae4d02682ae384b3..444e931173a96a9b0b86be70518016b35b4787f8 100644 (file)
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ddns-scripts
 PKG_VERSION:=1.0.0
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
index 62d4886971bd78154ca8bc97a01d18798e4096de..ed0396da9c980a75c8cfdeb08c3c2b46505f41bf 100755 (executable)
@@ -250,7 +250,8 @@ do
                do
                        replace_name=$(echo "\[$option_var\]" | tr 'a-z' 'A-Z')
                        replace_value=$(eval echo "\$$option_var")
-                       final_url=$(echo $final_url | sed s/"$replace_name"/"$replace_value"/g )
+                       replace_value=$(echo $replace_value | sed -f /usr/lib/ddns/url_escape.sed)
+                       final_url=$(echo $final_url | sed s^"$replace_name"^"$replace_value"^g )
                done    
                final_url=$(echo $final_url | sed s/"\[IP\]"/"$current_ip"/g )
                
diff --git a/net/ddns-scripts/files/usr/lib/ddns/url_escape.sed b/net/ddns-scripts/files/usr/lib/ddns/url_escape.sed
new file mode 100644 (file)
index 0000000..eb7011b
--- /dev/null
@@ -0,0 +1,23 @@
+# sed url escaping
+s: :%20:g
+s:<:%3C:g
+s:>:%3E:g
+s:#:%23:g
+s:%:%25:g
+s:{:%7B:g
+s:}:%7D:g
+s:|:%7C:g
+s:\\:%5C:g
+s:\^:%5E:g
+s:~:%7E:g
+s:\[:%5B:g
+s:\]:%5D:g
+s:`:%60:g
+s:;:%3B:g
+s:/:%2F:g
+s:?:%3F:g
+s^:^%3A^g
+s:@:%40:g
+s:=:%3D:g
+s:&:%26:g
+s:\$:%24:g