Protecting our processes from outside interference need not be limited
to just PuTTY: there's no reason why the other SSH-speaking tools
shouldn't have the same treatment (PSFTP, PSCP, Plink), and PuTTYgen
and Pageant which handle private key material.
+ sshrand winnoise sshsha winstore misc winctrls sshrsa sshdss winmisc
+ sshpubk sshaes sshsh256 sshsh512 IMPORT winutils puttygen.res
+ tree234 notiming winhelp winnojmp conf LIBS wintime sshecc
+ sshrand winnoise sshsha winstore misc winctrls sshrsa sshdss winmisc
+ sshpubk sshaes sshsh256 sshsh512 IMPORT winutils puttygen.res
+ tree234 notiming winhelp winnojmp conf LIBS wintime sshecc
pterm : [X] GTKTERM uxmisc misc ldisc settings uxpty uxsel BE_NONE uxstore
+ uxsignal CHARSET cmdline uxpterm version time xpmpterm xpmptcfg
pterm : [X] GTKTERM uxmisc misc ldisc settings uxpty uxsel BE_NONE uxstore
+ uxsignal CHARSET cmdline uxpterm version time xpmpterm xpmptcfg
+ platform_psftp_post_option_setup();
+
if (list) {
if (argc != 1)
usage();
if (list) {
if (argc != 1)
usage();
+ platform_psftp_post_option_setup();
+
/*
* If the loaded session provides a hostname, and a hostname has not
* otherwise been specified, pop it in `userhost' so that
/*
* If the loaded session provides a hostname, and a hostname has not
* otherwise been specified, pop it in `userhost' so that
*/
char *ssh_sftp_get_cmdline(const char *prompt, int backend_required);
*/
char *ssh_sftp_get_cmdline(const char *prompt, int backend_required);
+/*
+ * Platform-specific function called after the command line has been
+ * processed, so that any per-platform initialisation such as process
+ * ACL setup can be done.
+ */
+void platform_psftp_post_option_setup(void);
+
/*
* The main program in psftp.c. Called from main() in the platform-
* specific code, after doing any platform-specific initialisation.
/*
* The main program in psftp.c. Called from main() in the platform-
* specific code, after doing any platform-specific initialisation.
void frontend_net_error_pending(void) {}
void frontend_net_error_pending(void) {}
+void platform_psftp_post_option_setup(void) {}
+
/*
* Main program: do platform-specific initialisation and then call
* psftp_main().
/*
* Main program: do platform-specific initialisation and then call
* psftp_main().
#include "putty.h"
#include "ssh.h"
#include "licence.h"
#include "putty.h"
#include "ssh.h"
#include "licence.h"
+#ifndef UNPROTECT
+ /*
+ * Protect our process.
+ */
+ {
+ char *error = NULL;
+ if (!setprocessacl(error)) {
+ char *message = dupprintf("Could not restrict process ACL: %s",
+ error);
+ MessageBox(NULL, message, "PuTTYgen Warning",
+ MB_ICONWARNING | MB_OK);
+ sfree(message);
+ sfree(error);
+ }
+ }
+#endif
+
random_ref();
ret = DialogBox(hinst, MAKEINTRESOURCE(201), NULL, MainDlgProc) != IDOK;
random_ref();
ret = DialogBox(hinst, MAKEINTRESOURCE(201), NULL, MainDlgProc) != IDOK;
+#ifndef UNPROTECT
+ /*
+ * Protect our process.
+ */
+ {
+ char *error = NULL;
+ if (!setprocessacl(error)) {
+ char *message = dupprintf("Could not restrict process ACL: %s",
+ error);
+ MessageBox(NULL, message, "Pageant Warning",
+ MB_ICONWARNING | MB_OK);
+ sfree(message);
+ sfree(error);
+ }
+ }
+#endif
+
/*
* Forget any passphrase that we retained while going over
* command line keyfiles.
/*
* Forget any passphrase that we retained while going over
* command line keyfiles.
#include "putty.h"
#include "storage.h"
#include "tree234.h"
#include "putty.h"
#include "storage.h"
#include "tree234.h"
#define WM_AGENT_CALLBACK (WM_APP + 4)
#define WM_AGENT_CALLBACK (WM_APP + 4)
+#ifndef UNPROTECT
+ /*
+ * Protect our process.
+ */
+ {
+ char *error = NULL;
+ if (!setprocessacl(error)) {
+ char *message = dupprintf("Could not restrict process ACL: %s",
+ error);
+ logevent(NULL, message);
+ sfree(message);
+ sfree(error);
+ }
+ }
+#endif
+
+void platform_psftp_post_option_setup(void)
+{
+#ifndef UNPROTECT
+ /*
+ * Protect our process.
+ */
+ {
+ char *error = NULL;
+ if (!setprocessacl(error)) {
+ char *message = dupprintf("Could not restrict process ACL: %s",
+ error);
+ logevent(NULL, message);
+ sfree(message);
+ sfree(error);
+ }
+ }
+#endif
+}
+
/* ----------------------------------------------------------------------
* Main program. Parse arguments etc.
*/
/* ----------------------------------------------------------------------
* Main program. Parse arguments etc.
*/