+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl_regexp: converting SASL name %s\n", saslname, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "slap_sasl_regexp: converting SASL name %s\n",
+ saslname, 0, 0 );
+#endif
+
+ if (( saslname == NULL ) || ( nSaslRegexp == 0 ))
+ return( 0 );
+
+ /* Match the normalized SASL name to the saslregexp patterns */
+ for( reg = SaslRegexp,i=0; i<nSaslRegexp; i++,reg++ ) {
+ if ( regexec( ®->sr_workspace, saslname, SASLREGEX_REPLACE,
+ reg->sr_strings, 0) == 0 )
+ break;
+ }
+
+ if( i >= nSaslRegexp )
+ return( 0 );
+
+ /*
+ * The match pattern may have been of the form "a(b.*)c(d.*)e" and the
+ * replace pattern of the form "x$1y$2z". The returned string needs
+ * 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 );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( TRANSPORT, ENTRY,
+ "slap_sasl_regexp: converted SASL name to %s\n",
+ out->bv_len ? out->bv_val : "", 0, 0 );