/*
* 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 (c) 1991, 1999 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ident "%Z%%M% %I% %E% SMI" /* SunOS */
#include <setjmp.h>
#include <string.h>
#include <netinet/in_systm.h>
#include "snoop.h"
extern char *dlc_header;
char *ypbind_error();
char *sum_ypxfrstat();
char *sum_ypmaplist();
void detail_ypmaplist();
static void niscall(int);
static void nisreply(int);
static int detail_ypstat(void);
static int sum_ypstat(char *);
/*
* Defines missing from 5.0 yp_prot.h
*/
/* Procedure symbols */
static char *procnames_bind_short[] = {
"NULL", /* 0 */
"DOMAIN", /* 1 */
"SETDOMAIN", /* 2 */
};
static char *procnames_bind_long[] = {
"Null procedure", /* 0 */
"Get domain name", /* 1 */
"Set domain name", /* 2 */
};
static char *procnames_short[] = {
"NULL", /* 0 */
"DOMAIN", /* 1 */
"DOMAIN_NONACK", /* 2 */
"MATCH", /* 3 */
"FIRST", /* 4 */
"NEXT", /* 5 */
"XFR", /* 6 */
"CLEAR", /* 7 */
"ALL", /* 8 */
"MASTER", /* 9 */
"ORDER", /* 10 */
"MAPLIST", /* 11 */
"NEWXFR", /* 12 */
};
static char *procnames_long[] = {
"Null procedure", /* 0 */
"Verify domain support", /* 1 */
"Verify domain support (broadcast)", /* 2 */
"Return value of a key", /* 3 */
"Return first key-value pair in map", /* 4 */
"Return next key-value pair in map", /* 5 */
"Request map update (old)", /* 6 */
"Close current map on server", /* 7 */
"Get all key-value pairs in map", /* 8 */
"Get master server", /* 9 */
"Get order", /* 10 */
"Return list of supported maps", /* 11 */
"Request map update", /* 12 */
};
void
char *data;
int len;
{
char *line;
unsigned int status;
return;
return;
}
line = get_sum_line();
"NISBIND C %s",
switch (proc) {
case YPBINDPROC_NULL:
break;
case YPBINDPROC_DOMAIN:
break;
case YPBINDPROC_SETDOM:
break;
default:
break;
}
} else {
switch (proc) {
case YPBINDPROC_NULL:
break;
case YPBINDPROC_DOMAIN:
status = getxdr_long();
} else { /* failure */
status = getxdr_long();
}
break;
case YPBINDPROC_SETDOM:
break;
default:
break;
}
}
}
show_header("NISBIND:",
"Network Information Service Bind", len);
show_space();
return;
}
"Proc = %d (%s)",
switch (proc) {
case YPBINDPROC_NULL:
break;
case YPBINDPROC_DOMAIN:
(void) showxdr_string(YPMAXDOMAIN,
"Domain = %s");
break;
case YPBINDPROC_SETDOM:
(void) showxdr_string(YPMAXDOMAIN,
"Domain = %s");
(void) showxdr_u_long("Version=%lu");
break;
default:
break;
}
} else {
switch (proc) {
case YPBINDPROC_NULL:
break;
case YPBINDPROC_DOMAIN:
status = getxdr_u_long();
"Status = %lu (%s)",
if (status == 1) {
(void) showxdr_hex(4,
"Address=%s");
(void) showxdr_hex(2,
"Port=%s");
} else {
status = getxdr_u_long();
"Error = %lu (%s)",
}
break;
case YPBINDPROC_SETDOM:
break;
default:
break;
}
}
show_trailer();
}
}
void
char *data;
int len;
{
char *line;
/* buffers are all the same size so we don't have to keep track */
return;
}
line = get_sum_line();
else
"NIS C %s",
switch (proc) {
case YPPROC_NULL:
break;
case YPPROC_DOMAIN:
case YPPROC_DOMAIN_NONACK:
case YPPROC_MAPLIST:
/* YPMAXDOMAIN > YPMAXMAP */
break;
case YPPROC_FIRST:
break;
case YPPROC_MATCH:
case YPPROC_NEXT:
" %s in %s",
break;
case YPPROC_NEWXFR:
case YPPROC_XFR:
" map %s in %s",
break;
case YPPROC_CLEAR:
break;
case YPPROC_ALL:
case YPPROC_MASTER:
case YPPROC_ORDER:
" map %s in %s",
break;
default:
break;
}
} else {
else
switch (proc) {
case YPPROC_NULL:
break;
case YPPROC_DOMAIN:
case YPPROC_DOMAIN_NONACK:
break;
case YPPROC_MATCH:
(void) sum_ypstat(line);
break;
case YPPROC_FIRST:
case YPPROC_NEXT:
(void) getxdr_string(buff1,
YPMAXRECORD));
}
break;
case YPPROC_NEWXFR:
case YPPROC_XFR:
transid = getxdr_u_long();
status = getxdr_long();
break;
case YPPROC_CLEAR:
break;
case YPPROC_ALL:
if (getxdr_u_long()) {
(void) sum_ypstat(line);
} else {
"No more");
}
break;
case YPPROC_MASTER:
YPMAXPEER));
}
break;
case YPPROC_ORDER:
getxdr_u_long());
}
break;
case YPPROC_MAPLIST:
sum_ypmaplist());
}
break;
default:
break;
}
}
}
show_space();
return;
}
"Proc = %d (%s)",
proc,
else
show_trailer();
}
}
/*
* Print out version 2 NIS call packets
*/
static void
int proc;
{
switch (proc) {
case YPPROC_NULL:
break;
case YPPROC_DOMAIN:
case YPPROC_DOMAIN_NONACK:
case YPPROC_MAPLIST:
break;
case YPPROC_FIRST:
break;
case YPPROC_MATCH:
case YPPROC_NEXT:
break;
case YPPROC_NEWXFR:
(void) showxdr_u_long("Order = %lu");
(void) showxdr_u_long("Transid = %lu");
(void) showxdr_u_long("Prog = %lu");
break;
case YPPROC_XFR:
(void) showxdr_u_long("Order = %lu");
(void) showxdr_u_long("Transid = %lu");
(void) showxdr_u_long("Prog = %lu");
(void) showxdr_u_long("Port = %lu");
break;
case YPPROC_CLEAR:
break;
case YPPROC_ALL:
case YPPROC_MASTER:
case YPPROC_ORDER:
break;
default:
break;
}
}
/*
* Print out version 2 NIS reply packets
*/
void
int proc;
{
switch (proc) {
case YPPROC_NULL:
break;
case YPPROC_DOMAIN:
case YPPROC_DOMAIN_NONACK:
"Result=%s",
break;
case YPPROC_MATCH:
(void) detail_ypstat();
break;
case YPPROC_FIRST:
case YPPROC_NEXT:
(void) detail_ypstat();
break;
case YPPROC_NEWXFR:
case YPPROC_XFR:
(void) showxdr_u_long("Transid = %lu");
xfrstat = getxdr_u_long();
"Transfer status = %lu (%s)",
break;
case YPPROC_CLEAR:
break;
case YPPROC_ALL:
more = getxdr_u_long();
"More = %s",
if (more) {
(void) detail_ypstat();
}
break;
case YPPROC_MASTER:
(void) detail_ypstat();
case YPPROC_ORDER:
(void) detail_ypstat();
(void) showxdr_u_long("Order=%lu");
break;
case YPPROC_MAPLIST:
(void) detail_ypstat();
break;
default:
break;
}
}
char *
int status;
{
switch (status) {
case 1: return ("Success");
case 2: return ("Master's version not newer");
case -1: return ("Can't find server for map");
case -2: return ("No such domain");
case -3: return ("Resource allocation failure");
case -4: return ("RPC failure talking to server");
case -5: return ("Can't get master address");
case -7: return ("Bad arguments");
case -8: return ("Local dbm operation failed");
case -9: return ("Local file I/O operation failed");
case -10: return ("Map version skew during transfer");
case -11: return ("Can't send clear req to local ypserv");
case -12: return ("No local order number in map");
case -13: return ("Transfer error");
case -14: return ("Transfer request refused");
default:
return (buff);
}
/* NOTREACHED */
}
static int
char *line;
{
char *str;
status = getxdr_u_long();
switch (status) {
break;
}
return ((int)status);
}
static int
{
"Status = %d (%s)",
return ((int)status);
}
char *
{
int maps = 0;
return (buff);
}
while (getxdr_long()) {
maps++;
}
return (buff);
}
void
{
int maps = 0;
" %d+ maps. (Frame is incomplete)",
maps);
return;
}
while (getxdr_long()) {
maps++;
}
}
char *
int err;
{
switch (err) {
case YPBIND_ERR_ERR: return ("Internal error");
case YPBIND_ERR_NOSERV: return ("Internal error");
case YPBIND_ERR_RESC: return ("Resource allocation fail");
default:
return (buff);
}
/* NOTREACHED */
}