View | Details | Raw Unified | Return to bug 11426
Collapse All | Expand All

(-)openldap-2.2.19/include/ldap.h.ntlm (+21 lines)
Lines 1769-1773 Link Here
1769
	LDAPControl **sctrls,
1769
	LDAPControl **sctrls,
1770
	LDAPControl **cctrls ));
1770
	LDAPControl **cctrls ));
1771
1771
1772
/*
1773
 * hacks for NTLM
1774
 */
1775
#define LDAP_AUTH_NTLM_REQUEST	((ber_tag_t) 0x8aU)
1776
#define LDAP_AUTH_NTLM_RESPONSE	((ber_tag_t) 0x8bU)
1777
LDAP_F( int )
1778
ldap_ntlm_bind LDAP_P((
1779
	LDAP		*ld,
1780
	LDAP_CONST char	*dn,
1781
	ber_tag_t	tag,
1782
	struct berval	*cred,
1783
	LDAPControl	**sctrls,
1784
	LDAPControl	**cctrls,
1785
	int		*msgidp ));
1786
LDAP_F( int )
1787
ldap_parse_ntlm_bind_result LDAP_P((
1788
	LDAP		*ld,
1789
	LDAPMessage	*res,
1790
	struct berval	*challenge));
1791
1792
1772
LDAP_END_DECL
1793
LDAP_END_DECL
1773
#endif /* _LDAP_H */
1794
#endif /* _LDAP_H */
(-)openldap-2.2.19/libraries/libldap/Makefile.in.ntlm (-2 / +2 lines)
Lines 20-26 Link Here
20
SRCS	= bind.c open.c result.c error.c compare.c search.c \
20
SRCS	= bind.c open.c result.c error.c compare.c search.c \
21
	controls.c messages.c references.c extended.c cyrus.c \
21
	controls.c messages.c references.c extended.c cyrus.c \
22
	modify.c add.c modrdn.c delete.c abandon.c \
22
	modify.c add.c modrdn.c delete.c abandon.c \
23
	sasl.c sbind.c kbind.c unbind.c cancel.c  \
23
	sasl.c ntlm.c sbind.c kbind.c unbind.c cancel.c  \
24
	filter.c free.c sort.c passwd.c whoami.c \
24
	filter.c free.c sort.c passwd.c whoami.c \
25
	getdn.c getentry.c getattr.c getvalues.c addentry.c \
25
	getdn.c getentry.c getattr.c getvalues.c addentry.c \
26
	request.c os-ip.c url.c sortctrl.c vlvctrl.c \
26
	request.c os-ip.c url.c sortctrl.c vlvctrl.c \
Lines 29-35 Link Here
29
OBJS	= bind.lo open.lo result.lo error.lo compare.lo search.lo \
29
OBJS	= bind.lo open.lo result.lo error.lo compare.lo search.lo \
30
	controls.lo messages.lo references.lo extended.lo cyrus.lo \
30
	controls.lo messages.lo references.lo extended.lo cyrus.lo \
31
	modify.lo add.lo modrdn.lo delete.lo abandon.lo \
31
	modify.lo add.lo modrdn.lo delete.lo abandon.lo \
32
	sasl.lo sbind.lo kbind.lo unbind.lo cancel.lo \
32
	sasl.lo ntlm.lo sbind.lo kbind.lo unbind.lo cancel.lo \
33
	filter.lo free.lo sort.lo passwd.lo whoami.lo \
33
	filter.lo free.lo sort.lo passwd.lo whoami.lo \
34
	getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
34
	getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
35
	request.lo os-ip.lo url.lo sortctrl.lo vlvctrl.lo \
35
	request.lo os-ip.lo url.lo sortctrl.lo vlvctrl.lo \
(-)openldap-2.2.19/libraries/libldap/ntlm.c.ntlm (+137 lines)
Line 0 Link Here
1
/* $OpenLDAP: pkg/ldap/libraries/libldap/ntlm.c,v 1.1.4.10 2002/01/04 20:38:21 kurt Exp $ */
2
/*
3
 * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
4
 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5
 */
