mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-30 11:39:34 -05:00
ITS#4025 add pretty/normal for pwdAttribute that recognizes descr's as
well as numeric OIDs
This commit is contained in:
parent
eab3e6b572
commit
20cb8f49f9
1 changed files with 52 additions and 0 deletions
|
|
@ -1739,6 +1739,44 @@ ppolicy_parseCtrl(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
static int
|
||||
attrPretty(
|
||||
Syntax *syntax,
|
||||
struct berval *val,
|
||||
struct berval *out,
|
||||
void *ctx )
|
||||
{
|
||||
AttributeDescription *ad = NULL;
|
||||
const char *err;
|
||||
int code;
|
||||
|
||||
code = slap_bv2ad( val, &ad, &err );
|
||||
if ( !code ) {
|
||||
ber_dupbv_x( out, &ad->ad_type->sat_cname, ctx );
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int
|
||||
attrNormalize(
|
||||
slap_mask_t use,
|
||||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *val,
|
||||
struct berval *out,
|
||||
void *ctx )
|
||||
{
|
||||
AttributeDescription *ad = NULL;
|
||||
const char *err;
|
||||
int code;
|
||||
|
||||
code = slap_bv2ad( val, &ad, &err );
|
||||
if ( !code ) {
|
||||
ber_str2bv_x( ad->ad_type->sat_oid, 0, 1, out, ctx );
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int
|
||||
ppolicy_db_init(
|
||||
BackendDB *be
|
||||
|
|
@ -1758,6 +1796,20 @@ ppolicy_db_init(
|
|||
return code;
|
||||
}
|
||||
}
|
||||
{
|
||||
Syntax *syn;
|
||||
MatchingRule *mr;
|
||||
|
||||
syn = ch_malloc( sizeof( Syntax ));
|
||||
*syn = *ad_pwdAttribute->ad_type->sat_syntax;
|
||||
syn->ssyn_pretty = attrPretty;
|
||||
ad_pwdAttribute->ad_type->sat_syntax = syn;
|
||||
|
||||
mr = ch_malloc( sizeof( MatchingRule ));
|
||||
*mr = *ad_pwdAttribute->ad_type->sat_equality;
|
||||
mr->smr_normalize = attrNormalize;
|
||||
ad_pwdAttribute->ad_type->sat_equality = mr;
|
||||
}
|
||||
}
|
||||
|
||||
on->on_bi.bi_private = ch_calloc( sizeof(pp_info), 1 );
|
||||
|
|
|
|||
Loading…
Reference in a new issue