+#endif
+ send_ldap_disconnect( conn, op,
+ LDAP_PROTOCOL_ERROR, "decoding error" );
+ return SLAPD_DISCONNECT;
+ }
+
+ if( ( rc = get_ctrls( conn, op, 1 ) ) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "do_delete: conn %d get_ctrls failed\n", conn->c_connid, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "do_delete: get_ctrls failed\n", 0, 0, 0 );
+#endif
+ goto cleanup;
+ }
+
+ rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
+ if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "do_delete: conn %d invalid dn (%s)\n",
+ conn->c_connid, dn.bv_val, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "do_delete: invalid dn (%s)\n", dn.bv_val, 0, 0 );
+#endif
+ send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
+ "invalid DN", NULL, NULL );
+ goto cleanup;
+ }
+
+ if( ndn.bv_len == 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "do_delete: conn %d: Attempt to delete root DSE.\n",
+ conn->c_connid, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "do_delete: root dse!\n", 0, 0, 0 );
+#endif
+ /* protocolError would likely be a more appropriate error */
+ send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
+ NULL, "cannot delete the root DSE", NULL, NULL );
+ goto cleanup;
+
+#ifdef SLAPD_SCHEMA_DN
+
+ } else if ( bvmatch( &ndn, &global_schemandn ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO, "do_delete: conn %d: "
+ "Attempt to delete subschema subentry.\n", conn->c_connid, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "do_delete: subschema subentry!\n", 0, 0, 0 );
+#endif
+ /* protocolError would likely be a more appropriate error */
+ send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
+ NULL, "cannot delete the root DSE", NULL, NULL );
+ goto cleanup;
+
+#endif