mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-23 14:04:59 +02:00
5-8 C1
This commit is contained in:
parent
4c0e2c2078
commit
473841c4cc
2
authfd.c
2
authfd.c
@ -105,7 +105,7 @@ ssh_get_authentication_socket(int *fdp)
|
||||
}
|
||||
|
||||
HANDLE h = CreateFile(
|
||||
"\\\\.\\pipe\\ssh-agent", // pipe name
|
||||
"\\\\.\\pipe\\ssh-keyagent", // pipe name
|
||||
GENERIC_READ | // read and write access
|
||||
GENERIC_WRITE,
|
||||
0, // no sharing
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssh", "ssh.vcxproj", "{74E69D5E-A1EF-46EA-9173-19A412774104}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@ -89,6 +89,7 @@ EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssh-add", "ssh-add.vcxproj", "{029797FF-C986-43DE-95CD-2E771E86AEBC}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{05E1115F-8529-46D0-AAAF-52A404CE79A7} = {05E1115F-8529-46D0-AAAF-52A404CE79A7}
|
||||
{8F9D3B74-8D33-448E-9762-26E8DCC6B2F4} = {8F9D3B74-8D33-448E-9762-26E8DCC6B2F4}
|
||||
{DD483F7D-C553-4740-BC1A-903805AD0174} = {DD483F7D-C553-4740-BC1A-903805AD0174}
|
||||
{0D02F0F0-013B-4EE3-906D-86517F3822C0} = {0D02F0F0-013B-4EE3-906D-86517F3822C0}
|
||||
{8660C2FE-9874-432D-B047-E042BB41DBE0} = {8660C2FE-9874-432D-B047-E042BB41DBE0}
|
||||
|
@ -206,9 +206,11 @@
|
||||
<ClCompile Include="..\..\..\servconf.c" />
|
||||
<ClCompile Include="..\win32compat\ssh-agent\agent-main.c" />
|
||||
<ClCompile Include="..\win32compat\ssh-agent\agent.c" />
|
||||
<ClCompile Include="..\win32compat\ssh-agent\authagent-request.c" />
|
||||
<ClCompile Include="..\win32compat\ssh-agent\config.c" />
|
||||
<ClCompile Include="..\win32compat\ssh-agent\connection.c" />
|
||||
<ClCompile Include="..\win32compat\ssh-agent\agent-request.c" />
|
||||
<ClCompile Include="..\win32compat\ssh-agent\keyagent-request.c" />
|
||||
<ClCompile Include="..\win32compat\ssh-agent\pubkeyagent-request.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
@ -11,6 +11,6 @@ typedef unsigned __int64 u_int64_t;
|
||||
#include "digest.h"
|
||||
|
||||
|
||||
int process_add_identity(struct sshbuf*, struct sshbuf*, struct agent_connection*);
|
||||
int process_request_identities(struct sshbuf*, struct sshbuf*, struct agent_connection*);
|
||||
int process_sign_request(struct sshbuf*, struct sshbuf*, struct agent_connection*);
|
||||
int process_keyagent_request(struct sshbuf*, struct sshbuf*, struct agent_connection*);
|
||||
int process_pubkeyagent_request(struct sshbuf*, struct sshbuf*, struct agent_connection*);
|
||||
int process_authagent_request(struct sshbuf*, struct sshbuf*, struct agent_connection*);
|
@ -28,18 +28,19 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "agent.h"
|
||||
#define AGENT_PIPE_ID L"\\\\.\\pipe\\ssh-agent"
|
||||
#include "agent.h"s
|
||||
#define BUFSIZE 5 * 1024
|
||||
|
||||
static HANDLE ioc_port = NULL;
|
||||
static BOOL debug_mode = FALSE;
|
||||
|
||||
#define NUM_LISTENERS 1
|
||||
#define KEY_AGENT_PIPE_ID L"\\\\.\\pipe\\ssh-agent"
|
||||
#define NUM_LISTENERS 3
|
||||
#define KEY_AGENT_PIPE_ID L"\\\\.\\pipe\\ssh-keyagent"
|
||||
#define PUBKEY_AGENT_PIPE_ID L"\\\\.\\pipe\\ssh-pubkeyagent"
|
||||
#define AUTH_AGENT_PIPE_ID L"\\\\.\\pipe\\ssh-authagent"
|
||||
|
||||
static wchar_t *pipe_ids[NUM_LISTENERS] = { KEY_AGENT_PIPE_ID };
|
||||
static enum agent_type types[NUM_LISTENERS] = { KEY_AGENT };
|
||||
static wchar_t *pipe_ids[NUM_LISTENERS] = { KEY_AGENT_PIPE_ID, PUBKEY_AGENT_PIPE_ID, AUTH_AGENT_PIPE_ID };
|
||||
static enum agent_type types[NUM_LISTENERS] = { KEY_AGENT, PUBKEY_AGENT, PUBKEY_AUTH_AGENT};
|
||||
HANDLE event_stop_agent;
|
||||
|
||||
struct listener {
|
||||
|
37
contrib/win32/win32compat/ssh-agent/authagent-request.c
Normal file
37
contrib/win32/win32compat/ssh-agent/authagent-request.c
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Author: Manoj Ampalam <manoj.ampalam@microsoft.com>
|
||||
* ssh-agent implementation on Windows
|
||||
*
|
||||
* Copyright (c) 2015 Microsoft Corp.
|
||||
* All rights reserved
|
||||
*
|
||||
* Microsoft openssh win32 port
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "agent.h"
|
||||
#include "agent-request.h"
|
||||
|
||||
int process_authagent_request(struct sshbuf* request, struct sshbuf* response, struct agent_connection* con) {
|
||||
return -1;
|
||||
}
|
@ -119,7 +119,6 @@ static int
|
||||
process_request(struct agent_connection* con) {
|
||||
int r;
|
||||
struct sshbuf *request = NULL, *response = NULL;
|
||||
u_char type;
|
||||
|
||||
request = sshbuf_from(con->io_buf.buf, con->io_buf.num_bytes);
|
||||
response = sshbuf_new();
|
||||
@ -128,23 +127,14 @@ process_request(struct agent_connection* con) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ((r = sshbuf_get_u8(request, &type)) != 0)
|
||||
goto done;
|
||||
|
||||
switch (type) {
|
||||
case SSH2_AGENTC_ADD_IDENTITY:
|
||||
r = process_add_identity(request, response, con);
|
||||
break;
|
||||
case SSH2_AGENTC_REQUEST_IDENTITIES:
|
||||
r = process_request_identities(request, response, con);
|
||||
break;
|
||||
case SSH2_AGENTC_SIGN_REQUEST:
|
||||
r = process_sign_request(request, response, con);
|
||||
break;
|
||||
default:
|
||||
if (con->type == KEY_AGENT)
|
||||
r = process_keyagent_request(request, response, con);
|
||||
else if (con->type == PUBKEY_AGENT)
|
||||
r = process_pubkeyagent_request(request, response, con);
|
||||
else if (con->type == PUBKEY_AUTH_AGENT)
|
||||
r = process_authagent_request(request, response, con);
|
||||
else
|
||||
r = EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
if (request)
|
||||
|
@ -380,4 +380,23 @@ done:
|
||||
if (sub)
|
||||
RegCloseKey(sub);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
int process_keyagent_request(struct sshbuf* request, struct sshbuf* response, struct agent_connection* con) {
|
||||
int r;
|
||||
u_char type;
|
||||
|
||||
if ((r = sshbuf_get_u8(request, &type)) != 0)
|
||||
return r;
|
||||
switch (type) {
|
||||
case SSH2_AGENTC_ADD_IDENTITY:
|
||||
return process_add_identity(request, response, con);
|
||||
case SSH2_AGENTC_REQUEST_IDENTITIES:
|
||||
return process_request_identities(request, response, con);
|
||||
case SSH2_AGENTC_SIGN_REQUEST:
|
||||
return process_sign_request(request, response, con);
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
37
contrib/win32/win32compat/ssh-agent/pubkeyagent-request.c
Normal file
37
contrib/win32/win32compat/ssh-agent/pubkeyagent-request.c
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Author: Manoj Ampalam <manoj.ampalam@microsoft.com>
|
||||
* ssh-agent implementation on Windows
|
||||
*
|
||||
* Copyright (c) 2015 Microsoft Corp.
|
||||
* All rights reserved
|
||||
*
|
||||
* Microsoft openssh win32 port
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "agent.h"
|
||||
#include "agent-request.h"
|
||||
|
||||
int process_pubkeyagent_request(struct sshbuf* request, struct sshbuf* response, struct agent_connection* con) {
|
||||
return -1;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user