Commit 86ec442d authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

import fix to DN (and berval'ued items requiring) normalization in bindconf_parse (ITS#4766)

parent 1de6a92c
......@@ -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)
......
......@@ -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':
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment