Browse Source

return aRecord from ldap search

master
Gregory Rudolph 2 years ago
parent
commit
7708395971
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 4
      main.go

4
main.go

@ -96,7 +96,7 @@ func main() { @@ -96,7 +96,7 @@ func main() {
fmt.Sprintf("zoneName=%s,cn=dns,%s", ldap.EscapeFilter(domain), ldap.EscapeFilter(ldap_search_base)),
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
fmt.Sprintf("(relativeDomainName=%s)", ldap.EscapeFilter(host)),
[]string{"dn"},
[]string{"dn","aRecord"},
nil,
)
@ -108,7 +108,7 @@ func main() { @@ -108,7 +108,7 @@ func main() {
if len(sr.Entries) != 1 {
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()
if sr.Entries[0].GetAttributeValue("aRecord") == newIp {
log.Println("New IP is same as old IP, exiting gracefully.")

Loading…
Cancel
Save