1 /* pbind.c - passthru Bind overlay */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2003-2010 The OpenLDAP Foundation.
6 * Portions Copyright 2003-2010 Howard Chu.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
13 * A copy of this license is available in the file LICENSE in the
14 * top-level directory of the distribution or, alternatively, at
15 * <http://www.OpenLDAP.org/license.html>.
18 * This work was initially developed by the Howard Chu for inclusion
19 * in OpenLDAP Software.
26 #include <ac/string.h>
27 #include <ac/socket.h>
31 #include "back-ldap.h"
34 static BackendInfo *lback;
36 static slap_overinst ldappbind;
43 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
44 void *private = op->o_bd->be_private;
45 void *bi = op->o_bd->bd_info;
48 op->o_bd->bd_info = lback;
49 op->o_bd->be_private = on->on_bi.bi_private;
50 rc = lback->bi_op_bind( op, rs );
51 op->o_bd->be_private = private;
52 op->o_bd->bd_info = bi;
62 slap_overinst *on = (slap_overinst *)be->bd_info;
63 ConfigOCs *be_cf_ocs = be->be_cf_ocs;
64 void *private = be->be_private;
67 if ( lback == NULL ) {
68 lback = backend_info( "ldap" );
70 if ( lback == NULL ) {
75 rc = lback->bi_db_init( be, cr );
76 on->on_bi.bi_private = be->be_private;
77 be->be_cf_ocs = be_cf_ocs;
78 be->be_private = private;
88 slap_overinst *on = (slap_overinst *) be->bd_info;
89 void *private = be->be_private;
93 be->be_private = on->on_bi.bi_private;
94 monitoring = ( SLAP_DBFLAGS( be ) & SLAP_DBFLAG_MONITORING );
95 SLAP_DBFLAGS( be ) &= ~SLAP_DBFLAG_MONITORING;
96 rc = lback->bi_db_open( be, cr );
97 SLAP_DBFLAGS( be ) |= monitoring;
98 be->be_private = private;
108 slap_overinst *on = (slap_overinst *) be->bd_info;
109 void *private = be->be_private;
112 be->be_private = on->on_bi.bi_private;
113 rc = lback->bi_db_close( be, cr );
114 be->be_private = private;
120 ldap_pbind_db_destroy(
124 slap_overinst *on = (slap_overinst *) be->bd_info;
125 void *private = be->be_private;
128 be->be_private = on->on_bi.bi_private;
129 rc = lback->bi_db_close( be, cr );
130 on->on_bi.bi_private = be->be_private;
131 be->be_private = private;
137 ldap_pbind_connection_destroy(
142 slap_overinst *on = (slap_overinst *) be->bd_info;
143 void *private = be->be_private;
146 be->be_private = on->on_bi.bi_private;
147 rc = lback->bi_connection_destroy( be, conn );
148 be->be_private = private;
154 pbind_initialize( void )
158 ldappbind.on_bi.bi_type = "pbind";
159 ldappbind.on_bi.bi_db_init = ldap_pbind_db_init;
160 ldappbind.on_bi.bi_db_open = ldap_pbind_db_open;
161 ldappbind.on_bi.bi_db_close = ldap_pbind_db_close;
162 ldappbind.on_bi.bi_db_destroy = ldap_pbind_db_destroy;
164 ldappbind.on_bi.bi_op_bind = ldap_pbind_bind;
165 ldappbind.on_bi.bi_connection_destroy = ldap_pbind_connection_destroy;
167 rc = ldap_pbind_init_cf( &ldappbind.on_bi );
172 return overlay_register( &ldappbind );