]> git.sur5r.net Git - openldap/blob - servers/slapd/back-perl/bind.c
Added bdb_attribute and bdb_group ACL support routines
[openldap] / servers / slapd / back-perl / bind.c
1 /* $OpenLDAP$ */
2 /*
3  *       Copyright 1999, John C. Quillan, All rights reserved.
4  *
5  *       Redistribution and use in source and binary forms are permitted only
6  *       as authorized by the OpenLDAP Public License.  A copy of this
7  *       license is available at http://www.OpenLDAP.org/license.html or
8  *       in file LICENSE in the top-level directory of the distribution.
9  */
10
11 #include "portable.h"
12 /* init.c - initialize shell backend */
13         
14 #include <stdio.h>
15 /*      #include <ac/types.h>
16         #include <ac/socket.h>
17 */
18
19 #include <EXTERN.h>
20 #include <perl.h>
21
22 #include "slap.h"
23 #include "perl_back.h"
24
25
26 /**********************************************************
27  *
28  * Bind
29  *
30  **********************************************************/
31 int
32 perl_back_bind(
33         Backend *be,
34         Connection *conn,
35         Operation *op,
36         const char *dn,
37         const char *ndn,
38         int method,
39         struct berval *cred,
40         char** edn
41 )
42 {
43         int return_code;
44         int count;
45
46         PerlBackend *perl_back = (PerlBackend *) be->be_private;
47
48         *edn = NULL;
49
50         ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );  
51
52         {
53                 dSP; ENTER; SAVETMPS;
54
55                 PUSHMARK(sp);
56                 XPUSHs( perl_back->pb_obj_ref );
57                 XPUSHs(sv_2mortal(newSVpv( dn , 0)));
58                 XPUSHs(sv_2mortal(newSVpv( cred->bv_val , cred->bv_len)));
59                 PUTBACK;
60
61                 count = perl_call_method("bind", G_SCALAR);
62
63                 SPAGAIN;
64
65                 if (count != 1) {
66                         croak("Big trouble in back_search\n");
67                 }
68
69                 return_code = POPi;
70                                                          
71
72                 PUTBACK; FREETMPS; LEAVE;
73         }
74
75         ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );        
76
77         Debug( LDAP_DEBUG_ANY, "Perl BIND\n", 0, 0, 0 );
78
79         return ( return_code );
80 }
81
82