summaryrefslogtreecommitdiff
path: root/src/share/mh/import_key
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2009-02-19 22:42:43 -0500
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2009-02-19 22:42:43 -0500
commite13bbc823bc8fe7a28303e45055643e15d0849cd (patch)
tree29a8318fed9d344c637eec3ef8dd0df9cacaae11 /src/share/mh/import_key
parent826bfb547cc82252f18e63a25bb7ee5aeaaebc72 (diff)
parent21e298b8df5108b1337d66ba1a39184be4ce0e4e (diff)
Merge commit 'jrollins/master'
Diffstat (limited to 'src/share/mh/import_key')
-rw-r--r--src/share/mh/import_key9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/share/mh/import_key b/src/share/mh/import_key
index 6394ad7..040b41c 100644
--- a/src/share/mh/import_key
+++ b/src/share/mh/import_key
@@ -21,6 +21,11 @@ local userID
sshKeyFile="$1"
hostName="$2"
+# check that key file specified
+if [ -z "$sshKeyFile" ] ; then
+ failure "Must specify ssh key file to import, or specify '-' for stdin."
+fi
+
# use the default hostname if not specified
if [ -z "$hostName" ] ; then
hostName=$(hostname -f) || failure "Could not determine hostname."
@@ -45,9 +50,7 @@ mkdir -p "${GNUPGHOME_HOST}"
chmod 700 "${GNUPGHOME_HOST}"
# import ssh key to a private key
-if [ -z "$sshKeyFile" ] ; then
- failure "Must specify ssh key file to import, or specify '-' for stdin."
-elif [ "$sshKeyFile" = '-' ] ; then
+if [ "$sshKeyFile" = '-' ] ; then
log verbose "importing ssh key from stdin..."
PEM2OPENPGP_USAGE_FLAGS=authenticate pem2openpgp "$userID" \
| gpg_host --import