]> git.sur5r.net Git - openldap/commitdiff
import fix to DN (and berval'ued items requiring) normalization in bindconf_parse...
authorPierangelo Masarati <ando@openldap.org>
Sat, 2 Dec 2006 16:13:49 +0000 (16:13 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 2 Dec 2006 16:13:49 +0000 (16:13 +0000)
CHANGES
servers/slapd/config.c
servers/slapd/slap.h

diff --git a/CHANGES b/CHANGES
index 6888e5cf2f12a9eb38097b4a6e290810181344d7..e4ec658ee87be14bf25436ab95cd9bc1a47cc3b8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,7 @@ OpenLDAP 2.3 Change Log
 OpenLDAP 2.3.31 Engineering
        Fixed slapd group ACL caching when proxyAuthz'ing (ITS#4760)
        Fixed slapd "group" authz default member parsing (ITS#4761)
+       Fixed slapd DN parsing in bindconf_parse (ITS#4766)
        Fixed slapd-bdb/hdb/ldbm slap_add_opattrs error checking
        Documentation
                Fixed typo in slapo-retcode(5) man page (ITS#4753)
index 8b043a4f009cbd37dad560d8a838aabde151a128..f4b64b605856af903baffa9111026a42ec27d23e 100644 (file)
@@ -1028,15 +1028,21 @@ static slap_verbmasks methkey[] = {
 
 static slap_cf_aux_table bindkey[] = {
        { BER_BVC("uri="), offsetof(slap_bindconf, sb_uri), 'b', 1, NULL },
-       { BER_BVC("starttls="), offsetof(slap_bindconf, sb_tls), 'd', 0, tlskey },
-       { BER_BVC("bindmethod="), offsetof(slap_bindconf, sb_method), 'd', 0, methkey },
-       { BER_BVC("binddn="), offsetof(slap_bindconf, sb_binddn), 'b', 1, NULL },
+       { BER_BVC("starttls="), offsetof(slap_bindconf, sb_tls), 'i', 0, tlskey },
+       { BER_BVC("bindmethod="), offsetof(slap_bindconf, sb_method), 'i', 0, methkey },
+       { BER_BVC("binddn="), offsetof(slap_bindconf, sb_binddn), 'b', 1, dnNormalize },
        { BER_BVC("credentials="), offsetof(slap_bindconf, sb_cred), 'b', 1, NULL },
        { BER_BVC("saslmech="), offsetof(slap_bindconf, sb_saslmech), 'b', 0, NULL },
        { BER_BVC("secprops="), offsetof(slap_bindconf, sb_secprops), 's', 0, NULL },
        { BER_BVC("realm="), offsetof(slap_bindconf, sb_realm), 'b', 0, NULL },
+#ifndef SLAP_AUTHZ_SYNTAX
        { BER_BVC("authcID="), offsetof(slap_bindconf, sb_authcId), 'b', 0, NULL },
        { BER_BVC("authzID="), offsetof(slap_bindconf, sb_authzId), 'b', 1, NULL },
+#else /* SLAP_AUTHZ_SYNTAX */
+       { BER_BVC("authcID="), offsetof(slap_bindconf, sb_authcId), 'b', 0, authzNormalize },
+       { BER_BVC("authzID="), offsetof(slap_bindconf, sb_authzId), 'b', 1, authzNormalize },
+#endif /* SLAP_AUTHZ_SYNTAX */
+
        { BER_BVNULL, 0, 0, 0, NULL }
 };
 
@@ -1064,26 +1070,39 @@ slap_cf_aux_table_parse( const char *word, void *dst, slap_cf_aux_table *tab0, L
 
                        case 'b':
                                bptr = (struct berval *)((char *)dst + tab->off);
-                               ber_str2bv( val, 0, 1, bptr );
-                               break;
+                               if ( tab->aux != NULL ) {
+                                       struct berval   dn;
+                                       slap_mr_normalize_func *normalize = (slap_mr_normalize_func *)tab->aux;
 
-                       case 'd':
-                               assert( tab->aux != NULL );
-                               iptr = (int *)((char *)dst + tab->off);
+                                       ber_str2bv( val, 0, 0, &dn );
+                                       rc = normalize( 0, NULL, NULL, &dn, bptr, NULL );
 
-                               rc = 1;
-                               for ( j = 0; !BER_BVISNULL( &tab->aux[j].word ); j++ ) {
-                                       if ( !strcasecmp( val, tab->aux[j].word.bv_val ) ) {
-                                               *iptr = tab->aux[j].mask;
-                                               rc = 0;
-                                       }
+                               } else {
+                                       ber_str2bv( val, 0, 1, bptr );
+                                       rc = 0;
                                }
                                break;
 
                        case 'i':
                                iptr = (int *)((char *)dst + tab->off);
 
-                               rc = lutil_atoix( iptr, val, 0 );
+                               if ( tab->aux != NULL ) {
+                                       slap_verbmasks *aux = (slap_verbmasks *)tab->aux;
+
+                                       assert( aux != NULL );
+
+                                       rc = 1;
+                                       for ( j = 0; !BER_BVISNULL( &aux[j].word ); j++ ) {
+                                               if ( !strcasecmp( val, aux[j].word.bv_val ) ) {
+                                                       *iptr = aux[j].mask;
+                                                       rc = 0;
+                                                       break;
+                                               }
+                                       }
+
+                               } else {
+                                       rc = lutil_atoix( iptr, val, 0 );
+                               }
                                break;
 
                        case 'u':
@@ -1139,6 +1158,7 @@ slap_cf_aux_table_unparse( void *src, struct berval *bv, slap_cf_aux_table *tab0
                case 'b':
                        bptr = (struct berval *)((char *)src + tab->off);
                        cptr = &bptr->bv_val;
+
                case 's':
                        if ( *cptr ) {
                                *ptr++ = ' ';
@@ -1149,25 +1169,26 @@ slap_cf_aux_table_unparse( void *src, struct berval *bv, slap_cf_aux_table *tab0
                        }
                        break;
 
-               case 'd':
-                       assert( tab->aux != NULL );
+               case 'i':
                        iptr = (int *)((char *)src + tab->off);
-               
-                       for ( i = 0; !BER_BVISNULL( &tab->aux[i].word ); i++ ) {
-                               if ( *iptr == tab->aux[i].mask ) {
-                                       *ptr++ = ' ';
-                                       ptr = lutil_strcopy( ptr, tab->key.bv_val );
-                                       ptr = lutil_strcopy( ptr, tab->aux[i].word.bv_val );
-                                       break;
+
+                       if ( tab->aux != NULL ) {
+                               slap_verbmasks *aux = (slap_verbmasks *)tab->aux;
+
+                               for ( i = 0; !BER_BVISNULL( &aux[i].word ); i++ ) {
+                                       if ( *iptr == aux[i].mask ) {
+                                               *ptr++ = ' ';
+                                               ptr = lutil_strcopy( ptr, tab->key.bv_val );
+                                               ptr = lutil_strcopy( ptr, aux[i].word.bv_val );
+                                               break;
+                                       }
                                }
-                       }
-                       break;
 
-               case 'i':
-                       iptr = (int *)((char *)src + tab->off);
-                       *ptr++ = ' ';
-                       ptr = lutil_strcopy( ptr, tab->key.bv_val );
-                       ptr += snprintf( ptr, sizeof( buf ) - ( ptr - buf ), "%d", *iptr );
+                       } else {
+                               *ptr++ = ' ';
+                               ptr = lutil_strcopy( ptr, tab->key.bv_val );
+                               ptr += snprintf( ptr, sizeof( buf ) - ( ptr - buf ), "%d", *iptr );
+                       }
                        break;
 
                case 'u':
index 4d9f48dbbb1c6653f2fe0dc552d303f1e0304969..eace47d3b2668da67b41ef2e2390634081d79be0 100644 (file)
@@ -1576,7 +1576,7 @@ typedef struct slap_cf_aux_table {
        int off;
        char type;
        char quote;
-       slap_verbmasks *aux;
+       void *aux;
 } slap_cf_aux_table;
 
 #define SLAP_LIMIT_TIME        1