mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 01:18:00 +00:00
Resurrect the test backends.
I've been keeping them up to date with API changes as far as making sure they still _compile_, but today I tried to actually run them, and found that they were making a couple of segfault-inducing mistakes: not filling in their vtable pointer, and not returning a 'realhost' string. Now fixed.
This commit is contained in:
parent
18896b662e
commit
896bcd5068
@ -32,11 +32,8 @@
|
||||
|
||||
#include "putty.h"
|
||||
|
||||
static char *null_init(const BackendVtable *, Seat *, Backend **, LogContext *,
|
||||
Conf *, const char *, int, char **, bool, bool);
|
||||
static char *loop_init(const BackendVtable *, Seat *, Backend **, LogContext *,
|
||||
Conf *, const char *, int, char **, bool, bool);
|
||||
static void null_free(Backend *);
|
||||
static void loop_free(Backend *);
|
||||
static void null_reconfig(Backend *, Conf *);
|
||||
static void null_send(Backend *, const char *, size_t);
|
||||
@ -55,8 +52,8 @@ static void null_unthrottle(Backend *, size_t);
|
||||
static int null_cfg_info(Backend *);
|
||||
|
||||
const BackendVtable null_backend = {
|
||||
.init = null_init,
|
||||
.free = null_free,
|
||||
.init = loop_init,
|
||||
.free = loop_free,
|
||||
.reconfig = null_reconfig,
|
||||
.send = null_send,
|
||||
.sendbuffer = null_sendbuffer,
|
||||
@ -106,17 +103,6 @@ struct loop_state {
|
||||
size_t sendbuffer;
|
||||
};
|
||||
|
||||
static char *null_init(const BackendVtable *vt, Seat *seat,
|
||||
Backend **backend_handle, LogContext *logctx,
|
||||
Conf *conf, const char *host, int port,
|
||||
char **realhost, bool nodelay, bool keepalive) {
|
||||
/* No local authentication phase in this protocol */
|
||||
seat_set_trust_status(seat, false);
|
||||
|
||||
*backend_handle = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *loop_init(const BackendVtable *vt, Seat *seat,
|
||||
Backend **backend_handle, LogContext *logctx,
|
||||
Conf *conf, const char *host, int port,
|
||||
@ -127,15 +113,14 @@ static char *loop_init(const BackendVtable *vt, Seat *seat,
|
||||
seat_set_trust_status(seat, false);
|
||||
|
||||
st->seat = seat;
|
||||
st->backend.vt = vt;
|
||||
*backend_handle = &st->backend;
|
||||
|
||||
*realhost = dupstr(host);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void null_free(Backend *be)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void loop_free(Backend *be)
|
||||
{
|
||||
struct loop_state *st = container_of(be, struct loop_state, backend);
|
||||
|
Loading…
Reference in New Issue
Block a user