File tree Expand file tree Collapse file tree 5 files changed +13
-15
lines changed Expand file tree Collapse file tree 5 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,7 @@ use std::time::Duration;
44
55use crate :: cutils:: string_from_ptr;
66use crate :: pam:: rpassword:: Hidden ;
7- use crate :: system:: {
8- signal:: { self , SignalSet } ,
9- } ;
7+ use crate :: system:: signal:: { self , SignalSet } ;
108
119use super :: sys:: * ;
1210
Original file line number Diff line number Diff line change @@ -7,9 +7,7 @@ use std::{
77 time:: Duration ,
88} ;
99
10- use crate :: system:: {
11- signal:: { self , SignalSet } ,
12- } ;
10+ use crate :: system:: signal:: { self , SignalSet } ;
1311
1412use converse:: ConverserData ;
1513use error:: pam_err;
Original file line number Diff line number Diff line change 1- use std:: { ffi:: OsString , time:: Duration } ;
1+ use std:: ffi:: OsString ;
2+ use std:: time:: Duration ;
23
34use crate :: common:: context:: LaunchType ;
45use crate :: common:: error:: Error ;
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ use crate::system::{Hostname, User};
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 , time:: Duration } ;
15+ use std:: collections:: HashSet ;
16+ use std:: time:: Duration ;
1617
1718#[ must_use]
1819#[ cfg_attr( test, derive( Debug , PartialEq ) ) ]
@@ -191,7 +192,7 @@ mod test {
191192 Authentication {
192193 must_authenticate: true ,
193194 allowed_attempts: 3 ,
194- prior_validity: Duration :: from_secs ( 15 * 60 ) ,
195+ prior_validity: Duration :: from_mins ( 15 ) ,
195196 credential: AuthenticatingUser :: InvokingUser ,
196197 pwfeedback: false ,
197198 password_timeout: Some ( Duration :: from_secs( 300 ) ) ,
Original file line number Diff line number Diff line change @@ -54,9 +54,9 @@ impl SystemTime {
5454 }
5555
5656 #[ inline]
57- pub fn checked_add ( self , rhs : Duration ) -> Option < SystemTime > {
58- let rhs_secs = rhs. as_nanos ( ) . div_euclid ( 1_000_000_000 ) . try_into ( ) . ok ( ) ?;
59- let rhs_nsecs = rhs. as_nanos ( ) . rem_euclid ( 1_000_000_000 ) . try_into ( ) . ok ( ) ?;
57+ fn checked_add ( self , rhs : Duration ) -> Option < SystemTime > {
58+ let rhs_secs = rhs. as_secs ( ) . try_into ( ) . ok ( ) ?;
59+ let rhs_nsecs = rhs. subsec_nanos ( ) . try_into ( ) . ok ( ) ?;
6060
6161 let secs = self . secs . checked_add ( rhs_secs) ?;
6262 let nsecs = self . nsecs . checked_add ( rhs_nsecs) ?;
@@ -65,9 +65,9 @@ impl SystemTime {
6565 }
6666
6767 #[ inline]
68- pub fn checked_sub ( self , rhs : Duration ) -> Option < SystemTime > {
69- let rhs_secs = rhs. as_nanos ( ) . div_euclid ( 1_000_000_000 ) . try_into ( ) . ok ( ) ?;
70- let rhs_nsecs = rhs. as_nanos ( ) . rem_euclid ( 1_000_000_000 ) . try_into ( ) . ok ( ) ?;
68+ fn checked_sub ( self , rhs : Duration ) -> Option < SystemTime > {
69+ let rhs_secs = rhs. as_secs ( ) . try_into ( ) . ok ( ) ?;
70+ let rhs_nsecs = rhs. subsec_nanos ( ) . try_into ( ) . ok ( ) ?;
7171
7272 let secs = self . secs . checked_sub ( rhs_secs) ?;
7373 let nsecs = self . nsecs . checked_sub ( rhs_nsecs) ?;
You can’t perform that action at this time.
0 commit comments