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-1998,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 <sys/types.h> 30*0Sstevel@tonic-gate #include <sys/errno.h> 31*0Sstevel@tonic-gate #include <setjmp.h> 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate #include <netinet/in.h> 34*0Sstevel@tonic-gate #include <netdb.h> 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #include <sys/tiuser.h> 37*0Sstevel@tonic-gate #include <rpc/types.h> 38*0Sstevel@tonic-gate #include <rpc/xdr.h> 39*0Sstevel@tonic-gate #include <rpc/auth.h> 40*0Sstevel@tonic-gate #include <rpc/auth_unix.h> 41*0Sstevel@tonic-gate #include <rpc/auth_des.h> 42*0Sstevel@tonic-gate #include <rpc/clnt.h> 43*0Sstevel@tonic-gate #include <rpc/rpc_msg.h> 44*0Sstevel@tonic-gate #include <rpc/pmap_clnt.h> 45*0Sstevel@tonic-gate #include <rpc/svc.h> 46*0Sstevel@tonic-gate #include <rpcsvc/yp_prot.h> 47*0Sstevel@tonic-gate #include <rpc/pmap_prot.h> 48*0Sstevel@tonic-gate #include "snoop.h" 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate #ifndef MIN 51*0Sstevel@tonic-gate #define MIN(a, b) ((a) < (b) ? (a) : (b)) 52*0Sstevel@tonic-gate #endif 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gate int pos; 55*0Sstevel@tonic-gate struct cache_struct *find_xid(); 56*0Sstevel@tonic-gate extern jmp_buf xdr_err; 57*0Sstevel@tonic-gate void protoprint(); 58*0Sstevel@tonic-gate void print_rpcsec_gss_cred(int xid, int authlen); 59*0Sstevel@tonic-gate char *nameof_prog(); 60*0Sstevel@tonic-gate char *nameof_astat(); 61*0Sstevel@tonic-gate char *nameof_why(); 62*0Sstevel@tonic-gate 63*0Sstevel@tonic-gate #define LAST_FRAG ((ulong_t)1 << 31) 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate interpret_rpc(flags, rpc, fraglen, type) 66*0Sstevel@tonic-gate int flags; 67*0Sstevel@tonic-gate char *rpc; 68*0Sstevel@tonic-gate int fraglen, type; 69*0Sstevel@tonic-gate { 70*0Sstevel@tonic-gate ulong_t xid; 71*0Sstevel@tonic-gate int direction; 72*0Sstevel@tonic-gate struct cache_struct *x; 73*0Sstevel@tonic-gate int rpcvers, prog, vers, proc; 74*0Sstevel@tonic-gate int status, astat, rstat, why; 75*0Sstevel@tonic-gate char *lp; 76*0Sstevel@tonic-gate unsigned recmark; 77*0Sstevel@tonic-gate int markpos; 78*0Sstevel@tonic-gate extern int pi_frame; 79*0Sstevel@tonic-gate int lo, hi; 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gate xdr_init(rpc, fraglen); 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gate if (setjmp(xdr_err)) { 84*0Sstevel@tonic-gate if (flags & F_DTAIL) 85*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 86*0Sstevel@tonic-gate "---- short frame ---"); 87*0Sstevel@tonic-gate return (fraglen); 88*0Sstevel@tonic-gate } 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate if (type == IPPROTO_TCP) { /* record mark */ 91*0Sstevel@tonic-gate markpos = getxdr_pos(); 92*0Sstevel@tonic-gate recmark = getxdr_long(); 93*0Sstevel@tonic-gate } 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate xid = getxdr_u_long(); 96*0Sstevel@tonic-gate direction = getxdr_long(); 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gate if (direction == CALL) { 99*0Sstevel@tonic-gate rpcvers = getxdr_long(); 100*0Sstevel@tonic-gate pos = getxdr_pos(); 101*0Sstevel@tonic-gate prog = getxdr_long(); 102*0Sstevel@tonic-gate vers = getxdr_long(); 103*0Sstevel@tonic-gate proc = getxdr_long(); 104*0Sstevel@tonic-gate stash_xid(xid, pi_frame, prog, vers, proc); 105*0Sstevel@tonic-gate if (!(flags & (F_SUM | F_DTAIL))) 106*0Sstevel@tonic-gate protoprint(flags, CALL, xid, prog, vers, proc, 107*0Sstevel@tonic-gate rpc, fraglen); 108*0Sstevel@tonic-gate } else { 109*0Sstevel@tonic-gate x = find_xid(xid); 110*0Sstevel@tonic-gate } 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate if (flags & F_SUM) { 113*0Sstevel@tonic-gate switch (direction) { 114*0Sstevel@tonic-gate case CALL: 115*0Sstevel@tonic-gate (void) sprintf(get_sum_line(), 116*0Sstevel@tonic-gate "RPC C XID=%lu PROG=%d (%s) VERS=%d PROC=%d", 117*0Sstevel@tonic-gate xid, 118*0Sstevel@tonic-gate prog, nameof_prog(prog), 119*0Sstevel@tonic-gate vers, proc); 120*0Sstevel@tonic-gate if (getxdr_long() == RPCSEC_GSS) { /* Cred auth type */ 121*0Sstevel@tonic-gate extract_rpcsec_gss_cred_info(xid); 122*0Sstevel@tonic-gate /* RPCSEC_GSS cred auth data */ 123*0Sstevel@tonic-gate } else { 124*0Sstevel@tonic-gate xdr_skip(getxdr_long()); 125*0Sstevel@tonic-gate /* non RPCSEC_GSS cred auth data */ 126*0Sstevel@tonic-gate } 127*0Sstevel@tonic-gate xdr_skip(4); /* Verf auth type */ 128*0Sstevel@tonic-gate xdr_skip(RNDUP(getxdr_long())); /* Verf auth data */ 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gate protoprint(flags, CALL, xid, prog, vers, proc, 131*0Sstevel@tonic-gate rpc, fraglen); 132*0Sstevel@tonic-gate break; 133*0Sstevel@tonic-gate 134*0Sstevel@tonic-gate case REPLY: 135*0Sstevel@tonic-gate lp = get_sum_line(); 136*0Sstevel@tonic-gate if (x == NULL) 137*0Sstevel@tonic-gate (void) sprintf(lp, "RPC R XID=%lu", xid); 138*0Sstevel@tonic-gate else 139*0Sstevel@tonic-gate (void) sprintf(lp, "RPC R (#%d) XID=%lu", 140*0Sstevel@tonic-gate x->xid_frame, xid); 141*0Sstevel@tonic-gate 142*0Sstevel@tonic-gate lp += strlen(lp); 143*0Sstevel@tonic-gate status = getxdr_long(); 144*0Sstevel@tonic-gate switch (status) { 145*0Sstevel@tonic-gate case MSG_ACCEPTED: 146*0Sstevel@tonic-gate /* eat flavor and verifier */ 147*0Sstevel@tonic-gate (void) getxdr_long(); 148*0Sstevel@tonic-gate xdr_skip(RNDUP(getxdr_long())); 149*0Sstevel@tonic-gate astat = getxdr_long(); 150*0Sstevel@tonic-gate (void) sprintf(lp, " %s", 151*0Sstevel@tonic-gate nameof_astat(astat)); 152*0Sstevel@tonic-gate lp += strlen(lp); 153*0Sstevel@tonic-gate 154*0Sstevel@tonic-gate switch (astat) { 155*0Sstevel@tonic-gate case SUCCESS: 156*0Sstevel@tonic-gate if (x) { 157*0Sstevel@tonic-gate protoprint(flags, REPLY, 158*0Sstevel@tonic-gate xid, 159*0Sstevel@tonic-gate x->xid_prog, 160*0Sstevel@tonic-gate x->xid_vers, 161*0Sstevel@tonic-gate x->xid_proc, 162*0Sstevel@tonic-gate rpc, fraglen); 163*0Sstevel@tonic-gate } 164*0Sstevel@tonic-gate break; 165*0Sstevel@tonic-gate 166*0Sstevel@tonic-gate case PROG_UNAVAIL : 167*0Sstevel@tonic-gate case PROG_MISMATCH: 168*0Sstevel@tonic-gate case PROC_UNAVAIL : 169*0Sstevel@tonic-gate lo = getxdr_long(); 170*0Sstevel@tonic-gate hi = getxdr_long(); 171*0Sstevel@tonic-gate (void) sprintf(lp, 172*0Sstevel@tonic-gate " (low=%d, high=%d)", 173*0Sstevel@tonic-gate lo, hi); 174*0Sstevel@tonic-gate break; 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate case GARBAGE_ARGS: 177*0Sstevel@tonic-gate case SYSTEM_ERR: 178*0Sstevel@tonic-gate default: 179*0Sstevel@tonic-gate ; 180*0Sstevel@tonic-gate } 181*0Sstevel@tonic-gate break; 182*0Sstevel@tonic-gate 183*0Sstevel@tonic-gate case MSG_DENIED: 184*0Sstevel@tonic-gate rstat = getxdr_long(); 185*0Sstevel@tonic-gate 186*0Sstevel@tonic-gate switch (rstat) { 187*0Sstevel@tonic-gate case RPC_MISMATCH: 188*0Sstevel@tonic-gate lo = getxdr_long(); 189*0Sstevel@tonic-gate hi = getxdr_long(); 190*0Sstevel@tonic-gate (void) sprintf(lp, 191*0Sstevel@tonic-gate " Vers mismatch (low=%d, high=%d)", 192*0Sstevel@tonic-gate lo, hi); 193*0Sstevel@tonic-gate break; 194*0Sstevel@tonic-gate 195*0Sstevel@tonic-gate case AUTH_ERROR: 196*0Sstevel@tonic-gate why = getxdr_u_long(); 197*0Sstevel@tonic-gate (void) sprintf(lp, 198*0Sstevel@tonic-gate " Can't authenticate (%s)", 199*0Sstevel@tonic-gate nameof_why(why)); 200*0Sstevel@tonic-gate break; 201*0Sstevel@tonic-gate } 202*0Sstevel@tonic-gate } 203*0Sstevel@tonic-gate break; 204*0Sstevel@tonic-gate } 205*0Sstevel@tonic-gate } 206*0Sstevel@tonic-gate 207*0Sstevel@tonic-gate if (flags & F_DTAIL) { 208*0Sstevel@tonic-gate show_header("RPC: ", "SUN RPC Header", fraglen); 209*0Sstevel@tonic-gate show_space(); 210*0Sstevel@tonic-gate if (type == IPPROTO_TCP) { /* record mark */ 211*0Sstevel@tonic-gate (void) sprintf(get_line(markpos, markpos+4), 212*0Sstevel@tonic-gate "Record Mark: %s fragment, length = %d", 213*0Sstevel@tonic-gate recmark & LAST_FRAG ? "last" : "", 214*0Sstevel@tonic-gate recmark & ~LAST_FRAG); 215*0Sstevel@tonic-gate } 216*0Sstevel@tonic-gate 217*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 218*0Sstevel@tonic-gate "Transaction id = %lu", 219*0Sstevel@tonic-gate xid); 220*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 221*0Sstevel@tonic-gate "Type = %d (%s)", 222*0Sstevel@tonic-gate direction, 223*0Sstevel@tonic-gate direction == CALL ? "Call":"Reply"); 224*0Sstevel@tonic-gate 225*0Sstevel@tonic-gate switch (direction) { 226*0Sstevel@tonic-gate case CALL: 227*0Sstevel@tonic-gate rpc_detail_call(flags, xid, rpcvers, 228*0Sstevel@tonic-gate prog, vers, proc, rpc, fraglen); 229*0Sstevel@tonic-gate break; 230*0Sstevel@tonic-gate case REPLY: 231*0Sstevel@tonic-gate rpc_detail_reply(flags, xid, x, rpc, fraglen); 232*0Sstevel@tonic-gate break; 233*0Sstevel@tonic-gate } 234*0Sstevel@tonic-gate } 235*0Sstevel@tonic-gate 236*0Sstevel@tonic-gate return (fraglen); 237*0Sstevel@tonic-gate } 238*0Sstevel@tonic-gate 239*0Sstevel@tonic-gate rpc_detail_call(flags, xid, rpcvers, prog, vers, proc, data, len) 240*0Sstevel@tonic-gate int flags, xid, rpcvers, prog, vers, proc; 241*0Sstevel@tonic-gate char *data; 242*0Sstevel@tonic-gate int len; 243*0Sstevel@tonic-gate { 244*0Sstevel@tonic-gate char *nameof_flavor(); 245*0Sstevel@tonic-gate char *nameof_prog(); 246*0Sstevel@tonic-gate 247*0Sstevel@tonic-gate (void) sprintf(get_line(pos, getxdr_pos()), 248*0Sstevel@tonic-gate "RPC version = %d", 249*0Sstevel@tonic-gate rpcvers); 250*0Sstevel@tonic-gate (void) sprintf(get_line(pos, getxdr_pos()), 251*0Sstevel@tonic-gate "Program = %d (%s), version = %d, procedure = %d", 252*0Sstevel@tonic-gate prog, nameof_prog(prog), vers, proc); 253*0Sstevel@tonic-gate print_creds(xid); 254*0Sstevel@tonic-gate print_verif(CALL); 255*0Sstevel@tonic-gate show_trailer(); 256*0Sstevel@tonic-gate protoprint(flags, CALL, xid, prog, vers, proc, data, len); 257*0Sstevel@tonic-gate } 258*0Sstevel@tonic-gate 259*0Sstevel@tonic-gate char * 260*0Sstevel@tonic-gate nameof_flavor(flavor) 261*0Sstevel@tonic-gate int flavor; 262*0Sstevel@tonic-gate { 263*0Sstevel@tonic-gate switch (flavor) { 264*0Sstevel@tonic-gate case AUTH_NONE : return ("None"); 265*0Sstevel@tonic-gate case AUTH_UNIX : return ("Unix"); 266*0Sstevel@tonic-gate case AUTH_SHORT: return ("Unix short"); 267*0Sstevel@tonic-gate case AUTH_DES : return ("DES"); 268*0Sstevel@tonic-gate case RPCSEC_GSS: return ("RPCSEC_GSS"); 269*0Sstevel@tonic-gate default: return ("unknown"); 270*0Sstevel@tonic-gate } 271*0Sstevel@tonic-gate } 272*0Sstevel@tonic-gate 273*0Sstevel@tonic-gate char * 274*0Sstevel@tonic-gate tohex(char *p, int len) 275*0Sstevel@tonic-gate { 276*0Sstevel@tonic-gate int i, j; 277*0Sstevel@tonic-gate static char hbuff[1024]; 278*0Sstevel@tonic-gate static char *hexstr = "0123456789ABCDEF"; 279*0Sstevel@tonic-gate char toobig = 0; 280*0Sstevel@tonic-gate 281*0Sstevel@tonic-gate if (len * 2 > sizeof (hbuff)) { 282*0Sstevel@tonic-gate toobig++; 283*0Sstevel@tonic-gate len = sizeof (hbuff) / 2; 284*0Sstevel@tonic-gate } 285*0Sstevel@tonic-gate 286*0Sstevel@tonic-gate j = 0; 287*0Sstevel@tonic-gate for (i = 0; i < len; i++) { 288*0Sstevel@tonic-gate hbuff[j++] = hexstr[p[i] >> 4 & 0x0f]; 289*0Sstevel@tonic-gate hbuff[j++] = hexstr[p[i] & 0x0f]; 290*0Sstevel@tonic-gate } 291*0Sstevel@tonic-gate 292*0Sstevel@tonic-gate if (toobig) { 293*0Sstevel@tonic-gate hbuff[len * 2 - strlen("<Too Long>")] = '\0'; 294*0Sstevel@tonic-gate strcat(hbuff, "<Too Long>"); 295*0Sstevel@tonic-gate } else 296*0Sstevel@tonic-gate hbuff[j] = '\0'; 297*0Sstevel@tonic-gate 298*0Sstevel@tonic-gate return (hbuff); 299*0Sstevel@tonic-gate } 300*0Sstevel@tonic-gate 301*0Sstevel@tonic-gate print_creds(int xid) 302*0Sstevel@tonic-gate { 303*0Sstevel@tonic-gate int pos, flavor, authlen; 304*0Sstevel@tonic-gate int uid, gid, len; 305*0Sstevel@tonic-gate int tlen, idlen; 306*0Sstevel@tonic-gate int i, namekind; 307*0Sstevel@tonic-gate char *p, *line; 308*0Sstevel@tonic-gate 309*0Sstevel@tonic-gate pos = getxdr_pos(); 310*0Sstevel@tonic-gate flavor = getxdr_long(); 311*0Sstevel@tonic-gate authlen = getxdr_long(); 312*0Sstevel@tonic-gate (void) sprintf(get_line(pos, getxdr_pos()), 313*0Sstevel@tonic-gate "Credentials: Flavor = %d (%s), len = %d bytes", 314*0Sstevel@tonic-gate flavor, nameof_flavor(flavor), authlen); 315*0Sstevel@tonic-gate if (authlen <= 0) 316*0Sstevel@tonic-gate return; 317*0Sstevel@tonic-gate 318*0Sstevel@tonic-gate switch (flavor) { 319*0Sstevel@tonic-gate case AUTH_UNIX: 320*0Sstevel@tonic-gate (void) showxdr_time(" Time = %s"); 321*0Sstevel@tonic-gate (void) showxdr_string(MAX_MACHINE_NAME, " Hostname = %s"); 322*0Sstevel@tonic-gate pos = getxdr_pos(); 323*0Sstevel@tonic-gate uid = getxdr_u_long(); 324*0Sstevel@tonic-gate gid = getxdr_u_long(); 325*0Sstevel@tonic-gate (void) sprintf(get_line(pos, getxdr_pos()), 326*0Sstevel@tonic-gate " Uid = %d, Gid = %d", 327*0Sstevel@tonic-gate uid, gid); 328*0Sstevel@tonic-gate len = getxdr_u_long(); 329*0Sstevel@tonic-gate line = get_line(pos, len * 4); 330*0Sstevel@tonic-gate if (len == 0) 331*0Sstevel@tonic-gate (void) sprintf(line, " Groups = (none)"); 332*0Sstevel@tonic-gate else { 333*0Sstevel@tonic-gate (void) sprintf(line, " Groups = "); 334*0Sstevel@tonic-gate line += strlen(line); 335*0Sstevel@tonic-gate while (len--) { 336*0Sstevel@tonic-gate gid = getxdr_u_long(); 337*0Sstevel@tonic-gate (void) sprintf(line, "%d ", gid); 338*0Sstevel@tonic-gate line += strlen(line); 339*0Sstevel@tonic-gate } 340*0Sstevel@tonic-gate } 341*0Sstevel@tonic-gate break; 342*0Sstevel@tonic-gate 343*0Sstevel@tonic-gate case AUTH_DES: 344*0Sstevel@tonic-gate namekind = getxdr_u_long(); 345*0Sstevel@tonic-gate (void) sprintf(get_line(pos, getxdr_pos()), 346*0Sstevel@tonic-gate " Name kind = %d (%s)", 347*0Sstevel@tonic-gate namekind, 348*0Sstevel@tonic-gate namekind == ADN_FULLNAME ? 349*0Sstevel@tonic-gate "fullname" : "nickname"); 350*0Sstevel@tonic-gate switch (namekind) { 351*0Sstevel@tonic-gate case ADN_FULLNAME: 352*0Sstevel@tonic-gate (void) showxdr_string(64, 353*0Sstevel@tonic-gate " Network name = %s"); 354*0Sstevel@tonic-gate (void) showxdr_hex(8, 355*0Sstevel@tonic-gate " Conversation key = 0x%s (DES encrypted)"); 356*0Sstevel@tonic-gate (void) showxdr_hex(4, 357*0Sstevel@tonic-gate " Window = 0x%s (DES encrypted)"); 358*0Sstevel@tonic-gate break; 359*0Sstevel@tonic-gate 360*0Sstevel@tonic-gate case ADN_NICKNAME: 361*0Sstevel@tonic-gate (void) showxdr_hex(4, " Nickname = 0x%s"); 362*0Sstevel@tonic-gate break; 363*0Sstevel@tonic-gate }; 364*0Sstevel@tonic-gate break; 365*0Sstevel@tonic-gate 366*0Sstevel@tonic-gate case RPCSEC_GSS: 367*0Sstevel@tonic-gate print_rpcsec_gss_cred(xid, authlen); 368*0Sstevel@tonic-gate break; 369*0Sstevel@tonic-gate 370*0Sstevel@tonic-gate default: 371*0Sstevel@tonic-gate (void) showxdr_hex(authlen, "[%s]"); 372*0Sstevel@tonic-gate break; 373*0Sstevel@tonic-gate } 374*0Sstevel@tonic-gate } 375*0Sstevel@tonic-gate 376*0Sstevel@tonic-gate print_verif(direction) 377*0Sstevel@tonic-gate int direction; 378*0Sstevel@tonic-gate { 379*0Sstevel@tonic-gate int pos, flavor, verlen; 380*0Sstevel@tonic-gate 381*0Sstevel@tonic-gate pos = getxdr_pos(); 382*0Sstevel@tonic-gate flavor = getxdr_long(); 383*0Sstevel@tonic-gate verlen = getxdr_long(); 384*0Sstevel@tonic-gate (void) sprintf(get_line(pos, getxdr_pos()), 385*0Sstevel@tonic-gate "Verifier : Flavor = %d (%s), len = %d bytes", 386*0Sstevel@tonic-gate flavor, nameof_flavor(flavor), verlen); 387*0Sstevel@tonic-gate if (verlen == 0) 388*0Sstevel@tonic-gate return; 389*0Sstevel@tonic-gate 390*0Sstevel@tonic-gate switch (flavor) { 391*0Sstevel@tonic-gate case AUTH_DES: 392*0Sstevel@tonic-gate (void) showxdr_hex(8, " Timestamp = 0x%s (DES encrypted)"); 393*0Sstevel@tonic-gate if (direction == CALL) 394*0Sstevel@tonic-gate (void) showxdr_hex(4, 395*0Sstevel@tonic-gate " Window = 0x%s (DES encrypted)"); 396*0Sstevel@tonic-gate else 397*0Sstevel@tonic-gate (void) showxdr_hex(4, " Nickname = 0x%s"); 398*0Sstevel@tonic-gate break; 399*0Sstevel@tonic-gate 400*0Sstevel@tonic-gate /* For other flavors like AUTH_NONE, AUTH_UNIX, RPCSEC_GSS etc. */ 401*0Sstevel@tonic-gate default: 402*0Sstevel@tonic-gate (void) showxdr_hex(verlen, "[%s]"); 403*0Sstevel@tonic-gate break; 404*0Sstevel@tonic-gate } 405*0Sstevel@tonic-gate } 406*0Sstevel@tonic-gate 407*0Sstevel@tonic-gate struct rpcnames { 408*0Sstevel@tonic-gate int rp_prog; 409*0Sstevel@tonic-gate char *rp_name; 410*0Sstevel@tonic-gate } rpcnames[] = { 411*0Sstevel@tonic-gate 100000, "PMAP", /* Portmapper */ 412*0Sstevel@tonic-gate 100001, "RSTAT", /* Remote stats */ 413*0Sstevel@tonic-gate 100002, "RUSERS", /* Remote users */ 414*0Sstevel@tonic-gate 100003, "NFS", /* Nfs */ 415*0Sstevel@tonic-gate 100004, "NIS", /* Network Information Service */ 416*0Sstevel@tonic-gate 100005, "MOUNT", /* Mount demon */ 417*0Sstevel@tonic-gate 100006, "DBX", /* Remote dbx */ 418*0Sstevel@tonic-gate 100007, "NISBIND", /* NIS binder */ 419*0Sstevel@tonic-gate 100008, "WALL", /* Shutdown msg */ 420*0Sstevel@tonic-gate 100009, "NISPASSWD", /* Yppasswd server */ 421*0Sstevel@tonic-gate 100010, "ETHERSTAT", /* Ether stats */ 422*0Sstevel@tonic-gate 100011, "RQUOTA", /* Disk quotas */ 423*0Sstevel@tonic-gate 100012, "SPRAY", /* Spray packets */ 424*0Sstevel@tonic-gate 100013, "IBM3270", /* 3270 mapper */ 425*0Sstevel@tonic-gate 100014, "IBMRJE", /* RJE mapper */ 426*0Sstevel@tonic-gate 100015, "SELNSVC", /* Selection service */ 427*0Sstevel@tonic-gate 100016, "RDATABASE", /* Remote database access */ 428*0Sstevel@tonic-gate 100017, "REX", /* Remote execution */ 429*0Sstevel@tonic-gate 100018, "ALICE", /* Alice Office Automation */ 430*0Sstevel@tonic-gate 100019, "SCHED", /* Scheduling service */ 431*0Sstevel@tonic-gate 100020, "LLM", /* Local lock manager */ 432*0Sstevel@tonic-gate 100021, "NLM", /* Network lock manager */ 433*0Sstevel@tonic-gate 100022, "X25INR", /* X.25 inr protocol */ 434*0Sstevel@tonic-gate 100023, "STATMON1", /* Status monitor 1 */ 435*0Sstevel@tonic-gate 100024, "STATMON2", /* Status monitor 2 */ 436*0Sstevel@tonic-gate 100025, "SELNLIB", /* Selection library */ 437*0Sstevel@tonic-gate 100026, "BOOTPARAM", /* Boot parameters service */ 438*0Sstevel@tonic-gate 100027, "MAZEPROG", /* Mazewars game */ 439*0Sstevel@tonic-gate 100028, "NISUPDATE", /* NIS update */ 440*0Sstevel@tonic-gate 100029, "KEYSERVE", /* Key server */ 441*0Sstevel@tonic-gate 100030, "SECURECMD", /* Secure login */ 442*0Sstevel@tonic-gate 100031, "NETFWDI", /* NFS net forwarder init */ 443*0Sstevel@tonic-gate 100032, "NETFWDT", /* NFS net forwarder trans */ 444*0Sstevel@tonic-gate 100033, "SUNLINKMAP", /* Sunlink MAP */ 445*0Sstevel@tonic-gate 100034, "NETMON", /* Network monitor */ 446*0Sstevel@tonic-gate 100035, "DBASE", /* Lightweight database */ 447*0Sstevel@tonic-gate 100036, "PWDAUTH", /* Password authorization */ 448*0Sstevel@tonic-gate 100037, "TFS", /* Translucent file svc */ 449*0Sstevel@tonic-gate 100038, "NSE", /* NSE server */ 450*0Sstevel@tonic-gate 100039, "NSE_ACTIVATE", /* NSE activate daemon */ 451*0Sstevel@tonic-gate 100040, "SUNVIEW_HELP", /* Sunview help */ 452*0Sstevel@tonic-gate 100041, "PNP", /* PNP install */ 453*0Sstevel@tonic-gate 100042, "IPADDR_ALLOC", /* IP addr allocator */ 454*0Sstevel@tonic-gate 100043, "FILEHANDLE", /* Show filehandle */ 455*0Sstevel@tonic-gate 100044, "MVSNFS", /* MVS NFS mount */ 456*0Sstevel@tonic-gate 100045, "REM_FILEOP_USER", /* Remote user file operations */ 457*0Sstevel@tonic-gate 100046, "BATCH_NISUPDATE", /* Batched ypupdate */ 458*0Sstevel@tonic-gate 100047, "NEM", /* Network execution mgr */ 459*0Sstevel@tonic-gate 100048, "RAYTRACE_RD", /* Raytrace/mandelbrot remote daemon */ 460*0Sstevel@tonic-gate 100049, "RAYTRACE_LD", /* Raytrace/mandelbrot local daemon */ 461*0Sstevel@tonic-gate 100050, "REM_FILEOP_GROUP", /* Remote group file operations */ 462*0Sstevel@tonic-gate 100051, "REM_FILEOP_SYSTEM", /* Remote system file operations */ 463*0Sstevel@tonic-gate 100052, "REM_SYSTEM_ROLE", /* Remote system role operations */ 464*0Sstevel@tonic-gate 100055, "IOADMD", /* Ioadmd */ 465*0Sstevel@tonic-gate 100056, "FILEMERGE", /* Filemerge */ 466*0Sstevel@tonic-gate 100057, "NAMEBIND", /* Name Binding Program */ 467*0Sstevel@tonic-gate 100058, "NJE", /* Sunlink NJE */ 468*0Sstevel@tonic-gate 100059, "MVSATTR", /* MVSNFS get attribute service */ 469*0Sstevel@tonic-gate 100060, "RMGR", /* SunAccess/SunLink resource manager */ 470*0Sstevel@tonic-gate 100061, "UIDALLOC", /* UID allocation service */ 471*0Sstevel@tonic-gate 100062, "LBSERVER", /* License broker */ 472*0Sstevel@tonic-gate 100063, "LBBINDER", /* NETlicense client binder */ 473*0Sstevel@tonic-gate 100064, "GIDALLOC", /* GID allocation service */ 474*0Sstevel@tonic-gate 100065, "SUNISAM", /* SunIsam */ 475*0Sstevel@tonic-gate 100066, "RDBSRV", /* Remote Debug Server */ 476*0Sstevel@tonic-gate 100067, "NETDIR", /* Network directory daemon */ 477*0Sstevel@tonic-gate 100068, "CMSD", /* Network calendar program */ 478*0Sstevel@tonic-gate 100069, "NISXFR", /* NIS transfer */ 479*0Sstevel@tonic-gate 100070, "TIMED", /* RPC.timed */ 480*0Sstevel@tonic-gate 100071, "BUGTRAQ", /* Bugtraqd */ 481*0Sstevel@tonic-gate 100072, "NeFS", /* Internal use only */ 482*0Sstevel@tonic-gate 100073, "BILLBOARD", /* Connectathon Billboard - NFS */ 483*0Sstevel@tonic-gate 100074, "BILLBOARD", /* Connectathon Billboard - X */ 484*0Sstevel@tonic-gate 100075, "SCHEDROOM", /* Sun meeting room scheduler */ 485*0Sstevel@tonic-gate 100076, "AUTHNEGOTIATE", /* Authentication negotiation */ 486*0Sstevel@tonic-gate 100077, "ATTRPROG", /* Database manipulation */ 487*0Sstevel@tonic-gate 100080, "AUTODUMP", /* Sun consulting special */ 488*0Sstevel@tonic-gate 100081, "EVENT_SVC", /* Event protocol */ 489*0Sstevel@tonic-gate 100085, "ARM_PSD", /* ARM policy */ 490*0Sstevel@tonic-gate 100086, "ARMTOD", /* ARM TOD */ 491*0Sstevel@tonic-gate 100087, "NA.ADMIN", /* Sun (SNAG) administration agent */ 492*0Sstevel@tonic-gate 100099, "PLD", /* Genesil 8.1 hot plot */ 493*0Sstevel@tonic-gate 100101, "NA.EVENT", /* SNM (SunNet Manager) event dispatcher */ 494*0Sstevel@tonic-gate 100102, "NA.LOGGER", /* SNM report logger */ 495*0Sstevel@tonic-gate 100103, "NA.DISCOVER", /* SNM network discovery agent */ 496*0Sstevel@tonic-gate 100104, "NA.SYNC", /* SNM sync interface agent */ 497*0Sstevel@tonic-gate 100105, "NA.DISKINFO", /* SNM disk info agent */ 498*0Sstevel@tonic-gate 100106, "NA.IOSTAT", /* SNM iostat agent */ 499*0Sstevel@tonic-gate 100107, "NA.HOSTPERF", /* SNM rstat proxy agent */ 500*0Sstevel@tonic-gate 100108, "NA.CONFIG", /* SNM host configuration agent */ 501*0Sstevel@tonic-gate 100109, "NA.ACTIVITY", /* SNM activity daemon */ 502*0Sstevel@tonic-gate 100111, "NA.LPSTAT", /* SNM printer agent */ 503*0Sstevel@tonic-gate 100112, "NA.HOSTMEM", /* SNM host network memory agent */ 504*0Sstevel@tonic-gate 100113, "NA.SAMPLE", /* SNM sample agent */ 505*0Sstevel@tonic-gate 100114, "NA.X25", /* SNM X.25 agent */ 506*0Sstevel@tonic-gate 100115, "NA.PING", /* SNM ping proxy agent */ 507*0Sstevel@tonic-gate 100116, "NA.RPCNFS", /* SNM rpc and nfs agent */ 508*0Sstevel@tonic-gate 100117, "NA.HOSTIF", /* SNM host interface agent */ 509*0Sstevel@tonic-gate 100118, "NA.ETHERIF", /* SNM ethernet interface agent */ 510*0Sstevel@tonic-gate 100119, "NA.IPPATH", /* SNM traceroute proxy agent */ 511*0Sstevel@tonic-gate 100120, "NA.IPROUTES", /* SNM routing table agent */ 512*0Sstevel@tonic-gate 100121, "NA.LAYERS", /* SNM protocol layers gent */ 513*0Sstevel@tonic-gate 100122, "NA.SNMP", /* SNM SNMP proxy agent */ 514*0Sstevel@tonic-gate 100123, "NA.TRAFFIC", /* SNM network traffic agent */ 515*0Sstevel@tonic-gate 100124, "NA.DNI", /* DNI (DECnet) proxy agent */ 516*0Sstevel@tonic-gate 100125, "NA.CHAT", /* IBM Channel attach proxy agent */ 517*0Sstevel@tonic-gate 100126, "NA.FDDI", /* FDDI agent */ 518*0Sstevel@tonic-gate 100127, "NA.FDDISMT", /* FDDI SMT proxy agent */ 519*0Sstevel@tonic-gate 100128, "NA.MHS", /* MHS agent */ 520*0Sstevel@tonic-gate 100130, "SNM_GRAPHER", /* SNM 3D grapher */ 521*0Sstevel@tonic-gate 100132, "NA.TR", /* Token Ring agent */ 522*0Sstevel@tonic-gate 100134, "NA.TOKENRING", /* Token Ring agent */ 523*0Sstevel@tonic-gate 100136, "NA.FRAMERELAY", /* Frame Relay agent */ 524*0Sstevel@tonic-gate 100175, "NA.SNMPTRAP", /* SNM SNMP trap daemon */ 525*0Sstevel@tonic-gate 100180, "NA.MIPROUTES", /* SNM multicast routing table agent */ 526*0Sstevel@tonic-gate 100201, "MVSNFSSTAT", /* MVS/NFS Memory usage statistic server */ 527*0Sstevel@tonic-gate 100227, "NFS_ACL", /* NFS ACL support */ 528*0Sstevel@tonic-gate 100300, "NIS+", /* NIS+ name service */ 529*0Sstevel@tonic-gate 100302, "NIS+ CB", /* NIS+ callbacks */ 530*0Sstevel@tonic-gate 101002, "NSELINKTOOL", /* NSE link daemon */ 531*0Sstevel@tonic-gate 101003, "NSELINKAPP", /* NSE link application */ 532*0Sstevel@tonic-gate 110001, "GOLABEL", /* SunOS MLS */ 533*0Sstevel@tonic-gate 110002, "PUC", /* SunOS MLS */ 534*0Sstevel@tonic-gate 150001, "PCNFSD", /* PC passwd authorization */ 535*0Sstevel@tonic-gate 150002, "TOPS", /* TOPS name mapping */ 536*0Sstevel@tonic-gate 150003, "TOPS", /* TOPS external attribute storage */ 537*0Sstevel@tonic-gate 150004, "TOPS", /* TOPS hierarchical file system */ 538*0Sstevel@tonic-gate 150005, "TOPS", /* TOPS NFS transparency extensions */ 539*0Sstevel@tonic-gate 150006, "SOLARNET_FW", /* SolarNet Framework protocol */ 540*0Sstevel@tonic-gate 160001, "CM", /* Nihon Sun - Japanese Input system */ 541*0Sstevel@tonic-gate 300004, "FRAME 1", /* Frame program 1 */ 542*0Sstevel@tonic-gate 300009, "FRAME 2", /* Frame program 2 */ 543*0Sstevel@tonic-gate 390101, "RAP", /* Legato RAP protocol */ 544*0Sstevel@tonic-gate 390102, "RAPRD", /* Legato RAP resource dir protocol */ 545*0Sstevel@tonic-gate 500021, "ZNS", /* Zeus Network Service */ 546*0Sstevel@tonic-gate }; 547*0Sstevel@tonic-gate 548*0Sstevel@tonic-gate compare(a, b) 549*0Sstevel@tonic-gate register struct rpcnames *a, *b; 550*0Sstevel@tonic-gate { 551*0Sstevel@tonic-gate return (a->rp_prog - b->rp_prog); 552*0Sstevel@tonic-gate } 553*0Sstevel@tonic-gate 554*0Sstevel@tonic-gate char * 555*0Sstevel@tonic-gate nameof_prog(prog) 556*0Sstevel@tonic-gate int prog; 557*0Sstevel@tonic-gate { 558*0Sstevel@tonic-gate struct rpcnames *r; 559*0Sstevel@tonic-gate struct rpcnames *bsearch(); 560*0Sstevel@tonic-gate int elems = sizeof (rpcnames) / sizeof (*r); 561*0Sstevel@tonic-gate 562*0Sstevel@tonic-gate r = bsearch(&prog, rpcnames, elems, sizeof (*r), compare); 563*0Sstevel@tonic-gate if (r) 564*0Sstevel@tonic-gate return (r->rp_name); 565*0Sstevel@tonic-gate 566*0Sstevel@tonic-gate if (prog >= 0x40000000 && prog <= 0x5fffffff) 567*0Sstevel@tonic-gate return ("transient"); 568*0Sstevel@tonic-gate 569*0Sstevel@tonic-gate return ("?"); 570*0Sstevel@tonic-gate } 571*0Sstevel@tonic-gate 572*0Sstevel@tonic-gate char * 573*0Sstevel@tonic-gate nameof_astat(status) 574*0Sstevel@tonic-gate int status; 575*0Sstevel@tonic-gate { 576*0Sstevel@tonic-gate switch (status) { 577*0Sstevel@tonic-gate case SUCCESS : return ("Success"); 578*0Sstevel@tonic-gate case PROG_UNAVAIL : return ("Program unavailable"); 579*0Sstevel@tonic-gate case PROG_MISMATCH: return ("Program number mismatch"); 580*0Sstevel@tonic-gate case PROC_UNAVAIL : return ("Procedure unavailable"); 581*0Sstevel@tonic-gate case GARBAGE_ARGS : return ("Garbage arguments"); 582*0Sstevel@tonic-gate case SYSTEM_ERR : return ("System error"); 583*0Sstevel@tonic-gate default: return ("unknown"); 584*0Sstevel@tonic-gate } 585*0Sstevel@tonic-gate } 586*0Sstevel@tonic-gate 587*0Sstevel@tonic-gate char * 588*0Sstevel@tonic-gate nameof_why(why) 589*0Sstevel@tonic-gate int why; 590*0Sstevel@tonic-gate { 591*0Sstevel@tonic-gate switch (why) { 592*0Sstevel@tonic-gate case AUTH_BADCRED: return ("bogus credentials (seal broken)"); 593*0Sstevel@tonic-gate case AUTH_REJECTEDCRED: return ("client should begin new session"); 594*0Sstevel@tonic-gate case AUTH_BADVERF: return ("bogus verifier (seal broken)"); 595*0Sstevel@tonic-gate case AUTH_REJECTEDVERF: return ("verifier expired or was replayed"); 596*0Sstevel@tonic-gate case AUTH_TOOWEAK: return ("too weak"); 597*0Sstevel@tonic-gate case AUTH_INVALIDRESP: return ("bogus response verifier"); 598*0Sstevel@tonic-gate case AUTH_TIMEEXPIRE: return ("time of credential expired"); 599*0Sstevel@tonic-gate case AUTH_TKT_FILE: return ("something wrong with ticket file"); 600*0Sstevel@tonic-gate case AUTH_DECODE: return ("can't decode authenticator"); 601*0Sstevel@tonic-gate case AUTH_NET_ADDR: return ("net address in ticket wrong"); 602*0Sstevel@tonic-gate case RPCSEC_GSS_NOCRED: return ("no credentials for user"); 603*0Sstevel@tonic-gate case RPCSEC_GSS_FAILED: return ("GSS failure, credentials deleted"); 604*0Sstevel@tonic-gate case AUTH_FAILED: 605*0Sstevel@tonic-gate default: 606*0Sstevel@tonic-gate return ("unknown reason"); 607*0Sstevel@tonic-gate } 608*0Sstevel@tonic-gate } 609*0Sstevel@tonic-gate 610*0Sstevel@tonic-gate rpc_detail_reply(flags, xid, x, data, len) 611*0Sstevel@tonic-gate int flags, xid; 612*0Sstevel@tonic-gate struct cache_struct *x; 613*0Sstevel@tonic-gate char *data; 614*0Sstevel@tonic-gate int len; 615*0Sstevel@tonic-gate { 616*0Sstevel@tonic-gate int status; 617*0Sstevel@tonic-gate int astat, rstat, why; 618*0Sstevel@tonic-gate int pos; 619*0Sstevel@tonic-gate 620*0Sstevel@tonic-gate if (x) { 621*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 622*0Sstevel@tonic-gate "This is a reply to frame %d", 623*0Sstevel@tonic-gate x->xid_frame); 624*0Sstevel@tonic-gate } 625*0Sstevel@tonic-gate pos = getxdr_pos(); 626*0Sstevel@tonic-gate status = getxdr_long(); 627*0Sstevel@tonic-gate (void) sprintf(get_line(pos, getxdr_pos()), 628*0Sstevel@tonic-gate "Status = %d (%s)", 629*0Sstevel@tonic-gate status, status ? "Denied" : "Accepted"); 630*0Sstevel@tonic-gate 631*0Sstevel@tonic-gate switch (status) { 632*0Sstevel@tonic-gate case MSG_ACCEPTED: 633*0Sstevel@tonic-gate print_verif(REPLY); 634*0Sstevel@tonic-gate pos = getxdr_pos(); 635*0Sstevel@tonic-gate astat = getxdr_long(); 636*0Sstevel@tonic-gate (void) sprintf(get_line(pos, getxdr_pos()), 637*0Sstevel@tonic-gate "Accept status = %d (%s)", 638*0Sstevel@tonic-gate astat, nameof_astat(astat)); 639*0Sstevel@tonic-gate 640*0Sstevel@tonic-gate switch (astat) { 641*0Sstevel@tonic-gate case SUCCESS: 642*0Sstevel@tonic-gate if (x) { 643*0Sstevel@tonic-gate show_trailer(); 644*0Sstevel@tonic-gate protoprint(flags, REPLY, xid, 645*0Sstevel@tonic-gate x->xid_prog, x->xid_vers, x->xid_proc, 646*0Sstevel@tonic-gate data, len); 647*0Sstevel@tonic-gate } 648*0Sstevel@tonic-gate break; 649*0Sstevel@tonic-gate case PROG_UNAVAIL : 650*0Sstevel@tonic-gate break; 651*0Sstevel@tonic-gate case PROG_MISMATCH: 652*0Sstevel@tonic-gate case PROC_UNAVAIL : 653*0Sstevel@tonic-gate showxdr_long(" Low = %d"); 654*0Sstevel@tonic-gate showxdr_long(" High = %d"); 655*0Sstevel@tonic-gate break; 656*0Sstevel@tonic-gate case GARBAGE_ARGS: 657*0Sstevel@tonic-gate case SYSTEM_ERR: 658*0Sstevel@tonic-gate default: 659*0Sstevel@tonic-gate ; 660*0Sstevel@tonic-gate } 661*0Sstevel@tonic-gate 662*0Sstevel@tonic-gate break; 663*0Sstevel@tonic-gate 664*0Sstevel@tonic-gate case MSG_DENIED: 665*0Sstevel@tonic-gate pos = getxdr_pos(); 666*0Sstevel@tonic-gate rstat = getxdr_long(); 667*0Sstevel@tonic-gate (void) sprintf(get_line(pos, getxdr_pos()), 668*0Sstevel@tonic-gate "Reject status = %d (%s)", 669*0Sstevel@tonic-gate rstat, 670*0Sstevel@tonic-gate rstat ? "can't authenticate" 671*0Sstevel@tonic-gate : "version mismatch"); 672*0Sstevel@tonic-gate 673*0Sstevel@tonic-gate switch (rstat) { 674*0Sstevel@tonic-gate case RPC_MISMATCH: 675*0Sstevel@tonic-gate showxdr_long(" Low = %d"); 676*0Sstevel@tonic-gate showxdr_long(" High = %d"); 677*0Sstevel@tonic-gate break; 678*0Sstevel@tonic-gate case AUTH_ERROR: 679*0Sstevel@tonic-gate why = getxdr_u_long(); 680*0Sstevel@tonic-gate (void) sprintf(get_line(pos, getxdr_pos()), 681*0Sstevel@tonic-gate " Why = %d (%s)", 682*0Sstevel@tonic-gate why, nameof_why(why)); 683*0Sstevel@tonic-gate break; 684*0Sstevel@tonic-gate } 685*0Sstevel@tonic-gate break; 686*0Sstevel@tonic-gate } 687*0Sstevel@tonic-gate } 688*0Sstevel@tonic-gate 689*0Sstevel@tonic-gate /* 690*0Sstevel@tonic-gate * Return true if this is a valid RPC packet 691*0Sstevel@tonic-gate */ 692*0Sstevel@tonic-gate valid_rpc(rpc, rpclen) 693*0Sstevel@tonic-gate char *rpc; 694*0Sstevel@tonic-gate int rpclen; 695*0Sstevel@tonic-gate { 696*0Sstevel@tonic-gate XDR xdrm; 697*0Sstevel@tonic-gate struct rpc_msg msg; 698*0Sstevel@tonic-gate 699*0Sstevel@tonic-gate if (rpclen < 12) 700*0Sstevel@tonic-gate return (0); 701*0Sstevel@tonic-gate 702*0Sstevel@tonic-gate xdrmem_create(&xdrm, rpc, rpclen, XDR_DECODE); 703*0Sstevel@tonic-gate if (xdr_u_int(&xdrm, &msg.rm_xid) && 704*0Sstevel@tonic-gate xdr_u_int(&xdrm, (uint_t *)&msg.rm_direction)) { 705*0Sstevel@tonic-gate switch (msg.rm_direction) { 706*0Sstevel@tonic-gate case CALL: 707*0Sstevel@tonic-gate if (xdr_rpcvers(&xdrm, &msg.rm_call.cb_rpcvers) && 708*0Sstevel@tonic-gate msg.rm_call.cb_rpcvers == 2) 709*0Sstevel@tonic-gate return (1); 710*0Sstevel@tonic-gate break; 711*0Sstevel@tonic-gate case REPLY: 712*0Sstevel@tonic-gate if (xdr_u_int(&xdrm, 713*0Sstevel@tonic-gate (uint_t *)&msg.rm_reply.rp_stat) && 714*0Sstevel@tonic-gate (msg.rm_reply.rp_stat == MSG_ACCEPTED || 715*0Sstevel@tonic-gate msg.rm_reply.rp_stat == MSG_DENIED)) 716*0Sstevel@tonic-gate return (1); 717*0Sstevel@tonic-gate break; 718*0Sstevel@tonic-gate } 719*0Sstevel@tonic-gate } 720*0Sstevel@tonic-gate 721*0Sstevel@tonic-gate return (0); 722*0Sstevel@tonic-gate } 723*0Sstevel@tonic-gate 724*0Sstevel@tonic-gate struct cache_struct *xcpfirst = &xid_cache[0]; 725*0Sstevel@tonic-gate struct cache_struct *xcp = &xid_cache[0]; 726*0Sstevel@tonic-gate struct cache_struct *xcplast = &xid_cache[XID_CACHE_SIZE - 1]; 727*0Sstevel@tonic-gate 728*0Sstevel@tonic-gate struct cache_struct * 729*0Sstevel@tonic-gate find_xid(xid) 730*0Sstevel@tonic-gate ulong_t xid; 731*0Sstevel@tonic-gate { 732*0Sstevel@tonic-gate struct cache_struct *x; 733*0Sstevel@tonic-gate 734*0Sstevel@tonic-gate for (x = xcp; x >= xcpfirst; x--) 735*0Sstevel@tonic-gate if (x->xid_num == xid) 736*0Sstevel@tonic-gate return (x); 737*0Sstevel@tonic-gate for (x = xcplast; x > xcp; x--) 738*0Sstevel@tonic-gate if (x->xid_num == xid) 739*0Sstevel@tonic-gate return (x); 740*0Sstevel@tonic-gate return (NULL); 741*0Sstevel@tonic-gate } 742*0Sstevel@tonic-gate 743*0Sstevel@tonic-gate stash_xid(xid, frame, prog, vers, proc) 744*0Sstevel@tonic-gate ulong_t xid; 745*0Sstevel@tonic-gate int frame, prog, vers, proc; 746*0Sstevel@tonic-gate { 747*0Sstevel@tonic-gate struct cache_struct *x; 748*0Sstevel@tonic-gate 749*0Sstevel@tonic-gate x = find_xid(xid); 750*0Sstevel@tonic-gate if (x == NULL) { 751*0Sstevel@tonic-gate x = xcp++; 752*0Sstevel@tonic-gate if (xcp > xcplast) 753*0Sstevel@tonic-gate xcp = xcpfirst; 754*0Sstevel@tonic-gate x->xid_num = xid; 755*0Sstevel@tonic-gate x->xid_frame = frame; 756*0Sstevel@tonic-gate } 757*0Sstevel@tonic-gate x->xid_prog = prog; 758*0Sstevel@tonic-gate x->xid_vers = vers; 759*0Sstevel@tonic-gate x->xid_proc = proc; 760*0Sstevel@tonic-gate x->xid_gss_proc = RPCSEC_GSS_DATA; 761*0Sstevel@tonic-gate x->xid_gss_service = rpc_gss_svc_default; 762*0Sstevel@tonic-gate } 763*0Sstevel@tonic-gate 764*0Sstevel@tonic-gate void 765*0Sstevel@tonic-gate check_retransmit(line, xid) 766*0Sstevel@tonic-gate char *line; 767*0Sstevel@tonic-gate ulong_t xid; 768*0Sstevel@tonic-gate { 769*0Sstevel@tonic-gate struct cache_struct *x; 770*0Sstevel@tonic-gate extern int pi_frame; 771*0Sstevel@tonic-gate 772*0Sstevel@tonic-gate x = find_xid(xid); 773*0Sstevel@tonic-gate if (x && x->xid_frame != pi_frame) 774*0Sstevel@tonic-gate (void) strcat(line, " (retransmit)"); 775*0Sstevel@tonic-gate } 776