mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-21 04:54:48 +02:00
Added debug mode in ssh-agent
This commit is contained in:
parent
36f6ba825d
commit
2c781ffb0d
@ -202,6 +202,6 @@ char* w32_programdir() {
|
|||||||
|
|
||||||
int daemon(int nochdir, int noclose)
|
int daemon(int nochdir, int noclose)
|
||||||
{
|
{
|
||||||
/* this should never be invoked from Windows code*/
|
FreeConsole();
|
||||||
DebugBreak();
|
return 0;
|
||||||
}
|
}
|
@ -83,7 +83,7 @@ static VOID WINAPI service_handler(DWORD dwControl)
|
|||||||
|
|
||||||
BOOL WINAPI ctrl_c_handler(
|
BOOL WINAPI ctrl_c_handler(
|
||||||
_In_ DWORD dwCtrlType
|
_In_ DWORD dwCtrlType
|
||||||
) {
|
) {
|
||||||
/* for any Ctrl type, shutdown agent*/
|
/* for any Ctrl type, shutdown agent*/
|
||||||
debug("Ctrl+C received");
|
debug("Ctrl+C received");
|
||||||
agent_shutdown();
|
agent_shutdown();
|
||||||
@ -96,16 +96,21 @@ int wmain(int argc, wchar_t **argv) {
|
|||||||
load_config();
|
load_config();
|
||||||
if (!StartServiceCtrlDispatcherW(dispatch_table)) {
|
if (!StartServiceCtrlDispatcherW(dispatch_table)) {
|
||||||
if (GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) {
|
if (GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) {
|
||||||
/*todo - support debug mode*/
|
|
||||||
/*
|
if (argc == 2) {
|
||||||
if (debugMode) {
|
if (wcsncmp(argv[1], L"-ddd", 4) == 0)
|
||||||
SetConsoleCtrlHandler(ctrl_c_handler, TRUE);
|
|
||||||
log_init("ssh-agent", 7, 1, 1);
|
log_init("ssh-agent", 7, 1, 1);
|
||||||
|
else if (wcsncmp(argv[1], L"-dd", 3) == 0)
|
||||||
|
log_init("ssh-agent", 6, 1, 1);
|
||||||
|
else if (wcsncmp(argv[1], L"-d", 2) == 0)
|
||||||
|
log_init("ssh-agent", 5, 1, 1);
|
||||||
|
|
||||||
|
if (wcsncmp(argv[1], L"-d", 2) == 0) {
|
||||||
|
SetConsoleCtrlHandler(ctrl_c_handler, TRUE);
|
||||||
agent_start(TRUE, FALSE, 0);
|
agent_start(TRUE, FALSE, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if (argc == 2) {
|
|
||||||
/*agent process is likely a spawned child*/
|
/*agent process is likely a spawned child*/
|
||||||
char* h = 0;
|
char* h = 0;
|
||||||
h += _wtoi(*(argv + 1));
|
h += _wtoi(*(argv + 1));
|
||||||
@ -122,7 +127,7 @@ int wmain(int argc, wchar_t **argv) {
|
|||||||
DWORD err;
|
DWORD err;
|
||||||
|
|
||||||
if ((sc_handle = OpenSCManagerW(NULL, NULL, SERVICE_START)) == NULL ||
|
if ((sc_handle = OpenSCManagerW(NULL, NULL, SERVICE_START)) == NULL ||
|
||||||
(svc_handle = OpenServiceW(sc_handle, L"ssh-agent", SERVICE_START)) == NULL){
|
(svc_handle = OpenServiceW(sc_handle, L"ssh-agent", SERVICE_START)) == NULL) {
|
||||||
fatal("unable to open service handle");
|
fatal("unable to open service handle");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user