summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-01-26 00:14:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:06:15 -0500
commit69981e3341251250f0fa3ed61af184b9c1e8a78a (patch)
treecf36bcbbf7091dc3c246a68c27e16003ac23fa09 /source3/utils
parent60bcd1bd77557c86a7b384add8ff9b6b48a6e32d (diff)
downloadsamba-69981e3341251250f0fa3ed61af184b9c1e8a78a.tar.gz
samba-69981e3341251250f0fa3ed61af184b9c1e8a78a.tar.bz2
samba-69981e3341251250f0fa3ed61af184b9c1e8a78a.zip
r13148: Fix bug: #3413
Check that ldap admin dn is defined in smb.conf before setting the ldap password in secrets.tdb Based on patch by William Jojo <jojowil@hvcc.edu> Simo. (This used to be commit c2c004a620ecbd895786dc6f16fb6a616f354a0a)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/smbpasswd.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index 7659bb2997..29189c5feb 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -327,14 +327,20 @@ static int process_root(int local_flags)
char *old_passwd = NULL;
if (local_flags & LOCAL_SET_LDAP_ADMIN_PW) {
- printf("Setting stored password for \"%s\" in secrets.tdb\n",
- lp_ldap_admin_dn());
+ char *ldap_admin_dn = lp_ldap_admin_dn();
+ if ( ! *ldap_admin_dn ) {
+ DEBUG(0,("ERROR: 'ldap admin dn' not defined! Please check your smb.conf\n"));
+ goto done;
+ }
+
+ printf("Setting stored password for \"%s\" in secrets.tdb\n", ldap_admin_dn);
if ( ! *ldap_secret ) {
new_passwd = prompt_for_new_password(stdin_passwd_get);
fstrcpy(ldap_secret, new_passwd);
}
- if (!store_ldap_admin_pw(ldap_secret))
+ if (!store_ldap_admin_pw(ldap_secret)) {
DEBUG(0,("ERROR: Failed to store the ldap admin password!\n"));
+ }
goto done;
}