]> git.sur5r.net Git - openldap/blob - servers/slapd/back-shell/init.c
a3a936e5faf6deb5e8c7d8a773c7721b62c103e7
[openldap] / servers / slapd / back-shell / init.c
1 /* init.c - initialize shell backend */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 1998-2017 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in the file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
17  * All rights reserved.
18  *
19  * Redistribution and use in source and binary forms are permitted
20  * provided that this notice is preserved and that due credit is given
21  * to the University of Michigan at Ann Arbor. The name of the University
22  * may not be used to endorse or promote products derived from this
23  * software without specific prior written permission. This software
24  * is provided ``as is'' without express or implied warranty.
25  */
26 /* ACKNOWLEDGEMENTS:
27  * This work was originally developed by the University of Michigan
28  * (as part of U-MICH LDAP).
29  */
30
31 #include "portable.h"
32
33 #include <stdio.h>
34
35 #include <ac/socket.h>
36
37 #include "slap.h"
38
39 #include "config.h"
40
41 #include "shell.h"
42
43 int
44 shell_back_initialize(
45     BackendInfo *bi
46 )
47 {
48         bi->bi_open = 0;
49         bi->bi_config = 0;
50         bi->bi_close = 0;
51         bi->bi_destroy = 0;
52
53         bi->bi_db_init = shell_back_db_init;
54         bi->bi_db_config = 0;
55         bi->bi_db_open = 0;
56         bi->bi_db_close = 0;
57         bi->bi_db_destroy = shell_back_db_destroy;
58
59         bi->bi_op_bind = shell_back_bind;
60         bi->bi_op_unbind = shell_back_unbind;
61         bi->bi_op_search = shell_back_search;
62         bi->bi_op_compare = shell_back_compare;
63         bi->bi_op_modify = shell_back_modify;
64         bi->bi_op_modrdn = shell_back_modrdn;
65         bi->bi_op_add = shell_back_add;
66         bi->bi_op_delete = shell_back_delete;
67         bi->bi_op_abandon = 0;
68
69         bi->bi_extended = 0;
70
71         bi->bi_chk_referrals = 0;
72
73         bi->bi_connection_init = 0;
74         bi->bi_connection_destroy = 0;
75
76         return shell_back_init_cf( bi );
77 }
78
79 int
80 shell_back_db_init(
81         Backend *be,
82         ConfigReply *cr
83 )
84 {
85         struct shellinfo        *si;
86
87         si = (struct shellinfo *) ch_calloc( 1, sizeof(struct shellinfo) );
88
89         be->be_private = si;
90         be->be_cf_ocs = be->bd_info->bi_cf_ocs;
91
92         return si == NULL;
93 }
94
95 int
96 shell_back_db_destroy(
97         Backend *be,
98         ConfigReply *cr
99 )
100 {
101         free( be->be_private );
102         return 0;
103 }
104
105 #if SLAPD_SHELL == SLAPD_MOD_DYNAMIC
106
107 /* conditionally define the init_module() function */
108 SLAP_BACKEND_INIT_MODULE( shell )
109
110 #endif /* SLAPD_SHELL == SLAPD_MOD_DYNAMIC */
111