Skip to content

Commit f14953d

Browse files
committed
Fix bug in which the SSH-only tools (pscp, psftp) did not honour a
nonstandard port number when loading a saved session. Occurs because those tools include be_none.c which defines no entries in backends[] at all, as a result of which settings.c doesn't recognise the word 'ssh' in the saved session's protocol field and instead sets the protocol to something idiotic - which _then_ means that when pscp.c forces the protocol to PROT_SSH, it also resets the port number as it would when overriding a saved session specifying a protocol other than SSH. The immediate solution is to define a new be_ssh.c citing only ssh_backend, and include that in the SSH-only tools. However, I wonder if a better approach (perhaps when I redesign session loading and saving) would be not to be so clever, and just have all the tools contain a complete list of known protocol names for purposes of understanding what's in the saved session data, and complain if you try to use one they don't know how to actually speak. [originally from svn r9254]
1 parent 13c993d commit f14953d

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Recipe

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ LIBS = advapi32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib
317317
# to proxy.c depending on whether we're crypto-avoidant or not.
318318
BE_ALL = be_all cproxy
319319
BE_NOSSH = be_nossh nocproxy
320-
BE_SSH = be_none cproxy
320+
BE_SSH = be_ssh cproxy
321321
BE_NONE = be_none nocproxy
322322
# More backend sets, with the additional Windows serial-port module.
323323
W_BE_ALL = be_all_s winser cproxy

be_none.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Linking module for programs that do not support selection of backend
3-
* (such as pscp or pterm).
3+
* (such as pterm).
44
*/
55

66
#include <stdio.h>

be_ssh.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Linking module for programs that are restricted to only using SSH
3+
* (pscp and psftp). These do not support selection of backend, but
4+
* must still have a backends[] array mentioning SSH because
5+
* settings.c will want to consult it during session load.
6+
*/
7+
8+
#include <stdio.h>
9+
#include "putty.h"
10+
11+
const int be_default_protocol = PROT_SSH;
12+
13+
Backend *backends[] = {
14+
&ssh_backend,
15+
NULL
16+
};

0 commit comments

Comments
 (0)