1 /*        $NetBSD: init.c,v 1.3 2021/08/14 16:14:59 christos Exp $    */
2 
3 /* init.c - initialize ldap backend */
4 /* $OpenLDAP$ */
5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
6  *
7  * Copyright 2000-2021 The OpenLDAP Foundation.
8  * Portions Copyright 2000-2003 Kurt D. Zeilenga.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted only as authorized by the OpenLDAP
13  * Public License.
14  *
15  * A copy of this license is available in the file LICENSE in the
16  * top-level directory of the distribution or, alternatively, at
17  * <http://www.OpenLDAP.org/license.html>.
18  */
19 /* ACKNOWLEDGEMENTS:
20  * This work was originally developed by Kurt D. Zeilenga for inclusion
21  * in OpenLDAP Software.
22  */
23 
24 #include <sys/cdefs.h>
25 __RCSID("$NetBSD: init.c,v 1.3 2021/08/14 16:14:59 christos Exp $");
26 
27 #include "portable.h"
28 
29 #include <stdio.h>
30 
31 #include <ac/socket.h>
32 #include <ac/param.h>
33 #include <ac/string.h>
34 
35 #include "slap.h"
36 #include "slap-config.h"
37 #include "proto-dnssrv.h"
38 
39 int
dnssrv_back_initialize(BackendInfo * bi)40 dnssrv_back_initialize(
41     BackendInfo     *bi )
42 {
43           static char *controls[] = {
44                     LDAP_CONTROL_MANAGEDSAIT,
45                     NULL
46           };
47 
48           bi->bi_controls = controls;
49 
50           bi->bi_open = dnssrv_back_open;
51           bi->bi_config = 0;
52           bi->bi_close = 0;
53           bi->bi_destroy = 0;
54 
55           bi->bi_db_init = 0;
56           bi->bi_db_destroy = 0;
57           bi->bi_db_config = 0 /* dnssrv_back_db_config */;
58           bi->bi_db_open = 0;
59           bi->bi_db_close = 0;
60 
61           bi->bi_chk_referrals = dnssrv_back_referrals;
62 
63           bi->bi_op_bind = dnssrv_back_bind;
64           bi->bi_op_search = dnssrv_back_search;
65           bi->bi_op_compare = 0 /* dnssrv_back_compare */;
66           bi->bi_op_modify = 0;
67           bi->bi_op_modrdn = 0;
68           bi->bi_op_add = 0;
69           bi->bi_op_delete = 0;
70           bi->bi_op_abandon = 0;
71           bi->bi_op_unbind = 0;
72 
73           bi->bi_extended = 0;
74 
75           bi->bi_connection_init = 0;
76           bi->bi_connection_destroy = 0;
77 
78           bi->bi_access_allowed = slap_access_always_allowed;
79 
80           return 0;
81 }
82 
83 AttributeDescription          *ad_dc;
84 AttributeDescription          *ad_associatedDomain;
85 
86 int
dnssrv_back_open(BackendInfo * bi)87 dnssrv_back_open(
88     BackendInfo *bi )
89 {
90           const char *text;
91 
92           (void)slap_str2ad( "dc", &ad_dc, &text );
93           (void)slap_str2ad( "associatedDomain", &ad_associatedDomain, &text );
94 
95           return 0;
96 }
97 
98 int
dnssrv_back_db_init(Backend * be,ConfigReply * cr)99 dnssrv_back_db_init(
100           Backend   *be,
101           ConfigReply *cr)
102 {
103           return 0;
104 }
105 
106 int
dnssrv_back_db_destroy(Backend * be,ConfigReply * cr)107 dnssrv_back_db_destroy(
108           Backend   *be,
109           ConfigReply *cr )
110 {
111           return 0;
112 }
113 
114 #if SLAPD_DNSSRV == SLAPD_MOD_DYNAMIC
115 
116 /* conditionally define the init_module() function */
117 SLAP_BACKEND_INIT_MODULE( dnssrv )
118 
119 #endif /* SLAPD_DNSSRV == SLAPD_MOD_DYNAMIC */
120 
121