]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Add better root dse error reporting
authorKurt Zeilenga <kurt@openldap.org>
Tue, 9 Oct 2001 21:12:17 +0000 (21:12 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 9 Oct 2001 21:12:17 +0000 (21:12 +0000)
servers/slapd/add.c
servers/slapd/delete.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/result.c

index 190070feebf3dde5a64ad014b18e701bd279fec7..8f3b3082ff4b687efeb8a403984113d198ced380 100644 (file)
@@ -146,8 +146,18 @@ 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 );
index 4b6caecdfcde24b453fb889e24ecdebc05d75c67..3696769962d001b1546b070755d04069e3273510 100644 (file)
@@ -72,6 +72,16 @@ do_delete(
                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 ( strcasecmp( ndn, SLAPD_SCHEMA_DN ) == 0 ) {
+               Debug( LDAP_DEBUG_ANY, "do_delete: subschema subentry!\n", 0, 0, 0 );
+               /* 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
        }
 
        Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d DEL dn=\"%s\"\n",
index f2b31234b55538d5b9387c7854c1ae30b65d6508..8c4957543c4dde1894c3dff1fe093bddef28603c 100644 (file)
@@ -158,6 +158,16 @@ do_modify(
                send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
                        NULL, "modify upon the root DSE not supported", NULL, NULL );
                goto cleanup;
+
+#if defined( SLAPD_SCHEMA_DN )
+       } else if ( strcasecmp( ndn, SLAPD_SCHEMA_DN ) == 0 ) {
+               Debug( LDAP_DEBUG_ANY, "do_modify: subschema subentry!\n", 0, 0, 0 );
+
+               send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
+                       NULL, "modification of subschema subentry not supported",
+                       NULL, NULL );
+               goto cleanup;
+#endif
        }
 
 #ifdef LDAP_DEBUG
index c4fffbbf84f5eeba6dac806682d45803bbb9d130..fc8d3964eb1cd95a8d3907ccedabed01e17c5bbf 100644 (file)
@@ -156,6 +156,15 @@ do_modrdn(
                send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
                        NULL, "cannot rename the root DSE", NULL, NULL );
                goto cleanup;
+
+#ifdef SLAPD_SCHEMA_DN
+       } else if ( strcasecmp( ndn, SLAPD_SCHEMA_DN ) == 0 ) {
+               Debug( LDAP_DEBUG_ANY, "do_modrdn: subschema subentry!\n", 0, 0, 0 );
+
+               send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
+                       NULL, "cannot rename subschema subentry", NULL, NULL );
+               goto cleanup;
+#endif
        }
 
        Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MODRDN dn=\"%s\"\n",
index 2164ec08d672f7905a732ab16003ec014fd0f94f..64f04464f09359010f8befd673a4071f06eeff17 100644 (file)
@@ -730,6 +730,7 @@ send_search_entry(
                        ber_free( ber, 1 );
                        send_ldap_result( conn, op, LDAP_OTHER,
                            NULL, "encoding description error", NULL, NULL );
+                       attrs_free( aa );
                        goto error_return;
                }
 
@@ -751,6 +752,7 @@ send_search_entry(
                                        ber_free( ber, 1 );
                                        send_ldap_result( conn, op, LDAP_OTHER,
                                                NULL, "encoding values error", NULL, NULL );
+                                       attrs_free( aa );
                                        goto error_return;
                                }
                        }
@@ -761,6 +763,7 @@ send_search_entry(
                        ber_free( ber, 1 );
                        send_ldap_result( conn, op, LDAP_OTHER,
                            NULL, "encode end error", NULL, NULL );
+                       attrs_free( aa );
                        goto error_return;
                }
        }