1 | /* |
---|
2 | * Copyright (c) 1998 Sendmail, Inc. All rights reserved. |
---|
3 | * |
---|
4 | * By using this file, you agree to the terms and conditions set |
---|
5 | * forth in the LICENSE file which can be found at the top level of |
---|
6 | * the sendmail distribution. |
---|
7 | * |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | ** Support for LDAP. |
---|
12 | ** |
---|
13 | ** Contributed by Booker C. Bense <bbense+ldap@stanford.edu>. |
---|
14 | ** Please go to him for support -- since I (Eric) don't run LDAP, I |
---|
15 | ** can't help you at all. |
---|
16 | ** |
---|
17 | ** @(#)ldap_map.h 8.12 (Berkeley) 2/2/1999 |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef _LDAP_MAP_H |
---|
21 | #define _LDAP_MAP_H |
---|
22 | |
---|
23 | #include <sys/time.h> |
---|
24 | |
---|
25 | struct ldap_map_struct |
---|
26 | { |
---|
27 | /* needed for ldap_open */ |
---|
28 | char *ldaphost; |
---|
29 | int ldapport; |
---|
30 | |
---|
31 | /* Options set in ld struct before ldap_bind_s */ |
---|
32 | int deref; |
---|
33 | int timelimit; |
---|
34 | int sizelimit; |
---|
35 | int ldap_options; |
---|
36 | |
---|
37 | /* args for ldap_bind_s */ |
---|
38 | LDAP *ld; |
---|
39 | char *binddn; |
---|
40 | char *passwd; |
---|
41 | int method; |
---|
42 | |
---|
43 | /* args for ldap_search_st */ |
---|
44 | char *base; |
---|
45 | int scope; |
---|
46 | char *filter; |
---|
47 | char *attr[2]; |
---|
48 | int attrsonly; |
---|
49 | struct timeval timeout; |
---|
50 | LDAPMessage *res; |
---|
51 | }; |
---|
52 | |
---|
53 | typedef struct ldap_map_struct LDAP_MAP_STRUCT; |
---|
54 | |
---|
55 | #define DEFAULT_LDAP_MAP_PORT LDAP_PORT |
---|
56 | #define DEFAULT_LDAP_MAP_SCOPE LDAP_SCOPE_SUBTREE |
---|
57 | #define DEFAULT_LDAP_MAP_BINDDN NULL |
---|
58 | #define DEFAULT_LDAP_MAP_PASSWD NULL |
---|
59 | #define DEFAULT_LDAP_MAP_METHOD LDAP_AUTH_SIMPLE |
---|
60 | #define DEFAULT_LDAP_MAP_TIMELIMIT 5 |
---|
61 | #define DEFAULT_LDAP_MAP_DEREF LDAP_DEREF_NEVER |
---|
62 | #define DEFAULT_LDAP_MAP_SIZELIMIT 0 |
---|
63 | #define DEFAULT_LDAP_MAP_ATTRSONLY 0 |
---|
64 | #define LDAP_MAP_MAX_FILTER 1024 |
---|
65 | #ifdef LDAP_REFERRALS |
---|
66 | # define DEFAULT_LDAP_MAP_LDAP_OPTIONS LDAP_OPT_REFERRALS |
---|
67 | #else /* LDAP_REFERRALS */ |
---|
68 | # define DEFAULT_LDAP_MAP_LDAP_OPTIONS 0 |
---|
69 | #endif /* LDAP_REFERRALS */ |
---|
70 | |
---|
71 | /* |
---|
72 | ** ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1. |
---|
73 | ** Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations |
---|
74 | ** and assume (falsely) that all old API implementations are broken. |
---|
75 | ** (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT) |
---|
76 | */ |
---|
77 | |
---|
78 | #if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT) |
---|
79 | # define USE_LDAP_INIT 1 |
---|
80 | #endif |
---|
81 | |
---|
82 | /* |
---|
83 | ** LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x, |
---|
84 | ** hence ldap_set_option() must not exist. |
---|
85 | */ |
---|
86 | |
---|
87 | #if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION) |
---|
88 | # define USE_LDAP_SET_OPTION 1 |
---|
89 | #endif |
---|
90 | |
---|
91 | #endif /* _LDAP_MAP_H */ |
---|