correctly parse responses from changeip.com (dyndns protocol)
[bpdyndnsd] / 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);