@@ -94,54 +94,6 @@ ssh_get_authentication_socket(int *fdp)
94
94
if (fdp != NULL )
95
95
* fdp = -1 ;
96
96
97
- #ifdef WINDOWS
98
- /* Auth socket in Windows is a static-named pipe listener in ssh-agent */
99
- {
100
- HKEY agent_root = 0 ;
101
- DWORD agent_pid = 0 , tmp_size = 4 , pipe_server_pid = 0xff ;
102
- DWORD connection_attempts = 0 ;
103
- HANDLE h ;
104
- RegOpenKeyExW (HKEY_LOCAL_MACHINE , SSH_AGENT_REG_ROOT ,
105
- 0 , KEY_QUERY_VALUE , & agent_root );
106
- if (agent_root ) {
107
- RegQueryValueEx (agent_root , "ProcessId" , 0 ,
108
- NULL , (LPBYTE )& agent_pid , & tmp_size );
109
- RegCloseKey (agent_root );
110
- }
111
-
112
- do {
113
- h = CreateFileW (SSH_AGENT_PIPE_NAME , GENERIC_READ | GENERIC_WRITE , 0 ,
114
- NULL , OPEN_EXISTING , FILE_FLAG_OVERLAPPED , NULL );
115
- if (h != INVALID_HANDLE_VALUE || GetLastError () != ERROR_PIPE_BUSY ||
116
- ++ connection_attempts > 10 )
117
- break ;
118
- Sleep (100 );
119
- } while (1 );
120
-
121
- if (h == INVALID_HANDLE_VALUE ) {
122
- debug ("ssh_get_authentication_socket - CreateFileW failed error %d" ,
123
- GetLastError ());
124
- return SSH_ERR_AGENT_NOT_PRESENT ;
125
- }
126
-
127
- /*
128
- * ensure that connected server pid matches published pid.
129
- * this provides service side auth and prevents mitm
130
- */
131
- if (!GetNamedPipeServerProcessId (h , & pipe_server_pid ) ||
132
- (agent_pid != pipe_server_pid )) {
133
- debug ("agent pid mismatch" );
134
- CloseHandle (h );
135
- return SSH_ERR_AGENT_COMMUNICATION ;
136
- }
137
-
138
- /* alloc fd for pipe handle */
139
- if ((sock = w32_allocate_fd_for_handle (h , FALSE)) < 0 ) {
140
- CloseHandle (h );
141
- return SSH_ERR_SYSTEM_ERROR ;
142
- }
143
- }
144
- #else /* !WINDOWS */
145
97
authsocket = getenv (SSH_AUTHSOCKET_ENV_NAME );
146
98
if (!authsocket )
147
99
return SSH_ERR_AGENT_NOT_PRESENT ;
@@ -161,7 +113,6 @@ ssh_get_authentication_socket(int *fdp)
161
113
errno = oerrno ;
162
114
return SSH_ERR_SYSTEM_ERROR ;
163
115
}
164
- #endif /* !WINDOWS */
165
116
166
117
if (fdp != NULL )
167
118
* fdp = sock ;
0 commit comments