undo previous, now sockstat works without privs

This commit is contained in:
christos 2020-08-26 22:57:55 +00:00
parent 1d0978b88c
commit a09dcfa2d4
2 changed files with 3 additions and 11 deletions

View File

@ -1,11 +1,8 @@
# $NetBSD: Makefile,v 1.6 2020/08/25 16:39:16 christos Exp $ # $NetBSD: Makefile,v 1.7 2020/08/26 22:57:55 christos Exp $
.include <bsd.own.mk> .include <bsd.own.mk>
RUMPPRG= sockstat RUMPPRG= sockstat
BINGRP= kmem
BINMODE=2555
USE_FORT?= yes # setgid
.PATH: ${.CURDIR}/../../lib/libc/gen .PATH: ${.CURDIR}/../../lib/libc/gen
CPPFLAGS+= -DRUMP_ACTION CPPFLAGS+= -DRUMP_ACTION

View File

@ -1,4 +1,4 @@
/* $NetBSD: sockstat.c,v 1.22 2020/08/25 14:05:17 christos Exp $ */ /* $NetBSD: sockstat.c,v 1.23 2020/08/26 22:57:55 christos Exp $ */
/* /*
* Copyright (c) 2005 The NetBSD Foundation, Inc. * Copyright (c) 2005 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: sockstat.c,v 1.22 2020/08/25 14:05:17 christos Exp $"); __RCSID("$NetBSD: sockstat.c,v 1.23 2020/08/26 22:57:55 christos Exp $");
#endif #endif
#define _KMEMUSER #define _KMEMUSER
@ -179,11 +179,6 @@ main(int argc, char *argv[])
if (prog_init && prog_init() == -1) if (prog_init && prog_init() == -1)
err(1, "init"); err(1, "init");
/* Not used, but we set the PK_KMEM flag like this */
int fd = open("/dev/mem", O_RDONLY);
if (fd == -1)
err(EXIT_FAILURE, "Can't open `/dev/mem'");
close(fd);
if ((portmap != NULL) && (pf_list == 0)) { if ((portmap != NULL) && (pf_list == 0)) {
pf_list = PF_LIST_INET; pf_list = PF_LIST_INET;
#ifdef INET6 #ifdef INET6