]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldap/back-ldap.h
d33ea3c1830f28e2bfbb14e443babba5cfb3843f
[openldap] / servers / slapd / back-ldap / back-ldap.h
1 /* back-ldap.h - ldap backend header file */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 1999-2005 The OpenLDAP Foundation.
6  * Portions Copyright 2000-2003 Pierangelo Masarati.
7  * Portions Copyright 1999-2003 Howard Chu.
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted only as authorized by the OpenLDAP
12  * Public License.
13  *
14  * A copy of this license is available in the file LICENSE in the
15  * top-level directory of the distribution or, alternatively, at
16  * <http://www.OpenLDAP.org/license.html>.
17  */
18 /* ACKNOWLEDGEMENTS:
19  * This work was initially developed by the Howard Chu for inclusion
20  * in OpenLDAP Software and subsequently enhanced by Pierangelo
21  * Masarati.
22  */
23
24 #ifndef SLAPD_LDAP_H
25 #define SLAPD_LDAP_H
26
27 LDAP_BEGIN_DECL
28
29 struct slap_conn;
30 struct slap_op;
31 struct slap_backend_db;
32
33 struct ldapconn {
34         struct slap_conn        *lc_conn;
35         LDAP                    *lc_ld;
36         struct berval           lc_cred;
37         struct berval           lc_bound_ndn;
38         struct berval           lc_local_ndn;
39         int                     lc_bound;
40         int                     lc_ispriv;
41         ldap_pvt_thread_mutex_t lc_mutex;
42         unsigned                lc_refcnt;
43 };
44
45 /*
46  * identity assertion modes
47  */
48 enum {
49         LDAP_BACK_IDASSERT_LEGACY = 1,
50         LDAP_BACK_IDASSERT_NOASSERT,
51         LDAP_BACK_IDASSERT_ANONYMOUS,
52         LDAP_BACK_IDASSERT_SELF,
53         LDAP_BACK_IDASSERT_OTHERDN,
54         LDAP_BACK_IDASSERT_OTHERID
55 };
56
57 struct ldapinfo {
58         char            *url;
59         LDAPURLDesc     *lud;
60
61         slap_bindconf   acl_sb;
62 #define acl_authcID     acl_sb.sb_authcId
63 #define acl_authcDN     acl_sb.sb_binddn
64 #define acl_passwd      acl_sb.sb_cred
65 #define acl_authzID     acl_sb.sb_authzId
66 #define acl_authmethod  acl_sb.sb_method
67 #define acl_sasl_mech   acl_sb.sb_saslmech
68 #define acl_sasl_realm  acl_sb.sb_realm
69 #define acl_secprops    acl_sb.sb_secprops
70
71         /* ID assert stuff */
72         int             idassert_mode;
73
74         slap_bindconf   idassert_sb;
75 #define idassert_authcID        idassert_sb.sb_authcId
76 #define idassert_authcDN        idassert_sb.sb_binddn
77 #define idassert_passwd         idassert_sb.sb_cred
78 #define idassert_authzID        idassert_sb.sb_authzId
79 #define idassert_authmethod     idassert_sb.sb_method
80 #define idassert_sasl_mech      idassert_sb.sb_saslmech
81 #define idassert_sasl_realm     idassert_sb.sb_realm
82 #define idassert_secprops       idassert_sb.sb_secprops
83
84         unsigned        idassert_flags;
85 #define LDAP_BACK_AUTH_NONE             0x00U
86 #define LDAP_BACK_AUTH_NATIVE_AUTHZ     0x01U
87 #define LDAP_BACK_AUTH_OVERRIDE         0x02U
88 #define LDAP_BACK_AUTH_PRESCRIPTIVE     0x04U
89
90         BerVarray       idassert_authz;
91         /* end of ID assert stuff */
92
93         ldap_pvt_thread_mutex_t         conn_mutex;
94         unsigned        flags;
95 #define LDAP_BACK_F_NONE                0x00U
96 #define LDAP_BACK_F_SAVECRED            0x01U
97 #define LDAP_BACK_F_USE_TLS             0x02U
98 #define LDAP_BACK_F_PROPAGATE_TLS       0x04U
99 #define LDAP_BACK_F_TLS_CRITICAL        0x08U
100 #define LDAP_BACK_F_TLS_USE_MASK        (LDAP_BACK_F_USE_TLS|LDAP_BACK_F_TLS_CRITICAL)
101 #define LDAP_BACK_F_TLS_PROPAGATE_MASK  (LDAP_BACK_F_PROPAGATE_TLS|LDAP_BACK_F_TLS_CRITICAL)
102 #define LDAP_BACK_F_TLS_MASK            (LDAP_BACK_F_TLS_USE_MASK|LDAP_BACK_F_TLS_PROPAGATE_MASK)
103 #define LDAP_BACK_F_CHASE_REFERRALS     0x10U
104 #define LDAP_BACK_F_PROXY_WHOAMI        0x20U
105
106 #define LDAP_BACK_F_SUPPORT_T_F                 0x80U
107 #define LDAP_BACK_F_SUPPORT_T_F_DISCOVER        0x40U
108 #define LDAP_BACK_F_SUPPORT_T_F_MASK            (LDAP_BACK_F_SUPPORT_T_F|LDAP_BACK_F_SUPPORT_T_F_DISCOVER)
109
110 #define LDAP_BACK_SAVECRED(li)          ( (li)->flags & LDAP_BACK_F_SAVECRED )
111 #define LDAP_BACK_USE_TLS(li)           ( (li)->flags & LDAP_BACK_F_USE_TLS )
112 #define LDAP_BACK_PROPAGATE_TLS(li)     ( (li)->flags & LDAP_BACK_F_PROPAGATE_TLS )
113 #define LDAP_BACK_TLS_CRITICAL(li)      ( (li)->flags & LDAP_BACK_F_TLS_CRITICAL )
114 #define LDAP_BACK_CHASE_REFERRALS(li)   ( (li)->flags & LDAP_BACK_F_CHASE_REFERRALS )
115
116         int             version;
117
118         Avlnode         *conntree;
119
120         int             rwm_started;
121 };
122
123 typedef enum ldap_back_send_t {
124         LDAP_BACK_DONTSEND              = 0x00,
125         LDAP_BACK_SENDOK                = 0x01,
126         LDAP_BACK_SENDERR               = 0x02,
127         LDAP_BACK_SENDRESULT            = (LDAP_BACK_SENDOK|LDAP_BACK_SENDERR)
128 } ldap_back_send_t;
129
130 /* define to use asynchronous StartTLS */
131 #define SLAP_STARTTLS_ASYNCHRONOUS
132
133 LDAP_END_DECL
134
135 #include "proto-ldap.h"
136
137 #endif /* SLAPD_LDAP_H */