diff --git a/src/crypto.c b/src/crypto.c new file mode 100644 index 0000000000000000000000000000000000000000..ebeb1e0f63fa9347985929aaed95f03092331075 --- /dev/null +++ b/src/crypto.c @@ -0,0 +1,18 @@ +/* crypto.c + * + */ + +#include "crypto.h" + +static void do_crypt_none(struct crypto_instance *ignored, + UINT32 length, UINT8 *dst, UINT8 *src) +{ + if (src != dst) + memcpy(dst, src, length); +} + +struct crypto_instance crypto_none_instance = +{ + 8, + do_crypt_none +}; diff --git a/src/crypto.h b/src/crypto.h new file mode 100644 index 0000000000000000000000000000000000000000..f679d0ebab736127aee02c702b0c1d6adff1eae0 --- /dev/null +++ b/src/crypto.h @@ -0,0 +1,12 @@ +/* crypto.h + * + */ + +#ifndef LSH_CRYPTO_H_INCLUDED +#define LSH_CRYPTO_H_INCLUDED + +#include "abstract_crypto.h" + +struct crypto_instance crypto_none_instance; + +#endif diff --git a/src/lshd.c b/src/lshd.c new file mode 100644 index 0000000000000000000000000000000000000000..32bbfba470d0fb403a2dc6626c31d0c96c229420 --- /dev/null +++ b/src/lshd.c @@ -0,0 +1,71 @@ +/* lshd.c + * + * main server program. + */ + +#include <getopt.h> + +#include "io.h" +#include "werror.h" +#include "server.h" + +/* Global variable */ +struct io_backend backend; + +void usage() NORETURN; + +void usage() +{ + exit(1); +} + +int main(int argc, char **argv) +{ + char *port = "ssh"; + int verbose; + int option; + + /* For filtering messages. Could perhaps also be used when converting + * strings to and from UTF8. */ + setlocale(LC_CTYPE, ""); + + while((option = getopt(argc, argv, "dp:q")) != -1) + switch(option) + { + case 'p': + port = optarg; + break; + case 'q': + quiet_flag = 1; + break; + case 'd': + debug_flag = 1; + break; + default: + usage(); + } + + if ( (argc - optind) != 0) + usage(); + + if (!get_inaddr(&remote, NULL, port, "tcp")) + { + fprintf(stderr, "No such host or service"); + exit(1); + } + + { + struct server_callback connected = { + { (fd_callback_f) server_initiate }, + &backend, + BLOCK_SIZE; + }; + + io_connect(&backend, &remote, NULL, + make_client_callback(backend, BLOCK_SIZE)); + } + + io_run(); + + return 0; +} diff --git a/src/session.c b/src/session.c new file mode 100644 index 0000000000000000000000000000000000000000..e34ad988885c655a22fa5905c1d2bb849f426eb1 --- /dev/null +++ b/src/session.c @@ -0,0 +1,16 @@ +/* session.c + * + */ + +#include "session.h" + +struct session *ssh_session_alloc() +{ + struct ssh_session *session = xalloc(sizeof(struct ssh_session)); + + memset(session, 0, sizeof(struct ssh_Session)); + + session->max_packet = 0x8000; + + return session; +}