From: Howard Chu Date: Thu, 9 Oct 2003 10:36:28 +0000 (+0000) Subject: Fix non-portable initializers. X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~604 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a53514078c9d3320b2fc3009cf357a2a26adb55d;p=openldap Fix non-portable initializers. --- diff --git a/contrib/ldapsasl/ldapdb.c b/contrib/ldapsasl/ldapdb.c index 0ed61732af..1ce3db8977 100644 --- a/contrib/ldapsasl/ldapdb.c +++ b/contrib/ldapsasl/ldapdb.c @@ -88,11 +88,11 @@ static void ldapdb_auxprop_lookup(void *glob_context, int ret, i, n, *aindx; const struct propval *pr; LDAP *ld = NULL; - gluectx gc = { ctx, sparams }; + gluectx gc; struct berval *dn = NULL, **bvals; LDAPMessage *msg, *res; char **attrs = NULL, *authzid = NULL; - LDAPControl c, *ctrl[2] = {&c, NULL}; + LDAPControl c, *ctrl[2]; if(!ctx || !sparams || !user) return; @@ -151,14 +151,21 @@ static void ldapdb_auxprop_lookup(void *glob_context, if (ctx->use_tls > 1) goto done; } + gc.lc = ctx; + gc.lp = sparams; ret = ldap_sasl_interactive_bind_s(ld, NULL, ctx->mech.bv_val, NULL, NULL, LDAP_SASL_QUIET, ldapdb_interact, &gc); if (ret != LDAP_SUCCESS) goto done; + ctrl[0] = &c; + ctrl[1] = NULL; ret = ldap_whoami_s(ld, &dn, ctrl, NULL); if (ret != LDAP_SUCCESS || !dn) goto done; - if (dn->bv_val && !strncmp(dn->bv_val, "dn:", 3)) + if (!dn->bv_val || strncmp(dn->bv_val, "dn:", 3)) { + ber_bvfree(dn); + goto done; + } ret = ldap_search_s(ld, dn->bv_val+3, LDAP_SCOPE_BASE, "(objectclass=*)", attrs, 0, &res); ber_bvfree(dn);