]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
adduser: allow standard IFS characters in passwords
authorKyle Evans <kevans@FreeBSD.org>
Sun, 5 Apr 2020 19:25:46 +0000 (19:25 +0000)
committerKyle Evans <kevans@FreeBSD.org>
Sun, 5 Apr 2020 19:25:46 +0000 (19:25 +0000)
Notably, the default IFS contains space/tab, thus any leading/trailing
whitespace characters tend to be removed.

Set IFS= for just the read lines to mitigate this, allowing the user to be
less surprised when their leading/trailing spaces weren't actually captured
in the password as they are with other means of setting a user's password.

PR: 245342
Submitted by: dereks_lifeofadishwasher.com
Reviewed by: jilles
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24292

adduser/adduser.sh

index 5f80d77f7ca65bfaa9fd3e986ccf63e535516901..91a1b4b4cf016aa4a048a2fea2487d65112274e7 100644 (file)
@@ -733,10 +733,10 @@ input_interactive() {
                                        trap 'stty echo; exit' 0 1 2 3 15
                                        stty -echo
                                        echo -n "Enter password: "
-                                       read -r upass
+                                       IFS= read -r upass
                                        echo''
                                        echo -n "Enter password again: "
-                                       read -r _passconfirm
+                                       IFS= read -r _passconfirm
                                        echo ''
                                        stty echo
                                        # if user entered a blank password