/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2012 Milan Jurik. All rights reserved.
*/
#include <setjmp.h>
#include <rpc/rpcsec_gss.h>
#include <string.h>
#include "snoop.h"
struct cache_struct *find_xid();
char *nameof_prog(int prog);
static void print_rpc_gss_init_arg(int, struct cache_struct *);
static void print_rpc_gss_init_res(int);
char *
{
switch (proc) {
case RPCSEC_GSS_DATA: return "RPCSEC_GSS_DATA"; break;
case RPCSEC_GSS_INIT: return "RPCSEC_GSS_INIT"; break;
case RPCSEC_GSS_CONTINUE_INIT:
return ("RPCSEC_GSS_CONTINUE_INIT");
case RPCSEC_GSS_DESTROY:
return ("RPCSEC_GSS_DESTROY");
default: return ("unknown");
}
}
char *
{
switch (service) {
case rpc_gss_svc_none: return "none"; break;
case rpc_gss_svc_integrity: return "integrity"; break;
case rpc_gss_svc_privacy: return "privacy"; break;
default: return "unknown"; break;
}
}
/*
* Print detailed RPCSEC_GSS cred data.
*/
void
{
unsigned int seq_num;
unsigned int handle_len;
unsigned int rpcsec_gss_ver;
unsigned int rpcsec_gss_proc;
struct cache_struct *x;
int pos;
pos = getxdr_pos();
/* see if we know this version or not */
if (rpcsec_gss_ver != 1) {
return;
}
seq_num = getxdr_u_long();
" gss control procedure = %u (%s)",
pos = getxdr_pos();
handle_len = getxdr_u_long();
handle_len, handle);
if (x) {
x->xid_gss_proc = rpcsec_gss_proc;
}
}
/*
* Based on different RPCSEC_GSS services supported, maybe a
* special handling is needed before printing the arguments.
*
* For integrity service : print the sequence number.
* For privacy service : do not print the arguments.
*/
int
{
int seq;
struct cache_struct *x;
return (0);
switch (x->xid_gss_service) {
case rpc_gss_svc_default:
case rpc_gss_svc_none:
break; /* standard call args */
case rpc_gss_svc_integrity:
/* length of rpc_gss_data_t encoded in the databody_integ */
/* read the seq number */
seq = getxdr_u_long();
seq);
"RPCSEC_GSS data seq_num = %u", seq);
show_space();
}
/* call args follow */
break;
case rpc_gss_svc_privacy: {
if (*progname == '?') {
}
(void) sprintf(get_sum_line(),
"%s %c %s ver(%d) proc(%d) (data encrypted) ",
unsigned int args_len;
args_len = getxdr_u_long();
"RPCSEC_GSS %s ver(%d) proc(%d)",
"(%s args encrypted, len = %d bytes)",
show_space();
}
}
return (1);
default:
break;
}
return (0);
}
/*
* Based on different RPCSEC_GSS services supported, maybe a
* special handling is needed after printing the arguments.
*
* For integrity service : print the checksum.
*/
void
{
char *line;
struct cache_struct *x;
return;
switch (x->xid_gss_service) {
case rpc_gss_svc_default:
case rpc_gss_svc_none:
case rpc_gss_svc_privacy:
/* nothing left */
break;
case rpc_gss_svc_integrity:
line = get_sum_line();
unsigned int checksum_len;
char *checksum;
show_space();
"checksum: len = %d", checksum_len);
show_trailer();
}
break;
default:
break;
}
}
/*
* Print RPCSEC_GSS control procedures protocol data,
* No-op for RPCSEC_GSS_DATA.
*/
int
{
int seq;
struct cache_struct *x;
return (0);
if (x->xid_gss_proc != RPCSEC_GSS_DATA) {
"RPC RPCSEC_GSS",
x->xid_gss_proc,
}
if (x->xid_gss_proc == RPCSEC_GSS_INIT ||
x->xid_gss_proc == RPCSEC_GSS_CONTINUE_INIT) {
} else {
}
}
}
return (1);
}
return (0);
}
/*
* Skip the header RPCSEC_GSS cred data and
* put service and control type in the xid cache.
*/
void
{
unsigned int seq_num;
unsigned int handle_len;
unsigned int flavor_len;
unsigned int rpcsec_gss_ver;
unsigned int rpcsec_gss_proc;
struct cache_struct *x;
flavor_len = getxdr_u_long();
/* see if we know this version or not */
if (rpcsec_gss_ver != 1) {
}
seq_num = getxdr_u_long();
/* skip the handle */
x->xid_gss_proc = rpcsec_gss_proc;
}
}
/*
* Print the argument data for the RPCSEC_GSS_INIT control procedure.
*/
static void
{
unsigned int token_len;
int pos = 0;
/*
* see if we need to print out the rpc_gss_init_arg structure
* or not.
*/
if (x->xid_gss_proc != RPCSEC_GSS_INIT &&
x->xid_gss_proc != RPCSEC_GSS_CONTINUE_INIT) {
return;
}
/* print it */
"RPCSEC_GSS_INIT args:");
pos = getxdr_pos();
token_len = getxdr_u_long();
show_trailer();
}
/*
* Print the results data for the RPCSEC_GSS_INIT control procedure.
*/
void
{
int pos = 0;
struct cache_struct *x;
/* print it */
pos = getxdr_pos();
handle_len = getxdr_u_long();
handle_len, handle);
pos = getxdr_pos();
major = getxdr_u_long();
minor = getxdr_u_long();
seq_window = getxdr_u_long();
pos = getxdr_pos();
token_len = getxdr_u_long();
show_trailer();
}