From: Luke Howard Date: Thu, 23 Jan 2003 15:22:20 +0000 (+0000) Subject: Test PermitModify and NoReferrals controls (note that PermitModify is X-Git-Tag: NO_SLAP_OP_BLOCKS~524 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7759f75d762b97a8477ca61cd830b59c6788a0da;p=openldap Test PermitModify and NoReferrals controls (note that PermitModify is ignored for the moment - will be fixed shortly) --- 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,