From 7759f75d762b97a8477ca61cd830b59c6788a0da Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Thu, 23 Jan 2003 15:22:20 +0000 Subject: [PATCH] Test PermitModify and NoReferrals controls (note that PermitModify is ignored for the moment - will be fixed shortly) --- servers/slapd/controls.c | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index 88bfc94279..b068b1a7f0 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -49,6 +49,8 @@ static SLAP_CTRL_PARSE_FN parseManageDSAit; static SLAP_CTRL_PARSE_FN parseNoOp; static SLAP_CTRL_PARSE_FN parsePagedResults; static SLAP_CTRL_PARSE_FN parseValuesReturnFilter; +static SLAP_CTRL_PARSE_FN parsePermitModify; +static SLAP_CTRL_PARSE_FN parseNoReferrals; #ifdef LDAP_CONTROL_SUBENTRIES static SLAP_CTRL_PARSE_FN parseSubentries; @@ -92,6 +94,16 @@ static struct slap_control { SLAP_CTRL_SEARCH, NULL, parseSubentries }, #endif +#ifdef LDAP_CONTROL_PERMITMODIFY + { LDAP_CONTROL_PERMITMODIFY, + SLAP_CTRL_UPDATE, NULL, + parsePermitModify }, +#endif +#ifdef LDAP_CONTROL_NOREFERRALS + { LDAP_CONTROL_NOREFERRALS, + SLAP_CTRL_SEARCH, NULL, + parseNoReferrals }, +#endif #ifdef LDAP_CLIENT_UPDATE { LDAP_CONTROL_CLIENT_UPDATE, SLAP_CTRL_SEARCH, NULL, @@ -747,6 +759,56 @@ static int parseSubentries ( } #endif +#ifdef LDAP_CONTROL_PERMITMODIFY +static int parsePermitModify ( + Connection *conn, + Operation *op, + LDAPControl *ctrl, + const char **text ) +{ + if ( op->o_permitmodify != SLAP_NO_CONTROL ) { + *text = "permitmodify control specified multiple times"; + return LDAP_PROTOCOL_ERROR; + } + + if ( ctrl->ldctl_value.bv_len ) { + *text = "permitmodify control value not empty"; + return LDAP_PROTOCOL_ERROR; + } + + op->o_permitmodify = ctrl->ldctl_iscritical + ? SLAP_CRITICAL_CONTROL + : SLAP_NONCRITICAL_CONTROL; + + return LDAP_SUCCESS; +} +#endif + +#ifdef LDAP_CONTROL_NOREFERRALS +static int parseNoReferrals ( + Connection *conn, + Operation *op, + LDAPControl *ctrl, + const char **text ) +{ + if ( op->o_noreferrals != SLAP_NO_CONTROL ) { + *text = "noreferrals control specified multiple times"; + return LDAP_PROTOCOL_ERROR; + } + + if ( ctrl->ldctl_value.bv_len ) { + *text = "noreferrals control value not empty"; + return LDAP_PROTOCOL_ERROR; + } + + op->o_noreferrals = ctrl->ldctl_iscritical + ? SLAP_CRITICAL_CONTROL + : SLAP_NONCRITICAL_CONTROL; + + return LDAP_SUCCESS; +} +#endif + #ifdef LDAP_CLIENT_UPDATE static int parseClientUpdate ( Connection *conn, -- 2.39.5