@@ -74,7 +74,6 @@ pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Res
74
74
let ours;
75
75
let mut name;
76
76
let mut tries = 0 ;
77
- let mut reject_remote_clients_flag = c:: PIPE_REJECT_REMOTE_CLIENTS ;
78
77
loop {
79
78
tries += 1 ;
80
79
name = format ! (
@@ -96,7 +95,7 @@ pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Res
96
95
c:: PIPE_TYPE_BYTE
97
96
| c:: PIPE_READMODE_BYTE
98
97
| c:: PIPE_WAIT
99
- | reject_remote_clients_flag ,
98
+ | c :: PIPE_REJECT_REMOTE_CLIENTS ,
100
99
1 ,
101
100
PIPE_BUFFER_CAPACITY ,
102
101
PIPE_BUFFER_CAPACITY ,
@@ -112,30 +111,15 @@ pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Res
112
111
//
113
112
// Don't try again too much though as this could also perhaps be a
114
113
// legit error.
115
- // If `ERROR_INVALID_PARAMETER` is returned, this probably means we're
116
- // running on pre-Vista version where `PIPE_REJECT_REMOTE_CLIENTS` is
117
- // not supported, so we continue retrying without it. This implies
118
- // reduced security on Windows versions older than Vista by allowing
119
- // connections to this pipe from remote machines.
120
- // Proper fix would increase the number of FFI imports and introduce
121
- // significant amount of Windows XP specific code with no clean
122
- // testing strategy
123
- // For more info, see https://github.com/rust-lang/rust/pull/37677.
124
114
if handle == c:: INVALID_HANDLE_VALUE {
125
115
let error = api:: get_last_error ( ) ;
126
- if tries < 10 {
127
- if error == WinError :: ACCESS_DENIED {
128
- continue ;
129
- } else if reject_remote_clients_flag != 0
130
- && error == WinError :: INVALID_PARAMETER
131
- {
132
- reject_remote_clients_flag = 0 ;
133
- tries -= 1 ;
134
- continue ;
135
- }
116
+ if tries < 10 && error == WinError :: ACCESS_DENIED {
117
+ continue ;
118
+ } else {
119
+ return Err ( io:: Error :: from_raw_os_error ( error. code as i32 ) ) ;
136
120
}
137
- return Err ( io:: Error :: from_raw_os_error ( error. code as i32 ) ) ;
138
121
}
122
+
139
123
ours = Handle :: from_raw_handle ( handle) ;
140
124
break ;
141
125
}
0 commit comments