mirror of
				https://github.com/PowerShell/Win32-OpenSSH.git
				synced 2025-11-03 21:24:40 +01:00 
			
		
		
		
	4-17 C1
This commit is contained in:
		
							parent
							
								
									1c1d7cce79
								
							
						
					
					
						commit
						988295d28a
					
				@ -29,9 +29,9 @@
 | 
				
			|||||||
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "agent.h"
 | 
				
			||||||
#include "agent-request.h"
 | 
					#include "agent-request.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define KEY_ROOT L"SYSTEM\\CurrentControlSet\\Control\\SSH\\Host\\Keys"
 | 
					 | 
				
			||||||
#define MAX_KEY_LENGTH 255
 | 
					#define MAX_KEY_LENGTH 255
 | 
				
			||||||
#define MAX_VALUE_NAME 16383
 | 
					#define MAX_VALUE_NAME 16383
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -54,7 +54,7 @@ process_add_identity(struct sshbuf* request, struct sshbuf* response, HANDLE cli
 | 
				
			|||||||
	if ((thumbprint = sshkey_fingerprint(key, SSH_FP_HASH_DEFAULT, SSH_FP_DEFAULT)) == NULL)
 | 
						if ((thumbprint = sshkey_fingerprint(key, SSH_FP_HASH_DEFAULT, SSH_FP_DEFAULT)) == NULL)
 | 
				
			||||||
		goto done;
 | 
							goto done;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, KEY_ROOT,
 | 
						if ((r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, SSHD_HOST_KEYS_ROOT,
 | 
				
			||||||
	    0, KEY_WRITE, ®)) != 0)
 | 
						    0, KEY_WRITE, ®)) != 0)
 | 
				
			||||||
		goto done;
 | 
							goto done;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -98,7 +98,7 @@ process_request_identities(struct sshbuf* request, struct sshbuf* response, HAND
 | 
				
			|||||||
	wchar_t sub_name[MAX_KEY_LENGTH];
 | 
						wchar_t sub_name[MAX_KEY_LENGTH];
 | 
				
			||||||
	DWORD sub_name_len = MAX_KEY_LENGTH;
 | 
						DWORD sub_name_len = MAX_KEY_LENGTH;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, KEY_ROOT,
 | 
						if ((r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, SSHD_HOST_KEYS_ROOT,
 | 
				
			||||||
		0, STANDARD_RIGHTS_READ | KEY_ENUMERATE_SUB_KEYS, &root)) != 0)
 | 
							0, STANDARD_RIGHTS_READ | KEY_ENUMERATE_SUB_KEYS, &root)) != 0)
 | 
				
			||||||
		goto done;
 | 
							goto done;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -155,6 +155,8 @@ DWORD WINAPI iocp_work(LPVOID lpParam) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int agent_start() {
 | 
					int agent_start() {
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
						HKEY agent_root;
 | 
				
			||||||
 | 
						DWORD process_id = GetCurrentProcessId();
 | 
				
			||||||
	action_queue = 0;
 | 
						action_queue = 0;
 | 
				
			||||||
	list = NULL;
 | 
						list = NULL;
 | 
				
			||||||
	ioc_port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, (ULONG_PTR)NULL, 0);
 | 
						ioc_port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, (ULONG_PTR)NULL, 0);
 | 
				
			||||||
@ -163,6 +165,9 @@ int agent_start() {
 | 
				
			|||||||
		QueueUserWorkItem(iocp_work, NULL, 0);
 | 
							QueueUserWorkItem(iocp_work, NULL, 0);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	agent_listen();
 | 
						agent_listen();
 | 
				
			||||||
 | 
						RegOpenKeyEx(HKEY_LOCAL_MACHINE, SSH_AGENT_ROOT,
 | 
				
			||||||
 | 
							0, KEY_SET_VALUE, &agent_root);
 | 
				
			||||||
 | 
						RegSetValueEx(agent_root, L"ProcessID", 0, REG_DWORD, &process_id, 4);
 | 
				
			||||||
	iocp_work(NULL);
 | 
						iocp_work(NULL);
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,10 @@
 | 
				
			|||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#define MAX_MESSAGE_SIZE 5 * 1024
 | 
					#define MAX_MESSAGE_SIZE 5 * 1024
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SSH_ROOT L"SYSTEM\\CurrentControlSet\\Control\\SSH"
 | 
				
			||||||
 | 
					#define SSH_AGENT_ROOT SSH_ROOT L"\\agent"
 | 
				
			||||||
 | 
					#define SSHD_HOST_KEYS_ROOT SSH_ROOT L"\\Host\\Keys"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define HEADER_SIZE 4
 | 
					#define HEADER_SIZE 4
 | 
				
			||||||
struct agent_connection {
 | 
					struct agent_connection {
 | 
				
			||||||
	OVERLAPPED ol;
 | 
						OVERLAPPED ol;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user