Skip to content

Commit bec657d

Browse files
committed
fix: api log-follow, console password check
1 parent 7624fe7 commit bec657d

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎system/cuos/api.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,12 @@ api_command_log_follow() {
279279
local input
280280
input="$(cat)"
281281
local since
282-
since="$(echo "${input}" | jq -r '.message // ""')"
282+
since="$(echo "${input}" | jq -r '.since // ""')"
283283
local journalctl_args=(-t cuos -n 100 -o json -f)
284284
if [ -n "$since" ]; then
285-
since_args+=(--since "$since")
285+
journalctl_args+=(--since "$since")
286286
fi
287-
journalctl "${journalctl_args[@]}" | jq -c '{
287+
journalctl "${journalctl_args[@]}" | jq --unbuffered -c '{
288288
date: (.["__REALTIME_TIMESTAMP"] | tonumber / 1000000 | strftime("%Y-%m-%dT%H:%M:%S")),
289289
level: ({"0":"EMERGENCY","1":"ALERT","2":"CRITICAL","3":"ERROR","4":"WARNING","5":"NOTICE","6":"INFO","7":"DEBUG"}[.PRIORITY] // "INFO"),
290290
message: .MESSAGE

‎system/cuos/dialog-maintenance.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,10 @@ check_password() {
373373

374374
if [[ "${hash}" =~ ^\$[0-9a-z]+\$ ]] || [[ ${#hash} -gt 50 ]]; then
375375
local salt
376-
salt="$(printf '%s' "$hash" | sed -E 's/^(\$6\$[^$]+\$).*$/\1/')"
376+
salt="$(printf '%s' "$hash" | sed -E 's/^\$6\$([^$]+)\$.*$/\1/')"
377377

378378
# Recreate and compare
379-
test_hash="$(printf '%s' "$pass" | openssl passwd -6 -salt "${salt#\$6\$}" -stdin)"
379+
test_hash="$(printf '%s' "$pass" | openssl passwd -6 -salt "${salt}" -stdin)"
380380

381381
if [ "$test_hash" = "$hash" ]; then
382382
return 0

0 commit comments

Comments
 (0)