1 Commits

Author SHA1 Message Date
FoxyHunter c1a3b96a1d Fix: only update self domain if not in domain list 2026-06-10 20:51:59 +02:00
+11 -5
View File
@@ -108,8 +108,10 @@ int main(void) {
} }
int failed_updates = 0; int failed_updates = 0;
int self_domain_in_list = 0;
for (int i = 0; i < cfg.domain_count; i++) { for (int i = 0; i < cfg.domain_count; i++) {
if (strcmp(cfg.domains[i], cfg.dns_keeper_domain) == 0) continue; if (strcmp(cfg.domains[i], cfg.dns_keeper_domain) == 0)
self_domain_in_list = 1;
int gret = gandi_update_domains(cfg.domains[i], cached_ip, public_ip); int gret = gandi_update_domains(cfg.domains[i], cached_ip, public_ip);
if (gret == -3) { if (gret == -3) {
@@ -120,15 +122,19 @@ int main(void) {
} }
} }
if (!self_domain_in_list) {
int sret = gandi_update_record(cfg.dns_keeper_domain, cfg.dns_keeper_record, int sret = gandi_update_record(cfg.dns_keeper_domain, cfg.dns_keeper_record,
cached_ip, public_ip); cached_ip, public_ip);
if (sret == 0) { if (sret != 0) {
strncpy(cached_ip, public_ip, GANDI_MAX_IP_LEN - 1);
cached_ip[GANDI_MAX_IP_LEN - 1] = '\0';
} else {
log_error("Failed to update self record, cached IP not advanced"); log_error("Failed to update self record, cached IP not advanced");
failed_updates = 1; failed_updates = 1;
} }
}
if (!failed_updates) {
strncpy(cached_ip, public_ip, GANDI_MAX_IP_LEN - 1);
cached_ip[GANDI_MAX_IP_LEN - 1] = '\0';
}
if (failed_updates) log_error("One or more updates failed this cycle"); if (failed_updates) log_error("One or more updates failed this cycle");