diff options
author | Jameson Rollins <jrollins@finestructure.net> | 2010-10-18 23:34:06 -0400 |
---|---|---|
committer | Jameson Rollins <jrollins@finestructure.net> | 2010-10-18 23:34:06 -0400 |
commit | 2072a06faaf49615a75ef216b296abfbf14e1262 (patch) | |
tree | f847b087c8eb5b432c8c5d4a3ef4caa94d4c1615 /src/share | |
parent | 50f1ff1c641bd02e96a08929ae1c0761e4a5a07d (diff) |
fix remove_monkeysphere_lines function to just read from stdin and write to stdout
Diffstat (limited to 'src/share')
-rw-r--r-- | src/share/common | 26 | ||||
-rw-r--r-- | src/share/m/update_authorized_keys | 2 |
2 files changed, 3 insertions, 25 deletions
diff --git a/src/share/common b/src/share/common index 54c1b2a..8c21a83 100644 --- a/src/share/common +++ b/src/share/common @@ -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 diff --git a/src/share/m/update_authorized_keys b/src/share/m/update_authorized_keys index 03f6306..5449951 100644 --- a/src/share/m/update_authorized_keys +++ b/src/share/m/update_authorized_keys @@ -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" |