1
1
extern crate libc;
2
2
extern crate security_framework;
3
3
extern crate security_framework_sys;
4
- extern crate tempfile;
5
4
6
5
use self :: security_framework:: base;
7
6
use self :: security_framework:: certificate:: SecCertificate ;
@@ -12,7 +11,6 @@ use self::security_framework::secure_transport::{
12
11
self , ClientBuilder , SslConnectionType , SslContext , SslProtocol , SslProtocolSide ,
13
12
} ;
14
13
use self :: security_framework_sys:: base:: { errSecIO, errSecParam} ;
15
- use self :: tempfile:: TempDir ;
16
14
use std:: error;
17
15
use std:: fmt;
18
16
use std:: io;
@@ -38,7 +36,7 @@ use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder};
38
36
static SET_AT_EXIT : Once = Once :: new ( ) ;
39
37
40
38
#[ 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 ) ;
42
40
43
41
fn convert_protocol ( protocol : Protocol ) -> SslProtocol {
44
42
match protocol {
@@ -93,7 +91,7 @@ impl Identity {
93
91
return Err ( Error ( base:: Error :: from ( errSecParam) ) ) ;
94
92
}
95
93
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) ) ) ?;
97
95
let keychain = keychain:: CreateOptions :: new ( )
98
96
. password ( & random_password ( ) ?)
99
97
. create ( dir. path ( ) . join ( "identity.keychain" ) ) ?;
@@ -159,7 +157,8 @@ impl Identity {
159
157
let keychain = match * TEMP_KEYCHAIN . lock ( ) . unwrap ( ) {
160
158
Some ( ( ref keychain, _) ) => keychain. clone ( ) ,
161
159
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) ) ) ?;
163
162
164
163
let mut keychain = keychain:: CreateOptions :: new ( )
165
164
. password ( pass)
0 commit comments