@@ -6,13 +6,13 @@ use crate::common::{
66} ;
77use crate :: exec:: Umask ;
88use crate :: sudoers:: ast:: { ExecControl , Tag } ;
9- use crate :: system:: { time :: Duration , Hostname , User } ;
9+ use crate :: system:: { Hostname , User } ;
1010/// Data types and traits that represent what the "terms and conditions" are after a successful
1111/// permission check.
1212///
1313/// The trait definitions can be part of some global crate in the future, if we support more
1414/// than just the sudoers file.
15- use std:: collections:: HashSet ;
15+ use std:: { collections:: HashSet , time :: Duration } ;
1616
1717#[ must_use]
1818#[ cfg_attr( test, derive( Debug , PartialEq ) ) ]
@@ -38,11 +38,11 @@ impl super::Settings {
3838 Authentication {
3939 must_authenticate : tag. needs_passwd ( ) ,
4040 allowed_attempts : self . passwd_tries ( ) . try_into ( ) . unwrap ( ) ,
41- prior_validity : Duration :: seconds ( self . timestamp_timeout ( ) ) ,
41+ prior_validity : Duration :: from_secs ( self . timestamp_timeout ( ) ) ,
4242 pwfeedback : self . pwfeedback ( ) ,
4343 password_timeout : match self . passwd_timeout ( ) {
4444 0 => None ,
45- timeout => Some ( Duration :: seconds ( timeout) ) ,
45+ timeout => Some ( Duration :: from_secs ( timeout) ) ,
4646 } ,
4747 credential : if self . rootpw ( ) {
4848 AuthenticatingUser :: Root
@@ -191,10 +191,10 @@ mod test {
191191 Authentication {
192192 must_authenticate: true ,
193193 allowed_attempts: 3 ,
194- prior_validity: Duration :: minutes ( 15 ) ,
194+ prior_validity: Duration :: from_secs ( 15 * 60 ) ,
195195 credential: AuthenticatingUser :: InvokingUser ,
196196 pwfeedback: false ,
197- password_timeout: Some ( Duration :: seconds ( 300 ) ) ,
197+ password_timeout: Some ( Duration :: from_secs ( 300 ) ) ,
198198 } ,
199199 ) ;
200200
@@ -208,10 +208,10 @@ mod test {
208208 Authentication {
209209 must_authenticate: false ,
210210 allowed_attempts: 3 ,
211- prior_validity: Duration :: minutes ( 15 ) ,
211+ prior_validity: Duration :: from_secs ( 15 * 60 ) ,
212212 credential: AuthenticatingUser :: InvokingUser ,
213213 pwfeedback: false ,
214- password_timeout: Some ( Duration :: seconds ( 300 ) ) ,
214+ password_timeout: Some ( Duration :: from_secs ( 300 ) ) ,
215215 } ,
216216 ) ;
217217 assert_eq ! ( restrictions, restrictions2) ;
0 commit comments