X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/f70a606ea75cc1d03d335b3da1122f4cd7d0e381..b0faa571fcf0bdc556bf5fca5a0f81681d2c1d66:/pageant.c diff --git a/pageant.c b/pageant.c index 62f60db2..e368a682 100644 --- a/pageant.c +++ b/pageant.c @@ -3,7 +3,9 @@ */ #include +#ifndef NO_SECURITY #include +#endif #include #include "ssh.h" #include "tree234.h" @@ -39,20 +41,22 @@ extern char ver[]; -HINSTANCE instance; -HWND hwnd; -HWND keylist; -HWND aboutbox; -HMENU systray_menu; +static HINSTANCE instance; +static HWND hwnd; +static HWND keylist; +static HWND aboutbox; +static HMENU systray_menu; -tree234 *rsakeys; +static tree234 *rsakeys; -int has_security; +static int has_security; +#ifndef NO_SECURITY typedef DWORD (WINAPI *gsi_fn_t) (HANDLE, SE_OBJECT_TYPE, SECURITY_INFORMATION, PSID *, PSID *, PACL *, PACL *, PSECURITY_DESCRIPTOR *); -gsi_fn_t getsecurityinfo; +static gsi_fn_t getsecurityinfo; +#endif /* * We need this to link with the RSA code, because rsaencrypt() @@ -192,7 +196,7 @@ static int CALLBACK PassphraseProc(HWND hwnd, UINT msg, /* * Update the visible key list. */ -void keylist_update(void) { +static void keylist_update(void) { struct RSAKey *key; enum234 e; @@ -217,7 +221,7 @@ void keylist_update(void) { /* * This function loads a key from a file and adds it. */ -void add_keyfile(char *filename) { +static void add_keyfile(char *filename) { char passphrase[PASSPHRASE_MAXLEN]; struct RSAKey *key; int needs_pass; @@ -261,7 +265,7 @@ void add_keyfile(char *filename) { /* * This is the main agent function that answers messages. */ -void answer_msg(void *msg) { +static void answer_msg(void *msg) { unsigned char *p = msg; unsigned char *ret = msg; int type; @@ -432,7 +436,7 @@ void answer_msg(void *msg) { /* * Key comparison function for the 2-3-4 tree of RSA keys. */ -int cmpkeys(void *av, void *bv) { +static int cmpkeys(void *av, void *bv) { struct RSAKey *a = (struct RSAKey *)av; struct RSAKey *b = (struct RSAKey *)bv; Bignum am, bm; @@ -635,6 +639,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, #endif if (filemap != NULL && filemap != INVALID_HANDLE_VALUE) { int rc; +#ifndef NO_SECURITY if (has_security) { if ((proc = OpenProcess(MAXIMUM_ALLOWED, FALSE, GetCurrentProcessId())) == NULL) { @@ -678,6 +683,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, debug(("security APIs not present\r\n")); #endif } +#endif p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, 0); #ifdef DEBUG_IPC debug(("p is %p\r\n", p)); @@ -713,6 +719,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { has_security = FALSE; if (has_security) { +#ifndef NO_SECURITY /* * Attempt to ge the security API we need. */ @@ -725,6 +732,13 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { "Pageant Fatal Error", MB_ICONERROR | MB_OK); return 1; } +#else + MessageBox(NULL, + "This program has been compiled for Win9X and will\n" + "not run on NT, in case it causes a security breach.", + "Pageant Fatal Error", MB_ICONERROR | MB_OK); + return 1; +#endif } else advapi = NULL;