57 lines
1.6 KiB
Plaintext
57 lines
1.6 KiB
Plaintext
$OpenBSD: patch-src_fping_c,v 1.6 2018/08/01 15:02:18 millert Exp $
|
|
Index: src/fping.c
|
|
--- src/fping.c.orig
|
|
+++ src/fping.c
|
|
@@ -354,6 +354,9 @@ int main(int argc, char** argv)
|
|
int tos = 0;
|
|
HOST_ENTRY* cursor;
|
|
|
|
+ if (pledge("stdio inet rpath dns id", NULL) == -1)
|
|
+ perror("pledge");
|
|
+
|
|
prog = argv[0];
|
|
|
|
s = open_ping_socket(ping_data_size);
|
|
@@ -364,6 +367,9 @@ int main(int argc, char** argv)
|
|
perror("cannot setuid");
|
|
}
|
|
|
|
+ if (pledge("stdio inet rpath dns", NULL) == -1)
|
|
+ perror("pledge");
|
|
+
|
|
ident = getpid() & 0xFFFF;
|
|
verbose_flag = 1;
|
|
backoff_flag = 1;
|
|
@@ -583,6 +589,11 @@ int main(int argc, char** argv)
|
|
}
|
|
}
|
|
|
|
+ if (!filename) { /* drop rpath if not reading addrs from file */
|
|
+ if (pledge("stdio inet dns", NULL) == -1)
|
|
+ perror("pledge");
|
|
+ }
|
|
+
|
|
/* validate various option settings */
|
|
|
|
if (ttl > 255) {
|
|
@@ -798,6 +809,10 @@ int main(int argc, char** argv)
|
|
exit(num_noaddress ? 2 : 1);
|
|
}
|
|
|
|
+ /* done with file and dns/rdns lookups */
|
|
+ if (pledge("stdio inet", NULL) == -1)
|
|
+ perror("pledge");
|
|
+
|
|
if (src_addr_present) {
|
|
socket_set_src_addr(s, src_addr);
|
|
}
|
|
@@ -1667,7 +1682,7 @@ int wait_for_reply(long wait_time)
|
|
|
|
#ifndef IPV6
|
|
ip = (struct ip*)buffer;
|
|
-#if defined(__alpha__) && __STDC__ && !defined(__GLIBC__)
|
|
+#if defined(__alpha__) && __STDC__ && !defined(__GLIBC__) && !defined(__OpenBSD__)
|
|
/* The alpha headers are decidedly broken.
|
|
* Using an ANSI compiler, it provides ip_vhl instead of ip_hl and
|
|
* ip_v. So, to get ip_hl, we mask off the bottom four bits.
|