From bc31350b37a35c7839ada5bce630e83bf7a3b01c Mon Sep 17 00:00:00 2001 From: binext <33397660+binext@users.noreply.github.com> Date: Thu, 7 Dec 2017 18:08:43 +0800 Subject: [PATCH] fix the aliddns that can't add * or @ add urlencode for $aliddns_name,fix the aliddns that can't add universal parse * or primary domain name @ the current_ip use "query_recordid" instead of "nslookup" --- package/lean/luci-app-aliddns/root/usr/sbin/aliddns | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/package/lean/luci-app-aliddns/root/usr/sbin/aliddns b/package/lean/luci-app-aliddns/root/usr/sbin/aliddns index 3c5c5a258..ac0e9672b 100755 --- a/package/lean/luci-app-aliddns/root/usr/sbin/aliddns +++ b/package/lean/luci-app-aliddns/root/usr/sbin/aliddns @@ -14,7 +14,8 @@ ip=$(ifconfig $interface 2> /dev/null | grep 'inet addr' | awk '{print $2}' | cu check_aliddns() { #ip=`wget -qO- http://whatismyip.akamai.com/ 2>/dev/null` -current_ip=`nslookup $aliddns_name.$aliddns_domain | grep "Address 1"|tail -n1|cut -d' ' -f3 2>/dev/null` +#current_ip=`nslookup $aliddns_name.$aliddns_domain | grep "Address 1"|tail -n1|cut -d' ' -f3 2>/dev/null` +current_ip=`query_recordid | sed 's/.*,"Value":"\([0-9\.]*\)",.*/\1/'` echo "$DATE 当前路由IP: ${ip}" >> /var/log/aliddns.log echo "$DATE 远程解析IP: ${current_ip}" >> /var/log/aliddns.log if [ "$ip" = "$current_ip" ] @@ -55,15 +56,15 @@ get_recordid() { } query_recordid() { - send_request "DescribeSubDomainRecords" "SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&SubDomain=$aliddns_name.$aliddns_domain&Timestamp=$timestamp" + send_request "DescribeSubDomainRecords" "SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&SubDomain=$(urlencode "$aliddns_name").$aliddns_domain&Timestamp=$timestamp" } update_record() { - send_request "UpdateDomainRecord" "RR=$aliddns_name&RecordId=$1&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp&Type=A&Value=$ip" + send_request "UpdateDomainRecord" "RR=$(urlencode "$aliddns_name")&RecordId=$1&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp&Type=A&Value=$ip" } add_record() { - send_request "AddDomainRecord&DomainName=$aliddns_domain" "RR=$aliddns_name&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp&Type=A&Value=$ip" + send_request "AddDomainRecord&DomainName=$aliddns_domain" "RR=$(urlencode "$aliddns_name")&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp&Type=A&Value=$ip" } go_record() { @@ -123,4 +124,4 @@ if [ "$aliddns_enable" != "1" ]; then go_record add_aliddns_cru fi - \ No newline at end of file +