]> git.sur5r.net Git - openldap/commitdiff
don't return referral if cannot compute one (should fix ITS#2435)
authorPierangelo Masarati <ando@openldap.org>
Thu, 17 Apr 2003 21:48:57 +0000 (21:48 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 17 Apr 2003 21:48:57 +0000 (21:48 +0000)
servers/slapd/add.c
servers/slapd/delete.c
servers/slapd/modify.c
servers/slapd/modrdn.c

index 02744268392ed6f9153baa85304b59d971795d0d..b0bd5091c7c1760d84b4d25c3cd9e692c69c9753 100644 (file)
@@ -313,14 +313,20 @@ do_add( Operation *op, SlapReply *rs )
 
                        defref = op->o_bd->be_update_refs
                                ? op->o_bd->be_update_refs : default_referral;
-                       rs->sr_ref = referral_rewrite( defref,
-                               NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
+                       if ( defref != NULL ) {
+                               rs->sr_ref = referral_rewrite( defref,
+                                       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 );
+                               rs->sr_err = LDAP_REFERRAL;
+                               if (!rs->sr_ref) rs->sr_ref = default_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" );
+                       }
 #endif /* SLAPD_MULTIMASTER */
                }
        } else {
index db30af78b92a8bc0f93d652ad0c0a48265dac1f7..facf238f44676dae2435a17ec3cfa75e9e989473 100644 (file)
@@ -199,14 +199,20 @@ do_delete(
                } else {
                        BerVarray defref = op->o_bd->be_update_refs
                                ? op->o_bd->be_update_refs : default_referral;
-                       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 );
-
-                       if (rs->sr_ref != defref) ber_bvarray_free( rs->sr_ref );
+                       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 );
+
+                               if (rs->sr_ref != defref) ber_bvarray_free( rs->sr_ref );
+                       } else {
+                               send_ldap_error( op, rs,
+                                               LDAP_UNWILLING_TO_PERFORM,
+                                               "referral missing" );
+                       }
 #endif
                }
 
index b6399a9d7a22f5b7a0a251e5cb51c3d478ba2af0..1aea31a260688b34834749f2c3637cc8bf002ea4 100644 (file)
@@ -432,13 +432,25 @@ do_modify(
                } else {
                        BerVarray defref = op->o_bd->be_update_refs
                                ? op->o_bd->be_update_refs : default_referral;
-                       rs->sr_ref = referral_rewrite( defref,
-                               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 );
-                       if (rs->sr_ref != defref) ber_bvarray_free( rs->sr_ref );
+                       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;
+                               }
+                               rs->sr_err = LDAP_REFERRAL;
+                               send_ldap_result( op, rs );
+                               if (rs->sr_ref != defref) {
+                                       ber_bvarray_free( rs->sr_ref );
+                               }
+                       } else {
+                               send_ldap_error( op, rs,
+                                               LDAP_UNWILLING_TO_PERFORM,
+                                               "referral missing" );
+                       }
 #endif
                }
        } else {
index 90651da75d7e731e9b2094f8b22a00a011bb71b9..cf4f9e2d3130afa5f4f42e83fbace462c4ae9eff 100644 (file)
@@ -362,14 +362,20 @@ do_modrdn(
                } else {
                        BerVarray defref = op->o_bd->be_update_refs
                                ? op->o_bd->be_update_refs : default_referral;
-                       rs->sr_ref = referral_rewrite( defref,
-                               NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
-                       if (!rs->sr_ref) rs->sr_ref = defref;
+                       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;
 
-                       rs->sr_err = LDAP_REFERRAL;
-                       send_ldap_result( op, rs );
+                               rs->sr_err = LDAP_REFERRAL;
+                               send_ldap_result( op, rs );
 
-                       if (rs->sr_ref != defref) ber_bvarray_free( rs->sr_ref );
+                               if (rs->sr_ref != defref) ber_bvarray_free( rs->sr_ref );
+                       } else {
+                               send_ldap_error( op, rs,
+                                       LDAP_UNWILLING_TO_PERFORM,
+                                       "referral missing" );
+                       }
 #endif
                }
        } else {