correctly parse responses from changeip.com (dyndns protocol)
authorGerd von Egidy <gerd.von.egidy@intra2net.com>
Thu, 12 Jun 2014 15:38:05 +0000 (17:38 +0200)
committerGerd von Egidy <gerd.von.egidy@intra2net.com>
Thu, 12 Jun 2014 15:38:05 +0000 (17:38 +0200)
src/service_dyndns.cpp

index 475d29e..1b6dc53 100644 (file)
@@ -125,7 +125,8 @@ Service::UpdateErrorCode ServiceDyndns::perform_update(const std::string& ip)
         // Get the received http data.
         string curl_data = HTTPHelp->get_curl_data();
 
-        if ( curl_data.compare(0,4,"good") == 0 )
+        if ( curl_data.compare(0,4,"good") == 0 ||                         // dyndns.org answer
+             curl_data.compare(0,21,"200 Successful Update") == 0)         // changeip.com answer
         {
             return UpdateOk;
         }
@@ -154,6 +155,12 @@ Service::UpdateErrorCode ServiceDyndns::perform_update(const std::string& ip)
             return UpdateError;
         }
     }
+    else if ( http_status_code == 401 )
+    {
+        // auth error as indicated by changeip.com
+        get_logger()->print_service_not_authorized(url,get_login(),get_password());
+        return NotAuth;
+    }
     else
     {
         get_logger()->print_update_failure(url,http_status_code);