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 1991-2001, 2003 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 #pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate #include <string.h> 30*0Sstevel@tonic-gate #include <sys/types.h> 31*0Sstevel@tonic-gate #include <sys/tiuser.h> 32*0Sstevel@tonic-gate #include <rpc/types.h> 33*0Sstevel@tonic-gate #include <rpc/xdr.h> 34*0Sstevel@tonic-gate #include <rpc/auth.h> 35*0Sstevel@tonic-gate #include <rpc/clnt.h> 36*0Sstevel@tonic-gate #include <rpc/rpc_msg.h> 37*0Sstevel@tonic-gate #include "snoop.h" 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate #define RPC_TRANSIENT_START 0x40000000 40*0Sstevel@tonic-gate #define RPC_TRANSIENT_END 0x5fffffff 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate int rpcsec_gss_control_proc(int type, int flags, int xid); 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate int rpcsec_gss_pre_proto(int type, int flags, int xid, 45*0Sstevel@tonic-gate int prog, int vers, int proc); 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gate void rpcsec_gss_post_proto(int flags, int xid); 48*0Sstevel@tonic-gate 49*0Sstevel@tonic-gate void 50*0Sstevel@tonic-gate protoprint(flags, type, xid, prog, vers, proc, data, len) 51*0Sstevel@tonic-gate ulong_t xid; 52*0Sstevel@tonic-gate int flags, type, prog, vers, proc; 53*0Sstevel@tonic-gate char *data; 54*0Sstevel@tonic-gate int len; 55*0Sstevel@tonic-gate { 56*0Sstevel@tonic-gate char *name; 57*0Sstevel@tonic-gate void (*interpreter)(int, int, int, int, int, char *, int); 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate switch (prog) { 60*0Sstevel@tonic-gate case 100000: interpreter = interpret_pmap; break; 61*0Sstevel@tonic-gate case 100001: interpreter = interpret_rstat; break; 62*0Sstevel@tonic-gate case 100003: interpreter = interpret_nfs; break; 63*0Sstevel@tonic-gate case 100004: interpreter = interpret_nis; break; 64*0Sstevel@tonic-gate case 100005: interpreter = interpret_mount; break; 65*0Sstevel@tonic-gate case 100007: interpreter = interpret_nisbind; break; 66*0Sstevel@tonic-gate case 100011: interpreter = interpret_rquota; break; 67*0Sstevel@tonic-gate case 100021: interpreter = interpret_nlm; break; 68*0Sstevel@tonic-gate case 100026: interpreter = interpret_bparam; break; 69*0Sstevel@tonic-gate case 100227: interpreter = interpret_nfs_acl; break; 70*0Sstevel@tonic-gate case 100300: interpreter = interpret_nisplus; break; 71*0Sstevel@tonic-gate case 100302: interpreter = interpret_nisp_cb; break; 72*0Sstevel@tonic-gate case 150006: interpreter = interpret_solarnet_fw; break; 73*0Sstevel@tonic-gate default: interpreter = NULL; 74*0Sstevel@tonic-gate } 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate /* 77*0Sstevel@tonic-gate * if rpc in transient range and proc is 0 or 1, then 78*0Sstevel@tonic-gate * guess that it is the nfsv4 callback protocol 79*0Sstevel@tonic-gate */ 80*0Sstevel@tonic-gate if (prog >= RPC_TRANSIENT_START && prog <= RPC_TRANSIENT_END && 81*0Sstevel@tonic-gate (proc == 0 || proc == 1)) 82*0Sstevel@tonic-gate interpreter = interpret_nfs4_cb; 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate /* 85*0Sstevel@tonic-gate * If the RPC header indicates it's using the RPCSEC_GSS_* 86*0Sstevel@tonic-gate * control procedure, print it. 87*0Sstevel@tonic-gate */ 88*0Sstevel@tonic-gate if (rpcsec_gss_control_proc(type, flags, xid)) { 89*0Sstevel@tonic-gate return; 90*0Sstevel@tonic-gate } 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate if (interpreter == NULL) { 93*0Sstevel@tonic-gate if (!(flags & F_SUM)) 94*0Sstevel@tonic-gate return; 95*0Sstevel@tonic-gate name = nameof_prog(prog); 96*0Sstevel@tonic-gate if (*name == '?' || strcmp(name, "transient") == 0) 97*0Sstevel@tonic-gate return; 98*0Sstevel@tonic-gate (void) sprintf(get_sum_line(), "%s %c", 99*0Sstevel@tonic-gate name, 100*0Sstevel@tonic-gate type == CALL ? 'C' : 'R'); 101*0Sstevel@tonic-gate } else { 102*0Sstevel@tonic-gate /* Pre-processing based on different RPCSEC_GSS services. */ 103*0Sstevel@tonic-gate if (rpcsec_gss_pre_proto(type, flags, xid, prog, vers, proc)) 104*0Sstevel@tonic-gate return; 105*0Sstevel@tonic-gate 106*0Sstevel@tonic-gate (*interpreter) (flags, type, xid, vers, proc, data, len); 107*0Sstevel@tonic-gate 108*0Sstevel@tonic-gate /* Post-processing based on different RPCSEC_GSS services. */ 109*0Sstevel@tonic-gate rpcsec_gss_post_proto(flags, xid); 110*0Sstevel@tonic-gate } 111*0Sstevel@tonic-gate } 112