1/* 2 * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * 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. 8 *
| 1/* 2 * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * 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. 8 *
|
9 * $Id: ldap.h,v 1.9 2002/01/11 22:06:50 gshapiro Exp $
| 9 * $Id: ldap.h,v 1.22 2002/03/05 02:17:26 ca Exp $
|
10 */ 11 12#ifndef SM_LDAP_H 13# define SM_LDAP_H 14 15# include <sm/conf.h> 16# include <sm/rpool.h> 17
| 10 */ 11 12#ifndef SM_LDAP_H 13# define SM_LDAP_H 14 15# include <sm/conf.h> 16# include <sm/rpool.h> 17
|
| 18/* 19** NOTE: These should be changed from LDAPMAP_* to SM_LDAP_* 20** in the next major release (8.13) of sendmail. 21*/ 22
|
18# ifndef LDAPMAP_MAX_ATTR 19# define LDAPMAP_MAX_ATTR 64 20# endif /* ! LDAPMAP_MAX_ATTR */ 21# ifndef LDAPMAP_MAX_FILTER 22# define LDAPMAP_MAX_FILTER 1024 23# endif /* ! LDAPMAP_MAX_FILTER */ 24# ifndef LDAPMAP_MAX_PASSWD 25# define LDAPMAP_MAX_PASSWD 256 26# endif /* ! LDAPMAP_MAX_PASSWD */ 27 28# if LDAPMAP 29 30# if _FFR_LDAP_RECURSION 31 32/* Attribute types */
| 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 */ 32 33# if LDAPMAP 34 35# if _FFR_LDAP_RECURSION 36 37/* Attribute types */
|
33# define LDAPMAP_ATTR_NORMAL 0 34# define LDAPMAP_ATTR_DN 1 35# define LDAPMAP_ATTR_FILTER 2 36# define LDAPMAP_ATTR_URL 3 37# define LDAPMAP_ATTR_FINAL 4
| 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
|
38 39/* sm_ldap_results() flags */ 40# define SM_LDAP_SINGLEMATCH 0x0001 41# define SM_LDAP_MATCHONLY 0x0002
| 44 45/* sm_ldap_results() flags */ 46# define SM_LDAP_SINGLEMATCH 0x0001 47# define SM_LDAP_MATCHONLY 0x0002
|
| 48# define SM_LDAP_USE_ALLATTR 0x0004 49
|
42# endif /* _FFR_LDAP_RECURSION */ 43 44struct sm_ldap_struct 45{ 46 /* needed for ldap_open or ldap_init */
| 50# endif /* _FFR_LDAP_RECURSION */ 51 52struct sm_ldap_struct 53{ 54 /* needed for ldap_open or ldap_init */
|
47 char *ldap_host;
| 55 char *ldap_target;
|
48 int ldap_port;
| 56 int ldap_port;
|
| 57# if _FFR_LDAP_URI 58 bool ldap_uri; 59# endif /* _FFR_LDAP_URI */ 60# if _FFR_LDAP_SETVERSION 61 int ldap_version; 62# endif /* _FFR_LDAP_SETVERSION */
|
49 pid_t ldap_pid; 50 51 /* options set in ld struct before ldap_bind_s */ 52 int ldap_deref; 53 time_t ldap_timelimit; 54 int ldap_sizelimit; 55 int ldap_options; 56 57 /* args for ldap_bind_s */ 58 LDAP *ldap_ld; 59 char *ldap_binddn; 60 char *ldap_secret; 61 int ldap_method; 62 63 /* args for ldap_search */ 64 char *ldap_base; 65 int ldap_scope; 66 char *ldap_filter; 67 char *ldap_attr[LDAPMAP_MAX_ATTR + 1]; 68# if _FFR_LDAP_RECURSION 69 int ldap_attr_type[LDAPMAP_MAX_ATTR + 1];
| 63 pid_t ldap_pid; 64 65 /* options set in ld struct before ldap_bind_s */ 66 int ldap_deref; 67 time_t ldap_timelimit; 68 int ldap_sizelimit; 69 int ldap_options; 70 71 /* args for ldap_bind_s */ 72 LDAP *ldap_ld; 73 char *ldap_binddn; 74 char *ldap_secret; 75 int ldap_method; 76 77 /* args for ldap_search */ 78 char *ldap_base; 79 int ldap_scope; 80 char *ldap_filter; 81 char *ldap_attr[LDAPMAP_MAX_ATTR + 1]; 82# if _FFR_LDAP_RECURSION 83 int ldap_attr_type[LDAPMAP_MAX_ATTR + 1];
|
70 char *ldap_attr_final[LDAPMAP_MAX_ATTR + 1];
| 84 char *ldap_attr_needobjclass[LDAPMAP_MAX_ATTR + 1];
|
71# endif /* _FFR_LDAP_RECURSION */ 72 bool ldap_attrsonly; 73 74 /* args for ldap_result */ 75 struct timeval ldap_timeout; 76 LDAPMessage *ldap_res; 77 78 /* ldapmap_lookup options */ 79 char ldap_attrsep; 80 81 /* Linked list of maps sharing the same LDAP binding */ 82 void *ldap_next; 83}; 84 85typedef struct sm_ldap_struct SM_LDAP_STRUCT; 86 87# if _FFR_LDAP_RECURSION
| 85# endif /* _FFR_LDAP_RECURSION */ 86 bool ldap_attrsonly; 87 88 /* args for ldap_result */ 89 struct timeval ldap_timeout; 90 LDAPMessage *ldap_res; 91 92 /* ldapmap_lookup options */ 93 char ldap_attrsep; 94 95 /* Linked list of maps sharing the same LDAP binding */ 96 void *ldap_next; 97}; 98 99typedef struct sm_ldap_struct SM_LDAP_STRUCT; 100 101# if _FFR_LDAP_RECURSION
|
88struct sm_ldap_recurse_list
| 102struct sm_ldap_recurse_entry
|
89{ 90 char *lr_search; 91 int lr_type;
| 103{ 104 char *lr_search; 105 int lr_type;
|
92 struct sm_ldap_recurse_list *lr_next;
| 106 bool lr_done;
|
93}; 94
| 107}; 108
|
| 109struct sm_ldap_recurse_list 110{ 111 int lr_size; 112 int lr_cnt; 113 struct sm_ldap_recurse_entry **lr_data; 114}; 115 116typedef struct sm_ldap_recurse_entry SM_LDAP_RECURSE_ENTRY;
|
95typedef struct sm_ldap_recurse_list SM_LDAP_RECURSE_LIST; 96# endif /* _FFR_LDAP_RECURSION */ 97 98/* functions */ 99extern void sm_ldap_clear __P((SM_LDAP_STRUCT *)); 100extern bool sm_ldap_start __P((char *, SM_LDAP_STRUCT *)); 101extern int sm_ldap_search __P((SM_LDAP_STRUCT *, char *)); 102# if _FFR_LDAP_RECURSION
| 117typedef struct sm_ldap_recurse_list SM_LDAP_RECURSE_LIST; 118# endif /* _FFR_LDAP_RECURSION */ 119 120/* functions */ 121extern void sm_ldap_clear __P((SM_LDAP_STRUCT *)); 122extern bool sm_ldap_start __P((char *, SM_LDAP_STRUCT *)); 123extern int sm_ldap_search __P((SM_LDAP_STRUCT *, char *)); 124# if _FFR_LDAP_RECURSION
|
103extern int sm_ldap_results __P((SM_LDAP_STRUCT *, int, int, char, 104 SM_RPOOL_T *, char **,
| 125extern int sm_ldap_results __P((SM_LDAP_STRUCT *, int, int, int, 126 SM_RPOOL_T *, char **, int *, int *,
|
105 SM_LDAP_RECURSE_LIST *)); 106# endif /* _FFR_LDAP_RECURSION */ 107extern void sm_ldap_setopts __P((LDAP *, SM_LDAP_STRUCT *)); 108extern int sm_ldap_geterrno __P((LDAP *)); 109extern void sm_ldap_close __P((SM_LDAP_STRUCT *));
| 127 SM_LDAP_RECURSE_LIST *)); 128# endif /* _FFR_LDAP_RECURSION */ 129extern void sm_ldap_setopts __P((LDAP *, SM_LDAP_STRUCT *)); 130extern int sm_ldap_geterrno __P((LDAP *)); 131extern void sm_ldap_close __P((SM_LDAP_STRUCT *));
|
110# endif /* LDAPMAP */
| |
111
| 132
|
| 133/* Portability defines */ 134# if !SM_CONF_LDAP_MEMFREE 135# define ldap_memfree(x) ((void) 0) 136# endif /* !SM_CONF_LDAP_MEMFREE */ 137 138# endif /* LDAPMAP */
|
112#endif /* ! SM_LDAP_H */
| 139#endif /* ! SM_LDAP_H */
|