]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldap/back-ldap.h
7a62b1dff2858fdd3f7b4c38bd52df8634914fbc
[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         unsigned                lc_refcnt;
42 };
43
44 /*
45  * identity assertion modes
46  */
47 enum {
48         LDAP_BACK_IDASSERT_LEGACY = 1,
49         LDAP_BACK_IDASSERT_NOASSERT,
50         LDAP_BACK_IDASSERT_ANONYMOUS,
51         LDAP_BACK_IDASSERT_SELF,
52         LDAP_BACK_IDASSERT_OTHERDN,
53         LDAP_BACK_IDASSERT_OTHERID
54 };
55
56 struct ldapinfo {
57         char            *url;
58         LDAPURLDesc     *lud;
59
60         slap_bindconf   acl_sb;
61 #define acl_authcID     acl_sb.sb_authcId
62 #define acl_authcDN     acl_sb.sb_binddn
63 #define acl_passwd      acl_sb.sb_cred
64 #define acl_authzID     acl_sb.sb_authzId
65 #define acl_authmethod  acl_sb.sb_method
66 #define acl_sasl_mech   acl_sb.sb_saslmech
67 #define acl_sasl_realm  acl_sb.sb_realm
68 #define acl_secprops    acl_sb.sb_secprops
69
70         /* ID assert stuff */
71         int             idassert_mode;
72
73         slap_bindconf   idassert_sb;
74 #define idassert_authcID        idassert_sb.sb_authcId
75 #define idassert_authcDN        idassert_sb.sb_binddn
76 #define idassert_passwd         idassert_sb.sb_cred
77 #define idassert_authzID        idassert_sb.sb_authzId
78 #define idassert_authmethod     idassert_sb.sb_method
79 #define idassert_sasl_mech      idassert_sb.sb_saslmech
80 #define idassert_sasl_realm     idassert_sb.sb_realm
81 #define idassert_secprops       idassert_sb.sb_secprops
82
83         unsigned        idassert_flags;
84 #define LDAP_BACK_AUTH_NONE             0x00U
85 #define LDAP_BACK_AUTH_NATIVE_AUTHZ     0x01U
86 #define LDAP_BACK_AUTH_OVERRIDE         0x02U
87 #define LDAP_BACK_AUTH_PRESCRIPTIVE     0x04U
88
89         BerVarray       idassert_authz;
90         /* end of ID assert stuff */
91
92         ldap_pvt_thread_mutex_t         conn_mutex;
93         unsigned        flags;
94 #define LDAP_BACK_F_NONE                0x00U
95 #define LDAP_BACK_F_SAVECRED            0x01U
96 #define LDAP_BACK_F_USE_TLS             0x02U
97 #define LDAP_BACK_F_PROPAGATE_TLS       0x04U
98 #define LDAP_BACK_F_TLS_CRITICAL        0x08U
99 #define LDAP_BACK_F_TLS_USE_MASK        (LDAP_BACK_F_USE_TLS|LDAP_BACK_F_TLS_CRITICAL)
100 #define LDAP_BACK_F_TLS_PROPAGATE_MASK  (LDAP_BACK_F_PROPAGATE_TLS|LDAP_BACK_F_TLS_CRITICAL)
101 #define LDAP_BACK_F_TLS_MASK            (LDAP_BACK_F_TLS_USE_MASK|LDAP_BACK_F_TLS_PROPAGATE_MASK)
102 #define LDAP_BACK_F_CHASE_REFERRALS     0x10U
103 #define LDAP_BACK_F_PROXY_WHOAMI        0x20U
104
105 #define LDAP_BACK_F_SUPPORT_T_F                 0x80U
106 #define LDAP_BACK_F_SUPPORT_T_F_DISCOVER        0x40U
107 #define LDAP_BACK_F_SUPPORT_T_F_MASK            (LDAP_BACK_F_SUPPORT_T_F|LDAP_BACK_F_SUPPORT_T_F_DISCOVER)
108
109 #define LDAP_BACK_SAVECRED(li)          ( (li)->flags & LDAP_BACK_F_SAVECRED )
110 #define LDAP_BACK_USE_TLS(li)           ( (li)->flags & LDAP_BACK_F_USE_TLS )
111 #define LDAP_BACK_PROPAGATE_TLS(li)     ( (li)->flags & LDAP_BACK_F_PROPAGATE_TLS )
112 #define LDAP_BACK_TLS_CRITICAL(li)      ( (li)->flags & LDAP_BACK_F_TLS_CRITICAL )
113 #define LDAP_BACK_CHASE_REFERRALS(li)   ( (li)->flags & LDAP_BACK_F_CHASE_REFERRALS )
114
115         int             version;
116
117         Avlnode         *conntree;
118
119         int             rwm_started;
120 };
121
122 typedef enum ldap_back_send_t {
123         LDAP_BACK_DONTSEND              = 0x00,
124         LDAP_BACK_SENDOK                = 0x01,
125         LDAP_BACK_SENDERR               = 0x02,
126         LDAP_BACK_SENDRESULT            = (LDAP_BACK_SENDOK|LDAP_BACK_SENDERR)
127 } ldap_back_send_t;
128
129 /* define to use asynchronous StartTLS */
130 #define SLAP_STARTTLS_ASYNCHRONOUS
131
132 LDAP_END_DECL
133
134 #include "proto-ldap.h"
135
136 #endif /* SLAPD_LDAP_H */