fix bugs in ssh key export functions
[monkeysphere.git] / src / common
old mode 100755 (executable)
new mode 100644 (file)
index d7caefd..8b0f41a
@@ -14,8 +14,8 @@
 # managed directories
 ETC="/etc/monkeysphere"
 export ETC
-LIB="/var/lib/monkeysphere"
-export LIB 
+CACHE="/var/cache/monkeysphere"
+export CACHE
 ########################################################################
 
 failure() {
@@ -98,7 +98,7 @@ gpg2known_hosts() {
     echo -n "$host "
     gpg --export "$keyID" | \
        openpgp2ssh "$keyID" | tr -d '\n'
-    echo "MonkeySphere${DATE}"
+    echo " MonkeySphere${DATE}"
 }
 
 # convert key from gpg to ssh authorized_keys format
@@ -109,9 +109,9 @@ gpg2authorized_keys() {
     keyID="$1"
     userID="$2"
 
-    echo -n "MonkeySphere${DATE}:${userID}"
     gpg --export "$keyID" | \
-       openpgp2ssh "$keyID"
+       openpgp2ssh "$keyID" | tr -d '\n'
+    echo " MonkeySphere${DATE}:${userID}"
 }
 
 # userid and key policy checking
@@ -312,13 +312,13 @@ process_known_hosts() {
 # update an authorized_keys file after first processing the 
 # authorized_user_ids file
 update_authorized_keys() {
-    local cacheDir
     local msAuthorizedKeys
     local userAuthorizedKeys
+    local cacheDir
 
-    cacheDir="$1"
-    msAuthorizedKeys="$2"
-    userAuthorizedKeys="$3"
+    msAuthorizedKeys="$1"
+    userAuthorizedKeys="$2"
+    cacheDir="$3"
 
     process_authorized_ids "$AUTHORIZED_USER_IDS" "$cacheDir"