summaryrefslogtreecommitdiff
path: root/source3/libads
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-12-14 17:00:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:29 -0500
commitdb7bf9a6b6754b604ee44d28c564bab10c7b98a7 (patch)
tree0eb5c3b53cf3410e6667651d7e337f40cb9c0656 /source3/libads
parent3ff4f4410ff71fc4c74b7546d0c0002918a32cf3 (diff)
downloadsamba-db7bf9a6b6754b604ee44d28c564bab10c7b98a7.tar.gz
samba-db7bf9a6b6754b604ee44d28c564bab10c7b98a7.tar.bz2
samba-db7bf9a6b6754b604ee44d28c564bab10c7b98a7.zip
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)
Diffstat (limited to 'source3/libads')
-rw-r--r--source3/libads/ads_struct.c22
1 files changed, 22 insertions, 0 deletions
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