lib/addns/dnsquery.c,lib/addns/dnsquery.h,libcli/dns/dns.h,
  source3/utils/net_ads.c,source3/utils/net_dns.c,
  source3/utils/net_dns.h:

Since the realm may be different from the DNS domain:
  Query for SOA records to know where to update DNS.
  Fall back to checking for NS records if no SOA records found.
  Do not assume that the realm is the same as the DNS domain
    when creating the GSS security context for updating DNS.