xref: /onnv-gate/usr/src/uts/common/nfs/nfs_sec.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate /*
28*0Sstevel@tonic-gate  * nfs_sec.h, NFS specific security service information.
29*0Sstevel@tonic-gate  */
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate #ifndef	_NFS_SEC_H
32*0Sstevel@tonic-gate #define	_NFS_SEC_H
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #ifdef	__cplusplus
37*0Sstevel@tonic-gate extern "C" {
38*0Sstevel@tonic-gate #endif
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate #include <rpc/rpcsec_gss.h>
41*0Sstevel@tonic-gate 
42*0Sstevel@tonic-gate #ifndef _KERNEL
43*0Sstevel@tonic-gate #define	NFSSEC_CONF	"/etc/nfssec.conf"
44*0Sstevel@tonic-gate #define	SC_FAILURE	-1
45*0Sstevel@tonic-gate /*
46*0Sstevel@tonic-gate  * An error string produced by nfs_syslog_scerr can be no longer than
47*0Sstevel@tonic-gate  * MAXMSGLEN
48*0Sstevel@tonic-gate  */
49*0Sstevel@tonic-gate #define	MAXMSGLEN	80
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate /*
52*0Sstevel@tonic-gate  *  Errors for the nfssec_*
53*0Sstevel@tonic-gate  */
54*0Sstevel@tonic-gate #define	SC_NOERROR	0
55*0Sstevel@tonic-gate #define	SC_NOMEM	1
56*0Sstevel@tonic-gate #define	SC_OPENFAIL	2
57*0Sstevel@tonic-gate #define	SC_NOTFOUND	3
58*0Sstevel@tonic-gate #define	SC_BADENTRIES	4	/* Bad entries in nfssec.conf file */
59*0Sstevel@tonic-gate #endif /* _KERNEL */
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate typedef struct seconfig {
62*0Sstevel@tonic-gate 	char		sc_name[MAX_NAME_LEN];
63*0Sstevel@tonic-gate 	int		sc_nfsnum;
64*0Sstevel@tonic-gate 	int		sc_rpcnum;
65*0Sstevel@tonic-gate 	char		sc_gss_mech[MAX_NAME_LEN];
66*0Sstevel@tonic-gate 	struct rpc_gss_OID_s	*sc_gss_mech_type;
67*0Sstevel@tonic-gate 	uint_t		sc_qop;
68*0Sstevel@tonic-gate 	rpc_gss_service_t	sc_service;
69*0Sstevel@tonic-gate 	uid_t		sc_uid;
70*0Sstevel@tonic-gate } seconfig_t;
71*0Sstevel@tonic-gate 
72*0Sstevel@tonic-gate #ifdef _SYSCALL32
73*0Sstevel@tonic-gate typedef struct seconfig32 {
74*0Sstevel@tonic-gate 	char		sc_name[MAX_NAME_LEN];
75*0Sstevel@tonic-gate 	int32_t		sc_nfsnum;
76*0Sstevel@tonic-gate 	int32_t		sc_rpcnum;
77*0Sstevel@tonic-gate 	char		sc_gss_mech[MAX_NAME_LEN];
78*0Sstevel@tonic-gate 	caddr32_t	sc_gss_mech_type;
79*0Sstevel@tonic-gate 	uint32_t	sc_qop;
80*0Sstevel@tonic-gate 	int32_t		sc_service;
81*0Sstevel@tonic-gate 	uid_t		sc_uid;
82*0Sstevel@tonic-gate } seconfig32_t;
83*0Sstevel@tonic-gate #endif /* _SYSCALL32 */
84*0Sstevel@tonic-gate 
85*0Sstevel@tonic-gate #ifndef _KERNEL
86*0Sstevel@tonic-gate extern int nfs_getseconfig_default(seconfig_t *);
87*0Sstevel@tonic-gate extern int nfs_getseconfig_byname(char *, seconfig_t *);
88*0Sstevel@tonic-gate extern int nfs_getseconfig_bynumber(int, seconfig_t *);
89*0Sstevel@tonic-gate extern int nfs_getseconfig_bydesc(char *, char *, rpc_gss_service_t,
90*0Sstevel@tonic-gate     seconfig_t *);
91*0Sstevel@tonic-gate extern sec_data_t *nfs_clnt_secdata(seconfig_t *, char *, struct knetconfig *,
92*0Sstevel@tonic-gate     struct netbuf *, int);
93*0Sstevel@tonic-gate extern void nfs_free_secdata(sec_data_t *);
94*0Sstevel@tonic-gate extern int nfs_syslog_scerr(int, char[]);
95*0Sstevel@tonic-gate extern bool_t nfs_get_root_principal(seconfig_t *, char *, caddr_t *);
96*0Sstevel@tonic-gate #endif /* _KERNEL */
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate #ifdef	__cplusplus
99*0Sstevel@tonic-gate }
100*0Sstevel@tonic-gate #endif
101*0Sstevel@tonic-gate 
102*0Sstevel@tonic-gate #endif	/* !_NFS_SEC_H */
103