]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
regex thread safety fix from head
authorKurt Zeilenga <kurt@openldap.org>
Thu, 15 May 2003 21:51:20 +0000 (21:51 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 15 May 2003 21:51:20 +0000 (21:51 +0000)
servers/slapd/saslauthz.c

index 50c6b5fd67b0ecf5f4ab2cf3d8d6b19e5c5b7a46..18a021cc8cb9a9f33df41b6700e98e611d8454cd 100644 (file)
@@ -33,7 +33,6 @@ typedef struct sasl_regexp {
   char *sr_match;                                                      /* regexp match pattern */
   char *sr_replace;                                            /* regexp replace pattern */
   regex_t sr_workspace;                                                /* workspace for regexp engine */
-  regmatch_t sr_strings[SASLREGEX_REPLACE];    /* strings matching $1,$2 ... */
   int sr_offset[SASLREGEX_REPLACE+2];          /* offsets of $1,$2... in *replace */
 } SaslRegexp_t;
 
@@ -281,6 +280,7 @@ static int slap_sasl_regexp( struct berval *in, struct berval *out )
 {
        char *saslname = in->bv_val;
        SaslRegexp_t *reg;
+       regmatch_t sr_strings[SASLREGEX_REPLACE];       /* strings matching $1,$2 ... */
        int i;
 
        memset( out, 0, sizeof( *out ) );
@@ -300,7 +300,7 @@ static int slap_sasl_regexp( struct berval *in, struct berval *out )
        /* Match the normalized SASL name to the saslregexp patterns */
        for( reg = SaslRegexp,i=0;  i<nSaslRegexp;  i++,reg++ ) {
                if ( regexec( &reg->sr_workspace, saslname, SASLREGEX_REPLACE,
-                 reg->sr_strings, 0)  == 0 )
+                 sr_strings, 0)  == 0 )
                        break;
        }
 
@@ -312,7 +312,7 @@ static int slap_sasl_regexp( struct berval *in, struct berval *out )
         * to replace the $1,$2 with the strings that matched (b.*) and (d.*)
         */
        slap_sasl_rx_exp( reg->sr_replace, reg->sr_offset,
-               reg->sr_strings, saslname, out );
+               sr_strings, saslname, out );
 
 #ifdef NEW_LOGGING
        LDAP_LOG( TRANSPORT, ENTRY,