log debug "removing matching key lines..."
tempfile=$(mktemp "${file}.XXXXXXX") || \
failure "Unable to make temp file '${file}.XXXXXXX'"
- grep -v -x -F "$lines" "$file" >"$tempfile"
+ grep -v -x -F "$lines" "$file" >"$tempfile" || :
mv -f "$tempfile" "$file"
fi
}
# directories with correct permissions
touch_key_file_or_fail() {
local keyFile="$1"
+ local newUmask
+
if [ ! -f "$keyFile" ]; then
# make sure to create files and directories with the
# appropriate write bits turned off:
gpg_fetch_userid "$userID"
# output gpg info for (exact) userid and store
- gpgOut=$(gpg --list-key --fixed-list-mode --with-colon \
+ gpgOut=$(gpg --list-key --fixed-list-mode --with-colons \
--with-fingerprint --with-fingerprint \
="$userID" 2>/dev/null) || returnCode="$?"
esac
fi
+ ((++KEYS_PROCESSED))
+
# if key OK, add new key line
if [ "$ok" -eq '0' ] ; then
case "$FILE_TYPE" in
;;
esac
- echo "$keyLine" | log debug
+ echo "key line: $keyLine" | log debug
if [[ "$keyFile" == '-' ]] ; then
echo "$keyLine"
else
+ log debug "adding key line to file..."
echo "$keyLine" >>"$keyFile"
fi
+
+ ((++KEYS_VALID))
fi
done
+
+ log debug "KEYS_PROCESSED=$KEYS_PROCESSED"
+ log debug "KEYS_VALID=$KEYS_VALID"
}
# process an authorized_user_ids file on stdin for authorized_keys