Blame SOURCES/net-snmp-5.8-empty-passphrase.patch

8b097a
From 09a0c9005fb72102bf4f4499b28282f823e3e526 Mon Sep 17 00:00:00 2001
8b097a
From: Josef Ridky <jridky@redhat.com>
8b097a
Date: Wed, 18 Nov 2020 20:54:34 -0800
8b097a
Subject: [PATCH] net-snmp-create-v3-user: Handle empty passphrases correctly
8b097a
8b097a
See also https://github.com/net-snmp/net-snmp/issues/86.
8b097a
8b097a
Fixes: e5ad10de8e17 ("Quote provided encryption key in createUser line")
8b097a
Reported-by: Chris Cheney
8b097a
---
8b097a
 net-snmp-create-v3-user.in | 6 +++++-
8b097a
 1 file changed, 5 insertions(+), 1 deletion(-)
8b097a
8b097a
diff --git a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in
8b097a
index 452c2699d..31b4c58c1 100644
8b097a
--- a/net-snmp-create-v3-user.in
8b097a
+++ b/net-snmp-create-v3-user.in
8b097a
@@ -120,7 +120,11 @@ fi
8b097a
 fi
8b097a
 outdir="@PERSISTENT_DIRECTORY@"
8b097a
 outfile="$outdir/snmpd.conf"
8b097a
-line="createUser $user $Aalgorithm \"$apassphrase\" $Xalgorithm \"$xpassphrase\""
8b097a
+if test "x$xpassphrase" = "x" ; then
8b097a
+    line="createUser $user $Aalgorithm \"$apassphrase\" $Xalgorithm"
8b097a
+else
8b097a
+    line="createUser $user $Aalgorithm \"$apassphrase\" $Xalgorithm \"$xpassphrase\""
8b097a
+fi
8b097a
 echo "adding the following line to $outfile:"
8b097a
 echo "  " $line
8b097a
 # in case it hasn't ever been started yet, start it.