]> git.sur5r.net Git - openldap/blobdiff - libraries/librewrite/config.c
Another getpeerucred(3) fix.
[openldap] / libraries / librewrite / config.c
index 9cf3ad98dc45f6c5f2de29fb0d647ba464567398..b6c729406eb5aa0df8b99b5b8ce116ff36ca8a2c 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2003 The OpenLDAP Foundation.
+ * Copyright 2000-2005 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,7 @@ rewrite_parse_builtin_map(
  * lines handled are of the form:
  *
  *      rewriteEngine          {on|off}
- *      rewriteMaxPasses        numPasses
+ *      rewriteMaxPasses        numPasses [numPassesPerRule]
  *      rewriteContext                 contextName [alias aliasedContextName]
  *      rewriteRule            pattern substPattern [ruleFlags]
  *      rewriteMap             mapType mapName [mapArgs]
@@ -103,7 +103,25 @@ rewrite_parse(
                                        fname, lineno, "" );
                        return -1;
                }
+
                info->li_max_passes = atoi( argv[ 1 ] );
+               if ( info->li_max_passes <= 0 ) {
+                       Debug( LDAP_DEBUG_ANY,
+                                       "[%s:%d] negative or null rewriteMaxPasses'\n",
+                                       fname, lineno, 0 );
+               }
+
+               if ( argc > 2 ) {
+                       info->li_max_passes_per_rule = atoi( argv[ 2 ] );
+                       if ( info->li_max_passes_per_rule <= 0 ) {
+                               Debug( LDAP_DEBUG_ANY,
+                                               "[%s:%d] negative or null rewriteMaxPassesPerRule'\n",
+                                               fname, lineno, 0 );
+                       }
+
+               } else {
+                       info->li_max_passes_per_rule = info->li_max_passes;
+               }
                rc = REWRITE_SUCCESS;
        
        /*