diff --git a/Recipe b/Recipe index 34339774..b3f1667e 100644 --- a/Recipe +++ b/Recipe @@ -334,11 +334,12 @@ KEYGEN = sshrsag sshdssg sshecdsag putty : [G] GUITERM NONSSH WINSSH W_BE_ALL WINMISC winx11 putty.res LIBS puttytel : [G] GUITERM NONSSH W_BE_NOSSH WINMISC puttytel.res nogss LIBS plink : [C] winplink wincons NONSSH WINSSH W_BE_ALL logging WINMISC - + winx11 plink.res winnojmp sessprep noterm winnohlp winselcli LIBS + + winx11 plink.res winnojmp sessprep noterm winnohlp winselcli + + clicons LIBS pscp : [C] pscp winsftp wincons WINSSH BE_SSH SFTP wildcard WINMISC - + pscp.res winnojmp winnohlp winselcli LIBS + + pscp.res winnojmp winnohlp winselcli clicons LIBS psftp : [C] psftp winsftp wincons WINSSH BE_SSH SFTP wildcard WINMISC - + psftp.res winnojmp winnohlp winselcli LIBS + + psftp.res winnojmp winnohlp winselcli clicons LIBS pageant : [G] winpgnt pageant sshrsa sshpubk sshdes ARITH sshmd5 version + tree234 MISC sshaes sshsha winsecur winpgntc aqsync sshdss sshsh256 @@ -363,7 +364,7 @@ puttytel : [X] GTKTERM uxmisc misc ldisc settings uxsel U_BE_NOSSH + nogss utils memory GTKMAIN plink : [U] uxplink uxcons NONSSH UXSSH U_BE_ALL logging UXMISC uxsignal - + ux_x11 noterm uxnogtk sessprep cmdline + + ux_x11 noterm uxnogtk sessprep cmdline clicons PUTTYGEN_UNIX = KEYGEN sshprime sshdes ARITH sshmd5 version sshprng + sshrand uxnoise sshsha MISC sshrsa sshdss uxcons uxstore uxmisc @@ -374,7 +375,9 @@ puttygen : [U] cmdgen PUTTYGEN_UNIX cgtest : [UT] cgtest PUTTYGEN_UNIX pscp : [U] pscp uxsftp uxcons UXSSH BE_SSH SFTP wildcard UXMISC uxnogtk + + clicons psftp : [U] psftp uxsftp uxcons UXSSH BE_SSH SFTP wildcard UXMISC uxnogtk + + clicons pageant : [X] uxpgnt uxagentc aqsync pageant sshrsa sshpubk sshdes ARITH + sshmd5 version tree234 misc sshaes sshsha sshdss sshsh256 sshsh512 diff --git a/clicons.c b/clicons.c new file mode 100644 index 00000000..49811a05 --- /dev/null +++ b/clicons.c @@ -0,0 +1,14 @@ +/* + * clicons.c: definitions limited to tools that link against both + * console.c and cmdline.c. + */ + +#include "putty.h" + +static const LogPolicyVtable console_cli_logpolicy_vt = { + console_eventlog, + console_askappend, + console_logging_error, + cmdline_lp_verbose, +}; +LogPolicy console_cli_logpolicy[1] = {{ &console_cli_logpolicy_vt }}; diff --git a/cmdline.c b/cmdline.c index 8f656e53..fae28e58 100644 --- a/cmdline.c +++ b/cmdline.c @@ -157,6 +157,10 @@ static bool cmdline_check_unavailable(int flag, const char *p) static bool seen_hostname_argument = false; static bool seen_port_argument = false; +static bool seen_verbose_option = false; +bool cmdline_verbose(void) { return seen_verbose_option; } +bool cmdline_seat_verbose(Seat *seat) { return cmdline_verbose(); } +bool cmdline_lp_verbose(LogPolicy *lp) { return cmdline_verbose(); } int cmdline_process_param(const char *p, char *value, int need_save, Conf *conf) @@ -452,7 +456,8 @@ int cmdline_process_param(const char *p, char *value, } if (!strcmp(p, "-v")) { RETURN(1); - flags |= FLAG_VERBOSE; + UNAVAILABLE_IN(TOOLTYPE_NO_VERBOSE_OPTION); + seen_verbose_option = true; } if (!strcmp(p, "-l")) { RETURN(2); diff --git a/misc.c b/misc.c index 9ca15c8f..b3175244 100644 --- a/misc.c +++ b/misc.c @@ -364,6 +364,11 @@ StripCtrlChars *nullseat_stripctrl_new( Seat *seat, BinarySink *bs_out, SeatInteractionContext sic) {return NULL;} bool nullseat_set_trust_status(Seat *seat, bool tr) { return false; } bool nullseat_set_trust_status_vacuously(Seat *seat, bool tr) { return true; } +bool nullseat_verbose_no(Seat *seat) { return false; } +bool nullseat_verbose_yes(Seat *seat) { return true; } + +bool null_lp_verbose_no(LogPolicy *lp) { return false; } +bool null_lp_verbose_yes(LogPolicy *lp) { return true; } void sk_free_peer_info(SocketPeerInfo *pi) { diff --git a/pscp.c b/pscp.c index cadf7916..3cdb93ce 100644 --- a/pscp.c +++ b/pscp.c @@ -82,6 +82,7 @@ static const SeatVtable pscp_seat_vt = { nullseat_get_window_pixel_size, console_stripctrl_new, nullseat_set_trust_status_vacuously, + cmdline_seat_verbose, }; static Seat pscp_seat[1] = {{ &pscp_seat_vt }}; @@ -450,9 +451,9 @@ static void do_cmd(char *host, char *user, char *cmd) } conf_set_bool(conf, CONF_nopty, true); - logctx = log_init(default_logpolicy, conf); + logctx = log_init(console_cli_logpolicy, conf); - platform_psftp_pre_conn_setup(); + platform_psftp_pre_conn_setup(console_cli_logpolicy); err = backend_init(&ssh_backend, pscp_seat, &backend, logctx, conf, conf_get_str(conf, CONF_host), @@ -2257,7 +2258,7 @@ int psftp_main(int argc, char *argv[]) i++; /* skip next argument */ } else if (ret == 1) { /* We have our own verbosity in addition to `flags'. */ - if (flags & FLAG_VERBOSE) + if (cmdline_verbose()) verbose = true; } else if (strcmp(argv[i], "-pgpfp") == 0) { pgp_fingerprints(); diff --git a/psftp.c b/psftp.c index a9aeb4fa..4d128c03 100644 --- a/psftp.c +++ b/psftp.c @@ -64,6 +64,7 @@ static const SeatVtable psftp_seat_vt = { nullseat_get_window_pixel_size, console_stripctrl_new, nullseat_set_trust_status_vacuously, + cmdline_seat_verbose, }; static Seat psftp_seat[1] = {{ &psftp_seat_vt }}; @@ -2709,9 +2710,9 @@ static int psftp_connect(char *userhost, char *user, int portnumber) "exec sftp-server"); conf_set_bool(conf, CONF_ssh_subsys2, false); - psftp_logctx = log_init(default_logpolicy, conf); + psftp_logctx = log_init(console_cli_logpolicy, conf); - platform_psftp_pre_conn_setup(); + platform_psftp_pre_conn_setup(console_cli_logpolicy); err = backend_init(&ssh_backend, psftp_seat, &backend, psftp_logctx, conf, conf_get_str(conf, CONF_host), @@ -2798,7 +2799,7 @@ int psftp_main(int argc, char *argv[]) i++; /* skip next argument */ } else if (ret == 1) { /* We have our own verbosity in addition to `flags'. */ - if (flags & FLAG_VERBOSE) + if (cmdline_verbose()) verbose = true; } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-?") == 0 || diff --git a/psftp.h b/psftp.h index 9ed40b1d..79327e7a 100644 --- a/psftp.h +++ b/psftp.h @@ -49,7 +49,7 @@ char *ssh_sftp_get_cmdline(const char *prompt, bool backend_required); * Platform-specific function called when we're about to make a * network connection. */ -void platform_psftp_pre_conn_setup(void); +void platform_psftp_pre_conn_setup(LogPolicy *lp); /* * The main program in psftp.c. Called from main() in the platform- diff --git a/putty.h b/putty.h index 202fc022..fc7cc451 100644 --- a/putty.h +++ b/putty.h @@ -581,8 +581,6 @@ extern const char *const appname; /* * Some global flags denoting the type of application. * - * FLAG_VERBOSE is set when the user requests verbose details. - * * FLAG_INTERACTIVE is set when a full interactive shell session is * being run, _either_ because no remote command has been provided * _or_ because the application is GUI and can't run non- @@ -596,7 +594,6 @@ extern const char *const appname; * headers. It's probably best if those ones start from 0x1000, to * avoid collision. */ -#define FLAG_VERBOSE 0x0001 #define FLAG_INTERACTIVE 0x0002 GLOBAL int flags; @@ -954,6 +951,11 @@ struct SeatVtable { * prompts by malicious servers. */ bool (*set_trust_status)(Seat *seat, bool trusted); + + /* + * Ask the seat whether it would like verbose messages. + */ + bool (*verbose)(Seat *seat); }; static inline size_t seat_output( @@ -999,6 +1001,8 @@ static inline StripCtrlChars *seat_stripctrl_new( { return seat->vt->stripctrl_new(seat, bs, sic); } static inline bool seat_set_trust_status(Seat *seat, bool trusted) { return seat->vt->set_trust_status(seat, trusted); } +static inline bool seat_verbose(Seat *seat) +{ return seat->vt->verbose(seat); } /* Unlike the seat's actual method, the public entry point * seat_connection_fatal is a wrapper function with a printf-like API, @@ -1051,6 +1055,8 @@ StripCtrlChars *nullseat_stripctrl_new( Seat *seat, BinarySink *bs_out, SeatInteractionContext sic); bool nullseat_set_trust_status(Seat *seat, bool trusted); bool nullseat_set_trust_status_vacuously(Seat *seat, bool trusted); +bool nullseat_verbose_no(Seat *seat); +bool nullseat_verbose_yes(Seat *seat); /* * Seat functions provided by the platform's console-application @@ -1076,6 +1082,7 @@ bool console_set_trust_status(Seat *seat, bool trusted); * Other centralised seat functions. */ int filexfer_get_userpass_input(Seat *seat, prompts_t *p, bufchain *input); +bool cmdline_seat_verbose(Seat *seat); /* * Data type 'TermWin', which is a vtable encapsulating all the @@ -1681,6 +1688,11 @@ struct LogPolicyVtable { * file :-) */ void (*logging_error)(LogPolicy *lp, const char *event); + + /* + * Ask whether extra verbose log messages are required. + */ + bool (*verbose)(LogPolicy *lp); }; struct LogPolicy { const LogPolicyVtable *vt; @@ -1694,6 +1706,19 @@ static inline int lp_askappend( { return lp->vt->askappend(lp, filename, callback, ctx); } static inline void lp_logging_error(LogPolicy *lp, const char *event) { lp->vt->logging_error(lp, event); } +static inline bool lp_verbose(LogPolicy *lp) +{ return lp->vt->verbose(lp); } + +/* Defined in conscli.c, used in several console command-line tools */ +extern LogPolicy console_cli_logpolicy[]; + +int console_askappend(LogPolicy *lp, Filename *filename, + void (*callback)(void *ctx, int result), void *ctx); +void console_logging_error(LogPolicy *lp, const char *string); +void console_eventlog(LogPolicy *lp, const char *string); +bool null_lp_verbose_yes(LogPolicy *lp); +bool null_lp_verbose_no(LogPolicy *lp); +bool cmdline_lp_verbose(LogPolicy *lp); LogContext *log_init(LogPolicy *lp, Conf *conf); void log_free(LogContext *logctx); @@ -1725,10 +1750,6 @@ void log_packet(LogContext *logctx, int direction, int type, const unsigned long *sequence, unsigned downstream_id, const char *additional_log_text); -/* This is defined by applications that have an obvious logging - * destination like standard error or the GUI. */ -extern LogPolicy default_logpolicy[1]; - /* * Exports from testback.c */ @@ -1950,6 +1971,7 @@ void cmdline_run_saved(Conf *); void cmdline_cleanup(void); int cmdline_get_passwd_input(prompts_t *p); bool cmdline_host_ok(Conf *); +bool cmdline_verbose(void); #define TOOLTYPE_FILETRANSFER 1 #define TOOLTYPE_NONNETWORK 2 #define TOOLTYPE_HOST_ARG 4 @@ -1957,6 +1979,7 @@ bool cmdline_host_ok(Conf *); #define TOOLTYPE_HOST_ARG_PROTOCOL_PREFIX 16 #define TOOLTYPE_HOST_ARG_FROM_LAUNCHABLE_LOAD 32 #define TOOLTYPE_PORT_ARG 64 +#define TOOLTYPE_NO_VERBOSE_OPTION 128 extern int cmdline_tooltype; void cmdline_error(const char *, ...) PRINTF_LIKE(1, 2); diff --git a/sesschan.c b/sesschan.c index 5006423c..2aee4a1c 100644 --- a/sesschan.c +++ b/sesschan.c @@ -168,6 +168,7 @@ static const LogPolicyVtable sesschan_logpolicy_vt = { sesschan_eventlog, sesschan_askappend, sesschan_logging_error, + null_lp_verbose_no, }; static size_t sesschan_seat_output( @@ -196,6 +197,7 @@ static const SeatVtable sesschan_seat_vt = { sesschan_get_window_pixel_size, nullseat_stripctrl_new, nullseat_set_trust_status, + nullseat_verbose_no, }; Channel *sesschan_new(SshChannel *c, LogContext *logctx, diff --git a/ssh.c b/ssh.c index cd33c7f4..30f4ac6a 100644 --- a/ssh.c +++ b/ssh.c @@ -744,7 +744,7 @@ static const char *connect_to_host( ssh->fullhostname = NULL; *realhost = dupstr(host); /* best we can do */ - if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE)) { + if (seat_verbose(ssh->seat) || (flags & FLAG_INTERACTIVE)) { /* In an interactive session, or in verbose mode, announce * in the console window that we're a sharing downstream, * to avoid confusing users as to why this session doesn't diff --git a/ssh1login.c b/ssh1login.c index 145ac640..5e6269d3 100644 --- a/ssh1login.c +++ b/ssh1login.c @@ -426,7 +426,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) pq_push(s->ppl.out_pq, pkt); ppl_logevent("Sent username \"%s\"", s->username); - if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE)) + if (seat_verbose(s->ppl.seat) || (flags & FLAG_INTERACTIVE)) ppl_printf("Sent username \"%s\"\r\n", s->username); crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL); @@ -586,7 +586,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) if (pktin->type == SSH1_SMSG_SUCCESS) { ppl_logevent("Pageant's response " "accepted"); - if (flags & FLAG_VERBOSE) { + if (seat_verbose(s->ppl.seat)) { ptrlen comment = ptrlen_from_strbuf( s->agent_comment); ppl_printf("Authenticated using RSA " @@ -630,7 +630,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) * key file. */ bool got_passphrase; /* need not be kept over crReturn */ - if (flags & FLAG_VERBOSE) + if (seat_verbose(s->ppl.seat)) ppl_printf("Trying public key authentication.\r\n"); ppl_logevent("Trying public key \"%s\"", filename_to_str(s->keyfile)); @@ -644,7 +644,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) char *passphrase = NULL; /* only written after crReturn */ const char *error; if (!s->privatekey_encrypted) { - if (flags & FLAG_VERBOSE) + if (seat_verbose(s->ppl.seat)) ppl_printf("No passphrase required.\r\n"); passphrase = NULL; } else { @@ -766,7 +766,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL); if (pktin->type == SSH1_SMSG_FAILURE) { - if (flags & FLAG_VERBOSE) + if (seat_verbose(s->ppl.seat)) ppl_printf("Failed to authenticate with" " our public key.\r\n"); continue; /* go and try something else */ @@ -1054,7 +1054,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) s->cur_prompt = NULL; crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL); if (pktin->type == SSH1_SMSG_FAILURE) { - if (flags & FLAG_VERBOSE) + if (seat_verbose(s->ppl.seat)) ppl_printf("Access denied\r\n"); ppl_logevent("Authentication refused"); } else if (pktin->type != SSH1_SMSG_SUCCESS) { diff --git a/ssh2userauth.c b/ssh2userauth.c index 53df2f9b..e019b318 100644 --- a/ssh2userauth.c +++ b/ssh2userauth.c @@ -433,7 +433,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) prompt_get_result(s->cur_prompt->prompts[0]); free_prompts(s->cur_prompt); } else { - if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE)) + if (seat_verbose(s->ppl.seat) || (flags & FLAG_INTERACTIVE)) ppl_printf("Using username \"%s\".\r\n", s->username); } s->got_username = true; @@ -496,7 +496,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) * anti-spoofing header lines. */ if (bufchain_size(&s->banner) && - (flags & (FLAG_VERBOSE | FLAG_INTERACTIVE))) { + (seat_verbose(s->ppl.seat) || (flags & FLAG_INTERACTIVE))) { if (s->banner_scc) { ssh2_userauth_antispoof_msg( s, "Pre-authentication banner message from server:"); @@ -727,7 +727,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) } else { strbuf *agentreq, *sigdata; - if (flags & FLAG_VERBOSE) + if (seat_verbose(s->ppl.seat)) ppl_printf("Authenticating with public key " "\"%.*s\" from agent\r\n", PTRLEN_PRINTF(s->comment)); @@ -836,7 +836,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) * Actually attempt a serious authentication using * the key. */ - if (flags & FLAG_VERBOSE) + if (seat_verbose(s->ppl.seat)) ppl_printf("Authenticating with public key \"%s\"\r\n", s->publickey_comment); diff --git a/sshserver.c b/sshserver.c index 7889b7d4..b08373b3 100644 --- a/sshserver.c +++ b/sshserver.c @@ -120,6 +120,7 @@ static const SeatVtable server_seat_vt = { nullseat_get_window_pixel_size, nullseat_stripctrl_new, nullseat_set_trust_status, + nullseat_verbose_no, }; static void server_socket_log(Plug *plug, int type, SockAddr *addr, int port, diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 015d61a4..589f7f7b 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -399,6 +399,7 @@ static const SeatVtable gtk_seat_vt = { gtk_seat_get_window_pixel_size, gtk_seat_stripctrl_new, gtk_seat_set_trust_status, + nullseat_verbose_yes, }; static void gtk_eventlog(LogPolicy *lp, const char *string) @@ -428,6 +429,7 @@ static const LogPolicyVtable gtk_logpolicy_vt = { gtk_eventlog, gtk_askappend, gtk_logging_error, + null_lp_verbose_yes, }; /* diff --git a/unix/uxcons.c b/unix/uxcons.c index da7b8935..e3a57493 100644 --- a/unix/uxcons.c +++ b/unix/uxcons.c @@ -366,9 +366,8 @@ int console_confirm_weak_cached_hostkey( * Ask whether to wipe a session log file before writing to it. * Returns 2 for wipe, 1 for append, 0 for cancel (don't log). */ -static int console_askappend(LogPolicy *lp, Filename *filename, - void (*callback)(void *ctx, int result), - void *ctx) +int console_askappend(LogPolicy *lp, Filename *filename, + void (*callback)(void *ctx, int result), void *ctx) { static const char msgtemplate[] = "The session log file \"%.*s\" already exists.\n" @@ -468,7 +467,7 @@ void old_keyfile_warning(void) postmsg(&cf); } -static void console_logging_error(LogPolicy *lp, const char *string) +void console_logging_error(LogPolicy *lp, const char *string) { /* Errors setting up logging are considered important, so they're * displayed to standard error even when not in verbose mode */ @@ -480,11 +479,11 @@ static void console_logging_error(LogPolicy *lp, const char *string) } -static void console_eventlog(LogPolicy *lp, const char *string) +void console_eventlog(LogPolicy *lp, const char *string) { /* Ordinary Event Log entries are displayed in the same way as * logging errors, but only in verbose mode */ - if (flags & FLAG_VERBOSE) + if (lp_verbose(lp)) console_logging_error(lp, string); } @@ -624,10 +623,3 @@ bool is_interactive(void) char *platform_get_x_display(void) { return dupstr(getenv("DISPLAY")); } - -static const LogPolicyVtable default_logpolicy_vt = { - console_eventlog, - console_askappend, - console_logging_error, -}; -LogPolicy default_logpolicy[1] = {{ &default_logpolicy_vt }}; diff --git a/unix/uxplink.c b/unix/uxplink.c index e3e72a57..420fb4c8 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -399,6 +399,7 @@ static const SeatVtable plink_seat_vt = { nullseat_get_window_pixel_size, console_stripctrl_new, console_set_trust_status, + cmdline_seat_verbose, }; static Seat plink_seat[1] = {{ &plink_seat_vt }}; @@ -840,7 +841,7 @@ int main(int argc, char **argv) /* * Start up the connection. */ - logctx = log_init(default_logpolicy, conf); + logctx = log_init(console_cli_logpolicy, conf); { const char *error; char *realhost; diff --git a/unix/uxputty.c b/unix/uxputty.c index 7e2a6817..eb28b698 100644 --- a/unix/uxputty.c +++ b/unix/uxputty.c @@ -80,8 +80,9 @@ const bool share_can_be_upstream = true; void setup(bool single) { sk_init(); - flags = FLAG_VERBOSE | FLAG_INTERACTIVE; - cmdline_tooltype |= TOOLTYPE_HOST_ARG | TOOLTYPE_PORT_ARG; + flags = FLAG_INTERACTIVE; + cmdline_tooltype |= TOOLTYPE_HOST_ARG | TOOLTYPE_PORT_ARG | + TOOLTYPE_NO_VERBOSE_OPTION; default_protocol = be_default_protocol; /* Find the appropriate default port. */ { diff --git a/unix/uxserver.c b/unix/uxserver.c index 98eaf8dd..5852388e 100644 --- a/unix/uxserver.c +++ b/unix/uxserver.c @@ -163,6 +163,7 @@ static const LogPolicyVtable server_logpolicy_vt = { server_eventlog, server_askappend, server_logging_error, + null_lp_verbose_no, }; struct AuthPolicy_ssh1_pubkey { diff --git a/unix/uxsftp.c b/unix/uxsftp.c index 3195f902..b0dbd3d1 100644 --- a/unix/uxsftp.c +++ b/unix/uxsftp.c @@ -631,7 +631,7 @@ char *ssh_sftp_get_cmdline(const char *prompt, bool no_fds_ok) void frontend_net_error_pending(void) {} -void platform_psftp_pre_conn_setup(void) {} +void platform_psftp_pre_conn_setup(LogPolicy *lp) {} const bool buildinfo_gtk_relevant = false; diff --git a/windows/wincons.c b/windows/wincons.c index ffc93040..d0a51d4f 100644 --- a/windows/wincons.c +++ b/windows/wincons.c @@ -412,7 +412,7 @@ static void console_eventlog(LogPolicy *lp, const char *string) { /* Ordinary Event Log entries are displayed in the same way as * logging errors, but only in verbose mode */ - if (flags & FLAG_VERBOSE) + if (lp_verbose(lp)) console_logging_error(lp, string); } @@ -549,10 +549,3 @@ int console_get_userpass_input(prompts_t *p) return 1; /* success */ } - -static const LogPolicyVtable default_logpolicy_vt = { - console_eventlog, - console_askappend, - console_logging_error, -}; -LogPolicy default_logpolicy[1] = {{ &default_logpolicy_vt }}; diff --git a/windows/windlg.c b/windows/windlg.c index 26bea503..183837db 100644 --- a/windows/windlg.c +++ b/windows/windlg.c @@ -995,12 +995,13 @@ static int win_gui_askappend(LogPolicy *lp, Filename *filename, return 0; } -static const LogPolicyVtable default_logpolicy_vt = { +static const LogPolicyVtable win_gui_logpolicy_vt = { win_gui_eventlog, win_gui_askappend, win_gui_logging_error, + null_lp_verbose_yes, }; -LogPolicy default_logpolicy[1] = {{ &default_logpolicy_vt }}; +LogPolicy win_gui_logpolicy[1] = {{ &win_gui_logpolicy_vt }}; /* * Warn about the obsolescent key file format. diff --git a/windows/window.c b/windows/window.c index 1e8ef11f..a27a1c09 100644 --- a/windows/window.c +++ b/windows/window.c @@ -360,6 +360,7 @@ static const SeatVtable win_seat_vt = { win_seat_get_window_pixel_size, win_seat_stripctrl_new, win_seat_set_trust_status, + nullseat_verbose_yes, }; static Seat win_seat_impl = { &win_seat_vt }; Seat *const win_seat = &win_seat_impl; @@ -471,6 +472,8 @@ static void close_session(void *ignored_context) } } +extern LogPolicy win_gui_logpolicy[1]; /* defined in windlg.c */ + int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { MSG msg; @@ -481,8 +484,9 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) hinst = inst; hwnd = NULL; - flags = FLAG_VERBOSE | FLAG_INTERACTIVE; - cmdline_tooltype |= TOOLTYPE_HOST_ARG | TOOLTYPE_PORT_ARG; + flags = FLAG_INTERACTIVE; + cmdline_tooltype |= TOOLTYPE_HOST_ARG | TOOLTYPE_PORT_ARG | + TOOLTYPE_NO_VERBOSE_OPTION; sk_init(); @@ -760,7 +764,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) wintw->vt = &windows_termwin_vt; term = term_init(conf, &ucsdata, wintw); setup_clipboards(term, conf); - logctx = log_init(default_logpolicy, conf); + logctx = log_init(win_gui_logpolicy, conf); term_provide_logctx(term, logctx); term_size(term, conf_get_int(conf, CONF_height), conf_get_int(conf, CONF_width), @@ -868,7 +872,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) } if (restricted_acl) { - lp_eventlog(default_logpolicy, "Running with restricted process ACL"); + lp_eventlog(win_gui_logpolicy, "Running with restricted process ACL"); } winselgui_set_hwnd(hwnd); @@ -2299,7 +2303,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, break; case IDM_RESTART: if (!backend) { - lp_eventlog(default_logpolicy, + lp_eventlog(win_gui_logpolicy, "----- Session restarted -----"); term_pwron(term, false); start_backend(); diff --git a/windows/winplink.c b/windows/winplink.c index b3054b8a..99933013 100644 --- a/windows/winplink.c +++ b/windows/winplink.c @@ -101,6 +101,7 @@ static const SeatVtable plink_seat_vt = { nullseat_get_window_pixel_size, console_stripctrl_new, console_set_trust_status, + cmdline_seat_verbose, }; static Seat plink_seat[1] = {{ &plink_seat_vt }}; @@ -407,7 +408,7 @@ int main(int argc, char **argv) !conf_get_str_nthstrkey(conf, CONF_portfwd, 0)) conf_set_bool(conf, CONF_ssh_simple, true); - logctx = log_init(default_logpolicy, conf); + logctx = log_init(console_cli_logpolicy, conf); if (just_test_share_exists) { if (!vt->test_for_upstream) { @@ -423,7 +424,8 @@ int main(int argc, char **argv) } if (restricted_acl) { - lp_eventlog(default_logpolicy, "Running with restricted process ACL"); + lp_eventlog(console_cli_logpolicy, + "Running with restricted process ACL"); } inhandle = GetStdHandle(STD_INPUT_HANDLE); diff --git a/windows/winsftp.c b/windows/winsftp.c index c38fd9b6..3db81c71 100644 --- a/windows/winsftp.c +++ b/windows/winsftp.c @@ -712,10 +712,10 @@ char *ssh_sftp_get_cmdline(const char *prompt, bool no_fds_ok) return ctx->line; } -void platform_psftp_pre_conn_setup(void) +void platform_psftp_pre_conn_setup(LogPolicy *lp) { if (restricted_acl) { - lp_eventlog(default_logpolicy, "Running with restricted process ACL"); + lp_eventlog(lp, "Running with restricted process ACL"); } }