@@ -5,7 +5,7 @@ pub use cryptoki;
5
5
pub use r2d2;
6
6
7
7
use cryptoki:: {
8
- context:: Pkcs11 ,
8
+ context:: { Function , Pkcs11 } ,
9
9
error:: RvError ,
10
10
session:: { Session , SessionState , UserType } ,
11
11
slot:: { Limit , Slot } ,
@@ -101,9 +101,9 @@ impl SessionManager {
101
101
}
102
102
} ;
103
103
let res = match limit {
104
- Limit :: Max ( m) => Some ( m. try_into ( ) . unwrap_or ( u32:: max_value ( ) ) ) ,
104
+ Limit :: Max ( m) => Some ( m. try_into ( ) . unwrap_or ( u32:: MAX ) ) ,
105
105
Limit :: Unavailable => None ,
106
- Limit :: Infinite => Some ( u32:: max_value ( ) ) ,
106
+ Limit :: Infinite => Some ( u32:: MAX ) ,
107
107
} ;
108
108
Ok ( if let Some ( true ) = res. map ( |r| r > maximum) {
109
109
Some ( maximum)
@@ -136,7 +136,7 @@ impl ManageConnection for SessionManager {
136
136
} ;
137
137
if let Some ( user_type) = maybe_user_info {
138
138
match session. login ( user_type. 0 , Some ( user_type. 1 ) ) {
139
- Err ( Self :: Error :: Pkcs11 ( RvError :: UserAlreadyLoggedIn ) ) => { }
139
+ Err ( Self :: Error :: Pkcs11 ( RvError :: UserAlreadyLoggedIn , Function :: Login ) ) => { }
140
140
res => res?,
141
141
} ;
142
142
}
@@ -147,7 +147,10 @@ impl ManageConnection for SessionManager {
147
147
let actual_state = session. get_session_info ( ) ?. session_state ( ) ;
148
148
let expected_state = & self . session_type ;
149
149
if actual_state != expected_state. as_state ( ) {
150
- Err ( Self :: Error :: Pkcs11 ( RvError :: UserNotLoggedIn ) )
150
+ Err ( Self :: Error :: Pkcs11 (
151
+ RvError :: UserNotLoggedIn ,
152
+ Function :: GetSessionInfo ,
153
+ ) )
151
154
} else {
152
155
Ok ( ( ) )
153
156
}
0 commit comments