Commit 2f02920b authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

More for ITS#5927, ITS#5931

parent e671070a
......@@ -424,10 +424,34 @@ retry:
}
} else if ( rc == LDAP_RES_INTERMEDIATE ) {
Debug( LDAP_DEBUG_ANY,
"%s ldap_back_search: "
"intermediate response not supported yet.\n",
op->o_log_prefix, 0, 0 );
/* FIXME: response controls
* are passed without checks */
rc = ldap_parse_intermediate( lc->lc_ld,
res,
&rs->sr_rspoid,
&rs->sr_rspdata,
&rs->sr_ctrls,
0 );
if ( rc != LDAP_SUCCESS ) {
continue;
}
slap_send_ldap_intermediate( op, rs );
if ( rs->sr_rspoid != NULL ) {
ber_memfree( rs->sr_rspoid );
rs->sr_rspoid = NULL;
}
if ( rs->sr_rspdata != NULL ) {
ber_bvfree( rs->sr_rspdata );
rs->sr_rspdata = NULL;
}
if ( rs->sr_ctrls != NULL ) {
ldap_controls_free( rs->sr_ctrls );
rs->sr_ctrls = NULL;
}
} else {
char *err = NULL;
......@@ -646,7 +670,7 @@ ldap_build_entry(
attr = attr_alloc( NULL );
if ( attr == NULL ) {
continue;
return LDAP_OTHER;
}
if ( slap_bv2ad( &a, &attr->a_desc, &text )
!= LDAP_SUCCESS )
......@@ -658,6 +682,8 @@ ldap_build_entry(
"%s ldap_build_entry: "
"slap_bv2undef_ad(%s): %s\n",
op->o_log_prefix, a.bv_val, text );
( void )ber_scanf( &ber, "x" /* [W] */ );
attr_free( attr );
continue;
}
......@@ -680,7 +706,6 @@ ldap_build_entry(
* present...
*/
( void )ber_scanf( &ber, "x" /* [W] */ );
attr_free( attr );
continue;
}
......
......@@ -1212,6 +1212,44 @@ really_bad:;
rs->sr_ctrls = NULL;
}
} else if ( rc == LDAP_RES_INTERMEDIATE ) {
if ( candidates[ i ].sr_type == REP_INTERMEDIATE ) {
/* don't retry any more... */
candidates[ i ].sr_type = REP_RESULT;
}
/* FIXME: response controls
* are passed without checks */
rs->sr_err = ldap_parse_intermediate( msc->msc_ld,
msg,
&rs->sr_rspoid,
&rs->sr_rspdata,
&rs->sr_ctrls,
0 );
if ( rs->sr_err != LDAP_SUCCESS ) {
candidates[ i ].sr_type = REP_RESULT;
ldap_msgfree( res );
res = NULL;
goto really_bad;
}
slap_send_ldap_intermediate( op, rs );
if ( rs->sr_rspoid != NULL ) {
ber_memfree( rs->sr_rspoid );
rs->sr_rspoid = NULL;
}
if ( rs->sr_rspdata != NULL ) {
ber_bvfree( rs->sr_rspdata );
rs->sr_rspdata = NULL;
}
if ( rs->sr_ctrls != NULL ) {
ldap_controls_free( rs->sr_ctrls );
rs->sr_ctrls = NULL;
}
} else if ( rc == LDAP_RES_SEARCH_RESULT ) {
char buf[ SLAP_TEXT_BUFLEN ];
char **references = NULL;
......@@ -1412,16 +1450,6 @@ really_bad:;
assert( ncandidates > 0 );
--ncandidates;
} else if ( rc == LDAP_RES_INTERMEDIATE ) {
/* TODO: ITS#5931 */
/* ignore right now */
Debug( LDAP_DEBUG_ANY,
"%s meta_back_search[%ld]: "
"intermediate response message not supported yet.\n",
op->o_log_prefix,
i, 0 );
} else if ( rc == LDAP_RES_BIND ) {
meta_search_candidate_t retcode;
......@@ -1780,9 +1808,19 @@ meta_send_entry(
dn = BER_BVNULL;
const char *text;
dncookie dc;
ber_len_t len;
ber_tag_t tag;
int rc;
if ( ber_scanf( &ber, "{m{", &bdn ) == LBER_ERROR ) {
if ( ber_scanf( &ber, "l{", &len ) == LBER_ERROR ) {
return LDAP_DECODING_ERROR;
}
if ( ber_set_option( &ber, LBER_OPT_REMAINING_BYTES, &len ) != LBER_OPT_SUCCESS ) {
return LDAP_OTHER;
}
if ( ber_scanf( &ber, "m{", &bdn ) == LBER_ERROR ) {
return LDAP_DECODING_ERROR;
}
......@@ -1814,7 +1852,12 @@ meta_send_entry(
BER_BVZERO( &dn );
if ( rc != LDAP_SUCCESS ) {
return LDAP_INVALID_DN_SYNTAX;
Debug( LDAP_DEBUG_ANY,
"%s meta_send_entry(\"%s\"): "
"invalid DN syntax\n",
op->o_log_prefix, ent.e_name.bv_val, 0 );
rc = LDAP_INVALID_DN_SYNTAX;
goto done;
}
/*
......@@ -1833,6 +1876,20 @@ meta_send_entry(
slap_syntax_validate_func *validate;
slap_syntax_transform_func *pretty;
if ( ber_pvt_ber_remaining( &ber ) < 0 ) {
Debug( LDAP_DEBUG_ANY,
"%s meta_send_entry(\"%s\"): "
"unable to parse attr \"%s\".\n",
op->o_log_prefix, ent.e_name.bv_val, a.bv_val );
rc = LDAP_OTHER;
goto done;
}
if ( ber_pvt_ber_remaining( &ber ) == 0 ) {
break;
}
ldap_back_map( &mi->mi_targets[ target ]->mt_rwmap.rwm_at,
&a, &mapped, BACKLDAP_REMAP );
if ( BER_BVISNULL( &mapped ) || mapped.bv_val[0] == '\0' ) {
......@@ -1845,7 +1902,8 @@ meta_send_entry(
}
attr = attr_alloc( NULL );
if ( attr == NULL ) {
continue;
rc = LDAP_OTHER;
goto done;
}
if ( slap_bv2ad( &mapped, &attr->a_desc, &text )
!= LDAP_SUCCESS) {
......@@ -1861,6 +1919,7 @@ meta_send_entry(
mapped.bv_val, text );
Debug( LDAP_DEBUG_ANY, "%s", buf, 0, 0 );
( void )ber_scanf( &ber, "x" /* [W] */ );
attr_free( attr );
continue;
}
......@@ -1883,7 +1942,6 @@ meta_send_entry(
* present...
*/
( void )ber_scanf( &ber, "x" /* [W] */ );
attr_free(attr);
continue;
}
......@@ -2097,6 +2155,8 @@ next_attr:;
rc = LDAP_OTHER;
break;
}
done:;
rs->sr_entry = NULL;
rs->sr_attrs = NULL;
if ( rs->sr_ctrls != NULL ) {
......
Markdown is supported
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