xref: /illumos-gate/usr/src/uts/common/nfs/nfs_sec.h (revision dd72704bd9e794056c558153663c739e2012d721)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * nfs_sec.h, NFS specific security service information.
29  */
30 
31 #ifndef	_NFS_SEC_H
32 #define	_NFS_SEC_H
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #include <rpc/rpcsec_gss.h>
39 
40 #ifndef _KERNEL
41 #define	NFSSEC_CONF	"/etc/nfssec.conf"
42 #define	SC_FAILURE	-1
43 /*
44  * An error string produced by nfs_syslog_scerr can be no longer than
45  * MAXMSGLEN
46  */
47 #define	MAXMSGLEN	80
48 
49 /*
50  *  Errors for the nfssec_*
51  */
52 #define	SC_NOERROR	0
53 #define	SC_NOMEM	1
54 #define	SC_OPENFAIL	2
55 #define	SC_NOTFOUND	3
56 #define	SC_BADENTRIES	4	/* Bad entries in nfssec.conf file */
57 #endif /* _KERNEL */
58 
59 typedef struct seconfig {
60 	char		sc_name[MAX_NAME_LEN];
61 	int		sc_nfsnum;
62 	int		sc_rpcnum;
63 	char		sc_gss_mech[MAX_NAME_LEN];
64 	struct rpc_gss_OID_s	*sc_gss_mech_type;
65 	uint_t		sc_qop;
66 	rpc_gss_service_t	sc_service;
67 	uid_t		sc_uid;
68 } seconfig_t;
69 
70 #ifdef _SYSCALL32
71 typedef struct seconfig32 {
72 	char		sc_name[MAX_NAME_LEN];
73 	int32_t		sc_nfsnum;
74 	int32_t		sc_rpcnum;
75 	char		sc_gss_mech[MAX_NAME_LEN];
76 	caddr32_t	sc_gss_mech_type;
77 	uint32_t	sc_qop;
78 	int32_t		sc_service;
79 	uid_t		sc_uid;
80 } seconfig32_t;
81 #endif /* _SYSCALL32 */
82 
83 #ifndef _KERNEL
84 extern int nfs_getseconfig_default(seconfig_t *);
85 extern int nfs_getseconfig_byname(char *, seconfig_t *);
86 extern int nfs_getseconfig_bynumber(int, seconfig_t *);
87 extern int nfs_getseconfig_bydesc(char *, char *, rpc_gss_service_t,
88     seconfig_t *);
89 extern sec_data_t *nfs_clnt_secdata(seconfig_t *, char *, struct knetconfig *,
90     struct netbuf *, int);
91 extern void nfs_free_secdata(sec_data_t *);
92 extern int nfs_syslog_scerr(int, char[]);
93 extern bool_t nfs_get_root_principal(seconfig_t *, char *, caddr_t *);
94 #endif /* _KERNEL */
95 
96 #ifdef	__cplusplus
97 }
98 #endif
99 
100 #endif	/* !_NFS_SEC_H */
101