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>
23 #include "perl_back.h"
26 PerlInterpreter *perl_interpreter = NULL;
27 ldap_pvt_thread_mutex_t perl_interpreter_mutex;
30 /**********************************************************
34 **********************************************************/
41 char *embedding[] = { "", "-e", "0" };
43 Debug( LDAP_DEBUG_TRACE, "perl backend open\n", 0, 0, 0 );
45 if( perl_interpreter != NULL ) {
46 Debug( LDAP_DEBUG_ANY, "perl backend open: already opened\n",
51 perl_interpreter = perl_alloc();
52 perl_construct(perl_interpreter);
53 perl_parse(perl_interpreter, NULL, 3, embedding, (char **)NULL);
54 perl_run(perl_interpreter);
56 bi->bi_open = perl_back_open;
58 bi->bi_close = perl_back_close;
59 bi->bi_destroy = perl_back_destroy;
61 bi->bi_db_init = perl_back_db_init;
62 bi->bi_db_config = perl_back_db_config;
63 bi->bi_db_open = NULL;
64 bi->bi_db_close = NULL;
65 bi->bi_db_destroy = perl_back_db_destroy;
67 bi->bi_op_bind = perl_back_bind;
68 bi->bi_op_unbind = perl_back_unbind;
69 bi->bi_op_search = perl_back_search;
70 bi->bi_op_compare = perl_back_compare;
71 bi->bi_op_modify = perl_back_modify;
72 bi->bi_op_modrdn = perl_back_modrdn;
73 bi->bi_op_add = perl_back_add;
74 bi->bi_op_delete = perl_back_delete;
75 bi->bi_op_abandon = NULL;
77 bi->bi_acl_group = NULL;
87 ldap_pvt_thread_mutex_init( &perl_interpreter_mutex );
96 be->be_private = (PerlBackend *) ch_malloc( sizeof(PerlBackend) );
97 memset(&be->be_private, 0, sizeof(PerlBackend));
99 Debug( LDAP_DEBUG_TRACE, "perl backend db init\n", 0, 0, 0 );