|
|
cc3dff |
From d695afb6a637432e880296d8552f466981c0796c Mon Sep 17 00:00:00 2001
|
|
|
cc3dff |
From: "Thierry bordaz (tbordaz)" <tbordaz@redhat.com>
|
|
|
cc3dff |
Date: Thu, 16 May 2013 15:28:47 +0200
|
|
|
cc3dff |
Subject: [PATCH 72/78] Ticket 571 (dup 47361) - Empty control list causes LDAP
|
|
|
cc3dff |
protocol error is thrown
|
|
|
cc3dff |
|
|
|
cc3dff |
Bug Description:
|
|
|
cc3dff |
|
|
|
cc3dff |
If a request contains a list of controls containing zero control, it does
|
|
|
cc3dff |
not conform RFC http://tools.ietf.org/html/rfc4511#section-4.1.11. Then the
|
|
|
cc3dff |
server returns a Protocol Error.
|
|
|
cc3dff |
This is too restrictive for some applications.
|
|
|
cc3dff |
Note: such application needs to be linked with old version of mozldap or openldap
|
|
|
cc3dff |
because recent version skip sending empty list of controls
|
|
|
cc3dff |
|
|
|
cc3dff |
Fix Description:
|
|
|
cc3dff |
The fix is to ignore this error and let the operation complete
|
|
|
cc3dff |
|
|
|
cc3dff |
Note: ticket 571 (bz 918717) is a duplicate of 47361 (bz 963234). 47361 was used to
|
|
|
cc3dff |
backport in 1.2.11. 571 is used to backport in 1.3.1.
|
|
|
cc3dff |
This bug is fixed since 1.3.2
|
|
|
cc3dff |
|
|
|
cc3dff |
https://fedorahosted.org/389/ticket/571
|
|
|
cc3dff |
https://fedorahosted.org/389/ticket/47361
|
|
|
cc3dff |
|
|
|
cc3dff |
Reviewed by: Rich Megginson (thanks Rich !)
|
|
|
cc3dff |
|
|
|
cc3dff |
Platforms tested: F17 (unit + acceptance vlv/proxy/managed/psearch/tls/bindcontrol)
|
|
|
cc3dff |
|
|
|
cc3dff |
Flag Day: no
|
|
|
cc3dff |
|
|
|
cc3dff |
Doc impact: no
|
|
|
cc3dff |
(cherry picked from commit dea2a254117f1e9f4be1068c6784b2780fec933f)
|
|
|
cc3dff |
---
|
|
|
cc3dff |
ldap/servers/slapd/control.c | 32 +++++++++++++++++++++-----------
|
|
|
cc3dff |
1 file changed, 21 insertions(+), 11 deletions(-)
|
|
|
cc3dff |
|
|
|
cc3dff |
diff --git a/ldap/servers/slapd/control.c b/ldap/servers/slapd/control.c
|
|
|
cc3dff |
index fc3ab9f..e614d50 100644
|
|
|
cc3dff |
--- a/ldap/servers/slapd/control.c
|
|
|
cc3dff |
+++ b/ldap/servers/slapd/control.c
|
|
|
cc3dff |
@@ -354,17 +354,27 @@ get_ldapmessage_controls_ext(
|
|
|
cc3dff |
len = -1; /* reset for next loop iter */
|
|
|
cc3dff |
}
|
|
|
cc3dff |
|
|
|
cc3dff |
- if ( (tag != LBER_END_OF_SEQORSET) && (len != -1) ) {
|
|
|
cc3dff |
- goto free_and_return;
|
|
|
cc3dff |
- }
|
|
|
cc3dff |
-
|
|
|
cc3dff |
- slapi_pblock_set( pb, SLAPI_REQCONTROLS, ctrls );
|
|
|
cc3dff |
- managedsait = slapi_control_present( ctrls,
|
|
|
cc3dff |
- LDAP_CONTROL_MANAGEDSAIT, NULL, NULL );
|
|
|
cc3dff |
- slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, &managedsait );
|
|
|
cc3dff |
- pwpolicy_ctrl = slapi_control_present( ctrls,
|
|
|
cc3dff |
- LDAP_X_CONTROL_PWPOLICY_REQUEST, NULL, NULL );
|
|
|
cc3dff |
- slapi_pblock_set( pb, SLAPI_PWPOLICY, &pwpolicy_ctrl );
|
|
|
cc3dff |
+ if (curcontrols == 0) {
|
|
|
cc3dff |
+ int ctrl_not_found = 0; /* means that a given control is not present in the request */
|
|
|
cc3dff |
+
|
|
|
cc3dff |
+ slapi_pblock_set(pb, SLAPI_REQCONTROLS, NULL);
|
|
|
cc3dff |
+ slapi_pblock_set(pb, SLAPI_MANAGEDSAIT, &ctrl_not_found);
|
|
|
cc3dff |
+ slapi_pblock_set(pb, SLAPI_PWPOLICY, &ctrl_not_found);
|
|
|
cc3dff |
+ slapi_log_error(SLAPI_LOG_CONNS, "connection", "Warning: conn=%d op=%d contains an empty list of controls\n",
|
|
|
cc3dff |
+ pb->pb_conn->c_connid, pb->pb_op->o_opid);
|
|
|
cc3dff |
+ } else {
|
|
|
cc3dff |
+ if ((tag != LBER_END_OF_SEQORSET) && (len != -1)) {
|
|
|
cc3dff |
+ goto free_and_return;
|
|
|
cc3dff |
+ }
|
|
|
cc3dff |
+
|
|
|
cc3dff |
+ slapi_pblock_set(pb, SLAPI_REQCONTROLS, ctrls);
|
|
|
cc3dff |
+ managedsait = slapi_control_present(ctrls,
|
|
|
cc3dff |
+ LDAP_CONTROL_MANAGEDSAIT, NULL, NULL);
|
|
|
cc3dff |
+ slapi_pblock_set(pb, SLAPI_MANAGEDSAIT, &managedsait);
|
|
|
cc3dff |
+ pwpolicy_ctrl = slapi_control_present(ctrls,
|
|
|
cc3dff |
+ LDAP_X_CONTROL_PWPOLICY_REQUEST, NULL, NULL);
|
|
|
cc3dff |
+ slapi_pblock_set(pb, SLAPI_PWPOLICY, &pwpolicy_ctrl);
|
|
|
cc3dff |
+ }
|
|
|
cc3dff |
|
|
|
cc3dff |
if ( controlsp != NULL ) {
|
|
|
cc3dff |
*controlsp = ctrls;
|
|
|
cc3dff |
--
|
|
|
cc3dff |
1.8.1.4
|
|
|
cc3dff |
|