mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
ITS#1951: saslRegexp limits syntax of regular expressions
Don't normalize regex. Also, s/LDAP_OPERATIONS_ERROR/LDAP_OTHER/
This commit is contained in:
parent
d01375b200
commit
d22612e8db
@ -175,7 +175,7 @@ static int slap_sasl_rx_off(char *rep, int *off)
|
|||||||
if ( n == SASLREGEX_REPLACE ) {
|
if ( n == SASLREGEX_REPLACE ) {
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
LDAP_LOG( TRANSPORT, ERR,
|
LDAP_LOG( TRANSPORT, ERR,
|
||||||
"slap_sasl_regexp_config: \"%s\" has too many $n "
|
"slap_sasl_rx_off: \"%s\" has too many $n "
|
||||||
"placeholders (max %d)\n", rep, SASLREGEX_REPLACE, 0 );
|
"placeholders (max %d)\n", rep, SASLREGEX_REPLACE, 0 );
|
||||||
#else
|
#else
|
||||||
Debug( LDAP_DEBUG_ANY,
|
Debug( LDAP_DEBUG_ANY,
|
||||||
@ -184,7 +184,7 @@ static int slap_sasl_rx_off(char *rep, int *off)
|
|||||||
rep, SASLREGEX_REPLACE, 0 );
|
rep, SASLREGEX_REPLACE, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return( LDAP_OPERATIONS_ERROR );
|
return( LDAP_OTHER );
|
||||||
}
|
}
|
||||||
off[n] = c - rep;
|
off[n] = c - rep;
|
||||||
n++;
|
n++;
|
||||||
@ -203,27 +203,14 @@ int slap_sasl_regexp_config( const char *match, const char *replace )
|
|||||||
const char *c;
|
const char *c;
|
||||||
int rc, n;
|
int rc, n;
|
||||||
SaslRegexp_t *reg;
|
SaslRegexp_t *reg;
|
||||||
struct berval bv, nbv;
|
struct berval bv;
|
||||||
Filter *filter;
|
Filter *filter;
|
||||||
|
|
||||||
SaslRegexp = (SaslRegexp_t *) ch_realloc( (char *) SaslRegexp,
|
SaslRegexp = (SaslRegexp_t *) ch_realloc( (char *) SaslRegexp,
|
||||||
(nSaslRegexp + 1) * sizeof(SaslRegexp_t) );
|
(nSaslRegexp + 1) * sizeof(SaslRegexp_t) );
|
||||||
reg = &( SaslRegexp[nSaslRegexp] );
|
reg = &( SaslRegexp[nSaslRegexp] );
|
||||||
ber_str2bv( match, 0, 0, &bv );
|
ber_str2bv( match, 0, 0, &bv );
|
||||||
rc = dnNormalize2( NULL, &bv, &nbv );
|
reg->sr_match = bv.bv_val;
|
||||||
if ( rc ) {
|
|
||||||
#ifdef NEW_LOGGING
|
|
||||||
LDAP_LOG( TRANSPORT, ERR,
|
|
||||||
"slap_sasl_regexp_config: \"%s\" could not be normalized.\n",
|
|
||||||
match, 0, 0 );
|
|
||||||
#else
|
|
||||||
Debug( LDAP_DEBUG_ANY,
|
|
||||||
"SASL match pattern %s could not be normalized.\n",
|
|
||||||
match, 0, 0 );
|
|
||||||
#endif
|
|
||||||
return( rc );
|
|
||||||
}
|
|
||||||
reg->sr_match = nbv.bv_val;
|
|
||||||
|
|
||||||
ber_str2bv( replace, 0, 0, &bv );
|
ber_str2bv( replace, 0, 0, &bv );
|
||||||
rc = slap_parseURI( &bv, ®->sr_replace.dn, ®->sr_replace.scope,
|
rc = slap_parseURI( &bv, ®->sr_replace.dn, ®->sr_replace.scope,
|
||||||
@ -255,7 +242,7 @@ int slap_sasl_regexp_config( const char *match, const char *replace )
|
|||||||
reg->sr_match, 0, 0 );
|
reg->sr_match, 0, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return( LDAP_OPERATIONS_ERROR );
|
return( LDAP_OTHER );
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = slap_sasl_rx_off( reg->sr_replace.dn.bv_val, reg->sr_dn_offset );
|
rc = slap_sasl_rx_off( reg->sr_replace.dn.bv_val, reg->sr_dn_offset );
|
||||||
|
Loading…
Reference in New Issue
Block a user