summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2024-01-29 00:59:55 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2024-01-29 00:59:55 +0000
commit164b70ee2532ae51a2b57eec270614a3d4120239 (patch)
treebd7531a3d69253dac6ed1d783fb51b31a0330dae /sbin
parentf8cefb0b745e0e4972ad9b537a90a639af2a709f (diff)
Open /etc/{services,protocols} before pledge(2).
ok tobhe
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ipsecctl/ipsecctl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sbin/ipsecctl/ipsecctl.c b/sbin/ipsecctl/ipsecctl.c
index ef58ad94ce3..197e143d7f9 100644
--- a/sbin/ipsecctl/ipsecctl.c
+++ b/sbin/ipsecctl/ipsecctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsecctl.c,v 1.86 2023/10/09 15:32:14 tobhe Exp $ */
+/* $OpenBSD: ipsecctl.c,v 1.87 2024/01/29 00:59:54 yasuoka Exp $ */
/*
* Copyright (c) 2004, 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
*
@@ -706,6 +706,10 @@ ipsecctl_show(int opts)
}
}
+ /* open /etc/{services,protocols} before pledge(2) */
+ setservent(1);
+ setprotoent(1);
+
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
@@ -781,6 +785,10 @@ ipsecctl_show(int opts)
ipsecctl_print_title("SAD:");
printf("No entries\n");
}
+
+ /* close /etc/{services,protocols} */
+ endservent();
+ endprotoent();
}
int