Commit e312dae2 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Search limit updates and other misc cleanup

parent 06b5fb1b
......@@ -110,12 +110,14 @@ ldap_back_search(
/* if requested limit higher than hard limit, abort */
if ( !isroot && tlimit > limit->lms_t_hard ) {
/* no hard limit means use soft instead */
if ( limit->lms_t_hard == 0 && tlimit > limit->lms_t_soft ) {
if ( limit->lms_t_hard == 0
&& limit->lms_t_soft > -1
&& tlimit > limit->lms_t_soft ) {
tlimit = limit->lms_t_soft;
/* positive hard limit means abort */
} else if ( limit->lms_t_hard > 0 ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
send_ldap_result( conn, op, LDAP_ADMINLIMIT_EXCEEDED,
NULL, NULL, NULL, NULL );
rc = 0;
goto finish;
......@@ -128,12 +130,14 @@ ldap_back_search(
/* if requested limit higher than hard limit, abort */
if ( !isroot && slimit > limit->lms_s_hard ) {
/* no hard limit means use soft instead */
if ( limit->lms_s_hard == 0 && slimit > limit->lms_s_soft ) {
if ( limit->lms_s_hard == 0
&& limit->lms_s_soft > -1
&& slimit > limit->lms_s_soft ) {
slimit = limit->lms_s_soft;
/* positive hard limit means abort */
} else if ( limit->lms_s_hard > 0 ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
send_ldap_result( conn, op, LDAP_ADMINLIMIT_EXCEEDED,
NULL, NULL, NULL, NULL );
rc = 0;
goto finish;
......
......@@ -131,7 +131,9 @@ ldbm_back_db_init(
struct ldbminfo *li;
/* indicate system schema supported */
be->be_flags |= SLAP_BFLAG_ALIASES|SLAP_BFLAG_REFERRALS;
be->be_flags |=
SLAP_BFLAG_ALIASES |
SLAP_BFLAG_REFERRALS;
/* allocate backend-database-specific stuff */
li = (struct ldbminfo *) ch_calloc( 1, sizeof(struct ldbminfo) );
......
......@@ -247,13 +247,15 @@ searchit:
/* if requested limit higher than hard limit, abort */
} else if ( tlimit > limit->lms_t_hard ) {
/* no hard limit means use soft instead */
if ( limit->lms_t_hard == 0 && tlimit > limit->lms_t_soft ) {
if ( limit->lms_t_hard == 0
&& limit->lms_t_soft > -1
&& tlimit > limit->lms_t_soft ) {
tlimit = limit->lms_t_soft;
/* positive hard limit means abort */
} else if ( limit->lms_t_hard > 0 ) {
send_search_result( conn, op,
LDAP_UNWILLING_TO_PERFORM,
LDAP_ADMINLIMIT_EXCEEDED,
NULL, NULL, NULL, NULL, 0 );
rc = 0;
goto done;
......@@ -269,13 +271,15 @@ searchit:
/* if requested limit higher than hard limit, abort */
} else if ( slimit > limit->lms_s_hard ) {
/* no hard limit means use soft instead */
if ( limit->lms_s_hard == 0 && slimit > limit->lms_s_soft ) {
if ( limit->lms_s_hard == 0
&& limit->lms_s_soft > -1
&& slimit > limit->lms_s_soft ) {
slimit = limit->lms_s_soft;
/* positive hard limit means abort */
} else if ( limit->lms_s_hard > 0 ) {
send_search_result( conn, op,
LDAP_UNWILLING_TO_PERFORM,
LDAP_ADMINLIMIT_EXCEEDED,
NULL, NULL, NULL, NULL, 0 );
rc = 0;
goto done;
......
......@@ -167,12 +167,14 @@ meta_back_search(
/* if requested limit higher than hard limit, abort */
if ( !isroot && tlimit > limit->lms_t_hard ) {
/* no hard limit means use soft instead */
if ( limit->lms_t_hard == 0 && tlimit > limit->lms_t_soft ) {
if ( limit->lms_t_hard == 0
&& limit->lms_t_soft > -1
&& tlimit > limit->lms_t_soft ) {
tlimit = limit->lms_t_soft;
/* positive hard limit means abort */
} else if ( limit->lms_t_hard > 0 ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
send_ldap_result( conn, op, LDAP_ADMINLIMIT_EXCEEDED,
NULL, NULL, NULL, NULL );
rc = 0;
goto finish;
......@@ -185,12 +187,14 @@ meta_back_search(
/* if requested limit higher than hard limit, abort */
if ( !isroot && slimit > limit->lms_s_hard ) {
/* no hard limit means use soft instead */
if ( limit->lms_s_hard == 0 && slimit > limit->lms_s_soft ) {
if ( limit->lms_s_hard == 0
&& limit->lms_s_soft > -1
&& slimit > limit->lms_s_soft ) {
slimit = limit->lms_s_soft;
/* positive hard limit means abort */
} else if ( limit->lms_s_hard > 0 ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
send_ldap_result( conn, op, LDAP_ADMINLIMIT_EXCEEDED,
NULL, NULL, NULL, NULL );
rc = 0;
goto finish;
......
......@@ -112,6 +112,16 @@ monitor_subsys_backend_init(
attr_merge( e, monitor_ad_desc, bv );
attr_merge( e_backend, monitor_ad_desc, bv );
if ( bi->bi_controls ) {
int j;
for ( j = 0; bi->bi_controls[ j ]; j++ ) {
bv[0].bv_val = bi->bi_controls[ j ];
bv[0].bv_len = strlen( bv[0].bv_val );
attr_merge( e, slap_schema.si_ad_supportedControl, bv );
}
}
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
......
......@@ -1074,13 +1074,15 @@ backsql_search(
/* if requested limit higher than hard limit, abort */
} else if ( tlimit > limit->lms_t_hard ) {
/* no hard limit means use soft instead */
if ( limit->lms_t_hard == 0 && tlimit > limit->lms_t_soft ) {
if ( limit->lms_t_hard == 0
&& limit->lms_t_soft > -1
&& tlimit > limit->lms_t_soft ) {
tlimit = limit->lms_t_soft;
/* positive hard limit means abort */
} else if ( limit->lms_t_hard > 0 ) {
send_search_result( conn, op,
LDAP_UNWILLING_TO_PERFORM,
LDAP_ADMINLIMIT_EXCEEDED,
NULL, NULL, NULL, NULL, 0 );
return 0;
}
......@@ -1095,13 +1097,15 @@ backsql_search(
/* if requested limit higher than hard limit, abort */
} else if ( slimit > limit->lms_s_hard ) {
/* no hard limit means use soft instead */
if ( limit->lms_s_hard == 0 && slimit > limit->lms_s_soft ) {
if ( limit->lms_s_hard == 0
&& limit->lms_s_soft > -1
&& slimit > limit->lms_s_soft ) {
slimit = limit->lms_s_soft;
/* positive hard limit means abort */
} else if ( limit->lms_s_hard > 0 ) {
send_search_result( conn, op,
LDAP_UNWILLING_TO_PERFORM,
LDAP_ADMINLIMIT_EXCEEDED,
NULL, NULL, NULL, NULL, 0 );
return 0;
}
......
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