diff --git a/stubs/no-agent.c b/stubs/no-agent.c new file mode 100644 index 00000000..d4c755e2 --- /dev/null +++ b/stubs/no-agent.c @@ -0,0 +1,11 @@ +#include "putty.h" + +bool agent_exists(void) { return false; } +Socket *agent_connect(Plug *plug) { + return new_error_socket_fmt( + plug, "no actual networking in this application"); +} +void agent_cancel_query(agent_pending_query *pq) {} +agent_pending_query *agent_query( + strbuf *query, void **out, int *outlen, + void (*callback)(void *, void *, int), void *callback_ctx) {return NULL;} diff --git a/stubs/no-callback.c b/stubs/no-callback.c new file mode 100644 index 00000000..6c12f2b7 --- /dev/null +++ b/stubs/no-callback.c @@ -0,0 +1,33 @@ +/* + * Stub version of the callback.c functions. Doesn't let anyone + * _schedule_ a callback (because that would lead them into the false + * assumption that it would actually happen later on), but permits the + * other functions without error, on the grounds that it's well + * defined what they would do if nobody had scheduled any callbacks. + */ + +#include "putty.h" + +void queue_idempotent_callback(struct IdempotentCallback *ic) +{ + unreachable("callbacks are not supported in this application"); +} + +void delete_callbacks_for_context(void *ctx) +{ +} + +void queue_toplevel_callback(toplevel_callback_fn_t fn, void *ctx) +{ + unreachable("callbacks are not supported in this application"); +} + +bool run_toplevel_callbacks(void) +{ + return false; +} + +bool toplevel_callback_pending(void) +{ + return false; +} diff --git a/stubs/no-gss.c b/stubs/no-gss.c index 844a1323..dd0adb6d 100644 --- a/stubs/no-gss.c +++ b/stubs/no-gss.c @@ -6,6 +6,25 @@ #include "putty.h" +#include "ssh/pgssapi.h" +#include "ssh/gss.h" +#include "ssh/gssc.h" + const int ngsslibs = 0; const char *const gsslibnames[1] = { "dummy" }; const struct keyvalwhere gsslibkeywords[1] = { { "dummy", 0, -1, -1 } }; + +struct ssh_gss_liblist *ssh_gss_setup(Conf *conf) +{ + struct ssh_gss_liblist *list = snew(struct ssh_gss_liblist); + + list->libraries = NULL; + list->nlibraries = 0; + return list; +} + +void ssh_gss_cleanup(struct ssh_gss_liblist *list) +{ + sfree(list->libraries); /* I know it's always NULL, but stay consistent */ + sfree(list); +} diff --git a/stubs/no-ldisc.c b/stubs/no-ldisc.c new file mode 100644 index 00000000..a3d115ce --- /dev/null +++ b/stubs/no-ldisc.c @@ -0,0 +1,37 @@ +#include "putty.h" + +struct Ldisc_tag { + int dummy; +}; + +Ldisc *ldisc_create(Conf *conf, Terminal *term, Backend *backend, Seat *seat) +{ + Ldisc *ldisc = snew(Ldisc); + memset(ldisc, 0, sizeof(Ldisc)); + return ldisc; +} + +void ldisc_configure(Ldisc *ldisc, Conf *conf) +{ +} + +void ldisc_free(Ldisc *ldisc) +{ + sfree(ldisc); +} + +void ldisc_echoedit_update(Ldisc *ldisc) +{ +} + +void ldisc_provide_userpass_le(Ldisc *ldisc, TermLineEditor *le) +{ +} + +void ldisc_check_sendok(Ldisc *ldisc) +{ +} + +void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, bool interactive) +{ +} diff --git a/stubs/no-network.c b/stubs/no-network.c new file mode 100644 index 00000000..df97438a --- /dev/null +++ b/stubs/no-network.c @@ -0,0 +1,144 @@ +/* + * Stub version of the whole networking abstraction. + */ + +#include "putty.h" +#include "network.h" + +struct SockAddr { + int dummy; +}; + +void sk_init(void) +{ +} + +void sk_cleanup(void) +{ +} + +SockAddr *sk_namelookup(const char *host, char **canonicalname, + int address_family) +{ + return snew(SockAddr); +} +SockAddr *sk_nonamelookup(const char *host) +{ + return snew(SockAddr); +} + +void sk_getaddr(SockAddr *addr, char *buf, int buflen) +{ + strncpy(buf, "nonsense", buflen); +} + +bool sk_addr_needs_port(SockAddr *addr) +{ + return true; +} + +bool sk_hostname_is_local(const char *name) +{ + return false; +} + +bool sk_address_is_local(SockAddr *addr) +{ + return false; +} + +bool sk_address_is_special_local(SockAddr *addr) +{ + return false; +} + +int sk_addrtype(SockAddr *addr) +{ + return ADDRTYPE_UNSPEC; +} + +void sk_addrcopy(SockAddr *addr, char *buf) +{ +} + +void sk_addr_free(SockAddr *addr) +{ + sfree(addr); +} + +SockAddr *sk_addr_dup(SockAddr *addr) +{ + return snew(SockAddr); +} + +Socket *sk_new(SockAddr *addr, int port, bool privport, bool oobinline, + bool nodelay, bool keepalive, Plug *plug) +{ + return new_error_socket_fmt( + plug, "no actual networking in this application"); +} + +Socket *sk_newlistener(const char *srcaddr, int port, Plug *plug, + bool local_host_only, int orig_address_family) +{ + return new_error_socket_fmt( + plug, "no actual networking in this application"); +} + +void *(sk_getxdmdata)(Socket *sock, int *lenp) +{ + return NULL; +} + +void plug_closing_errno(Plug *plug, int error) +{ + plug_closing(plug, PLUGCLOSE_ERROR, "dummy"); +} + +const char *sk_addr_error(SockAddr *addr) +{ + return "no actual network addresses in this application"; +} + +int net_service_lookup(const char *service) +{ + return 0; +} + +char *get_hostname(void) +{ + return dupstr("dummy-hostname"); +} + +SockAddr *platform_get_x11_unix_address(const char *sockpath, int displaynum) +{ + return snew(SockAddr); +} + +SockAddr *unix_sock_addr(const char *path) +{ + return snew(SockAddr); +} + +SockAddr *sk_namedpipe_addr(const char *pipename) +{ + return snew(SockAddr); +} + +Socket *new_unix_listener(SockAddr *listenaddr, Plug *plug) +{ + return new_error_socket_fmt( + plug, "no actual networking in this application"); +} + +Socket *platform_start_subprocess(const char *cmd, Plug *plug, + const char *prefix) +{ + return new_error_socket_fmt( + plug, "no actual networking in this application"); +} + +#ifdef PUTTY_WINDOWS_PLATFORM_H +void plug_closing_system_error(Plug *plug, DWORD error) {} +void plug_closing_winsock_error(Plug *plug, DWORD error) {} +#endif diff --git a/stubs/no-timing.c b/stubs/no-timing.c index d1a0ef9f..0575fb53 100644 --- a/stubs/no-timing.c +++ b/stubs/no-timing.c @@ -19,3 +19,8 @@ unsigned long schedule_timer(int ticks, timer_fn_t fn, void *ctx) void expire_timer_context(void *ctx) { } + +unsigned long timing_last_clock(void) +{ + return 0; +} diff --git a/unix/stubs/no-uxsel.c b/unix/stubs/no-uxsel.c new file mode 100644 index 00000000..310a8ca3 --- /dev/null +++ b/unix/stubs/no-uxsel.c @@ -0,0 +1,31 @@ +/* + * Stub version of uxsel.c, for test programs. + */ + +#include "putty.h" + +void uxsel_init(void) +{ +} + +void uxsel_set(int fd, int rwx, uxsel_callback_fn callback) +{ +} + +void uxsel_del(int fd) +{ +} + +int next_fd(int *state, int *rwx) +{ + return -1; +} + +int first_fd(int *state, int *rwx) +{ + return -1; +} + +void select_result(int fd, int event) +{ +}