1 |
Get rid of this patch as soon as possible. |
2 |
More details are provided in README.evolution |
3 |
|
4 |
diff -uNPrp openldap-2.4.23.old/include/ldap.h openldap-2.4.23.new/include/ldap.h |
5 |
--- openldap-2.4.23.old/include/ldap.h 2010-06-10 20:48:36.000000000 +0200 |
6 |
+++ openldap-2.4.23.new/include/ldap.h 2010-08-24 18:17:46.306679878 +0200 |
7 |
@@ -2487,5 +2487,26 @@ ldap_parse_deref_control LDAP_P(( |
8 |
LDAPControl **ctrls, |
9 |
LDAPDerefRes **drp )); |
10 |
|
11 |
+/* |
12 |
+ * hacks for NTLM |
13 |
+ */ |
14 |
+#define LDAP_AUTH_NTLM_REQUEST ((ber_tag_t) 0x8aU) |
15 |
+#define LDAP_AUTH_NTLM_RESPONSE ((ber_tag_t) 0x8bU) |
16 |
+LDAP_F( int ) |
17 |
+ldap_ntlm_bind LDAP_P(( |
18 |
+ LDAP *ld, |
19 |
+ LDAP_CONST char *dn, |
20 |
+ ber_tag_t tag, |
21 |
+ struct berval *cred, |
22 |
+ LDAPControl **sctrls, |
23 |
+ LDAPControl **cctrls, |
24 |
+ int *msgidp )); |
25 |
+LDAP_F( int ) |
26 |
+ldap_parse_ntlm_bind_result LDAP_P(( |
27 |
+ LDAP *ld, |
28 |
+ LDAPMessage *res, |
29 |
+ struct berval *challenge)); |
30 |
+ |
31 |
+ |
32 |
LDAP_END_DECL |
33 |
#endif /* _LDAP_H */ |
34 |
diff -uNPrp openldap-2.4.23.old/libraries/libldap/Makefile.in openldap-2.4.23.new/libraries/libldap/Makefile.in |
35 |
--- openldap-2.4.23.old/libraries/libldap/Makefile.in 2010-04-13 22:22:55.000000000 +0200 |
36 |
+++ openldap-2.4.23.new/libraries/libldap/Makefile.in 2010-08-24 18:17:46.306679878 +0200 |
37 |
@@ -20,7 +20,7 @@ PROGRAMS = apitest dntest ftest ltest ur |
38 |
SRCS = bind.c open.c result.c error.c compare.c search.c \ |
39 |
controls.c messages.c references.c extended.c cyrus.c \ |
40 |
modify.c add.c modrdn.c delete.c abandon.c \ |
41 |
- sasl.c gssapi.c sbind.c unbind.c cancel.c \ |
42 |
+ sasl.c ntlm.c gssapi.c sbind.c unbind.c cancel.c \ |
43 |
filter.c free.c sort.c passwd.c whoami.c \ |
44 |
getdn.c getentry.c getattr.c getvalues.c addentry.c \ |
45 |
request.c os-ip.c url.c pagectrl.c sortctrl.c vlvctrl.c \ |
46 |
@@ -33,7 +33,7 @@ SRCS = bind.c open.c result.c error.c co |
47 |
OBJS = bind.lo open.lo result.lo error.lo compare.lo search.lo \ |
48 |
controls.lo messages.lo references.lo extended.lo cyrus.lo \ |
49 |
modify.lo add.lo modrdn.lo delete.lo abandon.lo \ |
50 |
- sasl.lo gssapi.lo sbind.lo unbind.lo cancel.lo \ |
51 |
+ sasl.lo ntlm.lo gssapi.lo sbind.lo unbind.lo cancel.lo \ |
52 |
filter.lo free.lo sort.lo passwd.lo whoami.lo \ |
53 |
getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \ |
54 |
request.lo os-ip.lo url.lo pagectrl.lo sortctrl.lo vlvctrl.lo \ |
55 |
diff -uNPrp openldap-2.4.23.old/libraries/libldap/ntlm.c openldap-2.4.23.new/libraries/libldap/ntlm.c |
56 |
--- openldap-2.4.23.old/libraries/libldap/ntlm.c 1970-01-01 01:00:00.000000000 +0100 |
57 |
+++ openldap-2.4.23.new/libraries/libldap/ntlm.c 2010-08-24 18:17:46.330680333 +0200 |
58 |
@@ -0,0 +1,137 @@ |
59 |
+/* $OpenLDAP: pkg/ldap/libraries/libldap/ntlm.c,v 1.1.4.10 2002/01/04 20:38:21 kurt Exp $ */ |
60 |
+/* |
61 |
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. |
62 |
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file |
63 |
+ */ |
64 |
+ |
65 |
+/* Mostly copied from sasl.c */ |
66 |
+ |
67 |
+#include "portable.h" |
68 |
+ |
69 |
+#include <stdlib.h> |
70 |
+#include <stdio.h> |
71 |
+ |
72 |
+#include <ac/socket.h> |
73 |
+#include <ac/string.h> |
74 |
+#include <ac/time.h> |
75 |
+#include <ac/errno.h> |
76 |
+ |
77 |
+#include "ldap-int.h" |
78 |
+ |
79 |
+int |
80 |
+ldap_ntlm_bind( |
81 |
+ LDAP *ld, |
82 |
+ LDAP_CONST char *dn, |
83 |
+ ber_tag_t tag, |
84 |
+ struct berval *cred, |
85 |
+ LDAPControl **sctrls, |
86 |
+ LDAPControl **cctrls, |
87 |
+ int *msgidp ) |
88 |
+{ |
89 |
+ BerElement *ber; |
90 |
+ int rc; |
91 |
+ ber_int_t id; |
92 |
+ |
93 |
+ Debug( LDAP_DEBUG_TRACE, "ldap_ntlm_bind\n", 0, 0, 0 ); |
94 |
+ |
95 |
+ assert( ld != NULL ); |
96 |
+ assert( LDAP_VALID( ld ) ); |
97 |
+ assert( msgidp != NULL ); |
98 |
+ |
99 |
+ if( msgidp == NULL ) { |
100 |
+ ld->ld_errno = LDAP_PARAM_ERROR; |
101 |
+ return ld->ld_errno; |
102 |
+ } |
103 |
+ |
104 |
+ /* create a message to send */ |
105 |
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) { |
106 |
+ ld->ld_errno = LDAP_NO_MEMORY; |
107 |
+ return ld->ld_errno; |
108 |
+ } |
109 |
+ |
110 |
+ assert( LBER_VALID( ber ) ); |
111 |
+ |
112 |
+ LDAP_NEXT_MSGID( ld, id ); |
113 |
+ rc = ber_printf( ber, "{it{istON}" /*}*/, |
114 |
+ id, LDAP_REQ_BIND, |
115 |
+ ld->ld_version, dn, tag, |
116 |
+ cred ); |
117 |
+ |
118 |
+ /* Put Server Controls */ |
119 |
+ if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) { |
120 |
+ ber_free( ber, 1 ); |
121 |
+ return ld->ld_errno; |
122 |
+ } |
123 |
+ |
124 |
+ if ( ber_printf( ber, /*{*/ "N}" ) == -1 ) { |
125 |
+ ld->ld_errno = LDAP_ENCODING_ERROR; |
126 |
+ ber_free( ber, 1 ); |
127 |
+ return ld->ld_errno; |
128 |
+ } |
129 |
+ |
130 |
+ /* send the message */ |
131 |
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber, id ); |
132 |
+ |
133 |
+ if(*msgidp < 0) |
134 |
+ return ld->ld_errno; |
135 |
+ |
136 |
+ return LDAP_SUCCESS; |
137 |
+} |
138 |
+ |
139 |
+int |
140 |
+ldap_parse_ntlm_bind_result( |
141 |
+ LDAP *ld, |
142 |
+ LDAPMessage *res, |
143 |
+ struct berval *challenge) |
144 |
+{ |
145 |
+ ber_int_t errcode; |
146 |
+ ber_tag_t tag; |
147 |
+ BerElement *ber; |
148 |
+ ber_len_t len; |
149 |
+ |
150 |
+ Debug( LDAP_DEBUG_TRACE, "ldap_parse_ntlm_bind_result\n", 0, 0, 0 ); |
151 |
+ |
152 |
+ assert( ld != NULL ); |
153 |
+ assert( LDAP_VALID( ld ) ); |
154 |
+ assert( res != NULL ); |
155 |
+ |
156 |
+ if ( ld == NULL || res == NULL ) { |
157 |
+ return LDAP_PARAM_ERROR; |
158 |
+ } |
159 |
+ |
160 |
+ if( res->lm_msgtype != LDAP_RES_BIND ) { |
161 |
+ ld->ld_errno = LDAP_PARAM_ERROR; |
162 |
+ return ld->ld_errno; |
163 |
+ } |
164 |
+ |
165 |
+ if ( ld->ld_error ) { |
166 |
+ LDAP_FREE( ld->ld_error ); |
167 |
+ ld->ld_error = NULL; |
168 |
+ } |
169 |
+ if ( ld->ld_matched ) { |
170 |
+ LDAP_FREE( ld->ld_matched ); |
171 |
+ ld->ld_matched = NULL; |
172 |
+ } |
173 |
+ |
174 |
+ /* parse results */ |
175 |
+ |
176 |
+ ber = ber_dup( res->lm_ber ); |
177 |
+ |
178 |
+ if( ber == NULL ) { |
179 |
+ ld->ld_errno = LDAP_NO_MEMORY; |
180 |
+ return ld->ld_errno; |
181 |
+ } |
182 |
+ |
183 |
+ tag = ber_scanf( ber, "{ioa" /*}*/, |
184 |
+ &errcode, challenge, &ld->ld_error ); |
185 |
+ ber_free( ber, 0 ); |
186 |
+ |
187 |
+ if( tag == LBER_ERROR ) { |
188 |
+ ld->ld_errno = LDAP_DECODING_ERROR; |
189 |
+ return ld->ld_errno; |
190 |
+ } |
191 |
+ |
192 |
+ ld->ld_errno = errcode; |
193 |
+ |
194 |
+ return( ld->ld_errno ); |
195 |
+} |