]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/add.c
BDB_INDEX code does no harm (but no good yet, not used by filters yet).
[openldap] / servers / slapd / add.c
index 28cc47990cb3ca3dfc0ae6d1e93c5978e6e159e8..238c8f1d0b7068aaa17e0ea80b1eb6e816ba8572 100644 (file)
@@ -186,12 +186,21 @@ do_add( Connection *conn, Operation *op )
        if( e->e_ndn == NULL || *e->e_ndn == '\0' ) {
                /* protocolError may be a more appropriate error */
                send_ldap_result( conn, op, rc = LDAP_ALREADY_EXISTS,
-                       NULL, "root DSE exists", NULL, NULL );
+                       NULL, "root DSE already exists",
+                       NULL, NULL );
                goto done;
+
+#if defined( SLAPD_SCHEMA_DN )
+       } else if ( strcasecmp( ndn, SLAPD_SCHEMA_DN ) == 0 ) {
+               /* protocolError may be a more appropriate error */
+               send_ldap_result( conn, op, rc = LDAP_ALREADY_EXISTS,
+                       NULL, "subschema subentry already exists",
+                       NULL, NULL );
+               goto done;
+#endif
        }
 
-       manageDSAit = get_manageDSAit( op ) &&
-               is_entry_referral( e );
+       manageDSAit = get_manageDSAit( op );
 
        /*
         * We could be serving multiple database backends.  Select the
@@ -234,8 +243,12 @@ do_add( Connection *conn, Operation *op )
 #endif
                {
                        int update = be->be_update_ndn != NULL;
+                       char textbuf[SLAP_TEXT_BUFLEN];
+                       size_t textlen = sizeof textbuf;
+
+                       rc = slap_modlist2mods( modlist, update, &mods, &text,
+                               textbuf, textlen );
 
-                       rc = slap_modlist2mods( modlist, update, &mods, &text );
                        if( rc != LDAP_SUCCESS ) {
                                send_ldap_result( conn, op, rc,
                                        NULL, text, NULL, NULL );