Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Colin's const-fixing Patch Of Death. Seems to build fine on Windows as well as Unix, so it can go in. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
c9f194519298d736657c2893d00b3cb0 |
| User & Date: | simon 2003-05-04 09:18:18.000 |
Context
|
2003-05-06
| ||
| 03:43 | Update to use -title rather than -T check-in: 3d5f4bd15e user: owen tags: trunk | |
|
2003-05-04
| ||
| 09:18 | Colin's const-fixing Patch Of Death. Seems to build fine on Windows as well as Unix, so it can go in. check-in: c9f1945192 user: simon tags: trunk | |
| 09:14 | Colin's and my fixes to connection_fatal(). check-in: 1bf6f94877 user: simon tags: trunk | |
Changes
Changes to console.c.
| ︙ | ︙ | |||
266 267 268 269 270 271 272 |
}
void console_provide_logctx(void *logctx)
{
console_logctx = logctx;
}
| | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
}
void console_provide_logctx(void *logctx)
{
console_logctx = logctx;
}
void logevent(void *frontend, const char *string)
{
if (console_logctx)
log_eventlog(console_logctx, string);
}
int console_get_line(const char *prompt, char *str,
int maxlen, int is_pw)
|
| ︙ | ︙ |
Changes to logging.c.
| ︙ | ︙ | |||
39 40 41 42 43 44 45 | * also as convenient a place as any to put the output of Event Log * entries to stderr when a command-line tool is in verbose mode. * (In particular, this is a better place to put it than in the * front ends, because it only has to be done once for all * platforms. Platforms which don't have a meaningful stderr can * just avoid defining FLAG_STDERR. */ | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
* also as convenient a place as any to put the output of Event Log
* entries to stderr when a command-line tool is in verbose mode.
* (In particular, this is a better place to put it than in the
* front ends, because it only has to be done once for all
* platforms. Platforms which don't have a meaningful stderr can
* just avoid defining FLAG_STDERR.
*/
void log_eventlog(void *handle, const char *event)
{
struct LogContext *ctx = (struct LogContext *)handle;
if ((flags & FLAG_STDERR) && (flags & FLAG_VERBOSE)) {
fprintf(stderr, "%s\n", event);
fflush(stderr);
}
if (ctx->cfg.logtype != LGTYP_PACKETS)
|
| ︙ | ︙ |
Changes to mac/macevlog.c.
|
| | | 1 2 3 4 5 6 7 8 | /* $Id: macevlog.c 3162 2003-05-04 14:18:18Z simon $ */ /* * Copyright (c) 2003 Ben Harris * All rights reserved. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without |
| ︙ | ︙ | |||
97 98 99 100 101 102 103 |
LDispose(s->eventlog);
if (s->eventlog_window != NULL) {
sfree((WinInfo *)GetWRefCon(s->eventlog_window));
DisposeWindow(s->eventlog_window);
}
}
| | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
LDispose(s->eventlog);
if (s->eventlog_window != NULL) {
sfree((WinInfo *)GetWRefCon(s->eventlog_window));
DisposeWindow(s->eventlog_window);
}
}
void logevent(void *frontend, const char *str)
{
Session *s = frontend;
ListBounds bounds, visible;
Cell cell = { 0, 0 };
if (s->eventlog == NULL)
mac_createeventlog(s);
|
| ︙ | ︙ |
Changes to mac/macnet.c.
| ︙ | ︙ | |||
140 141 142 143 144 145 146 |
{
if (stack != NULL)
return stack->newlistener(srcaddr, port, plug, local_host_only);
return NULL;
}
| | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
{
if (stack != NULL)
return stack->newlistener(srcaddr, port, plug, local_host_only);
return NULL;
}
const char *sk_addr_error(SockAddr addr)
{
if (stack != NULL)
return stack->addr_error(addr);
return "No TCP/IP stack installed";
}
|
| ︙ | ︙ |
Changes to mac/macterm.c.
|
| | | 1 2 3 4 5 6 7 8 | /* $Id: macterm.c 3162 2003-05-04 14:18:18Z simon $ */ /* * Copyright (c) 1999 Simon Tatham * Copyright (c) 1999, 2002 Ben Harris * All rights reserved. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation |
| ︙ | ︙ | |||
101 102 103 104 105 106 107 |
static void mac_closeterm(WindowPtr);
void pre_paint(Session *s);
void post_paint(Session *s);
void mac_startsession(Session *s)
{
| | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
static void mac_closeterm(WindowPtr);
void pre_paint(Session *s);
void post_paint(Session *s);
void mac_startsession(Session *s)
{
const char *errmsg;
int i;
WinInfo *wi;
init_ucs(s);
/*
* Select protocol. This is farmed out into a table in a
|
| ︙ | ︙ |
Changes to mac/mtcpnet.c.
| ︙ | ︙ | |||
213 214 215 216 217 218 219 | static Plug mactcp_plug(Socket, Plug); static void mactcp_flush(Socket); static void mactcp_close(Socket); static int mactcp_write(Socket, char const *, int); static int mactcp_write_oob(Socket, char const*, int); static void mactcp_set_private_ptr(Socket, void *); static void *mactcp_get_private_ptr(Socket); | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | static Plug mactcp_plug(Socket, Plug); static void mactcp_flush(Socket); static void mactcp_close(Socket); static int mactcp_write(Socket, char const *, int); static int mactcp_write_oob(Socket, char const*, int); static void mactcp_set_private_ptr(Socket, void *); static void *mactcp_get_private_ptr(Socket); static const char *mactcp_socket_error(Socket); static void mactcp_set_frozen(Socket, int); static void mactcp_recv(Actual_Socket s, size_t len); /* * Initialise MacTCP. * This should be called once before any TCP connection is opened. |
| ︙ | ︙ | |||
710 711 712 713 714 715 716 |
return "Out of memory";
default:
sprintf(buf, "Unknown DNR error %d", addr->hostinfo.rtnCode);
return buf;
}
}
| | | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 |
return "Out of memory";
default:
sprintf(buf, "Unknown DNR error %d", addr->hostinfo.rtnCode);
return buf;
}
}
static const char *mactcp_socket_error(Socket sock)
{
static char buf[64];
Actual_Socket s = (Actual_Socket) sock;
switch (s->err) {
case noErr:
return NULL;
|
| ︙ | ︙ |
Changes to mac/otnet.c.
| ︙ | ︙ | |||
181 182 183 184 185 186 187 | static void ot_tcp_close(Socket s); static int ot_tcp_write(Socket s, char const *data, int len); static int ot_tcp_write_oob(Socket s, char const *data, int len); static void ot_tcp_set_private_ptr(Socket s, void *ptr); static void *ot_tcp_get_private_ptr(Socket s); static void ot_tcp_set_frozen(Socket s, int is_frozen); | | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
static void ot_tcp_close(Socket s);
static int ot_tcp_write(Socket s, char const *data, int len);
static int ot_tcp_write_oob(Socket s, char const *data, int len);
static void ot_tcp_set_private_ptr(Socket s, void *ptr);
static void *ot_tcp_get_private_ptr(Socket s);
static void ot_tcp_set_frozen(Socket s, int is_frozen);
static const char *ot_tcp_socket_error(Socket s);
static void ot_recv(Actual_Socket s);
void ot_poll(void);
Socket ot_register(void *sock, Plug plug)
{
static struct socket_function_table fn_table = {
ot_tcp_plug,
|
| ︙ | ︙ | |||
416 417 418 419 420 421 422 |
static char buf[128];
if (addr->error == kOTNoError)
return NULL;
sprintf(buf, "error %d", addr->error);
return buf;
}
| | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
static char buf[128];
if (addr->error == kOTNoError)
return NULL;
sprintf(buf, "error %d", addr->error);
return buf;
}
static const char *ot_tcp_socket_error(Socket sock)
{
Actual_Socket s = (Actual_Socket) sock;
static char buf[128];
if (s->error == kOTNoError)
return NULL;
sprintf(buf, "error %d", s->error);
|
| ︙ | ︙ |
Changes to network.h.
| ︙ | ︙ | |||
34 35 36 37 38 39 40 |
int (*write) (Socket s, const char *data, int len);
int (*write_oob) (Socket s, const char *data, int len);
void (*flush) (Socket s);
void (*set_private_ptr) (Socket s, void *ptr);
void *(*get_private_ptr) (Socket s);
void (*set_frozen) (Socket s, int is_frozen);
/* ignored by tcp, but vital for ssl */
| | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
int (*write) (Socket s, const char *data, int len);
int (*write_oob) (Socket s, const char *data, int len);
void (*flush) (Socket s);
void (*set_private_ptr) (Socket s, void *ptr);
void *(*get_private_ptr) (Socket s);
void (*set_frozen) (Socket s, int is_frozen);
/* ignored by tcp, but vital for ssl */
const char *(*socket_error) (Socket s);
};
struct plug_function_table {
int (*closing)
(Plug p, const char *error_msg, int error_code, int calling_back);
/* error_msg is NULL iff it is not an error (ie it closed normally) */
/* calling_back != 0 iff there is a Plug function */
/* currently running (would cure the fixme in try_send()) */
int (*receive) (Plug p, int urgent, char *data, int len);
/*
* - urgent==0. `data' points to `len' bytes of perfectly
* ordinary data.
|
| ︙ | ︙ | |||
126 127 128 129 130 131 132 | #define sk_get_private_ptr(s) (((*s)->get_private_ptr) (s)) /* * Special error values are returned from sk_namelookup and sk_new * if there's a problem. These functions extract an error message, * or return NULL if there's no problem. */ | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | #define sk_get_private_ptr(s) (((*s)->get_private_ptr) (s)) /* * Special error values are returned from sk_namelookup and sk_new * if there's a problem. These functions extract an error message, * or return NULL if there's no problem. */ const char *sk_addr_error(SockAddr addr); #define sk_socket_error(s) (((*s)->socket_error) (s)) /* * Set the `frozen' flag on a socket. A frozen socket is one in * which all READABLE notifications are ignored, so that data is * not accepted from the peer until the socket is unfrozen. This * exists for two purposes: |
| ︙ | ︙ |
Changes to plink.c.
| ︙ | ︙ | |||
554 555 556 557 558 559 560 |
sk_init();
/*
* Start up the connection.
*/
netevent = CreateEvent(NULL, FALSE, FALSE, NULL);
{
| | | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 |
sk_init();
/*
* Start up the connection.
*/
netevent = CreateEvent(NULL, FALSE, FALSE, NULL);
{
const char *error;
char *realhost;
/* nodelay is only useful if stdin is a character device (console) */
int nodelay = cfg.tcp_nodelay &&
(GetFileType(GetStdHandle(STD_INPUT_HANDLE)) == FILE_TYPE_CHAR);
error = back->init(NULL, &backhandle, &cfg, cfg.host, cfg.port,
&realhost, nodelay);
|
| ︙ | ︙ |
Changes to portfwd.c.
| ︙ | ︙ | |||
82 83 84 85 86 87 88 |
* we may have to temporarily hold some in a dynamically
* allocated buffer here.
*/
void *buffer;
int buflen;
};
| | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
* we may have to temporarily hold some in a dynamically
* allocated buffer here.
*/
void *buffer;
int buflen;
};
static int pfd_closing(Plug plug, const char *error_msg, int error_code,
int calling_back)
{
struct PFwdPrivate *pr = (struct PFwdPrivate *) plug;
/*
* We have no way to communicate down the forwarded connection,
* so if an error occurred on the socket, we just ignore it
|
| ︙ | ︙ | |||
327 328 329 330 331 332 333 |
if (pr->c)
sshfwd_unthrottle(pr->c, bufsize);
}
/*
* Called when receiving a PORT OPEN from the server
*/
| | | > | | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
if (pr->c)
sshfwd_unthrottle(pr->c, bufsize);
}
/*
* Called when receiving a PORT OPEN from the server
*/
const char *pfd_newconnect(Socket *s, char *hostname, int port,
void *c, const Config *cfg)
{
static const struct plug_function_table fn_table = {
pfd_closing,
pfd_receive,
pfd_sent,
NULL
};
SockAddr addr;
const char *err;
char *dummy_realhost;
struct PFwdPrivate *pr;
/*
* Try to find host.
*/
addr = name_lookup(hostname, port, &dummy_realhost, cfg);
if ((err = sk_addr_error(addr)) != NULL)
|
| ︙ | ︙ | |||
386 387 388 389 390 391 392 |
pfd_closing,
pfd_receive,
pfd_sent,
NULL
};
struct PFwdPrivate *pr, *org;
Socket s;
| | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
pfd_closing,
pfd_receive,
pfd_sent,
NULL
};
struct PFwdPrivate *pr, *org;
Socket s;
const char *err;
org = (struct PFwdPrivate *)p;
pr = snew(struct PFwdPrivate);
pr->buffer = NULL;
pr->fn = &fn_table;
pr->c = NULL;
|
| ︙ | ︙ | |||
433 434 435 436 437 438 439 |
return 0;
}
/* Add a new forwarding from port -> desthost:destport
sets up a listener on the local machine on (srcaddr:)port
*/
| | | | | 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
return 0;
}
/* Add a new forwarding from port -> desthost:destport
sets up a listener on the local machine on (srcaddr:)port
*/
const char *pfd_addforward(char *desthost, int destport, char *srcaddr,
int port, void *backhandle, const Config *cfg)
{
static const struct plug_function_table fn_table = {
pfd_closing,
pfd_receive, /* should not happen... */
pfd_sent, /* also should not happen */
pfd_accepting
};
const char *err;
struct PFwdPrivate *pr;
Socket s;
/*
* Open socket.
*/
pr = snew(struct PFwdPrivate);
|
| ︙ | ︙ |
Changes to proxy.c.
| ︙ | ︙ | |||
169 170 171 172 173 174 175 |
*/
if (ps->freeze) return;
}
sk_set_frozen(ps->sub_socket, is_frozen);
}
| | | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
*/
if (ps->freeze) return;
}
sk_set_frozen(ps->sub_socket, is_frozen);
}
static const char * sk_proxy_socket_error (Socket s)
{
Proxy_Socket ps = (Proxy_Socket) s;
if (ps->error != NULL || ps->sub_socket == NULL) {
return ps->error;
}
return sk_socket_error(ps->sub_socket);
}
/* basic proxy plug functions */
static int plug_proxy_closing (Plug p, const char *error_msg,
int error_code, int calling_back)
{
Proxy_Plug pp = (Proxy_Plug) p;
Proxy_Socket ps = pp->proxy_socket;
if (ps->state != PROXY_STATE_ACTIVE) {
ps->closing_error_msg = error_msg;
|
| ︙ | ︙ | |||
373 374 375 376 377 378 379 |
if (cfg->proxy_type != PROXY_NONE &&
proxy_for_destination(addr, hostname, port, cfg))
{
Proxy_Socket ret;
Proxy_Plug pplug;
SockAddr proxy_addr;
| | | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
if (cfg->proxy_type != PROXY_NONE &&
proxy_for_destination(addr, hostname, port, cfg))
{
Proxy_Socket ret;
Proxy_Plug pplug;
SockAddr proxy_addr;
char *proxy_canonical_name;
ret = snew(struct Socket_proxy_tag);
ret->fn = &socket_fn_table;
ret->cfg = *cfg; /* STRUCTURE COPY */
ret->plug = plug;
ret->remote_addr = addr;
ret->remote_port = port;
|
| ︙ | ︙ | |||
417 418 419 420 421 422 423 | pplug = snew(struct Plug_proxy_tag); pplug->fn = &plug_fn_table; pplug->proxy_socket = ret; /* look-up proxy */ proxy_addr = sk_namelookup(cfg->proxy_host, &proxy_canonical_name); | | | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
pplug = snew(struct Plug_proxy_tag);
pplug->fn = &plug_fn_table;
pplug->proxy_socket = ret;
/* look-up proxy */
proxy_addr = sk_namelookup(cfg->proxy_host,
&proxy_canonical_name);
if (sk_addr_error(proxy_addr) != NULL) {
ret->error = "Proxy error: Unable to resolve proxy host name";
return (Socket)ret;
}
sfree(proxy_canonical_name);
/* create the actual socket we will be using,
* connected to our proxy server and port.
|
| ︙ | ︙ |
Changes to proxy.h.
| ︙ | ︙ | |||
60 61 62 63 64 65 66 |
int (*negotiate) (Proxy_Socket /* this */, int /* change type */);
/* current arguments of plug handlers
* (for use by proxy's negotiate function)
*/
/* closing */
| | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
int (*negotiate) (Proxy_Socket /* this */, int /* change type */);
/* current arguments of plug handlers
* (for use by proxy's negotiate function)
*/
/* closing */
const char *closing_error_msg;
int closing_error_code;
int closing_calling_back;
/* receive */
int receive_urgent;
char *receive_data;
int receive_len;
|
| ︙ | ︙ |
Changes to psftp.c.
| ︙ | ︙ | |||
1687 1688 1689 1690 1691 1692 1693 |
/*
* Connect to a host.
*/
static int psftp_connect(char *userhost, char *user, int portnumber)
{
char *host, *realhost;
| | | 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 |
/*
* Connect to a host.
*/
static int psftp_connect(char *userhost, char *user, int portnumber)
{
char *host, *realhost;
const char *err;
/* Separate host and username */
host = userhost;
host = strrchr(host, '@');
if (host == NULL) {
host = userhost;
} else {
|
| ︙ | ︙ |
Changes to putty.h.
| ︙ | ︙ | |||
262 263 264 265 266 267 268 |
FUNKY_XTERM,
FUNKY_VT400,
FUNKY_VT100P,
FUNKY_SCO
};
struct backend_tag {
| | > | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
FUNKY_XTERM,
FUNKY_VT400,
FUNKY_VT100P,
FUNKY_SCO
};
struct backend_tag {
const char *(*init) (void *frontend_handle, void **backend_handle,
Config *cfg,
char *host, int port, char **realhost, int nodelay);
void (*free) (void *handle);
/* back->reconfig() passes in a replacement configuration. */
void (*reconfig) (void *handle, Config *cfg);
/* back->send() returns the current amount of buffered data. */
int (*send) (void *handle, char *buf, int len);
/* back->sendbuffer() does the same thing but without attempting a send */
int (*sendbuffer) (void *handle);
|
| ︙ | ︙ | |||
639 640 641 642 643 644 645 | */ void *log_init(void *frontend, Config *cfg); void log_free(void *logctx); void log_reconfig(void *logctx, Config *cfg); void logfopen(void *logctx); void logfclose(void *logctx); void logtraffic(void *logctx, unsigned char c, int logmode); | | | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
*/
void *log_init(void *frontend, Config *cfg);
void log_free(void *logctx);
void log_reconfig(void *logctx, Config *cfg);
void logfopen(void *logctx);
void logfclose(void *logctx);
void logtraffic(void *logctx, unsigned char c, int logmode);
void log_eventlog(void *logctx, const char *string);
enum { PKT_INCOMING, PKT_OUTGOING };
void log_packet(void *logctx, int direction, int type,
char *texttype, void *data, int len);
/*
* Exports from testback.c
*/
|
| ︙ | ︙ | |||
774 775 776 777 778 779 780 | const char *wc_error(int value); int wc_match(const char *wildcard, const char *target); int wc_unescape(char *output, const char *wildcard); /* * Exports from windlg.c */ | | | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | const char *wc_error(int value); int wc_match(const char *wildcard, const char *target); int wc_unescape(char *output, const char *wildcard); /* * Exports from windlg.c */ void logevent(void *frontend, const char *); void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype, char *keystr, char *fingerprint); void askcipher(void *frontend, char *ciphername, int cs); int askappend(void *frontend, Filename filename); /* * Exports from console.c (that aren't equivalents to things in |
| ︙ | ︙ |
Changes to raw.c.
| ︙ | ︙ | |||
25 26 27 28 29 30 31 |
static void c_write(Raw raw, char *buf, int len)
{
int backlog = from_backend(raw->frontend, 0, buf, len);
sk_set_frozen(raw->s, backlog > RAW_MAX_BACKLOG);
}
| | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
static void c_write(Raw raw, char *buf, int len)
{
int backlog = from_backend(raw->frontend, 0, buf, len);
sk_set_frozen(raw->s, backlog > RAW_MAX_BACKLOG);
}
static int raw_closing(Plug plug, const char *error_msg, int error_code,
int calling_back)
{
Raw raw = (Raw) plug;
if (raw->s) {
sk_close(raw->s);
raw->s = NULL;
|
| ︙ | ︙ | |||
63 64 65 66 67 68 69 | * Called to set up the raw connection. * * Returns an error message, or NULL on success. * * Also places the canonical host name into `realhost'. It must be * freed by the caller. */ | | | | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
* Called to set up the raw connection.
*
* Returns an error message, or NULL on success.
*
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *raw_init(void *frontend_handle, void **backend_handle,
Config *cfg,
char *host, int port, char **realhost, int nodelay)
{
static const struct plug_function_table fn_table = {
raw_closing,
raw_receive,
raw_sent
};
SockAddr addr;
const char *err;
Raw raw;
raw = snew(struct raw_backend_data);
raw->fn = &fn_table;
raw->s = NULL;
*backend_handle = raw;
|
| ︙ | ︙ |
Changes to rlogin.c.
| ︙ | ︙ | |||
28 29 30 31 32 33 34 |
static void c_write(Rlogin rlogin, char *buf, int len)
{
int backlog = from_backend(rlogin->frontend, 0, buf, len);
sk_set_frozen(rlogin->s, backlog > RLOGIN_MAX_BACKLOG);
}
| | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
static void c_write(Rlogin rlogin, char *buf, int len)
{
int backlog = from_backend(rlogin->frontend, 0, buf, len);
sk_set_frozen(rlogin->s, backlog > RLOGIN_MAX_BACKLOG);
}
static int rlogin_closing(Plug plug, const char *error_msg, int error_code,
int calling_back)
{
Rlogin rlogin = (Rlogin) plug;
if (rlogin->s) {
sk_close(rlogin->s);
rlogin->s = NULL;
}
|
| ︙ | ︙ | |||
93 94 95 96 97 98 99 | * Called to set up the rlogin connection. * * Returns an error message, or NULL on success. * * Also places the canonical host name into `realhost'. It must be * freed by the caller. */ | | | | > | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
* Called to set up the rlogin connection.
*
* Returns an error message, or NULL on success.
*
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *rlogin_init(void *frontend_handle, void **backend_handle,
Config *cfg,
char *host, int port, char **realhost,
int nodelay)
{
static const struct plug_function_table fn_table = {
rlogin_closing,
rlogin_receive,
rlogin_sent
};
SockAddr addr;
const char *err;
Rlogin rlogin;
rlogin = snew(struct rlogin_tag);
rlogin->fn = &fn_table;
rlogin->s = NULL;
rlogin->frontend = frontend_handle;
rlogin->term_width = cfg->width;
|
| ︙ | ︙ |
Changes to scp.c.
| ︙ | ︙ | |||
472 473 474 475 476 477 478 |
}
/*
* Open an SSH connection to user@host and execute cmd.
*/
static void do_cmd(char *host, char *user, char *cmd)
{
| > | | 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
}
/*
* Open an SSH connection to user@host and execute cmd.
*/
static void do_cmd(char *host, char *user, char *cmd)
{
const char *err;
char *realhost;
DWORD namelen;
if (host == NULL || host[0] == '\0')
bump("Empty host name");
/* Try to load settings for this host */
do_defaults(host, &cfg);
|
| ︙ | ︙ |
Changes to ssh.c.
| ︙ | ︙ | |||
658 659 660 661 662 663 664 |
void *agent_response;
int agent_response_len;
};
#define logevent(s) logevent(ssh->frontend, s)
/* logevent, only printf-formatted. */
| | | 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 |
void *agent_response;
int agent_response_len;
};
#define logevent(s) logevent(ssh->frontend, s)
/* logevent, only printf-formatted. */
static void logeventf(Ssh ssh, const char *fmt, ...)
{
va_list ap;
char *buf;
va_start(ap, fmt);
buf = dupvprintf(fmt, ap);
va_end(ap);
|
| ︙ | ︙ | |||
2073 2074 2075 2076 2077 2078 2079 |
if (ssh->version == 2)
bufchain_clear(&c->v.v2.outbuffer);
sfree(c);
}
}
}
| | | 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 |
if (ssh->version == 2)
bufchain_clear(&c->v.v2.outbuffer);
sfree(c);
}
}
}
static int ssh_closing(Plug plug, const char *error_msg, int error_code,
int calling_back)
{
Ssh ssh = (Ssh) plug;
ssh_do_close(ssh);
if (error_msg) {
/* A socket error has occurred. */
logevent(error_msg);
|
| ︙ | ︙ | |||
2116 2117 2118 2119 2120 2121 2122 | /* * Connect to specified host and port. * Returns an error message, or NULL on success. * Also places the canonical host name into `realhost'. It must be * freed by the caller. */ | | | | | 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 |
/*
* Connect to specified host and port.
* Returns an error message, or NULL on success.
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *connect_to_host(Ssh ssh, char *host, int port,
char **realhost, int nodelay)
{
static const struct plug_function_table fn_table = {
ssh_closing,
ssh_receive,
ssh_sent,
NULL
};
SockAddr addr;
const char *err;
ssh->savedhost = snewn(1 + strlen(host), char);
if (!ssh->savedhost)
fatalbox("Out of memory");
strcpy(ssh->savedhost, host);
if (port < 0)
|
| ︙ | ︙ | |||
3524 3525 3526 3527 3528 3529 3530 |
} else if (ssh->pktin.type == SSH1_MSG_PORT_OPEN) {
/* Remote side is trying to open a channel to talk to a
* forwarded port. Give them back a local channel number. */
struct ssh_channel *c;
struct ssh_rportfwd pf;
int hostsize, port;
char host[256], buf[1024];
| | > | 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 |
} else if (ssh->pktin.type == SSH1_MSG_PORT_OPEN) {
/* Remote side is trying to open a channel to talk to a
* forwarded port. Give them back a local channel number. */
struct ssh_channel *c;
struct ssh_rportfwd pf;
int hostsize, port;
char host[256], buf[1024];
char *p, *h;
const char *e;
c = snew(struct ssh_channel);
c->ssh = ssh;
hostsize = GET_32BIT(ssh->pktin.body+4);
for (h = host, p = (char *)(ssh->pktin.body+8);
hostsize != 0; hostsize--) {
if (h+1 < host+sizeof(host))
|
| ︙ | ︙ | |||
5996 5997 5998 5999 6000 6001 6002 |
pf.sport = ssh2_pkt_getuint32(ssh);
ssh2_pkt_getstring(ssh, &peeraddr, &peeraddrlen);
peerport = ssh2_pkt_getuint32(ssh);
realpf = find234(ssh->rportfwds, &pf, NULL);
if (realpf == NULL) {
error = "Remote port is not recognised";
} else {
| | > | > | 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 |
pf.sport = ssh2_pkt_getuint32(ssh);
ssh2_pkt_getstring(ssh, &peeraddr, &peeraddrlen);
peerport = ssh2_pkt_getuint32(ssh);
realpf = find234(ssh->rportfwds, &pf, NULL);
if (realpf == NULL) {
error = "Remote port is not recognised";
} else {
const char *e = pfd_newconnect(&c->u.pfd.s,
realpf->dhost,
realpf->dport, c,
&ssh->cfg);
logeventf(ssh, "Received remote port open request"
" for %s:%d", realpf->dhost, realpf->dport);
if (e != NULL) {
logeventf(ssh, "Port open failed: %s", e);
error = "Port open failed";
} else {
logevent("Forwarded port opened successfully");
|
| ︙ | ︙ | |||
6106 6107 6108 6109 6110 6111 6112 | } /* * Called to set up the connection. * * Returns an error message, or NULL on success. */ | | | | | | 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 |
}
/*
* Called to set up the connection.
*
* Returns an error message, or NULL on success.
*/
static const char *ssh_init(void *frontend_handle, void **backend_handle,
Config *cfg,
char *host, int port, char **realhost, int nodelay)
{
const char *p;
Ssh ssh;
ssh = snew(struct ssh_tag);
ssh->cfg = *cfg; /* STRUCTURE COPY */
ssh->version = 0; /* when not ready yet */
ssh->s = NULL;
ssh->cipher = NULL;
|
| ︙ | ︙ |
Changes to ssh.h.
| ︙ | ︙ | |||
246 247 248 249 250 251 252 | void SHATransform(word32 * digest, word32 * data); #endif int random_byte(void); void random_add_noise(void *noise, int length); void random_add_heavynoise(void *noise, int length); | | | | | | > | | | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | void SHATransform(word32 * digest, word32 * data); #endif int random_byte(void); void random_add_noise(void *noise, int length); void random_add_heavynoise(void *noise, int length); void logevent(void *, const char *); /* Allocate and register a new channel for port forwarding */ void *new_sock_channel(void *handle, Socket s); void ssh_send_port_open(void *channel, char *hostname, int port, char *org); /* Exports from portfwd.c */ extern const char *pfd_newconnect(Socket * s, char *hostname, int port, void *c, const Config *cfg); /* desthost == NULL indicates dynamic (SOCKS) port forwarding */ extern const char *pfd_addforward(char *desthost, int destport, char *srcaddr, int port, void *backhandle, const Config *cfg); extern void pfd_close(Socket s); extern int pfd_send(Socket s, char *data, int len); extern void pfd_confirm(Socket s); extern void pfd_unthrottle(Socket s); extern void pfd_override_throttle(Socket s, int enable); /* Exports from x11fwd.c */ extern const char *x11_init(Socket *, char *, void *, void *, const char *, int, const Config *); extern void x11_close(Socket); extern int x11_send(Socket, char *, int); extern void *x11_invent_auth(char *, int, char *, int, int); extern void x11_free_auth(void *); extern void x11_unthrottle(Socket s); extern void x11_override_throttle(Socket s, int enable); extern int x11_get_screen_number(char *display); |
| ︙ | ︙ |
Changes to telnet.c.
| ︙ | ︙ | |||
627 628 629 630 631 632 633 |
telnet->state = TOP_LEVEL;
}
break;
}
}
}
| | | 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
telnet->state = TOP_LEVEL;
}
break;
}
}
}
static int telnet_closing(Plug plug, const char *error_msg, int error_code,
int calling_back)
{
Telnet telnet = (Telnet) plug;
if (telnet->s) {
sk_close(telnet->s);
telnet->s = NULL;
|
| ︙ | ︙ | |||
667 668 669 670 671 672 673 | * Called to set up the Telnet connection. * * Returns an error message, or NULL on success. * * Also places the canonical host name into `realhost'. It must be * freed by the caller. */ | | | | > | | 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 |
* Called to set up the Telnet connection.
*
* Returns an error message, or NULL on success.
*
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *telnet_init(void *frontend_handle, void **backend_handle,
Config *cfg,
char *host, int port, char **realhost,
int nodelay)
{
static const struct plug_function_table fn_table = {
telnet_closing,
telnet_receive,
telnet_sent
};
SockAddr addr;
const char *err;
Telnet telnet;
telnet = snew(struct telnet_tag);
telnet->fn = &fn_table;
telnet->cfg = *cfg; /* STRUCTURE COPY */
telnet->s = NULL;
telnet->echoing = TRUE;
|
| ︙ | ︙ |
Changes to unix/gtkdlg.c.
| ︙ | ︙ | |||
2716 2717 2718 2719 2720 2721 2722 |
{
struct eventlog_stuff *es;
es = snew(struct eventlog_stuff);
memset(es, 0, sizeof(*es));
return es;
}
| | | 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 |
{
struct eventlog_stuff *es;
es = snew(struct eventlog_stuff);
memset(es, 0, sizeof(*es));
return es;
}
void logevent_dlg(void *estuff, const char *string)
{
struct eventlog_stuff *es = (struct eventlog_stuff *)estuff;
char timebuf[40];
time_t t;
if (es->nevents >= es->negsize) {
|
| ︙ | ︙ |
Changes to unix/pterm.c.
| ︙ | ︙ | |||
162 163 164 165 166 167 168 |
int from_backend(void *frontend, int is_stderr, const char *data, int len)
{
struct gui_data *inst = (struct gui_data *)frontend;
return term_data(inst->term, is_stderr, data, len);
}
| | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
int from_backend(void *frontend, int is_stderr, const char *data, int len)
{
struct gui_data *inst = (struct gui_data *)frontend;
return term_data(inst->term, is_stderr, data, len);
}
void logevent(void *frontend, const char *string)
{
struct gui_data *inst = (struct gui_data *)frontend;
log_eventlog(inst->logctx, string);
logevent_dlg(inst->eventlogstuff, string);
}
|
| ︙ | ︙ | |||
3071 3072 3073 3074 3075 3076 3077 |
uxsel_init();
term_size(inst->term, inst->cfg.height, inst->cfg.width, inst->cfg.savelines);
inst->back = select_backend(&inst->cfg);
{
| | > | 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 |
uxsel_init();
term_size(inst->term, inst->cfg.height, inst->cfg.width, inst->cfg.savelines);
inst->back = select_backend(&inst->cfg);
{
char *realhost;
const char *error;
error = inst->back->init((void *)inst, &inst->backhandle,
&inst->cfg, inst->cfg.host, inst->cfg.port,
&realhost, inst->cfg.tcp_nodelay);
if (error) {
char *msg = dupprintf("Unable to open connection to %s:\n%s",
|
| ︙ | ︙ |
Changes to unix/pty.c.
| ︙ | ︙ | |||
481 482 483 484 485 486 487 | * Called to set up the pty. * * Returns an error message, or NULL on success. * * Also places the canonical host name into `realhost'. It must be * freed by the caller. */ | | | | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
* Called to set up the pty.
*
* Returns an error message, or NULL on success.
*
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *pty_init(void *frontend, void **backend_handle, Config *cfg,
char *host, int port, char **realhost, int nodelay)
{
int slavefd;
pid_t pid, pgrp;
long windowid;
pty_frontend = frontend;
*backend_handle = NULL; /* we can't sensibly use this, sadly */
|
| ︙ | ︙ |
Changes to unix/unix.h.
| ︙ | ︙ | |||
60 61 62 63 64 65 66 | /* Things pterm.c needs from gtkdlg.c */ int do_config_box(const char *title, Config *cfg, int midsession); void fatal_message_box(void *window, char *msg); void about_box(void *window); void *eventlogstuff_new(void); void showeventlog(void *estuff, void *parentwin); | | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
/* Things pterm.c needs from gtkdlg.c */
int do_config_box(const char *title, Config *cfg, int midsession);
void fatal_message_box(void *window, char *msg);
void about_box(void *window);
void *eventlogstuff_new(void);
void showeventlog(void *estuff, void *parentwin);
void logevent_dlg(void *estuff, const char *string);
int reallyclose(void *frontend);
/* Things pterm.c needs from {ptermm,uxputty}.c */
char *make_default_wintitle(char *hostname);
int process_nonoption_arg(char *arg, Config *cfg);
/* pterm.c needs this special function in xkeysym.c */
|
| ︙ | ︙ |
Changes to unix/uxcons.c.
| ︙ | ︙ | |||
254 255 256 257 258 259 260 |
"\n"
"Once the key is loaded into PuTTYgen, you can perform\n"
"this conversion simply by saving it again.\n";
fputs(message, stderr);
}
| | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
"\n"
"Once the key is loaded into PuTTYgen, you can perform\n"
"this conversion simply by saving it again.\n";
fputs(message, stderr);
}
void logevent(void *frontend, const char *string)
{
log_eventlog(logctx, string);
}
int console_get_line(const char *prompt, char *str,
int maxlen, int is_pw)
{
|
| ︙ | ︙ |
Changes to unix/uxnet.c.
| ︙ | ︙ | |||
22 23 24 25 26 27 28 |
#include "tree234.h"
#define ipv4_is_loopback(addr) (inet_netof(addr) == IN_LOOPBACKNET)
struct Socket_tag {
struct socket_function_table *fn;
/* the above variable absolutely *must* be the first in this structure */
| | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
#include "tree234.h"
#define ipv4_is_loopback(addr) (inet_netof(addr) == IN_LOOPBACKNET)
struct Socket_tag {
struct socket_function_table *fn;
/* the above variable absolutely *must* be the first in this structure */
const char *error;
int s;
Plug plug;
void *private_ptr;
bufchain output_data;
int connected;
int writable;
int frozen; /* this causes readability notifications to be ignored */
|
| ︙ | ︙ | |||
52 53 54 55 56 57 58 |
* abstract, Socket no longer means a tcp socket (it could mean
* an ssl socket). So now we must use Actual_Socket when we know
* we are talking about a tcp socket.
*/
typedef struct Socket_tag *Actual_Socket;
struct SockAddr_tag {
| | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
* abstract, Socket no longer means a tcp socket (it could mean
* an ssl socket). So now we must use Actual_Socket when we know
* we are talking about a tcp socket.
*/
typedef struct Socket_tag *Actual_Socket;
struct SockAddr_tag {
const char *error;
/*
* Which address family this address belongs to. AF_INET for
* IPv4; AF_INET6 for IPv6; AF_UNSPEC indicates that name
* resolution has not been done and a simple host name is held
* in this SockAddr structure.
*/
int family;
|
| ︙ | ︙ | |||
111 112 113 114 115 116 117 |
if (sktree) {
for (i = 0; (s = index234(sktree, i)) != NULL; i++) {
close(s->s);
}
}
}
| | | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
if (sktree) {
for (i = 0; (s = index234(sktree, i)) != NULL; i++) {
close(s->s);
}
}
}
const char *error_string(int error)
{
return strerror(error);
}
SockAddr sk_namelookup(const char *host, char **canonicalname)
{
SockAddr ret = snew(struct SockAddr_tag);
|
| ︙ | ︙ | |||
318 319 320 321 322 323 324 | static void sk_tcp_close(Socket s); static int sk_tcp_write(Socket s, const char *data, int len); static int sk_tcp_write_oob(Socket s, const char *data, int len); static void sk_tcp_set_private_ptr(Socket s, void *ptr); static void *sk_tcp_get_private_ptr(Socket s); static void sk_tcp_set_frozen(Socket s, int is_frozen); | | | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
static void sk_tcp_close(Socket s);
static int sk_tcp_write(Socket s, const char *data, int len);
static int sk_tcp_write_oob(Socket s, const char *data, int len);
static void sk_tcp_set_private_ptr(Socket s, void *ptr);
static void *sk_tcp_get_private_ptr(Socket s);
static void sk_tcp_set_frozen(Socket s, int is_frozen);
static const char *sk_tcp_socket_error(Socket s);
static struct socket_function_table tcp_fn_table = {
sk_tcp_plug,
sk_tcp_close,
sk_tcp_write,
sk_tcp_write_oob,
sk_tcp_flush,
|
| ︙ | ︙ | |||
833 834 835 836 837 838 839 |
* can immediately perform an OOB read and get back OOB
* data, which we will send to the back end with
* type==2 (urgent data).
*/
ret = recv(s->s, buf, sizeof(buf), MSG_OOB);
noise_ultralight(ret);
if (ret <= 0) {
| | | | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 |
* can immediately perform an OOB read and get back OOB
* data, which we will send to the back end with
* type==2 (urgent data).
*/
ret = recv(s->s, buf, sizeof(buf), MSG_OOB);
noise_ultralight(ret);
if (ret <= 0) {
const char *str = (ret == 0 ? "Internal networking trouble" :
error_string(errno));
/* We're inside the Unix frontend here, so we know
* that the frontend handle is unnecessary. */
logevent(NULL, str);
fatalbox("%s", str);
} else {
return plug_receive(s->plug, 2, buf, ret);
}
|
| ︙ | ︙ | |||
999 1000 1001 1002 1003 1004 1005 | } /* * Special error values are returned from sk_namelookup and sk_new * if there's a problem. These functions extract an error message, * or return NULL if there's no problem. */ | | | | 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 |
}
/*
* Special error values are returned from sk_namelookup and sk_new
* if there's a problem. These functions extract an error message,
* or return NULL if there's no problem.
*/
const char *sk_addr_error(SockAddr addr)
{
return addr->error;
}
static const char *sk_tcp_socket_error(Socket sock)
{
Actual_Socket s = (Actual_Socket) sock;
return s->error;
}
static void sk_tcp_set_frozen(Socket sock, int is_frozen)
{
|
| ︙ | ︙ |
Changes to unix/uxplink.c.
| ︙ | ︙ | |||
570 571 572 573 574 575 576 |
uxsel_init();
/*
* Start up the connection.
*/
logctx = log_init(NULL, &cfg);
{
| | | 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
uxsel_init();
/*
* Start up the connection.
*/
logctx = log_init(NULL, &cfg);
{
const char *error;
char *realhost;
/* nodelay is only useful if stdin is a terminal device */
int nodelay = cfg.tcp_nodelay && isatty(0);
error = back->init(NULL, &backhandle, &cfg, cfg.host, cfg.port,
&realhost, nodelay);
if (error) {
|
| ︙ | ︙ |
Changes to windlg.c.
| ︙ | ︙ | |||
655 656 657 658 659 660 661 |
if (!ret)
cfg = backup_cfg; /* structure copy */
return ret;
}
| | | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 |
if (!ret)
cfg = backup_cfg; /* structure copy */
return ret;
}
void logevent(void *frontend, const char *string)
{
char timebuf[40];
time_t t;
log_eventlog(logctx, string);
if (nevents >= negsize) {
|
| ︙ | ︙ |
Changes to window.c.
| ︙ | ︙ | |||
632 633 634 635 636 637 638 |
SetScrollInfo(hwnd, SB_VERT, &si, FALSE);
}
/*
* Start up the telnet connection.
*/
{
| | | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 |
SetScrollInfo(hwnd, SB_VERT, &si, FALSE);
}
/*
* Start up the telnet connection.
*/
{
const char *error;
char msg[1024], *title;
char *realhost;
error = back->init(NULL, &backhandle, &cfg,
cfg.host, cfg.port, &realhost, cfg.tcp_nodelay);
back->provide_logctx(backhandle, logctx);
if (error) {
|
| ︙ | ︙ |
Changes to winnet.c.
| ︙ | ︙ | |||
461 462 463 464 465 466 467 | static void sk_tcp_close(Socket s); static int sk_tcp_write(Socket s, const char *data, int len); static int sk_tcp_write_oob(Socket s, const char *data, int len); static void sk_tcp_set_private_ptr(Socket s, void *ptr); static void *sk_tcp_get_private_ptr(Socket s); static void sk_tcp_set_frozen(Socket s, int is_frozen); | | | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
static void sk_tcp_close(Socket s);
static int sk_tcp_write(Socket s, const char *data, int len);
static int sk_tcp_write_oob(Socket s, const char *data, int len);
static void sk_tcp_set_private_ptr(Socket s, void *ptr);
static void *sk_tcp_get_private_ptr(Socket s);
static void sk_tcp_set_frozen(Socket s, int is_frozen);
static const char *sk_tcp_socket_error(Socket s);
extern char *do_select(SOCKET skt, int startup);
Socket sk_register(void *sock, Plug plug)
{
static const struct socket_function_table fn_table = {
sk_tcp_plug,
|
| ︙ | ︙ | |||
1169 1170 1171 1172 1173 1174 1175 | } /* * Special error values are returned from sk_namelookup and sk_new * if there's a problem. These functions extract an error message, * or return NULL if there's no problem. */ | | | | 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 |
}
/*
* Special error values are returned from sk_namelookup and sk_new
* if there's a problem. These functions extract an error message,
* or return NULL if there's no problem.
*/
const char *sk_addr_error(SockAddr addr)
{
return addr->error;
}
static const char *sk_tcp_socket_error(Socket sock)
{
Actual_Socket s = (Actual_Socket) sock;
return s->error;
}
static void sk_tcp_set_frozen(Socket sock, int is_frozen)
{
|
| ︙ | ︙ |
Changes to x11fwd.c.
| ︙ | ︙ | |||
170 171 172 173 174 175 176 |
if (abs(t - tim) > 20*60) /* 20 minute clock skew should be OK */
return "XDM-AUTHORIZATION-1 time stamp was too far out";
}
/* implement other protocols here if ever required */
return NULL;
}
| | | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
if (abs(t - tim) > 20*60) /* 20 minute clock skew should be OK */
return "XDM-AUTHORIZATION-1 time stamp was too far out";
}
/* implement other protocols here if ever required */
return NULL;
}
static int x11_closing(Plug plug, const char *error_msg, int error_code,
int calling_back)
{
struct X11Private *pr = (struct X11Private *) plug;
/*
* We have no way to communicate down the forwarded connection,
* so if an error occurred on the socket, we just ignore it
|
| ︙ | ︙ | |||
228 229 230 231 232 233 234 | /* * Called to set up the raw connection. * * Returns an error message, or NULL on success. * also, fills the SocketsStructure */ | | | > | | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
/*
* Called to set up the raw connection.
*
* Returns an error message, or NULL on success.
* also, fills the SocketsStructure
*/
const char *x11_init(Socket * s, char *display, void *c, void *auth,
const char *peeraddr, int peerport, const Config *cfg)
{
static const struct plug_function_table fn_table = {
x11_closing,
x11_receive,
x11_sent,
NULL
};
SockAddr addr;
int port;
const char *err;
char *dummy_realhost;
char host[128];
int n, displaynum;
struct X11Private *pr;
/*
* Split up display name into host and display-number parts.
*/
|
| ︙ | ︙ |