.BR soft
limit is used; if the requested time limit exceedes the
.BR hard
-limit, an "Unwilling to perform" is returned.
+limit, an "Administrative limit exceeded" is returned.
If the
.BR hard
limit is set to 0 or to the keyword "soft", the soft limit is used
.BR soft
limit is used; if the requested size limit exceedes the
.BR hard
-limit, an "Unwilling to perform" is returned.
+limit, an "Administrative limit exceeded" is returned.
If the
.BR hard
limit is set to 0 or to the keyword "soft", the soft limit is used
/* 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;
/* 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;
/* 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;
/* 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;
/* 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;
/* 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;
/* 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;
/* 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;
/* 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;
}
/* 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;
}
} else if ( strcasecmp( pattern, "users" ) == 0 ) {
type = SLAP_LIMITS_USERS;
- } else if ( strncasecmp( pattern, "dn", 2 ) == 0 ) {
+ } else if ( strncasecmp( pattern, "dn", sizeof( "dn") - 1 ) == 0 ) {
pattern += 2;
if ( pattern[0] == '.' ) {
pattern++;
- if ( strncasecmp( pattern, "exact", 5 ) == 0 ) {
+ if ( strncasecmp( pattern, "exact", sizeof( "exact" ) - 1 ) == 0 ) {
type = SLAP_LIMITS_EXACT;
pattern += 5;
- } else if ( strncasecmp( pattern, "base", 4 ) == 0 ) {
+ } else if ( strncasecmp( pattern, "base", sizeof( "base " ) - 1 ) == 0 ) {
type = SLAP_LIMITS_BASE;
pattern += 4;
- } else if ( strncasecmp( pattern, "one", 3 ) == 0 ) {
+ } else if ( strncasecmp( pattern, "one", sizeof( "one" ) - 1 ) == 0 ) {
type = SLAP_LIMITS_ONE;
pattern += 3;
- } else if ( strncasecmp( pattern, "subtree", 7 ) == 0 ) {
+ } else if ( strncasecmp( pattern, "subtree", sizeof( "subtree" ) - 1 ) == 0 ) {
type = SLAP_LIMITS_SUBTREE;
pattern += 7;
- } else if ( strncasecmp( pattern, "children", 8 ) == 0 ) {
+ } else if ( strncasecmp( pattern, "children", sizeof( "children" ) - 1 ) == 0 ) {
type = SLAP_LIMITS_CHILDREN;
pattern += 8;
- } else if ( strncasecmp( pattern, "regex", 5 ) == 0 ) {
+ } else if ( strncasecmp( pattern, "regex", sizeof( "regex" ) - 1 ) == 0 ) {
type = SLAP_LIMITS_REGEX;
pattern += 5;
* this could be deprecated in favour
* of the pattern = "anonymous" form
*/
- } else if ( strncasecmp( pattern, "anonymous", 9 ) == 0 ) {
+ } else if ( strncasecmp( pattern, "anonymous", sizeof( "anonymous" ) - 1 ) == 0 ) {
type = SLAP_LIMITS_ANONYMOUS;
pattern = NULL;
}
/*
* sanity checks ...
*/
- if ( limit.lms_t_hard > 0 && limit.lms_t_hard < limit.lms_t_soft ) {
+ if ( limit.lms_t_hard > 0 &&
+ ( limit.lms_t_hard < limit.lms_t_soft
+ || limit.lms_t_soft == -1 ) ) {
limit.lms_t_hard = limit.lms_t_soft;
}
- if ( limit.lms_s_hard > 0 && limit.lms_s_hard < limit.lms_s_soft ) {
+ if ( limit.lms_s_hard > 0 &&
+ ( limit.lms_s_hard < limit.lms_s_soft
+ || limit.lms_s_soft == -1 ) ) {
limit.lms_s_hard = limit.lms_s_soft;
}
assert( arg );
assert( limit );
- if ( strncasecmp( arg, "time", 4 ) == 0 ) {
+ if ( strncasecmp( arg, "time", sizeof( "time" ) - 1 ) == 0 ) {
arg += 4;
if ( arg[0] == '.' ) {
arg++;
- if ( strncasecmp( arg, "soft", 4 ) == 0 ) {
+ if ( strncasecmp( arg, "soft", sizeof( "soft" ) - 1 ) == 0 ) {
arg += 4;
if ( arg[0] != '=' ) {
return( 1 );
}
arg++;
- limit->lms_t_soft = atoi( arg );
+ if ( strcasecmp( arg, "none" ) == 0 ) {
+ limit->lms_t_soft = -1;
+ } else {
+ char *next = NULL;
+
+ limit->lms_t_soft =
+ strtol( arg, &next, 10 );
+ if ( next == arg || limit->lms_t_soft < -1 ) {
+ return( 1 );
+ }
+ }
- } else if ( strncasecmp( arg, "hard", 4 ) == 0 ) {
+ } else if ( strncasecmp( arg, "hard", sizeof( "hard" ) - 1 ) == 0 ) {
arg += 4;
if ( arg[0] != '=' ) {
return( 1 );
} else if ( strcasecmp( arg, "none" ) == 0 ) {
limit->lms_t_hard = -1;
} else {
- limit->lms_t_hard = atoi( arg );
+ char *next = NULL;
+
+ limit->lms_t_hard =
+ strtol( arg, &next, 10 );
+ if ( next == arg || limit->lms_t_hard < -1 ) {
+ return( 1 );
+ }
}
} else {
}
} else if ( arg[0] == '=' ) {
+ char *next = NULL;
+
arg++;
- limit->lms_t_soft = atoi( arg );
+ limit->lms_t_soft = strtol( arg, &next, 10 );
+ if ( next == arg || limit->lms_t_soft < -1 ) {
+ return( 1 );
+ }
limit->lms_t_hard = 0;
} else {
return( 1 );
}
- } else if ( strncasecmp( arg, "size", 4 ) == 0 ) {
+ } else if ( strncasecmp( arg, "size", sizeof( "size" ) - 1 ) == 0 ) {
arg += 4;
if ( arg[0] == '.' ) {
arg++;
- if ( strncasecmp( arg, "soft", 4 ) == 0 ) {
+ if ( strncasecmp( arg, "soft", sizeof( "soft" ) - 1 ) == 0 ) {
arg += 4;
if ( arg[0] != '=' ) {
return( 1 );
}
arg++;
- limit->lms_s_soft = atoi( arg );
+ if ( strcasecmp( arg, "none" ) == 0 ) {
+ limit->lms_s_soft = -1;
+ } else {
+ char *next = NULL;
+
+ limit->lms_s_soft =
+ strtol( arg, &next, 10 );
+ if ( next == arg || limit->lms_s_soft < -1 ) {
+ return( 1 );
+ }
+ }
- } else if ( strncasecmp( arg, "hard", 4 ) == 0 ) {
+ } else if ( strncasecmp( arg, "hard", sizeof( "hard" ) - 1 ) == 0 ) {
arg += 4;
if ( arg[0] != '=' ) {
return( 1 );
} else if ( strcasecmp( arg, "none" ) == 0 ) {
limit->lms_s_hard = -1;
} else {
- limit->lms_s_hard = atoi( arg );
+ char *next = NULL;
+
+ limit->lms_s_hard =
+ strtol( arg, &next, 10 );
+ if ( next == arg || limit->lms_s_hard < -1 ) {
+ return( 1 );
+ }
}
- } else if ( strncasecmp( arg, "unchecked", 9 ) == 0 ) {
+ } else if ( strncasecmp( arg, "unchecked", sizeof( "unchecked" ) - 1 ) == 0 ) {
arg += 9;
if ( arg[0] != '=' ) {
return( 1 );
if ( strcasecmp( arg, "none" ) == 0 ) {
limit->lms_s_unchecked = -1;
} else {
- limit->lms_s_unchecked = atoi( arg );
+ char *next = NULL;
+
+ limit->lms_s_unchecked =
+ strtol( arg, &next, 10 );
+ if ( next == arg || limit->lms_s_unchecked < -1 ) {
+ return( 1 );
+ }
}
} else {
}
} else if ( arg[0] == '=' ) {
+ char *next = NULL;
+
arg++;
- limit->lms_s_soft = atoi( arg );
+ limit->lms_s_soft = strtol( arg, &next, 10 );
+ if ( next == arg || limit->lms_s_soft < -1 ) {
+ return( 1 );
+ }
limit->lms_s_hard = 0;
} else {