Browse Source

Updating code to b4c8fd9d

Source commit: 9185b8e78c509be716a7a265aa5cc3a3870a6378
Martin Prikryl 6 years ago
parent
commit
1e599ffa91

+ 58 - 58
source/core/PuttyIntf.cpp

@@ -85,18 +85,19 @@ TSecureShell * GetSecureShell(Plug * plug, bool & pfwd)
   }
 
   pfwd = is_pfwd(plug);
-  void * frontend;
+  Seat * seat;
   if (pfwd)
   {
-    frontend = get_pfwd_frontend(plug);
+    seat = get_pfwd_seat(plug);
   }
   else
   {
-    frontend = get_ssh_frontend(plug);
+    seat = get_ssh_seat(plug);
   }
-  DebugAssert(frontend != NULL);
+  DebugAssert(seat != NULL);
 
-  return reinterpret_cast<TSecureShell*>(frontend);
+  TSecureShell * SecureShell = static_cast<ScpSeat *>(seat)->SecureShell;
+  return SecureShell;
 }
 //---------------------------------------------------------------------------
 struct callback_set * get_callback_set(Plug * plug)
@@ -106,9 +107,10 @@ struct callback_set * get_callback_set(Plug * plug)
   return SecureShell->GetCallbackSet();
 }
 //---------------------------------------------------------------------------
-struct callback_set * get_frontend_callback_set(Frontend * frontend)
+struct callback_set * get_seat_callback_set(Seat * seat)
 {
-  return reinterpret_cast<TSecureShell *>(frontend)->GetCallbackSet();
+  TSecureShell * SecureShell = static_cast<ScpSeat *>(seat)->SecureShell;
+  return SecureShell->GetCallbackSet();
 }
 //---------------------------------------------------------------------------
 extern "C" char * do_select(Plug * plug, SOCKET skt, int startup)
@@ -127,31 +129,31 @@ extern "C" char * do_select(Plug * plug, SOCKET skt, int startup)
   return NULL;
 }
 //---------------------------------------------------------------------------
-int from_backend(Frontend * frontend, int is_stderr, const void * data, int datalen)
+static int output(Seat * seat, int is_stderr, const void * data, int len)
 {
-  DebugAssert(frontend);
+  TSecureShell * SecureShell = static_cast<ScpSeat *>(seat)->SecureShell;
   if (is_stderr >= 0)
   {
     DebugAssert((is_stderr == 0) || (is_stderr == 1));
-    ((TSecureShell *)frontend)->FromBackend((is_stderr == 1), reinterpret_cast<const unsigned char *>(data), datalen);
+    SecureShell->FromBackend((is_stderr == 1), reinterpret_cast<const unsigned char *>(data), len);
   }
   else
   {
     DebugAssert(is_stderr == -1);
-    ((TSecureShell *)frontend)->CWrite(reinterpret_cast<const char *>(data), datalen);
+    SecureShell->CWrite(reinterpret_cast<const char *>(data), len);
   }
   return 0;
 }
 //---------------------------------------------------------------------------
-int from_backend_eof(Frontend * /*frontend*/)
+static int eof(Seat *)
 {
   return FALSE;
 }
 //---------------------------------------------------------------------------
-int get_userpass_input(prompts_t * p, bufchain * DebugUsedArg(input))
+static int get_userpass_input(Seat * seat, prompts_t * p, bufchain * DebugUsedArg(input))
 {
   DebugAssert(p != NULL);
-  TSecureShell * SecureShell = reinterpret_cast<TSecureShell *>(p->frontend);
+  TSecureShell * SecureShell = static_cast<ScpSeat *>(seat)->SecureShell;
   DebugAssert(SecureShell != NULL);
 
   int Result;
@@ -217,55 +219,42 @@ int get_userpass_input(prompts_t * p, bufchain * DebugUsedArg(input))
   return Result;
 }
 //---------------------------------------------------------------------------
