From db7bf9a6b6754b604ee44d28c564bab10c7b98a7 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 14 Dec 2006 17:00:10 +0000 Subject: r20173: DNS update fixes: * Fix DNS updates for multi-homed hosts * Child domains often don't have an NS record in DNS so we have to fall back to looking up the the NS records for the forest root. * Fix compile warning caused by mismatched 'struct in_addr' and 'in_addr_t' parameters called to DoDNSUpdate() (This used to be commit 3486acd3c3ebefae8f98dcc72d1c3d6b06fffcc7) --- source3/libads/ads_struct.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source3/libads/ads_struct.c') diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c index 130d86b8dc..545995ddcc 100644 --- a/source3/libads/ads_struct.c +++ b/source3/libads/ads_struct.c @@ -75,6 +75,28 @@ char *ads_build_dn(const char *realm) return ads_build_path(realm, ".", "dc=", 0); } +/* return a DNS name in the for aa.bb.cc from the DN + "dc=AA,dc=BB,dc=CC". caller must free +*/ +char *ads_build_domain(const char *dn) +{ + char *dnsdomain = NULL; + + /* result should always be shorter than the DN */ + + if ( (dnsdomain = SMB_STRDUP( dn )) == NULL ) { + DEBUG(0,("ads_build_domain: malloc() failed!\n")); + return NULL; + } + + strlower_m( dnsdomain ); + all_string_sub( dnsdomain, "dc=", "", 0); + all_string_sub( dnsdomain, ",", ".", 0 ); + + return dnsdomain; +} + + #ifndef LDAP_PORT #define LDAP_PORT 389 -- cgit