]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldap/back-ldap.h
01a466a5be484d5fd6356ad43ab559b1e6ee1437
[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-2004 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 #include "proto-ldap.h"
28
29 #ifdef LDAP_DEVEL
30 #define LDAP_BACK_PROXY_AUTHZ
31 #endif
32
33 LDAP_BEGIN_DECL
34
35 struct slap_conn;
36 struct slap_op;
37 struct slap_backend_db;
38
39 struct ldapconn {
40         struct slap_conn        *lc_conn;
41         LDAP                    *lc_ld;
42         struct berval           lc_cred;
43         struct berval           lc_bound_ndn;
44         struct berval           lc_local_ndn;
45         int                     lc_bound;
46         ldap_pvt_thread_mutex_t lc_mutex;
47 };
48
49 struct ldapauth {
50         struct berval   la_authcID;
51         struct berval   la_authcDN;
52         struct berval   la_passwd;
53
54         struct berval   la_authzID;
55         
56         int             la_authmethod;
57         int             la_sasl_flags;
58         struct berval   la_sasl_mech;
59         struct berval   la_sasl_realm;
60         
61 #define LDAP_BACK_AUTH_NONE             0x00U
62 #define LDAP_BACK_AUTH_NATIVE_AUTHZ     0x01U
63 #define LDAP_BACK_AUTH_OVERRIDE         0x02U
64         unsigned        la_flags;
65 };
66
67 struct ldapinfo {
68         char            *url;
69         LDAPURLDesc     *lud;
70         struct ldapauth acl_la;
71 #define acl_authcDN     acl_la.la_authcDN
72 #define acl_passwd      acl_la.la_passwd
73
74 #ifdef LDAP_BACK_PROXY_AUTHZ
75         /* ID assert stuff */
76         int             idassert_mode;
77 #define LDAP_BACK_IDASSERT_LEGACY       0
78 #define LDAP_BACK_IDASSERT_NOASSERT     1
79 #define LDAP_BACK_IDASSERT_ANONYMOUS    2
80 #define LDAP_BACK_IDASSERT_SELF         3
81 #define LDAP_BACK_IDASSERT_OTHERDN      4
82 #define LDAP_BACK_IDASSERT_OTHERID      5
83
84         struct ldapauth idassert_la;
85 #define idassert_authcID        idassert_la.la_authcID
86 #define idassert_authcDN        idassert_la.la_authcDN
87 #define idassert_passwd         idassert_la.la_passwd
88 #define idassert_authzID        idassert_la.la_authzID
89 #define idassert_authmethod     idassert_la.la_authmethod
90 #define idassert_sasl_flags     idassert_la.la_sasl_flags
91 #define idassert_sasl_mech      idassert_la.la_sasl_mech
92 #define idassert_sasl_realm     idassert_la.la_sasl_realm
93 #define idassert_flags          idassert_la.la_flags
94         BerVarray       idassert_authz;
95         
96         int             idassert_ppolicy;
97         /* end of ID assert stuff */
98 #endif /* LDAP_BACK_PROXY_AUTHZ */
99
100         ldap_pvt_thread_mutex_t         conn_mutex;
101         int             savecred;
102         Avlnode         *conntree;
103
104         int             rwm_started;
105 };
106
107 int ldap_back_freeconn( Operation *op, struct ldapconn *lc );
108 struct ldapconn *ldap_back_getconn(struct slap_op *op, struct slap_rep *rs);
109 int ldap_back_dobind(struct ldapconn *lc, Operation *op, SlapReply *rs);
110 int ldap_back_retry(struct ldapconn *lc, Operation *op, SlapReply *rs);
111 int ldap_back_map_result(SlapReply *rs);
112 int ldap_back_op_result(struct ldapconn *lc, Operation *op, SlapReply *rs,
113         ber_int_t msgid, int sendok);
114 int     back_ldap_LTX_init_module(int argc, char *argv[]);
115
116 extern int ldap_back_conn_cmp( const void *c1, const void *c2);
117 extern int ldap_back_conn_dup( void *c1, void *c2 );
118 extern void ldap_back_conn_free( void *c );
119
120 #ifdef LDAP_BACK_PROXY_AUTHZ
121 extern int
122 ldap_back_proxy_authz_ctrl(
123                 struct ldapconn *lc,
124                 Operation       *op,
125                 SlapReply       *rs,
126                 LDAPControl     ***pctrls );
127
128 extern int
129 ldap_back_proxy_authz_ctrl_free(
130                 Operation       *op,
131                 LDAPControl     ***pctrls );
132 #endif /* LDAP_BACK_PROXY_AUTHZ */
133
134 LDAP_END_DECL
135
136 #endif /* SLAPD_LDAP_H */