|
|
@ -96,7 +96,7 @@ func main() { |
|
|
|
fmt.Sprintf("zoneName=%s,cn=dns,%s", ldap.EscapeFilter(domain), ldap.EscapeFilter(ldap_search_base)), |
|
|
|
fmt.Sprintf("zoneName=%s,cn=dns,%s", ldap.EscapeFilter(domain), ldap.EscapeFilter(ldap_search_base)), |
|
|
|
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, |
|
|
|
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, |
|
|
|
fmt.Sprintf("(relativeDomainName=%s)", ldap.EscapeFilter(host)), |
|
|
|
fmt.Sprintf("(relativeDomainName=%s)", ldap.EscapeFilter(host)), |
|
|
|
[]string{"dn"}, |
|
|
|
[]string{"dn","aRecord"}, |
|
|
|
nil, |
|
|
|
nil, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -108,7 +108,7 @@ func main() { |
|
|
|
if len(sr.Entries) != 1 { |
|
|
|
if len(sr.Entries) != 1 { |
|
|
|
log.Fatalf("Host does not exist or too many entries returned (%+v)", len(sr.Entries)) |
|
|
|
log.Fatalf("Host does not exist or too many entries returned (%+v)", len(sr.Entries)) |
|
|
|
} |
|
|
|
} |
|
|
|
log.Printf("Record found for %s.%s", host, domain) |
|
|
|
log.Printf("Record found for %s.%s: %+v", host, domain, sr.Entries[0]) |
|
|
|
newIp := getip2() |
|
|
|
newIp := getip2() |
|
|
|
if sr.Entries[0].GetAttributeValue("aRecord") == newIp { |
|
|
|
if sr.Entries[0].GetAttributeValue("aRecord") == newIp { |
|
|
|
log.Println("New IP is same as old IP, exiting gracefully.") |
|
|
|
log.Println("New IP is same as old IP, exiting gracefully.") |
|
|
|