summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-03-10 01:52:09 +0000
committerAndrew Tridgell <tridge@samba.org>2002-03-10 01:52:09 +0000
commit9b9d681870453c488a3c258ce7b56c5d250f3dc7 (patch)
tree8ec0eb397194d32f7004a6491afb34fde9d95a6a
parent683ba419ff2aeca94971a3bba9d7a1ee45374045 (diff)
downloadsamba-9b9d681870453c488a3c258ce7b56c5d250f3dc7.tar.gz
samba-9b9d681870453c488a3c258ce7b56c5d250f3dc7.tar.bz2
samba-9b9d681870453c488a3c258ce7b56c5d250f3dc7.zip
try to use our workstation account password for ADS leave
(This used to be commit 2a42e91397d7871d326abed0e99af297e71dd77e)
-rw-r--r--source3/utils/net_ads.c15
1 files changed, 11 insertions, 4 deletions
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;
}