Blame SOURCES/rhel-specific-0001-config-Add-enable-authfile-option.patch

f9a3b2
From 87c8545816cca03d19c2f3ef54031940f7e19d50 Mon Sep 17 00:00:00 2001
df4748
From: Jan Friesse <jfriesse@redhat.com>
f9a3b2
Date: Fri, 18 Nov 2022 11:57:46 +0100
df4748
Subject: [PATCH] config: Add enable-authfile option
df4748
df4748
This option enables (or disables) usage of authfile. Can be 'yes' or 'no'.
df4748
Default is 'no'.
df4748
df4748
Booth usage of authfile was broken for long time (since commit
df4748
da79b8ba28ad4837a0fee13e5f8fb6f89fe0e24c).
df4748
df4748
Pcs was adding authfile by default, but it was not used. Once booth bug
df4748
was fixed problem appears because mixed clusters (with fixed version and
df4748
without fixed one) stops working.
df4748
df4748
This non-upstream option is added and used to allow use of
df4748
authfile without breaking compatibility for clusters
df4748
consisting of mixed versions (usually happens before all nodes are
df4748
updated) of booth (user have to explicitly
df4748
enable usage of authfile).
df4748
df4748
This patch is transitional and will be removed in future major version of
df4748
distribution.
df4748
df4748
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
df4748
---
df4748
 docs/boothd.8.txt |  7 +++++++
df4748
 src/config.c      | 17 +++++++++++++++++
df4748
 src/config.h      |  1 +
df4748
 src/main.c        |  2 +-
df4748
 4 files changed, 26 insertions(+), 1 deletion(-)
df4748
df4748
diff --git a/docs/boothd.8.txt b/docs/boothd.8.txt
f9a3b2
index 0f3d2c1..c7a8413 100644
df4748
--- a/docs/boothd.8.txt
df4748
+++ b/docs/boothd.8.txt
df4748
@@ -230,6 +230,13 @@ will always bind and listen to both UDP and TCP ports.
df4748
 	parameter to a higher value. The time skew test is performed
df4748
 	only in concert with authentication.
df4748
 
f9a3b2
+'enable-authfile'::
df4748
+	Enables (or disables) usage of authfile. Can be 'yes' or 'no'.
df4748
+	Default is 'no'.
df4748
+	This is non-upstream option used to allow use of authfile without
df4748
+	breaking compatibility for clusters consisting of mixed
df4748
+	versions of booth.
df4748
+
f9a3b2
 'debug'::
f9a3b2
 	Specifies the debug output level. Alternative to
f9a3b2
 	command line argument. Effective only for 'daemon'
df4748
diff --git a/src/config.c b/src/config.c
f9a3b2
index f0ca4aa..e1f25f0 100644
df4748
--- a/src/config.c
df4748
+++ b/src/config.c
f9a3b2
@@ -732,6 +732,23 @@ no_value:
df4748
 			booth_conf->maxtimeskew = atoi(val);
df4748
 			continue;
df4748
 		}
df4748
+
df4748
+		if (strcmp(key, "enable-authfile") == 0) {
df4748
+			if (strcasecmp(val, "yes") == 0 ||
df4748
+			    strcasecmp(val, "on") == 0 ||
df4748
+			    strcasecmp(val, "1") == 0) {
df4748
+				booth_conf->enable_authfile = 1;
df4748
+			} else if (strcasecmp(val, "no") == 0 ||
df4748
+			    strcasecmp(val, "off") == 0 ||
df4748
+			    strcasecmp(val, "0") == 0) {
df4748
+				booth_conf->enable_authfile = 0;
df4748
+			} else {
df4748
+				error = "Expected yes/no value for enable-authfile";
df4748
+				goto err;
df4748
+			}
df4748
+
df4748
+			continue;
df4748
+		}
df4748
 #endif
df4748
 
df4748
 		if (strcmp(key, "site") == 0) {
df4748
diff --git a/src/config.h b/src/config.h
df4748
index bca73bc..da1e917 100644
df4748
--- a/src/config.h
df4748
+++ b/src/config.h
df4748
@@ -297,6 +297,7 @@ struct booth_config {
df4748
 	struct stat authstat;
df4748
 	char authkey[BOOTH_MAX_KEY_LEN];
df4748
 	int authkey_len;
df4748
+	int enable_authfile;
df4748
     /** Maximum time skew between peers allowed */
df4748
 	int maxtimeskew;
df4748
 
df4748
diff --git a/src/main.c b/src/main.c
df4748
index b4a174f..0fdb295 100644
df4748
--- a/src/main.c
df4748
+++ b/src/main.c
df4748
@@ -364,7 +364,7 @@ static int setup_config(int type)
df4748
 	if (rv < 0)
df4748
 		goto out;
df4748
 
df4748
-	if (booth_conf->authfile[0] != '\0') {
df4748
+	if (booth_conf->authfile[0] != '\0' && booth_conf->enable_authfile) {
df4748
 		rv = read_authkey();
df4748
 		if (rv < 0)
df4748
 			goto out;
df4748
-- 
f9a3b2
2.27.0
df4748