X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/2c2ebd8b5093be00ecb19b278882b2c27ab14319..dacbd0e88298088e0506eb653ae3d1f596085f67:/pageant.c diff --git a/pageant.c b/pageant.c index d7bd94cf..66392753 100644 --- a/pageant.c +++ b/pageant.c @@ -21,8 +21,6 @@ #define APPNAME "Pageant" -#define MAILSLOTNAME "\\\\.\\mailslot\\pageant_listener" - #define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1 #define SSH_AGENT_RSA_IDENTITIES_ANSWER 2 #define SSH_AGENTC_RSA_CHALLENGE 3 @@ -513,7 +511,6 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { WNDCLASS wndclass; - HANDLE mailslot; MSG msg; instance = inst; @@ -573,21 +570,30 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { ShowWindow (hwnd, SW_HIDE); /* - * Create the mailslot. + * Initialise storage for RSA keys. + */ + rsakeys = newtree234(cmpkeys); + + /* + * Process the command line and add RSA keys as listed on it. + * FIXME: we don't support spaces in filenames here. We should. */ { - SECURITY_ATTRIBUTES sa; - sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = NULL; - sa.bInheritHandle = TRUE; - mailslot = CreateMailslot(MAILSLOTNAME, 0, 0, &sa); + char *p = cmdline; + while (*p) { + while (*p && isspace(*p)) p++; + if (*p && !isspace(*p)) { + char *q = p; + while (*p && !isspace(*p)) p++; + if (*p) *p++ = '\0'; + add_keyfile(q); + } + } } /* - * Initialise storage for RSA keys. + * Main message loop. */ - rsakeys = newtree234(cmpkeys); - while (GetMessage(&msg, NULL, 0, 0) == 1) { TranslateMessage(&msg); DispatchMessage(&msg);