summaryrefslogtreecommitdiffstats
path: root/daemons/ipa-otpd
diff options
context:
space:
mode:
authorNathaniel McCallum <npmccallum@redhat.com>2015-12-14 10:12:26 -0500
committerMartin Basti <mbasti@redhat.com>2016-01-12 12:28:44 +0100
commit563bddce6d0c3e31f4858edb25f1260af8cc3c44 (patch)
tree18eed1c46df61d762c333ca7fba6cdf02cbd341d /daemons/ipa-otpd
parent34b197afa4beb0a84ca01cb594c39859abdc4706 (diff)
downloadfreeipa-563bddce6d0c3e31f4858edb25f1260af8cc3c44.tar.gz
freeipa-563bddce6d0c3e31f4858edb25f1260af8cc3c44.tar.xz
freeipa-563bddce6d0c3e31f4858edb25f1260af8cc3c44.zip
Don't error when find_base() fails if a base is not required
We always have to call find_base() in order to force libldap to open the socket. However, if no base is actually required then there is no reason to error out if find_base() fails. This condition can arise when anonymous binds are disabled. Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'daemons/ipa-otpd')
-rw-r--r--daemons/ipa-otpd/main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/daemons/ipa-otpd/main.c b/daemons/ipa-otpd/main.c
index a5d1f93ff..aebc039bc 100644
--- a/daemons/ipa-otpd/main.c
+++ b/daemons/ipa-otpd/main.c
@@ -175,12 +175,13 @@ static krb5_error_code setup_ldap(const char *uri, krb5_boolean bind,
/* Always find the base since this forces open the socket. */
basetmp = find_base(ldp);
- if (basetmp == NULL)
- return ENOTCONN;
- if (base != NULL)
+ if (base != NULL) {
+ if (basetmp == NULL)
+ return ENOTCONN;
*base = basetmp;
- else
+ } else {
free(basetmp);
+ }
/* Set default timeout to just return immediately for async requests. */
memset(&timeout, 0, sizeof(timeout));