Skip to content

Commit a76d8d3

Browse files
committed
Merge remote-tracking branch 'ArrayBolt3/arraybolt3/trixie'
2 parents 543b45c + ae4eb79 commit a76d8d3

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

usr/sbin/autologinchange

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ cli_disable_autologin() {
452452
return 0
453453
fi
454454
disable_sysmaint_autologin
455+
warn_on_unusable_password 'sysmaint'
455456
return 0
456457
fi
457458

@@ -462,13 +463,21 @@ cli_disable_autologin() {
462463
fi
463464

464465
disable_autologin "${user}"
466+
warn_on_unusable_password "${user}"
465467
}
466468

467-
warn_on_empty_user_password() {
468-
if [ -z "$(get_clean_pass "$1")" ]; then
469-
printf '%s\n' "${red}WARNING:${nocolor} Account '$1' has no password set." >&2
470-
printf '%s\n' "Users can log into this account knowing only the username." >&2
471-
printf '%s\n' "You can use the 'pwchange' utility to change this." >&2
469+
warn_on_unusable_password() {
470+
local user
471+
user="$1"
472+
if is_pass_locked "${user}" || is_pass_disabled "${user}"; then
473+
printf '%s\n' "${red}WARNING:${nocolor} Account '${user}' has a locked or disabled password." >&2
474+
printf '%s\n' "You will NOT be able to log in manually to this account." >&2
475+
printf '%s\n' "You can use the 'pwchange' utility to set a password." >&2
476+
printf '%s\n' "See https://www.kicksecure.com/wiki/User#Locking_a_Password for more information." >&2
477+
elif [ -z "$(get_clean_pass "${user}")" ]; then
478+
printf '%s\n' "${red}WARNING:${nocolor} Account '${user}' has no password set." >&2
479+
printf '%s\n' "Anyone can log into this account knowing only the username." >&2
480+
printf '%s\n' "You can use the 'pwchange' utility to set a password." >&2
472481
printf '%s\n' "See https://www.kicksecure.com/wiki/Login for more information." >&2
473482
fi
474483
}
@@ -497,7 +506,7 @@ autologinchange() {
497506
if [ "${disable_yn,,}" = 'y' ]; then
498507
disable_autologin "${user}"
499508
printf '%s\n' "SUCCESS: Autologin for account '$user' disabled." >&2
500-
warn_on_empty_user_password "$user"
509+
warn_on_unusable_password "${user}"
501510
else
502511
printf '%s\n' "CANCELLED disabling autologin for account '$user'." >&2
503512
fi
@@ -510,7 +519,7 @@ autologinchange() {
510519
if [ "${disable_yn,,}" = 'y' ]; then
511520
disable_sysmaint_autologin
512521
printf '%s\n' "SUCCESS: Autologin for account 'sysmaint' disabled." >&2
513-
warn_on_empty_user_password 'sysmaint'
522+
warn_on_unusable_password 'sysmaint'
514523
else
515524
printf '%s\n' "CANCELLED disabling autologin for account 'sysmaint'." >&2
516525
fi

0 commit comments

Comments
 (0)