2 * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
9 * $Id: ldap.h,v 1.22 2002/03/05 02:17:26 ca Exp $
16 # include <sm/rpool.h>
19 ** NOTE: These should be changed from LDAPMAP_* to SM_LDAP_*
20 ** in the next major release (8.13) of sendmail.
23 # ifndef LDAPMAP_MAX_ATTR
24 # define LDAPMAP_MAX_ATTR 64
25 # endif /* ! LDAPMAP_MAX_ATTR */
26 # ifndef LDAPMAP_MAX_FILTER
27 # define LDAPMAP_MAX_FILTER 1024
28 # endif /* ! LDAPMAP_MAX_FILTER */
29 # ifndef LDAPMAP_MAX_PASSWD
30 # define LDAPMAP_MAX_PASSWD 256
31 # endif /* ! LDAPMAP_MAX_PASSWD */
35 # if _FFR_LDAP_RECURSION
38 # define SM_LDAP_ATTR_NONE (-1)
39 # define SM_LDAP_ATTR_OBJCLASS 0
40 # define SM_LDAP_ATTR_NORMAL 1
41 # define SM_LDAP_ATTR_DN 2
42 # define SM_LDAP_ATTR_FILTER 3
43 # define SM_LDAP_ATTR_URL 4
45 /* sm_ldap_results() flags */
46 # define SM_LDAP_SINGLEMATCH 0x0001
47 # define SM_LDAP_MATCHONLY 0x0002
48 # define SM_LDAP_USE_ALLATTR 0x0004
50 # endif /* _FFR_LDAP_RECURSION */
54 /* needed for ldap_open or ldap_init */
59 # endif /* _FFR_LDAP_URI */
60 # if _FFR_LDAP_SETVERSION
62 # endif /* _FFR_LDAP_SETVERSION */
65 /* options set in ld struct before ldap_bind_s */
67 time_t ldap_timelimit;
71 /* args for ldap_bind_s */
77 /* args for ldap_search */
81 char *ldap_attr[LDAPMAP_MAX_ATTR + 1];
82 # if _FFR_LDAP_RECURSION
83 int ldap_attr_type[LDAPMAP_MAX_ATTR + 1];
84 char *ldap_attr_needobjclass[LDAPMAP_MAX_ATTR + 1];
85 # endif /* _FFR_LDAP_RECURSION */
88 /* args for ldap_result */
89 struct timeval ldap_timeout;
90 LDAPMessage *ldap_res;
92 /* ldapmap_lookup options */
95 /* Linked list of maps sharing the same LDAP binding */
99 typedef struct sm_ldap_struct SM_LDAP_STRUCT;
101 # if _FFR_LDAP_RECURSION
102 struct sm_ldap_recurse_entry
109 struct sm_ldap_recurse_list
113 struct sm_ldap_recurse_entry **lr_data;
116 typedef struct sm_ldap_recurse_entry SM_LDAP_RECURSE_ENTRY;
117 typedef struct sm_ldap_recurse_list SM_LDAP_RECURSE_LIST;
118 # endif /* _FFR_LDAP_RECURSION */
121 extern void sm_ldap_clear __P((SM_LDAP_STRUCT *));
122 extern bool sm_ldap_start __P((char *, SM_LDAP_STRUCT *));
123 extern int sm_ldap_search __P((SM_LDAP_STRUCT *, char *));
124 # if _FFR_LDAP_RECURSION
125 extern int sm_ldap_results __P((SM_LDAP_STRUCT *, int, int, int,
126 SM_RPOOL_T *, char **, int *, int *,
127 SM_LDAP_RECURSE_LIST *));
128 # endif /* _FFR_LDAP_RECURSION */
129 extern void sm_ldap_setopts __P((LDAP *, SM_LDAP_STRUCT *));
130 extern int sm_ldap_geterrno __P((LDAP *));
131 extern void sm_ldap_close __P((SM_LDAP_STRUCT *));
133 /* Portability defines */
134 # if !SM_CONF_LDAP_MEMFREE
135 # define ldap_memfree(x) ((void) 0)
136 # endif /* !SM_CONF_LDAP_MEMFREE */
138 # endif /* LDAPMAP */
139 #endif /* ! SM_LDAP_H */