summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorJameson Graef Rollins <jrollins@phys.columbia.edu>2008-06-13 14:56:01 -0400
committerJameson Graef Rollins <jrollins@phys.columbia.edu>2008-06-13 14:56:01 -0400
commit0c2c01095b4e3e707a08e9ff6ebe61f18689bcaa (patch)
treec77a0c6355c6665723f0740f42201267aa1a4162 /src/common
parent2fa88e2fde0f56774c76e5cbdc8ea2c67849f3c0 (diff)
Modify how logging is handled. Now send most everything to stderr.
Change to known_hosts hashing on by default.
Diffstat (limited to 'src/common')
-rw-r--r--src/common22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/common b/src/common
index 8b0f41a..0f98923 100644
--- a/src/common
+++ b/src/common
@@ -23,14 +23,8 @@ failure() {
exit ${2:-'1'}
}
-# write output to stdout
-log() {
- echo -n "ms: "
- echo "$@"
-}
-
# write output to stderr
-loge() {
+log() {
echo -n "ms: " 1>&2
echo "$@" 1>&2
}
@@ -153,7 +147,7 @@ process_user_id() {
# return 1 if there only "tru" lines are output from gpg
if [ -z "$(echo "$gpgOut" | grep -v '^tru:')" ] ; then
- loge " key not found."
+ log " key not found."
return 1
fi
@@ -182,18 +176,18 @@ process_user_id() {
# check primary key validity
if [ "$validity" != 'u' -a "$validity" != 'f' ] ; then
- loge " unacceptable primary key validity ($validity)."
+ log " unacceptable primary key validity ($validity)."
continue
fi
# check capability is not Disabled...
if check_capability "$capability" 'D' ; then
- loge " key disabled."
+ log " key disabled."
continue
fi
# check overall key capability
# must be Encryption and Authentication
if ! check_capability "$capability" $requiredPubCapability ; then
- loge " unacceptable primary key capability ($capability)."
+ log " unacceptable primary key capability ($capability)."
continue
fi
@@ -242,7 +236,7 @@ process_user_id() {
# key cache file
if [ "$keyOK" -a "$uidOK" -a "${keyIDs[*]}" ] ; then
for keyID in ${keyIDs[@]} ; do
- loge " acceptable key/uid found."
+ log " acceptable key/uid found."
if [ "$MODE" = 'known_hosts' ] ; then
# export the key
@@ -298,11 +292,11 @@ process_known_hosts() {
cacheDir="$2"
# take all the hosts from the known_hosts file (first field),
- # grep out all the hashed hosts (lines starting with '|')
+ # grep out all the hashed hosts (lines starting with '|')...
cut -d ' ' -f 1 "$knownHosts" | \
grep -v '^|.*$' | \
while IFS=, read -r -a hosts ; do
- # process each host
+ # ...and process each host
for host in ${hosts[*]} ; do
process_host "$host" "$cacheDir"
done