-char * get_ttymode(Frontend * /*frontend*/, const char * /*mode*/)
-{
-  // should never happen when Config.nopty == TRUE
-  DebugFail();
-  return NULL;
-}
-//---------------------------------------------------------------------------
-void connection_fatal(Frontend * frontend, const char * fmt, ...)
+static void connection_fatal(Seat * seat, const char * message)
 {
-  va_list Param;
-  char Buf[200];
-  va_start(Param, fmt);
-  vsnprintf(Buf, LENOF(Buf), fmt, Param); \
-  Buf[LENOF(Buf) - 1] = '\0'; \
-  va_end(Param);
 
-  DebugAssert(frontend != NULL);
-  ((TSecureShell *)frontend)->PuttyFatalError(Buf);
+  TSecureShell * SecureShell = static_cast<ScpSeat *>(seat)->SecureShell;
+  SecureShell->PuttyFatalError(UnicodeString(AnsiString(message)));
 }
 //---------------------------------------------------------------------------
-int verify_ssh_host_key(Frontend * frontend, char * host, int port, const char * keytype,
+int verify_ssh_host_key(Seat * seat, const char * host, int port, const char * keytype,
   char * keystr, char * fingerprint, void (*/*callback*/)(void * ctx, int result),
   void * /*ctx*/)
 {
-  DebugAssert(frontend != NULL);
-  reinterpret_cast<TSecureShell *>(frontend)->VerifyHostKey(host, port, keytype, keystr, fingerprint);
+  TSecureShell * SecureShell = static_cast<ScpSeat *>(seat)->SecureShell;
+  SecureShell->VerifyHostKey(host, port, keytype, keystr, fingerprint);
 
   // We should return 0 when key was not confirmed, we throw exception instead.
   return 1;
 }
 //---------------------------------------------------------------------------
-int have_ssh_host_key(void * frontend, const char * hostname, int port,
+int have_ssh_host_key(Seat * seat, const char * hostname, int port,
   const char * keytype)
 {
-  DebugAssert(frontend != NULL);
-  return static_cast<TSecureShell *>(frontend)->HaveHostKey(hostname, port, keytype) ? 1 : 0;
+  TSecureShell * SecureShell = static_cast<ScpSeat *>(seat)->SecureShell;
+  return SecureShell->HaveHostKey(hostname, port, keytype) ? 1 : 0;
 }
 //---------------------------------------------------------------------------
-int askalg(Frontend * frontend, const char * algtype, const char * algname,
+int confirm_weak_crypto_primitive(Seat * seat, const char * algtype, const char * algname,
   void (*/*callback*/)(void * ctx, int result), void * /*ctx*/)
 {
-  DebugAssert(frontend != NULL);
-  ((TSecureShell *)frontend)->AskAlg(algtype, algname);
+  TSecureShell * SecureShell = static_cast<ScpSeat *>(seat)->SecureShell;
+  SecureShell->AskAlg(algtype, algname);
 
   // We should return 0 when alg was not confirmed, we throw exception instead.
   return 1;
 }
 //---------------------------------------------------------------------------
-int askhk(Frontend * /*frontend*/, const char * /*algname*/, const char * /*betteralgs*/,
+int confirm_weak_cached_hostkey(Seat *, const char * /*algname*/, const char * /*betteralgs*/,
   void (*/*callback*/)(void *ctx, int result), void * /*ctx*/)
 {
   return 1;
@@ -276,11 +265,11 @@ void old_keyfile_warning(void)
   // no reference to TSecureShell instance available
 }
 //---------------------------------------------------------------------------
-void display_banner(Frontend * frontend, const char * banner, int size)
+void display_banner(Seat * seat, const char * banner, int size)
 {
-  DebugAssert(frontend);
+  TSecureShell * SecureShell = static_cast<ScpSeat *>(seat)->SecureShell;
   UnicodeString Banner(UTF8String(banner, size));
-  ((TSecureShell *)frontend)->DisplayBanner(Banner);
+  SecureShell->DisplayBanner(Banner);
 }
 //---------------------------------------------------------------------------
 static void SSHFatalError(const char * Format, va_list Param)
@@ -316,16 +305,6 @@ void ldisc_echoedit_update(Ldisc * /*handle*/)
   DebugFail();
 }
 //---------------------------------------------------------------------------
-void notify_remote_exit(Frontend * /*frontend*/)
-{
-  // nothing
-}
-//---------------------------------------------------------------------------
-void update_specials_menu(Frontend * /*frontend*/)
-{
-  // nothing
-}
-//---------------------------------------------------------------------------
 unsigned long schedule_timer(int ticks, timer_fn_t /*fn*/, void * /*ctx*/)
 {
   return ticks + GetTickCount();
@@ -351,11 +330,6 @@ void pinger_free(Pinger * /*pinger*/)
   // nothing
 }
 //---------------------------------------------------------------------------
-void set_busy_status(Frontend * /*frontend*/, int /*status*/)
-{
-  // nothing
-}
-//---------------------------------------------------------------------------
 void platform_get_x11_auth(struct X11Display * /*display*/, Conf * /*conf*/)
 {
   // nothing, therefore no auth.
@@ -377,6 +351,32 @@ char * get_remote_username(Conf * conf)
   return result;
 }
 //---------------------------------------------------------------------------
+static const SeatVtable ScpSeatVtable =
+  {
+    output,
+    eof,
+    get_userpass_input,
+    nullseat_notify_remote_exit,
+    connection_fatal,
+    nullseat_update_specials_menu,
+    nullseat_get_ttymode,
+    nullseat_set_busy_status,
+    verify_ssh_host_key,
+    confirm_weak_crypto_primitive,
+    confirm_weak_cached_hostkey,
+    nullseat_is_always_utf8,
+    nullseat_echoedit_update,
+    nullseat_get_x_display,
+    nullseat_get_windowid,
+    nullseat_get_char_cell_size
+  };
+//---------------------------------------------------------------------------
+ScpSeat::ScpSeat(TSecureShell * ASecureShell)
+{
+  SecureShell = ASecureShell;
+  vt = &ScpSeatVtable;
+}
+//---------------------------------------------------------------------------
 static long OpenWinSCPKey(HKEY Key, const char * SubKey, HKEY * Result, bool CanCreate)
 {
   long R;

+ 8 - 0
source/core/PuttyIntf.h

@@ -32,4 +32,12 @@ UnicodeString GetCipher2Name(const ssh2_cipher * Cipher);
 UnicodeString GetCompressorName(const ssh_compressor * Compressor);
 UnicodeString GetDecompressorName(const ssh_decompressor * Decompressor);
 //---------------------------------------------------------------------------
+class TSecureShell;
+struct ScpSeat : public Seat
+{
+  TSecureShell * SecureShell;
+
+  ScpSeat(TSecureShell * SecureShell);
+};
+//---------------------------------------------------------------------------
 #endif

+ 20 - 3
source/core/SecureShell.cpp

@@ -33,8 +33,21 @@ struct TPuttyTranslation
 struct ScpLogPolicy : public LogPolicy
 {
   TSecureShell * SecureShell;
+  struct Seat * Seat;
 };
 //---------------------------------------------------------------------------
+Seat * get_log_seat(LogContext * logctx)
+{
+  ScpLogPolicy * ALogPolicy = static_cast<ScpLogPolicy *>(log_get_logpolicy(logctx));
+  return ALogPolicy->Seat;
+}
+//---------------------------------------------------------------------------
+struct callback_set * get_log_callback_set(LogContext * logctx)
+{
+  ScpLogPolicy * ALogPolicy = static_cast<ScpLogPolicy *>(log_get_logpolicy(logctx));
+  return ALogPolicy->SecureShell->GetCallbackSet();
+}
+//---------------------------------------------------------------------------
 __fastcall TSecureShell::TSecureShell(TSessionUI* UI,
   TSessionData * SessionData, TSessionLog * Log, TConfiguration * Configuration)
 {
@@ -50,6 +63,7 @@ __fastcall TSecureShell::TSecureShell(TSessionUI* UI,
   Pending = NULL;
   FBackendHandle = NULL;
   FLogPolicy = NULL;
+  FSeat = NULL;
   FLogCtx = NULL;
   ResetConnection();
   FOnCaptureOutput = NULL;
@@ -93,6 +107,8 @@ void __fastcall TSecureShell::ResetConnection()
   FStoredPassphraseTried = false;
   delete FLogPolicy;
   FLogPolicy = NULL;
+  delete FSeat;
+  FSeat = NULL;
   if (FLogCtx != NULL)
   {
     log_free(FLogCtx);
@@ -436,14 +452,15 @@ void __fastcall TSecureShell::Open()
     const char * InitError;
     Conf * conf = StoreToConfig(FSessionData, Simple);
     FSendBuf = FSessionData->SendBuf;
+    FSeat = new ScpSeat(this);
     FLogPolicy = new ScpLogPolicy();
     FLogPolicy->vt = &ScpLogPolicyVTable;
     FLogPolicy->SecureShell = this;
+    FLogPolicy->Seat = FSeat;
     try
     {
-      Frontend * AFrontend = reinterpret_cast<Frontend *>(this);
-      FLogCtx = log_init(FLogPolicy, conf, AFrontend);
-      InitError = backend_init(&ssh_backend, AFrontend, &FBackendHandle, FLogCtx, conf,
+      FLogCtx = log_init(FLogPolicy, conf);
+      InitError = backend_init(&ssh_backend, FSeat, &FBackendHandle, FLogCtx, conf,
         AnsiString(FSessionData->HostNameExpanded).c_str(), FSessionData->PortNumber, &RealHost,
         (FSessionData->TcpNoDelay ? 1 : 0),
         conf_get_int(conf, CONF_tcp_keepalives));

+ 2 - 0
source/core/SecureShell.h

@@ -22,6 +22,7 @@ struct callback_set;
 enum TSshImplementation { sshiUnknown, sshiOpenSSH, sshiProFTPD, sshiBitvise, sshiTitan, sshiOpenVMS, sshiCerberus };
 struct ScpLogPolicy;
 struct LogContext;
+struct ScpSeat;
 //---------------------------------------------------------------------------
 class TSecureShell
 {
@@ -73,6 +74,7 @@ private:
   int FSendBuf;
   std::auto_ptr<callback_set> FCallbackSet;
   ScpLogPolicy * FLogPolicy;
+  ScpSeat * FSeat;
   LogContext * FLogCtx;
 
   void __fastcall Init();

+ 3 - 5
source/putty/logging.c

@@ -20,7 +20,6 @@ struct LogContext {
     LogPolicy *lp;
     Conf *conf;
     int logtype;		       /* cached out of conf */
-    Frontend *frontend; // WINSCP
 };
 
 static Filename *xlatlognam(Filename *s, char *hostname, int port,
@@ -366,7 +365,7 @@ void log_packet(LogContext *ctx, int direction, int type,
     logflush(ctx);
 }
 
-LogContext *log_init(LogPolicy *lp, Conf *conf, Frontend* frontend) // WINSCP
+LogContext *log_init(LogPolicy *lp, Conf *conf)
 {
     LogContext *ctx = snew(LogContext);
     ctx->lgfp = NULL;
@@ -375,15 +374,14 @@ LogContext *log_init(LogPolicy *lp, Conf *conf, Frontend* frontend) // WINSCP
     ctx->conf = conf_copy(conf);
     ctx->logtype = conf_get_int(ctx->conf, CONF_logtype);
     ctx->currlogfilename = NULL;
-    ctx->frontend = frontend;
     bufchain_init(&ctx->queue);
     return ctx;
 }
 
 // WINSCP
-Frontend *log_get_frontend(LogContext *ctx)
+LogPolicy *log_get_logpolicy(LogContext *ctx)
 {
-    return ctx->frontend;
+    return ctx->lp;
 }
 
 void log_free(LogContext *ctx)

+ 5 - 5
source/putty/portfwd.c

@@ -1069,20 +1069,20 @@ int is_pfwd(Plug * plug)
     (plug->vt->closing == pfl_closing);
 }
 
-Frontend * get_pfwd_frontend(Plug * plug)
+Seat * get_pfwd_seat(Plug * plug)
 {
-  Frontend * frontend = NULL;
+  LogContext * logctx;
   if (plug->vt->closing == pfl_closing)
   {
     struct PortListener *pl = container_of(plug, struct PortListener, plug);
-    frontend = log_get_frontend(pl->cl->logctx);
+    logctx = pl->cl->logctx;
   }
   else if (plug->vt->closing == pfd_closing)
   {
     struct PortForwarding *pf = container_of(plug, struct PortForwarding, plug);
-    frontend = log_get_frontend(pf->cl->logctx);
+    logctx = pf->cl->logctx;
   }
-  return frontend;
+  return get_log_seat(logctx);
 }
 
 #endif

+ 8 - 11
source/putty/putty.h

@@ -638,7 +638,7 @@ typedef struct {
     void *data;		/* slot for housekeeping data, managed by
 			 * seat_get_userpass_input(); initially NULL */
 } prompts_t;
-prompts_t *new_prompts();
+prompts_t *new_prompts(void); // WINSCP (void)
 void add_prompt(prompts_t *p, char *promptstr, int echo);
 void prompt_set_result(prompt_t *pr, const char *newstr);
 void prompt_ensure_result_size(prompt_t *pr, int len);
@@ -1481,7 +1481,7 @@ struct LogPolicy {
 #define lp_askappend(lp, fn, cb, ctx) ((lp)->vt->askappend(lp, fn, cb, ctx))
 #define lp_logging_error(lp, event) ((lp)->vt->logging_error(lp, event))
 
-LogContext *log_init(LogPolicy *lp, Conf *conf, Frontend* frontend); // WINSCP
+LogContext *log_init(LogPolicy *lp, Conf *conf);
 void log_free(LogContext *logctx);
 void log_reconfig(LogContext *logctx, Conf *conf);
 void logfopen(LogContext *logctx);
@@ -1679,15 +1679,9 @@ void pgp_fingerprints(void);
  * have_ssh_host_key() just returns true if a key of that type is
  * already cached and false otherwise.
  */
-#ifdef MPEXT
-int have_ssh_host_key(void *frontend, const char *host, int port, const char *keytype);
-#else
-int have_ssh_host_key(const char *host, int port, const char *keytype);
-#endif
+int have_ssh_host_key(Seat *seat, const char *host, int port, const char *keytype); // WINSCP
 
-#ifdef MPEXT
-void display_banner(Frontend *frontend, const char* banner, int size);
-#endif
+void display_banner(Seat *seat, const char* banner, int size); // WINSCP
 /*
  * Exports from console frontends (wincons.c, uxcons.c)
  * that aren't equivalents to things in windlg.c et al.
@@ -1952,8 +1946,11 @@ int run_toplevel_callbacks(CALLBACK_SET_ONLY);
 int toplevel_callback_pending(CALLBACK_SET_ONLY);
 struct callback_set * get_callback_set(Plug * plug);
 struct callback_set * get_frontend_callback_set(Frontend * frontend);
+struct callback_set * get_seat_callback_set(Seat * seat);
 void delete_callbacks_for_context(CALLBACK_SET void *ctx);
-Frontend *log_get_frontend(LogContext *ctx); // WINSCP
+LogPolicy *log_get_logpolicy(LogContext *ctx); // WINSCP
+Seat * get_log_seat(LogContext * lp); // WINSCP
+struct callback_set * get_log_callback_set(LogContext * lp); // WINSCP
 
 /*
  * Another facility in callback.c deals with 'idempotent' callbacks,

+ 2 - 2
source/putty/puttyexp.h

@@ -12,7 +12,7 @@ typedef const struct ssh2_cipheralg *ssh2_cipher;
 
 int is_ssh(Plug * plug);
 int get_ssh_version(Backend * be);
-void * get_ssh_frontend(Plug * plug);
+Seat * get_ssh_seat(Plug * plug);
 const ssh1_cipher * get_cipher(Backend * be);
 const ssh2_cipher * get_cscipher(Backend * be);
 const ssh2_cipher * get_sccipher(Backend * be);
@@ -36,7 +36,7 @@ void get_macs(int * count, const struct ssh2_macalg *** amacs);
 // from portfwd.c
 
 int is_pfwd(Plug * plug);
-Frontend * get_pfwd_frontend(Plug * plug);
+Seat * get_pfwd_seat(Plug * plug);
 
 // for winstore.c
 

+ 4 - 4
source/putty/ssh.c

@@ -186,7 +186,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv,
             /* Load and pick the highest GSS library on the preference
              * list. */
             if (!ssh->gss_state.libs)
-                ssh->gss_state.libs = ssh_gss_setup(ssh->conf, ssh->frontend); // WINSCP
+                ssh->gss_state.libs = ssh_gss_setup(ssh->conf, ssh->logctx); // WINSCP
             ssh->gss_state.lib = NULL;
             if (ssh->gss_state.libs->nlibraries > 0) {
                 int i, j;
@@ -816,7 +816,7 @@ static const char *ssh_init(Seat *seat, Backend **backend_handle,
     bufchain_init(&ssh->user_input);
     ssh->ic_out_raw.fn = ssh_bpp_output_raw_data_callback;
     ssh->ic_out_raw.ctx = ssh;
-    ssh->ic_out_raw.set = get_frontend_callback_set(frontend);
+    ssh->ic_out_raw.set = get_seat_callback_set(seat);
 
     ssh->backend.vt = &ssh_backend;
     *backend_handle = &ssh->backend;
@@ -1136,9 +1136,9 @@ int get_ssh_version(Backend * be)
   return ssh->version;
 }
 
-void * get_ssh_frontend(Plug * plug)
+Seat * get_ssh_seat(Plug * plug)
 {
-  return container_of(plug, Ssh, plug)->frontend;
+  return container_of(plug, Ssh, plug)->seat;
 }
 
 const ssh1_cipher * get_cipher(Backend * be)

+ 3 - 3
source/putty/ssh.h

@@ -89,7 +89,7 @@ typedef struct PktOut {
 typedef struct PacketQueueBase {
     PacketQueueNode end;
     struct IdempotentCallback *ic;
-    Frontend * frontend; // WINSCP
+    Seat * seat; // WINSCP
 } PacketQueueBase;
 
 typedef struct PktInQueue {
@@ -107,8 +107,8 @@ void pq_base_push_front(PacketQueueBase *pqb, PacketQueueNode *node);
 void pq_base_concatenate(PacketQueueBase *dest,
                          PacketQueueBase *q1, PacketQueueBase *q2);
 
-void pq_in_init(PktInQueue *pq, Frontend * frontend); // WINSCP
-void pq_out_init(PktOutQueue *pq, Frontend * frontend); // WINSCP
+void pq_in_init(PktInQueue *pq, Seat * seat); // WINSCP
+void pq_out_init(PktOutQueue *pq, Seat * seat); // WINSCP
 void pq_in_clear(PktInQueue *pq);
 void pq_out_clear(PktOutQueue *pq);
 

+ 1 - 1
source/putty/ssh1connection.c

@@ -904,7 +904,7 @@ static void ssh1_channel_destroy(struct ssh1_channel *c)
      * toplevel callback, just in case anything on the current call
      * stack objects to this entire PPL being freed.
      */
-    queue_toplevel_callback(log_get_frontend(s->cl.logctx), ssh1_check_termination_callback, s); // WINSCP
+    queue_toplevel_callback(get_log_callback_set(s->cl.logctx), ssh1_check_termination_callback, s); // WINSCP
 }
 
 static int ssh1_check_termination(struct ssh1_connection_state *s)

+ 2 - 2
source/putty/ssh1login.c

@@ -693,7 +693,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
                         ppl_printf(("No passphrase required.\r\n"));
                     passphrase = NULL;
                 } else {
-                    s->cur_prompt = new_prompts(s->ppl.seat);
+                    s->cur_prompt = new_prompts(); // WINSCP removed s->ppl.seat
                     s->cur_prompt->to_server = FALSE;
                     s->cur_prompt->name = dupstr("SSH key passphrase");
                     add_prompt(s->cur_prompt,
@@ -833,7 +833,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
         /*
          * Otherwise, try various forms of password-like authentication.
          */
-        s->cur_prompt = new_prompts(s->ppl.seat);
+        s->cur_prompt = new_prompts(); // WINSCP removed s->ppl.seat
 
         if (conf_get_int(s->conf, CONF_try_tis_auth) &&
             (s->supported_auths_mask & (1 << SSH1_AUTH_TIS)) &&

+ 5 - 3
source/putty/ssh2connection.c

@@ -11,6 +11,9 @@
 #include "sshchan.h"
 #include "sshcr.h"
 
+// WINSCP
+#define queue_toplevel_callback(FN, CTX) queue_toplevel_callback(get_log_callback_set(CTX->cl.logctx), FN, CTX)
+
 struct ssh2_channel;
 
 typedef enum MainChanType {
@@ -1559,7 +1562,7 @@ static void ssh2_channel_destroy(struct ssh2_channel *c)
      * toplevel callback, just in case anything on the current call
      * stack objects to this entire PPL being freed.
      */
-    queue_toplevel_callback(log_get_frontend(s->cl.logctx), ssh2_check_termination_callback, s); // WINSCP
+    queue_toplevel_callback(ssh2_check_termination_callback, s);
 }
 
 static void ssh2_check_termination(struct ssh2_connection_state *s)
@@ -2111,8 +2114,7 @@ static void ssh2_sharing_no_more_downstreams(ConnectionLayer *cl)
 {
     struct ssh2_connection_state *s =
         container_of(cl, struct ssh2_connection_state, cl);
-    // WINSCP
-    queue_toplevel_callback(get_frontend_callback_set(log_get_frontend(cl->logctx)), ssh2_check_termination_callback, s);
+    queue_toplevel_callback(ssh2_check_termination_callback, s);
 }
 
 static struct X11FakeAuth *ssh2_add_sharing_x11_display(

+ 5 - 5
source/putty/ssh2transport.c

@@ -336,12 +336,12 @@ PacketProtocolLayer *ssh2_transport_new(
     s->server_greeting = dupstr(server_greeting);
     s->stats = stats;
 
-    pq_in_init(&s->pq_in_higher, higher_layer->frontend); // WINSCP
-    pq_out_init(&s->pq_out_higher, higher_layer->frontend); // WINSCP
+    pq_in_init(&s->pq_in_higher, higher_layer->seat); // WINSCP
+    pq_out_init(&s->pq_out_higher, higher_layer->seat); // WINSCP
     s->pq_out_higher.pqb.ic = &s->ic_pq_out_higher;
     s->ic_pq_out_higher.fn = ssh2_transport_higher_layer_packet_callback;
     s->ic_pq_out_higher.ctx = &s->ppl;
-    s->ic_pq_out_higher.set = get_frontend_callback_set(higher_layer->frontend);
+    s->ic_pq_out_higher.set = get_seat_callback_set(higher_layer->seat);
 
     s->higher_layer = higher_layer;
     s->higher_layer->selfptr = &s->higher_layer;
@@ -823,7 +823,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
                     if (hostkey_algs[j].id != s->preferred_hk[i])
                         continue;
                     if (have_ssh_host_key(
-                                          s->ppl.frontend, // WINSCP
+                                          s->ppl.seat, // WINSCP
                                           s->savedhost, s->savedport,
                                           hostkey_algs[j].alg->cache_id)) {
                         alg = ssh2_kexinit_addalg(s->kexlists[KEXLIST_HOSTKEY],
@@ -1122,7 +1122,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
                         in_commasep_string(hostkey_algs[j].alg->ssh_id,
                                            str.ptr, str.len) &&
                         !have_ssh_host_key(
-                                           s->ppl.frontend, // WINSCP
+                                           s->ppl.seat, // WINSCP
                                            s->savedhost, s->savedport,
                                            hostkey_algs[j].alg->cache_id)) {
                         s->uncert_hostkeys[s->n_uncert_hostkeys++] = j;

+ 1 - 1
source/putty/ssh2userauth.c

@@ -468,7 +468,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
                         void *data;
                         int len;
                         bufchain_prefix(&s->banner, &data, &len);
-                        display_banner(s->ppl.frontend, &s->banner, len); // WINSCP
+                        display_banner(s->ppl.seat, &s->banner, len); // WINSCP
                         seat_stderr(s->ppl.seat, data, len);
                         bufchain_consume(&s->banner, len);
                     }

+ 12 - 12
source/putty/sshcommon.c

@@ -85,7 +85,7 @@ static PktIn *pq_in_after(PacketQueueBase *pqb,
 
     if (pop) {
         #ifdef WINSCP
-        struct callback_set * set = get_frontend_callback_set(pqb->frontend);
+        struct callback_set * set = get_seat_callback_set(pqb->seat);
         assert(set != NULL);
         if (set->ic_pktin_free == NULL)
         {
@@ -133,18 +133,18 @@ static PktOut *pq_out_after(PacketQueueBase *pqb,
     return container_of(node, PktOut, qnode);
 }
 
-void pq_in_init(PktInQueue *pq, Frontend * frontend) // WINSCP
+void pq_in_init(PktInQueue *pq, Seat * seat) // WINSCP
 {
     pq->pqb.ic = NULL;
-    pq->pqb.frontend = frontend;
+    pq->pqb.seat = seat;
     pq->pqb.end.next = pq->pqb.end.prev = &pq->pqb.end;
     pq->after = pq_in_after;
 }
 
-void pq_out_init(PktOutQueue *pq, Frontend * frontend) // WINSCP
+void pq_out_init(PktOutQueue *pq, Seat * seat) // WINSCP
 {
     pq->pqb.ic = NULL;
-    pq->pqb.frontend = frontend;
+    pq->pqb.seat = seat;
     pq->pqb.end.next = pq->pqb.end.prev = &pq->pqb.end;
     pq->after = pq_out_after;
 }
@@ -685,7 +685,7 @@ void ssh_ppl_replace(PacketProtocolLayer *old, PacketProtocolLayer *new)
 
 void ssh_ppl_free(PacketProtocolLayer *ppl)
 {
-    delete_callbacks_for_context(get_frontend_callback_set(ppl->frontend), ppl); // WINSCP
+    delete_callbacks_for_context(get_seat_callback_set(ppl->seat), ppl); // WINSCP
     ppl->vt->free(ppl);
 }
 
@@ -703,7 +703,7 @@ void ssh_ppl_setup_queues(PacketProtocolLayer *ppl,
     ppl->in_pq->pqb.ic = &ppl->ic_process_queue;
     ppl->ic_process_queue.fn = ssh_ppl_ic_process_queue_callback;
     ppl->ic_process_queue.ctx = ppl;
-    ppl->ic_process_queue.set = get_frontend_callback_set(ppl->frontend);
+    ppl->ic_process_queue.set = get_seat_callback_set(ppl->seat);
 
     /* If there's already something on the input queue, it will want
      * handling immediately. */
@@ -739,14 +739,14 @@ static void ssh_bpp_output_packet_callback(void *context)
 
 void ssh_bpp_common_setup(BinaryPacketProtocol *bpp)
 {
-    pq_in_init(&bpp->in_pq, log_get_frontend(bpp->logctx)); // WINSCP
-    pq_out_init(&bpp->out_pq, log_get_frontend(bpp->logctx)); // WINSCP
+    pq_in_init(&bpp->in_pq, get_log_seat(bpp->logctx)); // WINSCP
+    pq_out_init(&bpp->out_pq, get_log_seat(bpp->logctx)); // WINSCP
     bpp->input_eof = FALSE;
     bpp->ic_in_raw.fn = ssh_bpp_input_raw_data_callback;
-    bpp->ic_in_raw.set = get_frontend_callback_set(log_get_frontend(bpp->logctx));
+    bpp->ic_in_raw.set = get_log_callback_set(bpp->logctx);
     bpp->ic_in_raw.ctx = bpp;
     bpp->ic_out_pq.fn = ssh_bpp_output_packet_callback;
-    bpp->ic_out_pq.set = get_frontend_callback_set(log_get_frontend(bpp->logctx));
+    bpp->ic_out_pq.set = get_log_callback_set(bpp->logctx);
     bpp->ic_out_pq.ctx = bpp;
     bpp->out_pq.pqb.ic = &bpp->ic_out_pq;
 }
@@ -754,7 +754,7 @@ void ssh_bpp_common_setup(BinaryPacketProtocol *bpp)
 void ssh_bpp_free(BinaryPacketProtocol *bpp)
 {
     // WINSCP
-    delete_callbacks_for_context(get_frontend_callback_set(log_get_frontend(bpp->logctx)), bpp);
+    delete_callbacks_for_context(get_log_callback_set(bpp->logctx), bpp);
     bpp->vt->free(bpp);
 }
 

+ 1 - 1
source/putty/sshgss.h

@@ -53,7 +53,7 @@ struct ssh_gss_liblist {
     struct ssh_gss_library *libraries;
     int nlibraries;
 };
-struct ssh_gss_liblist *ssh_gss_setup(Conf *conf, Frontend *frontend);
+struct ssh_gss_liblist *ssh_gss_setup(Conf *conf, LogContext *logctx);
 void ssh_gss_cleanup(struct ssh_gss_liblist *list);
 
 /*

+ 3 - 3
source/putty/windows/wingss.c

@@ -98,7 +98,7 @@ const char *gsslogmsg = NULL;
 
 static void ssh_sspi_bind_fns(struct ssh_gss_library *lib);
 
-struct ssh_gss_liblist *ssh_gss_setup(Conf *conf, Frontend *frontend) // MPEXT
+struct ssh_gss_liblist *ssh_gss_setup(Conf *conf, LogContext *logctx) // MPEXT
 {
     HMODULE module;
     HKEY regkey;
@@ -236,9 +236,9 @@ struct ssh_gss_liblist *ssh_gss_setup(Conf *conf, Frontend *frontend) // MPEXT
                                LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
                                LOAD_LIBRARY_SEARCH_USER_DIRS);
         // MPEXT
-        if (!module && frontend) {
+        if (!module && logctx) {
             char *buf = dupprintf("Cannot load GSSAPI from user-specified library '%s': %s", path, win_strerror(GetLastError()));
-            logevent(frontend, buf);
+            logevent(logctx, buf);
             sfree(buf);
         }
     }