Mercurial > crates > nonstick
comparison testharness/src/lib.rs @ 167:0cabe7b94a4f
Check for old_authtok in change_authtok to emulate real behavior.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Tue, 15 Jul 2025 00:39:08 -0400 |
parents | 2f5913131295 |
children | 6642e89d29a2 |
comparison
equal
deleted
inserted
replaced
166:2f5913131295 | 167:0cabe7b94a4f |
---|---|
86 action: AuthtokAction, | 86 action: AuthtokAction, |
87 _flags: AuthtokFlags, | 87 _flags: AuthtokFlags, |
88 ) -> nonstick::Result<()> { | 88 ) -> nonstick::Result<()> { |
89 match action { | 89 match action { |
90 AuthtokAction::PreliminaryCheck => { | 90 AuthtokAction::PreliminaryCheck => { |
91 if handle.old_authtok(None)?.as_bytes() != b"old token!" { | |
92 return Err(ErrorCode::AuthenticationError); | |
93 } | |
91 let password = handle.authtok(None)?; | 94 let password = handle.authtok(None)?; |
92 if password.as_bytes() != b"acceptable" { | 95 if password.as_bytes() != b"acceptable" { |
93 return Err(ErrorCode::PermissionDenied); | 96 return Err(ErrorCode::PermissionDenied); |
94 } | 97 } |
95 handle.set_module_data("checked_pass", password) | 98 handle.set_module_data("checked_pass", password) |