Commit 145e6fc1 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

fix or comment Calysto findings

parent 1a86e388
......@@ -1816,6 +1816,13 @@ void tool_print_ctrls(
char *str;
int j;
/* FIXME: there might be cases where a control has NULL OID;
* this makes little sense, especially when returned by the
* server, but libldap happily allows it */
if ( ctrls[i]->ldctl_oid == NULL ) {
continue;
}
len = ldif ? 2 : 0;
len += strlen( ctrls[i]->ldctl_oid );
......@@ -1824,7 +1831,7 @@ void tool_print_ctrls(
? sizeof("true") : sizeof("false");
/* convert to base64 */
if ( ctrls[i]->ldctl_value.bv_len ) {
if ( !BER_BVISNULL( &ctrls[i]->ldctl_value ) ) {
b64.bv_len = LUTIL_BASE64_ENCODE_LEN(
ctrls[i]->ldctl_value.bv_len ) + 1;
b64.bv_val = ber_memalloc( b64.bv_len + 1 );
......
......@@ -231,7 +231,7 @@ int ldap_pvt_get_controls(
if( tag == LBER_OCTETSTRING ) {
tag = ber_scanf( ber, "o", &tctrl->ldctl_value );
} else {
tctrl->ldctl_value.bv_val = NULL;
BER_BVZERO( &tctrl->ldctl_value );
}
*ctrls = tctrls;
......@@ -350,6 +350,7 @@ ldap_control_dup( const LDAPControl *c )
}
} else {
/* FIXME: how can a control have null OID? */
new->ldctl_oid = NULL;
}
......
......@@ -315,6 +315,7 @@ ldap_parse_intermediate (
if( retoidp != NULL ) *retoidp = NULL;
if( retdatap != NULL ) *retdatap = NULL;
if( serverctrls != NULL ) *serverctrls = NULL;
ber = ber_dup( res->lm_ber );
......
......@@ -865,6 +865,9 @@ ldif_read_record(
fp2 = ldif_open_url( ptr );
if ( fp2 ) {
LDIFFP *lnew = ber_memalloc( sizeof( LDIFFP ));
if ( lnew == NULL ) {
return 0;
}
lnew->prev = lfp->prev;
lnew->fp = lfp->fp;
lfp->prev = lnew;
......
......@@ -49,6 +49,8 @@ lutil_sasl_freedefs(
void *defaults )
{
lutilSASLdefaults *defs = defaults;
assert( defs != NULL );
if (defs->mech) ber_memfree(defs->mech);
if (defs->realm) ber_memfree(defs->realm);
......
......@@ -1352,6 +1352,14 @@ retry_lock:;
li->li_acl_authcID.bv_val,
li->li_acl_passwd.bv_val,
NULL );
if ( defaults == NULL ) {
rs->sr_err = LDAP_OTHER;
LDAP_BACK_CONN_ISBOUND_CLEAR( lc );
if ( sendok & LDAP_BACK_SENDERR ) {
send_ldap_result( op, rs );
}
goto done;
}
rs->sr_err = ldap_sasl_interactive_bind_s( lc->lc_ld,
li->li_acl_authcDN.bv_val,
......@@ -2091,6 +2099,14 @@ ldap_back_proxy_authz_bind(
li->li_idassert_authcID.bv_val,
li->li_idassert_passwd.bv_val,
authzID.bv_val );
if ( defaults == NULL ) {
rs->sr_err = LDAP_OTHER;
LDAP_BACK_CONN_ISBOUND_CLEAR( lc );
if ( sendok & LDAP_BACK_SENDERR ) {
send_ldap_result( op, rs );
}
goto done;
}
rs->sr_err = ldap_sasl_interactive_bind_s( lc->lc_ld, binddn->bv_val,
li->li_idassert_sasl_mech.bv_val, NULL, NULL,
......
......@@ -1425,6 +1425,14 @@ meta_back_proxy_authz_cred(
mt->mt_idassert_authcID.bv_val,
mt->mt_idassert_passwd.bv_val,
authzID.bv_val );
if ( defaults == NULL ) {
rs->sr_err = LDAP_OTHER;
LDAP_BACK_CONN_ISBOUND_CLEAR( msc );
if ( sendok & LDAP_BACK_SENDERR ) {
send_ldap_result( op, rs );
}
goto done;
}
rs->sr_err = ldap_sasl_interactive_bind_s( msc->msc_ld, binddn->bv_val,
mt->mt_idassert_sasl_mech.bv_val, NULL, NULL,
......
......@@ -1584,6 +1584,10 @@ slap_client_connect( LDAP **ldp, slap_bindconf *sb )
sb->sb_authcId.bv_val,
sb->sb_cred.bv_val,
sb->sb_authzId.bv_val );
if ( defaults == NULL ) {
rc = LDAP_OTHER;
goto done;
}
rc = ldap_sasl_interactive_bind_s( ld,
sb->sb_binddn.bv_val,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment