4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 #include <sys/types.h>
31 #include <nfs/nfs_sec.h>
40 * Method: nfssec_free_secmode_list
42 * Description: Frees the space allocated for the security mode list array.
45 * - char **seclist - the array to be freed.
46 * - int num_elements - the number of elements in the array.
52 nfssec_free_secmode_list(char **seclist
, int num_elements
)
54 fileutil_free_string_array(seclist
, num_elements
);
55 } /* nfssec_free_secmode_list */
58 * Method: nfssec_get_default_secmode
60 * Description: Retrieves the default security mode for NFS.
63 * - int *errp - the error indicator. This will be set to a non-zero
67 * - char * - the NFS security mode name.
68 * - NULL if an error occurred.
70 * Note: Caller must free the space allocated for the return value.
73 nfssec_get_default_secmode(int *errp
)
75 seconfig_t secp
, defsecp
;
80 err
= nfs_getseconfig_default(&secp
);
86 err
= nfs_getseconfig_bynumber(secp
.sc_nfsnum
, &defsecp
);
92 ret_val
= strdup(defsecp
.sc_name
);
93 if (ret_val
== NULL
) {
99 } /* nfssec_get_default_secmode */
102 * Method: nfssec_get_nfs_secmode_list
104 * Description: Retrieves a list of the supported NFS security modes from
108 * - int *num_elements - integer pointer used to keep track of the number
109 * of elements in the array.
110 * - int *errp - the error indicator. This will be set to a non-zero
114 * - char ** - The array containing the supported security mode names as
116 * - NULL if an error occurred.
118 * Note: The space allocated for the return array must be freed by the caller
119 * using nfssec_free_secmode_list.
122 nfssec_get_nfs_secmode_list(int *num_elements
, int *errp
)
125 char **seclist
= NULL
;
129 if ((fp
= fopen(NFSSEC_CONF
, "r")) == NULL
) {
131 * The opening of nfssec.conf failed.
137 seclist
= fileutil_get_first_column_data(fp
, num_elements
, &err
);
139 if (seclist
== NULL
) {
145 } /* nfssec_get_nfs_secmode_list */