From bcf1f8c11c5739c7643d4a1570798a9dd0cac7e4 Mon Sep 17 00:00:00 2001 From: akfaew Date: Wed, 14 Jun 2017 20:48:54 +0000 Subject: [PATCH] Don't support loading appletalk addresses from /etc/appletalk.names. OK deraadt@ --- usr.sbin/tcpdump/print-atalk.c | 40 +--------------------------------- usr.sbin/tcpdump/privsep.c | 5 ++--- usr.sbin/tcpdump/privsep.h | 3 +-- 3 files changed, 4 insertions(+), 44 deletions(-) diff --git a/usr.sbin/tcpdump/print-atalk.c b/usr.sbin/tcpdump/print-atalk.c index 815c12d50e2..da49751f65a 100644 --- a/usr.sbin/tcpdump/print-atalk.c +++ b/usr.sbin/tcpdump/print-atalk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-atalk.c,v 1.31 2016/10/28 12:54:05 jsg Exp $ */ +/* $OpenBSD: print-atalk.c,v 1.32 2017/06/14 20:48:54 akfaew Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -554,51 +554,13 @@ struct hnamemem { static struct hnamemem hnametable[HASHNAMESIZE]; -/* - * see if there's an AppleTalk number to name map file. - */ -static void -init_atalk(void) -{ - struct hnamemem *tp; - char nambuf[HOST_NAME_MAX+1 + 20]; - char line[BUFSIZ]; - int i1, i2, i3; - - priv_getlines(FTAB_APPLETALK); - while (priv_getline(line, sizeof(line)) > 0) { - if (line[0] == '\n' || line[0] == 0 || line[0] == '#') - continue; - if (sscanf(line, "%d.%d.%d %255s", &i1, &i2, &i3, nambuf) == 4) - /* got a hostname. */ - i3 |= ((i1 << 8) | i2) << 8; - else if (sscanf(line, "%d.%d %255s", &i1, &i2, nambuf) == 3) - /* got a net name */ - i3 = (((i1 << 8) | i2) << 8) | 255; - else - continue; - - for (tp = &hnametable[i3 & (HASHNAMESIZE-1)]; - tp->nxt; tp = tp->nxt) - ; - tp->addr = i3; - tp->nxt = newhnamemem(); - tp->name = savestr(nambuf); - } -} - static const char * ataddr_string(u_short atnet, u_char athost) { struct hnamemem *tp, *tp2; int i = (atnet << 8) | athost; char nambuf[HOST_NAME_MAX+1 + 20]; - static int first = 1; - if (first) { - first = 0; - init_atalk(); - } for (tp = &hnametable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt) if (tp->addr == i) return (tp->name); diff --git a/usr.sbin/tcpdump/privsep.c b/usr.sbin/tcpdump/privsep.c index 596822b4355..46007a65e24 100644 --- a/usr.sbin/tcpdump/privsep.c +++ b/usr.sbin/tcpdump/privsep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep.c,v 1.44 2017/01/23 04:25:05 deraadt Exp $ */ +/* $OpenBSD: privsep.c,v 1.45 2017/06/14 20:48:54 akfaew Exp $ */ /* * Copyright (c) 2003 Can Erkin Acar @@ -101,8 +101,7 @@ struct ftab { int count; }; -static struct ftab file_table[] = {{"/etc/appletalk.names", 1, 0}, - {PF_OSFP_FILE, 1, 0}}; +static struct ftab file_table[] = {{PF_OSFP_FILE, 1, 0}}; #define NUM_FILETAB (sizeof(file_table) / sizeof(struct ftab)) diff --git a/usr.sbin/tcpdump/privsep.h b/usr.sbin/tcpdump/privsep.h index 8f0b8a74381..0e5678e5f68 100644 --- a/usr.sbin/tcpdump/privsep.h +++ b/usr.sbin/tcpdump/privsep.h @@ -22,8 +22,7 @@ #define TCPDUMP_MAGIC 0xa1b2c3d4 /* file ids used by priv_getlines */ -#define FTAB_APPLETALK 0 -#define FTAB_PFOSFP 1 +#define FTAB_PFOSFP 0 enum cmd_types { PRIV_OPEN_BPF, /* open a bpf descriptor */ -- 2.20.1