1*9781SMoriah.Waterland@Sun.COM /*
2*9781SMoriah.Waterland@Sun.COM * CDDL HEADER START
3*9781SMoriah.Waterland@Sun.COM *
4*9781SMoriah.Waterland@Sun.COM * The contents of this file are subject to the terms of the
5*9781SMoriah.Waterland@Sun.COM * Common Development and Distribution License (the "License").
6*9781SMoriah.Waterland@Sun.COM * You may not use this file except in compliance with the License.
7*9781SMoriah.Waterland@Sun.COM *
8*9781SMoriah.Waterland@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9781SMoriah.Waterland@Sun.COM * or http://www.opensolaris.org/os/licensing.
10*9781SMoriah.Waterland@Sun.COM * See the License for the specific language governing permissions
11*9781SMoriah.Waterland@Sun.COM * and limitations under the License.
12*9781SMoriah.Waterland@Sun.COM *
13*9781SMoriah.Waterland@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each
14*9781SMoriah.Waterland@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9781SMoriah.Waterland@Sun.COM * If applicable, add the following below this CDDL HEADER, with the
16*9781SMoriah.Waterland@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying
17*9781SMoriah.Waterland@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner]
18*9781SMoriah.Waterland@Sun.COM *
19*9781SMoriah.Waterland@Sun.COM * CDDL HEADER END
20*9781SMoriah.Waterland@Sun.COM */
21*9781SMoriah.Waterland@Sun.COM
22*9781SMoriah.Waterland@Sun.COM /*
23*9781SMoriah.Waterland@Sun.COM * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24*9781SMoriah.Waterland@Sun.COM * Use is subject to license terms.
25*9781SMoriah.Waterland@Sun.COM */
26*9781SMoriah.Waterland@Sun.COM
27*9781SMoriah.Waterland@Sun.COM /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28*9781SMoriah.Waterland@Sun.COM /* All Rights Reserved */
29*9781SMoriah.Waterland@Sun.COM
30*9781SMoriah.Waterland@Sun.COM
31*9781SMoriah.Waterland@Sun.COM #include <stdio.h>
32*9781SMoriah.Waterland@Sun.COM #include <limits.h>
33*9781SMoriah.Waterland@Sun.COM #include <stdlib.h>
34*9781SMoriah.Waterland@Sun.COM #include <unistd.h>
35*9781SMoriah.Waterland@Sun.COM #include <string.h>
36*9781SMoriah.Waterland@Sun.COM #include <errno.h>
37*9781SMoriah.Waterland@Sun.COM #include <pkglocs.h>
38*9781SMoriah.Waterland@Sun.COM #include <locale.h>
39*9781SMoriah.Waterland@Sun.COM #include <libintl.h>
40*9781SMoriah.Waterland@Sun.COM #include <pkglib.h>
41*9781SMoriah.Waterland@Sun.COM #include <pkgerr.h>
42*9781SMoriah.Waterland@Sun.COM #include <pkgweb.h>
43*9781SMoriah.Waterland@Sun.COM #include <install.h>
44*9781SMoriah.Waterland@Sun.COM #include <libinst.h>
45*9781SMoriah.Waterland@Sun.COM #include <libadm.h>
46*9781SMoriah.Waterland@Sun.COM #include <messages.h>
47*9781SMoriah.Waterland@Sun.COM
48*9781SMoriah.Waterland@Sun.COM #define DEFMAIL "root"
49*9781SMoriah.Waterland@Sun.COM
50*9781SMoriah.Waterland@Sun.COM extern struct admin adm; /* holds info about install admin */
51*9781SMoriah.Waterland@Sun.COM extern int warnflag; /* != 0 non-fatal error occurred 2 */
52*9781SMoriah.Waterland@Sun.COM
53*9781SMoriah.Waterland@Sun.COM static struct {
54*9781SMoriah.Waterland@Sun.COM char **memloc;
55*9781SMoriah.Waterland@Sun.COM char *tag;
56*9781SMoriah.Waterland@Sun.COM } admlist[] = {
57*9781SMoriah.Waterland@Sun.COM &adm.action, "action",
58*9781SMoriah.Waterland@Sun.COM &adm.authentication, "authentication",
59*9781SMoriah.Waterland@Sun.COM &adm.basedir, "basedir",
60*9781SMoriah.Waterland@Sun.COM &adm.conflict, "conflict",
61*9781SMoriah.Waterland@Sun.COM &adm.idepend, "idepend",
62*9781SMoriah.Waterland@Sun.COM &adm.instance, "instance",
63*9781SMoriah.Waterland@Sun.COM &adm.keystore, "keystore",
64*9781SMoriah.Waterland@Sun.COM &adm.mail, "mail",
65*9781SMoriah.Waterland@Sun.COM &adm.networkretries, "networkretries",
66*9781SMoriah.Waterland@Sun.COM &adm.networktimeout, "networktimeout",
67*9781SMoriah.Waterland@Sun.COM &adm.partial, "partial",
68*9781SMoriah.Waterland@Sun.COM &adm.proxy, "proxy",
69*9781SMoriah.Waterland@Sun.COM &adm.rdepend, "rdepend",
70*9781SMoriah.Waterland@Sun.COM &adm.RSCRIPTALT, RSCRIPTALT_KEYWORD,
71*9781SMoriah.Waterland@Sun.COM &adm.runlevel, "runlevel",
72*9781SMoriah.Waterland@Sun.COM &adm.setuid, "setuid",
73*9781SMoriah.Waterland@Sun.COM &adm.space, "space",
74*9781SMoriah.Waterland@Sun.COM /* MUST BE LAST ENTRY IN LIST */
75*9781SMoriah.Waterland@Sun.COM (char **)NULL, (char *)NULL
76*9781SMoriah.Waterland@Sun.COM };
77*9781SMoriah.Waterland@Sun.COM
78*9781SMoriah.Waterland@Sun.COM /*
79*9781SMoriah.Waterland@Sun.COM * Name: setadminSetting
80*9781SMoriah.Waterland@Sun.COM * Description: set one administration parameter setting
81*9781SMoriah.Waterland@Sun.COM * Arguments: a_paramName - pointer to string representing the name of
82*9781SMoriah.Waterland@Sun.COM * the administration parameter to set
83*9781SMoriah.Waterland@Sun.COM * a_paramValue - pointer to string representing the value
84*9781SMoriah.Waterland@Sun.COM * to set the specified administration parameter to
85*9781SMoriah.Waterland@Sun.COM * Returns: char *
86*9781SMoriah.Waterland@Sun.COM * - old value the parameter had before being set
87*9781SMoriah.Waterland@Sun.COM * == NULL - the old paramter was not set
88*9781SMoriah.Waterland@Sun.COM */
89*9781SMoriah.Waterland@Sun.COM
90*9781SMoriah.Waterland@Sun.COM char *
setadminSetting(char * a_paramName,char * a_paramValue)91*9781SMoriah.Waterland@Sun.COM setadminSetting(char *a_paramName, char *a_paramValue)
92*9781SMoriah.Waterland@Sun.COM {
93*9781SMoriah.Waterland@Sun.COM char *oldValue = (char *)NULL;
94*9781SMoriah.Waterland@Sun.COM int i;
95*9781SMoriah.Waterland@Sun.COM
96*9781SMoriah.Waterland@Sun.COM /* locate and update the specified admin setting */
97*9781SMoriah.Waterland@Sun.COM
98*9781SMoriah.Waterland@Sun.COM for (i = 0; admlist[i].memloc; i++) {
99*9781SMoriah.Waterland@Sun.COM if (strcmp(a_paramName, admlist[i].tag) == 0) {
100*9781SMoriah.Waterland@Sun.COM oldValue = *admlist[i].memloc;
101*9781SMoriah.Waterland@Sun.COM *admlist[i].memloc = a_paramValue;
102*9781SMoriah.Waterland@Sun.COM break;
103*9781SMoriah.Waterland@Sun.COM }
104*9781SMoriah.Waterland@Sun.COM }
105*9781SMoriah.Waterland@Sun.COM
106*9781SMoriah.Waterland@Sun.COM if (admlist[i].memloc == (char **)NULL) {
107*9781SMoriah.Waterland@Sun.COM logerr(WRN_UNKNOWN_ADM_PARAM, a_paramName);
108*9781SMoriah.Waterland@Sun.COM }
109*9781SMoriah.Waterland@Sun.COM
110*9781SMoriah.Waterland@Sun.COM return (oldValue);
111*9781SMoriah.Waterland@Sun.COM }
112*9781SMoriah.Waterland@Sun.COM
113*9781SMoriah.Waterland@Sun.COM /*
114*9781SMoriah.Waterland@Sun.COM * Name: setadminFile
115*9781SMoriah.Waterland@Sun.COM * Description: read and remember settings from administration file
116*9781SMoriah.Waterland@Sun.COM * Arguments: file - pointer to string representing the path to the
117*9781SMoriah.Waterland@Sun.COM * administration file to read - if this is NULL
118*9781SMoriah.Waterland@Sun.COM * then the name "default" is used - if this is
119*9781SMoriah.Waterland@Sun.COM * the string "none" then the admin "basedir"
120*9781SMoriah.Waterland@Sun.COM * setting is set to "ask" so that the location
121*9781SMoriah.Waterland@Sun.COM * of the administration file will be interactively
122*9781SMoriah.Waterland@Sun.COM * asked at the appropriate time
123*9781SMoriah.Waterland@Sun.COM * Returns: void
124*9781SMoriah.Waterland@Sun.COM */
125*9781SMoriah.Waterland@Sun.COM
126*9781SMoriah.Waterland@Sun.COM void
setadminFile(char * file)127*9781SMoriah.Waterland@Sun.COM setadminFile(char *file)
128*9781SMoriah.Waterland@Sun.COM {
129*9781SMoriah.Waterland@Sun.COM FILE *fp;
130*9781SMoriah.Waterland@Sun.COM int i;
131*9781SMoriah.Waterland@Sun.COM char param[MAX_PKG_PARAM_LENGTH];
132*9781SMoriah.Waterland@Sun.COM char *value;
133*9781SMoriah.Waterland@Sun.COM char path[PATH_MAX];
134*9781SMoriah.Waterland@Sun.COM int mail = 0;
135*9781SMoriah.Waterland@Sun.COM
136*9781SMoriah.Waterland@Sun.COM if (file == NULL)
137*9781SMoriah.Waterland@Sun.COM file = "default";
138*9781SMoriah.Waterland@Sun.COM else if (strcmp(file, "none") == 0) {
139*9781SMoriah.Waterland@Sun.COM adm.basedir = "ask";
140*9781SMoriah.Waterland@Sun.COM return;
141*9781SMoriah.Waterland@Sun.COM }
142*9781SMoriah.Waterland@Sun.COM
143*9781SMoriah.Waterland@Sun.COM if (file[0] == '/')
144*9781SMoriah.Waterland@Sun.COM (void) strcpy(path, file);
145*9781SMoriah.Waterland@Sun.COM else {
146*9781SMoriah.Waterland@Sun.COM (void) snprintf(path, sizeof (path), "%s/admin/%s",
147*9781SMoriah.Waterland@Sun.COM get_PKGADM(), file);
148*9781SMoriah.Waterland@Sun.COM if (access(path, R_OK)) {
149*9781SMoriah.Waterland@Sun.COM (void) snprintf(path, sizeof (path), "%s/admin/%s",
150*9781SMoriah.Waterland@Sun.COM PKGADM, file);
151*9781SMoriah.Waterland@Sun.COM }
152*9781SMoriah.Waterland@Sun.COM }
153*9781SMoriah.Waterland@Sun.COM
154*9781SMoriah.Waterland@Sun.COM if ((fp = fopen(path, "r")) == NULL) {
155*9781SMoriah.Waterland@Sun.COM progerr(ERR_OPEN_ADMIN_FILE, file, strerror(errno));
156*9781SMoriah.Waterland@Sun.COM quit(99);
157*9781SMoriah.Waterland@Sun.COM }
158*9781SMoriah.Waterland@Sun.COM
159*9781SMoriah.Waterland@Sun.COM param[0] = '\0';
160*9781SMoriah.Waterland@Sun.COM while (value = fpkgparam(fp, param)) {
161*9781SMoriah.Waterland@Sun.COM if (strcmp(param, "mail") == 0) {
162*9781SMoriah.Waterland@Sun.COM mail = 1;
163*9781SMoriah.Waterland@Sun.COM }
164*9781SMoriah.Waterland@Sun.COM if (value[0] == '\0') {
165*9781SMoriah.Waterland@Sun.COM param[0] = '\0';
166*9781SMoriah.Waterland@Sun.COM continue; /* same as not being set at all */
167*9781SMoriah.Waterland@Sun.COM }
168*9781SMoriah.Waterland@Sun.COM for (i = 0; admlist[i].memloc; i++) {
169*9781SMoriah.Waterland@Sun.COM if (strcmp(param, admlist[i].tag) == 0) {
170*9781SMoriah.Waterland@Sun.COM *admlist[i].memloc = value;
171*9781SMoriah.Waterland@Sun.COM break;
172*9781SMoriah.Waterland@Sun.COM }
173*9781SMoriah.Waterland@Sun.COM }
174*9781SMoriah.Waterland@Sun.COM if (admlist[i].memloc == NULL) {
175*9781SMoriah.Waterland@Sun.COM logerr(WRN_UNKNOWN_ADM_PARAM, param);
176*9781SMoriah.Waterland@Sun.COM free(value);
177*9781SMoriah.Waterland@Sun.COM }
178*9781SMoriah.Waterland@Sun.COM param[0] = '\0';
179*9781SMoriah.Waterland@Sun.COM }
180*9781SMoriah.Waterland@Sun.COM
181*9781SMoriah.Waterland@Sun.COM (void) fclose(fp);
182*9781SMoriah.Waterland@Sun.COM
183*9781SMoriah.Waterland@Sun.COM if (!mail) {
184*9781SMoriah.Waterland@Sun.COM adm.mail = DEFMAIL; /* if we don't assign anything to it */
185*9781SMoriah.Waterland@Sun.COM }
186*9781SMoriah.Waterland@Sun.COM }
187*9781SMoriah.Waterland@Sun.COM
188*9781SMoriah.Waterland@Sun.COM
189*9781SMoriah.Waterland@Sun.COM /*
190*9781SMoriah.Waterland@Sun.COM * Function: web_ck_retries
191*9781SMoriah.Waterland@Sun.COM * Description: Reads admin file setting for networkretries, or uses default
192*9781SMoriah.Waterland@Sun.COM * Parameters: None
193*9781SMoriah.Waterland@Sun.COM * Returns: admin file setting for networkretries, or the default if no
194*9781SMoriah.Waterland@Sun.COM * admin file setting exists or if it is outside the
195*9781SMoriah.Waterland@Sun.COM * allowable range.
196*9781SMoriah.Waterland@Sun.COM */
197*9781SMoriah.Waterland@Sun.COM int
web_ck_retries(void)198*9781SMoriah.Waterland@Sun.COM web_ck_retries(void)
199*9781SMoriah.Waterland@Sun.COM {
200*9781SMoriah.Waterland@Sun.COM int retries = NET_RETRIES_DEFAULT;
201*9781SMoriah.Waterland@Sun.COM
202*9781SMoriah.Waterland@Sun.COM if (ADMSET(networkretries)) {
203*9781SMoriah.Waterland@Sun.COM /* Make sure value is within valid range */
204*9781SMoriah.Waterland@Sun.COM if ((retries = atoi(adm.networkretries)) == 0) {
205*9781SMoriah.Waterland@Sun.COM return (NET_RETRIES_DEFAULT);
206*9781SMoriah.Waterland@Sun.COM } else if (retries <= NET_RETRIES_MIN ||
207*9781SMoriah.Waterland@Sun.COM retries > NET_RETRIES_MAX) {
208*9781SMoriah.Waterland@Sun.COM return (NET_RETRIES_DEFAULT);
209*9781SMoriah.Waterland@Sun.COM }
210*9781SMoriah.Waterland@Sun.COM }
211*9781SMoriah.Waterland@Sun.COM return (retries);
212*9781SMoriah.Waterland@Sun.COM }
213*9781SMoriah.Waterland@Sun.COM
214*9781SMoriah.Waterland@Sun.COM /*
215*9781SMoriah.Waterland@Sun.COM * Function: web_ck_authentication
216*9781SMoriah.Waterland@Sun.COM * Description: Retrieves admin file setting for authentication
217*9781SMoriah.Waterland@Sun.COM * Parameters: None
218*9781SMoriah.Waterland@Sun.COM * Returns: admin file policy for authentication - AUTH_QUIT
219*9781SMoriah.Waterland@Sun.COM * or AUTH_NOCHECK.
220*9781SMoriah.Waterland@Sun.COM * non-zero failure
221*9781SMoriah.Waterland@Sun.COM */
222*9781SMoriah.Waterland@Sun.COM int
web_ck_authentication(void)223*9781SMoriah.Waterland@Sun.COM web_ck_authentication(void)
224*9781SMoriah.Waterland@Sun.COM {
225*9781SMoriah.Waterland@Sun.COM if (ADM(authentication, "nocheck"))
226*9781SMoriah.Waterland@Sun.COM return (AUTH_NOCHECK);
227*9781SMoriah.Waterland@Sun.COM
228*9781SMoriah.Waterland@Sun.COM return (AUTH_QUIT);
229*9781SMoriah.Waterland@Sun.COM }
230*9781SMoriah.Waterland@Sun.COM
231*9781SMoriah.Waterland@Sun.COM /*
232*9781SMoriah.Waterland@Sun.COM * Function: web_ck_timeout
233*9781SMoriah.Waterland@Sun.COM * Description: Retrieves admin file policy for networktimeout's
234*9781SMoriah.Waterland@Sun.COM * Parameters: NONE
235*9781SMoriah.Waterland@Sun.COM * Returns: Admin file setting for networktimeout, or default
236*9781SMoriah.Waterland@Sun.COM * timeout value if admin file does not specify one,
237*9781SMoriah.Waterland@Sun.COM * or specifies one that is out of the allowable range.
238*9781SMoriah.Waterland@Sun.COM */
239*9781SMoriah.Waterland@Sun.COM int
web_ck_timeout(void)240*9781SMoriah.Waterland@Sun.COM web_ck_timeout(void)
241*9781SMoriah.Waterland@Sun.COM {
242*9781SMoriah.Waterland@Sun.COM int timeout = NET_TIMEOUT_DEFAULT;
243*9781SMoriah.Waterland@Sun.COM
244*9781SMoriah.Waterland@Sun.COM if (ADMSET(networktimeout)) {
245*9781SMoriah.Waterland@Sun.COM /* Make sure value is within valid range */
246*9781SMoriah.Waterland@Sun.COM if ((timeout = atoi(adm.networktimeout)) == 0) {
247*9781SMoriah.Waterland@Sun.COM return (NET_TIMEOUT_DEFAULT);
248*9781SMoriah.Waterland@Sun.COM } else if (timeout <= NET_TIMEOUT_MIN ||
249*9781SMoriah.Waterland@Sun.COM timeout > NET_TIMEOUT_MAX) {
250*9781SMoriah.Waterland@Sun.COM return (NET_TIMEOUT_DEFAULT);
251*9781SMoriah.Waterland@Sun.COM }
252*9781SMoriah.Waterland@Sun.COM }
253*9781SMoriah.Waterland@Sun.COM return (timeout);
254*9781SMoriah.Waterland@Sun.COM }
255*9781SMoriah.Waterland@Sun.COM
256*9781SMoriah.Waterland@Sun.COM /*
257*9781SMoriah.Waterland@Sun.COM * Function: check_keystore_admin
258*9781SMoriah.Waterland@Sun.COM * Description: Retrieves security keystore setting from admin file,
259*9781SMoriah.Waterland@Sun.COM * or validates user-supplied keystore policy.
260*9781SMoriah.Waterland@Sun.COM * Parameters: keystore - Where to store resulting keystore policy
261*9781SMoriah.Waterland@Sun.COM * Returns: B_TRUE - admin file contained valid keystore, or
262*9781SMoriah.Waterland@Sun.COM * user-supplied keystore passed in "keystore" was
263*9781SMoriah.Waterland@Sun.COM * valid. Resulting keystore stored in "keystore"
264*9781SMoriah.Waterland@Sun.COM *
265*9781SMoriah.Waterland@Sun.COM * B_FALSE - No location supplied to store result,
266*9781SMoriah.Waterland@Sun.COM * or user-supplied keystore was not valid.
267*9781SMoriah.Waterland@Sun.COM */
268*9781SMoriah.Waterland@Sun.COM boolean_t
check_keystore_admin(char ** keystore)269*9781SMoriah.Waterland@Sun.COM check_keystore_admin(char **keystore)
270*9781SMoriah.Waterland@Sun.COM {
271*9781SMoriah.Waterland@Sun.COM
272*9781SMoriah.Waterland@Sun.COM if (!keystore) {
273*9781SMoriah.Waterland@Sun.COM /* no location to store keystore */
274*9781SMoriah.Waterland@Sun.COM return (B_FALSE);
275*9781SMoriah.Waterland@Sun.COM }
276*9781SMoriah.Waterland@Sun.COM
277*9781SMoriah.Waterland@Sun.COM if (*keystore != NULL) {
278*9781SMoriah.Waterland@Sun.COM if (!path_valid(*keystore)) {
279*9781SMoriah.Waterland@Sun.COM /* the given keystore is invalid */
280*9781SMoriah.Waterland@Sun.COM return (B_FALSE);
281*9781SMoriah.Waterland@Sun.COM }
282*9781SMoriah.Waterland@Sun.COM
283*9781SMoriah.Waterland@Sun.COM /* the user-supplied keystore was valid */
284*9781SMoriah.Waterland@Sun.COM return (B_TRUE);
285*9781SMoriah.Waterland@Sun.COM }
286*9781SMoriah.Waterland@Sun.COM
287*9781SMoriah.Waterland@Sun.COM /* no user-supplied, so use default */
288*9781SMoriah.Waterland@Sun.COM if ((*keystore = set_keystore_admin()) == NULL) {
289*9781SMoriah.Waterland@Sun.COM *keystore = PKGSEC;
290*9781SMoriah.Waterland@Sun.COM }
291*9781SMoriah.Waterland@Sun.COM return (B_TRUE);
292*9781SMoriah.Waterland@Sun.COM }
293*9781SMoriah.Waterland@Sun.COM
294*9781SMoriah.Waterland@Sun.COM /*
295*9781SMoriah.Waterland@Sun.COM * Function: get_proxy_port_admin
296*9781SMoriah.Waterland@Sun.COM * Description: Retrieves proxy setting from admin file
297*9781SMoriah.Waterland@Sun.COM * Parameters: proxy - where to store resulting proxy (host:port or URL)
298*9781SMoriah.Waterland@Sun.COM * port - Where to store resulting proxy port
299*9781SMoriah.Waterland@Sun.COM * Returns: B_TRUE - admin file had a valid proxy setting,
300*9781SMoriah.Waterland@Sun.COM * and it is stored in "proxy".
301*9781SMoriah.Waterland@Sun.COM * B_FALSE - no proxy setting in admin file, or
302*9781SMoriah.Waterland@Sun.COM * invalid setting in admin file.
303*9781SMoriah.Waterland@Sun.COM */
304*9781SMoriah.Waterland@Sun.COM boolean_t
get_proxy_port_admin(char ** proxy,ushort_t * port)305*9781SMoriah.Waterland@Sun.COM get_proxy_port_admin(char **proxy, ushort_t *port)
306*9781SMoriah.Waterland@Sun.COM {
307*9781SMoriah.Waterland@Sun.COM if (ADMSET(proxy) && !path_valid(adm.proxy)) {
308*9781SMoriah.Waterland@Sun.COM /* admin file has bad keystore */
309*9781SMoriah.Waterland@Sun.COM return (B_FALSE);
310*9781SMoriah.Waterland@Sun.COM } else if (ADMSET(proxy)) {
311*9781SMoriah.Waterland@Sun.COM *proxy = strdup(adm.proxy);
312*9781SMoriah.Waterland@Sun.COM *port = strip_port(adm.proxy);
313*9781SMoriah.Waterland@Sun.COM }
314*9781SMoriah.Waterland@Sun.COM return (B_TRUE);
315*9781SMoriah.Waterland@Sun.COM }
316*9781SMoriah.Waterland@Sun.COM
317*9781SMoriah.Waterland@Sun.COM /*
318*9781SMoriah.Waterland@Sun.COM * Function: set_keystore_admin
319*9781SMoriah.Waterland@Sun.COM * Description: Retrieves security keystore setting from admin file,
320*9781SMoriah.Waterland@Sun.COM * Parameters: NONE
321*9781SMoriah.Waterland@Sun.COM * Returns: Keystore file policy from admin file, if set
322*9781SMoriah.Waterland@Sun.COM * and valid. NULL otherwise.
323*9781SMoriah.Waterland@Sun.COM */
324*9781SMoriah.Waterland@Sun.COM char *
set_keystore_admin(void)325*9781SMoriah.Waterland@Sun.COM set_keystore_admin(void)
326*9781SMoriah.Waterland@Sun.COM {
327*9781SMoriah.Waterland@Sun.COM if (ADMSET(keystore) && !path_valid(adm.keystore)) {
328*9781SMoriah.Waterland@Sun.COM return (NULL);
329*9781SMoriah.Waterland@Sun.COM }
330*9781SMoriah.Waterland@Sun.COM
331*9781SMoriah.Waterland@Sun.COM if (!ADMSET(keystore)) {
332*9781SMoriah.Waterland@Sun.COM return (NULL);
333*9781SMoriah.Waterland@Sun.COM }
334*9781SMoriah.Waterland@Sun.COM
335*9781SMoriah.Waterland@Sun.COM return (adm.keystore);
336*9781SMoriah.Waterland@Sun.COM }
337