diff options
Diffstat (limited to 'recipes-support/openldap/openldap-2.4.39/evolution-ntlm.patch')
| -rw-r--r-- | recipes-support/openldap/openldap-2.4.39/evolution-ntlm.patch | 222 |
1 files changed, 222 insertions, 0 deletions
diff --git a/recipes-support/openldap/openldap-2.4.39/evolution-ntlm.patch b/recipes-support/openldap/openldap-2.4.39/evolution-ntlm.patch new file mode 100644 index 0000000..cd9bc26 --- /dev/null +++ b/recipes-support/openldap/openldap-2.4.39/evolution-ntlm.patch | |||
| @@ -0,0 +1,222 @@ | |||
| 1 | Patch from evolution-exchange (2.10.3). The ldap_ntlm_bind function is | ||
| 2 | actually called by evolution-data-server, checked at version 1.12.2. | ||
| 3 | Without this patch, the Exchange addressbook integration uses simple binds | ||
| 4 | with cleartext passwords. | ||
| 5 | |||
| 6 | Russ checked with openldap-software for upstream's opinion on this patch | ||
| 7 | on 2007-12-21. Upstream had never received it as a patch submission and | ||
| 8 | given that it's apparently only for older Exchange servers that can't do | ||
| 9 | SASL and DIGEST-MD5, it's not very appealing. | ||
| 10 | |||
| 11 | Bug#457374 filed against evolution-data-server asking if this support is | ||
| 12 | still required on 2007-12-21. | ||
| 13 | |||
| 14 | --- a/include/ldap.h | ||
| 15 | +++ b/include/ldap.h | ||
| 16 | @@ -2517,5 +2517,25 @@ ldap_parse_deref_control LDAP_P(( | ||
| 17 | LDAPControl **ctrls, | ||
| 18 | LDAPDerefRes **drp )); | ||
| 19 | |||
| 20 | +/* | ||
| 21 | + * hacks for NTLM | ||
| 22 | + */ | ||
| 23 | +#define LDAP_AUTH_NTLM_REQUEST ((ber_tag_t) 0x8aU) | ||
| 24 | +#define LDAP_AUTH_NTLM_RESPONSE ((ber_tag_t) 0x8bU) | ||
| 25 | +LDAP_F( int ) | ||
| 26 | +ldap_ntlm_bind LDAP_P(( | ||
| 27 | + LDAP *ld, | ||
| 28 | + LDAP_CONST char *dn, | ||
| 29 | + ber_tag_t tag, | ||
| 30 | + struct berval *cred, | ||
| 31 | + LDAPControl **sctrls, | ||
| 32 | + LDAPControl **cctrls, | ||
| 33 | + int *msgidp )); | ||
| 34 | +LDAP_F( int ) | ||
| 35 | +ldap_parse_ntlm_bind_result LDAP_P(( | ||
| 36 | + LDAP *ld, | ||
| 37 | + LDAPMessage *res, | ||
| 38 | + struct berval *challenge)); | ||
| 39 | + | ||
| 40 | LDAP_END_DECL | ||
| 41 | #endif /* _LDAP_H */ | ||
| 42 | --- /dev/null | ||
| 43 | +++ b/libraries/libldap/ntlm.c | ||
| 44 | @@ -0,0 +1,138 @@ | ||
| 45 | +/* $OpenLDAP: pkg/ldap/libraries/libldap/ntlm.c,v 1.1.4.10 2002/01/04 20:38:21 kurt Exp $ */ | ||
| 46 | +/* | ||
| 47 | + * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. | ||
| 48 | + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file | ||
| 49 | + */ | ||
| 50 | + | ||
| 51 | +/* Mostly copied from sasl.c */ | ||
| 52 | + | ||
| 53 | +#include "portable.h" | ||
| 54 | + | ||
| 55 | +#include <stdlib.h> | ||
| 56 | +#include <stdio.h> | ||
| 57 | + | ||
| 58 | +#include <ac/socket.h> | ||
| 59 | +#include <ac/string.h> | ||
| 60 | +#include <ac/time.h> | ||
| 61 | +#include <ac/errno.h> | ||
| 62 | + | ||
| 63 | +#include "ldap-int.h" | ||
| 64 | + | ||
| 65 | +int | ||
| 66 | +ldap_ntlm_bind( | ||
| 67 | + LDAP *ld, | ||
| 68 | + LDAP_CONST char *dn, | ||
| 69 | + ber_tag_t tag, | ||
| 70 | + struct berval *cred, | ||
| 71 | + LDAPControl **sctrls, | ||
| 72 | + LDAPControl **cctrls, | ||
| 73 | + int *msgidp ) | ||
| 74 | +{ | ||
| 75 | + BerElement *ber; | ||
| 76 | + int rc; | ||
| 77 | + ber_int_t id; | ||
| 78 | + | ||
| 79 | + Debug( LDAP_DEBUG_TRACE, "ldap_ntlm_bind\n", 0, 0, 0 ); | ||
| 80 | + | ||
| 81 | + assert( ld != NULL ); | ||
| 82 | + assert( LDAP_VALID( ld ) ); | ||
| 83 | + assert( msgidp != NULL ); | ||
| 84 | + | ||
| 85 | + if( msgidp == NULL ) { | ||
| 86 | + ld->ld_errno = LDAP_PARAM_ERROR; | ||
| 87 | + return ld->ld_errno; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /* create a message to send */ | ||
| 91 | + if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) { | ||
| 92 | + ld->ld_errno = LDAP_NO_MEMORY; | ||
| 93 | + return ld->ld_errno; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + assert( LBER_VALID( ber ) ); | ||
| 97 | + | ||
| 98 | + LDAP_NEXT_MSGID( ld, id ); | ||
| 99 | + rc = ber_printf( ber, "{it{istON}" /*}*/, | ||
| 100 | + id, LDAP_REQ_BIND, | ||
| 101 | + ld->ld_version, dn, tag, | ||
| 102 | + cred ); | ||
| 103 | + | ||
| 104 | + /* Put Server Controls */ | ||
| 105 | + if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) { | ||
| 106 | + ber_free( ber, 1 ); | ||
| 107 | + return ld->ld_errno; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + if ( ber_printf( ber, /*{*/ "N}" ) == -1 ) { | ||
| 111 | + ld->ld_errno = LDAP_ENCODING_ERROR; | ||
| 112 | + ber_free( ber, 1 ); | ||
| 113 | + return ld->ld_errno; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + /* send the message */ | ||
| 117 | + *msgidp = ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber, id ); | ||
| 118 | + | ||
| 119 | + if(*msgidp < 0) | ||
| 120 | + return ld->ld_errno; | ||
| 121 | + | ||
| 122 | + return LDAP_SUCCESS; | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | +int | ||
| 126 | +ldap_parse_ntlm_bind_result( | ||
| 127 | + LDAP *ld, | ||
| 128 | + LDAPMessage *res, | ||
| 129 | + struct berval *challenge) | ||
| 130 | +{ | ||
| 131 | + ber_int_t errcode; | ||
| 132 | + ber_tag_t tag; | ||
| 133 | + BerElement *ber; | ||
| 134 | + ber_len_t len; | ||
| 135 | + | ||
| 136 | + Debug( LDAP_DEBUG_TRACE, "ldap_parse_ntlm_bind_result\n", 0, 0, 0 ); | ||
| 137 | + | ||
| 138 | + assert( ld != NULL ); | ||
| 139 | + assert( LDAP_VALID( ld ) ); | ||
| 140 | + assert( res != NULL ); | ||
| 141 | + | ||
| 142 | + if ( ld == NULL || res == NULL ) { | ||
| 143 | + return LDAP_PARAM_ERROR; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + if( res->lm_msgtype != LDAP_RES_BIND ) { | ||
| 147 | + ld->ld_errno = LDAP_PARAM_ERROR; | ||
| 148 | + return ld->ld_errno; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + if ( ld->ld_error ) { | ||
| 152 | + LDAP_FREE( ld->ld_error ); | ||
| 153 | + ld->ld_error = NULL; | ||
| 154 | + } | ||
| 155 | + if ( ld->ld_matched ) { | ||
| 156 | + LDAP_FREE( ld->ld_matched ); | ||
| 157 | + ld->ld_matched = NULL; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + /* parse results */ | ||
| 161 | + | ||
| 162 | + ber = ber_dup( res->lm_ber ); | ||
| 163 | + | ||
| 164 | + if( ber == NULL ) { | ||
| 165 | + ld->ld_errno = LDAP_NO_MEMORY; | ||
| 166 | + return ld->ld_errno; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + tag = ber_scanf( ber, "{ioa" /*}*/, | ||
| 170 | + &errcode, challenge, &ld->ld_error ); | ||
| 171 | + ber_free( ber, 0 ); | ||
| 172 | + | ||
| 173 | + if( tag == LBER_ERROR ) { | ||
| 174 | + ld->ld_errno = LDAP_DECODING_ERROR; | ||
| 175 | + return ld->ld_errno; | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + ld->ld_errno = errcode; | ||
| 179 | + | ||
| 180 | + return( ld->ld_errno ); | ||
| 181 | +} | ||
| 182 | + | ||
| 183 | --- a/libraries/libldap/Makefile.in | ||
| 184 | +++ b/libraries/libldap/Makefile.in | ||
| 185 | @@ -27,7 +27,7 @@ SRCS = bind.c open.c result.c error.c co | ||
| 186 | init.c options.c print.c string.c util-int.c schema.c \ | ||
| 187 | charray.c os-local.c dnssrv.c utf-8.c utf-8-conv.c \ | ||
| 188 | tls2.c tls_o.c tls_g.c tls_m.c \ | ||
| 189 | - turn.c ppolicy.c dds.c txn.c ldap_sync.c stctrl.c \ | ||
| 190 | + turn.c ppolicy.c dds.c txn.c ldap_sync.c stctrl.c ntlm.c \ | ||
| 191 | assertion.c deref.c ldif.c fetch.c | ||
| 192 | |||
| 193 | OBJS = bind.lo open.lo result.lo error.lo compare.lo search.lo \ | ||
| 194 | @@ -40,7 +40,7 @@ OBJS = bind.lo open.lo result.lo error.l | ||
| 195 | init.lo options.lo print.lo string.lo util-int.lo schema.lo \ | ||
| 196 | charray.lo os-local.lo dnssrv.lo utf-8.lo utf-8-conv.lo \ | ||
| 197 | tls2.lo tls_o.lo tls_g.lo tls_m.lo \ | ||
| 198 | - turn.lo ppolicy.lo dds.lo txn.lo ldap_sync.lo stctrl.lo \ | ||
| 199 | + turn.lo ppolicy.lo dds.lo txn.lo ldap_sync.lo stctrl.lo ntlm.lo \ | ||
| 200 | assertion.lo deref.lo ldif.lo fetch.lo | ||
| 201 | |||
| 202 | LDAP_INCDIR= ../../include | ||
| 203 | --- a/libraries/libldap_r/Makefile.in | ||
| 204 | +++ b/libraries/libldap_r/Makefile.in | ||
| 205 | @@ -29,7 +29,7 @@ XXSRCS = apitest.c test.c \ | ||
| 206 | init.c options.c print.c string.c util-int.c schema.c \ | ||
| 207 | charray.c os-local.c dnssrv.c utf-8.c utf-8-conv.c \ | ||
| 208 | tls2.c tls_o.c tls_g.c tls_m.c \ | ||
| 209 | - turn.c ppolicy.c dds.c txn.c ldap_sync.c stctrl.c \ | ||
| 210 | + turn.c ppolicy.c dds.c txn.c ldap_sync.c stctrl.c ntlm.c \ | ||
| 211 | assertion.c deref.c ldif.c fetch.c | ||
| 212 | SRCS = threads.c rdwr.c rmutex.c tpool.c rq.c \ | ||
| 213 | thr_posix.c thr_cthreads.c thr_thr.c thr_nt.c \ | ||
| 214 | @@ -47,7 +47,7 @@ OBJS = threads.lo rdwr.lo rmutex.lo tpoo | ||
| 215 | init.lo options.lo print.lo string.lo util-int.lo schema.lo \ | ||
| 216 | charray.lo os-local.lo dnssrv.lo utf-8.lo utf-8-conv.lo \ | ||
| 217 | tls2.lo tls_o.lo tls_g.lo tls_m.lo \ | ||
| 218 | - turn.lo ppolicy.lo dds.lo txn.lo ldap_sync.lo stctrl.lo \ | ||
| 219 | + turn.lo ppolicy.lo dds.lo txn.lo ldap_sync.lo stctrl.lo ntlm.lo \ | ||
| 220 | assertion.lo deref.lo ldif.lo fetch.lo | ||
| 221 | |||
| 222 | LDAP_INCDIR= ../../include | ||
