xref: /illumos-gate/usr/src/cmd/nscd/nscd_initf.c (revision 2f172c55ef76964744bc62b4500ece87f3089b4d)
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  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include <nss_common.h>
29 #include <nss_dbdefs.h>
30 #include "nscd_common.h"
31 #include "nscd_switch.h"
32 
33 void
34 _nss_initf_passwd(nss_db_params_t *p)
35 {
36 	p->name	= NSS_DBNAM_PASSWD;
37 	p->default_config = NSS_DEFCONF_PASSWD;
38 }
39 
40 void
41 _nss_initf_hosts(nss_db_params_t *p)
42 {
43 	p->name	= NSS_DBNAM_HOSTS;
44 	p->default_config = NSS_DEFCONF_HOSTS;
45 }
46 
47 void
48 _nss_initf_group(nss_db_params_t *p)
49 {
50 	p->name	= NSS_DBNAM_GROUP;
51 	p->default_config = NSS_DEFCONF_GROUP;
52 }
53 
54 void
55 _nss_initf_ipnodes(nss_db_params_t *p)
56 {
57 	p->name	= NSS_DBNAM_IPNODES;
58 	p->default_config = NSS_DEFCONF_IPNODES;
59 }
60 
61 void
62 _nss_initf_net(nss_db_params_t *p)
63 {
64 	p->name	= NSS_DBNAM_NETWORKS;
65 	p->default_config = NSS_DEFCONF_NETWORKS;
66 }
67 
68 void
69 _nss_initf_proto(nss_db_params_t *p)
70 {
71 	p->name	= NSS_DBNAM_PROTOCOLS;
72 	p->default_config = NSS_DEFCONF_PROTOCOLS;
73 }
74 
75 void
76 _nss_initf_rpc(p)
77 	nss_db_params_t	*p;
78 {
79 	p->name	= NSS_DBNAM_RPC;
80 	p->default_config = NSS_DEFCONF_RPC;
81 }
82 
83 void
84 _nss_initf_ethers(nss_db_params_t *p)
85 {
86 	p->name	= NSS_DBNAM_ETHERS;
87 	p->default_config = NSS_DEFCONF_ETHERS;
88 }
89 
90 void
91 _nss_initf_netmasks(nss_db_params_t *p)
92 {
93 	p->name	= NSS_DBNAM_NETMASKS;
94 	p->default_config = NSS_DEFCONF_NETMASKS;
95 }
96 
97 void
98 _nss_initf_bootparams(nss_db_params_t *p)
99 {
100 	p->name	= NSS_DBNAM_BOOTPARAMS;
101 	p->default_config = NSS_DEFCONF_BOOTPARAMS;
102 }
103 
104 void
105 _nss_initf_publickey(nss_db_params_t *p)
106 {
107 	p->name	= NSS_DBNAM_PUBLICKEY;
108 	p->default_config = NSS_DEFCONF_PUBLICKEY;
109 }
110 
111 void
112 _nss_initf_netgroup(nss_db_params_t *p)
113 {
114 	p->name	= NSS_DBNAM_NETGROUP;
115 	p->default_config = NSS_DEFCONF_NETGROUP;
116 }
117 
118 void
119 _nss_initf_services(nss_db_params_t *p)
120 {
121 	p->name	= NSS_DBNAM_SERVICES;
122 	p->default_config = NSS_DEFCONF_SERVICES;
123 }
124 
125 void
126 _nss_initf_printers(nss_db_params_t *p)
127 {
128 	p->name	= NSS_DBNAM_PRINTERS;
129 	p->default_config = NSS_DEFCONF_PRINTERS;
130 }
131 
132 void
133 _nss_initf_authattr(nss_db_params_t *p)
134 {
135 	p->name	= NSS_DBNAM_AUTHATTR;
136 	p->default_config = NSS_DEFCONF_AUTHATTR;
137 }
138 
139 void
140 _nss_initf_profattr(nss_db_params_t *p)
141 {
142 	p->name	= NSS_DBNAM_PROFATTR;
143 	p->default_config = NSS_DEFCONF_PROFATTR;
144 }
145 
146 void
147 _nss_initf_execattr(nss_db_params_t *p)
148 {
149 	p->name	= NSS_DBNAM_EXECATTR;
150 	p->default_config = NSS_DEFCONF_PROFATTR;
151 	p->config_name    = NSS_DBNAM_PROFATTR; /* use config for "prof_attr" */
152 }
153 
154 void
155 _nss_initf_userattr(nss_db_params_t *p)
156 {
157 	p->name	= NSS_DBNAM_USERATTR;
158 	p->config_name = NSS_DBNAM_PASSWD;
159 	p->default_config = NSS_DEFCONF_USERATTR;
160 }
161 
162 void
163 _nss_initf_project(nss_db_params_t *p)
164 {
165 	p->name	= NSS_DBNAM_PROJECT;
166 	p->default_config = NSS_DEFCONF_PROJECT;
167 }
168 
169 void
170 _nss_initf_auuser(nss_db_params_t *p)
171 {
172 	p->name	= NSS_DBNAM_AUDITUSER;
173 	p->config_name	= NSS_DBNAM_PASSWD;
174 	p->default_config = NSS_DEFCONF_AUDITUSER;
175 }
176 
177 void
178 _nss_initf_shadow(nss_db_params_t *p)
179 {
180 	p->name	= NSS_DBNAM_SHADOW;
181 	p->config_name	= NSS_DBNAM_PASSWD;
182 	p->default_config = NSS_DEFCONF_PASSWD;
183 }
184 
185 void
186 _nss_initf_passwd_compat(nss_db_params_t *p)
187 {
188 	p->name	= NSS_DBNAM_PASSWD;
189 	p->config_name	= NSS_DBNAM_PASSWD_COMPAT;
190 	p->default_config = NSS_DEFCONF_PASSWD_COMPAT;
191 }
192 
193 void
194 _nss_initf_group_compat(nss_db_params_t *p)
195 {
196 	p->name	= NSS_DBNAM_GROUP;
197 	p->config_name	= NSS_DBNAM_GROUP_COMPAT;
198 	p->default_config = NSS_DEFCONF_GROUP_COMPAT;
199 }
200 
201 void
202 _nss_initf_tsol_rh(nss_db_params_t *p)
203 {
204 	p->name = NSS_DBNAM_TSOL_RH;
205 	p->default_config = NSS_DEFCONF_TSOL_RH;
206 }
207 
208 void
209 _nss_initf_tsol_tp(nss_db_params_t *p)
210 {
211 	p->name = NSS_DBNAM_TSOL_TP;
212 	p->default_config = NSS_DEFCONF_TSOL_TP;
213 }
214 
215 nss_db_initf_t	nscd_nss_db_initf[] = {
216 	_nss_initf_passwd,
217 	_nss_initf_hosts,
218 	_nss_initf_group,
219 	_nss_initf_ipnodes,
220 	_nss_initf_net,
221 	_nss_initf_proto,
222 	_nss_initf_rpc,
223 	_nss_initf_ethers,
224 	_nss_initf_netmasks,
225 	_nss_initf_bootparams,
226 	_nss_initf_publickey,
227 	_nss_initf_netgroup,
228 	_nss_initf_services,
229 	_nss_initf_printers,
230 	_nss_initf_authattr,
231 	_nss_initf_profattr,
232 	_nss_initf_execattr,
233 	_nss_initf_userattr,
234 	_nss_initf_project,
235 	_nss_initf_shadow,
236 	_nss_initf_auuser,
237 	_nss_initf_tsol_rh,
238 	_nss_initf_tsol_tp,
239 	_nss_initf_passwd_compat,
240 	_nss_initf_group_compat,
241 	/*
242 	 * no initf() for pseudo-databases: passwd, shadow,
243 	 * audit_user, user_attr, and group (when called from
244 	 * the compat backend)
245 	 */
246 	NULL,
247 	NULL,
248 	NULL,
249 	NULL,
250 	NULL};
251