From 9f85d4ad5f2bb5fdb7739b3f90c4bfac705393ce Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 16 Jan 2002 02:22:30 +0000 Subject: much better support for organisational units in ADS join (This used to be commit 7e876057d5e392f85e6fdb0f2c233b0fe76df688) --- source3/utils/net_ads.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source3/utils/net_ads.c') diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 7baa297230..fec31c6ea3 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -211,6 +211,7 @@ static int net_ads_join(int argc, const char **argv) char *dn; void *res; DOM_SID dom_sid; + char *ou_str; if (argc > 0) org_unit = argv[0]; @@ -224,16 +225,19 @@ static int net_ads_join(int argc, const char **argv) if (!(ads = ads_startup())) return -1; - asprintf(&dn, "cn=%s,%s", org_unit, ads->bind_path); + ou_str = ads_ou_string(org_unit); + asprintf(&dn, "%s,%s", ou_str, ads->bind_path); + free(ou_str); rc = ads_search_dn(ads, &res, dn, NULL); - free(dn); ads_msgfree(ads, res); if (rc.error_type == ADS_ERROR_LDAP && rc.rc == LDAP_NO_SUCH_OBJECT) { - d_printf("ads_join_realm: organisational unit %s does not exist\n", org_unit); + d_printf("ads_join_realm: organisational unit %s does not exist (dn:%s)\n", + org_unit, dn); return -1; } + free(dn); if (!ADS_ERR_OK(rc)) { d_printf("ads_join_realm: %s\n", ads_errstr(rc)); -- cgit