Blame SOURCES/Improve-error-message-when-bind-is-given-an-invalid-.patch

566fbd
From 02f17448e379c92745f8203f47e5de0725b1c1b6 Mon Sep 17 00:00:00 2001
566fbd
From: Sergio Correia <scorreia@redhat.com>
566fbd
Date: Fri, 18 Oct 2019 09:04:22 -0300
566fbd
Subject: [PATCH] Improve error message when bind is given an invalid PIN
566fbd
566fbd
---
566fbd
 src/luks/clevis-luks-bind | 7 ++++++-
566fbd
 1 file changed, 6 insertions(+), 1 deletion(-)
566fbd
566fbd
diff --git a/src/luks/clevis-luks-bind b/src/luks/clevis-luks-bind
566fbd
index 7aae2ea..1b5caf2 100755
566fbd
--- a/src/luks/clevis-luks-bind
566fbd
+++ b/src/luks/clevis-luks-bind
566fbd
@@ -19,6 +19,8 @@
566fbd
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
566fbd
 #
566fbd
 
566fbd
+. clevis-luks-common-functions
566fbd
+
566fbd
 SUMMARY="Binds a LUKS device using the specified policy"
566fbd
 UUID=cb6e8904-81ff-40da-a84a-07ab9ab5715e
566fbd
 
566fbd
@@ -68,6 +70,9 @@ fi
566fbd
 if ! PIN=${@:$((OPTIND++)):1} || [ -z "$PIN" ]; then
566fbd
     echo "Did not specify a pin!" >&2
566fbd
     usage
566fbd
+elif ! EXE=$(findexe clevis-encrypt-"${PIN}"); then
566fbd
+    echo "'$PIN' is not a valid pin!" >&2
566fbd
+    usage
566fbd
 fi
566fbd
 
566fbd
 if ! CFG=${@:$((OPTIND++)):1} || [ -z "$CFG" ]; then
566fbd
@@ -142,4 +147,4 @@ else
566fbd
         cryptsetup luksRemoveKey "$DEV" <<<"$key"
566fbd
         exit 1
566fbd
     fi
566fbd
-fi
566fbd
\ No newline at end of file
566fbd
+fi
566fbd
-- 
566fbd
2.21.0
566fbd