From 1c75a7f25cf284b37aa4f00b952e39bb25b7f2b1 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Mon, 12 Aug 2002 08:45:20 +0000 Subject: [PATCH] Fix inverted bvmatch logic in modrdn --- servers/slapd/config.c | 4 ++-- servers/slapd/modrdn.c | 8 +++++--- servers/slapd/proto-slap.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/servers/slapd/config.c b/servers/slapd/config.c index f04c52f4d3..14b092b19c 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -53,8 +53,8 @@ struct berval default_search_base = { 0, NULL }; struct berval default_search_nbase = { 0, NULL }; unsigned num_subordinates = 0; #ifdef SLAPD_SCHEMA_DN -struct berval global_schemadn; -struct berval global_schemandn; +struct berval global_schemadn = { 0, NULL }; +struct berval global_schemandn = { 0, NULL }; #endif ber_len_t sockbuf_max_incoming = SLAP_SB_MAX_INCOMING_DEFAULT; diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index 07057d0407..5116735ab6 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -202,12 +202,14 @@ do_modrdn( goto cleanup; #ifdef SLAPD_SCHEMA_DN - } else if ( bvmatch( &ndn, &global_schemandn ) == 0 ) { + } else if ( bvmatch( &ndn, &global_schemandn ) ) { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, ERR, - "do_modrdn: attempt to modify subschema subentry\n", 0, 0, 0 ); + "do_modrdn: attempt to modify subschema subentry: %s (%ld)\n", + global_schemandn.bv_val, (long) global_schemandn.bv_len, 0 ); #else - Debug( LDAP_DEBUG_ANY, "do_modrdn: subschema subentry!\n", 0, 0, 0 ); + Debug( LDAP_DEBUG_ANY, "do_modrdn: subschema subentry: %s (%ld)\n", + global_schemandn.bv_val, (long) global_schemandn.bv_len, 0 ); #endif send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM, diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 6fd4487eaf..a7528cbe77 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -341,7 +341,7 @@ LDAP_SLAPD_F (void) slapd_clr_read LDAP_P((ber_socket_t s, int wake)); */ #define dn_match(dn1, dn2) ( ber_bvcmp((dn1), (dn2)) == 0 ) -#define bvmatch(bv1, bv2) ( ((bv1)->bv_len == (bv2)->bv_len) && memcmp((bv1)->bv_val, (bv2)->bv_val, (bv1)->bv_len) == 0 ) +#define bvmatch(bv1, bv2) ( ((bv1)->bv_len == (bv2)->bv_len) && (memcmp((bv1)->bv_val, (bv2)->bv_val, (bv1)->bv_len) == 0) ) LDAP_SLAPD_V( const struct berval ) slap_empty_bv; -- 2.39.5