mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-21 22:28:37 -05:00
Add a compile option so that anyone who really wants to can build a
Win95-only (securityless) version of Pageant. This will refuse to run at all under NT, so as to avoid the risk of people accidentally running an insecure binary on a security-requiring system. [originally from svn r688]
This commit is contained in:
parent
f7d6cd2059
commit
b8967e5231
14
pageant.c
14
pageant.c
@ -3,7 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#ifndef NO_SECURITY
|
||||||
#include <aclapi.h>
|
#include <aclapi.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "tree234.h"
|
#include "tree234.h"
|
||||||
@ -48,11 +50,13 @@ static HMENU systray_menu;
|
|||||||
static tree234 *rsakeys;
|
static tree234 *rsakeys;
|
||||||
|
|
||||||
static int has_security;
|
static int has_security;
|
||||||
|
#ifndef NO_SECURITY
|
||||||
typedef DWORD (WINAPI *gsi_fn_t)
|
typedef DWORD (WINAPI *gsi_fn_t)
|
||||||
(HANDLE, SE_OBJECT_TYPE, SECURITY_INFORMATION,
|
(HANDLE, SE_OBJECT_TYPE, SECURITY_INFORMATION,
|
||||||
PSID *, PSID *, PACL *, PACL *,
|
PSID *, PSID *, PACL *, PACL *,
|
||||||
PSECURITY_DESCRIPTOR *);
|
PSECURITY_DESCRIPTOR *);
|
||||||
static gsi_fn_t getsecurityinfo;
|
static gsi_fn_t getsecurityinfo;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need this to link with the RSA code, because rsaencrypt()
|
* We need this to link with the RSA code, because rsaencrypt()
|
||||||
@ -635,6 +639,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
|
|||||||
#endif
|
#endif
|
||||||
if (filemap != NULL && filemap != INVALID_HANDLE_VALUE) {
|
if (filemap != NULL && filemap != INVALID_HANDLE_VALUE) {
|
||||||
int rc;
|
int rc;
|
||||||
|
#ifndef NO_SECURITY
|
||||||
if (has_security) {
|
if (has_security) {
|
||||||
if ((proc = OpenProcess(MAXIMUM_ALLOWED, FALSE,
|
if ((proc = OpenProcess(MAXIMUM_ALLOWED, FALSE,
|
||||||
GetCurrentProcessId())) == NULL) {
|
GetCurrentProcessId())) == NULL) {
|
||||||
@ -678,6 +683,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
|
|||||||
debug(("security APIs not present\r\n"));
|
debug(("security APIs not present\r\n"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, 0);
|
p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, 0);
|
||||||
#ifdef DEBUG_IPC
|
#ifdef DEBUG_IPC
|
||||||
debug(("p is %p\r\n", p));
|
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;
|
has_security = FALSE;
|
||||||
|
|
||||||
if (has_security) {
|
if (has_security) {
|
||||||
|
#ifndef NO_SECURITY
|
||||||
/*
|
/*
|
||||||
* Attempt to ge the security API we need.
|
* 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);
|
"Pageant Fatal Error", MB_ICONERROR | MB_OK);
|
||||||
return 1;
|
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
|
} else
|
||||||
advapi = NULL;
|
advapi = NULL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user