+ rc = add_limits( be, type, pattern, &limit );
+ if ( rc ) {
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( CONFIG, CRIT,
+ "%s : line %d: unable to add limit in "
+ "\"limits <pattern> <limits>\" line.\n",
+ fname, lineno, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "%s : line %d: unable to add limit in "
+ "\"limits <pattern> <limits>\" line.\n",
+ fname, lineno, 0 );
+#endif
+ }
+
+ return( rc );
+}
+
+int
+parse_limit(
+ const char *arg,
+ struct slap_limits_set *limit
+)
+{
+ assert( arg );
+ assert( limit );
+
+ if ( strncasecmp( arg, "time", sizeof( "time" ) - 1 ) == 0 ) {
+ arg += 4;
+
+ if ( arg[0] == '.' ) {
+ arg++;
+ if ( strncasecmp( arg, "soft", sizeof( "soft" ) - 1 ) == 0 ) {
+ arg += 4;
+ if ( arg[0] != '=' ) {
+ return( 1 );
+ }
+ 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", sizeof( "hard" ) - 1 ) == 0 ) {
+ arg += 4;
+ if ( arg[0] != '=' ) {
+ return( 1 );
+ }
+ arg++;
+ if ( strcasecmp( arg, "soft" ) == 0 ) {
+ limit->lms_t_hard = 0;
+ } else if ( strcasecmp( arg, "none" ) == 0 ) {
+ limit->lms_t_hard = -1;
+ } else {
+ char *next = NULL;
+
+ limit->lms_t_hard =
+ strtol( arg, &next, 10 );
+ if ( next == arg || limit->lms_t_hard < -1 ) {
+ return( 1 );
+ }
+ }
+
+ } else {
+ return( 1 );
+ }
+
+ } else if ( arg[0] == '=' ) {
+ 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 );
+ }
+ }
+ limit->lms_t_hard = 0;
+
+ } else {
+ return( 1 );
+ }
+
+ } else if ( strncasecmp( arg, "size", sizeof( "size" ) - 1 ) == 0 ) {
+ arg += 4;
+
+ if ( arg[0] == '.' ) {
+ arg++;
+ if ( strncasecmp( arg, "soft", sizeof( "soft" ) - 1 ) == 0 ) {
+ arg += 4;
+ if ( arg[0] != '=' ) {
+ return( 1 );
+ }
+ 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", sizeof( "hard" ) - 1 ) == 0 ) {
+ arg += 4;
+ if ( arg[0] != '=' ) {
+ return( 1 );
+ }
+ arg++;
+ if ( strcasecmp( arg, "soft" ) == 0 ) {
+ limit->lms_s_hard = 0;
+ } else if ( strcasecmp( arg, "none" ) == 0 ) {
+ limit->lms_s_hard = -1;
+ } else {
+ 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", sizeof( "unchecked" ) - 1 ) == 0 ) {
+ arg += 9;
+ if ( arg[0] != '=' ) {
+ return( 1 );
+ }
+ arg++;
+ if ( strcasecmp( arg, "none" ) == 0 ) {
+ limit->lms_s_unchecked = -1;
+ } else {
+ char *next = NULL;
+
+ limit->lms_s_unchecked =
+ strtol( arg, &next, 10 );
+ if ( next == arg || limit->lms_s_unchecked < -1 ) {
+ return( 1 );
+ }
+ }
+
+ } else if ( strncasecmp( arg, "pr", sizeof( "pr" ) - 1 ) == 0 ) {
+ arg += sizeof( "pr" ) - 1;
+ if ( arg[0] != '=' ) {
+ return( 1 );
+ }
+ arg++;
+ if ( strcasecmp( arg, "noEstimate" ) == 0 ) {
+ limit->lms_s_pr_hide = 1;
+ } else {
+ char *next = NULL;
+
+ limit->lms_s_pr =
+ strtol( arg, &next, 10 );
+ if ( next == arg || limit->lms_s_pr < -1 ) {
+ return( 1 );
+ }
+ }
+
+ } else {
+ return( 1 );
+ }
+
+ } else if ( arg[0] == '=' ) {
+ 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 );
+ }
+ }
+ limit->lms_s_hard = 0;
+
+ } else {
+ return( 1 );
+ }
+ }
+
+ return 0;