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

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