diff options
author | Gerald Carter <jerry@samba.org> | 2006-12-14 17:00:10 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2006-12-14 17:00:10 +0000 |
commit | bd26daed86816c1191092d11e557ee6ec3a02fe6 (patch) | |
tree | a462b7c645e7fb2d0ad595b4bf1d2da330b5942f /source/libads/ads_struct.c | |
parent | 9747bc3dd763b7e4f118764f8ce03dd00bdbf711 (diff) | |
download | samba-bd26daed86816c1191092d11e557ee6ec3a02fe6.tar.gz samba-bd26daed86816c1191092d11e557ee6ec3a02fe6.tar.xz samba-bd26daed86816c1191092d11e557ee6ec3a02fe6.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()
Diffstat (limited to 'source/libads/ads_struct.c')
-rw-r--r-- | source/libads/ads_struct.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/libads/ads_struct.c b/source/libads/ads_struct.c index 130d86b8dc8..545995ddccc 100644 --- a/source/libads/ads_struct.c +++ b/source/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 |