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

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