summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2016-03-04 17:42:05 +0100
committerKarolin Seeger <kseeger@samba.org>2016-03-15 20:29:33 +0100
commit0dc8e3120bc16d0d10aa07525a39afee15e156a9 (patch)
tree58c15005b31e63a46424f6966afc8570e0b074f2 /source3
parentf74d7f54c0d8ea366a1fd86ab0a0324144fdf7f4 (diff)
downloadsamba-0dc8e3120bc16d0d10aa07525a39afee15e156a9.tar.gz
s3:libads:ldap: print LDAP error message with log level 10.
Guenther BUG: https://bugzilla.samba.org/show_bug.cgi?id=11755 Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit 34030b025b9e4cd5e7321d6e242f6c03da2a60c0)
Diffstat (limited to 'source3')
-rw-r--r--source3/libads/ldap.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 9918b95e8c8..f4fc7b074ea 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -1628,6 +1628,17 @@ static ADS_STATUS ads_mod_ber(TALLOC_CTX *ctx, ADS_MODLIST *mods,
}
#endif
+static void ads_print_error(int ret, LDAP *ld)
+{
+ if (ret != 0) {
+ char *ld_error = NULL;
+ ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &ld_error);
+ DEBUG(10,("AD LDAP failure %d (%s):\n%s\n", ret,
+ ldap_err2string(ret), ld_error));
+ SAFE_FREE(ld_error);
+ }
+}
+
/**
* Perform an ldap modify
* @param ads connection to ads server
@@ -1663,6 +1674,7 @@ ADS_STATUS ads_gen_mod(ADS_STRUCT *ads, const char *mod_dn, ADS_MODLIST mods)
mods[i] = NULL;
ret = ldap_modify_ext_s(ads->ldap.ld, utf8_dn,
(LDAPMod **) mods, controls, NULL);
+ ads_print_error(ret, ads->ldap.ld);
TALLOC_FREE(utf8_dn);
return ADS_ERROR(ret);
}
@@ -1691,6 +1703,7 @@ ADS_STATUS ads_gen_add(ADS_STRUCT *ads, const char *new_dn, ADS_MODLIST mods)
mods[i] = NULL;
ret = ldap_add_s(ads->ldap.ld, utf8_dn, (LDAPMod**)mods);
+ ads_print_error(ret, ads->ldap.ld);
TALLOC_FREE(utf8_dn);
return ADS_ERROR(ret);
}
@@ -1712,6 +1725,7 @@ ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn)
}
ret = ldap_delete_s(ads->ldap.ld, utf8_dn);
+ ads_print_error(ret, ads->ldap.ld);
TALLOC_FREE(utf8_dn);
return ADS_ERROR(ret);
}