goto return_results;
}
- if (0) {
+ if( 0 ) {
/* transaction retry */
retry: rc = txn_abort( ltid );
ltid = NULL;
p = NULL;
if ( ! rc ) {
- Debug( LDAP_DEBUG_TRACE, "bdb_add: no write access to parent\n",
+ Debug( LDAP_DEBUG_TRACE,
+ "bdb_add: no write access to parent\n",
0, 0, 0 );
rc = LDAP_INSUFFICIENT_ACCESS;
text = "no write access to parent";
db_strerror(rc), rc, 0 );
rc = LDAP_OTHER;
text = "commit failed";
+
} else {
Debug( LDAP_DEBUG_TRACE,
"bdb_add: added id=%08lx dn=\"%s\"\n",
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
- if(rc == LDAP_SUCCESS && bdb->bi_txn_cp ) {
+ if( rc == LDAP_SUCCESS && bdb->bi_txn_cp ) {
ldap_pvt_thread_yield();
txn_checkpoint( bdb->bi_dbenv,
bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 );
{
rc = LDAP_COMPARE_FALSE;
- if ( value_find_ex( ava->aa_desc,
- SLAP_MR_VALUE_IS_IN_MR_SYNTAX,
- a->a_vals, ava->aa_value ) == 0 )
- {
+ if ( value_find( ava->aa_desc, a->a_vals, ava->aa_value ) == 0 ) {
rc = LDAP_COMPARE_TRUE;
break;
}
Debug( LDAP_DEBUG_ARGS, "==> bdb_delete: %s\n", dn, 0, 0 );
- if (0) {
+ if( 0 ) {
retry: /* transaction retry */
Debug( LDAP_DEBUG_TRACE, "==> bdb_delete: retrying...\n", 0, 0, 0 );
rc = txn_abort( ltid );
Debug( LDAP_DEBUG_ARGS, "bdb_modify: %s\n", dn, 0, 0 );
- if (0) {
+ if( 0 ) {
retry: /* transaction retry */
Debug(LDAP_DEBUG_TRACE,
"bdb_modify: retrying...\n", 0, 0, 0);
db_strerror(rc), rc, 0 );
rc = LDAP_OTHER;
text = "commit failed";
+
} else {
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: updated id=%08lx dn=\"%s\"\n",
for ( j = 0; a->a_vals[j] != NULL; j++ ) {
int match;
int rc = value_match( &match, mod->sm_desc, mr,
- SLAP_MR_MODIFY_MATCHING,
+ SLAP_MR_VALUE_SYNTAX_MATCH,
a->a_vals[j], asserted, &text );
if( rc == LDAP_SUCCESS && match == 0 ) {
for ( j = 0; a->a_vals[j] != NULL; j++ ) {
int match;
int rc = value_match( &match, mod->sm_desc, mr,
- SLAP_MR_MODIFY_MATCHING,
+ SLAP_MR_VALUE_SYNTAX_MATCH,
a->a_vals[j], asserted, &text );
if( rc == LDAP_SUCCESS && match != 0 ) {
}
#endif
- if (0) {
+ if( 0 ) {
retry: /* transaction retry */
Debug( LDAP_DEBUG_TRACE, "==>bdb_modrdn: retrying...\n", 0, 0, 0 );
rc = txn_abort( ltid );
}
}
-
if( bdb->bi_txn ) {
/* begin transaction */
rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
goto done;
}
- if (0) {
+ if( 0 ) {
retry: /* transaction retry */
Debug( LDAP_DEBUG_TRACE, "bdb_exop_passwd: retrying...\n", 0, 0, 0 );
rc = txn_abort( ltid );
{
rc = LDAP_COMPARE_FALSE;
- if ( value_find_ex( ava->aa_desc,
- SLAP_MR_VALUE_IS_IN_MR_SYNTAX,
- a->a_vals, ava->aa_value ) == 0 )
- {
+ if ( value_find( ava->aa_desc, a->a_vals, ava->aa_value ) == 0 ) {
rc = LDAP_COMPARE_TRUE;
break;
}
for ( j = 0; a->a_vals[j] != NULL; j++ ) {
int match;
int rc = value_match( &match, mod->sm_desc, mr,
- SLAP_MR_MODIFY_MATCHING,
+ SLAP_MR_VALUE_SYNTAX_MATCH,
a->a_vals[j], asserted, &text );
if( rc == LDAP_SUCCESS && match == 0 ) {
for ( j = 0; a->a_vals[j] != NULL; j++ ) {
int match;
int rc = value_match( &match, mod->sm_desc, mr,
- SLAP_MR_MODIFY_MATCHING,
+ SLAP_MR_VALUE_SYNTAX_MATCH,
a->a_vals[j], asserted, &text );
if( rc == LDAP_SUCCESS && match != 0 ) {
{
rc = LDAP_COMPARE_FALSE;
- if ( value_find_ex( ava->aa_desc,
- SLAP_MR_VALUE_IS_IN_MR_SYNTAX,
- a->a_vals, ava->aa_value ) == 0 )
- {
+ if ( value_find( ava->aa_desc, a->a_vals, ava->aa_value ) == 0 ) {
rc = LDAP_COMPARE_TRUE;
break;
}
const char *text;
rc = value_match( &ret, a->a_desc, mra->ma_rule,
- SLAP_MR_VALUE_IS_IN_MR_SYNTAX,
+ SLAP_MR_ASSERTION_SYNTAX_MATCH,
a->a_vals[i], mra->ma_value,
&text );
const char *text;
rc = value_match( &ret, a->a_desc, mr,
- SLAP_MR_VALUE_IS_IN_MR_SYNTAX,
+ SLAP_MR_ASSERTION_SYNTAX_MATCH,
a->a_vals[i], ava->aa_value,
&text );
const char *text;
rc = value_match( &ret, a->a_desc, mr,
- SLAP_MR_VALUE_IS_IN_MR_SYNTAX,
+ SLAP_MR_ASSERTION_SYNTAX_MATCH,
a->a_vals[i], f->f_sub,
&text );
struct berval *v1,
void *v2,
const char ** text ));
+#define value_find(ad,values,value) (value_find_ex((ad),0,(values),(value)))
LDAP_SLAPD_F (int) value_find_ex LDAP_P((
AttributeDescription *ad,
unsigned flags,
struct berval **values,
struct berval *value ));
-#define value_find(ad, values, value) ( value_find_ex(ad,0,values,value ) )
-LDAP_SLAPD_F (int) value_add LDAP_P(( struct berval ***vals, struct berval **addvals ));
+LDAP_SLAPD_F (int) value_add LDAP_P((
+ struct berval ***vals,
+ struct berval **addvals ));
/*
* user.c
return SLAPD_COMPARE_UNDEFINED;
}
- if( flags & SLAP_MR_MODIFY_MATCHING ) {
+ if( SLAP_IS_MR_VALUE_SYNTAX_MATCH( flags ) ) {
*matchp = ( asserted != oc );
} else {
*matchp = !is_object_subclass( asserted, oc );
#define SLAP_MR_SUBSTR_ANY ( SLAP_MR_SUBSTR | 0x0020U )
#define SLAP_MR_SUBSTR_FINAL ( SLAP_MR_SUBSTR | 0x0040U )
-/* this is used to kludge objectClass testing */
-#define SLAP_MR_MODIFY_MATCHING 0x0001U
-/* are we matching from a mr asserted value or a real value */
-#define SLAP_MR_VALUE_IS_IN_MR_SYNTAX 0x0002U
+/*
+ * normally the provided value is expected to conform to
+ * assertion syntax specified in the matching rule, however
+ * at times (such as during individual value modification),
+ * the provided value is expected to conform to the
+ * attribute's value syntax.
+ */
+#define SLAP_MR_ASSERTION_SYNTAX_MATCH 0x0000U
+#define SLAP_MR_VALUE_SYNTAX_MATCH 0x0001U
+#define SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH 0x0003U
+
+#define SLAP_IS_MR_ASSERTION_SYNTAX_MATCH( usage ) \
+ (!((usage) & SLAP_MR_VALUE_SYNTAX_MATCH))
+#define SLAP_IS_MR_VALUE_SYNTAX_MATCH( usage ) \
+ ((usage) & SLAP_MR_VALUE_SYNTAX_MATCH)
+
+#define SLAP_IS_MR_VALUE_SYNTAX_CONVERTED_MATCH( usage ) \
+ (((usage) & SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH) \
+ == SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH)
+#define SLAP_IS_MR_VALUE_SYNTAX_NONCONVERTED_MATCH( usage ) \
+ (((usage) & SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH) \
+ == SLAP_MR_VALUE_SYNTAX_MATCH)
Syntax *smr_syntax;
slap_mr_convert_func *smr_convert;
}
}
- if ( !(flags & SLAP_MR_VALUE_IS_IN_MR_SYNTAX) &&
- mr->smr_convert ) {
- rc = (mr->smr_convert)(v2,&nv2);
+ if ( SLAP_IS_MR_VALUE_SYNTAX_NONCONVERTED_MATCH( flags ) &&
+ mr->smr_convert )
+ {
+ rc = (mr->smr_convert)( v2, &nv2 );
if ( rc != LDAP_SUCCESS ) {
- return LDAP_INVALID_SYNTAX;
+ return LDAP_INVALID_SYNTAX;
}
+
+ /* let smr_match know we've converted the value */
+ flags |= SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH;
}
rc = (mr->smr_match)( match, flags,
}
/* Take care of this here or ssyn_normalize later will hurt */
- if ( !(flags & SLAP_MR_VALUE_IS_IN_MR_SYNTAX) &&
- mr->smr_convert ) {
- rc = (mr->smr_convert)(val,&nval);
+ if ( SLAP_IS_MR_VALUE_SYNTAX_NONCONVERTED_MATCH( flags )
+ && mr->smr_convert )
+ {
+ rc = (mr->smr_convert)( val, &nval );
if ( rc != LDAP_SUCCESS ) {
return LDAP_INVALID_SYNTAX;
}
+
+ /* let value_match know we've done the version */
+ flags |= SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH;
}
if( mr->smr_syntax->ssyn_normalize ) {
int match;
const char *text;
- /* We did convert, so keep value_match from trying */
- rc = value_match( &match, ad, mr,
- flags & !SLAP_MR_VALUE_IS_IN_MR_SYNTAX,
+ rc = value_match( &match, ad, mr, flags,
vals[i], nval == NULL ? val : nval, &text );
if( rc == LDAP_SUCCESS && match == 0 ) {