]> git.sur5r.net Git - openldap/blob - servers/slapd/back-shell/init.c
7b69e139f12f3393bdfb50a36e911920d610facc
[openldap] / servers / slapd / back-shell / init.c
1 /* init.c - initialize shell backend */
2
3 #include "portable.h"
4
5 #include <stdio.h>
6
7 #include <ac/socket.h>
8
9 #include "slap.h"
10 #include "shell.h"
11
12 #ifdef SLAPD_SHELL_DYNAMIC
13 #include <gmodule.h>
14
15 G_MODULE_EXPORT void init_module(int argc, char *argv[]) {
16    BackendInfo bi;
17
18    bi.bi_type = "shell";
19    bi.bi_init = shell_back_initialize;
20
21    backend_add(&bi);
22 }
23
24 #endif /* SLAPD_SHELL_DYNAMIC */
25
26 int
27 shell_back_initialize(
28     BackendInfo *bi
29 )
30 {
31         bi->bi_open = 0;
32         bi->bi_config = 0;
33         bi->bi_close = 0;
34         bi->bi_destroy = 0;
35
36         bi->bi_db_init = shell_back_db_init;
37         bi->bi_db_config = shell_back_db_config;
38         bi->bi_db_open = 0;
39         bi->bi_db_close = 0;
40         bi->bi_db_destroy = shell_back_db_destroy;
41
42         bi->bi_op_bind = shell_back_bind;
43         bi->bi_op_unbind = shell_back_unbind;
44         bi->bi_op_search = shell_back_search;
45         bi->bi_op_compare = shell_back_compare;
46         bi->bi_op_modify = shell_back_modify;
47         bi->bi_op_modrdn = shell_back_modrdn;
48         bi->bi_op_add = shell_back_add;
49         bi->bi_op_delete = shell_back_delete;
50         bi->bi_op_abandon = shell_back_abandon;
51
52 #ifdef SLAPD_ACLGROUPS
53         bi->bi_acl_group = 0;
54 #endif
55
56         bi->bi_connection_init = 0;
57         bi->bi_connection_destroy = 0;
58
59         return 0;
60 }
61
62 int
63 shell_back_db_init(
64     Backend     *be
65 )
66 {
67         struct shellinfo        *si;
68
69         si = (struct shellinfo *) ch_calloc( 1, sizeof(struct shellinfo) );
70
71         be->be_private = si;
72
73         return si == NULL;
74 }
75
76 int
77 shell_back_db_destroy(
78     Backend     *be
79 )
80 {
81         free( be->be_private );
82         return 0;
83 }