From 9b9d681870453c488a3c258ce7b56c5d250f3dc7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 10 Mar 2002 01:52:09 +0000 Subject: try to use our workstation account password for ADS leave (This used to be commit 2a42e91397d7871d326abed0e99af297e71dd77e) --- source3/utils/net_ads.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'source3/utils/net_ads.c') diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index b9388f3349..22e511760c 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -197,13 +197,20 @@ static int net_ads_leave(int argc, const char **argv) ADS_STRUCT *ads = NULL; ADS_STATUS rc; extern pstring global_myname; + extern char *opt_user_name; + extern char *opt_password; - if (!(ads = ads_startup())) { + if (!secrets_init()) { + DEBUG(1,("Failed to initialise secrets database\n")); return -1; } - if (!secrets_init()) { - DEBUG(1,("Failed to initialise secrets database\n")); + if (!opt_password) { + asprintf(&opt_user_name, "%s$", global_myname); + opt_password = secrets_fetch_machine_password(); + } + + if (!(ads = ads_startup())) { return -1; } @@ -252,7 +259,7 @@ static int net_ads_join(int argc, const char **argv) 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 (dn:%s)\n", + d_printf("ads_join_realm: organizational unit %s does not exist (dn:%s)\n", org_unit, dn); return -1; } -- cgit