@@ -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
@@ -190,10 +190,10 @@ mod test {
190190 Authentication {
191191 must_authenticate: true ,
192192 allowed_attempts: 3 ,
193- prior_validity: Duration :: minutes ( 15 ) ,
193+ prior_validity: Duration :: from_secs ( 15 * 60 ) ,
194194 credential: AuthenticatingUser :: InvokingUser ,
195195 pwfeedback: false ,
196- password_timeout: Some ( Duration :: seconds ( 300 ) ) ,
196+ password_timeout: Some ( Duration :: from_secs ( 300 ) ) ,
197197 } ,
198198 ) ;
199199
@@ -207,10 +207,10 @@ mod test {
207207 Authentication {
208208 must_authenticate: false ,
209209 allowed_attempts: 3 ,
210- prior_validity: Duration :: minutes ( 15 ) ,
210+ prior_validity: Duration :: from_secs ( 15 * 60 ) ,
211211 credential: AuthenticatingUser :: InvokingUser ,
212212 pwfeedback: false ,
213- password_timeout: Some ( Duration :: seconds ( 300 ) ) ,
213+ password_timeout: Some ( Duration :: from_secs ( 300 ) ) ,
214214 } ,
215215 ) ;
216216 assert_eq ! ( restrictions, restrictions2) ;
0 commit comments