summaryrefslogtreecommitdiffstats
path: root/src/util/sss_ldap.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-03-04 22:17:55 +0100
committerStephen Gallagher <sgallagh@redhat.com>2011-04-08 11:32:23 -0400
commit4a28fb10122bd74ba33607af46f028813de9161d (patch)
treeac0e97fc7be4f8c84a8591acc3fc66e96366aa8e /src/util/sss_ldap.c
parent63d85fff72563cb913287ab7785c551fa98fc35d (diff)
downloadsssd_unused-4a28fb10122bd74ba33607af46f028813de9161d.tar.gz
sssd_unused-4a28fb10122bd74ba33607af46f028813de9161d.tar.xz
sssd_unused-4a28fb10122bd74ba33607af46f028813de9161d.zip
Don't pass NULL to printf for TLS errors
https://fedorahosted.org/sssd/ticket/643
Diffstat (limited to 'src/util/sss_ldap.c')
-rw-r--r--src/util/sss_ldap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util/sss_ldap.c b/src/util/sss_ldap.c
index f098e7d6..a4d73a8a 100644
--- a/src/util/sss_ldap.c
+++ b/src/util/sss_ldap.c
@@ -22,7 +22,25 @@
#include "config.h"
#include "util/sss_ldap.h"
+#include "util/util.h"
+int sss_ldap_get_diagnostic_msg(TALLOC_CTX *mem_ctx, LDAP *ld, char **_errmsg)
+{
+ char *errmsg = NULL;
+ int optret;
+
+ optret = ldap_get_option(ld, SDAP_DIAGNOSTIC_MESSAGE, (void*)&errmsg);
+ if (optret != LDAP_SUCCESS) {
+ return EINVAL;
+ }
+
+ *_errmsg = talloc_strdup(mem_ctx, errmsg ? errmsg : "unknown error");
+ ldap_memfree(errmsg);
+ if (*_errmsg == NULL) {
+ return ENOMEM;
+ }
+ return EOK;
+}
int sss_ldap_control_create(const char *oid, int iscritical,
struct berval *value, int dupval,