Deleted Added
full compact
check-password.4th (329145) check-password.4th (339697)
1\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
2\ All rights reserved.
3\
4\ Redistribution and use in source and binary forms, with or without
5\ modification, are permitted provided that the following conditions
6\ are met:
7\ 1. Redistributions of source code must retain the above copyright
8\ notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23\ SUCH DAMAGE.
24\
1\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
2\ All rights reserved.
3\
4\ Redistribution and use in source and binary forms, with or without
5\ modification, are permitted provided that the following conditions
6\ are met:
7\ 1. Redistributions of source code must retain the above copyright
8\ notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23\ SUCH DAMAGE.
24\
25\ $FreeBSD: stable/11/stand/forth/check-password.4th 281616 2015-04-16 20:53:15Z dteske $
25\ $FreeBSD: stable/11/stand/forth/check-password.4th 339697 2018-10-24 23:17:17Z dteske $
26
27marker task-check-password.4th
28
29include /boot/screen.4th
30
31vocabulary password-processing
32only forth also password-processing definitions
33

--- 90 unchanged lines hidden (view full) ---

124 \ at readmax except for Backspace or Enter
125 readlen @ 1+ dup readlen ! 1- readval + c!
126 then then then
127
128 drop \ last key pressed
129 again \ Enter was not pressed; repeat
130;
131
26
27marker task-check-password.4th
28
29include /boot/screen.4th
30
31vocabulary password-processing
32only forth also password-processing definitions
33

--- 90 unchanged lines hidden (view full) ---

124 \ at readmax except for Backspace or Enter
125 readlen @ 1+ dup readlen ! 1- readval + c!
126 then then then
127
128 drop \ last key pressed
129 again \ Enter was not pressed; repeat
130;
131
132only forth definitions also password-processing
132only forth definitions also password-processing also support-functions
133
134: check-password ( -- )
135
136 \ Do not allow the user to proceed beyond this point if a boot-lock
137 \ password has been set (preventing even boot from proceeding)
138 s" bootlock_password" getenv dup -1 <> if
139 dup readmax > if drop readmax then
140 begin

--- 15 unchanged lines hidden (view full) ---

156 else drop then
157
158 \ Exit if a password was not set
159 s" password" getenv -1 = if exit else drop then
160
161 \ We should prevent the user from visiting the menu or dropping to the
162 \ interactive loader(8) prompt, but still allow the machine to boot...
163
133
134: check-password ( -- )
135
136 \ Do not allow the user to proceed beyond this point if a boot-lock
137 \ password has been set (preventing even boot from proceeding)
138 s" bootlock_password" getenv dup -1 <> if
139 dup readmax > if drop readmax then
140 begin

--- 15 unchanged lines hidden (view full) ---

156 else drop then
157
158 \ Exit if a password was not set
159 s" password" getenv -1 = if exit else drop then
160
161 \ We should prevent the user from visiting the menu or dropping to the
162 \ interactive loader(8) prompt, but still allow the machine to boot...
163
164 any_conf_read? if load_kernel load_modules then
164 0 autoboot
165
166 \ Only reached if autoboot fails for any reason (including if/when
167 \ the user aborts/escapes the countdown sequence leading to boot).
168
169 s" password" getenv dup readmax > if drop readmax then
170 begin
171 s" Password: " read ( prompt -- )
172 2dup readval readlen @ compare 0= if \ Correct password?
173 2drop read-reset exit
174 then
175 3000 ms ." loader: incorrect password" 10 emit
176 again
177;
178
179only forth definitions
165 0 autoboot
166
167 \ Only reached if autoboot fails for any reason (including if/when
168 \ the user aborts/escapes the countdown sequence leading to boot).
169
170 s" password" getenv dup readmax > if drop readmax then
171 begin
172 s" Password: " read ( prompt -- )
173 2dup readval readlen @ compare 0= if \ Correct password?
174 2drop read-reset exit
175 then
176 3000 ms ." loader: incorrect password" 10 emit
177 again
178;
179
180only forth definitions