Merge commit 'dkg/master'
[monkeysphere.git] / src / common
index 9dcc5e869986188cb58b4eef491f93aac1f9e3a7..5bb0b79fac779d08348721f2d3e5d6df0f29ed5a 100644 (file)
@@ -109,7 +109,7 @@ translate_ssh_variables() {
     echo "$path"
 }
 
-### CONVERTION UTILITIES
+### CONVERSION UTILITIES
 
 # output the ssh key for a given key ID
 gpg2ssh() {
@@ -263,7 +263,7 @@ process_user_id() {
     fi
     requiredPubCapability=$(echo "$requiredCapability" | tr "[:lower:]" "[:upper:]")
 
-    # if CHECK_KEYSERVER variable set, check the keyserver
+    # if CHECK_KEYSERVER variable set to true, check the keyserver
     # for the user ID
     if [ "$CHECK_KEYSERVER" = "true" ] ; then
        gpg_fetch_userid "$userID"
@@ -445,6 +445,9 @@ update_known_hosts() {
     # least one host
     returnCode=0
 
+    # set the trap to remove any lockfiles on exit
+    trap "lockfile-remove $KNOWN_HOSTS" EXIT
+
     # create a lockfile on known_hosts
     lockfile-create "$KNOWN_HOSTS"
 
@@ -526,6 +529,9 @@ update_authorized_keys() {
     # at least one user ID
     returnCode=0
 
+    # set the trap to remove any lockfiles on exit
+    trap "lockfile-remove $AUTHORIZED_KEYS" EXIT
+
     # create a lockfile on authorized_keys
     lockfile-create "$AUTHORIZED_KEYS"