]> git.sur5r.net Git - openldap/commitdiff
add pedantic checks
authorPierangelo Masarati <ando@openldap.org>
Fri, 21 Aug 2009 17:08:48 +0000 (17:08 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 21 Aug 2009 17:08:48 +0000 (17:08 +0000)
servers/slapd/syncrepl.c

index b95397f4726c330a0f6a8408b0b09b7a4a7317e6..22496b66b3825f246c2f5f7a5f75bb097aafa2ae 100644 (file)
@@ -1620,6 +1620,13 @@ syncrepl_message_to_op(
        op->o_tag = LBER_DEFAULT;
        op->o_bd = si->si_wbe;
 
+       if ( BER_BVISEMPTY( &bdn ) && !BER_BVISEMPTY( &op->o_bd->be_nsuffix[0] ) ) {
+               Debug( LDAP_DEBUG_ANY,
+                       "syncrepl_message_to_op: %s got empty dn",
+                       si->si_ridtxt, 0, 0 );
+               return LDAP_OTHER;
+       }
+
        while (( rc = ldap_get_attribute_ber( si->si_ld, msg, ber, &bv, &bvals ) )
                == LDAP_SUCCESS ) {
                if ( bv.bv_val == NULL )
@@ -1857,6 +1864,13 @@ syncrepl_message_to_entry(
                return rc;
        }
 
+       if ( BER_BVISEMPTY( &bdn ) && !BER_BVISEMPTY( &op->o_bd->be_nsuffix[0] ) ) {
+               Debug( LDAP_DEBUG_ANY,
+                       "syncrepl_message_to_entry: %s got empty dn",
+                       si->si_ridtxt, 0, 0 );
+               return LDAP_OTHER;
+       }
+
        if ( syncstate == LDAP_SYNC_PRESENT || syncstate == LDAP_SYNC_DELETE ) {
                /* NOTE: this could be done even before decoding the DN,
                 * although encoding errors wouldn't be detected */