1 /*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the name of the University nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * $FreeBSD$ 33 */ 34 35 #ifndef _NFS_RPCV2_H_ 36 #define _NFS_RPCV2_H_ 37 38 /* 39 * Definitions for Sun RPC Version 2, from 40 * "RPC: Remote Procedure Call Protocol Specification" RFC1057 41 */ 42 43 /* Version # */ 44 #define RPC_VER2 2 45 46 /* Authentication flavours */ 47 #define RPCAUTH_NULL 0 48 #define RPCAUTH_UNIX 1 49 #define RPCAUTH_SHORT 2 50 #define RPCAUTH_KERB4 4 51 #define RPCAUTH_GSS 6 52 #define RPCAUTH_GSSKRB5 390003 53 #define RPCAUTH_GSSKRB5INTEGRITY 390004 54 #define RPCAUTH_GSSKRB5PRIVACY 390005 55 56 #define RPCAUTH_MAXSIZ 400 57 #define RPCVERF_MAXSIZ 12 /* For Kerb, can actually be 400 */ 58 59 /* 60 * RPCAUTH_UNIX defs. 61 */ 62 #define RPCAUTHUNIX_MINSIZ (5 * NFSX_UNSIGNED) 63 #define RPCAUTH_UNIXGIDS 16 64 65 /* 66 * RPCAUTH_GSS defs. 67 */ 68 #define RPCAUTHGSS_VERS1 1 69 70 #define RPCAUTHGSS_DATA 0 71 #define RPCAUTHGSS_INIT 1 72 #define RPCAUTHGSS_CONTINIT 2 73 #define RPCAUTHGSS_DESTROY 3 74 75 #define RPCAUTHGSS_SVCNONE 1 76 #define RPCAUTHGSS_SVCINTEGRITY 2 77 #define RPCAUTHGSS_SVCPRIVACY 3 78 79 #define RPCAUTHGSS_MAXSEQ 0x80000000 80 81 #define RPCAUTHGSS_WINDOW 64 /* # of bits in u_int64_t */ 82 #define RPCAUTHGSS_SEQWINDOW (RPCAUTHGSS_WINDOW + 1) 83 84 #define RPCAUTHGSS_MIC 1 85 #define RPCAUTHGSS_WRAP 2 86 87 /* 88 * Qop values for the types of security services. 89 */ 90 #define GSS_KERBV_QOP 0 91 92 /* 93 * Sizes of GSS stuff. 94 */ 95 #define RPCGSS_KEYSIZ 8 96 97 #define GSSX_AUTHHEAD (5 * NFSX_UNSIGNED) 98 #define GSSX_MYHANDLE (sizeof (long) + sizeof (u_int64_t)) 99 #define GSSX_RPCHEADER (13 * NFSX_UNSIGNED + GSSX_MYHANDLE) 100 #define GSSX_MINWRAP (2 * NFSX_UNSIGNED) 101 #define GSSX_KERBVTOKEN 24 102 #define GSSX_LOCALHANDLE (sizeof (void *)) 103 104 /* 105 * Stuff for the gssd. 106 */ 107 #define RPCPROG_GSSD 0x20101010 108 #define RPCGSSD_VERS 1 109 #define RPCGSSD_INIT 1 110 #define RPCGSSD_CONTINIT 2 111 #define RPCGSSD_CONTINITDESTROY 3 112 #define RPCGSSD_CLINIT 4 113 #define RPCGSSD_CLINITUID 5 114 #define RPCGSSD_CLCONT 6 115 #define RPCGSSD_CLCONTUID 7 116 #define RPCGSSD_CLINITNAME 8 117 #define RPCGSSD_CLCONTNAME 9 118 119 /* 120 * Stuff for the nfsuserd 121 */ 122 #define RPCPROG_NFSUSERD 0x21010101 123 #define RPCNFSUSERD_VERS 1 124 #define RPCNFSUSERD_GETUID 1 125 #define RPCNFSUSERD_GETGID 2 126 #define RPCNFSUSERD_GETUSER 3 127 #define RPCNFSUSERD_GETGROUP 4 128 129 /* 130 * Some major status codes. 131 */ 132 #if !defined(_GSSAPI_H_) && !defined(GSSAPI_H_) && !defined(_GSSAPI_GSSAPI_H_) && !defined(_RPCSEC_GSS_H) 133 #define GSS_S_COMPLETE 0x00000000 134 #define GSS_S_CONTINUE_NEEDED 0x00000001 135 #define GSS_S_DUPLICATE_TOKEN 0x00000002 136 #define GSS_S_OLD_TOKEN 0x00000004 137 #define GSS_S_UNSEQ_TOKEN 0x00000008 138 #define GSS_S_GAP_TOKEN 0x00000010 139 #define GSS_S_BAD_MECH 0x00010000 140 #define GSS_S_BAD_NAME 0x00020000 141 #define GSS_S_BAD_NAMETYPE 0x00030000 142 #define GSS_S_BAD_BINDINGS 0x00040000 143 #define GSS_S_BAD_STATUS 0x00050000 144 #define GSS_S_BAD_MIC 0x00060000 145 #define GSS_S_BAD_SIG 0x00060000 146 #define GSS_S_NO_CRED 0x00070000 147 #define GSS_S_NO_CONTEXT 0x00080000 148 #define GSS_S_DEFECTIVE_TOKEN 0x00090000 149 #define GSS_S_DEFECTIVE_CREDENTIAL 0x000a0000 150 #define GSS_S_CREDENTIALS_EXPIRED 0x000b0000 151 #define GSS_S_CONTEXT_EXPIRED 0x000c0000 152 #define GSS_S_FAILURE 0x000d0000 153 #define GSS_S_BAD_QOP 0x000e0000 154 #define GSS_S_UNAUTHORIZED 0x000f0000 155 #define GSS_S_UNAVAILABLE 0x00100000 156 #define GSS_S_DUPLICATE_ELEMENT 0x00110000 157 #define GSS_S_NAME_NOT_MN 0x00120000 158 #define GSS_S_CALL_INACCESSIBLE_READ 0x01000000 159 #define GSS_S_CALL_INACCESSIBLE_WRITE 0x02000000 160 #define GSS_S_CALL_BAD_STRUCTURE 0x03000000 161 #endif /* _GSSAPI_H_ */ 162 163 /* Rpc Constants */ 164 #define RPC_CALL 0 165 #define RPC_REPLY 1 166 #define RPC_MSGACCEPTED 0 167 #define RPC_MSGDENIED 1 168 #define RPC_PROGUNAVAIL 1 169 #define RPC_PROGMISMATCH 2 170 #define RPC_PROCUNAVAIL 3 171 #define RPC_GARBAGE 4 /* I like this one */ 172 #define RPC_MISMATCH 0 173 #define RPC_AUTHERR 1 174 175 /* Authentication failures */ 176 #define AUTH_BADCRED 1 177 #define AUTH_REJECTCRED 2 178 #define AUTH_BADVERF 3 179 #define AUTH_REJECTVERF 4 180 #define AUTH_TOOWEAK 5 /* Give em wheaties */ 181 #define AUTH_PROBCRED 13 182 #define AUTH_CTXCRED 14 183 184 /* Sizes of rpc header parts */ 185 #define RPC_SIZ 24 186 #define RPC_REPLYSIZ 28 187 188 /* RPC Prog definitions */ 189 #define RPCPROG_MNT 100005 190 #define RPCMNT_VER1 1 191 #define RPCMNT_VER3 3 192 #define RPCMNT_MOUNT 1 193 #define RPCMNT_DUMP 2 194 #define RPCMNT_UMOUNT 3 195 #define RPCMNT_UMNTALL 4 196 #define RPCMNT_EXPORT 5 197 #define RPCMNT_NAMELEN 255 198 #define RPCMNT_PATHLEN 1024 199 #define RPCPROG_NFS 100003 200 201 /* Structs for common parts of the rpc's */ 202 struct rpcv2_time { 203 u_int32_t rpc_sec; 204 u_int32_t rpc_usec; 205 }; 206 207 #endif /* _NFS_RPCV2_H_ */ 208