6
7
/* Mostly copied from sasl.c */
8
9
#include "portable.h"
10
11
#include <stdlib.h>
12
#include <stdio.h>
13
14
#include <ac/socket.h>
15
#include <ac/string.h>
16
#include <ac/time.h>
17
#include <ac/errno.h>
18
19
#include "ldap-int.h"
20
21
int
22
ldap_ntlm_bind(
23
	LDAP		*ld,
24
	LDAP_CONST char	*dn,
25
	ber_tag_t	tag,
26
	struct berval	*cred,
27
	LDAPControl	**sctrls,
28
	LDAPControl	**cctrls,
29
	int		*msgidp )
30
{
31
	BerElement	*ber;
32
	int rc;
33
	ber_int_t id;
34
35
	Debug( LDAP_DEBUG_TRACE, "ldap_ntlm_bind\n", 0, 0, 0 );
36
37
	assert( ld != NULL );
38
	assert( LDAP_VALID( ld ) );
39
	assert( msgidp != NULL );
40
41
	if( msgidp == NULL ) {
42
		ld->ld_errno = LDAP_PARAM_ERROR;
43
		return ld->ld_errno;
44
	}
45
46
	/* create a message to send */
47
	if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
48
		ld->ld_errno = LDAP_NO_MEMORY;
49
		return ld->ld_errno;
50
	}
51
52
	assert( LBER_VALID( ber ) );
53
54
	LDAP_NEXT_MSGID( ld, id );
55
	rc = ber_printf( ber, "{it{istON}" /*}*/,
56
			 id, LDAP_REQ_BIND,
57
			 ld->ld_version, dn, tag,
58
			 cred );
59
60
	/* Put Server Controls */
61
	if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
62
		ber_free( ber, 1 );
63
		return ld->ld_errno;
64
	}
65
66
	if ( ber_printf( ber, /*{*/ "N}" ) == -1 ) {
67
		ld->ld_errno = LDAP_ENCODING_ERROR;
68
		ber_free( ber, 1 );
69
		return ld->ld_errno;
70
	}
71
72
	/* send the message */
73
	*msgidp = ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber, id );
74
75
	if(*msgidp < 0)
76
		return ld->ld_errno;
77
78
	return LDAP_SUCCESS;
79
}
80
81
int
82
ldap_parse_ntlm_bind_result(
83
	LDAP		*ld,
84
	LDAPMessage	*res,
85
	struct berval	*challenge)
86
{
87
	ber_int_t	errcode;
88
	ber_tag_t	tag;
89
	BerElement	*ber;
90
	ber_len_t	len;
91
92
	Debug( LDAP_DEBUG_TRACE, "ldap_parse_ntlm_bind_result\n", 0, 0, 0 );
93
94
	assert( ld != NULL );
95
	assert( LDAP_VALID( ld ) );
96
	assert( res != NULL );
97
98
	if ( ld == NULL || res == NULL ) {
99
		return LDAP_PARAM_ERROR;
100
	}
101
102
	if( res->lm_msgtype != LDAP_RES_BIND ) {
103
		ld->ld_errno = LDAP_PARAM_ERROR;
104
		return ld->ld_errno;
105
	}
106
107
	if ( ld->ld_error ) {
108
		LDAP_FREE( ld->ld_error );
109
		ld->ld_error = NULL;
110
	}
111
	if ( ld->ld_matched ) {
112
		LDAP_FREE( ld->ld_matched );
113
		ld->ld_matched = NULL;
114
	}
115
116
	/* parse results */
117
118
	ber = ber_dup( res->lm_ber );
119
120
	if( ber == NULL ) {
121
		ld->ld_errno = LDAP_NO_MEMORY;
122
		return ld->ld_errno;
123
	}
124
125
	tag = ber_scanf( ber, "{ioa" /*}*/,
126
			 &errcode, challenge, &ld->ld_error );
127
	ber_free( ber, 0 );
128
129
	if( tag == LBER_ERROR ) {
130
		ld->ld_errno = LDAP_DECODING_ERROR;
131
		return ld->ld_errno;
132
	}
133
134
	ld->ld_errno = errcode;
135
136
	return( ld->ld_errno );
137
}

Return to bug 11426