From: Pierangelo Masarati Date: Sat, 6 Aug 2005 20:56:02 +0000 (+0000) Subject: fix potential leak (if URL form is broken); cleanup X-Git-Tag: OPENLDAP_AC_BP~91 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8b54d3b7e19d875550377be5fc815c03b327110e;p=openldap fix potential leak (if URL form is broken); cleanup --- diff --git a/servers/slapd/saslauthz.c b/servers/slapd/saslauthz.c index 80300f8c71..b3885374fe 100644 --- a/servers/slapd/saslauthz.c +++ b/servers/slapd/saslauthz.c @@ -94,8 +94,8 @@ static const char *policy_txt[] = { static int authz_policy = SASL_AUTHZ_NONE; -static -int slap_sasl_match( Operation *opx, struct berval *rule, +static int +slap_sasl_match( Operation *opx, struct berval *rule, struct berval *assertDN, struct berval *authc ); int slap_sasl_setpolicy( const char *arg ) @@ -222,6 +222,7 @@ static int slap_parseURI( Operation *op, struct berval *uri, "slap_parseURI: parsing %s\n", uri->bv_val, 0, 0 ); rc = LDAP_PROTOCOL_ERROR; + /* * dn[.]: * ::= {exact|regex|children|subtree|onelevel} @@ -435,7 +436,8 @@ is_dn: bv.bv_len = uri->bv_len - (bv.bv_val - uri->bv_val); /* * must be ldap:/// */ - return LDAP_PROTOCOL_ERROR; + rc = LDAP_PROTOCOL_ERROR; + goto done; } break; @@ -445,12 +447,14 @@ is_dn: bv.bv_len = uri->bv_len - (bv.bv_val - uri->bv_val); * * NOTE: must pass DN normalization */ + ldap_free_urldesc( ludp ); bv.bv_val = uri->bv_val; *scope = LDAP_X_SCOPE_EXACT; goto is_dn; default: - return LDAP_PROTOCOL_ERROR; + rc = LDAP_PROTOCOL_ERROR; + goto done; } if ( ( ludp->lud_host && *ludp->lud_host ) @@ -885,8 +889,8 @@ slap_sasl_matches( Operation *op, BerVarray rules, * The assertDN should not have the dn: prefix */ -static -int slap_sasl_match( Operation *opx, struct berval *rule, +static int +slap_sasl_match( Operation *opx, struct berval *rule, struct berval *assertDN, struct berval *authc ) { int rc; @@ -1136,8 +1140,12 @@ COMPLETE: * an internal search must be done, and if that search returns exactly one * entry, return the DN of that one entry. */ -void slap_sasl2dn( Operation *opx, - struct berval *saslname, struct berval *sasldn, int flags ) +void +slap_sasl2dn( + Operation *opx, + struct berval *saslname, + struct berval *sasldn, + int flags ) { int rc; slap_callback cb = { NULL, sasl_sc_sasl2dn, NULL, NULL };