]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Log when -restrict-acl is in use.
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Sat, 11 Feb 2017 00:44:00 +0000 (00:44 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Sat, 11 Feb 2017 00:44:00 +0000 (00:44 +0000)
Partly to reassure the user that they got what they asked for, and
partly so that's a clue for us in the logs when we get bug reports.

This involved repurposing platform_psftp_post_option_setup() (no longer
used since e22120fe) as platform_psftp_pre_conn_setup(), and moving it
to after logging is set up.

pscp.c
psftp.c
psftp.h
unix/uxsftp.c
windows/window.c
windows/winplink.c
windows/winsftp.c

diff --git a/pscp.c b/pscp.c
index 5d8256dfa27c0578d877e9bc3dc64de01e723960..126c2ad64d75d0f8a2964e832c314354091b4ffe 100644 (file)
--- a/pscp.c
+++ b/pscp.c
@@ -517,6 +517,8 @@ static void do_cmd(char *host, char *user, char *cmd)
     logctx = log_init(NULL, conf);
     console_provide_logctx(logctx);
 
+    platform_psftp_pre_conn_setup();
+
     err = back->init(NULL, &backhandle, conf,
                     conf_get_str(conf, CONF_host),
                     conf_get_int(conf, CONF_port),
@@ -2357,8 +2359,6 @@ int psftp_main(int argc, char *argv[])
     argv += i;
     back = NULL;
 
-    platform_psftp_post_option_setup();
-
     if (list) {
        if (argc != 1)
            usage();
diff --git a/psftp.c b/psftp.c
index 83dec9687b4f70c9fbde22df15b553c8e7342ff3..3b22741e2965c153e72f15a603633bb2708ec20f 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -2840,6 +2840,8 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
     logctx = log_init(NULL, conf);
     console_provide_logctx(logctx);
 
+    platform_psftp_pre_conn_setup();
+
     err = back->init(NULL, &backhandle, conf,
                     conf_get_str(conf, CONF_host),
                     conf_get_int(conf, CONF_port),
@@ -2954,8 +2956,6 @@ int psftp_main(int argc, char *argv[])
     argv += i;
     back = NULL;
 
-    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
diff --git a/psftp.h b/psftp.h
index 6f46bdcd3c9aef4fe6964ff84d237ce98ffc0587..3696548987bbbd3426a48de34fa6984fc6706e3d 100644 (file)
--- a/psftp.h
+++ b/psftp.h
@@ -48,11 +48,10 @@ int ssh_sftp_loop_iteration(void);
 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.
+ * Platform-specific function called when we're about to make a
+ * network connection.
  */
-void platform_psftp_post_option_setup(void);
+void platform_psftp_pre_conn_setup(void);
 
 /*
  * The main program in psftp.c. Called from main() in the platform-
index a9fb9cb329cd65642aae2e12c2227f5607c54f26..794cc9cbda7e0099c0794ec79a2083a1c16ed05b 100644 (file)
@@ -620,7 +620,7 @@ char *ssh_sftp_get_cmdline(const char *prompt, int no_fds_ok)
 
 void frontend_net_error_pending(void) {}
 
-void platform_psftp_post_option_setup(void) {}
+void platform_psftp_pre_conn_setup(void) {}
 
 /*
  * Main program: do platform-specific initialisation and then call
index 01487522d70dd511c5deb41c3477640df34477e9..2fb12c80dd1453271e334681e50069d961548e85 100644 (file)
@@ -840,6 +840,10 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
        }
     }
 
+    if (restricted_acl) {
+       logevent(NULL, "Running with restricted process ACL");
+    }
+
     start_backend();
 
     /*
index 0f86b41c648dbf6b978fd97a10b119dbe0c362d2..c54cc24cad77c843bda233398fb231a48547652c 100644 (file)
@@ -633,6 +633,10 @@ int main(int argc, char **argv)
             return 1;
     }
 
+    if (restricted_acl) {
+       logevent(NULL, "Running with restricted process ACL");
+    }
+
     /*
      * Start up the connection.
      */
index c85c24aaa373fef54b967b5f02ae99f9c10fdd1f..437ef439d0c23651cb2f7bee8ad8be79350b1359 100644 (file)
@@ -747,8 +747,11 @@ char *ssh_sftp_get_cmdline(const char *prompt, int no_fds_ok)
     return ctx->line;
 }
 
-void platform_psftp_post_option_setup(void)
+void platform_psftp_pre_conn_setup(void)
 {
+    if (restricted_acl) {
+       logevent(NULL, "Running with restricted process ACL");
+    }
 }
 
 /* ----------------------------------------------------------------------