From d2c6714ebf0b58fafcc929f0da45853518b7ac6f Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Thu, 18 Sep 2008 21:12:13 +0000 Subject: [PATCH] honor relax by not applying constraints (ITS#5705) --- doc/man/man5/slapo-constraint.5 | 4 ++++ servers/slapd/overlays/constraint.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/man/man5/slapo-constraint.5 b/doc/man/man5/slapo-constraint.5 index 4df7d83c3e..af832ac4ce 100644 --- a/doc/man/man5/slapo-constraint.5 +++ b/doc/man/man5/slapo-constraint.5 @@ -20,6 +20,10 @@ like telephone numbers, post codes, FQDNs, etc. It constrains only LDAP \fIadd\fP, \fImodify\fP and \fIrename\fP commands and only seeks to control the \fIadd\fP and \fIreplace\fP values of \fImodify\fP and \fIrename\fP requests. +.LP +No constraints are applied for operations performed with the +.I relax +control set. .SH CONFIGURATION This .B slapd.conf diff --git a/servers/slapd/overlays/constraint.c b/servers/slapd/overlays/constraint.c index 6a7506677c..c514da31a7 100644 --- a/servers/slapd/overlays/constraint.c +++ b/servers/slapd/overlays/constraint.c @@ -757,6 +757,10 @@ constraint_add( Operation *op, SlapReply *rs ) int rc; char *msg = NULL; + if (get_relax(op)) { + return SLAP_CB_CONTINUE; + } + if ((a = op->ora_e->e_attrs) == NULL) { op->o_bd->bd_info = (BackendInfo *)(on->on_info); send_ldap_error(op, rs, LDAP_INVALID_SYNTAX, @@ -833,6 +837,10 @@ constraint_update( Operation *op, SlapReply *rs ) int rc; char *msg = NULL; + if (get_relax(op)) { + return SLAP_CB_CONTINUE; + } + switch ( op->o_tag ) { case LDAP_REQ_MODIFY: modlist = op->orm_modlist; @@ -846,7 +854,6 @@ constraint_update( Operation *op, SlapReply *rs ) /* impossible! assert? */ return LDAP_OTHER; } - Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE, "constraint_update()\n", 0,0,0); if ((m = modlist) == NULL) { -- 2.39.5