OBJ=obj
RES=res
+##-- objects putty puttytel
+GOBJS1 = window.$(OBJ) windlg.$(OBJ) terminal.$(OBJ) telnet.$(OBJ) raw.$(OBJ)
+GOBJS2 = xlat.$(OBJ) ldisc.$(OBJ) sizetip.$(OBJ)
##-- objects putty
-POBJS1 = window.$(OBJ) windlg.$(OBJ) terminal.$(OBJ) telnet.$(OBJ) raw.$(OBJ)
-POBJS2 = xlat.$(OBJ) ldisc.$(OBJ) sizetip.$(OBJ) ssh.$(OBJ)
+POBJS = ssh.$(OBJ) be_all.$(OBJ)
+##-- objects puttytel
+TOBJS = be_nossh.$(OBJ)
##-- objects pscp
-SOBJS = scp.$(OBJ) windlg.$(OBJ) scpssh.$(OBJ)
+SOBJS = scp.$(OBJ) windlg.$(OBJ) scpssh.$(OBJ) be_none.$(OBJ)
+##-- objects putty puttytel pscp
+MOBJS = misc.$(OBJ) version.$(OBJ)
##-- objects putty pscp
-OBJS1 = misc.$(OBJ) noise.$(OBJ)
-OBJS2 = sshcrc.$(OBJ) sshdes.$(OBJ) sshmd5.$(OBJ) sshrsa.$(OBJ) sshrand.$(OBJ)
-OBJS3 = sshsha.$(OBJ) sshblowf.$(OBJ) version.$(OBJ)
+OBJS1 = sshcrc.$(OBJ) sshdes.$(OBJ) sshmd5.$(OBJ) sshrsa.$(OBJ) sshrand.$(OBJ)
+OBJS2 = sshsha.$(OBJ) sshblowf.$(OBJ) noise.$(OBJ)
##-- resources putty
PRESRC = win_res.$(RES)
+##-- resources puttytel
+TRESRC = nossh_res.$(RES)
##-- resources pscp
SRESRC = scp.$(RES)
##--
##-- gui-apps
# putty
+# puttytel
##-- console-apps
# pscp
##--
LIBS1 = advapi32.lib user32.lib gdi32.lib
LIBS2 = wsock32.lib comctl32.lib comdlg32.lib
-all: putty.exe pscp.exe
-
-putty.exe: $(POBJS1) $(POBJS2) $(OBJS1) $(OBJS2) $(OBJS3) $(PRESRC) link.rsp
- link /debug -out:putty.exe @link.rsp
-
-pscp.exe: $(SOBJS) $(OBJS1) $(OBJS2) $(OBJS3) $(SRESRC) scp.rsp
- link /debug -out:pscp.exe @scp.rsp
-
-link.rsp: makefile
- echo /nologo /subsystem:windows > link.rsp
- echo $(POBJS1) >> link.rsp
- echo $(POBJS2) >> link.rsp
- echo $(OBJS1) >> link.rsp
- echo $(OBJS2) >> link.rsp
- echo $(OBJS3) >> link.rsp
- echo $(PRESRC) >> link.rsp
- echo $(LIBS1) >> link.rsp
- echo $(LIBS2) >> link.rsp
-
-scp.rsp: makefile
- echo /nologo /subsystem:console > scp.rsp
- echo $(SOBJS) >> scp.rsp
- echo $(OBJS1) >> scp.rsp
- echo $(OBJS2) >> scp.rsp
- echo $(OBJS3) >> scp.rsp
- echo $(SRESRC) >> scp.rsp
- echo $(LIBS1) >> scp.rsp
- echo $(LIBS2) >> scp.rsp
+all: putty.exe puttytel.exe pscp.exe
+
+putty.exe: $(GOBJS1) $(GOBJS2) $(POBJS) $(MOBJS) $(OBJS1) $(OBJS2) $(PRESRC) putty.rsp
+ link /debug -out:putty.exe @putty.rsp
+
+puttytel.exe: $(GOBJS1) $(GOBJS2) $(TOBJS) $(MOBJS) $(PRESRC) puttytel.rsp
+ link /debug -out:puttytel.exe @puttytel.rsp
+
+pscp.exe: $(SOBJS) $(OBJS1) $(OBJS2) $(OBJS3) $(SRESRC) pscp.rsp
+ link /debug -out:pscp.exe @pscp.rsp
+
+putty.rsp: makefile
+ echo /nologo /subsystem:windows > putty.rsp
+ echo $(GOBJS1) >> putty.rsp
+ echo $(GOBJS2) >> putty.rsp
+ echo $(POBJS) >> putty.rsp
+ echo $(MOBJS) >> putty.rsp
+ echo $(OBJS1) >> putty.rsp
+ echo $(OBJS2) >> putty.rsp
+ echo $(PRESRC) >> putty.rsp
+ echo $(LIBS1) >> putty.rsp
+ echo $(LIBS2) >> putty.rsp
+
+puttytel.rsp: makefile
+ echo /nologo /subsystem:windows > puttytel.rsp
+ echo $(GOBJS1) >> puttytel.rsp
+ echo $(GOBJS2) >> puttytel.rsp
+ echo $(TOBJS) >> puttytel.rsp
+ echo $(MOBJS) >> puttytel.rsp
+ echo $(TRESRC) >> puttytel.rsp
+ echo $(LIBS1) >> puttytel.rsp
+ echo $(LIBS2) >> puttytel.rsp
+
+pscp.rsp: makefile
+ echo /nologo /subsystem:console > pscp.rsp
+ echo $(SOBJS) >> pscp.rsp
+ echo $(MOBJS) >> pscp.rsp
+ echo $(OBJS1) >> pscp.rsp
+ echo $(OBJS2) >> pscp.rsp
+ echo $(SRESRC) >> pscp.rsp
+ echo $(LIBS1) >> pscp.rsp
+ echo $(LIBS2) >> pscp.rsp
##-- dependencies
window.$(OBJ): window.c putty.h win_res.h
scp.$(OBJ): scp.c putty.h scp.h
scpssh.$(OBJ): scpssh.c putty.h ssh.h scp.h
version.$(OBJ): version.c
+be_all.$(OBJ): be_all.c
+be_nossh.$(OBJ): be_nossh.c
+be_none.$(OBJ): be_none.c
##--
# Hack to force version.obj to be rebuilt always
rc $(FWHACK) $(RCFL) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 win_res.rc
##-- dependencies
+nossh_res.$(RES): nossh_res.rc win_res.h putty.ico
+##--
+nossh_res.$(RES):
+ rc $(FWHACK) $(RCFL) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 nossh_res.rc
+
+##-- dependencies
scp.$(RES): scp.rc scp.ico
##--
scp.$(RES):
--- /dev/null
+/*
+ * Linking module for PuTTY proper: list the available backends
+ * including ssh.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include "putty.h"
+
+struct backend_list backends[] = {
+ {PROT_SSH, "ssh", &ssh_backend},
+ {PROT_TELNET, "telnet", &telnet_backend},
+ {PROT_RAW, "raw", &raw_backend},
+ {0, NULL}
+};
--- /dev/null
+/*
+ * Linking module for PSCP: list no available backends. This is
+ * only present to satisfy linker requirements. I should really
+ * untangle the whole lot a bit better.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include "putty.h"
+
+struct backend_list backends[] = {
+ {0, NULL}
+};
--- /dev/null
+/*
+ * Linking module for PuTTYtel: list the available backends not
+ * including ssh.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include "putty.h"
+
+struct backend_list backends[] = {
+ {PROT_TELNET, "telnet", &telnet_backend},
+ {PROT_RAW, "raw", &raw_backend},
+ {0, NULL}
+};
+
+/*
+ * Stub implementations of functions not used in non-ssh versions.
+ */
+void random_save_seed(void) {
+}
+
+void noise_ultralight(DWORD data) {
+}
--- /dev/null
+/* Stub rc file for the PuTTYtel ssh-free binary */
+#define NO_SSH
+#include "win_res.rc"
GLOBAL Backend *back;
+GLOBAL struct backend_list {
+ int protocol;
+ char *name;
+ Backend *backend;
+} backends[];
+
typedef struct {
void (*send) (char *buf, int len);
} Ldisc;
void logevent (char *);
void showeventlog (HWND);
void showabout (HWND);
-void verify_ssh_host_key(char *host, struct RSAKey *key);
+void verify_ssh_host_key(char *host, char *keystr);
void get_sesslist(int allocate);
GLOBAL int nsessions;
if (!rsabuf)
fatalbox("Out of memory");
- verify_ssh_host_key(savedhost, &hostkey);
+ /*
+ * Verify the host key.
+ */
+ {
+ /*
+ * First format the key into a string.
+ */
+ int len = rsastr_len(&hostkey);
+ char *keystr = malloc(len);
+ if (!keystr)
+ fatalbox("Out of memory");
+ rsastr_fmt(keystr, &hostkey);
+ verify_ssh_host_key(savedhost, keystr);
+ free(keystr);
+ }
for (i=0; i<32; i++) {
rsabuf[i] = session_key[i];
if (!rsabuf)
fatalbox("Out of memory");
- verify_ssh_host_key(savedhost, &hostkey);
+ /*
+ * Verify the host key.
+ */
+ {
+ /*
+ * First format the key into a string.
+ */
+ int len = rsastr_len(&hostkey);
+ char *keystr = malloc(len);
+ if (!keystr)
+ fatalbox("Out of memory");
+ rsastr_fmt(keystr, &hostkey);
+ verify_ssh_host_key(savedhost, keystr);
+ free(keystr);
+ }
for (i=0; i<32; i++) {
rsabuf[i] = session_key[i];
RTEXT "Protocol:", IDC0_PROTSTATIC, 3, 29, 52, 8
AUTORADIOBUTTON "&Raw", IDC0_PROTRAW, 61, 29, 33, 10, WS_GROUP
AUTORADIOBUTTON "&Telnet", IDC0_PROTTELNET, 96, 29, 33, 10
+#ifndef NO_SSH
AUTORADIOBUTTON "SS&H", IDC0_PROTSSH, 132, 29, 33, 10
#endif
+#endif
LTEXT "Stor&ed Sessions", IDC0_SESSSTATIC, 3, 40, 122, 8
EDITTEXT IDC0_SESSEDIT, 3, 48, 122, 12, ES_AUTOHSCROLL
LISTBOX IDC0_SESSLIST, 3, 63, 122, 81,
if (do_host) {
wpps (sesskey, "HostName", cfg.host);
wppi (sesskey, "PortNumber", cfg.port);
- wpps (sesskey, "Protocol",
- cfg.protocol == PROT_SSH ? "ssh" :
- cfg.protocol == PROT_TELNET ? "telnet" : "raw" );
+ p = "raw";
+ for (i = 0; backends[i].backend != NULL; i++)
+ if (backends[i].protocol == cfg.protocol) {
+ p = backends[i].name;
+ break;
+ }
+ wpps (sesskey, "Protocol", p);
}
wppi (sesskey, "CloseOnExit", !!cfg.close_on_exit);
wppi (sesskey, "WarnOnClose", !!cfg.warn_on_close);
gpps (sesskey, "HostName", "", cfg.host, sizeof(cfg.host));
gppi (sesskey, "PortNumber", default_port, &cfg.port);
+
gpps (sesskey, "Protocol", "default", prot, 10);
- if (!strcmp(prot, "ssh"))
- cfg.protocol = PROT_SSH;
- else if (!strcmp(prot, "telnet"))
- cfg.protocol = PROT_TELNET;
- else if (!strcmp(prot, "raw"))
- cfg.protocol = PROT_RAW;
- else
- cfg.protocol = default_protocol;
+ cfg.protocol = default_protocol;
+ for (i = 0; backends[i].backend != NULL; i++)
+ if (!strcmp(prot, backends[i].name)) {
+ cfg.protocol = backends[i].protocol;
+ break;
+ }
gppi (sesskey, "CloseOnExit", 1, &cfg.close_on_exit);
gppi (sesskey, "WarnOnClose", 1, &cfg.warn_on_close);
}
}
-void verify_ssh_host_key(char *host, struct RSAKey *key) {
- char *keystr, *otherstr, *mungedhost;
+void verify_ssh_host_key(char *host, char *keystr) {
+ char *otherstr, *mungedhost;
int len;
HKEY rkey;
- /*
- * Format the key into a string.
- */
- len = rsastr_len(key);
- keystr = malloc(len);
- if (!keystr)
- fatalbox("Out of memory");
- rsastr_fmt(keystr, key);
+ len = 1 + strlen(keystr);
/*
* Now read a saved key in from the registry and see what it
}
}
- back = (cfg.protocol == PROT_SSH ? &ssh_backend :
- cfg.protocol == PROT_TELNET ? &telnet_backend :
- &raw_backend);
+ /*
+ * Select protocol. This is farmed out into a table in a
+ * separate file to enable an ssh-free variant.
+ */
+ {
+ int i;
+ back = NULL;
+ for (i = 0; backends[i].backend != NULL; i++)
+ if (backends[i].protocol == cfg.protocol) {
+ back = backends[i].backend;
+ break;
+ }
+ if (back == NULL) {
+ MessageBox(NULL, "Unsupported protocol number found",
+ "PuTTY Internal Error", MB_OK | MB_ICONEXCLAMATION);
+ WSACleanup();
+ return 1;
+ }
+ }
ldisc = (cfg.ldisc_term ? &ldisc_term : &ldisc_simple);