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