Skip to content

Commit

Permalink
attempt to address issues from PowerShell#362
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandeivert committed Oct 12, 2021
1 parent 904470d commit 87db37a
Show file tree
Hide file tree
Showing 6 changed files with 358 additions and 19 deletions.
2 changes: 2 additions & 0 deletions contrib/win32/win32compat/ssh-agent/agent-request.h
Expand Up @@ -18,5 +18,7 @@ int process_request_identities(struct sshbuf*, struct sshbuf*, struct agent_conn
int process_sign_request(struct sshbuf*, struct sshbuf*, struct agent_connection*);
int process_remove_key(struct sshbuf*, struct sshbuf*, struct agent_connection*);
int process_remove_all(struct sshbuf*, struct sshbuf*, struct agent_connection*);
int process_add_smartcard_key(struct sshbuf*, struct sshbuf*, struct agent_connection*);
int process_remove_smartcard_key(struct sshbuf*, struct sshbuf*, struct agent_connection*);

/* auth */
2 changes: 2 additions & 0 deletions contrib/win32/win32compat/ssh-agent/agent.h
Expand Up @@ -8,6 +8,8 @@
#define SSH_AGENT_ROOT SSH_REGISTRY_ROOT L"\\Agent"
#define SSH_KEYS_KEY L"Keys"
#define SSH_KEYS_ROOT SSH_AGENT_ROOT L"\\" SSH_KEYS_KEY
#define SSH_PKCS11_PROVIDERS_KEY L"PKCS11_Providers"
#define SSH_PKCS11_PROVIDERS_ROOT SSH_AGENT_ROOT L"\\" SSH_PKCS11_PROVIDERS_KEY

#define HEADER_SIZE 4

Expand Down
14 changes: 14 additions & 0 deletions contrib/win32/win32compat/ssh-agent/connection.c
Expand Up @@ -28,9 +28,14 @@
* (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 "includes.h"
#include "agent.h"
#include "agent-request.h"

#ifdef ENABLE_PKCS11
#include "ssh-pkcs11.h"
#endif

#pragma warning(push, 3)

int process_request(struct agent_connection*);
Expand Down Expand Up @@ -156,6 +161,15 @@ process_request(struct agent_connection* con)
case SSH2_AGENTC_REMOVE_ALL_IDENTITIES:
r = process_remove_all(request, response, con);
break;
#ifdef ENABLE_PKCS11
case SSH_AGENTC_ADD_SMARTCARD_KEY:
case SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED:
r = process_add_smartcard_key(request, response, con);
break;
case SSH_AGENTC_REMOVE_SMARTCARD_KEY:
r = process_remove_smartcard_key(request, response, con);
break;
#endif /* ENABLE_PKCS11 */
default:
debug("unknown agent request %d", type);
r = -1;
Expand Down

0 comments on commit 87db37a

Please sign in to comment.