On Thu, Nov 16, 2023 at 11:55:41PM +0000, Klemens Nanni wrote:
> On Fri, Nov 17, 2023 at 12:26:08AM +0100, Christian Weisgerber wrote:
> > net/xprobe                          C++ std::random_shuffle
> 
> https://en.cppreference.com/w/cpp/algorithm/random_shuffle
> (deprecated in C++14)
> (removed in C++17)
> 
> 'grep -r random_shuffle /usr/local/include/' suggests that boost may
> provide a fallback, but I'm inclined to delete this dead port instead.
> 
> No update since 2005, last SourceForge activity in 2013, unmaintained,
> HOMEPAGE redirects, link on SourceForge is NXDOMAIN...
> 
> OK to remove?

Alternative is to patch std::random_shuffle usage, then you get
- OpenBSD/-current detected as multiple releases betweeen 2.5 and 3.9
  each with 100% probability
- Linux 6.x detected as multiple Linux 2.4.x each with 100% probability
- segfaults on IPv6 addresses in general
- crashes on some IP/interface configs, but not all:
  # xprobe2 100.64.73.1
  ...
  No interface leading to 100.64.73.1 was found
  Segmentation fault (core dumped)
  # ifconfig vport | grep 100.64
        inet 100.64.73.1 netmask 0xffffff00 broadcast 100.64.73.255


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/xprobe/Makefile,v
diff -u -p -r1.29 Makefile
--- Makefile    7 Nov 2023 14:19:42 -0000       1.29
+++ Makefile    17 Nov 2023 01:16:47 -0000
@@ -1,7 +1,7 @@
 COMMENT=               ICMP active OS fingerprint scanner
 
 DISTNAME=              xprobe2-0.3
-REVISION =             6
+REVISION =             7
 CATEGORIES=                    net security
 
 HOMEPAGE=              https://xprobe.sourceforge.net/
Index: patches/patch-src_target_cc
===================================================================
RCS file: patches/patch-src_target_cc
diff -N patches/patch-src_target_cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_target_cc 17 Nov 2023 01:16:44 -0000
@@ -0,0 +1,30 @@
+Replace std::random_shuffle (removed in C++14) with std::shuffle
+
+Index: src/target.cc
+--- src/target.cc.orig
++++ src/target.cc
+@@ -20,6 +20,7 @@
+ */
+ 
+ 
++#include <random>
+ #include "xprobe.h"
+ #include "target.h"
+ #include "interface.h"
+@@ -363,6 +364,7 @@ void Port_Range::set_range(u_short a, u_short b) {
+ 
+ int Port_Range::get_next(u_short *port) {
+       int k, sz=size();
++      random_device rd;
+       
+       if (curr+low > high)
+               return 1;
+@@ -370,7 +372,7 @@ int Port_Range::get_next(u_short *port) {
+               // initialize
+               for (k=0; k < sz; k++) 
+                       ports.push_back(low + k);
+-              random_shuffle(ports.begin(), ports.end());
++              shuffle(ports.begin(), ports.end(), rd);
+               *port = ports[curr++];
+       } else 
+               *port = ports[curr++];

Reply via email to