Blame SOURCES/0008-ipset-translate-allow-invoking-with-a-path-name.patch

74da1b
From a7d1e05c0fcae89fffcd5aa235ea32d16becbd21 Mon Sep 17 00:00:00 2001
74da1b
From: Quentin Armitage <quentin@armitage.org.uk>
74da1b
Date: Thu, 11 Aug 2022 17:52:18 +0100
74da1b
Subject: [PATCH] ipset-translate: allow invoking with a path name
74da1b
74da1b
Executing /usr/sbin/ipset-translate results in the ipset functionality being run, rather than the ipset-translate functionality.
74da1b
74da1b
 # ipset-translate destroy fred
74da1b
 This command is not supported, use `ipset-translate restore < file'
74da1b
74da1b
 # /usr/sbin/ipset-translate destroy fred
74da1b
 ipset v7.15: The set with the given name does not exist
74da1b
74da1b
use basename() to resolve the issue.
74da1b
74da1b
Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1626
74da1b
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
74da1b
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
74da1b
(cherry picked from commit e1b60b2a93356c313cccb2abfdae4b58d530e02b)
74da1b
---
74da1b
 src/ipset.c | 3 ++-
74da1b
 1 file changed, 2 insertions(+), 1 deletion(-)
74da1b
74da1b
diff --git a/src/ipset.c b/src/ipset.c
74da1b
index 6d42b60d2fe9d..162f477d49cd0 100644
74da1b
--- a/src/ipset.c
74da1b
+++ b/src/ipset.c
74da1b
@@ -6,6 +6,7 @@
74da1b
  * it under the terms of the GNU General Public License version 2 as
74da1b
  * published by the Free Software Foundation.
74da1b
  */
74da1b
+#define _GNU_SOURCE
74da1b
 #include <assert.h>			/* assert */
74da1b
 #include <stdio.h>			/* fprintf */
74da1b
 #include <stdlib.h>			/* exit */
74da1b
@@ -31,7 +32,7 @@ main(int argc, char *argv[])
74da1b
 		exit(1);
74da1b
 	}
74da1b
 
74da1b
-	if (!strcmp(argv[0], "ipset-translate")) {
74da1b
+	if (!strcmp(basename(argv[0]), "ipset-translate")) {
74da1b
 		ret = ipset_xlate_argv(ipset, argc, argv);
74da1b
 	} else {
74da1b
 		ret = ipset_parse_argv(ipset, argc, argv);
74da1b
-- 
74da1b
2.38.0
74da1b