3
3
//! Handler for Unix domain sockets
4
4
use super :: { Connect , ReadWrite } ;
5
5
use crate :: error:: { ClientErrorKind , Result } ;
6
+ use std:: os:: unix:: net:: UnixStream ;
7
+ use std:: path:: PathBuf ;
8
+ use std:: time:: Duration ;
9
+
10
+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
6
11
use log:: error;
12
+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
7
13
use std:: ffi:: OsStr ;
14
+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
8
15
use std:: fs;
16
+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
9
17
use std:: io:: { Error , ErrorKind } ;
18
+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
10
19
use std:: os:: unix:: fs:: MetadataExt ;
11
- use std:: os:: unix:: net:: UnixStream ;
12
- use std:: path:: PathBuf ;
13
- use std:: time:: Duration ;
14
20
15
21
const DEFAULT_SOCKET_PATH : & str = "/tmp/parsec/parsec.sock" ;
16
22
const DEFAULT_TIMEOUT : Duration = Duration :: from_secs ( 1 ) ;
@@ -26,7 +32,7 @@ pub struct Handler {
26
32
27
33
impl Connect for Handler {
28
34
fn connect ( & self ) -> Result < Box < dyn ReadWrite > > {
29
- #[ cfg( not( no_fs_permission_check ) ) ]
35
+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
30
36
self . secure_parsec_socket_folder ( ) ?;
31
37
32
38
let stream = UnixStream :: connect ( self . path . clone ( ) ) . map_err ( ClientErrorKind :: Ipc ) ?;
@@ -54,7 +60,7 @@ impl Handler {
54
60
55
61
/// Checks if the socket is inside a folder with correct owners and permissions to make sure it
56
62
/// is from the Parsec service.
57
- #[ cfg( not( no_fs_permission_check ) ) ]
63
+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
58
64
fn secure_parsec_socket_folder ( & self ) -> Result < ( ) > {
59
65
let mut socket_dir = self . path . clone ( ) ;
60
66
if !socket_dir. pop ( ) {
0 commit comments