diff options
author | Jameson Rollins <jrollins@finestructure.net> | 2010-10-18 09:55:53 -0400 |
---|---|---|
committer | Jameson Rollins <jrollins@finestructure.net> | 2010-10-18 16:34:32 -0400 |
commit | df882c1e7e63fc658d0296dbd272499923fc4c69 (patch) | |
tree | e9e7e364780bc6429e09340d74e1bf7dc580be33 /src/monkeysphere | |
parent | 7f20193196c87b2cff0bf95d5ec53b5be3bdabb8 (diff) |
Simplification/refactoring of key/file processing
This is a fairly major overhaul to greatly reduce the number of
redundant code paths. We here created a new process_keys_for_file
function that processes key from a userid for a given key file. All
the main top elevel functions now call this one function.
The main top level monkeysphere functions for updating the user's
authorized_keys and known_hosts files are now moved to their own
sourced files, which greatly reduces the amount of code sourced with
common.
monkeysphere now updates authorized_keys and known_hosts in temporary
files that are then atomically moved into place upon completion.
Finally, removed the confusing return codes in the key/file processing
functions that were based on number of valid/invalid keys processed.
It was confusing in the presence of actual errors that stopped
processing.
Diffstat (limited to 'src/monkeysphere')
-rwxr-xr-x | src/monkeysphere | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/monkeysphere b/src/monkeysphere index 0aa4a84..9d0685b 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -220,6 +220,8 @@ case $COMMAND in # whether or not to check keyservers CHECK_KEYSERVER=${MONKEYSPHERE_CHECK_KEYSERVER:=${CHECK_KEYSERVER:="true"}} + source "${MSHAREDIR}/update_known_hosts" + # if hosts are specified on the command line, process just # those hosts if [ "$1" ] ; then @@ -235,9 +237,8 @@ case $COMMAND in 'update-authorized_keys'|'update-authorized-keys'|'a') # whether or not to check keyservers CHECK_KEYSERVER=${MONKEYSPHERE_CHECK_KEYSERVER:=${CHECK_KEYSERVER:="true"}} - - # process authorized_user_ids file - process_authorized_user_ids "$AUTHORIZED_USER_IDS" + source "${MSHAREDIR}/update_authorized_keys" + update_authorized_keys ;; 'import-subkey'|'import'|'i') @@ -267,17 +268,20 @@ case $COMMAND in 'keys-for-userid'|'u') CHECK_KEYSERVER=${MONKEYSPHERE_CHECK_KEYSERVER:=${CHECK_KEYSERVER:="true"}} + source "${MSHAREDIR}/keys_for_userid" keys_for_userid "$@" ;; 'sshfprs-for-userid') CHECK_KEYSERVER=${MONKEYSPHERE_CHECK_KEYSERVER:=${CHECK_KEYSERVER:="true"}} + source "${MSHAREDIR}/keys_for_userid" keys_for_userid "$@" | "$SYSSHAREDIR/keytrans" sshfpr ;; 'keys-from-userid') echo "Warning: 'keys-from-userid' is deprecated. Please use 'keys-for-userid' instead." >&2 CHECK_KEYSERVER=${MONKEYSPHERE_CHECK_KEYSERVER:=${CHECK_KEYSERVER:="true"}} + source "${MSHAREDIR}/keys_for_userid" keys_for_userid "$@" ;; |