2 * Copyright 1999, John C. Quillan, All rights reserved.
4 * Redistribution and use in source and binary forms are permitted only
5 * as authorized by the OpenLDAP Public License. A copy of this
6 * license is available at http://www.OpenLDAP.org/license.html or
7 * in file LICENSE in the top-level directory of the distribution.
11 /* init.c - initialize shell backend */
14 /* #include <ac/types.h>
15 #include <ac/socket.h>
22 #include "perl_back.h"
25 /**********************************************************
29 **********************************************************/
40 PerlBackend *perl_back = (PerlBackend *) be->be_private;
41 char eval_str[EVAL_BUF_SIZE];
44 /***** SECURITY PROBLEM HERE FIX LATER *****/
46 if ( strcasecmp( argv[0], "perlModule" ) == 0 ) {
48 Debug( LDAP_DEBUG_ANY,
49 "%s.pm: line %d: missing module in \"perlModule <module>\" line\n",
54 strncpy(eval_str, argv[1], EVAL_BUF_SIZE );
56 perl_require_pv( strcat( eval_str, ".pm" ));
58 if (SvTRUE(GvSV(errgv))) {
59 fprintf(stderr , "Error %s\n", SvPV(GvSV(errgv), na)) ;
64 XPUSHs(sv_2mortal(newSVpv(argv[1], 0)));
67 count = perl_call_method("new", G_SCALAR);
72 croak("Big trouble in config\n") ;
75 perl_back->pb_obj_ref = newSVsv(POPs);
77 PUTBACK; FREETMPS; LEAVE ;
80 } else if ( strcasecmp( argv[0], "perlModulePath" ) == 0 ) {
83 "%s: line %d: missing module in \"PerlModulePath <module>\" line\n",
88 sprintf( eval_str, "push @INC, '%s';", argv[1] );
89 loc_sv = perl_eval_pv( eval_str, 0 );
93 * Pass it to Perl module if defined
97 "Unknown perl backeng config: %s\n", argv[0]);