File tree Expand file tree Collapse file tree 2 files changed +25
-11
lines changed Expand file tree Collapse file tree 2 files changed +25
-11
lines changed Original file line number Diff line number Diff line change @@ -122,11 +122,16 @@ pub fn load_ak(
122122        . with_decrypt ( true ) 
123123        . with_encrypt ( true ) 
124124        . build ( ) ; 
125-     context. tr_sess_set_attributes ( 
126-         policy_auth_session, 
127-         session_attributes, 
128-         session_attributes_mask, 
129-     ) ?; 
125+     context
126+         . tr_sess_set_attributes ( 
127+             policy_auth_session, 
128+             session_attributes, 
129+             session_attributes_mask, 
130+         ) 
131+         . or_else ( |e| { 
132+             context. flush_context ( SessionHandle :: from ( policy_auth_session) . into ( ) ) ?; 
133+             Err ( e) 
134+         } ) ?; 
130135
131136    let  key_handle = context. execute_with_temporary_object ( 
132137        SessionHandle :: from ( policy_auth_session) . into ( ) , 
@@ -182,11 +187,16 @@ pub fn create_ak<IKC: IntoKeyCustomization>(
182187        . with_decrypt ( true ) 
183188        . with_encrypt ( true ) 
184189        . build ( ) ; 
185-     context. tr_sess_set_attributes ( 
186-         policy_auth_session, 
187-         session_attributes, 
188-         session_attributes_mask, 
189-     ) ?; 
190+     context
191+         . tr_sess_set_attributes ( 
192+             policy_auth_session, 
193+             session_attributes, 
194+             session_attributes_mask, 
195+         ) 
196+         . or_else ( |e| { 
197+             context. flush_context ( SessionHandle :: from ( policy_auth_session) . into ( ) ) ?; 
198+             Err ( e) 
199+         } ) ?; 
190200
191201    context. execute_with_temporary_object ( 
192202        SessionHandle :: from ( policy_auth_session) . into ( ) , 
Original file line number Diff line number Diff line change @@ -305,7 +305,11 @@ impl Context {
305305            . with_decrypt ( true ) 
306306            . with_encrypt ( true ) 
307307            . build ( ) ; 
308-         self . tr_sess_set_attributes ( auth_session,  session_attributes,  session_attributes_mask) ?; 
308+         self . tr_sess_set_attributes ( auth_session,  session_attributes,  session_attributes_mask) 
309+             . or_else ( |e| { 
310+                 self . flush_context ( SessionHandle :: from ( auth_session) . into ( ) ) ?; 
311+                 Err ( e) 
312+             } ) ?; 
309313
310314        let  res = self . execute_with_session ( Some ( auth_session) ,  f) ; 
311315
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments