]> git.sur5r.net Git - openldap/blob - servers/slapd/back-perl/bind.c
Per ITS#419, don't require SLAPD_RLOOKUPS when HAVE_TCPD
[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         char *dn,
37         char *ndn,
38         int method,
39         char            *mech,
40         struct berval *cred,
41         char** edn
42 )
43 {
44         int return_code;
45         int count;
46
47         PerlBackend *perl_back = (PerlBackend *) be->be_private;
48
49         *edn = NULL;
50
51         ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );  
52
53         {
54                 dSP; ENTER; SAVETMPS;
55
56                 PUSHMARK(sp);
57                 XPUSHs( perl_back->pb_obj_ref );
58                 XPUSHs(sv_2mortal(newSVpv( dn , 0)));
59                 XPUSHs(sv_2mortal(newSVpv( cred->bv_val , cred->bv_len)));
60                 PUTBACK;
61
62                 count = perl_call_method("bind", G_SCALAR);
63
64                 SPAGAIN;
65
66                 if (count != 1) {
67                         croak("Big trouble in back_search\n");
68                 }
69
70                 return_code = POPi;
71                                                          
72
73                 PUTBACK; FREETMPS; LEAVE;
74         }
75
76         ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );        
77
78         Debug( LDAP_DEBUG_ANY, "Perl BIND\n", 0, 0, 0 );
79
80         return ( return_code );
81 }
82
83