mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
ITS#9629 back-sql: Add support for ppolicy opattrs
So that ppolicy rules are applied
This commit is contained in:
parent
2a6e24e924
commit
ab3db65388
1 changed files with 36 additions and 5 deletions
|
|
@ -35,23 +35,50 @@
|
||||||
#include <lutil.h>
|
#include <lutil.h>
|
||||||
#endif /* BACKSQL_SYNCPROV */
|
#endif /* BACKSQL_SYNCPROV */
|
||||||
|
|
||||||
|
const char * processable_op_attrs[] = {
|
||||||
|
"pwdAccountLockedTime",
|
||||||
|
"pwdChangedTime",
|
||||||
|
"pwdFailureTime",
|
||||||
|
"pwdGraceUseTime",
|
||||||
|
"pwdHistory",
|
||||||
|
"pwdPolicySubentry",
|
||||||
|
"pwdReset",
|
||||||
|
"entryUUID"
|
||||||
|
};
|
||||||
|
|
||||||
|
#define processable_op_attrs_length (sizeof (processable_op_attrs) / sizeof (const char *))
|
||||||
|
|
||||||
|
static int indexOf(const char *array[], int array_size, const char * value) {
|
||||||
|
for (int i = 0; i < array_size; ++i) {
|
||||||
|
if(strcmp(array[i], value) == 0) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int is_processable_opattr(const char * attr) {
|
||||||
|
return indexOf(processable_op_attrs, processable_op_attrs_length, attr) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define backsql_opattr_skip(ad) \
|
||||||
|
(is_at_operational( (ad)->ad_type ) && (ad) != slap_schema.si_ad_ref )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip:
|
* Skip:
|
||||||
* - null values (e.g. delete modification)
|
* - null values (e.g. delete modification)
|
||||||
* - single occurrence of objectClass, because it is already used
|
* - single occurrence of objectClass, because it is already used
|
||||||
* to determine how to build the SQL entry
|
* to determine how to build the SQL entry
|
||||||
* - operational attributes
|
* - operational attributes (except those in processable_op_attrs)
|
||||||
* - empty attributes
|
* - empty attributes
|
||||||
*/
|
*/
|
||||||
#define backsql_opattr_skip(ad) \
|
|
||||||
(is_at_operational( (ad)->ad_type ) && (ad) != slap_schema.si_ad_ref )
|
|
||||||
#define backsql_attr_skip(ad, vals) \
|
#define backsql_attr_skip(ad, vals) \
|
||||||
( \
|
( \
|
||||||
( (ad) == slap_schema.si_ad_objectClass \
|
( ( (ad) == slap_schema.si_ad_objectClass \
|
||||||
&& (vals) && BER_BVISNULL( &((vals)[ 1 ]) ) ) \
|
&& (vals) && BER_BVISNULL( &((vals)[ 1 ]) ) ) \
|
||||||
|| backsql_opattr_skip( (ad) ) \
|
|| backsql_opattr_skip( (ad) ) \
|
||||||
|| ( (vals) && BER_BVISNULL( &((vals)[ 0 ]) ) ) \
|
|| ( (vals) && BER_BVISNULL( &((vals)[ 0 ]) ) ) \
|
||||||
)
|
) && !is_processable_opattr( ad->ad_cname.bv_val ) )
|
||||||
|
|
||||||
int
|
int
|
||||||
backsql_modify_delete_all_values(
|
backsql_modify_delete_all_values(
|
||||||
|
|
@ -302,6 +329,10 @@ backsql_modify_internal(
|
||||||
ad->ad_cname.bv_val, sm_ops[ sm_op ], BACKSQL_OC_NAME( oc ) );
|
ad->ad_cname.bv_val, sm_ops[ sm_op ], BACKSQL_OC_NAME( oc ) );
|
||||||
|
|
||||||
if ( backsql_attr_skip( ad, sm_values ) ) {
|
if ( backsql_attr_skip( ad, sm_values ) ) {
|
||||||
|
Debug( LDAP_DEBUG_TRACE, " backsql_modify_internal(): "
|
||||||
|
"skipping attribute \"%s\"\n",
|
||||||
|
ad->ad_cname.bv_val, 0, 0 );
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue