Sync with HEAD

This commit is contained in:
Kurt Zeilenga 2004-01-23 02:09:44 +00:00
parent ee4cf56000
commit 5e78cb385d
7 changed files with 74 additions and 47 deletions

View file

@ -1090,8 +1090,8 @@ print_entry(
} else if (( bvals = ldap_get_values_len( ld, entry, a )) != NULL ) {
for ( i = 0; bvals[i] != NULL; i++ ) {
if ( vals2tmp > 1 || ( vals2tmp
&& ldif_is_not_printable( bvals[i]->bv_val, bvals[i]->bv_len ) ))
if ( vals2tmp > 1 || ( vals2tmp && ldif_is_not_printable(
bvals[i]->bv_val, bvals[i]->bv_len ) ))
{
int tmpfd;
/* write value to file */

View file

@ -121,3 +121,9 @@ string LDAPObjClass::getName () {
else
return *(names.begin());
}
int LDAPObjClass::getKind () {
return kind;
}

View file

@ -67,6 +67,11 @@ class LDAPObjClass{
*/
string getName ();
/**
* Returns object class kind: 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY
*/
int getKind ();
/**
* Returns all object class names
*/

View file

@ -118,8 +118,9 @@ when connecting to a slapd and there is no x500dsa.hostname principal
registered with your Kerberos Domain Controller(s).
.TP
.B \-t
Write retrieved values to a set of temporary files. This is useful for
dealing with non-ASCII values such as jpegPhoto or audio.
Write retrieved non-printable values to a set of temporary files. This
is useful for dealing with values containing non-character data such as
jpegPhoto or audio.
.TP
.B \-A
Retrieve attributes only (no values). This is useful when you just want to

View file

@ -179,7 +179,6 @@ glue_back_db_destroy (
typedef struct glue_state {
int err;
int is_slimit;
int slimit;
int matchlen;
char *matched;
@ -194,7 +193,7 @@ glue_back_response ( Operation *op, SlapReply *rs )
switch(rs->sr_type) {
case REP_SEARCH:
if ( gs->is_slimit && rs->sr_nentries >= gs->slimit ) {
if ( gs->slimit && rs->sr_nentries >= gs->slimit ) {
gs->err = LDAP_SIZELIMIT_EXCEEDED;
return -1;
}
@ -203,14 +202,12 @@ glue_back_response ( Operation *op, SlapReply *rs )
return SLAP_CB_CONTINUE;
default:
if ( gs->is_slimit && rs->sr_err == LDAP_SIZELIMIT_EXCEEDED
&& rs->sr_nentries >= gs->slimit ) {
gs->err = LDAP_SIZELIMIT_EXCEEDED;
return -1;
}
if (rs->sr_err == LDAP_SUCCESS || gs->err != LDAP_SUCCESS) {
if (rs->sr_err == LDAP_SUCCESS ||
rs->sr_err == LDAP_SIZELIMIT_EXCEEDED ||
rs->sr_err == LDAP_TIMELIMIT_EXCEEDED ||
rs->sr_err == LDAP_ADMINLIMIT_EXCEEDED ||
gs->err != LDAP_SUCCESS)
gs->err = rs->sr_err;
}
if (gs->err == LDAP_SUCCESS && gs->matched) {
ch_free (gs->matched);
gs->matched = NULL;
@ -257,13 +254,11 @@ glue_back_search ( Operation *op, SlapReply *rs )
glueinfo *gi = (glueinfo *) b0->bd_info;
int i;
long stoptime = 0;
glue_state gs = {0, 0, 0, 0, NULL, 0, NULL};
glue_state gs = {0, 0, 0, NULL, 0, NULL};
slap_callback cb = { NULL, glue_back_response, NULL, NULL };
int scope0, slimit0, tlimit0;
struct berval dn, ndn;
gs.is_slimit = ( op->ors_slimit > 0 );
cb.sc_private = &gs;
cb.sc_next = op->o_callback;
@ -289,9 +284,7 @@ glue_back_search ( Operation *op, SlapReply *rs )
op->o_callback = &cb;
rs->sr_err = gs.err = LDAP_UNWILLING_TO_PERFORM;
scope0 = op->ors_scope;
if ( gs.is_slimit ) {
slimit0 = gs.slimit = op->ors_slimit;
}
slimit0 = gs.slimit = op->ors_slimit;
tlimit0 = op->ors_tlimit;
dn = op->o_req_dn;
ndn = op->o_req_ndn;
@ -309,7 +302,7 @@ glue_back_search ( Operation *op, SlapReply *rs )
break;
}
}
if ( gs.is_slimit ) {
if (slimit0) {
op->ors_slimit = slimit0 - rs->sr_nentries;
if (op->ors_slimit < 0) {
rs->sr_err = gs.err = LDAP_SIZELIMIT_EXCEEDED;
@ -364,9 +357,7 @@ glue_back_search ( Operation *op, SlapReply *rs )
}
end_of_loop:;
op->ors_scope = scope0;
if ( gs.is_slimit ) {
op->ors_slimit = slimit0;
}
op->ors_slimit = slimit0;
op->ors_tlimit = tlimit0;
op->o_req_dn = dn;
op->o_req_ndn = ndn;

View file

@ -290,7 +290,7 @@ send_ldap_controls( Operation *o, BerElement *ber, LDAPControl **c )
return rc;
}
void
static int
send_ldap_response(
Operation *op,
SlapReply *rs )
@ -311,7 +311,7 @@ send_ldap_response(
op->o_callback = op->o_callback->sc_next;
}
op->o_callback = sc;
if ( rc != SLAP_CB_CONTINUE ) goto cleanup;
if ( rc != SLAP_CB_CONTINUE ) goto clean2;
}
#ifdef LDAP_CONNECTIONLESS
@ -464,12 +464,18 @@ send_ldap_response(
num_pdu_sent++;
ldap_pvt_thread_mutex_unlock( &num_sent_mutex );
cleanup:;
cleanup:
/* Tell caller that we did this for real, as opposed to being
* overridden by a callback
*/
rc = SLAP_CB_CONTINUE;
if ( rs->sr_matched && rs->sr_flags & REP_MATCHED_MUSTBEFREED ) {
free( (char *)rs->sr_matched );
rs->sr_matched = NULL;
}
clean2:
if (op->o_callback) {
slap_callback *sc = op->o_callback;
for ( ; op->o_callback; op->o_callback = op->o_callback->sc_next ) {
@ -480,7 +486,7 @@ cleanup:;
op->o_callback = sc;
}
return;
return rc;
}
@ -518,11 +524,11 @@ send_ldap_disconnect( Operation *op, SlapReply *rs )
rs->sr_msgid = 0;
}
send_ldap_response( op, rs );
Statslog( LDAP_DEBUG_STATS,
if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {
Statslog( LDAP_DEBUG_STATS,
"conn=%lu op=%lu DISCONNECT tag=%lu err=%d text=%s\n",
op->o_connid, op->o_opid, rs->sr_tag, rs->sr_err, rs->sr_text ? rs->sr_text : "" );
}
}
void
@ -612,22 +618,22 @@ slap_send_ldap_result( Operation *op, SlapReply *rs )
rs->sr_tag = req2res( op->o_tag );
rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0;
send_ldap_response( op, rs );
if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {
if ( op->o_tag == LDAP_REQ_SEARCH ) {
char nbuf[64];
snprintf( nbuf, sizeof nbuf, "%d nentries=%d",
rs->sr_err, rs->sr_nentries );
if ( op->o_tag == LDAP_REQ_SEARCH ) {
char nbuf[64];
snprintf( nbuf, sizeof nbuf, "%d nentries=%d",
rs->sr_err, rs->sr_nentries );
Statslog( LDAP_DEBUG_STATS,
"conn=%lu op=%lu SEARCH RESULT tag=%lu err=%s text=%s\n",
op->o_connid, op->o_opid, rs->sr_tag, nbuf,
rs->sr_text ? rs->sr_text : "" );
} else {
Statslog( LDAP_DEBUG_STATS,
"conn=%lu op=%lu RESULT tag=%lu err=%d text=%s\n",
op->o_connid, op->o_opid, rs->sr_tag, rs->sr_err,
rs->sr_text ? rs->sr_text : "" );
Statslog( LDAP_DEBUG_STATS,
"conn=%lu op=%lu SEARCH RESULT tag=%lu err=%s text=%s\n",
op->o_connid, op->o_opid, rs->sr_tag, nbuf,
rs->sr_text ? rs->sr_text : "" );
} else {
Statslog( LDAP_DEBUG_STATS,
"conn=%lu op=%lu RESULT tag=%lu err=%d text=%s\n",
op->o_connid, op->o_opid, rs->sr_tag, rs->sr_err,
rs->sr_text ? rs->sr_text : "" );
}
}
if( tmp != NULL ) ch_free(tmp);

View file

@ -47,8 +47,6 @@ for i in 0 1 2 3 4 5; do
sleep 5
done
test $KILLSERVERS != no && kill -HUP $KILLPIDS
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
exit $RC
@ -65,8 +63,28 @@ if test $? != 0 ; then
echo "comparison failed - database was not created correctly"
echo $SEARCHFLT $LDIFFLT
$DIFF $SEARCHFLT $LDIFFLT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
echo "Testing sizelimit..."
$LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 -s one -z 2 > $SEARCHOUT 2>&1
RC=$?
if test $RC = 0 ; then
echo "sizelimit not detected at end of search."
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
$LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 -z 9 objectclass=OpenLDAPPerson > $SEARCHOUT 2>&1
RC=$?
if test $RC = 0 ; then
echo "sizelimit not detected at middle of search."
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
test $KILLSERVERS != no && kill -HUP $KILLPIDS
echo ">>>>> Test succeeded"
exit 0