r26193: In the LDAP server, use the new 'controls_decoded' element to
authorAndrew Bartlett <abartlet@samba.org>
Thu, 29 Nov 2007 07:02:36 +0000 (08:02 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:46:44 +0000 (05:46 +0100)
determine if this (possibly critical) control has been decoded.  This
allows us to return an error, rather than just dropping the socket.

Andrew Bartlett
(This used to be commit 230a60c1910f95ce5139c174d6d79786fca08433)

source4/ldap_server/ldap_backend.c

index 5a953947f320d538db3f028b37a0ba3a3d48d4c5..a6697dfba8020fd653c858750d709e149acede43 100644 (file)
@@ -720,6 +720,18 @@ static NTSTATUS ldapsrv_AbandonRequest(struct ldapsrv_call *call)
 
 NTSTATUS ldapsrv_do_call(struct ldapsrv_call *call)
 {
+       int i;
+       struct ldap_message *msg = call->request;
+       /* Check for undecoded critical extensions */
+       for (i=0; msg->controls && msg->controls[i]; i++) {
+               if (!msg->controls_decoded[i] && 
+                   msg->controls[i]->critical) {
+                       DEBUG(3, ("ldapsrv_do_call: Critical extension %s is not known to this server\n",
+                                 msg->controls[i]->oid));
+                       return ldapsrv_unwilling(call, LDAP_UNAVAILABLE_CRITICAL_EXTENSION);
+               }
+       }
+
        switch(call->request->type) {
        case LDAP_TAG_BindRequest:
                return ldapsrv_BindRequest(call);