xref: /illumos-gate/usr/src/cmd/nscd/nscd_initf.c (revision 75d94465dbafa487b716482dc36d5150a4ec9853)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
24  */
25 
26 #include <nss_common.h>
27 #include <nss_dbdefs.h>
28 #include "nscd_common.h"
29 #include "nscd_switch.h"
30 
31 void
32 _nss_initf_passwd(nss_db_params_t *p)
33 {
34 	p->name	= NSS_DBNAM_PASSWD;
35 	p->default_config = NSS_DEFCONF_PASSWD;
36 }
37 
38 void
39 _nss_initf_hosts(nss_db_params_t *p)
40 {
41 	p->name	= NSS_DBNAM_HOSTS;
42 	p->default_config = NSS_DEFCONF_HOSTS;
43 }
44 
45 void
46 _nss_initf_group(nss_db_params_t *p)
47 {
48 	p->name	= NSS_DBNAM_GROUP;
49 	p->default_config = NSS_DEFCONF_GROUP;
50 }
51 
52 void
53 _nss_initf_ipnodes(nss_db_params_t *p)
54 {
55 	p->name	= NSS_DBNAM_IPNODES;
56 	p->default_config = NSS_DEFCONF_IPNODES;
57 }
58 
59 void
60 _nss_initf_net(nss_db_params_t *p)
61 {
62 	p->name	= NSS_DBNAM_NETWORKS;
63 	p->default_config = NSS_DEFCONF_NETWORKS;
64 }
65 
66 void
67 _nss_initf_proto(nss_db_params_t *p)
68 {
69 	p->name	= NSS_DBNAM_PROTOCOLS;
70 	p->default_config = NSS_DEFCONF_PROTOCOLS;
71 }
72 
73 void
74 _nss_initf_rpc(p)
75 	nss_db_params_t	*p;
76 {
77 	p->name	= NSS_DBNAM_RPC;
78 	p->default_config = NSS_DEFCONF_RPC;
79 }
80 
81 void
82 _nss_initf_ethers(nss_db_params_t *p)
83 {
84 	p->name	= NSS_DBNAM_ETHERS;
85 	p->default_config = NSS_DEFCONF_ETHERS;
86 }
87 
88 void
89 _nss_initf_netmasks(nss_db_params_t *p)
90 {
91 	p->name	= NSS_DBNAM_NETMASKS;
92 	p->default_config = NSS_DEFCONF_NETMASKS;
93 }
94 
95 void
96 _nss_initf_bootparams(nss_db_params_t *p)
97 {
98 	p->name	= NSS_DBNAM_BOOTPARAMS;
99 	p->default_config = NSS_DEFCONF_BOOTPARAMS;
100 }
101 
102 void
103 _nss_initf_publickey(nss_db_params_t *p)
104 {
105 	p->name	= NSS_DBNAM_PUBLICKEY;
106 	p->default_config = NSS_DEFCONF_PUBLICKEY;
107 }
108 
109 void
110 _nss_initf_netgroup(nss_db_params_t *p)
111 {
112 	p->name	= NSS_DBNAM_NETGROUP;
113 	p->default_config = NSS_DEFCONF_NETGROUP;
114 }
115 
116 void
117 _nss_initf_services(nss_db_params_t *p)
118 {
119 	p->name	= NSS_DBNAM_SERVICES;
120 	p->default_config = NSS_DEFCONF_SERVICES;
121 }
122 
123 void
124 _nss_initf_printers(nss_db_params_t *p)
125 {
126 	p->name	= NSS_DBNAM_PRINTERS;
127 	p->default_config = NSS_DEFCONF_PRINTERS;
128 }
129 
130 void
131 _nss_initf_authattr(nss_db_params_t *p)
132 {
133 	p->name	= NSS_DBNAM_AUTHATTR;
134 	p->default_config = NSS_DEFCONF_AUTHATTR;
135 }
136 
137 void
138 _nss_initf_profattr(nss_db_params_t *p)
139 {
140 	p->name	= NSS_DBNAM_PROFATTR;
141 	p->default_config = NSS_DEFCONF_PROFATTR;
142 }
143 
144 void
145 _nss_initf_execattr(nss_db_params_t *p)
146 {
147 	p->name	= NSS_DBNAM_EXECATTR;
148 	p->default_config = NSS_DEFCONF_PROFATTR;
149 	p->config_name    = NSS_DBNAM_PROFATTR; /* use config for "prof_attr" */
150 }
151 
152 void
153 _nss_initf_userattr(nss_db_params_t *p)
154 {
155 	p->name	= NSS_DBNAM_USERATTR;
156 	p->config_name = NSS_DBNAM_PASSWD;
157 	p->default_config = NSS_DEFCONF_USERATTR;
158 }
159 
160 void
161 _nss_initf_project(nss_db_params_t *p)
162 {
163 	p->name	= NSS_DBNAM_PROJECT;
164 	p->default_config = NSS_DEFCONF_PROJECT;
165 }
166 
167 void
168 _nss_initf_auuser(nss_db_params_t *p)
169 {
170 	p->name	= NSS_DBNAM_AUDITUSER;
171 	p->config_name	= NSS_DBNAM_PASSWD;
172 	p->default_config = NSS_DEFCONF_AUDITUSER;
173 }
174 
175 void
176 _nss_initf_shadow(nss_db_params_t *p)
177 {
178 	p->name	= NSS_DBNAM_SHADOW;
179 	p->config_name	= NSS_DBNAM_PASSWD;
180 	p->default_config = NSS_DEFCONF_PASSWD;
181 }
182 
183 void
184 _nss_initf_passwd_compat(nss_db_params_t *p)
185 {
186 	p->name	= NSS_DBNAM_PASSWD;
187 	p->config_name	= NSS_DBNAM_PASSWD_COMPAT;
188 	p->default_config = NSS_DEFCONF_PASSWD_COMPAT;
189 }
190 
191 void
192 _nss_initf_group_compat(nss_db_params_t *p)
193 {
194 	p->name	= NSS_DBNAM_GROUP;
195 	p->config_name	= NSS_DBNAM_GROUP_COMPAT;
196 	p->default_config = NSS_DEFCONF_GROUP_COMPAT;
197 }
198 
199 void
200 _nss_initf_tsol_rh(nss_db_params_t *p)
201 {
202 	p->name = NSS_DBNAM_TSOL_RH;
203 	p->default_config = NSS_DEFCONF_TSOL_RH;
204 }
205 
206 void
207 _nss_initf_tsol_tp(nss_db_params_t *p)
208 {
209 	p->name = NSS_DBNAM_TSOL_TP;
210 	p->default_config = NSS_DEFCONF_TSOL_TP;
211 }
212 
213 nss_db_initf_t	nscd_nss_db_initf[] = {
214 	_nss_initf_passwd,
215 	_nss_initf_hosts,
216 	_nss_initf_group,
217 	_nss_initf_ipnodes,
218 	_nss_initf_net,
219 	_nss_initf_proto,
220 	_nss_initf_rpc,
221 	_nss_initf_ethers,
222 	_nss_initf_netmasks,
223 	_nss_initf_bootparams,
224 	_nss_initf_publickey,
225 	_nss_initf_netgroup,
226 	_nss_initf_services,
227 	_nss_initf_printers,
228 	_nss_initf_authattr,
229 	_nss_initf_profattr,
230 	_nss_initf_execattr,
231 	_nss_initf_userattr,
232 	_nss_initf_project,
233 	_nss_initf_shadow,
234 	_nss_initf_auuser,
235 	_nss_initf_tsol_rh,
236 	_nss_initf_tsol_tp,
237 	_nss_initf_passwd_compat,
238 	_nss_initf_group_compat,
239 	/*
240 	 * no initf() for pseudo-databases: passwd, shadow, audit_user,
241 	 * user_attr, and group (when called from the compat backend)
242 	 */
243 	NULL,
244 	NULL,
245 	NULL,
246 	NULL,
247 	NULL};
248