Move to /var/lib/monkeysphere instead of /var/cache/monkeysphere.
[monkeysphere.git] / src / common
index 9fd156b862b3a47d1a2ea89daabbc26dbfa09511..ead3736d7241ae1709dceff82494fc66b17e6dfb 100644 (file)
@@ -16,8 +16,6 @@
 # managed directories
 ETC="/etc/monkeysphere"
 export ETC
-CACHE="/var/cache/monkeysphere"
-export CACHE
 
 ########################################################################
 ### UTILITY FUNCTIONS
@@ -115,9 +113,7 @@ translate_ssh_variables() {
 gpg2ssh() {
     local keyID
     
-    #keyID="$1" #TMP
-    # only use last 16 characters until openpgp2ssh can take all 40 #TMP
-    keyID=$(echo "$1" | cut -c 25-) #TMP
+    keyID="$1"
 
     gpg --export "$keyID" | openpgp2ssh "$keyID" 2> /dev/null
 }
@@ -445,6 +441,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 +525,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"