]> git.sur5r.net Git - openldap/commitdiff
improve previous commit
authorPierangelo Masarati <ando@openldap.org>
Thu, 17 Apr 2003 22:19:14 +0000 (22:19 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 17 Apr 2003 22:19:14 +0000 (22:19 +0000)
servers/slapd/add.c
servers/slapd/delete.c
servers/slapd/modify.c
servers/slapd/modrdn.c

index b0bd5091c7c1760d84b4d25c3cd9e692c69c9753..a5ade437e28b23657c3f0d5cdc757587a3dc57c9 100644 (file)
@@ -200,12 +200,16 @@ do_add( Operation *op, SlapReply *rs )
        if ( op->o_bd == NULL ) {
                rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
-
-               rs->sr_err = LDAP_REFERRAL;
                if (!rs->sr_ref) rs->sr_ref = default_referral;
-               send_ldap_result( op, rs );
+               if ( rs->sr_ref != NULL ) {
+                       rs->sr_err = LDAP_REFERRAL;
+                       send_ldap_result( op, rs );
 
-               if ( rs->sr_ref != default_referral ) ber_bvarray_free( rs->sr_ref );
+                       if ( rs->sr_ref != default_referral ) ber_bvarray_free( rs->sr_ref );
+               } else {
+                       send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
+                                       "referral missing" );
+               }
                goto done;
        }
 
@@ -316,7 +320,7 @@ do_add( Operation *op, SlapReply *rs )
                        if ( defref != NULL ) {
                                rs->sr_ref = referral_rewrite( defref,
                                        NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
-
+                               if ( rs->sr_ref == NULL ) rs->sr_ref = defref;
                                rs->sr_err = LDAP_REFERRAL;
                                if (!rs->sr_ref) rs->sr_ref = default_referral;
                                send_ldap_result( op, rs );
index facf238f44676dae2435a17ec3cfa75e9e989473..4ef2a53b80d46854fafc10c1f30e4df016afd925 100644 (file)
@@ -131,11 +131,16 @@ do_delete(
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
 
                if (!rs->sr_ref) rs->sr_ref = default_referral;
-               rs->sr_err = LDAP_REFERRAL;
+               if ( rs->sr_ref != NULL ) {
+                       rs->sr_err = LDAP_REFERRAL;
 
-               send_ldap_result( op, rs );
+                       send_ldap_result( op, rs );
 
-               if (rs->sr_ref!= default_referral) ber_bvarray_free( rs->sr_ref );
+                       if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
+               } else {
+                       send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
+                                       "referral missing" );
+               }
                goto cleanup;
        }
 
@@ -202,7 +207,6 @@ do_delete(
                        if ( defref != NULL ) {
                                rs->sr_ref = referral_rewrite( default_referral,
                                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
-
                                if (!rs->sr_ref) rs->sr_ref = defref;
                                rs->sr_err = LDAP_REFERRAL;
                                send_ldap_result( op, rs );
index 1aea31a260688b34834749f2c3637cc8bf002ea4..a04d49a61c1708f623768b596cedc9283bd18c73 100644 (file)
@@ -301,10 +301,15 @@ do_modify(
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                if (!rs->sr_ref) rs->sr_ref = default_referral;
 
-               rs->sr_err = LDAP_REFERRAL;
-               send_ldap_result( op, rs );
+               if (rs->sr_ref != NULL ) {
+                       rs->sr_err = LDAP_REFERRAL;
+                       send_ldap_result( op, rs );
 
-               if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
+                       if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
+               } else {
+                       send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
+                                       "referral missing" );
+               }
                goto cleanup;
        }
 
@@ -432,15 +437,11 @@ do_modify(
                } else {
                        BerVarray defref = op->o_bd->be_update_refs
                                ? op->o_bd->be_update_refs : default_referral;
-
                        if ( defref != NULL ) {
                                rs->sr_ref = referral_rewrite( defref,
                                        NULL, &op->o_req_dn,
                                        LDAP_SCOPE_DEFAULT );
-
-                               if (!rs->sr_ref) {
-                                       rs->sr_ref = defref;
-                               }
+                               if (!rs->sr_ref) rs->sr_ref = defref;
                                rs->sr_err = LDAP_REFERRAL;
                                send_ldap_result( op, rs );
                                if (rs->sr_ref != defref) {
index cf4f9e2d3130afa5f4f42e83fbace462c4ae9eff..0644a8995a8d56a76615c016fd3719d9cc0e934f 100644 (file)
@@ -276,10 +276,15 @@ do_modrdn(
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                if (!rs->sr_ref) rs->sr_ref = default_referral;
 
-               rs->sr_err = LDAP_REFERRAL;
-               send_ldap_result( op, rs );
+               if ( rs->sr_ref != NULL ) {
+                       rs->sr_err = LDAP_REFERRAL;
+                       send_ldap_result( op, rs );
 
-               if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
+                       if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
+               } else {
+                       send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
+                                       "referral missing" );
+               }
                goto cleanup;
        }