Page MenuHomeFreeBSD

PR231649: pw: make checks in boolean_str() match reality
ClosedPublic

Authored by yuripv on Sep 24 2018, 3:49 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 28, 6:38 AM
Unknown Object (File)
Wed, Apr 24, 2:22 PM
Unknown Object (File)
Mar 22 2024, 9:17 PM
Unknown Object (File)
Mar 22 2024, 9:17 PM
Unknown Object (File)
Mar 22 2024, 9:17 PM
Unknown Object (File)
Mar 22 2024, 9:17 PM
Unknown Object (File)
Mar 22 2024, 9:17 PM
Unknown Object (File)
Mar 22 2024, 9:16 PM

Details

Summary

PR: 231649

boolean_str() has weird ideas about the possible values of val, make them match reality.

Test Plan
# /usr/obj/home/yuri/ws/pw/amd64.amd64/usr.sbin/pw/pw useradd -D -w no; grep defaultpasswd /etc/pw.conf
defaultpasswd = "no"
# /usr/obj/home/yuri/ws/pw/amd64.amd64/usr.sbin/pw/pw useradd -D -w none; grep defaultpasswd /etc/pw.conf
defaultpasswd = "none"
# /usr/obj/home/yuri/ws/pw/amd64.amd64/usr.sbin/pw/pw useradd -D -w random; grep defaultpasswd /etc/pw.conf
defaultpasswd = "random"
# /usr/obj/home/yuri/ws/pw/amd64.amd64/usr.sbin/pw/pw useradd -D -w yes; grep defaultpasswd /etc/pw.conf
defaultpasswd = "yes"
# /usr/obj/home/yuri/ws/pw/amd64.amd64/usr.sbin/pw/pw useradd -D -w whoa; grep defaultpasswd /etc/pw.conf
pw: Invalid value for default password
defaultpasswd = "yes"

Also, newly added test cases:

...
usr.sbin/pw/pw_useradd_test:user_add_conf_defaultpasswd  ->  passed  [0.089s]
...

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

yuripv edited the summary of this revision. (Show Details)

add fix for PR231653 helping added test cases

Just as a comment: boolean_str() problem seems to be a left-over after my change r326848 that changed magic values -2 .. 1 to symbols P_NONE etc. but missed a change for boolean_str().

This revision is now accepted and ready to land.Sep 30 2018, 10:56 AM
yuripv edited the summary of this revision. (Show Details)
yuripv edited the test plan for this revision. (Show Details)

rebase after the fix for PR231653 landed separately

This revision now requires review to proceed.Oct 21 2018, 11:53 AM
This revision is now accepted and ready to land.Oct 21 2018, 12:43 PM
This revision was automatically updated to reflect the committed changes.