From: Thomas Jarosch Date: Mon, 31 Jan 2011 14:35:35 +0000 (+0100) Subject: Dyndns: Better handling for nochg and abuse return codes: Log them as unsuccessful... X-Git-Tag: v1.1~14 X-Git-Url: http://developer.intra2net.com/git/?p=bpdyndnsd;a=commitdiff_plain;h=cd5a41a42b516c2d81e6516472016723c04e421b Dyndns: Better handling for nochg and abuse return codes: Log them as unsuccessful updates and record the IP in the update log (for the burnt logic) --- diff --git a/src/service.cpp b/src/service.cpp index 1bab19b..3eebff0 100644 --- a/src/service.cpp +++ b/src/service.cpp @@ -280,7 +280,9 @@ void Service::update(const string& ip, const time_t current_time, bool changed_t { Log->print_update_service(service_name); - if ( perform_update(ip) == UpdateOk ) + UpdateErrorCode update_res = perform_update(ip); + + if (update_res == UpdateOk) { // if update was successful, we need to set the Lastupdated and ActualIP base member. set_last_update(current_time,ip); @@ -292,6 +294,13 @@ void Service::update(const string& ip, const time_t current_time, bool changed_t } else { + if (update_res == NoChange || update_res == Blocked) + { + // Log update for burnt IP logic and update "ActualIP" of this service + set_last_update(current_time,ip); + ActualIP = ip; + } + // problem while trying to update service Log->print_update_service_failure(service_name); diff --git a/src/service_dyndns.cpp b/src/service_dyndns.cpp index 5d7b8b8..4dc4789 100644 --- a/src/service_dyndns.cpp +++ b/src/service_dyndns.cpp @@ -134,14 +134,14 @@ Service::UpdateErrorCode ServiceDyndns::perform_update(const std::string& ip) // IP didn't change, this might indicate a problem at the // dyndns backend or another client is running elsewhere. get_logger()->print_update_failure(url, curl_data); - return UpdateOk; + return NoChange; } else if (curl_data.compare(0,5,"abuse") == 0 ) { // Account is blocked. Log it as a successful update // so the IP address will be "burnt" until it changes. get_logger()->print_update_failure(url, curl_data); - return UpdateOk; + return Blocked; } else if ( curl_data == "badauth" ) {