projects
/
monkeysphere.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
some cleanup to the proxycommand.
[monkeysphere.git]
/
src
/
common
diff --git
a/src/common
b/src/common
index 16235a2881f7b7c2c9480abe5e93c6d17681f28b..c70ba64593994959667bdaf23e1bfb0b79ab5db0 100644
(file)
--- a/
src/common
+++ b/
src/common
@@
-35,11
+35,15
@@
log() {
local priority
local level
local output
local priority
local level
local output
- # don't include SILENT in alllevels: it's handled separately
- # list in decreasing verbosity (all caps)
- local alllevels="DEBUG INFO ERROR"
+ local alllevels
local found=
local found=
+ # don't include SILENT in alllevels: it's handled separately
+ # list in decreasing verbosity (all caps).
+ # separate with $IFS explicitly, since we do some fancy footwork
+ # elsewhere.
+ alllevels="DEBUG${IFS}VERBOSE${IFS}INFO${IFS}ERROR"
+
# translate lowers to uppers in global log level
LOG_LEVEL=$(echo "$LOG_LEVEL" | tr "[:lower:]" "[:upper:]")
# translate lowers to uppers in global log level
LOG_LEVEL=$(echo "$LOG_LEVEL" | tr "[:lower:]" "[:upper:]")
@@
-48,7
+52,7
@@
log() {
return
fi
return
fi
- for level in $alllevels; do
+ for level in $alllevels
; do
if [ "$LOG_LEVEL" = "$level" ] ; then
found=true
fi
if [ "$LOG_LEVEL" = "$level" ] ; then
found=true
fi
@@
-409,7
+413,7
@@
gpg_fetch_userid() {
userID="$1"
userID="$1"
- log
info
" checking keyserver $KEYSERVER... "
+ log
verbose
" checking keyserver $KEYSERVER... "
echo 1,2,3,4,5 | \
gpg --quiet --batch --with-colons \
--command-fd 0 --keyserver "$KEYSERVER" \
echo 1,2,3,4,5 | \
gpg --quiet --batch --with-colons \
--command-fd 0 --keyserver "$KEYSERVER" \
@@
-481,7
+485,7
@@
process_user_id() {
# if the gpg query return code is not 0, return 1
if [ "$?" -ne 0 ] ; then
# if the gpg query return code is not 0, return 1
if [ "$?" -ne 0 ] ; then
- log
error
" no primary keys found."
+ log
verbose
" no primary keys found."
return 1
fi
return 1
fi
@@
-498,7
+502,7
@@
process_user_id() {
lastKeyOK=
fingerprint=
lastKeyOK=
fingerprint=
- log
error
" primary key found: $keyid"
+ log
verbose
" primary key found: $keyid"
# if overall key is not valid, skip
if [ "$validity" != 'u' -a "$validity" != 'f' ] ; then
# if overall key is not valid, skip
if [ "$validity" != 'u' -a "$validity" != 'f' ] ; then
@@
-547,7
+551,7
@@
process_user_id() {
# output a line for the primary key
# 0 = ok, 1 = bad
if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
# output a line for the primary key
# 0 = ok, 1 = bad
if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
- log
error
" * acceptable primary key."
+ log
verbose
" * acceptable primary key."
if [ -z "$sshKey" ] ; then
log error " ! primary key could not be translated (not RSA or DSA?)."
else
if [ -z "$sshKey" ] ; then
log error " ! primary key could not be translated (not RSA or DSA?)."
else
@@
-603,7
+607,7
@@
process_user_id() {
# output a line for the sub key
# 0 = ok, 1 = bad
if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
# output a line for the sub key
# 0 = ok, 1 = bad
if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
- log
error
" * acceptable sub key."
+ log
verbose
" * acceptable sub key."
if [ -z "$sshKey" ] ; then
log error " ! sub key could not be translated (not RSA or DSA?)."
else
if [ -z "$sshKey" ] ; then
log error " ! sub key could not be translated (not RSA or DSA?)."
else
@@
-638,7
+642,7
@@
process_host_known_hosts() {
host="$1"
userID="ssh://${host}"
host="$1"
userID="ssh://${host}"
- log
info
"processing: $host"
+ log
verbose
"processing: $host"
nKeys=0
nKeysOK=0
nKeys=0
nKeysOK=0
@@
-739,7
+743,7
@@
update_known_hosts() {
# note if the known_hosts file was updated
if [ "$(file_hash "$KNOWN_HOSTS")" != "$fileCheck" ] ; then
# note if the known_hosts file was updated
if [ "$(file_hash "$KNOWN_HOSTS")" != "$fileCheck" ] ; then
- log
info
"known_hosts file updated."
+ log
verbose
"known_hosts file updated."
fi
# if an acceptable host was found, return 0
fi
# if an acceptable host was found, return 0
@@
-762,7
+766,7
@@
update_known_hosts() {
process_known_hosts() {
local hosts
process_known_hosts() {
local hosts
- log
info
"processing known_hosts file..."
+ log
verbose
"processing known_hosts file..."
hosts=$(meat "$KNOWN_HOSTS" | cut -d ' ' -f 1 | grep -v '^|.*$' | tr , ' ' | tr '\n' ' ')
hosts=$(meat "$KNOWN_HOSTS" | cut -d ' ' -f 1 | grep -v '^|.*$' | tr , ' ' | tr '\n' ' ')
@@
-787,7
+791,7
@@
process_uid_authorized_keys() {
userID="$1"
userID="$1"
- log
info
"processing: $userID"
+ log
verbose
"processing: $userID"
nKeys=0
nKeysOK=0
nKeys=0
nKeysOK=0
@@
-882,7
+886,7
@@
update_authorized_keys() {
# note if the authorized_keys file was updated
if [ "$(file_hash "$AUTHORIZED_KEYS")" != "$fileCheck" ] ; then
# note if the authorized_keys file was updated
if [ "$(file_hash "$AUTHORIZED_KEYS")" != "$fileCheck" ] ; then
- log
info
"authorized_keys file updated."
+ log
verbose
"authorized_keys file updated."
fi
# if an acceptable id was found, return 0
fi
# if an acceptable id was found, return 0
@@
-909,7
+913,7
@@
process_authorized_user_ids() {
authorizedUserIDs="$1"
authorizedUserIDs="$1"
- log
info
"processing authorized_user_ids file..."
+ log
verbose
"processing authorized_user_ids file..."
if ! meat "$authorizedUserIDs" > /dev/null ; then
log error "no user IDs to process."
if ! meat "$authorizedUserIDs" > /dev/null ; then
log error "no user IDs to process."