summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJameson Graef Rollins <jrollins@phys.columbia.edu>2008-08-03 00:10:28 -0700
committerJameson Graef Rollins <jrollins@phys.columbia.edu>2008-08-03 00:10:28 -0700
commit8e1439bc18f8203d71c1237a25c21374ca17c38c (patch)
treec98ae6931df6072b1830e1ea3687712c9902eaec
parentce1111775aa0e23680932508c2b31e8091ff8beb (diff)
rework out user id processing is done to provide better diagnostic output.
-rw-r--r--debian/changelog4
-rw-r--r--src/common56
2 files changed, 40 insertions, 20 deletions
diff --git a/debian/changelog b/debian/changelog
index 8bfd387..3e7abb8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,8 +5,10 @@ monkeysphere (0.7-1) UNRELEASED; urgency=low
[ Jameson Graef Rollins ]
* fix how check for file modification is done.
+ * rework out user id processing is done to provide more verbose log
+ output.
- -- Jameson Graef Rollins <jrollins@phys.columbia.edu> Sat, 02 Aug 2008 16:41:20 -0700
+ -- Jameson Graef Rollins <jrollins@phys.columbia.edu> Sun, 03 Aug 2008 00:00:06 -0700
monkeysphere (0.6-1) experimental; urgency=low
diff --git a/src/common b/src/common
index ba7df73..f5bb3bb 100644
--- a/src/common
+++ b/src/common
@@ -314,7 +314,7 @@ process_user_id() {
# if the gpg query return code is not 0, return 1
if [ "$?" -ne 0 ] ; then
- log " - key not found."
+ log " no primary keys found."
return 1
fi
@@ -377,10 +377,19 @@ process_user_id() {
# output a line for the primary key
# 0 = ok, 1 = bad
if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
- log " * acceptable key found."
- echo "0:${fingerprint}"
+ log " * acceptable primary key."
+ if [ -z "$sshKey" ] ; then
+ log " ! primary key could not be translated."
+ else
+ echo "0:${sshKey}"
+ fi
else
- echo "1:${fingerprint}"
+ log " - unacceptable primary key."
+ if [ -z "$sshKey" ] ; then
+ log " ! primary key could not be translated."
+ else
+ echo "1:${sshKey}"
+ fi
fi
;;
'sub') # sub keys
@@ -404,18 +413,29 @@ process_user_id() {
'fpr') # key fingerprint
fingerprint="$uidfpr"
+ sshKey=$(gpg2ssh "$fingerprint")
+
# if the last key was the pub key, skip
if [ "$lastKey" = pub ] ; then
continue
fi
-
- # output a line for the last subkey
+
+ # output a line for the primary key
# 0 = ok, 1 = bad
if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
- log " * acceptable key found."
- echo "0:${fingerprint}"
+ log " * acceptable sub key."
+ if [ -z "$sshKey" ] ; then
+ log " ! sub key could not be translated."
+ else
+ echo "0:${sshKey}"
+ fi
else
- echo "1:${fingerprint}"
+ log " - unacceptable sub key."
+ if [ -z "$sshKey" ] ; then
+ log " ! sub key could not be translated."
+ else
+ echo "1:${sshKey}"
+ fi
fi
;;
esac
@@ -429,28 +449,27 @@ process_host_known_hosts() {
local nKeys
local nKeysOK
local ok
- local keyid
+ local sshKey
local tmpfile
host="$1"
- log "processing host: $host"
+ log "processing: $host"
userID="ssh://${host}"
nKeys=0
nKeysOK=0
+ IFS=$'\n'
for line in $(process_user_id "ssh://${host}") ; do
# note that key was found
nKeys=$((nKeys+1))
ok=$(echo "$line" | cut -d: -f1)
- keyid=$(echo "$line" | cut -d: -f2)
+ sshKey=$(echo "$line" | cut -d: -f2)
- sshKey=$(gpg2ssh "$keyid")
if [ -z "$sshKey" ] ; then
- log " ! key could not be translated."
continue
fi
@@ -582,25 +601,24 @@ process_uid_authorized_keys() {
local nKeys
local nKeysOK
local ok
- local keyid
+ local sshKey
userID="$1"
- log "processing user ID: $userID"
+ log "processing: $userID"
nKeys=0
nKeysOK=0
+ IFS=$'\n'
for line in $(process_user_id "$userID") ; do
# note that key was found
nKeys=$((nKeys+1))
ok=$(echo "$line" | cut -d: -f1)
- keyid=$(echo "$line" | cut -d: -f2)
+ sshKey=$(echo "$line" | cut -d: -f2)
- sshKey=$(gpg2ssh "$keyid")
if [ -z "$sshKey" ] ; then
- log " ! key could not be translated."
continue
fi