fix remove_monkeysphere_lines function to just read from stdin and write to stdout
authorJameson Rollins <jrollins@finestructure.net>
Tue, 19 Oct 2010 03:34:06 +0000 (23:34 -0400)
committerJameson Rollins <jrollins@finestructure.net>
Tue, 19 Oct 2010 03:34:06 +0000 (23:34 -0400)
src/share/common
src/share/m/update_authorized_keys

index 54c1b2a14e87908255edca56d8b489d4e72c27ca..8c21a836f5dbb270a84fba00de0c8eb134f0def1 100644 (file)
@@ -355,31 +355,9 @@ remove_line() {
     fi
 }
 
-# remove all lines with MonkeySphere strings in file
+# remove all lines with MonkeySphere strings from stdin
 remove_monkeysphere_lines() {
-    local file
-    local tempfile
-
-    file="$1"
-
-    # return error if file does not exist
-    if [ ! -e "$file" ] ; then
-       return 1
-    fi
-
-    # just return ok if the file is empty, since there aren't any
-    # lines to remove
-    if [ ! -s "$file" ] ; then
-       return 0
-    fi
-
-    tempfile=$(mktemp "${file}.XXXXXXX") || \
-       failure "Could not make temporary file '${file}.XXXXXXX'."
-
-    egrep -v ' MonkeySphere[[:digit:]]{4}(-[[:digit:]]{2}){2}T[[:digit:]]{2}(:[[:digit:]]{2}){2} ' \
-       "$file" >"$tempfile" || true
-    cat "$tempfile" > "$file"
-    rm "$tempfile"
+    egrep -v ' MonkeySphere[[:digit:]]{4}(-[[:digit:]]{2}){2}T[[:digit:]]{2}(:[[:digit:]]{2}){2} '
 }
 
 # translate ssh-style path variables %h and %u
index 03f6306ef686fb7807a0166786cda7275b176c9e..544995155f08855e05e54b8ab8ffdd1dd3788fb1 100644 (file)
@@ -32,7 +32,7 @@ update_authorized_keys() {
     # remove any monkeysphere lines from authorized_keys file this is
     # to insure that that all old authorized keys that are no longer
     # authorized are removed
-    remove_monkeysphere_lines "$AUTHORIZED_KEYS" > "$tmpFile"
+    remove_monkeysphere_lines <"$AUTHORIZED_KEYS" >"$tmpFile"
 
     process_authorized_user_ids "$tmpFile" \
        < "$AUTHORIZED_USER_IDS"