]> git.sur5r.net Git - openldap/commitdiff
fix or comment Calysto findings
authorPierangelo Masarati <ando@openldap.org>
Tue, 21 Aug 2007 10:52:16 +0000 (10:52 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 21 Aug 2007 10:52:16 +0000 (10:52 +0000)
clients/tools/common.c
libraries/libldap/controls.c
libraries/libldap/extended.c
libraries/liblutil/ldif.c
libraries/liblutil/sasl.c
servers/slapd/back-ldap/bind.c
servers/slapd/back-meta/bind.c
servers/slapd/config.c

index 78d8db7811dbb874ef54ce50b903530048a07cea..1c84ff2a5aa16edff4ffdb2dbb0363493c296049 100644 (file)
@@ -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 );
index 51fde85a51c3c7a601b2b4aac5515be3108876cb..aa38040c3eed251186f467bd2b668838b0f456b8 100644 (file)
@@ -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;
        }
 
index 644180de0ecf0662291c4363544fb5131e8f54f5..5a6efda9f13bb0348122842a591b783e4b1768f6 100644 (file)
@@ -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 );
 
index 2af75fb73236caec40a64534769da10db1b26c6e..482a604d62b13f7c3756ea8c5941572c6d6fabb3 100644 (file)
@@ -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;
index ffbd29846e67b03fadbcd18010c79a319b3c4d32..50b5a29ddcfeae2b07c69e601e13cf1648702d5a 100644 (file)
@@ -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);
index ebc51bdbd0da072fa4c774d009ddc35a8d4200ea..fd5e39b217bfcdf7c8ec65a041354b585c03fe78 100644 (file)
@@ -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,
index c1c02496e81e7b99a40b8fc3c67c1daaa9251717..03e3ec204eb33d8e2975770f3871516ed0272c51 100644 (file)
@@ -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,
index b99d8f0a192f557fc676fcb07c56ea681e99ced8..d6655a78a01eda9113da6bec7324067e48a03e77 100644 (file)
@@ -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,