]> git.sur5r.net Git - openldap/commitdiff
Test PermitModify and NoReferrals controls (note that PermitModify is
authorLuke Howard <lukeh@openldap.org>
Thu, 23 Jan 2003 15:22:20 +0000 (15:22 +0000)
committerLuke Howard <lukeh@openldap.org>
Thu, 23 Jan 2003 15:22:20 +0000 (15:22 +0000)
ignored for the moment - will be fixed shortly)

servers/slapd/controls.c

index 88bfc9427986f2983d96c61f2390dbba7fc04dad..b068b1a7f09436054ea3ed60a8258b499a3e930d 100644 (file)
@@ -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,