11extern crate libc;
22extern crate security_framework;
33extern crate security_framework_sys;
4- extern crate tempfile;
54
65use self :: security_framework:: base;
76use self :: security_framework:: certificate:: SecCertificate ;
@@ -12,7 +11,6 @@ use self::security_framework::secure_transport::{
1211 self , ClientBuilder , SslConnectionType , SslContext , SslProtocol , SslProtocolSide ,
1312} ;
1413use self :: security_framework_sys:: base:: { errSecIO, errSecParam} ;
15- use self :: tempfile:: TempDir ;
1614use std:: error;
1715use std:: fmt;
1816use std:: io;
@@ -38,7 +36,7 @@ use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder};
3836static SET_AT_EXIT : Once = Once :: new ( ) ;
3937
4038#[ cfg( not( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
41- static TEMP_KEYCHAIN : Mutex < Option < ( SecKeychain , TempDir ) > > = Mutex :: new ( None ) ;
39+ static TEMP_KEYCHAIN : Mutex < Option < ( SecKeychain , tempfile :: TempDir ) > > = Mutex :: new ( None ) ;
4240
4341fn convert_protocol ( protocol : Protocol ) -> SslProtocol {
4442 match protocol {
@@ -93,7 +91,7 @@ impl Identity {
9391 return Err ( Error ( base:: Error :: from ( errSecParam) ) ) ;
9492 }
9593
96- let dir = TempDir :: new ( ) . map_err ( |_| Error ( base:: Error :: from ( errSecIO) ) ) ?;
94+ let dir = tempfile :: TempDir :: new ( ) . map_err ( |_| Error ( base:: Error :: from ( errSecIO) ) ) ?;
9795 let keychain = keychain:: CreateOptions :: new ( )
9896 . password ( & random_password ( ) ?)
9997 . create ( dir. path ( ) . join ( "identity.keychain" ) ) ?;
@@ -159,7 +157,8 @@ impl Identity {
159157 let keychain = match * TEMP_KEYCHAIN . lock ( ) . unwrap ( ) {
160158 Some ( ( ref keychain, _) ) => keychain. clone ( ) ,
161159 ref mut lock @ None => {
162- let dir = TempDir :: new ( ) . map_err ( |_| Error ( base:: Error :: from ( errSecIO) ) ) ?;
160+ let dir =
161+ tempfile:: TempDir :: new ( ) . map_err ( |_| Error ( base:: Error :: from ( errSecIO) ) ) ?;
163162
164163 let mut keychain = keychain:: CreateOptions :: new ( )
165164 . password ( pass)
0 commit comments