xref: /titanic_51/usr/src/uts/common/nfs/nfs_sec.h (revision 1e49577a7fcde812700ded04431b49d67cc57d6d)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #include <rpc/rpcsec_gss.h>
41 
42 #ifndef _KERNEL
43 #define	NFSSEC_CONF	"/etc/nfssec.conf"
44 #define	SC_FAILURE	-1
45 /*
46  * An error string produced by nfs_syslog_scerr can be no longer than
47  * MAXMSGLEN
48  */
49 #define	MAXMSGLEN	80
50 
51 /*
52  *  Errors for the nfssec_*
53  */
54 #define	SC_NOERROR	0
55 #define	SC_NOMEM	1
56 #define	SC_OPENFAIL	2
57 #define	SC_NOTFOUND	3
58 #define	SC_BADENTRIES	4	/* Bad entries in nfssec.conf file */
59 #endif /* _KERNEL */
60 
61 typedef struct seconfig {
62 	char		sc_name[MAX_NAME_LEN];
63 	int		sc_nfsnum;
64 	int		sc_rpcnum;
65 	char		sc_gss_mech[MAX_NAME_LEN];
66 	struct rpc_gss_OID_s	*sc_gss_mech_type;
67 	uint_t		sc_qop;
68 	rpc_gss_service_t	sc_service;
69 	uid_t		sc_uid;
70 } seconfig_t;
71 
72 #ifdef _SYSCALL32
73 typedef struct seconfig32 {
74 	char		sc_name[MAX_NAME_LEN];
75 	int32_t		sc_nfsnum;
76 	int32_t		sc_rpcnum;
77 	char		sc_gss_mech[MAX_NAME_LEN];
78 	caddr32_t	sc_gss_mech_type;
79 	uint32_t	sc_qop;
80 	int32_t		sc_service;
81 	uid_t		sc_uid;
82 } seconfig32_t;
83 #endif /* _SYSCALL32 */
84 
85 #ifndef _KERNEL
86 extern int nfs_getseconfig_default(seconfig_t *);
87 extern int nfs_getseconfig_byname(char *, seconfig_t *);
88 extern int nfs_getseconfig_bynumber(int, seconfig_t *);
89 extern int nfs_getseconfig_bydesc(char *, char *, rpc_gss_service_t,
90     seconfig_t *);
91 extern sec_data_t *nfs_clnt_secdata(seconfig_t *, char *, struct knetconfig *,
92     struct netbuf *, int);
93 extern void nfs_free_secdata(sec_data_t *);
94 extern int nfs_syslog_scerr(int, char[]);
95 extern bool_t nfs_get_root_principal(seconfig_t *, char *, caddr_t *);
96 #endif /* _KERNEL */
97 
98 #ifdef	__cplusplus
99 }
100 #endif
101 
102 #endif	/* !_NFS_SEC_H */
103