2012-07-13 Niels Möller * nettle: Deleted the nettle subdirectory. Always use the installed nettle library, don't look for it in the build tree. * .bootstrap: Deleted all references to the nettle subdirectory. * configure.ac: Deleted --with-system-nettle option, and all setup for using a bundled nettle library. Use a regular AC_CHECK_LIB to check for libhogweed (nettle's public key library). * src/Makefile.in (LOCAL_NETTLE_DEP): Deleted variable, and all uses. (PRE_CPPFLAGS): Deleted nettle_builddir. (PRE_LDFLAGS): Likewise. * Makefile.in (SUBDIRS): Deleted nettle. * src/testsuite/functions.sh (need_tcputils): Deleted function. * src/testsuite/lshd-random-input-test: Use ./tcpconnect, rather than the possibly installed version from tcputils. Don't use need_tcputils. * src/testsuite/lshg-tcpip-local-test: Likewise. * src/testsuite/lshg-tcpip-remote-test: Likewise. * src/testsuite/rapid7-lshd-test: Likewise. * src/testsuite/socks4-test: Likewise. * src/testsuite/socks5-test: Likewise. * src/testsuite/tcpip-local-test: Likewise. * src/testsuite/tcpip-remote-test: Likewise. * src/testsuite/tcpconnect.c (main): Ignore SIGPIPE. Fixes to diagnostic printouts. * src/lsh.c (main_argp_parser): Pass on --hostkey-algorithm and new option --kex-algorithm to lsh-transport. * src/lsh-transport.c (main_argp_parser): Configure key exchange algorithms via algorithm_options. * src/lshd.c (lshd_config_handler): Likewise. 2012-07-12 Niels Möller * src/algorithms.h (class algorithms_options): New attribute kex_algorithms. * src/algorithms.c (default_kex_algorithms): New function. (lookup_kex_algorithm): New function. (list_kex_algorithms): New function. (algorithms_options): Added --kex-algorithm. (init_algorithms_options): Initialize kex_algorithms. (algorithms_argp_parser): Handle --kex-algorithm, and default value. Use list_kex_algorithms for --list-algorithms. * doc/Makefile.in (.nroff.txt): Pass -Tutf8 to groff. 2012-07-10 Niels Möller * src/testsuite/mini-inetd.c (usage): Take a FILE * as argument. Called with stdout in response to --help, and stderr otherwise. * src/testsuite/prgrp-timeout.c: Added missing include of config.h. 2012-07-08 Niels Möller * src/testsuite/Makefile.in (TARGETS): Added tcpconnnect. * src/testsuite/tcpconnect.c: New file. Reimplemented the program with the same name in tcputils. 2012-06-19 Niels Möller * src/transport.c (transport_process_packet): Disconnect on reception of an SSH_MSG_UNIMPLEMENTED message. 2012-02-03 Niels Möller * doc/index.html: Updated to xhtml, and added charset declaration. Added git instructions. * doc/lsh.texinfo: Updated charset declaration. 2011-11-24 Niels Möller * misc/run-tests (test_program): If EMULATOR is set in the environment, and the testprogram is not a script, use EMULATOR to run it. Typical use is EMULATUR=wine. 2011-09-21 Niels Möller * src/Makefile.in (SOURCES): Added pidfile.c. 2011-09-07 Niels Möller * config.guess: Upgraded to current version, timestamp 2011-08-20. Needed to recognize osx (darwin) on x86_64. * config.sub: Upgraded to current version, timestamp 2011-08-23. 2011-09-06 Niels Möller * src/testsuite/Makefile.in (TS_SH): Added gateway-close-test. * src/gateway_channel.c (do_kill_gateway_channel): Arrange for the chained connection to be closed. (do_gateway_channel_event): Start by checking if the chained connection is alive. If it is not, we should only handle the CONFIRM event. * src/testsuite/gateway-close-test: New test case. 2011-09-05 Niels Möller * src/testsuite/gateway-stop-test: Check that the pidfile is deleted (indicating that the process has cleaned up and exited like it should). * src/testsuite/functions.sh (test_result): Use --pid-file option to lsh. Check for existence of file before killing the process. * src/Makefile.in (PIDFILE_SOURCES): Arrange so that both lsh and lshd are linked with pidfile.o. * src/lsh.c (main_options): New option --pid-file. (main): Moved writing of pid to child process. For --pid-file, use make_pid_file_resource. 2011-09-02 Niels Möller * src/.dist_classes: Added pidfile.c.x. * src/.dist_headers: Added pidfile.h. * src/daemon.c (daemon_pidfile): Deleted function. The functionality moved to pidfile.c. * src/lshd.c (main): make_pid_file_resource now also creates the file, so need to call daemon_pidfile. (make_pid_file_resource): Moved to src/pidfile.c (class pid_file_resource): Likewise. (do_kill_pid_file): Likewise. * src/Makefile.in (lshd_SOURCES): Added pidfile.c. * src/pidfile.h: New file. * src/pidfile.c: New file. (make_pid_file_resource): Moved function from lshd.c, and incorporate the writing of the file from daemon.c:daemon_pidfile. (class pid_file_resource): Moved from lshd.c. (do_kill_pid_file): Likewise. * src/testsuite/Makefile.in (TS_SH): Added gateway-stop-test. * src/testsuite/gateway-stop-test: New file. * src/testsuite/functions.sh (spawn_lsh): Check if pid-file exists before trying to kill the process. * src/lsh.c (main): Fixed --stop-gateway. Must read the hello message before we write the stop message. * src/gateway.c (kill_gateway_connection): Deleted loop to close channels. (gateway_packet_handler): When receiving LSH_GATEWAY_STOP message, call ssh_connection_pending_close to close the shared connection after all currently open channels are closed. * src/connection.c (ssh_connection_pending_close): Check channel_count, and kill connection immediately if zero. 2011-05-02 Niels Möller * src/testsuite/serpent-test.c: Updated for correct serpent byte order. 2011-03-28 Niels Möller * src/unix_random.c (random_init): Display errno when locking fails. 2011-03-23 Niels Möller * doc/lsh.texinfo: Fixed "service ssh-userauth" and "service ssh-connection" examples. (Invoking lshd): Reviewed and updated. (Files and environment variables): Likewise. * src/lshd.c (lshd_options): New options --add-port, --add-interface and --no-syslog. (lshd_argp_parser): Implement them. * src/lshd-userauth.c (start_service): Pass on the LSHD_CONNECTION_CONF environment variable. 2011-02-21 Niels Möller * src/lsh.c (parse_forward_arg): Support for optional brackets, to support IPv6 literal addresses. 2011-02-18 Niels Möller * doc/Makefile.in (DISTFILES): Deleted srp-spec.txt, reverting change from 2011-02-10. It is already included, via $(TARGETS). * src/testsuite/Makefile.in (TS_SH): Added ipv4-test and ipv6-test. * src/testsuite/functions.sh (need_ipv6): New function. (LOCALHOST): New variable. Use it in all functions starting the lsh client. (at_connect): Use new --background option to mini-inetd, to improve robustness. * src/testsuite/tcpip-remote-test: Added a sleep call, to let the server side setup the port forwarding before we use it. * src/testsuite/mini-inetd.c (main): New --background option. * src/testsuite/ipv6-test: New file. * src/testsuite/ipv4-test: New file. * src/lshd.c (open_port): More info when getaddrinfo fails. (parse_interface): Allow optional brackets around ip address, needed for IPv6 literal addresses. 2011-02-14 Niels Möller * src/testsuite/x11-3-test: Export DISPLAY before running exec_lsh. * src/testsuite/functions.sh (spawn_xvfb): Use rm -f. 2011-02-10 Niels Möller * doc/Makefile.in (DISTFILES): Added srp-spec.txt, to avoid requiring groff. 2011-01-31 Niels Möller * doc/lsh.texinfo (Server configuration): Describe all config options. * src/lshd-connection.c (main_argp_parser): Warn if shell, exec or subsystem requests are enabled, but session channels are disabled. * src/lshd-userauth.c (main_argp_parser): Add --helper-fd option to the default lshd-connection command line. 2011-01-07 Niels Möller * src/lsh.c (OPT_HOST_DB_UPDATE): Rennamed, from... (OPT_CAPTURE_TO): ...old name. (main_argp_parser): For '-D' option, initialize socks_port. * src/lsh-transport.c (OPT_HOST_DB_UPDATE): Rennamed, from... (OPT_CAPTURE_TO): ...old name. * doc/lsh.texinfo (Hostauth options): Updated --host-db-update (used to be ---captured-to). 2010-12-14 Niels Möller * doc/lsh.texinfo (Gateway options): New node. (Invoking lshg): Deleted node. * src/lsh.c (main_options): Moved gateway options to a new group, and updated the description of -G. Fixed --stop-gateway option. 2010-12-09 Niels Möller * doc/lsh.texinfo (lshd basics): Rewrote node. (srp): Deleted node, and other references to SRP. 2010-11-17 Niels Möller * misc/xenofarm.sh: Copy list of files in $pfx into result package. 2010-11-16 Niels Möller * misc/xenofarm.sh: Improved crude gmp check to look for mpz_getlimbn. (cfgargs): Tweaked order for --with-include-path and --with-lib-path, to put $pfx before /usr/local. 2010-11-15 Niels Möller * misc/xenofarm.sh (dotask): Display the correct status value when the step is skipped. (LIBGMPDIST): Initialize. * src/testsuite/Makefile.in (OTHER_SOURCES): Added getopt.c getopt1.c. (DISTFILES): Added getopt.h. (GETOPT_OBJS): New variable. (prgrp-timeout): Depend on and link with getopt files. (mini-inetd): Likewise. * .bootstrap: Link getopt files to the src/testsuite directory. * misc/xenofarm.sh: If a gmp dist is included in the build package, and gmp is not already installed on the system, install it in $pfx before trying to build lsh. * src/testsuite/mini-inetd.c: Include netinet/in.h, needed for IPPROTO_TCP on FreeBSD. * src/server_x11.c (do_kill_x11_listen_port): Close self->dir, even if lsh_pushd_fd fails. (open_x11_socket): Stop trying higher display numbers if bind fails with an error other then EADDRINUSE. * src/io.c (io_bind_sockaddr): Save and restore errno when returning failure. * src/server.c (service_config_option): Avoid using the non-standard strnlen function; plain strlen is good enough here. 2010-11-14 Niels Möller * src/testsuite/Makefile.in (mini-inetd): Fixed typo with EXEEXT. * src/lshd-connection.c (make_lshd_connection): Warning message for attempt to enable features which were disabled at compile time. 2010-11-13 Niels Möller * src/testsuite/config/lshd-connection.conf: Use new config file options to enable all features. * src/lshd-connection.c (enum tcpforward_type): New enum. (class lshd_connection_config): Added attributes subsystem_config, allow_tcpforward, allow_session, allow_shell, allow_exec, allow_pty, allow_x11. (make_lshd_connection): Make all session and forwarding features configurable. (make_lshd_connection_config): Initialize new atttributes, and link to new lshd_connection_config_parser. (main_options): New command line options: --allow-tcpip-forward, --deny-tcpip-forward, --allow-session, --deny-session, --allow-shell, --deny-shell, --allow-exec, --deny-exec, --subsystem, and --add-subsystem. (CASE_FLAG): New macro. (main_argp_parser): Sanity check configuration at ARGP_KEY_END. Handle new command line options (see above). (lshd_connection_config_options): New list of config file options. (lshd_connection_config_handler): New function. (lshd_connection_config_parser): New config file parser. * src/server_session.c (class subsystem_request): Use service_config to represent subsystems. (quote_argument_length): New function. (quote_argument): New function. (subsystem_command_line): New function. (do_spawn_subsystem): Rewritten to use service_config_lookup and subsystem_command_line. (make_subsystem_handler): Changed argument type to const struct service_config *. * src/lshd-userauth.c (main): Use libexec_dir from the service_config class. (start_service): Propagate environment variable $LSHD_LIBEXEC_DIR. * src/lshd.c (lshd_service_request_handler): Use libexec_dir from the service_config class. * src/server.c (server_lookup_module): Deleted function. (make_service_config): Set libexec_dir, taking environment variable $LSHD_LIBEXEC_DIR into account. (service_config_lookup): Declare argument const. * src/server.h (class service_config): New attribute libexec_dir. 2010-11-12 Niels Möller * src/lshd-userauth.c (main_options): Fixed double ':' in header. (class lshd_userauth_config): Deleted werror_config attribute; this class is already inherited. (make_lshd_userauth_config): Deleted initialization of werror_config attribute. (CASE_FLAG): New macro. (main_argp_parser): Use CASE_FLAG. (lshd_userauth_config_handler): Updated child state initialization to point to inherited werror config. (lshd_userauth_config_handler): Added missing break. (main): Use trace, not werror, for startup message. * src/lshd.c (lshd_config_handler): Added missing break. 2010-11-10 Niels Möller * src/lsh.c (parse_arg_unsigned): New argument with expected terminator. (parse_forward_arg): Return targret address on success. Don't modify the input string, using updated parse_arg_unsigned. Don't use io_lookup_address; names are resolved later. (main_argp_parser): Use make_string. Updated to parse_forward_arg changes. When setting up tcp forwarding, use "" to denote any address, and "localhost" to denote any local addresses. * src/lshd.c (make_lshd_port): Use io_bind_sockaddr. (open_port): Unconditionally set AI_PASSIVE. * src/server_tcpforward.c (make_server_forward): Use tcpforward_listen, replacing calls to make_tcpforward_listen_port and io_listen. * src/client_tcpforward.c (do_forward_local_port): Likewise. * src/socks.c (make_socks_listen_port): Rewritten, analogously to tcpforward_listen, below. (do_make_socks_server): Updated to use new make_socks_listen_port. * src/tcpforward.c (tcpforward_listen): New function, replacing make_tcpforward_listen_port. Does address lookups via io_getaddrinfo, and may bind multiple interfaces using IPv4 or IPv6. Trace message with each bound interface. Call io_listen, not just io_bind_sockaddr. (make_tcpforward_listen_port): Deleted. (class io_connect_state): New ttributes to keep track of list of addresses. (tcpforward_connect_error): Try next address, if available. (tcpforward_connect): Use io_getaddrinfo, and attempt connection to each address on the list. * src/io.c (io_getaddrinfo): New helper function. (io_make_sockaddr): Deleted function. (io_lookup_address): Deleted function. (io_bind_sockaddr): Set IPV6_V6ONLY. Report errors using werror. * src/server_x11.c (do_x11_listen_port_accept): Fixed error message. (open_x11_socket): Use make_string. * src/queue.h (class addr_queue): Deleted unused class. * src/queue.c: Deleted all addr_queue related functions. 2010-11-09 Niels Möller * src/lshd-connection.c (oop_read_service): Use verbose, not werror, for message on EOF. (main): Use trace, not werror, for startup message. * src/lsh-decode-key.c (main_argp_parser): Use make_string. * src/lsh-keygen.c (main_argp_parser): Likewise. * src/srp-gen.c (srp_gen): Likewise. (main_argp_parser): Likewise. * src/testsuite/lshg-tcpip-remote-test: Deleted sleep. * src/testsuite/tcpip-remote-test: Likewise. * src/testsuite/lsh-encrypted-key-test: Reenabled test. 2010-11-08 Niels Möller * src/testsuite/functions.sh (at_connect): Don't use -m flag to mini-inetd. * src/atoms.in: Deleted ssh-userauth and ssh-connection (no longer hardcoded). 2010-11-07 Niels Möller * src/testsuite/functions.sh (LSHD_CONNECTION): Deleted variable. (LSHD_PTY_HELPER): Deleted variable. * src/lshd-userauth.c (main_argp_parser): Use FILE_LSHD_CONNECTION directly, without consulting $LSHD_CONNECTION in the environment. $LSHD_LIBEXEC_DIR is consulted later. (main): Use FILE_LSHD_PTY_HELPER, also without cunsulting environment. * src/lshd.c (lshd_argp_parser): Analogous change to use FILE_LSHD_USERAUTH directly. * src/environ.h.in (ENV_LSHD_CONNECTION): Deleted, LSHD_LIBEXEC_DIR or service option should be sufficient. (ENV_LSHD_PTY_HELPER): Likewise. (ENV_LSHD_USERAUTH): Likewise. 2010-11-03 Niels Möller * src/testsuite/Makefile.in (TS_SH): Added lshd-example-config-test. * src/environ.h.in (FILE_LSHD_CONNECTION): Deleted directory part. (FILE_LSHD_PTY_HELPER): Likewise. * src/lshd.c (lshd_service_request_handler): Fixed error message for bad $LSHD_LIBEEXEC_DIR. Leave unrecognized "$(foo)" in the argument list untouched (previously, skipped the initial "$"). (class server_config): New attributes ports_override_config_file and interfaces_override_config_file. (make_lshd_config): Initialize ports_override_config_file and interfaces_override_config_file. (OPT_NO, OPT_SETSID): Deleted constants. (lshd_options): Added --service and --add-service. (lshd_argp_children): Deleted service_argp. (lshd_argp_parser): Updated child init in ARGP_KEY_INIT. Set ports_override_config_file and interfaces_override_config_file if the corresponding option occurs on the command line. Handle --service and --add-service. (lshd_config_options): Added config option "service". (lshd_config_handler): Fixed child initialization. Check ports_override_config_file and interfaces_override_config_file. Handle "service" option. * src/lshd-userauth.c (handle_userauth): Use service_config_lookup, instead of hard-coding ssh-connection. Changed return type to return struct service_entry pointer. (main_options): Added --service and --add-service. (class server_config): Added service_config atttribute. (make_lshd_userauth_config): Call make_service_config. (main_argp_parser): Setup default service in ARGP_KEY_END case. Handle --service and --add-service. (lshd_userauth_config_options): New config option "service". (lshd_userauth_config_handler): Handle service option. (main): Take environment variable LSHD_LIBEXEC_DIR and compiled in LIBEXECDIR into account when interpreting the name of the hepler program and the service program. Use the service_entry returned from handle_userauth. Expand "$(helper_fd)" in the argument list, and spawn the helper program only if this expansion is used. * src/xalloc.h (lsh_space_free) [!DEBUG_ALLOC]: Defined to lsh_free rather then free, to avoid warnings when freeing const pointers. * src/server.c (service_config_lookup): Renamed and updated callers, from... (server_lookup_service): ... old name. (service_config_argp): New function, doing the main work for an argp service parser, without being one. (service_config_option): New function, analogous but for config file parsing. (service_argp): Deleted argp parser. (service_config_parser): Deleted config file parser. * src/server_config.c (list_append): Fixed broken indirection. (server_config_parse_example): Fixed CONFIG_TYPE_LIST case. 2010-11-01 Niels Möller * src/testsuite/lshd-example-config-test: New test case. * src/server_config.c (list_append): Deleted return value. Instead aborts if allocation fails. Call config_tokenizer_next to get first string. Use lsh_space_free rather than plain free. (parser_parse_option): Call config_tokenizer_next after config_tokenizer_looking_at. Separate error message for missing '='. (server_config_parse_example): Handle CONFIG_TYPE_LIST (not yet tested). * src/parse_config.c (parse_setting): Call config_tokenizer_next after config_tokenizer_looking_at. (parse_groups): Likewise. * src/tokenize_config.c (config_tokenizer_looking_at): Don't call config_tokenizer_next. * src/testsuite/functions.sh (LSHD_USERAUTH): Partly reverted previous change. Define, but don't export. 2010-10-29 Niels Möller * src/testsuite/functions.sh (LSHD_LIBEXEC_DIR): Define and export. (LSHD_USERAUTH): Deleted. * src/server_config.c (parser_parse_option): Don't check for proper end of line if we already had a syntax error. * src/lshd.c (lshd_service_request_handler): Take environment variable LSHD_LIBEXEC_DIR and compiled in LIBEXECDIR into account when interpreting the program name. Added the resulting name to debug output. Also deleted local variable hex. * src/environ.h.in (FILE_LSHD_USERAUTH): Stripped directory part. (ENV_LSHD_LIBEXEC_DIR): New define. * src/lshd.c (lshd_service_request_handler): Use server_lookup_service. (lshd_argp_parser): Updated handling of default service. (lshd_config_handler): Initialize service_config child. (lshd_config_children): Added service_config_parser. * src/server.c (make_service_entry): New function. (make_service_config): Updated initialization. (server_lookup_service): New function. (service_options): New option --service-add. (service_argp_parser): Support --service-add. Support multiple --service and --service-add options. (service_config_options): New config option "service". (service_config_handler): New function. (service_config_parser): New config file parser. * src/server.h (class service_entry): New class. (class service_config): Support multiple services. * src/tcpforward.c (make_tcpforward_listen_port): Trace output of requested port and the bound ip address. (tcpforward_connect_error): Convert error number to string. (tcpforward_connect): Trace output of target port. (tcpforward_connect): Fixed logging of errno when io_connect fails. * src/client_x11.c (x11_connect_error): Convert error number to string. * src/io.c (oop_io_connect): Use errno if getsockopt fails. 2010-10-28 Niels Möller * src/testsuite/functions.sh (at_connect): Use our own mini-inetd. * src/testsuite/rapid7-lsh-test: Likewise. * src/testsuite/Makefile.in (TS_SH): Omit obsolete lshd-no-auth-test. (TARGETS): Added mini-inetd. (OTHER_SOURCES): Added mini-inetd.c. (mini-inetd): New rule. * src/testsuite/mini-inetd.c: New file. Reimplementation of mini-inetd, hopefully working better with IPv6 than the version in tcputils. 2010-10-26 Niels Möller * src/werror.c (werror_format): Made static. * src/testsuite/server-config-test.c: Added '=' tokens in input. * src/testsuite/config/lshd-connection.conf: Updated to new syntax with '=' tokens. * src/testsuite/config/lshd-userauth.conf: Likewise. * src/testsuite/config/lshd.conf: Likewise. * src/server_config.c (parser_init): Deleted unnecessary cast. (parser_finalize): Deleted err argument and return value. Updated callers. (list_append): New function. (parse_value_list): New function. (parser_parse_option): Recognize CONFIG_TYPE_LIST. Require '=' token for all other types. (server_config_print_example): Output '=' tokens. Handle CONFIG_TYPE_LIST. * src/server_config.h (enum config_type): Renamed CONFIG_TYPE_UNSIGNED to CONFIG_TYPE_NUMBER. Added CONFIG_TYPE_LIST. * src/tokenize_config.c (char_class): Added '=' as separator. (config_tokenizer_next): Recognize '='. * src/tokenize_config.h (enum config_token_type): Added TOK_EQUAL. * src/pkcs5-test.c (main): Added long options. Deleted -?, and fixed handling of bad options. * src/testsuite/prgrp-timeout.c (main): Likewise. * src/lshd-userauth.c (read_packet): Don't treat EOF at start of header as an error. (main): Deleted useless trace call before arpg_parse. * src/lshd-pty-helper.c (utmp_gettimeofday): New function, to work around ut_tv 32-bit backwards compatibility hack for 64-bit systems. * src/tcpforward.c (tcpforward_connect_error): Use STRERROR to display socket error code. (make_tcpforward_listen_port): Trace output of local and target ports. * src/client_x11.c (x11_connect_error): Use STRERROR to display socket error code. 2010-08-24 Niels Möller * src/scm/guile-compat.scm: Use the rdelim module, for the read-line. Needed at least for guile-1.8.7. * doc/fixff.pl: Use regexp m modifier rather than the arcane $*. 2010-07-23 Niels Möller * src/lshd-userauth.c (lookup_user): Set user->shell before use. (handle_userauth): More verbose output. 2010-07-20 Niels Möller * src/crypto.c (make_des3_cbc_instance): Updated to Nettle's new DES interface. 2010-06-04 Niels Möller * src/testsuite/Makefile.in (TS_SH): Added passwd-1-test and passwd-2-test. (check): Don't pass on PASSWD_PRELOAD, leave that for functions.sh. * src/testsuite/passwd-1-test: New test, using dummy passwd database. * src/testsuite/passwd-2-test: New test, password authentication. * src/testsuite/setup-env: Fixed setup of test password. * src/testsuite/functions.sh (need_getpwnam_wrapper): New function. (ENV_PROGRAM, GETPWNAM_PRELOAD): New variables. * src/testsuite/getpwnam-wrapper.c (getpwnam): Added empty-passwd-testuser to the dummy passwd database. * src/lshd.c (lshd_service_request_handler): Don't hard code --session-id argument, instead substitute "$(session_id)" if appearing on the argument list. (lshd_argp_parser): For the default service, ssh-userauth, add --session-id $(session_id) to the argument list. * src/lshd-userauth.c (lookup_user): If there's no login shell, consider the account disabled. Improved check for missing home directory. * src/Makefile.in (stamp-h): Standard rule for config.h via stamp-h. * src/lshd.c (read_host_key): Recognize dsa-sha256. * src/lshd-userauth.c (get_verifier): Recognize ssh-dsa-sha256. * src/lsh-transport.c (read_user_key): Recognize dsa-sha256. (lsh_transport_lookup_verifier): Recognize ssh-dsa-sha256. * src/lsh-decode-key.c (lsh_decode_key): Recognise ssh-dsa-sha256. Also slight code cleanup. * src/dsa.c: Updated dsa-sha1 functions for renamed constants. (do_dsa_verify): Require signature blob to be precisely 40 octets. (do_dsa_sha256_verify): New function. (do_dsa_sha256_public_key): New function. (do_dsa_sha256_public_spki_key): New function. (init_dsa_sha256_verifier): New function. (parse_ssh_dsa_sha256_public): New function. (do_dsa_sha256_sign): New function. (do_dsa_sha256_get_verifier): New function. (make_dsa_sha256_verifier): New function. (make_dsa_sha256_signer): New function. (dsa_sha256_algorithm): New algorithm. (make_ssh_dsa_sha256_verifier): New function. * src/crypto.h: Declarations for dsa-sha256. * src/algorithms.c (lookup_hostkey_algorithm): Recognize dsa-sha256. * src/Makefile.in (GPERF_FLAGS): Tweaked positions, to distinguish between ssh-rsa and ssh-dsa. * src/atoms.in: Added ssh-dsa, ssh-dsa-sha256@lysator.liu.se, and dsa-sha256. 2010-06-03 Niels Möller * src/lsh-keygen.c: Added support for dsa-sha256 keys. (main_options): Improved descriptions. (dsa_sha1_generate_key): Renamed, was dsa_generate_key. (dsa_sha256_generate_key): New function. (enum config_algorithm): New enum. 2010-06-02 Niels Möller * src/testsuite/getpwnam-wrapper.c (getpwnam): Use GETWPWNAM_WRAPPER_DIR to locate configuration directory. * src/testsuite/setup-env: Create a password for testing. 2010-06-01 Niels Möller * configure.ac (LOCAL_NETTLE_DEP): When building with the bundled nettle library, setup a dependency when linking. * src/Makefile.in (LOCAL_NETTLE_DEP): Use it here. 2010-05-25 Niels Möller * src/lsh-keygen.c (dsa_generate_key): Updated call to dsa_generate_keypair to explicitly specify a 160 bit q. 2010-03-30 Niels Möller * src/dsa.c (do_dsa_verify): Updated for Nettle's dsa_sha1_verify rename. (do_dsa_sign): Updated for Nettle's dsa_sha1_sign rename, and check return value. * src/server_session.c (stdin_eof): New function. If we have a pty, send EOF and ignore error. (oop_write_stdin): Use it. (do_receive): Use it. (do_server_session_event): Use it, replacing old code to send EOF. 2010-03-24 Niels Möller * src/lsh-transport.c (start_userauth): Check return value from the SIGN method. * src/server_keyexchange.c (server_dh_handler): Likewise. * src/rsa.c (do_rsa_sign): Check return value from rsa_sha1_sign. 2010-03-23 Niels Möller * src/client_x11.c (do_client_channel_x11_receive): Fixed broken, too short(!), allocation for X11 connection failure message. 2010-03-04 Niels Möller * src/testsuite/functions.sh (spawn_xvfb): Explicitly setup the xauthority file using xauth add, don't rely on xauth generate and the X11 security extension. * src/lsh-keygen.c (main_argp_parser): Added --bit-length option, to replace the old --level option. Added sypport for -a symmetric, which generates random keys for use as a shared secret. (check_file): Allow file to be NULL. (process_private): Hex encode symmetric keys. (main): Use the value of the --bit-length option. New logic to handle generation of symmetric keys. (dsa_generate_key): Take bit size as input, not a NIST security level. (main_argp_parser): By default, don't encrypt symmetric keys. * src/lshd.c: Updated for service_config being a class. * src/server.c (make_service_config): New function, replacing init_service_config. * src/server.h (service_config): Make this into a class rather than a struct, for safer casting in service_argp_parser. 2010-02-23 Niels Möller * src/lshd.c (lshd_context): Added service_config, deleted commented-out attributes. (lshd_service_request_handler): Made service configurable. (make_lshd_context): Use init_transport_context and init_service_config. (lshd_config): Deleted werror_config (it's inherited via server_config). (make_lshd_config): Deleted call to make_werror_config. (lshd_argp_children): Added service_argp. (lshd_argp_parser): Updated initialization of child_inputs. Setup default service, ssh-userauth. (lshd_config_handler): Fixed references to the inherited werror_config. * src/Makefile.in (COMMON_SOURCES): Added arglist.c. * src/server.h (service_config): New class. * src/server.c (init_service_config): New function. (service_argp, service_argp_parser): New parser för --service { ... } argument. 2010-02-20 Niels Möller * src/lsh-transport.c (make_lsh_transport_config): Use init_transport_context. (start_userauth): In verbose mode, display the user name we're trying to authenticate. (try_password_auth): Likewise. (try_keyboard_interactive_auth): Likewise. * src/transport.c (init_transport_context): New function. 2010-02-15 Niels Möller * src/lshd.c (make_lshd_port): Check that IPV6_V6ONLY is defined before trying to setsockopt it. * src/testsuite/Makefile.in (OTHER_SOURCES): Added getpwnam-wrapper.c. 2010-02-11 Niels Möller * src/lshd-userauth.c (main_options): Renamed options to start with --allow or --deny. 2010-02-08 Niels Möller * configure.ac: When looking for a shared libc, look for the symlink /libc.so.* rather than the glibc-specific name libc-*.so. * src/lshd-userauth.c: Renamed configuration parameters and corresonding variables to allow-password, allow-publickey and allow-root-login. 2010-02-05 Niels Möller * src/testsuite/config/lshd-userauth.conf: Added enable-publickey option. * src/testsuite/lsh-4-test: Added missing call to test_done. * src/lshd-userauth.c (lshd_userauth_config_handler): New function. (main_options): New options --password, --publickey, --root-login, and negated versions. (handle_userauth): Implement the the options. (handle_publickey, handle_password): Take the configuration as argument, and return 0 if the method is not enabled. 2010-02-04 Niels Möller * src/server_config.c (parser_parse_option): Require new line at end of option-value pair, and warn for spurious tokens before the end of line. * src/tokenize_config.c (config_tokenizer_eolp): New function. * src/testsuite/Makefile.in (PASSWD_PRELOAD): New variable, set depending on IF_LD_PRELOAD, and passed to the environment of run-tests. (getpwnam-wrapper): Use $(CCPIC). Deleted -rdynamic when compiling and -Wl,-soname when linking. * configure.ac: Use LSH_CCPIC. (IF_LD_PRELOAD): New substituted variable, set if we apepar to use dynamic libraries. (KRB_PROGRAM, PAM_PROGRAM): Deleted. * src/config.make.in (CCPIC): New variable. 2010-02-02 Niels Möller * src/testsuite/Makefile.in: Added rules for building getpwnam-wrapper.so. Needs to be configured. * src/testsuite/getpwnam-wrapper.c: New file, intended to be used for lshd test cases. * src/client.c (kill_client_connection): Use trace rather than werror. 2010-01-12 Niels Möller * src/lshd-userauth.c (handle_password): New function, currently untested and #if:ed out. * src/crypto.h (hash_algorithm): Deleted class, just use the corresponding struct nettle_hash. 2009-10-25 Niels Möller * configure.ac: Updated URL for liboop, it's now http://liboop.ofb.net. 2009-10-21 Niels Möller * src/lshd.c (make_lshd_port): Set the IPPROTO_IPV6ONLY socket option when listening on an IPv6 socket. 2009-10-07 Niels Möller * src/lshd-userauth.c (lookup_user): Added support for shadow passwords. 2009-09-22 Niels Möller * src/testsuite/lsh-6-test (ALGORITHMS): Updated list to include aes128 in cbc and ctr modes. * src/testsuite/aes-test.c: Added tests for aes128-cbc, aes128-ctr and aes256-ctr. * src/crypto.c (crypto_aes128_cbc_algorithm): New algorithm. (crypto_aes128_ctr_algorithm): Likewise. * src/algorithms.c (all_symmetric_algorithms): Added aes128-cbc and aes128-ctr. (all_crypto_algorithms): Likewise. (default_crypto_algorithms): Replaced aes256-cbc by aes128-ctr, as the preferred choice. (lookup_crypto): Added "aes128-cbc" with alias "aes-cbc", added "aes-128-ctr" with aliases "aes", "aes128", "aes-ctr". Removed some aliases for "aes256-cbc" and "aes256-ctr", including the old "rijndael" alias. 2009-09-05 Niels Möller * src/server_config.c (server_config_parse_example): Don't use options where the example is NULL. 2009-09-01 Niels Möller * src/testsuite/functions.sh (XAUTHORITY): Put xauthority file in $TEST_HOME. * src/Makefile.in (uninstall): Delete files in $(libexecdir). * doc/Makefile.in (DISTFILES): Removed explicit srp-spec.txt (already included via $(TARGETS)). * src/Makefile.in: Added make rules for autoheader. * configure.ac: Test for $with_system_argp != no, rather than = yes. 2009-08-31 Niels Möller * doc/Makefile.in (DISTFILES): Distribute TODO file. * Makefile.in (install uninstall): Recurse into sftp directory. 2009-08-24 Niels Möller * .bootstrap, Makefile.in, configure.ac: Reenable building of sftp. 2009-05-30 Niels Möller * doc/Makefile.in (.texinfo.info): Don't use a temporary output file $@T, trust makeinfo to not remove output file on errors. 2009-05-04 Niels Möller * texinfo.tex: Upgrade to version 2009-03-22.17. 2009-02-24 Niels Möller * src/server_pty.c (pty_open_slave): Work around Solaris problem with bogus definition of TIOCSCTTY. * src/lshd-pty-helper.c (die, werror, process_request): Improved error messages. 2009-02-23 Niels Möller * src/testsuite/x11-4-test: Explicitly start /bin/sh at the remote end. Avoid recursive use of here-documents. Use $XAUTH, $XMODMAP and friends. * src/client_x11.c (make_client_x11_display): Use KILL_RESOURCE on failure. (do_client_channel_x11_receive): Send "access denied" message back when a connection is refused. 2009-02-16 Niels Möller * src/testsuite/x11-2-test: Use lsh, not lshg, for this test. Also export DISPLAY. * src/testsuite/x11-1-test: export DISPLAY. * src/testsuite/x11-5-test: Likewise. * src/testsuite/functions.sh: Unset DISPLAY, don't export it (the tests that need it should do that). * src/testsuite/x11-5-test: Use $XMODMAP. * src/testsuite/functions.sh (XAUTH, XMODMAP, XVFB): New variables. (need_xvfb, spawn_xvfb): Use $XVFB. 2009-02-12 Niels Möller * src/testsuite/x11-2-test: Use lshg, and also check that the X-forwarding is removed properly. * src/testsuite/functions.sh (test_result): Sleep 3 seconds before trying xauth generate. * src/werror.c (werror_vformat): Don't output any punctuation for %e. Changed all callers to use it like "...: %e.\n". 2009-02-11 Niels Möller * src/pty-helper.c (pty_send_message): Clear the control area, to work around overly strict length validation in CMSG_NXTHDR. Problem present at least in glibc. (pty_send_message, pty_recv_message): Also clear the entire msghdr struct. 2008-12-02 Niels Möller * contrib/lshd.debian.init: Updated file names for host key. Use SIGHUP when stopping daemon. * src/lshd.c (lshd_config_options): Use FILE_LSHD_HOST_KEY. (open_interface): Fixed handling of default (NULL) interface. 2008-11-27 Niels Möller * src/testsuite/x11-1-test: Set $DISPLAY and $LSH_FLAGS at top-level, not just locally for exec_lsh function. 2008-11-26 Niels Möller * src/pty-helper.c (CMSG_LEN): Fallback definition now includes int alignment at the end of the header. (pty_recv_message): Check that msg_controllen is large enough before using CMSG_FIRSTHDR. * src/server_x11.c (open_x11_socket): Try to create directory /tmp/.X11-unix. 2008-11-22 Niels Möller * src/lsh-make-seed.c (main): Reverted part of change from 2008-11-01. Don't explicitly set the seeded flag in the yarrow ctx, as that results in calls to aes_encrypt before aes_set_encrypt_key. 2008-11-12 Niels Möller * src/testsuite/functions.sh (XAUTHORITY): Use a separate export statement for XAUTHORITY. 2008-11-10 Niels Möller * src/server_x11.c (create_xauth): Added fallback when libXau is unavailable. Avoid using the Xauth type in the argument list. Use O_EXCL when creating files. (server_x11_setup): Updated for new create_xauth interface. (do_kill_x11_listen_port): Delete xauthority file. * doc/Makefile.in (DISTFILES): Added srp-spec.txt. * configure.ac: Use AC_CHECK_LIB to check for libXau. 2008-11-09 Niels Möller * src/testsuite/functions.sh: Explicitly export DISPLAY. 2008-11-07 Niels Möller * configure.ac: Try a different workaround for libXau on Solaris-5.8. * src/pty-helper.c (pty_send_message): Set msg_control to NULL if controllen is 0, to make FreeBSD happy. * src/lshd-pty-helper.c (main): Fixed error message when pty_send_message fails. * configure.ac: Fixed check for credentials passing to work on FreeBSD. 2008-11-06 Niels Möller * configure.ac: Moved checks for -lnsl and -lsocket earlier. Updated GMP URL. * configure.ac: Fixed spurious # in include section i test for utmp members. 2008-11-05 Niels Möller * configure.ac: Check for XauGetAuthByAddr in both libXau and libX11. (XAUTH_PROGRAM): Deleted check and configure option. 2008-11-04 Niels Möller * src/server_pty.h: Include . * src/pty-helper.c: Added support for FreeBSD style credentials passing, with SCM_CREDS and struct cmsgcred. 2008-11-01 Niels Möller * src/unix_random.c (update_seed_file): Mix in current seed file before overwriting it. (random_init): yarrow256_force_reseed replaced by yarrow256_slow_reseed. * src/lsh-make-seed.c (main): Updated for new yarrow interface in nettle-2.0. * src/seed_file.c (seed_file_write): Likewise, generate seed file with yarrow256_random. * src/crypto.c: Updated (nettle_crypt_func *) casts, for nettle-2.0. 2008-10-30 Niels Möller * src/lsh.c (main_argp_parser): Support user@host notation. (main_argp_parser): Count self->start_gateway as an action. 2008-10-22 Niels Möller * src/transport.c (transport_send_kexinit): Use make_kexinit function. * src/transport.h (class transport_context): Type of kexinit attribute changed to struct kexinit_info *. * src/lsh-transport.c (main_argp_parser): Use make_kexinit_info. * src/lshd.c (lshd_config_handler): Likewise. * src/keyexchange.c (class kexinit_info): Renamed from simple_kexinit. Don't inherit make_kexinit. (make_kexinit_info): Renamed from make_simple_kexinit. (make_kexinit): New function, replacing the make method of the make_kexinit class. * src/keyexchange.h (class make_kexinit): Deleted abstract class. * src/dh_exchange.c (dh_hash_update): Deleted free argument. Updated all callers. 2008-09-26 Niels Möller * src/Makefile.in (COMMON_SOURCES): Moved queue.c here, from CONNECTION_SOURCES. * src/lshd.c (open_ports): Replaced by three new functions, to support multiple listen ports. (open_port): Look up a port using getaddrinfo, and bind one or more sockets. (open_interface): Bind all appropriate ports for a given interface. (open_all_ports): Open all configured ports on all interfaces. (class lshd_interface): New class. (class lshd_config): Use queues to handle multiple ports and interfaces. (parse_interface): New function. (main_argp_parser): Handle --interface option. Accept multiple -p options. (lshd_config_handler): Likewise. Added default port logic. * src/testsuite/config/lshd.conf: Removed interface option, it is set to localhost on the command line. * src/testsuite/functions.sh: Set $INTERFACE. * src/channel.c (channel_open_new_v): Removed function, merged into channel_open_new_type. 2008-09-03 Niels Möller * src/transport.c (transport_process_packet): Parse SSH_DISCONNECT message and display the description and reason code. * src/lsh-transport.c (lsh_transport_lookup_verifier): Fixed the code for writing out the ACL entry. (read_host_acls): Fixed error message for read errors. * src/io.c (lsh_popen_write): Close the pipe to the spawned process after the data is written. 2008-09-02 Niels Möller * src/lsh-transport.c (lsh_transport_lookup_verifier): Reintroduced call to werror_quiet_p. --sloppy --quiet means that keys are accepted (but not stored in .lsh/host-acls), with no question asked. * src/atoms.in: Commented out or deleted unused symbols. 2008-09-01 Niels Möller * src/testsuite/functions.sh: --capture-to option renamed to --host-db-update. * src/testsuite/lsh-9-test: Likewise. * src/testsuite/rapid7-lsh-test: Likewise. * src/lsh.c (main_options): --capture-to option renamed to --host-db-update. For backwards compatibility, old name kept as a hidden alias. (main_argp_parser): Pass on --host-db-update. * src/lsh-transport.c (lsh_transport_lookup_verifier): Ask before writing ACL. Add more details in the ACL comments. Use lsh_popen_write to pipe data through sexp-conv --lock. (read_host_acls): Added file name argument. (main_options): Renamed option --capture-to to --host-db-update. (main_argp_parser): Pass file name to read_host_acls. Make the --host-db-update option default to the file used for --host-db, by default ~/.lsh/host-acls. * src/unix_interact.c (interact_yes_or_no): Deleted argument free. Use werror_quiet_p and return default answer in quiet mode. Updated callers. * src/io.c (lsh_popen): Removed function, merged with lsh_popen_read. (lsh_popen_write): New function. 2008-08-28 Niels Möller * src/unix_random.c (random_add): Don't associate any entropy with input of type RANDOM_SOURCE_SECRET. (random_init_system): Use GET_FILE_ENV, which uses FILE_SEED_FILE. * src/seed_file.c (seed_file_lock): Compare return value from fcntl to -1; according to the Solaris 10 man page, the return value on success not -1 but otherwise not specified at all. * src/lshd.c (lshd_config_handler): Use FILE_LSHD_PID and FILE_LSHD_HOST_KEY. * src/lsh-make-seed.c (main_argp_parser): Use FILE_SEED_FILE_DIR and FILE_SEED_FILE. * src/lsh-keygen.c (main_argp_parser): Use FILE_LSHD_CONFIG_DIR and FILE_LSHD_HOST_KEY. Create FILE_LSHD_CONFIG_DIR if it doesn't exist. * src/Makefile.in (LIBEXEC_PROGRAMS): New variable, listing programs that are moved to libexec, lsh-transport, lshd-userauth, lshd-connection and lshd-pty-helper. (environ.h): Substitute localstatedir. (install): Install $(LIBEXEC_PROGRAMS). (tags-here): Put TAGS file in source directory. * src/config.make.in (libexecdir): New variable. (sysconfdir): Likewise. (localstatedir): Likewise. * src/environ.h.in (LOCALSTATEDIR): New macro. (FILE_LSHD_HOST_KEY): New macro. (FILE_LSHD_PID): New macro. (FILE_SEED_FILE_DIR): New macro. (FILE_SEED_FILE): New macro. (FILE_LSHD_CONNECTION): Use LIBEXECDIR. (FILE_LSHD_PTY_HELPER): Likewise. (FILE_LSHD_USERAUTH): Likewise. (FILE_LSH_TRANSPORT): Likewise. * src/daemon.c (PID_DIR, PID_SUFFIX): Deleted unused macros. 2008-08-26 Niels Möller * src/testsuite/Makefile.in (tags): New target. * doc/Makefile.in (tags): New do nothing target. 2008-08-20 Niels Möller * src/transport.c (transport_connection_kill): Cancel oop_timer_retry. (transport_stop_read): Likewise. (oop_timer_retry): Assert that the connection is alive. * src/lshd.c (class lshd_port): Inherit io_listen_port. (kill_port): Deleted function, it was identical with kill_io_fd_resource. (lshd_port_accept): Converted from an oop callback to an accept method for the io_listen_port class. Use SERVER_VERSION_LINE. (make_lshd_port): Changed return type to struct resource *. Take a sockaddr as argument, rather than an fd. Create and initialize the socket. Use io_listen. (open_ports): Creation of socket moved to make_lshd_port. (main): Simplified logic slightly for the daemon mode. * src/version.h (SERVER_PROTOCOL_VERSION): Deleted constant. (CLIENT_PROTOCOL_VERSION): Likewise. (SERVER_VERSION_LINE): New constant. (CLIENT_VERSION_LINE): Likewise. Updated all users. 2008-08-19 Niels Möller * src/lshd.c (class lshd_port): Inherit io_listen_port. (kill_port): Deleted function. * src/io.c (kill_io_fd_resource): New function, replacing kill_io_connect_state and kill_io_listen_port. (init_io_connect_state): Updated for new super class io_fd_resource. (oop_io_connect): Likewise. (io_connect): Likewise. (init_io_listen_port): Likewise. (oop_io_accept): Likewise. (io_listen): Likewise. * src/client_tcpforward.c (do_forward_local_port): Likewise. * src/client_x11.c (x11_connect): Likewise. * src/gateway.c (do_gateway_port_accept): Likewise. (make_gateway_port): Likewise. * src/server_session.c (do_kill_server_session): Likewise. * src/server_tcpforward.c (make_server_forward): Likewise. * src/server_x11.c (do_kill_x11_listen_port): Likewise. (do_x11_listen_port_accept): Likewise. (make_x11_listen_port): Likewise. (server_x11_setup): Likewise. * src/socks.c (do_make_socks_server): Likewise. * src/tcpforward.c (tcpforward_connect): Likewise. * src/io.h (class io_fd_resource): New class. (class io_connect_state): Inherit io_fd_resource. (class io_listen_port): Likewise. 2008-08-11 Niels Möller * src/spki.c (spki_pkcs5_encrypt): Handle the case of no IV. 2008-08-04 Niels Möller * src/lsh-writekey.c: Deleted program. * src/client_x11.c (x11_connect_error): Fixed call to channel_open_deny. 2008-07-27 Niels Möller Merged lsh-writekey into lsh-keygen. Old lsh-keygen behavior is enabled with --write-raw, old lsh-writekey behaviour is enabled by --read-raw. * src/testsuite/write-key-1-test: Use lsh-keygen --write-raw. * src/testsuite/write-key-2-test: Likewise. * src/testsuite/rapid7-lsh-test: Silence output. * src/testsuite/lsh-decrypt-key-test: Use the --read-raw and --write-raw flags to lsh-keygen. * src/testsuite/keygen-1-test: Don't use lsh-writekey. * src/testsuite/keygen-2-test: Likewise. * src/testsuite/lsh-encrypted-key-test: Likewise. * src/testsuite/setup-env: Likewise. * src/Makefile.in (BIN_PROGRAMS): Removed lsh-writekey. (INTERACT_RANDOM_SOURCES): New variable. (CRYPTO_SOURCES): Removed lock_file.c and randomness.c. Added seed_file.c. (CONNECTION_SOURCES): Removed command.c and exception.c. (lsh_SOURCES): Removed xauth.c. (lsh_writekey_SOURCES): Deleted. (lsh_writekey_OBJS): Deleted. (lsh-writekey): Deleted target. (lsh_transport_OBJS): Added $(INTERACT_RANDOM_OBJS). (lsh_keygen_OBJS): Likewise. * src/lsh-keygen.c: New constants OPT_READ_RAW, OPT_WRITE_RAW, OPT_LABEL and OPT_PASSPHRASE. (class lsh_keygen_options): New flags read_raw and write_raw. Merged configuration attributes from lsh-writekey. (make_lsh_keygen_options): Initialize new attributes. (main_options): Merged lsh-writekey options. (main_argp_parser): Merged option handling from lsh-writekey. (main_argp): New shorter description. (dsa_generate_key): Adapted to new randomness interface. Deleted randomness argument. (rsa_generate_key): Likewise. (check_file): Moved from lsh-writekey.c. (open_file): Likewise. (process_private): Likewise. (process_public): Likewise. (main): Adapted to new randomness interface. Aded code to split key into private and public parts, stored in different files. 2008-07-07 Niels Möller Reorganized client actions. * src/lsh.h: Deleted forward declarations of obsolete classes. * src/channel.c (make_channel_open_exception): Deleted function. * src/command.c: Deleted file. * src/command.h: Deleted file. * src/exception.c: Deleted file. * src/exception.h: Deleted file. * src/lsh.c (class lsh_options): Deleted handler attribute. Added detach flag. (make_options): Deleted handler argrment. (add_action): Changed argument type to client_connection_action. (make_client_session): Deleted handler argument in call to make_client_session_channel. (client_shell_session): Changed return type to client_connection_action. Use make_open_session_action. (client_subsystem_session): Likewise. (client_command_session): Likewise. (main_argp_parser): Changeed handling of -B, just set detach flag. (class lsh_default_handler): Deleted class. (do_lsh_default_handler): Deleted function. (make_lsh_default_handler): Deleted function. (main): Actions are now handled using the client_connection_action class, not as commands. This was the last use of the command and exception abstractions. (main): Handle detach (-B flag) here. * src/tcpforward.c (tcpforward_remove): Use CAST_SUBTYPE. * src/socks.c (SOCKS_HANDSHAKE): Deleted macro. (class make_socks_server_action): Replaces class make_socks_server_command. (make_socks_server): Changed return type to client_connection_action. * src/channel_forward.c (forward_start_io_command): Deleted unused command. * src/client_tcpforward.c (class forward_local_port_action): Replaces class forward_local_port_command. (class request_tcpip_forward_action): Replaces class request_tcpip_forward_command. (forward_local_port): Changed return type to client_connection_action. (forward_remote_port): Likewise. * src/client_session.c (do_client_session_event): No special error handling for CHANNEL_EVENT_DENY. (make_client_session_channel): Deleted exception handler argument. * src/client.c (class session_open_action): Replaces class session_open_command. (class background_process_command): Deleted class. * src/client.h (class client_connection_action): New class. (class client_session): Deleted exception handler attribute. * src/server_tcpforward.c (OPEN_FORWARDED_TCPIP): Deleted unused macro. 2008-07-06 Niels Möller Simplified interface to the randomness generator. * src/testsuite/Makefile.in (TEST_OBJS): Removed lock_file.o, randomness.o and unix_random.o. * src/testsuite/testutils.c (bad_random): New global variable. (random_generate): New fake randomness generator, replacing the real generator for the testcases. (lsh_random): Likewise. (test_sign): Initialize the fake randomness generator. * src/testsuite/functions.sh: Set $LSH_MAKE_SEED to /bin/false. * src/environ.h.in (FILE_LSH_MAKE_SEED): New macro. (ENV_LSH_MAKE_SEED): Likewise. * src/unix_random_user.c: New file. (random_init_user): New function. Replaces make_user_random. Tries to create the seed file automatically, if missing. * src/unix_random.c: Use globals for the generator state. (unix_random): Deleted class. (read_initial_seed_file): Simplified. Permission check moved to random_init. Seeking is done by read_seed_file. (update_seed_file): Deleted argument. Use seed_file.h interface. (trivia_source): Renamed from do_trivia_source. Use globals. (device_source): Renamed from do_device_source. Use globals. (random_generate): Replaces method do_unix_random. (random_add): Replaces method do_unix_random_add. (random_init): Use seed_file.h interface. Initialize all globals, including the sources'. (make_user_random): Deleted, replaced by random_init_user in unix_random_user.c. (random_init_system): Replaces make_system_random. (lsh_random): Moved definition here, from randomness.c. * src/lsh-make-seed.c (enum source_type): Deleted type SOURCE_DEV_MEM. (main): Use seed_file.h interface for locking and writing to the seed file. * src/lsh-writekey.c: Adapted to new randomness interface. * src/lsh-transport.c (make_lsh_transport_config): No argument to all_signature_algorithms. Deleted call to make_user_random. (lsh_transport_service_packet_handler): No randomness argument to lsh_string_write_random. (try_password_auth): Use random_add to mix the secret password into the randomness generator. (main): Use random_init_user. * src/lsh-export-key.c: No argument to all_signature_algorithms. * src/client_x11.c (channel_open_x11): Deleted old #if:ed out code. (xauth_lookup): Function moved here, from xauth.c. * xauth.c, xauth.h: Deleted files. * src/gateway_tcpforward.c (do_kill_gateway_forward): Fixed typo in prototype. * src/client_keyexchange.c (client_dh_init): Updated for new dh_generate_secret, with no randomness argument. * src/server_keyexchange.c (server_dh_init): Likewise. * src/lock_file.c, src/lock_file.h: Deleted, replaced by seed_file.c and seed_file.h * src/seed_file.h: New file. * src/seed_file.c: New file. * src/transport.c (oop_write_ssh): Updated call to transport_write_flush. (transport_send_packet): Updated calls to transport_write_packet and transport_write_flush. (transport_send_kexinit): Updated to new make_kexinit interface. * src/transport_write.c (make_ignore_packet): Deleted randomness argument. (transport_write_packet): Likewise. (transport_write_flush): Likewise. * src/transport_read.c (decode_packet): Use random_add, to mix the received random padding into the pool. * src/transport.h (class transport_context): Deleted randomness attribute. * src/spki.c (spki_pkcs5_encrypt): Deleted randomness argument. * src/lshd.c (make_lshd_context): No randomness attribute. (lshd_config_handler): Adapted to new randomness interface. (main): Likewise. * src/dsa.c (class dsa_algorithm): Deleted class, randomness attribute no longer needed. (class dsa_signer): Deleted randomness attribute. (do_dsa_sign): Adapted to new randomness interface. (make_dsa_signer): No randomness attribute. (make_dsa_algorithm): Deleted function. Replaced by... (dsa_algorithm): New static object. * src/encrypt.c (encrypt_packet): Deleted randomness argument. * src/dh_exchange.c (dh_generate_secret): Deleted randomness argument. * src/algorithms.c (all_signature_algorithms): Deleted randomness argument. * src/randomness.c: Deleted file. * src/lsh_string.c (lsh_string_random): Adapted to new randomness interface, and deleted randomness argument. (lsh_string_write_random): Likewise. * src/keyexchange.h (class make_kexinit): Deleted randomness argument from the make method. (MAKE_KEXINIT): Deleted macro. * src/keyexchange.c (do_make_simple_kexinit): Adapted to new randomness interface, and deleted randomness argument. * src/randomness.h: Deleted randomness class. New interface using plain functions random_generate and random_add. 2008-06-17 Niels Möller * src/.dist_classes (dist_classes): Deleted channel.c.x, combinators.c.x, gateway_channel.c.x, io_commands.c.x. Added gateway_tcpforward.c.x. * src/.dist_headers (dist_headers): Deleted io_commands.h and suspend.h. 2008-06-16 Niels Möller * src/testsuite/Makefile.in (TS_SH): Added lshg-tcpip-remote-test. * src/testsuite/lshg-tcpip-remote-test: New test case. * src/Makefile.in (lsh_SOURCES): Added gateway_tcpforward.c. * src/gateway.h (gateway_tcpip_forward_handler): New declaration. * src/gateway.c (make_gateway_connection): Add handler for GLOBAL_REQUEST tcpip-forward. 2008-06-15 Niels Möller * src/gateway_tcpforward.c: New file. 2008-06-14 Niels Möller * src/Makefile.in (lsh_SOURCES): Added gateway_x11.c. * src/testsuite/Makefile.in (TS_SH): Added x11-5-test. * src/testsuite/x11-5-test: New test for x11 forwarding over a gateway. * src/lsh.c (main): When we're starting a gateway, enable channel open handler for x11 and forwrded-tcp channels. * src/gateway_x11.c (gateway_x11_request_handler): Put the handler on the connection's resource list. Record the number of pending replies *including* the one for the x11-req. * src/gateway_channel.c (class gateway_channel): Moved to gateway.h. Adapted to changed type of chain. (do_kill_gateway_channel): Kill x11 handler, if present. (do_gateway_channel_event): Check for the reply to x11-req, and install x11 handler. (gateway_forward_channel_open): Install handler for x11-req on the originating channel. * src/gateway.h (class gateway_channel): Moved definition here, from gateway_chanel.h. Changed type of chain attribute to gateway_channel. * src/gateway_x11.c: New file. 2008-06-09 Niels Möller * src/xalloc.c (lsh_object_check_subtype): Removed support for LSH_ALLOC_STACK. * src/server_tcpforward.c (remove_server_forward): Deleted. (do_tcpip_forward_handler): Adapted to new convention. Use global_request_reply. (do_tcpip_cancel_forward): Adapted to new convention. Use global_request_reply, and tcpforward_remove. * src/pty-helper.c (pty_send_message): Moved declaration of creds. * src/lshd-pty-helper.c (process_request): Deleted werror messages for each request. * src/client_x11.c (channel_open_x11): Use CAST_SUBTYPE, since client_x11_handler has subclasses. * src/tcpforward.c (tcpforward_remove): New function. * src/client_tcpforward.c (class remote_port): Inherit client_tcpforward_handler. (do_remote_port_open): New function (make_remote_port): Initialize open method. (channel_open_forwarded_tcpip): Look up a client_tcpforward_handler for the port, and invoke its open method. Code for actual connecting is moved to do_remote_port_open. (class remote_port_state): New class, replacing remote_port_continuation and remote_port_exception_handler. (do_remote_port_state_done): New function. (class remote_port_continuation): Deleted. (do_remote_port_continuation): Deleted. (make_remote_port_continuation): Deleted. (class remote_port_exception_handler): Deleted. (do_remote_port_exception_handler): Deleted. (make_remote_port_exception_handler): Deleted. (do_request_tcpip_forward): Adapted to new channel_send_global_request convention, and use make_remote_port_state. * src/client_session.c (handle_exit_status): struct channel_request_info renamed to request_info. (handle_exit_signal): Likewise. * src/server_session.c (shell_request_handler): struct channel_request_info renamed to request_info. (exec_request_handler): Likewise. (do_spawn_subsystem): Likewise. (pty_request_handler): Likewise. (window_change_request_handler): Likewise. (x11_request_handler): Likewise. * src/gateway_channel.c (gateway_forward_channel_request): struct channel_request_info renamed to request_info. * src/client.h (class client_tcpforward_handler): New class. * src/channel.c (class request_status): Deleted. (make_request_status): Deleted. (class global_request_continuation): Deleted. (send_global_request_responses): Deleted. (do_global_request_response): Deleted. (make_global_request_response): Deleted. (class global_request_exception_handler): Deleted. (do_exc_global_request_handler): Deleted. (make_global_request_exception_handler): Deleted. (handle_global_request): New simplified handler convention, with no continuation or exception_handler. (global_request_reply): New function. (handle_global_success): Use new global_request_state class. (handle_global_failure): Likewise. (handle_channel_request): struct channel_request_info renamed to request_info. (channel_request_reply): Likewise. (channel_send_global_request): Use struct global_request_state instead of struct command_context. * src/channel.h (struct channel_request_info): Deleted. (class channel_request): Use struct request_info for the handler method. (class global_request_state): New class. * src/connection.c (init_ssh_connection): Deleted initialization of active_global_requests. * src/connection.h (struct request_info): New struct, replaces channel_request_info in channel.h. Used for both global requests and channel requests. (class ssh_connection): Deleted active_global_requests. (class global_request): The handler method now takes a struct request_info as argument, and no continuation or exception_handler. 2008-05-30 Niels Möller * src/lsh.c (maybe_x11): Pass zero single_connection argument to make_x11_action. * src/client_x11.c (make_client_x11_handler): Deleted function. (class client_x11_display): Inherit client_x11_handler. (channel_open_x11): Invoke the handler's open method. (client_add_x11_handler): Take an argument of type client_x11_handler *, not resource *. (do_client_x11_display_open): New function. (make_client_x11_display): New argument single_connection. Initialize super class and open method. (do_action_x11_success): Updated for client_x11_display inheriting client_x11_handler. (make_x11_action): New argument single_connection. * src/client.h (class client_x11_handler): New class, replacing similar class in client_x11.c. 2008-05-28 Niels Möller * src/gateway_channel.c (do_gateway_channel_event): Pass on CHANNEL_SUCCESS and CHANNEL_FAILURE to the other channel. (do_gateway_channel_request): Deleted. (gateway_forward_channel_request): New channel request handler, replacing do_gateway_channel_request. Use channel_send_request. (do_gateway_channel_success): Deleted. (do_gateway_channel_failure): Deleted. (gateway_request_methods): Deleted. (gateway_forward_channel_open): Renamed, was gateway_forward_open. Updated all callers. Initialize request_fallback. * src/gateway.c (oop_read_gateway): Use verbose for message at EOF. (kill_gateway_connection): Use trace. * src/channel.c (handle_channel_request): Use request_fallback. (handle_channel_success): Deleted check for request_methods. (handle_channel_failure): Likewise. (init_channel): Initialize request_fallback. (channel_send_request): The type is now specified as length and pointer. Updated all callers. * src/channel.h (struct channel_request_methods): Deleted. (class ssh_channel): New attribute request_fallback, replacing request_methods. * src/scm/Makefile.am: Deleted obsolete file. * src/Makefile.in (CONNECTION_SOURCES): Removed combinators.c. * src/testsuite/Makefile.in (TS_SH): Added x11-3-test and x11-4-test. * src/testsuite/functions.sh (stdin_lsh): New function. * src/testsuite/testutils.c (test_sign): Use STATIC_HEADER, not STACK_HEADER. * src/testsuite/x11-2-test: Use xmodmap, not xdpyinfo to test connecting to the X server. * src/testsuite/x11-4-test: New test case, testing that bad cookies are rejected. * src/testsuite/x11-3-test: New test case, testing that fake and real cookie differs. * src/resource.c (resource_list_top): Corrected handling of empty list. * src/lsh.h (LSH_ALLOC_STACK): Deleted constant. (STACK_HEADER): Deleted macro. * src/gc.c (gc_mark): Removed support for LSH_ALLOC_STACK. * src/connection.c (connection_remember): Deleted command. * src/command.h: Deleted macros and declarations related to the combinator commands. * src/command.c (class command_apply): Deleted. (do_command_apply): Deleted function. (make_apply): Deleted function. (class gaba_continuation)): Deleted. (do_gaba_continuation): Deleted function. (gaba_apply): Deleted function. * src/client_x11.c (do_action_x11_success): Set session->x11. * src/client_session.c (do_kill_client_session): Kill pty and x11 resources. (oop_read_stdin): When reading is finished, kill pty resource, and no other resources. (make_client_session_channel): Initialize pty and x11 attributes. Replaces initialization of the resource list. * src/client_pty.c (client_pty_resource): Reintroduced class. Previous incarnation was called client_tty_resource. (do_kill_client_pty_resource): Kill window change callback. (make_client_pty_resource): Renamed, was make_client_tty_resource. Added session argument. Install window change callback. (do_action_pty_success): Use new make_client_pty_resource, and store result in sesion->pty. * src/client.h (class client_session): Deleted resource list. Replaced by separate resources for pty and x11. * src/channel.c (channel_open_deny): Fixed assertion. (channel_open_confirm): Added assertion. 2008-05-26 Niels Möller * src/combinators.c: Deleted file. * src/Makefile.in (CONNECTION_SOURCES): Deleted io_commands.c. * src/testsuite/Makefile.in (TS_SOURCES): Resurrected sockaddr2info-test.c. * src/testsuite/sockaddr2info-test.c: Resurrected file. * src/server_session.c (class server_session): x11 object now refers to the listen port. Deleted resources list. (x11_request_handler): Adapted to server_x11_setup changes. * src/server_x11.c (make_x11_server_info): Deleted function. (class server_x11_socket): Deleted class. (do_kill_x11_socket): Deleted function. (make_server_x11_socket): Deleted function. (do_kill_x11_listen_port): New function. (do_x11_listen_port_accept): New function. (make_x11_listen_port): New function. (open_x11_socket): Use make_x11_listen_port. (server_x11_setup): Use new io_listen. Return port object. * src/server_x11.h (class x11_listen_port): New class, merging server_x11_info and server_x11_socket. * src/socks.c (make_socks_channel): listen_value argument replaced by fd and peer info. Call io_register_fd. (socks_handshake): Deleted command. (socks_listen_port): New class. (do_socks_accept): New function. (make_socks_listen_port): New function. (class make_socks_server_command): New class. (do_make_socks_server): New function, wrapping make_socks_listen_port. (make_socks_server): New function, replacing the old expr-construction. * src/server_tcpforward.c (make_server_forward): Use make_tcpforward_listen_port and io-listen. New argument connection. (open_forwarded_tcpip_command): Deleted command. (expr tcpforward_forwarded_tcpip): Deleted. (class tcpip_forward_request_continuation): Deleted. (do_tcpip_forward_request_continuation): Deleted function. (make_tcpip_forward_request_continuation): Deleted function. (class tcpip_forward_request_exception_handler): Deleted. (do_tcpip_forward_request_exc): Deleted. (make_tcpip_forward_request_exc): Deleted. (do_tcpip_forward_handler): Simplified, letting make_server_forward to most of the work. * src/client_tcpforward.c (open_direct_tcpip_command): Deleted command. (class forward_local_port_command): New class. (do_forward_local_port): New function, wrapping make_tcpforward_listen_port. (forward_local_port): New function, replacing the old expr-construction. (forward_remote_port): Use const. Also affects other classes related to remote forwarding. * src/lsh.c (prepend_action): Deleted function. (main): Use new make_gateway_port. * src/gateway.c (command gateway_accept): Deleted. (class gateway_port): New class. (do_gateway_port_accept): New function. (expr make_gateway_setup): Deleted. (make_gateway_port): New function, replacing make_gateway_setup. * src/io.c (kill_io_connect_state): Simplified, io_close_fd ignores negative fd:s. (kill_io_listen_port): New function. (init_io_listen_port): New function. (oop_io_accept): New function. (io_listen): New function, replacing function in io_commands.c. (sockaddr2info): Resurrected function. Use const sockaddr * argument. Handle only AF_INET and AF_INET6. (io_bind_local): Use const argument. (io_connect_local): Likewise. * src/io.h (class listen_value): Deleted class. (class io_listen_port): New class. * src/io_commands.c, src/io_commands.h: Deleted files. * src/tcpforward.h (class forwarded_port): Use const. * src/tcpforward.c (tcpforward_connect): Use const for address_info argument. (tcpforward_listen_port): New class. (do_tcpforward_listen_port_accept): New function. (make_tcpforward_listen_port): New function. * src/client_x11.c (make_client_x11_channel): Use a write buffer size corresponding to a full window, and initialize rec_window_size to a smaller value corresponding to the initial X11 packet wth authentication data. 2008-05-23 Niels Möller * src/io_commands.c (make_listen_value): Added missing break. * src/server_session.c (shell_request_handler): Updated to new channel_request interface. (exec_request_handler): Likewise. (do_spawn_subsystem): Likewise. (pty_request_handler): Likewise. (x11_request_handler): Likewise. (window_change_request_handler): Updated to new channel_request interface. Never send a reply. Write a warning if ioctl fails. * src/client_session.c (handle_exit_status): Updated to new channel_request interface. Never send a reply. (handle_exit_signal): Likewise. * src/channel.h (class ssh_channel): Deleted the active_requests queue. (class channel_request): Deleted contuniation and exception handler arguments to the handler method. (DEFINE_CHANNEL_REQUEST): Updated prototype. * src/channel.c (class channel_request_continuation): Deleted. (send_channel_request_responses): Deleted function. (do_channel_request_response): Deleted function. (make_channel_request_response): Deleted function. (class channel_request_exception_handler): Deleted. (do_exc_channel_request_handler): Deleted function. (make_channel_request_exception_handler): Deleted function. (handle_channel_request): Pass no continuation and exception handler to the request handler. Request handlers are expected to call channel_request_reply before returning, making unnecessary the old code for ensuring that requests are replied to in order. (channel_request_reply): New function. (init_channel): No initialization of active_requests. * src/testsuite/Makefile.in (TS_SH): Added x11-1-test and x11-2-test. * src/testsuite/functions.sh (XAUTHORITY: New exported variables. (TEST_DISPLAY): New variable. (DISPLAY): Unset. * src/testsuite/x11-1-test: Use LSH_FLAGS to pass the --x11 flag to lsh. * src/testsuite/x11-2-test: New testcase, using an Xvfb X server. * src/Makefile.in (lshd_connection_SOURCES): Added server_x11.c. * src/server_x11.h (class server_x11_info): Use const strings. * src/server_x11.c (make_x11_server_info): New function. (class forwarded_x11_callback): New class, replacing channel_open_command_x11. (do_open_forwarded_x11): New function, replacing new_x11_channel. (make_forwarded_x11_callback): New function. (class open_forwarded_x11): Deleted. (expr server_x11_callback): Deleted. (class server_x11_socket): Replaced old lsh_fd pointer by an fd. This class should be merged with the corresponding port object. (make_server_x11_socket): New function. (open_x11_socket): Updated to new io_bind_sockaddr. Use make_server_x11_socket. Don't call io_listen, leave that to the caller. (class xauth_exit_callback): Deleted. (make_xauth_exit_callback): Deleted function. (bad_string): Deleted function. (create_xauth): New function using XauWriteAuth. (server_x11_setup): Support the single flag. Deleted code for spawnign an xauth process, use create_xauth and libXau instead. Use io_listen and make_forwarded_x11_callback. Deleted continuation and exception handling arguments. Changed DISPLAY to unix::. * src/server_session.c (class server_session): New attribute resources. (do_kill_server_session): Kill additional resources. (make_server_session): Initialize resources. (x11_request_handler): Decode hex cookie. Deleted continuation and exception handler arguments to server_x11_setup. * src/lshd-userauth.c (main_argp_parser): Use lsh_string_hex_decode. (decode_hex): Deleted function. * src/lshd-connection.c (make_lshd_connection): Enable X11 forwarding. * src/lsh_string.c (lsh_string_hex_decode): New function. * src/io_commands.c (io_listen): New function. (listen_tcp_command): Use io_listen. Deallocate sockaddr also in the success case. (listen_local_command): Use io_listen. * src/io.h (class local_info): Use const strings. * src/io.c (make_local_info): Use const arguments. * src/xauth.c (xauth_process): Deleted function. (xauth_lookup): Set family correctly for IPv6. Use XauGetAuthByAddr. * src/scm/gaba.scm (process-class): Allow absent variable list. * src/alist.h (class alist): Deleted size attribute. * src/alist.c: Deleted code to update size. 2008-05-20 Niels Möller * configure.ac: Deleted check for cfmakeraw. * src/lsh-transport.c (class lsh_transport_config): Deleted tty attribute. (try_password_auth): Use interact_read_password. (send_userauth_info_response): Use interact_dialog. (read_user_key): Updated for alist_select_l change. (OPT_ASKPASS): New constant. Use an enum for all the options constants. (main_options): Added --askpass option. (main_argp_parser): Use interact_set_askpass. (main): Use unix_interact_init. * src/lsh-decrypt-key.c (main): Updated for alist_select_l change. * src/alist.h (meta-class alist): Use const for the get method. * src/alist.c (alist_select_l): Changed to return the new alist. Inlined work, no longer calls alist_select and make_int_list. (alist_select): Deleted unused function. * src/lsh.c (class lsh_options): Deleted tty attribute. (maybe_pty): Use interact_is_tty and client_request_pty. (main_argp_parser): Removed call to suspend_install_handler. Pass on --askpass option to lsh-transport. (main): Call unix_interact_init. 2008-05-19 Niels Möller * src/lshd-connection.c (make_lshd_connection): Install window-change handler. * src/server_session.c (pty_request_handler): Convert dimensions to struct winsize. (window_change_request_handler): Likewise. Also use ioctl, not tty_setwinsize, and use DEFINE_CHANNEL_REQUEST. * src/server_pty.c (pty_open_slave): Replaced uses of tty_getattr, tty_setattr and tty_setwinsize, by calls to the underlying functions tcgetattr, tcsetattr and ioctl with TIOCSWINSZ. * src/server_pty.h: Don't include tty.h. Include sys/ioctl.h. (class pty_info): Change type of the dims attribute to struct winsize. * src/Makefile.in (INTERACT_SOURCES): Deleted suspend.c. (CRYPTO_CLIENT_SOURCES): New variable. (SOURCES): Added CRYPTO_CLIENT_SOURCES. (CRYPTO_CLIENT_OBJS): New variable. (lsh_transport_OBJS): Deleted TTY_OBJS. Added CRYPTO_CLIENT_OBJS. (lsh_decrypt_key_OBJS): Likewise. (lsh_writekey_OBJS): Deleted TTY_OBJS. * src/lsh-decrypt-key.c: Updated for interact changes. * src/lsh-writekey.c: Likewise. * src/srp-gen.c: Likewise. * src/client_pty.c (class client_tty_resource): Deleted class, it needs no attributes beyond the superclass resource. (do_kill_client_tty_resource): Use interact_set_mode. (make_client_tty_resource): Deleted arguments. (do_client_winch_handler): Updated to new interface, with new domensions as argument. (class client_pty_action): Deleted class, it needs no attributes beyond the superclass client_session_action. (do_action_pty_start): Updated for interact changes. (do_action_pty_success): Likewise. (client_request_pty): New static object, replacing make_pty_action. (make_pty_action): Deleted function. * src/client.c (suspend_callback): Moved here, from deleted file suspend.c. * src/tty.h (struct terminal_dimensions): Deleted struct. Replaced by struct winsize, from sys/ioctl.h. (CFMAKERAW): Deleted macro. * src/tty.c: (tty_getattr, tty_setattr): Deleted functions. (tty_getwinsize, tty_setwinsize): Deleted functions. (termios_cc_index): Renamed, was cc_ndx. Made const. (termios_iflags): Renamed, was cc_iflags. Made const. (termios_oflags): Renamed, was cc_oflags. Made const. (termios_cflags): Renamed, was cc_cflags. Made const. (termios_lflags): Renamed, was cc_lflags. Made const. (ENCODE_FLAGS): Renamed, was PARSE_FLAGS. (tty_encode_term_mode): Updated for new names. Made the argument const. (TTY_SET_VALUE): Deleted macro. (TTY_DECODE_FLAG): Renamed, was TTY_SET_FLAG. Use SIZE macro. Fixed test for non-existent flag. (tty_decode_term_mode): Fixed off-by-one error in check for SSH_TTY_OP_RESERVED. Inlined handling of c_cc. * src/unix_interact.c (tty_fd): New global variable. (askpass_program): Likewise. (original_mode): Likewise. (raw_mode): Likewise. (unix_interact_init): New function. Optionally installs signal handler and atexit handler to restore tty modes. (interact_is_tty): New function, replacing method unix_is_tty. (interact_set_askpass): Likewise. (read_line): Deleted fd argument. (class window_subscriber): Deleted class. (class unix_interact): Deleted class. (interact_yes_or_no): New function, replacing unix_yes_or_no. Loop until we get a yes or no answer. (read_password): Deleted self argument. Use globals instead. (interact_read_password): New function, replacing method unix_read_password. (interact_dialog): New function, replacing unix_dialog method. (class unix_termio): Deleted class. (interact_set_mode): New function, replacing methods unix_set_attributes and do_make_raw. (interact_get_window_size): New function, replacing unix_window_size method. (class winch_handler): Replace interact poitner with a pointer directly to a window_change_callback. (do_winch_handler): Pass new window size to callback. Invoke a single window_change_callback, not a list of subscribers. (interact_on_window_change): New function, replacing unix_window_change_subscribe method. (make_unix_interact): Deleted function. (interact_get_terminal_mode): New function, unix_get_attributes method. * src/interact.h: Forward declare struct winsize and struct termios. (class terminal_attributes): Deleted. (class window_change_callback): Change callback argument, it now gets the new window size. (class interact): Deleted class. Use ordinary functions instead. * src/suspend.c: Deleted file. Moved signal handler to unix_interact.c. Moved suspend_callback to client.c. * src/suspend.h: Deleted file. * src/spki.c (spki_algorithm_lookup): Made non-static. Moved functions depending on interact_read_password to a separat file spki-decrypt.c. * src/spki-decrypt.c: New file. (parse_pkcs5): Moved function from spki.c. (parse_pkcs5_payload): Likewise. (spki_pkcs5_decrypt): Likewise. Deleted interact argument. 2008-05-17 Niels Möller * src/client_session.c (oop_read_stdin): Implemented handling of escape character. (make_client_session_channel): Initialize escape_state. * src/client.h (enum escape_state): Moved here, from client_escape.c. Renamed constants with ESCAPE_ prefixes. (class client_session): New attribute escape_state. * src/client_escape.c (do_escape_help): Better display of ^Z. (class escape_handler): Deleted class. (scan_escape): Deleted function. (do_escape_handler): Deleted function. (make_handle_escape): Deleted function. (escape_dispatch): Use const argument. (client_escape_process): New function, replacing old code. 2008-05-15 Niels Möller * src/channel.h: Deleted old if:ed out code. * src/gc.c, src/gc.h: Likewise. * src/io.c, src/io_commands.h: Likewise. * src/lsh-make-seed.c: Likewise. * src/queue.c: Likewise. * src/server_config.c: Likewise. * src/werror.c: Likewise. 2008-05-14 Niels Möller * src/channel.h (CHANNEL_RECEIVE): Deleted macro, updated the only call in channel.c. (CHANNEL_SEND_ADJUST): Likewise. (CHANNEL_REQUEST): Likewise. (CHANNEL_OPEN_CONFIRM): Deleted macro. (CHANNEL_OPEN_FAILURE): Likewise. * src/.dist_classes: Added client_session.c.x, client_x11.c.x and gateway.c.x. * src/make-class-map: Use /usr/bin/awk as interpreter. * src/lsh.h (MAX, SQR): Deleted unused macros. * src/testsuite/sockaddr2info-test.c: Deleted file. Tested function no longer exists. * src/testsuite/Makefile.in (TS_SOURCES): Removed sockaddr2info-test.c. (TS_SH): Added lsh-13-test. * src/Makefile.in (lsh_SOURCES): Added client_x11.c and xauth.c. (class-map): New target. * src/lsh.c (command gateway_accept): Moved to gateway.c. (make_gateway_setup): Likewise. (maybe_x11): New function, replacing client_maybe_x11 in client.c. (client_shell_session, client_command_session): X11 handling. (main): Install CHANNEL_OPEN handler for x11. * src/io.c (io_lookup_address): Fixed error message. * src/gateway.c (gateway_packet_handler): Implemented SSH_LSH_GATEWAY_STOP. (make_gateway_connection): Set port attribute. Corresponding new argument. (command gateway_accept): Moved here, from lsh.c. Use the port object provided in the listen_value. (make_gateway_setup): Moved here, from lsh.c. * src/client.h: Updated x11-related prototypes. * src/client.c (oop_read_service): More debug output for unexpected message types. (client_maybe_x11): Deleted function (moved to lsh.c). * src/client_pty.c (do_kill_client_tty_resource): Check alive flag. New trace message. * src/client_session.c (do_client_session_event): Deleted call to channel_start_receive. (do_action_shell_success): New function. Calls channel_start_receive. The old ordering of the CHANNEL_REQUEST message and the CHANNEL_WINDOW_ADJUST caused interoperability problems with Sun_SSH_1.1 (no comprehensive interoperability testing done). (client_request_shell): Use do_action_shell_success. (make_action_command): Use do_action_shell_success. Set the serial attribute to true. * src/client_x11.c: Total reorganization. Adapted to new client_session_action conventions, and the new handling of channel open and channel requests. * src/testsuite/daemon-fd-test: Use ls -1, to get the same output regardless of presence of pty. * src/lsh-transport.c (lsh_transport_service_packet_handler): Fixed handling of SSH_LSH_RANDOM_REQUEST. * src/format.c (format_string): Fixed length calculation for hex output. * src/channel.c (channel_send_request): Check if we have sent channel_close. Return success/failure. 2008-05-12 Niels Möller * src/io_commands.c (make_listen_value): Moved function here, from io.c. Also made static, changed interface to take a sockaddr as argument, and merged contents of sockaddr2info, (oop_io_port_accept): Updated call to make_listen_value. * src/io.h (class listen_value): Added port attribute. * src/io.c (make_listen_value, sockaddr2info): Deleted, moved to io_commands.c. * src/lsh.c (DEFAULT_ESCAPE_CHAR, DEFAULT_SOCKS_PORT): Moved from client.c. (class lsh_options): Don't inherit client_options, its contents is moved here. (make_options): Moved initialization code from init_client_options. (add_action, prepend_action): New functions, moved from client.c. (make_client_session): New function, moved from client.c. (maybe_pty): New function, moved from client.c. (client_shell_session): Rewritten to use client_session_action. (client_subsystem_session): Likewise. (client_command_session): Likewise. (main_options): Copied options from client.c. (main_argp_children): Inherit werror_argp, not client_argp. (parse_arg_unsigned, parse_forward_arg): Moved from client.c. (CASE_ARG, CASE_FLAG): Updated, not member is no longer in super class. (main_argp_parser): Moved option parsing from client.c. (fork_lsh_transport): Updated to changes in lsh_options. (main): Updated to changes in lsh_options. Modify inhibit_actions flag around call to env_parse. Moved option parsing and configuration from client.c. * src/client_pty.c (class pty_request): Deleted. (do_client_winch_handler): Updated call to channel_send_request. (class client_pty_action): New class, more or less replaces the pty_request class. (do_pty_continuation): Deleted function. (make_pty_continuation): Deleted function. (do_pty_request): Deleted function. (make_pty_request): Deleted function. (do_action_pty_start): New function. (do_action_pty_success): New function. (do_action_pty_failure): New function. (make_pty_action): New function. * src/client_session.c (session_next_action): New function. (do_client_session_event): Deleted installation of exit-status and exit-signal. Use session_next_action, and implement the new way of sending channel requests for the session. (handle_exit_status): Moved from client.c, and rewritten to use DEFINE_CHANNEL_REQUEST, and to use the exit_status pointer in the session. (handle_exit_signal): Likewise. (make_client_session_channel): New argument actions. Initialize actions, action_next and action_done. Initialize the request_types alist with handlers for exit-status and exit-signal. (do_action_shell_start): New function. (These and below related to session actions). (class client_action_command): New class. (do_action_command_start): New function. (make_action_command): New function. (make_exec_action): New function. (make_subsystem_action): New function. * src/client.h (class client_session_action): New class. (class client_session): New attributes actions, action_next, action_done, replacing the attribute requests. (class client_options)): Deleted, merged with lsh_options in lsh.c. * src/client.c: All code related to options and configuration moved to lsh.c. (make_client_escape): New function. (env_parse): Don't touch the inhibit_actions flag, let the caller do that. * src/server_session.c (do_exit_shell): Updated call to channel_send_request. (do_server_session_event): Ignore CHANNEL_EVENT_SUCCESS and CHANNEL_EVENT_FAILURE. * src/channel_forward.c (do_channel_forward_event): Ignore CHANNEL_EVENT_SUCCESS and CHANNEL_EVENT_FAILURE. * src/gateway_channel.c (do_gateway_channel_event): Likewise. * src/socks.c (do_socks_channel_event): Likewise. * src/channel.c (handle_channel_success): Generate a CHANNEL_EVENT_SUCCESS to notify the channel. (handle_channel_failure): Generate a CHANNEL_EVENT_FAILURE. (init_channel): Updated initialization of pending_requests. (channel_send_request): Deleted command_context argument. * src/channel.h (enum channel_event): New constants CHANNEL_EVENT_SUCCESS, CHANNEL_EVENT_FAILURE. (class ssh_channel): Made pending_requests a simple counter, not a queue of objects. 2008-05-04 Niels Möller * src/client.c (handle_random_reply): New function. (client_random_request): New function. (client_gateway_random_request): New function. (oop_read_service): Use handle_random_reply. Moved and renamed class lsh_connection. * src/lsh.c (class lsh_connection): Moved definition to client.h. Renamed to client_connection. Renamed all related function. Related i/o code moved to client.c. * src/client.h (class client_connection): Moved here from lsh.c. New attribute pending_random. (client_random_handler): New class. * src/client.c: Moved client_connection i/o code here. (handle_random_reply): New function. (client_random_request): New function. (client_gateway_random_request): New function. (oop_read_service): Use handle_random_reply. * src/gateway.c (gateway_write_packet): Made non-static. (gateway_packet_handler): Handle SSH_LSH_RANDOM_REQUEST. (make_gateway_connection): Changed argument type from ssh_connection to client_connection. * src/gateway.h (class gateway_connection): Changed type of shared attribute to client_connection. Needs inclusion of client.h * src/gateway_channel.c (gateway_channel_open): Updated for new type of the shared attribute. 2008-05-03 Niels Möller * src/transport_forward.c (forward_packet_handler): Refuse to forward "local" messages, with message numbers from SSH_FIRST_LOCAL and up. * src/resource.c (resource_list_top): Bug fixes. * src/gateway.h (gateway_forward_channel): Added prototype. * src/gateway_channel.c (gateway_forward_channel): Renamed function, was make_gateway_pair. (gateway_channel_open): Moved check for pending_close earlier. Reorganized handling of SSH_MSG_CHANNEL_OPEN. * src/connection.h (class ssh_connection): New attribute open_fallback, used by the gateway code. (class channel_open_info): Upgraded to a first-class object. Added attributes connection and local_channel_number. (class channel_open): Deleted the connection, continuation, and exception_handler arguments from the handler method. (DEFINE_CHANNEL_OPEN): Updated for shorter argument list. * src/connection.c (init_ssh_connection): Initialize open_fallback. * src/channel.c (class channel_open_continuation): Deleted class. (class exc_channel_open_handler): Deleted class. (make_channel_open_continuation): Deleted function. (make_exc_channel_open_handler): Deleted function. (channel_open_confirm): New function, replaces channel_open_continuation. Don't generate CHANNEL_EVENT_CONFIRM. (channel_open_deny): New function, replaces exc_channel_open_handler. (parse_channel_open): New function. Creates a channel_open_info object. (handle_channel_open): Use parse_channel_open. Set the connection and local_channel_number attributes of the channel_open_info. Check the open_fallback pointer. Less arguments to CHANNEL_OPEN. * src/channel.h (make_channel_io_exception_handler): Deleted prototype of obsolete function. (enum channel_event): CHANNEL_EVENT_CONFIRM is generated only for channels opened by our side. * src/tcpforward.c (class tcpforward_connect_state): Replaced continuation and exception handler attributes with a channel_open_info. (tcpforward_connect_done): Replaced COMMAND_CONTINUATION call with calls to channel_open_confirm and channel_forward_start_io. (tcpforward_connect_error): Replaced EXCEPTION_RAISE call with a call to channel_open_deny. (tcpforward_connect): Take a channel_open_info as argument. Adapted to new CHANNEL_OPEN convention. * src/server_tcpforward.c (channel_open_direct_tcpip): Adapted to new CHANNEL_OPEN convention. * src/client_tcpforward.c (channel_open_forwarded_tcpip): Adapted to new CHANNEL_OPEN convention. * src/server_session.c (do_open_session): Adapted to new CHANNEL_OPEN convention. * src/gateway_channel.c (class gateway_channel): New attribute channel_open_info. (do_gateway_channel_event): Use channel_open_confirm and channel_open_deny. (make_gateway_pair): Take a chennel_open_info as argument, replacing origin_connection. Leave most of the initialization of the originating channel to channel_open_confirm. (gateway_channel_open): Regular channel open handler, replacing function gateway_handle_channel_open. * src/gateway.c (gateway_packet_handler): Deleted special handling of SSH_MSG_CHANNEL_OPEN. (make_gateway_connection): Set open_fallback to gateway_channel_open. 2008-05-01 Niels Möller * src/server_tcpforward.c (channel_open_direct_tcpip): Use DEFINE_CHANNEL_OPEN. * src/connection.h (DEFINE_CHANNEL_OPEN): Fixed colliding argument names in prototype. * src/client_tcpforward.c (channel_open_forwarded_tcpip): Use DEFINE_CHANNEL_OPEN. 2008-04-28 Niels Möller * src/channel_forward.c (init_channel_forward): Use do_channel_forward_event if the given event handler is NULL. (channel_forward_write): New function. (do_channel_forward_receive): Use it. * src/resource.c (resource_list_top): New function. * src/lshd-connection.c (class lshd_connection): Renamed class, was connection. Updated users and renamed related functions for consistency. * src/gateway_channel.c (make_gateway_pair): Changed interface to take the two connections as arguments. (gateway_handle_channel_open): Likewise. Also made non-static. (gateway_packet_handler): Moved to gateway.c. * src/gateway.c (gateway_packet_handler): Moved function here. * src/connection.h (class ssh_connection): Removed attribute x11_display. 2008-04-24 Niels Möller * src/lsh-transport.c (lsh_transport_service_packet_handler): New function, implementing SSH_LSH_RANDOM_REQUEST. (make_lsh_transport_connection): Use lsh_transport_service_packet_handler. * src/transport_forward.c (transport_forward_service_packet): New function, extracted from forward_packet_handler. * src/ssh.h (RANDOM_REQUEST_MAX): New constant. * src/format.c (ssh_vformat_length): Cleaned up handling of %r. 2008-04-23 Niels Möller * src/lsh-transport.c (make_lsh_transport_connection): Updated for init_transport_forward change. * src/transport_forward.c (init_transport_forward): New argument packet_handler. (transport_forward_packet): Default implementation fo the packet_handler method. (make_transport_forward): Updated for init_transport_forward change. (oop_read_service): Use packet_handler method. * src/transport_forward.h (class transport_forward): New method packet_handler. * src/ssh.h (SSH_LSH_RANDOM_REQUEST, SSH_LSH_RANDOM_REPLY): New local message types. 2008-03-03 Niels Möller * src/client.c (env_parse): Can't free the allocated copy of the environment value, as the argument parser stores pointers into it. * src/lsh.c (main): Adapted to changed env_parse. Use ENV_LSHFLAGS. * src/client.c (env_parse): Take environment value as argument. Don't iterate over envp, instead, caller is expected to use the ordinary getenv. Renamed, used to be envp_parse. * src/environ.h.in (ENV_LSHFLAGS): New constant. 2008-02-24 Niels Möller * doc/Makefile.in (DISTFILES): Removed srp-spec.txt; already included in $(TARGETS). 2008-02-06 Niels Möller * src/lsh-transport.c (read_host_acls): Message when host-acls cannot be opened is displayed only in verbose mode. Fixed message about old known_hosts file. * src/werror.c (werror_vformat): For %e, don't display the numeric errno value. 2008-01-08 Niels Möller * src/lsh-transport.c (lsh_transport_packet_handler): Handle SSH_MSG_USERAUTH_BANNER. (lsh_transport_lookup_verifier): Use spki_lookup_key. * src/spki.c (spki_lookup_key): New function. 2008-01-07 Niels Möller * src/gateway.c (oop_write_gateway): New function. (gateway_start_write, gateway_stop_write): New functions. (gateway_write_data): Use gateway_start_write and gateway_stop_write. (make_gateway_connection): Initialize write_active. * src/gateway.h (class gateway_connection): New attribute write_active. * src/transport_forward.c (forward_packet_handler): Fixed error message. * src/lsh.c (write_packet): Deleted FIXME. Stopping channels and gateways when the transport write buffer is getting full, is implemented in service_start_write. 2007-09-19 Niels Möller * src/testsuite/Makefile.in (prgrp-timeout): Added rule for building prgrp-timeout executable. 2007-09-13 Niels Möller * misc/xenofarm.sh: Updated for moved argp, nettle and spki directories. * src/testsuite/functions.sh: Avoid using type -p, since it's not portable. 2007-09-12 Niels Möller * src/testsuite/lsh-10-test: Fixed typo in check for local tty. * src/testsuite/Makefile.in (TEST_LIBS): Added $(LIBS). * src/testsuite/testutils.c (test_cipher): Adapted to new crypt_string interface. * doc/Makefile.in (DISTFILES): Added srp-spec.txt. 2007-09-10 Niels Möller * src/testsuite/lsh-10-test: Skip test if we have no tty locally. 2007-09-09 Niels Möller * src/spki.c (spki_pkcs5_encrypt): Updated use of crypt_string_pad. (spki_pkcs5_decrypt): Updated use of crypt_string_unpad. * src/lsh-writekey.c (process_private): Consume input string. (main): Adapt to process_private destroying the input. Do all conversions before writing the output files. * src/crypto.c (crypt_string, crypt_string_pad) (crypt_string_unpad): Deleted argument free. Now always consumes input string. 2007-09-07 Niels Möller * src/atoms.c (get_atom_length, get_atom_name): Changed argument type to enum lsh_atom. * src/werror.c (get_error_stream): New function. * src/lsh.c (class lsh_connection): New attributes write_active and write_blocked. (CONNECTION_WRITE_BUFFER_STOP_THRESHOLD) (CONNECTION_WRITE_BUFFER_START_THRESHOLD): New constants. (stop_gateway, start_gateway): New functions. (oop_write_service): New function. (service_start_write, service_stop_write): New functions. (write_packet): Use service_start_write and service_stop_write. (oop_read_service): Added assert. (make_lsh_connection): Initialize write_active and write_blocked. (DEFINE_COMMAND2): Call gateway_start_read. (fork_lsh_transport): If messages are logged to file, dup that fd to stderr for the child process. * src/lsh-transport.c (main_argp_parser): Added -l/--user option. * src/gateway.c (gateway_start_read): Made non-static. Check read_active. (gateway_stop_read): New function. (make_gateway_connection): Initialize read_active. Don't call gateway_start_read. * src/gateway.h (class gateway_connection): New attribute read_active. * src/channel.c (send_stop, ssh_connection_stop_channels) (send_start, ssh_connection_start_channels): New functions. * src/connection.c (ssh_connection_foreach): New function. * src/connection.h: Prototypes for the above. 2007-05-29 Niels Möller * src/gateway_channel.c (do_gateway_channel_event): When opening the target channel fails, we should deallocate the originating channel, not the target one. * src/Makefile.in (lshd-pty-helper): Added rules for this program. 2007-05-14 Niels Möller * src/testsuite/Makefile.in (TEST_OBJS): Added compress.o. (TEST_LIBS): Link with -lhogweed. * src/Makefile.in: Link programs with -lhogweed. 2007-05-10 Niels Möller * Makefile.in (install uninstall): Typo fix. (SUBDIRS): Added misc directory. * doc/Makefile.in: Set VPATH. Fixed distclean rule. Fixed install and distclean targets. * contrib/Makefile.in: Set VPATH. Fixed distclean rule. * misc/Makefile.in (tags): Likewise. 2007-05-09 Niels Möller * src/config.make.in (LIBS): Add @LIB_ARGP. * misc/Makefile.in (DISTFILES): New file. * configure.ac: Generate doc/Makefile misc/Makefile contrib/Makefile contrib/lsh.spec and contrib/solpkg.sh. (dummy-dep-files): Use only files in src and src/testsuite. (LIB_ARGP): New variable. We can't put -largp i LIBS, since that will cause the configure tests to fail. * Makefile.in (SUBDIRS): Added doc and contrib directories. (BUILD_SUBDIRS): Added doc directory. (install uninstall): Recurse also into doc directory. * doc/Makefile.in: New file. * doc/Makefile.am: Deleted. * contrib/Makefile.in: New file. * contrib/Makefile.am: Deleted. 2007-05-08 Niels Möller * src/testsuite/Makefile.in (clean, distclean): New targets. * src/Makefile.in: New install, uninstall and clean targets. * src/config.make.in (sbindir): New variable. * Makefile.in (all check): Recurse only into the directories listed in BUILD_SUBDIRS. (install uninstall): Recurse into src. (distclean-here, maintainer-clean-here): Bugfix, depend on the corresponding clean-here targets. * configure.ac: Add -largp to LIBS, if we're using the bundled argp library. Use AC_PROG_INSTALL and AC_PROG_MKDIR_P. 2007-05-04 Niels Möller * configure.ac: Commented out --without-zlib handling. For now, it's always disabled. * Makefile.am: Deleted obsolete file. 2007-05-04 Niels Möller * INSTALL, install-sh, texinfo.tex: New files, copied from automake-1.10. 2007-05-03 Niels Möller * aclocal.m4: Renamed, used to be acinclude.m4. * src/argp, src/nettle, src/rsync, src/spki: Removed directories and all files. They have moved one level up. * src/symmetric: Deleted obsolete directory and files. * src/testsuite/lshd-random-input-test: Use $LFIB_STREAM. * src/testsuite/functions.sh (SEXP_CONV, LFIB_STREAM): Locate programs by looking in nettle_builddir and in $PATH. * src/testsuite/Makefile.am: Deleted file. * src/testsuite/Makefile.in: Fixed distribution target, and dependencies. * src/testsuite/.test-rules.make: New file. * src/version.h (SOFTWARE_CLIENT_VERSION) (SOFTWARE_SERVER_VERSION): Deleted. * src/parse.c (parse_bignum): Compile only when LSH_MINIMAL is undefined. * src/lshd.c: Use PACKAGE_STRING. (add_key, read_host_key): Moved here... * src/server.c: ... from here. * src/lsh.c (make_options): Disable use of randomness generator. Breaks X11 forwarding (generation of fake X11 cookies). * src/config.make.in: New file. * src/Makefile.in: Fixes to distribution target. * src/Makefile.am: Deleted file. * configure.ac: Removed automake-related macros. New options --with-system-nettle and --with-system-libspki. * Makefile.in: Deleted config.h rules. Fixed DISTFILES. * .bootstrap: Updated for directory reorganization. 2007-05-02 Niels Möller * src/lsh-decode-key.c (argp_program_version): Use PACKAGE_STRING. * src/lsh-decrypt-key.c: Likewise. * src/lsh-export-key.c: Likewise. * src/lsh-keygen.c: Likewise. * src/lsh-make-seed.c: Likewise. * src/lsh-transport.c: Likewise. * src/lsh-writekey.c: Likewise. * src/lshd-connection.c: Likewise. * src/lshd-userauth.c: Likewise. * src/lcp: Support filenames containing white space. Fix from Ludovic Courtès. 2007-04-26 Niels Möller * src/testsuite/Makefile.in (distdir): New target. * src/Makefile.in (distdir): New target. * src/lsh_string.c: Use #ifndef LSH_MINIMAL around functions that need crypto or bignums. * src/format.c: Likewise, for "%n" formatting. * src/werror.c: Likewise, for "%n" formatting. * Makefile.in: New manually written Makefile.in. * src/Makefile.in (PRE_CPPFLAGS, PRE_LDFLAGS): List argp_builddir, nettle_builddir and spki_builddir. (SUBDIRS): List testsuite. 2007-04-23 Niels Möller * src/testsuite/Makefile.in: New manually written Makefile.in. 2007-04-07 Niels Möller * src/lsh_string.c (lsh_string_ntop): Use HAVE_INET_NTOP, not WITH_IPV6. Fixes problem with --disable-ipv6, reported by Sonny Rao. * configure.ac: Check for inet_ntop. 2007-04-04 Niels Möller * configure.ac: Bumped version number to 2.9.1-exp. * Released lsh-2.9-exp 2007-03-27 Niels Möller * src/gateway_channel.c (do_gateway_channel_event): For CHANNEL_EVENT_DENY, use the right channel number when propagating the error to the chained connection. * src/client_session.c (oop_read_stdin): Reset tty modes if we get EOF or I/O error on stdin. * src/channel.c (ssh_connection_register_channel): Reintroduced initialization of channel->local_channel_number. Unclear when this change from 2005-09-15 was lost. * src/unix_process.c (spawn_error): Deleted sync argument, let the caller be responsible for that. (spawn_parent): Only the reading end of the sync pipe passed as argument. (spawn_child): Only writing end of sync pipe passed as argument. (spawn_shell): Close the sync fd:s that aren't needed by the helper functions. * src/testsuite/lsh-10-test: Added extra delay before sending EOF, to avoid trigging a race condition when signalling EOF on a pty. * src/testsuite/Makefile.am (TS_SH): Added lsh-12-test. (EXTRA_DIST): Added socks4-config and socks5-config. * src/testsuite/lsh-12-test: New test, which executes two commands in parallel. 2007-03-05 Niels Möller * configure.ac: By default, don't use the system's argp. 2007-03-01 Niels Möller * configure.ac: Changed version "number" to 2.9-exp. * src/Makefile.am (EXTRA_DIST): Added lshg. 2007-02-28 Niels Möller * src/lsh-transport.c: Implemented password authentication, both "password" and "keyboard-interactive". (lsh_transport_packet_handler): Try password authentication if supported. (try_password_auth): New function. (try_keyboard_interactive_auth): New function. (format_userauth_info_response): New function. (send_userauth_info_response): New function. (make_lsh_transport_config): Added support for diffie_hellman_group1_sha1. (start_service): Send hello message. * src/lsh.c (gateway_accept): Send hello message. (process_hello_message): New function. (main): Use process_hello_message. Implies that lsh -B will stay in the forground until after user authentication. Better error handling if connection fails. * src/ssh.h (LSH_HELLO_LINE_LENGTH, LSH_HELLO_VERSION): New constants. Use a fix length line as hello message between local components. * src/werror.c (werror_argp_parser): Don't handle ARGP_KEY_INIT. At the time it is called, state->name is not yet valid. * src/list.c (int_list_member): New function. * src/keyexchange.c (select_algorithm): Use int_list_member. * src/gateway.c (gateway_write_data): New function. (gateway_write_packet): Use it. * src/environ.h.in: Helper programs are in SBINDIR and BINDIR, not LIBEXECDIR. 2007-02-26 Niels Möller * src/lshg: New shell script. * src/Makefile.am (bin_SCRIPTS): Added lshg. 2007-02-13 Niels Möller * src/werror.c (werror_vformat): For %e, use the passed in number, not errno. * src/testsuite/prgrp-timeout.c (main): Close tty before exec. Display a message before the 10s sleep. * src/ssh_write.c (ssh_write_data): Enqueue the given data also in the i/o error case. This is necessary for proper handling of EWOULDBLOCK. * src/lshd-pty-helper.c (process_request): Record errno before calling other functions. 2007-02-08 Niels Möller * src/testsuite/Makefile.am (TIMEOUT_PROGRAM): Pass -n to prgrp-timeout. * src/testsuite/prgrp-timeout.c (main): Don't create a new process group when running interactively, as it will confuse the shell. New option -n. * src/testsuite/functions.sh (spawn_lshd): Use --no-setsid, so that lshd stays in the same process group. * src/lshd.c: New option --no-setsid. * src/lshd-pty-helper.c (process_request): Display a message with the request return code, if it is non-zero. * src/daemon.c (daemon_init): New argument daemon_flags. Skip the call to setsid if DAEMON_FLAG_NO_SETSID is set. * src/testsuite/prgrp-timeout.c: Propagate SIGINT and SIGTERM to child process. 2007-02-07 Niels Möller * src/unix_process.c (send_helper_request): Better error message on EOF. * src/server_pty.c (pty_open_master): Better error messages if grantpt or unlockpt fails. Moved io_set_close_on_exec after grantpt, since it may be implemented be execing a separate (suid) program. * src/testsuite/config/lshd-connection.conf: Don't enable quiet mode. * src/testsuite/prgrp-timeout.c: Include signal.h and string.h. Made the internal functions static. (main): Cast exit_pid to int before printing it. * src/testsuite/Makefile.am (noinst_PROGRAMS): Added prgrp-timeout. (check): Use prgrp-timeout. * src/testsuite/prgrp-timeout.c: New program, used to enforce a timeout and process cleanup when running the tests. 2007-02-06 Niels Möller * src/testsuite/lsh-11-test: Workaround for the broken /bin/sh on Solaris. On Solaris, just exec ksh instead. * src/testsuite/Makefile.am (TS_SH): Added lsh-11-test. * src/testsuite/lsh-11-test: New test, checking environment setup. * src/unix_process.c (exec_shell): Fixed off-by-one error, which broke inheritance of $HOME. * src/lcp: Quote argument to basename. 2007-02-05 Niels Möller * src/transport_read.c (DEBUG_PACKET_HEADER): Disabled this debug output. * src/lshd-pty-helper.c (process_request): Require creds on all messages, only if configure indicates that credentials passing work. They are strictly needed only for utmp handling, to get an authentic pid. (process_request): For PTY_REQUEST_LOGIN, fixed missing break. Require creds. * src/testsuite/lsh-10-test: Skip test if /dev/ptmx doesn't exist. * configure.ac (HAVE_SOCKET_CREDENTIALS_PASSING): Check for working credentials passing. 2007-01-27 Niels Möller * src/transport.c: (format_newkeys): Moved to keyexchange.c. (transport_keyexchange_finish): Don't send the NEWKEYS message here, let keyexchange_finish handle that. * src/keyexchange.c (format_newkeys): Moved from transport.c. (keyexchange_finish): Generate the newkeys packet here, after checking for weak keys. Skip the TRANSPORT_WRITE_FLAG_PUSH when sending this packet; otherwise any added IGNORE packet will be encrypted with the wrong keys. Instead, try pushing the packet out after the new keys have been installed. 2007-01-26 Niels Möller * src/client_tcpforward.c (do_channel_open_forwarded_tcpip): Fixed bug in verbose message. 2007-01-11 Niels Möller * src/lshd-userauth.c (read_packet): No need for EINTR loop around lsh_string_read. * src/transport_read.c (read_some): Deleted function. (class transport_read_state): Inherit ssh_read_state. * src/service_read.c (read_some): Deleted function. (class service_read_state): Inherit ssh_read_state. * src/transport.c: enum transport_read_status replaced by ssh_read_status. * src/gateway.c: enum service_read_status replaced by ssh_read_status. * src/lsh.c (oop_read_service): Likewise. * src/lshd-connection.c (oop_read_service): Likewise. * src/transport_forward.c (oop_read_service): Likewise. * src/transport.h (enum transport_read_status): Deleted, replaced by enum ssh_read_status. * src/service.h (enum service_read_status): Likewise. * src/ssh_read.h (class ssh_read_state): New simpler class, replacing the old and unused file of the same name. It is intended as a base class for service_read_state and transport_read_state, to reduce code duplication. (enum ssh_read_status): New enum. * src/ssh_read.c (ssh_read_some, init_ssh_read_state): New functions. 2007-01-09 Niels Möller * src/ssh_read.c, src/ssh_read.h: Deleted obsolete files. * src/write_packet.c: Deleted obsolete file. 2007-01-05 Niels Möller * src/transport_read.c (transport_read_packet): Debug output in the case that the packet header is invalid. * configure.ac: Disable utmp support if pututline is not available. * src/lshd-pty-helper.c (main): Fixed copy-paste error in error message. 2006-12-08 Niels Möller * src/pty-helper.c (CMSG_SPACE): Fixed typo. 2006-12-06 Niels Möller * src/pty-helper.c (CMSG_LEN, CMSG_SPACE): If fails to define these macros, define them here. * src/lshd-pty-helper.c (init_pty_state): Portability fixes for systems without utmpx. * src/lshd-connection.c: Include , for writev. 2006-12-06 Niels Möller * src/unix_user.c: Deleted obsolete file. 2006-12-05 Niels Möller * src/lshd-pty-helper.c: Attempted to make the utmp/wtmp handling more portable. * configure.ac: When checking for utmp members, first include . * contrib/solpkg.sh.in (datarootdir): New directory variable (for autoconf-2.61). 2006-12-04 Niels Möller * .bootstrap: Commented out linking of install-sh, texinfo.tex, INSTALL and COPYING into the nettle subdirectory. 2006-05-26 Niels Möller * src/lshd_read.c: Deleted unused file. * src/lshd-userauth.c (spawn_helper): Use SOCK_DGRAM for Solaris style ucred passing, otherwise SOCK_STREAM. 2006-05-26 Niels Möller * src/testsuite/functions.sh: Don't use set -e, since it made the cleanup code unreliable. FIXME: Check if any tests depended on this. * src/testsuite/setup-env: Reverted previous change. No -v flag to lsh-make-seed. * src/pty-helper.c: Moved inclusion of sys/types.h and sys/socket.h, from pty-helper.h. (pty_send_message): Check if SCM_CREDENTIALS is defined. (pty_recv_message): Check if SCM_CREDENTIALS or SCM_UCRED is defined, and support both interfaces (for Linux and Solaris, respectively). * src/lshd-pty-helper.c: Include sys/socket.h (main): Use setsockopt SO_RECVUCRED, if available. * configure.ac: Check for ucred.h. 2006-05-25 Niels Möller * src/testsuite/lsh-10-test: Check that the client gets a tty. * src/lshd-userauth.c (spawn_helper): Use SOCK_DGRAM for the pty-helper socketpair. 2006-05-25 Niels Möller * src/testsuite/setup-env: Pass -v flag to lsh-make-seed. * src/lsh-make-seed.c (struct unix_random_source_state): New field start_time. (spawn_source_process): Save process start time. (SOURCE_TIMEOUT): New constant. (get_system): Use a 30 timeout for the select call, and kill processes that run for too long. * src/lshd-userauth.c (start_service): Fixed ENV_MAX handling. 2006-05-23 Niels Möller * src/pty-helper.c (_XPG4_2): Define before including system headers. Needed for CMSG_SPACE and friends on Solaris. * src/service_read.c: Include "io.h". * src/transport_read.c: Likewise. * src/lshd.c (open_ports): Cast second argument to bind to struct sockaddr *. * src/lshd-pty-helper.c (main): Use _WTMP_FILE, when defined. Needed on Solaris. Otherwise, use _PATH_WTMPX. (main): Call setsockopt with SO_PASSCRED only if SO_PASSCRED is defined, which it is on Linux. * src/lshd-connection.c: Include . * src/daemon.c: Include . (getdtablesize): Use INT_MAX, not MAX_INT. * src/arglist.c (arglist_push_optarg): Use malloc + strcpy instead of asprintf, for better portability. 2006-05-23 Niels Möller * src/io.c (io_readable_p): New function, replacing the static function readable_p in service_read.c and transport_read.c. * src/service_read.c (readable_p): Deleted function. (read_some): Use io_readable_p. * src/transport_read.c (readable_p): Deleted function. (read_some): Use io_readable_p. * configure.ac (HAVE_IOCTL_FIONREAD): Improved test. * configure.ac: New check for filio.h. (HAVE_IOCTL_FIONREAD): New check, if ioctl FIONREAD exists, and takes an int argument. 2006-05-19 Niels Möller * src/jpoll.c, src/jpoll.h: Deleted files. * src/Makefile.am (EXTRA_DIST): Deleted jpoll.h and jpoll.c. * configure.ac: Deleted tests for poll.h, sys/poll.h and the poll function. * src/lsh-make-seed.c (get_dev_mem): Deleted function. (main): Deleted call to get_dev_mem. (update_zlib): Deleted function, and the rest of the zlib-related code. (get_system): Rewritten to use select instead of poll. * src/xalloc.c, src/xalloc.h: Some cleanup. (lsh_space_alloc, lsh_space_free, lsh_space_realloc): Don't use these wrapper functions in the !DEBUG_ALLOC case, instead, use xalloc, free and xrealloc directly using some preprocessor hacks. * src/lshd-pty-helper.c (main): Declare argc and argv UNUSED. 2006-05-19 Niels Möller * configure.ac: Deleted canonicalize_file_name check, reverting earlier change. * src/lshd-userauth.c (main): Display a warning if the name of the lshd-connection executable doesn't start with a "/". (canonicalize_file_name): Deleted function, reverting earlier change. (start_service): For simplicity, removed special handling of relative file names and the canonicalize_file_name call. If user insists on using a relative file name, it will be interpreted relative to the logged in user's home directory. * src/lshd-userauth.c (canonicalize_file_name): As a fallback, try implementing canonicalize_file_name on top of the broken realpath function. Not 100% robust. (start_service): Avoid using canonicalize_file_name for absolute filenames. * configure.ac: Check for canonicalize_file_name. * src/lsh-transport.c: Include sys/stat.h. 2006-05-19 Niels Möller * src/testsuite/Makefile.am (EXTRA_DIST): Added configuration files. 2006-05-18 Niels Möller * src/pty-helper.c (pty_send_message, pty_recv_message): Make linux style ucred handling conditional on SCM_CREDENTIALS being defined. * src/pty-helper.h (struct pty_message): Don't depend on the system to define struct ucred, instead, inline a struct with pid, uid and gid. * src/xalloc.h (lsh_realloc): New define. * src/xalloc.c (lsh_space_realloc): New function. * src/parse_config.c (parse_groups): Made group name optional. This change from 2005-09-06 was appearantly lost in the merge. * src/lshd.c (main): Moved call of make_lshd_config after daemon_close_fds. * src/io.c (lsh_pushd): Close fd if stat fails. (lsh_pushd): Set close-on-exec flag on the fd that may be returned in *result. (lsh_pushd): Fixed EINTR handling for fchdir. * src/daemon.c: Don't include wait.h. * src/atoms.in: Deleted serpent-cbc@lysator.liu.se. * src/algorithms.c (all_symmetric_algorithms): Deleted ATOM_SERPENT_CBC_LOCAL. (all_crypto_algorithms): Likewise. 2006-05-16 Niels Möller * src/testsuite/server-config-test.c: New file (merged manually from experimental branch). * src/lshd.c (make_lshd_config): Initialize werror_config. (lshd_config_handler): Pass self->werror_config to child parser. (main): Merged new daemonic handling from main branch. * src/testsuite/functions.sh (spawn_lshd): Use --daemonic option. * Merged experimental branch. Start of branch changes below. 2006-05-11 Niels Möller * src/testsuite/lsh-encrypted-key-test: Disabled test for now. * src/testsuite/login-auth-test: Likewise. 2006-05-09 Niels Möller * src/testsuite/Makefile.am (TS_PROGS): Added server-config-test. * src/lsh-make-seed.c (get_dev_random): Use uint8_t for the read buffer. * src/channel.c (handle_open_confirm): Impose limit on send_max_packet. 2006-05-08 Niels Möller * configure.ac: Set version to lsh-2x1. * src/channel_forward.c: Use CAST_SUBTYPE, not CAST, to allow for subclassing. 2006-02-28 Niels Möller * src/testsuite/setup-env: Create empty utmp and wtmp files. * src/testsuite/lcp-test: Updated to use new gateway interface. * src/testsuite/functions.sh (LSHD_PTY_HELPER, LSHD_UTMP) (LSHD_WTMP): Define and export. (run_lsh): Moved -nt flag before $LSH_FLAGS, so it can be overridden. (exec_lsh, exec_lshg): Removed -nt flag, as no tty is the default behaviour. * src/testsuite/Makefile.am (TS_SH): Added lsh-10-test. * src/lshd-userauth.c (lookup_group): New function. (spawn_helper): New function. (main): Start a helper program, and pass an fd connected to the helper to the started service, using the --helper-fd option. * src/lshd-connection.c (lshd_connection_config): New class. (class connection): New attribute config. (make_connection): New argument config. Enable pty support. (make_lshd_connection_config): New function. (OPT_HELPER_FD): New constant. (main_options): New options struct, and new option --helper-fd. (main_argp_parser): New function. (main_argp): Include new options. (main): Use make_lshd_connection_config, and pass configuration to make_connection. * src/io.h (SHUT_RD_UNIX, SHUT_WR_UNIX, SHUT_RD_WR_UNIX): Deleted. * src/io.c (fd2info): Deleted. (lsh_make_pipe): Don't use SHUT_RD_UNIX and SHUT_WR_UNIX. (choose_address, io_resolv_address, address_info2sockaddr): #if:ed out. 2006-02-27 Niels Möller * src/format.c (ssh_format): Fixed bug for the case DEBUG_ALLOC && !__GNUC__. (write_decimal_length): Deleted function. (format_decimal): Made static. (format_string): New function, for the common parts of ssh_vformat_write. Includes the code from... (format_hex_string): Deleted function. (ssh_vformat_write): Deleted the feature of including a sexp-style decimal length, "3:foo". Unified handling of %s, %S and %z, using the new function format_string. * src/exception.c (make_exception_handler) (make_report_exception_info): Deleted. (class report_exception_handler): Deleted. (do_report_exception_handler, make_report_exception_handler): Deleted. * src/command.h (CONTINUATION_USED_P): Deleted. (class catch_report_collect): Deleted. (STATIC_CATCH_REPORT): Deleted. (PROGN, PROTECT): Deleted. * src/command.c (class parallell_progn): Deleted. (do_parallell_progn, make_parallell_progn) (progn_command): Deleted. (class catch_handler_info): Deleted. (make_catch_handler_info): Deleted. (class catch_handler): Deleted. (do_catch_handler, make_catch_handler): Deleted. (class catch_apply): Deleted. (do_catch_apply, make_catch_apply): Deleted. (class catch_report_apply): Deleted. (do_catch_report_apply, make_catch_report_apply) (do_catch_report_collect): Deleted. (class protect_handler): Deleted. (do_exc_protect_handler, make_protect_exception_handler) (protect_command): Deleted. * src/unix_process.c: Deleted old code to handle utmp and wtmp. That work is now delegated to a helper process, which can run with sufficient privileges. (make_unix_process): Made static. (send_helper_request): New function. (class logout_notice): New attributes helper_fd and helper_ref. (do_logout_notice): Send a PTY_REQUEST_LOGOUT to the helper process. (exec_shell): Made static. (spawn_error): New arguments helper_fd and helper_ref. Send a PTY_REQUEST_DESTROY to the helper process. (make_logout_notice): New arguments helper_fd and helper_ref. (spawn_parent): Pass helper_fd and helper_ref to make_logout_notice. (spawn_child): New arguments helper_fd and helper_ref. Send a PTY_REQUEST_LOGIN to the helper process. (spawn_shell): New arguments helper_fd. Send a PTY_REQUEST_CREATE to the helper process. Pass on helper_Fd and helper_ref to help functions. * src/server_session.c (class server_session): New attribute helper_fd. (make_server_session): Made static. New argument helper_fd. (class open_session): New attribute helper_fd. (do_open_session): Pass helper_fd to make_server_session. (make_open_session): New argument helper_fd. (do_exit_shell): Updated calls of channel_send_request. Cosmetic change to verbose message. (make_pty): Dup the master fd for both stdin and stdout, and leave the fd in the pty_info object intact. (spawn_process): Pass helper_fd to spawn_shell. If we're using a pty, set ignored_error = EIO on the read state correspondign to stdout. If we don't have a separate stderr channel, set channel->sources to 1, not 2. * src/lshg.c: Deleted file. * src/testsuite/lsh-10-test: New testcase, using a pty request. * src/lsh_process.h: Deleted prototypes for make_unix_process and exec_shell, and updated prototype for spawn_shell to include helper_fd. * src/lsh.h (struct catch_report_collect): Deleted forward declaration. * src/lsh.c (do_lsh_default_handler): Don't treat EXC_CHANNEL_REQUEST as an error. (transport_exit_callback): Fixed format strings. (fork_lsh_transport): Deleted if:ed out code. * src/lsh-decode-key.c (lsh_decode_key): Cosmetic changes to werror messages. * src/environ.h.in: Changed "_CONFIG_FILE" to "_CONF" in the names of environment variables. (FILE_LSHD_PTY_HELPER, ENV_LSHD_PTY_HELPER): New constants. (ENV_LSHD_UTMP, ENV_LSHD_WTMP): Likewise. * src/client_pty.c (class pty_request): Inherit command. (do_client_winch_handler): Use channel_send_request. (format_window_change): Deleted function. (do_pty_continuation): Use the session's resource list; a general channel no longer includes a resource list. (do_pty_request): New function, replacing do_format_pty_request. (do_format_pty_request): Deleted function. (make_pty_request): Update for changed inheritance. * src/client.h (class client_session): New attribute with the channel's resources. Needed for the pty support. * src/client_session.c (do_kill_client_session): Kill associated resources. (make_client_session_channel): Initialize resource list. * src/client.c: Cosmetic changes to werror messages. (request_shell, do_session_channel_request): Pass a NULL ctx to channel_send_request. (client_maybe_pty): Enabled pty allocation. * src/channel_io.h (class channel_read_state): New attribute ignored_error. * src/channel_io.c (init_channel_read_state): Initialize ignored_error. (channel_io_read): If ignored_error is non-zero, tread read errors with matching errno as EOF. (channel_io_write, channel_io_flush): Fixed werror format string. * src/channel.c (handle_channel_success, handle_channel_failure): Use the command_context associated with the request, if it's non-NULL. (format_channel_request_i): Deleted function. (channel_send_request): Changed arguments to include a want_reply flag and a struct command_context *. * src/Makefile.am: Deleted lshg rules. (liblsh_a_SOURCES): Added client_pty.c. * src/lshd-pty-helper.c: Rewritten. Uses the functions in pty-helper.c. Handle utmp and wtmp. * src/pty-helper.h: New file. * src/pty-helper.c: New file. 2006-02-23 Niels Möller * src/testsuite/lshg-1-test: Use --start-gateway. Don't use need_lshg. * src/testsuite/lshg-cat-2-test: Likewise. * src/testsuite/lshg-cat-test: Likewise. * src/testsuite/lshg-tcpip-local-test: Likewise. * src/testsuite/rapid7-lshd-test: Less verbosity. * src/testsuite/rapid7-lsh-test: Likewise. * src/testsuite/functions.sh: Use new gateway flags. Deleted function need_lshg. * src/lsh.c (class lsh_connection): Renamed, was connection. New attribute gateway_connections. (oop_read_service): Fixed cut and paste errors in error messages. (make_lsh_connection): Initialize gateway_connections. (gateway_accept): New command. (expr make_gateway_setup): Moved from gateway_commands.c. (class lsh_options): New attributes, use_gateway, start_gateway, stop_gateway, and gateway. (make_options): Initialize gateway related attributes. (main_options): Use an enum to define option values. New options --use-gateway, --no-use-gateway, -G, --start-gateway, --stop-gateway. (main_argp_parser): Handle gateway related options. (fork_lsh_transport): Return a plain fd, not an object. (main): Start and stop gateway, as appropriate. Use a loop with object_queue_is_empty and object_queue_remove_head, instead of the FOR_OBJECT_QUEUE macro. * src/gateway_channel.c: Much of the old implementation deleted. (class gateway_channel): New class. (do_kill_gateway_channel): New function. (do_receive): Use channel_transmit_data and channel_transmit_extended, on the chained channel. (do_send_adjust): Use channel_adjust_rec_window. (do_gateway_channel_event): New function. (do_gateway_channel_request): New function. (do_gateway_channel_success): New function. (do_gateway_channel_failure): New function. (gateway_request_methods): New method struct. (make_gateway_pair): New function. (gateway_handle_channel_open): New function. (gateway_packet_handler): New function. * src/gateway.h (class gateway_connection): New class. * src/gateway.c (kill_gateway_connection): New function. (gateway_write_packet): New function. (gateway_disconnect): New function. (oop_read_gateway): New function. (gateway_start_read): New function. (do_write_packet): New function. (do_disconnect): New function. (make_gateway_connection): New function. * src/client_tcpforward.c (open_direct_tcpip_command): Don't setup any channel_open_context. * src/client.c (do_exit_status): Updated for const channel_request_info. (do_exit_signal): Updated for const channel_request_info. Use enum lsh_atom. (class session_open_command): New class, replacing command of the same name. (do_open_session_command): Don't setup any channel_open_context. (make_open_session_command): New function. (request_shell): Pass non-zero close_on_error to channel_send_request. Mark continuation and exception arguments as UNUSED. (do_session_channel_request): Likewise. (client_options): Cosmetic changes. (expr make_start_session): Deleted. (client_shell_session, client_subsystem_session) (client_command_session): Use request queue in client_session object. (make_client_session): Changed return type to struct client_session *. * src/client_session.c (do_client_session_event): On CHANNEL_EVENT_CONFIRM, send all queued channel requests. On CHANNEL_EVENT_DENY, raise an exception. On CHANNEL_EVENT_CLOSE, do nothing. * src/client.h (class client_session): Moved definition here, from client_session.c. New queue of requests to send. New attribute with an exception handler to use for failed CHANNEL_OPEN and CHANNEL_REQUEST. * src/server_session.c (do_server_session_event): Handle and ignore CHANNEL_EVENT_CLOSE and CHANNEL_EVENT_DENY. (do_exit_shell): Updated call to channel_send_request. (shell_request_handler, exec_request_handler): Updated for const channel_request_info. (pty_request_handler): Likewise. * src/server_tcpforward.c (open_forwarded_tcpip_command): Don't setup any channel_open_context. * src/socks.c (class socks_channel): Replaces class socks_connection, and inherits channel_forward. (class socks_continuation): Deleted. (do_socks_continuation, make_socks_continuation): Deleted. (class socks_exception_handler): Deleted. (do_exc_socks_handler, make_socks_exception_handler): Deleted. (do_socks_channel_event): New function, in particular handling CHANNEL_EVENT_CONFIRM and CHANNEL_EVENT_DENY. * src/channel_forward.c (channel_forward_shutdown): Made non-static. (channel_forward_start_read): New function. (channel_forward_start_io): Use channel_forward_start_read. (do_channel_forward_event): Use channel_forward_start_read. Recognize CHANNEL_EVENT_DENY and CHANNEL_EVENT_CLOSE, and do nothing. (init_channel_forward): Take event handler as argument. (make_channel_forward): Pass do_channel_forward_event to init_channel_forward. (forward_open_report, catch_channel_open): Deleted. * src/channel.h (format_channel_close, format_channel_eof): Deleted prototypes. * src/channel.c: Generally, use ssh_connection_lookup_channel with type CHANNEL_ALLOC_ACTIVE. (format_open_confirmation, format_open_failure) (format_channel_success, format_channel_failure) (format_channel_window_adjust): New function. (lookup_channel, lookup_channel_reserved): Deleted, replaced by ssh_connection_lookup_channel. (ssh_connection_register_channel): Renamed, was register_channel. (send_window_adjust): New function, replacing prepare_window_adjust. (channel_adjust_rec_window, channel_start_receive): Use send_window_adjust. (handle_global_request): Use enum lsh_atom. (handle_channel_request): Use request_methods, if non-NULL. Treat a request on non-existing channel as a protocol error. (do_channel_open_continue): Use ssh_connection_register_channel and ssh_connection_activate_channel. (do_exc_channel_open_handler): Updated for in_use / alloc_state renaming. (handle_channel_open): Don't use open_fallback handler. Use type CHANNEL_ALLOC_RECEIVED_OPEN when allocating the channel number. (handle_channel_close): Generate CHANNEL_EVENT_CLOSE. (handle_open_confirm): Use ssh_connection_activate_channel. Don't use channel_open_context. (handle_open_failure): Use ssh_connection_lookup_channel with type CHANNEL_ALLOC_SENT_OPEN. Generate CHANNEL_EVENT_DENY. Don't use channel_open_context. (handle_channel_success, handle_channel_failure): Use request_methods if non-NULL. For now, don't invoke any continuation or exception. (init_channel): Updated initialization for added and removed attributes. (channel_transmit_data): Use format_channel_data. (channel_transmit_extended): Use format_channel_extended_data. (channel_open_new_v): Alloc channel with type CHANNEL_ALLOC_SENT_OPEN. Call ssh_connection_register_channel. (channel_open_new_type): Replaced type argument, an atom, with length and const uint8_t * (channel_send_request): Replaced the context argument with a flag saying if the channel should be closed on failure. * src/channel.h (enum channel_event): New event types CHANNEL_EVENT_DENY and CHANNEL_EVENT_CLOSE. (struct channel_request_info): Use enum lsh_atom for the type. (struct channel_request_methods): New struct, used by gateway channels to replace the handling of channel requests. (class ssh_channel): New attribute request_methods. Deleted request_fallback and channel_open_context. (class channel_request): Made the struct channel_request_info * argument const. * src/connection.c (init_ssh_connection): Initialize alloc_state. (ssh_connection_alloc_channel): Added type argument. Proper reallocation of alloc_state. (ssh_connection_dealloc_channel): Updated for in_use / alloc_state renaming. (ssh_connection_activate_channel): Renamed function, was ssh_connection_use_channel. (ssh_connection_lookup_channel): New function, replacing lookup_channel and lookup_channel_reserved in channel.c. * src/connection.h (enum channel_alloc_state): New name for enum. Replaced CHANNEL_RESERVED and CHANNEL_IN_USE with three values, CHANNEL_ALLOC_SENT_OPEN, CHANNEL_ALLOC_RECEIVED_OPEN, and CHANNEL_ALLOC_ACTIVE. (class ssh_connection): Deleted open_fallback. Renamed array in_use to alloc_state. * src/gateway_channel.h: Deleted obsolete file. * src/gateway_commands.h: Likewise. * src/gateway_commands.c: Likewise. * src/debug.c: Likewise. * src/resource.c (resource_iterate): New function. (do_mark_resources): Use resource_iterate. (resource_list_foreach): New function. (kill_resource): New function. (do_kill_resource_list): Renamed, was do_kill_all. Use resource_list_foreach. * src/ssh.h (SSH_LSH_GATEWAY_STOP): New, local, message number. * src/charset.c: No longer includes format.h. * src/io_commands.c (listen_tcp_command): Use io_bind_sockaddr. (listen_local_command): New command. * src/io.c (io_bind_local, io_connect_local): Changed to return a plain fd, no lsh_fd object. (io_bind_sockaddr): New function, used for both AF_LOCAL and AF_INET sockets. * src/lsh_string.c (lsh_string_dup): New function, replacing... * src/format.h (lsh_string_dup): ... deleted macro. * src/dsa.c (do_dsa_verify, make_ssh_dss_verifier): Use enum lsh_atom. * src/rsa.c (do_rsa_verify, make_ssh_rsa_verifier): Likewise. * src/lsh-decode-key.c (lsh_decode_key): Likewise. * src/lshd-userauth.c (get_verifier, handle_publickey) (handle_userauth): Likewise. * src/spki.c (spki_algorithm_lookup): Likewise. * src/sexp.c (lsh_sexp_to_atom, lsh_sexp_get_type): Return enum lsh_atom, not int. * src/process_atoms: For the header file, generate an enum, not a list of #define:s. * src/parse.c (parse_atom, parse_next_atom): Use enum lsh_atom for result. (parse_atoms): Convert from enum lsh_atom to int, when constructing the list. * src/atoms.in: Deleted unused spki-related atoms, p, q, g, y, x, r, s, n, e, d, a, b, c. * src/atoms.h (ATOM_LD): New macro. * src/atoms.c (lookup_atom): Return enum lsh_atom, not int. * src/Makefile.am (sbin_PROGRAMS): Added lshd-pty-helper. (liblsh_a_SOURCES): Added gateway.c and gateway_channel.c. * src/lshd-pty-helper.c: New program. * src/server_config.h: Fixed include guard. * src/tokenize_config.h: Likewise. * src/arglist.h: Added missing include guard. * src/channel_io.h: Likewise. * src/lock_file.h: Likewise. * src/environ.h.in: Likewise. * src/transport_forward.h: Likewise. 2006-02-14 Niels Möller * src/testsuite/parse-config-test.c (test_main): Pass dummy file name to config_parse_string. * src/testsuite/lshd-random-input-test: Use "localhost" instead of $INTERFACE. * src/testsuite/rapid7-lshd-test: Likewise. * src/testsuite/lshd-no-auth-test: Deleted --interface option. * src/lshd_keyexchange.c: Deleted obsolete file. * src/Makefile.am (lsh_execuv_LDADD): Deleted. * src/unix_process.c (format_env_pair): Use const char * for the value. (format_env_pair_c): Deleted. (exec_shell): Updated for above changes. * src/transport_forward.c: Adapted event handler functions to return void. (oop_read_service): Fix cut and paste error, should use SERVICE_READ_PUSH and SERVICE_READ_PENDING, not TRANSPORT_READ_*. * src/transport.c (format_newkeys): Moved function here, and made static. Used to be in format.c. (transport_close): Clarified comment on disconnect handling. The event handler no longer returns and value for TRANSPORT_EVENT_CLOSE. Simplified logic deciding if the connection should be closed immediately, or if we should allow some time for the buffer to drain. * src/server_session.c (make_server_session): Cleanup of initialization. (init_spawn_info): Now plain const char * is used for environment values. (shell_request_handler): Deleted FIXME comment. (lookup_subsystem): Deleted function, replaced by server_lookup_module. (do_spawn_subsystem): Use server_lookup_module. * src/lshd.c (lshd_event_handler): Return void. (lookup_service): Deleted function, replaced by server_lookup_module. (lshd_service_request_handler): Use server_lookup_module. * src/server.c (server_lookup_module): New function, replacing lookup_service and lookup_subsystem. * src/lsh_string.h: Added include guards. Declare lsh_string_colonize, lsh_string_bubblebabble_c and lsh_string_bubblebabble. * src/lsh_string.c (lsh_string_colonize) (lsh_string_bubblebabble_c, lsh_string_bubblebabble): Functions moved here, used to be in format.c. * src/lsh_process.h (struct env_value): Use a const char * for the value. * src/lsh-transport.c (lsh_transport_event_handler): Changed return type to void. (lsh_transport_lookup_verifier): Use spki_add_acls. (read_host_acls): Use spki_add_acls. * src/spki.c (spki_add_acls): New function, replacing spki_add_acl. The new function takes a string as argument, containing zero or more acls. * src/transport.h (class transport_connection): Changed the event_handler method to return void. * src/keyexchange.c (parse_kexinit, format_kexinit) (do_make_simple_kexinit): Use sizeof to get the size of kex->cookie, instead of hardcoding the value 16. * src/format.c (ssh_vformat_length): Removed support for negative numbers. (ssh_vformat_write): Likewise. (format_newkeys): Function moved to transport.c. (lsh_string_colonize): Function moved to lsh_string.c. (lsh_string_bubblebabble_c): Likewise. (lsh_string_bubblebabble): Likewise. * src/dsa.c (DSA_BLOB_LENGTH): New constant. (dsa_blob_length): Deleted function. (dsa_blob_write): Deleted length argument. (do_dsa_sign): Use a constant size DSA_BLOB_LENGTH for writing r and s. * src/channel_io.c (init_channel_read_state) (init_channel_write_state): Let fd < 0 mean that no buffer should be allocated yet. 2006-02-13 Niels Möller * src/testsuite/functions.sh (LSHD_CONFIG_DIR): Set and export. (INTERFACE): Deleted variable. * src/testsuite/config/lshd-connection.conf: New file. * src/testsuite/config/lshd-userauth.conf: New file. * src/testsuite/config/lshd.conf: New file. * src/.dist_classes (dist_classes): Added lshd-userauth.c.x, server.h.x and werror.h.x. * src/Makefile.am (sbin_PROGRAMS): Deleted lsh-execuv. (liblsh_a_SOURCES): Added server_config.c and tokenize_config.c. * src/lshd.c (class lshd_configuration): Split in two classes, lshd_config and lshd_context. (lshd_packet_handler): Improved trace message. Never dump userauth packets to the log. (class lshd_port): Use lshd_context class. (open_ports): Likewise. (make_lshd_context): New function. (class pid_file_resource): Use a proper string for saving the file name. (class lshd_config): New class. (make_lshd_config): New function. (main_options): Use uppercase for metasyntactic variables in help output, to match other GNU programs. (main_argp_children): Use server_argp as a child parser, making werror_argp a grand child. (main_argp_parser): At ARGP_KEY_INIT, set up child_inputs. At ARGP_KEY_END, key handling etc has been moved to after the configuration file is parsed, in lshd_config_handler. (lshd_config_options): New config file keywords. (lshd_config_handler): New function. (lshd_config_children, lshd_config_parser): New constant structs. (main): Adapted to lshd_config/lshd_context split. * src/lshd-userauth.c (start_service): Propagate $LSHD_CONFIG_DIR to the new process. (main_argp_children): Use server_argp as child parser, which makes werror_argp a grand child. (class lshd_userauth_config): New class, inheriting server_config. (make_lshd_userauth_config): New function. (main_argp_parser): At ARGP_KEY_INIT, setup child_inputs[0]. (main): Use make_lshd_userauth_config. Deleted hack to unconditionally pass -v and --trace to the child process. * src/lshd-connection.c (main_argp_children): Use server_argp as child parser, which makes werror_argp a grand child. (main): Use make_server_config, with configuration file pointer out by FILE_LSHD_CONNECTION_CONF and ENV_LSHD_CONNECTION_CONFIG_FILE. * src/transport.c (transport_process_packet): Improved trace message. * src/server.c (server_parse_config_file): New function. (init_server_config, make_server_config): New functions. (server_argp): New config file parser, responsible for options related to the configuration files, and for processing of the configuration file. * src/lsh.c (main_argp_children): werror_argp is no longer a direct child parser, it's a grand child via client_argp. (main_argp_parser): At ARGP_KEY_INIT, no longer set child_inputs[1]. At ARGP_KEY_END, deleted old transport-level setup which has been moved to lsh-transport.c. (fork_lsh_transport): Examing the werror_config object to figure out which flags to pass on, instead of using the global variables quiet_flag and friends. * src/lsh-transport.c (class lsh_transport_config): Include a pointer to a werror_config. (make_lsh_transport_config): Use make_werror_config. (lsh_transport_packet_handler): Use debug, not werror, for dumping packet contents. (lsh_transport_lookup_verifier): Use werror_quiet_p. (main_argp_parser): At ARGP_KEY_INIT, set child_inputs[1]. At ARGP_KEY_END, call werror_init. * src/client.c (do_exit_signal): Use int type for signal. (init_client_options): Call init_werror_config. (quiet_callback, verbose_callback, trace_callback) (debug_callback): Call the correspnding toggle_* function. (client_argp_parser): At ARGP_KEY_INIT, set child_inputs[0]. At ARGP_KEY_END, call werror_init. (client_argp_children, client_argp): Use werror_argp as a child parser. * src/client.h (class client_options): Inherit werror_config. * src/xauth.c: Deleted obsolete xauth parsing code. * src/xalloc.h (number_of_strings): Deleted declaration. * src/werror.h (class werror_config): New class. * src/werror.c (trace_flag, debug_flag, quiet_flag, verbose_flag): Made static. (toggle_quiet, toggle_verbose, toggle_trace, toggle_debug): New functions. (set_error_syslog): Deleted argument. (werror_format): Made non-static. (werror_quiet_p, init_werror_config, make_werror_config): New functions. (werror_init): New function. (werror_config_parser): New configuration file parser. * src/unix_interact.c (read_password): Use werror_quiet_p. (unix_yes_or_no): Don't check for quiet mode; let the caller do that. * src/io_commands.c (command listen_command): Deleted. (resolve_exception):Deleted. (command bind_address_command): Deleted. (command bind_local_command): Deleted. (class connect_continuation): Deleted. (do_connect_continuation): Deleted. (make_connect_continuation): Deleted. (do_connect): Deleted. (class connect_port): Deleted. (do_connect_port): Deleted. (make_connect_port): Deleted. (command connect_simple_command): Deleted. (command connect_list_command): Deleted. (command connect_connection_command): Deleted. (command connect_local_command): Deleted. * src/lsh_string.c (lsh_string_put_base64_single): Deleted unused function. * src/srp-gen.c (class srp_gen_options): Inherit werror_config. (make_srp_gen_options): Call init_werror_config. (main_argp_parser): At ARGP_KEY_INIT, set child_inputs[0]. At ARGP_KEY_END, call werror_init. * src/lsh-decode-key.c: Analogous changes. * src/lsh-decrypt-key.c: Analogous changes. * src/lsh-export-key.c: Analogous changes. * src/lsh-keygen.c: Analogous changes. * src/lsh-writekey.c: Analogous changes. * src/lsh-make-seed.c: Analogous changes. (main): Use werror_quiet_p. * src/parse_config.c: Tokenizer code moved to a separate file, tokenize_config.c. (config_parse_string): Added file name argument. * src/exception.h (class report_exception_info): Deleted. (make_report_exception_info): Deleted. (STATIC_REPORT_EXCEPTION_INFO): Deleted. (make_report_exception_handler): Deleted. (make_exception_handler): Deleted. (class protocol_exception): Deleted. (make_protocol_exception): Deleted. (STATIC_PROTOCOL_EXCEPTION): Deleted. (PROTOCOL_ERROR): Deleted. (PROTOCOL_ERROR_DISCONNECT): Deleted. * src/exception.c (default_exception_handler): Deleted. (make_protocol_exception): Deleted. * src/environ.h.in (FILE_LSHD_CONFIG_DIR, FILE_LSHD_CONF) (FILE_LSHD_USERAUTH_CONF, FILE_LSHD_CONNECTION_CONF) (ENV_LSHD_CONFIG_DIR, ENV_LSHD_CONNECTION_CONFIG_FILE) (ENV_LSHD_USERAUTH_CONFIG_FILE): New string constants. * src/dh_exchange.c (dh_make_client_msg, dh_process_server_msg): Deleted obsolete functions. * src/connection.c (kill_ssh_connection): Deleted obsolete function. * src/client_session.c (client_start_io): Deleted obsolete command. (make_client_session_channel): Comment fix. * src/channel_forward.c (channel_forward_start_io_read): Deleted obsolete function. * src/channel.c (lookup_channel, lookup_channel_reserved): Made static. * src/algorithms.c (algorithms_options): Use uppercase for metasyntactic variables in help output, to match other GNU programs. * src/tokenize_config.h: New file. * src/tokenize_config.c: New file. * src/server_config.h: New file. * src/server_config.c: New file. * src/handshake.c, src/handshake.h, src/lsh-execuv.c, src/oop-line-file.c, src/oop-line.h: Removed obsolete files. * configure.ac: For gcc-4.x, add -Wno-pointer-sign to CFLAGS. 2005-10-10 Niels Möller * src/.dist_classes (dist_classes): Removed a bunch of obsolete class files. * src/client_userauth.c: Deleted file. * src/client_userauth.h: Deleted file. 2005-10-10 Niels Möller * src/client.c (client_argp_parser): Enable socks forwarding. * src/Makefile.am (liblsh_a_SOURCES): Added socks.c. * src/socks.c: Adapted to new i/o and channel_forward interfaces. 2005-10-09 Niels Möller * src/io.c: Deleted obsoleted functionality. (class io_listen_callback): Deleted class. (do_listen_callback, make_listen_callback): Deleted functions. (class io_connect_callback): Deleted class. (do_connect_callback, make_connect_callback): Deleted functions. (do_kill_fd, do_exc_io_handler): Deleted functions. (read_raw): Deleted function. (io_connect): Deleted old connect interface. (do_connect_list_kill, make_connect_list_state): Deleted functions. (class connect_list_callback): Deleted class. (connect_attempt, do_connect_list_callback) (make_connect_list_callback, io_connect_list): Deleted functions. (io_bind_sockaddr, io_listen, io_listen_list): Deleted old listen interface. (io_read_write, io_read, io_write): Deleted old constructors. (class write_only_file)): Deleted class. (io_write_file): Deleted function. (close_fd, close_fd_nicely, close_fd_read, close_fd_write): Deleted old close interface. (class exc_finish_read_handler)): Deleted class. (finish_read_exception, finish_io_exception): Deleted exceptions. (make_io_exception): Deleted function. * src/io.h (connect_list_state): Deleted class. * src/Makefile.am (liblsh_a_SOURCES): Removed string_buffer.c. * src/io.c: Don't include string_buffer.h. (io_read_file_raw): Use lsh_string_realloc, not the string_buffer abstraction. * src/lsh_string.c (lsh_string_realloc): New function. * src/string_buffer.c, src/string_buffer.h: Deleted files. 2005-10-09 Niels Möller * src/gateway_commands.c: Don't include connection_commands.h. * src/lsh.c: Likewise. * src/socks.c: Likewise. * src/connection_commands.c, src/connection_commands.h: Deleted files. * src/tcpforward_commands.c: Deleted file. * src/tcpforward.h: Deleted old declarations. (forward_remote_port): New declaration. * src/tcpforward.c: Deleted old tcpforwarding code. * src/server_tcpforward.c (do_tcpip_forward_request_continuation): Fixed assert. * src/server_session.c: Don't include channel_commands.h. (format_exit_signal, format_exit): Deleted functions. (do_exit_shell): Use channel_send_request. * src/lsh.c: Enabled remote port forwarding. (main): Add handler for CHANNEL_OPEN "forwarded-tcpip". * src/client_pty.c: Don't include channel_commands.h. * src/gateway_channel.c: Likewise. * src/server_x11.c: Likewise. * src/tcpforward.c: Likewise. * src/client_tcpforward.c (forward_remote_port): Reimplemented. * src/client_session.c: Include channel.h, not channel_commands.h. * src/client.h: Don't include channel_commands.h. (request_service): Deleted class. * src/client.c (request_shell): Use channel_send_request. (session_channel_request): New class, replacing exec_request and subsystem_request. (do_session_channel_request, make_session_channel_request): New functions, using channel_send_request. (make_exec_request, make_subsystem_request): Use make_session_channel_request. (client_parse_forward_arg): Use client_arg_unsigned. * src/channel_commands.c: Deleted file. * src/channel_commands.h: Deleted file. * src/channel.c (channel_send_request) (channel_send_global_request): New functions. (format_channel_request, format_global_request): Deleted functions. * src/Makefile.am (liblsh_a_SOURCES): Removed channel_commands.c. 2005-10-07 Niels Möller * src/tcpforward.h (remote_port): Removed class. Replaced by new version in client_tcpforward.c. * src/server_tcpforward.c (do_channel_open_direct_tcpip): Fixed messages. * src/server.h (make_offer_service): Deleted prototype. * src/exception.h: Deleted old definition of exception type constants. * src/client_tcpforward.c (make_remote_port): New function. (do_channel_open_forwarded_tcpip): New function. (class remote_port): New class. Both replace older versions in tcpforward.c * src/channel_commands.h (class channel_open_command): Deleted class. * src/channel_commands.c (do_channel_open_command): Deleted function. * src/testsuite/functions.sh (need_lshg): New function. * src/testsuite/lshg-1-test: Skip test if lshg isn't built. * src/testsuite/lshg-cat-2-test: Likewise. * src/testsuite/lshg-cat-test: Likewise. * src/testsuite/lshg-tcpip-local-test: Likewise. * src/client.c (client_parse_forward_arg): Use io_lookup_address. (client_argp_parser): Use forward_local_port (renamed). * src/tcpforward.c (class tcpforward_connect_state): New class. (tcpforward_connect_done, tcpforward_connect_error) (tcpforward_connect): New functions, using the new io_connect interface. * src/tcpforward.h (TCPIP_WINDOW_SIZE): Moved constant definition here. * src/client_tcpforward.c (open_direct_tcpip_command): Call io_register_fd. Added trace message. (expr forward_local_port): Reverted earlier renaming, was called tcpforward_direct_tcpip. * src/server_tcpforward.c (open_forwarded_tcpip_command): Call io_register_fd. (do_channel_open_direct_tcpip): New function, replacing the old one in tcpforward.c. Uses tcpforward_connect. * src/server_session.c (do_server_session_event): Ignore CHANNEL_EVENT_CONFIRM. * src/lshd-connection.c (make_connection): Enabled direct-tcpip. * src/io.c (kill_io_connect_state, init_io_connect_state) (oop_io_connect): New functions. (io_connect): New different interface, using class io_connect_state. (get_portno): Changed return type to unsigned. (io_make_sockaddr): Bug fixes. Now it seems to actually work. (io_lookup_address): New function. * src/io.h (class io_connect_state): New class. * src/channel_forward.c (init_channel_forward): Don't call io_register_fd; it's now the responsibility of the caller. * src/channel.c (do_channel_open_continue): Generate a CHANNEL_EVENT_CONFIRM. 2005-10-06 Niels Möller * src/io_commands.c (listen_tcp_command): Use io_make_sockaddr. * src/io.c (io_make_sockaddr): New function. * src/transport_write.c: Include werror.h, needed for trace. * src/lshd.c (class lshd_configuration): Renamed, was configuration. Merged attributes from class lshd_options. (class lshd_options): Deleted class. (main_argp_children): Use algorithms_argp as a child parser. (main_argp_parser): When handling ARGP_KEY_END, read host key, and set up kexinit according to the algorithm options. 2005-09-22 Niels Möller * src/Makefile.am (liblsh_a_SOURCES): Added client_tcpforward.c and server_tcpforward.c. Removed tcpforward_commands.c. * src/tcpforward_commands.c: Code related to direct-tcpip moved to client_tcpforward.c. * src/tcpforward.c: Code related to tcpip-forward moved to server_tcpforward.c. (tcpforward_lookup): Renamed, was lookup_forward, and made non-static. (tcpforward_remove_port): New function. * src/server_tcpforward.c: New file. Moved handling of remote port forwarding here, including open_forwarded_tcpip_command and tcpip_forward_handler. * src/lshd-connection.c (make_connection): Enable global request handlers for tcpip-forward and cancel-tcpip-forward. * src/connection.c (init_ssh_connection): Initialize connection->forwarded_ports. * src/connection.h (class ssh_connection): Replaced remote_ports and local_ports with a single queue forwarded_ports.. * src/client.c (client_argp_parser): Use tcpforward_direct_tcpip, not forward_local_port. * src/client_tcpforward.c: New file. Moved open_direct_tcpip_command and tcpforward_direct_tcpip. The latter used to be called forward_local_port. 2005-09-21 Niels Möller * src/command.h (class command_2): Changed invoke to be a plain function pointer, not a method. (COMMAND_2_INVOKE): Deleted macro. (DEFINE_COMMAND2): Deleted unused first argument. Updated all users. * src/command.c (do_command_2_invoke): Don't pass self when using the invoke function pointer. * src/unix_process.c (class utmp_cleanup): Commented out class. * src/reaper.c (reaper_handle): Added trace message. * src/lsh_proxy.c: Deleted file. Also deleted all other proxy*.c and proxy*.h files. * src/lsh.c (do_lsh_default_handler): Display errno string, for i/o errors. (fork_lsh_transport): Pass on -p option only if actually provided on the command line. * src/keyexchange.c (handle_kexinit): Fixed update to self->read_state. * src/Makefile.am (liblsh_a_SOURCES): Readded tcpforward_commands. * src/scm/gaba.scm (c-prototype, c-prototype*): New argument for the storage type. Updated callers. (process-expr): New storage attribute. * src/transport_write.c (transport_write_packet): Trace call to display sent message type. * src/transport.c (transport_process_packet): USe trace, not debug, for received message type. * src/tcpforward_commands.c (open_direct_tcpip_command): New command. (forward_local_port): Use it. #if:ed out the old code. * src/tcpforward.h (forward_local_port): Declare. #if:ed out the rest of the declarations. * src/socks.c (make_socks_server): Deleted wrapper function. Renamed expression forward_socks -> make_socks_server. * src/lshg.c (expr make_lshg_connect): Marked static. * src/server_x11.c (expr server_x11_callback): Likewise. * src/io_commands.c (listen_tcp_command): Reordered arguments, callback comes first. * src/gateway_commands.c (make_gateway_setup): Deleted wrapper function. Renamed expression gateway_setup -> make_gateway_setup. * src/connection.c (connection_remember): Moved command here. Use CAST_SUBTYPE. Moved from... * src/connection_commands.c: ... here. * src/client.c (client_argp_parser): Enable local "-L" port forwarding. (expr make_start_session): Marked as static. * src/channel_io.c (channel_io_read): Call channel_io_stop_read on eof. 2005-09-20 Niels Möller * src/client.c (open_session_command): New command. (class session_open_command): Deleted class. (new_session, make_open_session_command): Deleted functions. (expr make_start_session): First argument is now the session. Updated callers. * src/channel_commands.c (do_channel_open_command): #if:ed out. * src/channel.c (register_channel): Set up channel->connection pointer. Removed corresponding code in callers. (channel_open_new_v, channel_open_new_type): New functions, replacing... (format_channel_open_s, format_channel_open): Deleted functions. * src/abstract_io.c, src/abstract_io.h, src/read_data.c, src/read_data.h, src/read_file.c, src/read_line.c, src/read_line.h, src/read_packet.c, src/read_packet.h, src/write_buffer.c, src/write_buffer.h: Deleted obsolete files. 2005-09-20 Niels Möller * src/server_session.c: Don't include read_data.h. * src/lsh.h (struct abstract_write): Deleted declaration. * src/keyexchange.c: Don't include abstract_io.h. * src/io.h: Don't include abstract_io.h and write_buffer.h. * src/client.c: Don't include abstract_io.h. * src/channel.h: Don't include write_buffer.h. * src/channel.c: Don't include read_data.h. * src/Makefile.am (class-map): Depend on .dist_classes. * misc/make-am: Use C locale, to get files sorted in sane order. * src/server.c: Don't include abstract_io.h, format.h, ssh.h and xalloc.h. Include atoms.h (class service_handler, do_service_request) (make_service_request_handler, class offer_service) (do_offer_service, make_offer_service): Deleted. * src/testsuite/conv-1-test, src/testsuite/conv-2-test, src/testsuite/conv-3-test, src/testsuite/export-1-test, src/testsuite/lsh-cat-test, src/testsuite/lshg-cat-2-test, src/testsuite/lshg-cat-test: Remove test.out1 before the test. * src/testsuite/login-auth-test: Reversed role of test.out1 and test.out2. The latter is the reference data. Remove test.out1 before the test. * src/tcpforward_commands.c (forward_local_port): Sketched new version for improved channel open framework. * src/server_session.c (do_server_session_event): New event handler, replaces do_eof. (spawn_process): If we have a non-zero send_window_size, start reading stdout and stderr right away. * src/connection.h (channel_open_exception): Deleted class. * src/client_session.c (do_client_session_event): New event handler. Replaces do_client_session_eof. Starts i/o on CHANNEL_EVENT_CONFIRM. This change implies we we now enable i/o before we have sent any shell or exec request. * src/client.c (class client_start_session): Deleted. (client_shell_session): Don't use client_start_session. No CAST_SUBTYPE needed when calling make_start_session. (client_command_session): Likewise. (client_subsystem_session): Likewise. * src/channel_forward.c (do_channel_forward_event): New event handler. Replaces do_channel_forward_eof. Calls channel_forward_start_io_read on CHANNEL_EVENT_CONFIRM. * src/channel_commands.c (do_channel_open_command): Set channel_open_context. * src/channel.c (make_channel_open_exception): Use make_exception. (handle_channel_eof): Generate CHANNEL_EVENT_EOF. (handle_open_confirm): Use channel_open_context. Generate CHANNEL_EVENT_CONFIRM. (handle_open_failure): Use channel_open_context. (init_channel): New argument event. * src/channel.h (enum channel_event): New enum. (class ssh_channel): Attributes open_continuation and e replaced by channel_open_context. Method eof replaced by new method event. 2005-09-20 Niels Möller * src/Makefile.am (liblsh_a_SOURCES): Compile io_commands.c. * src/io_commands.c (class io_port): New class. (listen_tcp_command): New command. * src/srp-gen.c (main): Use write_raw. (main_argp_parser): Don't use io_write_file. * src/io.h (enum io_type, class io_callback, class lsh_fd) (io_buffered_read, io_consuming_read, io_exception): Deleted classes. [!SHUTDOWN_WORKS_WITH_UNIX_SOCKETS]: Deleted workaround for old linux bug. (listen_value): Use a raw fd. Deleted local attribute. * src/io.c: Deleted old code. (lsh_oop_fd_read_callback, lsh_oop_register_read_fd) (lsh_oop_cancel_read_fd, lsh_oop_fd_write_callback) (lsh_oop_register_write_fd, lsh_oop_cancel_write_fd) (list_files, do_buffered_read, make_buffered_read) (do_consuming_read, init_consuming_read, do_write_callback) (io_init_fd, make_lsh_fd, io_nfiles): Deleted functions. (make_listen_value): Deleted local argument. Use a raw fd, not struct lsh_fd. * src/exception.h (enum exception_type): EXC_RESOLVE. * src/exception.c: Don't include exception.c.x. * src/client_escape.c (class escape_handler): Commented out class. 2005-09-19 Niels Möller * src/Makefile.am (liblsh_a_SOURCES): Removed read_data.c read_file.c read_line.c. * src/lsh-transport.c: Use global_oop_source. * src/lshd.c: Use global_oop_source. (make_lshd_connection): Deleted redundant function. * src/transport.c: Use global_oop_source. (init_transport_connection): Call io_register_fd. (transport_connection_kill, transport_close): Call io_close_fd. * src/transport_forward.c: Use global_oop_source. * src/transport.h (class transport_context): Deleted attribute oop. global_oop_source should be used instead. * src/server_session.c: Adapted to new simpler exception abstraction. Use SSH_CONNECTION_ERROR. * acinclude.m4 (LSH_GCC_FUNCTION_NAME): Deleted. * configure.ac: Don't use LSH_GCC_FUNCTION_NAME. * src/lsh_string.h (lsh_string_alloc) [DEBUG_ALLOC]: Don't use FUNCTION_NAME. * src/lsh.c (do_lsh_default_handler): Adapted to new simpler exception abstraction. * src/io.c (io_register_fd): Improved trace message. * src/command.c (gaba_apply): Mark continuation with STACK_HEADER. #if:ed out some old exception-related functions. (class protect_handler): New parent attribute (used to be in the super class). * src/client.c (do_exit_status, do_exit_signal): Use SSH_CONNECTION_ERROR. * src/channel_forward.c (catch_channel_open): #if:ed out. * src/channel.c (do_exc_global_request_handler) (make_global_request_exception_handler, handle_global_request) (do_exc_channel_request_handler) (make_channel_request_exception_handler, handle_channel_request) (do_exc_channel_open_handler, make_exc_channel_open_handler) (handle_channel_open, handle_channel_failure): Adapted to new simpler exception abstraction. * src/exception.c: #if:ed out old code. * src/exception.h: Simplified exception class. Now an exception consistd of a type, a subtype, and a message, but no class hierarchy and no type masks. Exception handlers don't have parents by default. (DEFINE_EXCEPTION_HANDLER): New macro. 2005-09-19 Niels Möller * src/Makefile.am (liblsh_a_SOURCES): Readded channel_forward.c. * src/channel_forward.c: Rewrote to use channel_io.c. 2005-09-18 Niels Möller * src/server_session.c (oop_write_stdin, do_receive, do_eof): Call channel_write_state_close on EOF and error. (oop_read_stdout, oop_read_stderr): Call channel_read_state_close on EOF and error. * src/client_session.c (oop_write_stdout, oop_write_stderr): Call channel_write_state_close on EOF and error. (do_receive): Likewise. (oop_read_stdin): Call channel_read_state_close on EOF and error. * src/channel.c (channel_adjust_rec_window): Check that written > 0. * src/channel_io.c (channel_io_read): Return an enum channel_io_status. Don't call channel_read_state_close on error; leave that up to the caller. (channel_io_start_read): Check that file->fd is valid. (channel_io_write, channel_io_flush): Return an enum channel_io_status. Don't call channel_write_state_close on error; leave that up to the caller. (channel_io_stop_write): Return CHANNEL_IO_EOF if all data has been written. * src/channel_io.h (enum channel_io_status): New enum. 2005-09-17 Niels Möller * src/channel_io.c (channel_io_write): Call channel_adjust_rec_window. * src/transport_read.c (decode_packet): Implemented inflating. * src/encrypt.c (encrypt_packet): Adapted to new CODEC interface. * src/zlib.c (class zlib_instance): Deleted attributes max and rate. (estimate_size, estimate_update): Deleted functions. (do_zlib): Adapted to new CODEC interface, and simplified significantly. (make_zlib_instance): Don't initialize max and rate. * src/compress.h (class compress_instance): Changed interface for the CODEC method. Output storage is a string and a start offset, input is length and pointer. * src/lshd.c (lshd_service_request_handler): Don't call io_register_fd on the service pipe here; it's the responsibility of the transport_forward class. * src/transport_forward.c (transport_forward_close): Use io_close_fd. (transport_forward_setup): Use io_register_fd. 2005-09-16 Niels Möller * src/channel.c (receive_data_common): New function, with processing and checks common for handle_channel_data and handle_channel_extended_data. Invoke CHANNEL_RECEIVE with length and pointer, avoiding allocation fo an extra copy. (handle_channel_data, handle_channel_extended_data): Use it. * src/channel.h (class ssh_channel): Changed the CHANNEL_RECEIVE method to take a length and pointer, rather than an lsh_string. Updated method implementations. * src/server_session.c (do_exit_shell): Call channel_maybe_close unconditionally. (do_receive): Deallocate the packet. * src/lshd.c (kill_port): Use io_close_fd. (lshd_service_request_handler, make_lshd_port): Use io_register_fd. * src/lshd-connection.c (make_connection): Enable the "exec" request on session channels. * src/lsh.c (main): Put the resources generating by options processing on the connection's resource list. * src/lsh-export-key.c (sexp_to_ssh2_key): Due to the new debug macrology of ssh_format, it no longer works to use ssh_format in an argument of itself. So assign the fingerptint hash to a variable before use. * src/io.c (io_final): Deleted function. (io_run): Cleanup processing, previously done by io_final. * src/lsh-transport.c (main): No longer calls io_final. * src/srp-gen.c (main): Likewise. * src/format.h (ssh_format) [DEBUG_ALLOC]: If __GNUC__ is defined, define as a varargs macro, calling ssh_format_clue with file and line number as the first argument. * src/format.c (ssh_format) [DEBUG_ALLOC]: Use the supplied clue. * src/client_session.c (do_receive): Deallocate packet. * src/client.c (do_exit_status, do_exit_signal): Call channel_maybe_close. * src/channel_io.c (channel_write_state_close): Call channel_maybe_close unconditionally. * src/channel.c (handle_channel_request): Added trace message with request type. (channel_maybe_close): Ignore channel->sinks counter, when CHANNEL_NO_WAIT_FOR_EOF is set. 2005-09-16 Niels Möller * src/Makefile.am (liblsh_a_SOURCES): Added connection.c again. * src/lsh.h: Declare struct ssh_channel. * src/lsh.c: Updated for channel_table->ssh_connection renaming. (disconnect): New argument for the reason code. (do_disconnect): New method. * src/lshd-connection.c: Analogous changes. * src/channel_commands.c, src/channel_commands.h, src/client.c,src/client_session.c, src/server_session.c: Updated for channel_table->ssh_connection renaming. * src/channel.c: Code moved to connection.c. Updated for channel_table->ssh_connection renaming. * src/connection.c (init_ssh_connection) (ssh_connection_alloc_channel, ssh_connection_dealloc_channel) (ssh_connection_use_channel, ssh_connection_pending_close): Moved functions here, from channel.c. They used to be called init_channel_table, alloc_channel, dealloc_channel, use_channel and channel_pending_close. * src/connection.h: Moved the channel_table from channels.h to this file, and renamed the class ssh_connection. Deleted old version of this class. 2005-09-15 Niels Möller * src/unix_random.c (do_device_source): Use the read system call directly, not the read_raw function. * src/lshd-userauth.c (read_packet): New argument for seqno pointer. (write_packet): Don't use lsh_string_sequence_number. (handle_userauth): Likewise. Use the new argument to read_packet instead. * src/lsh_string.c (struct lsh_string): Deleted sequence_number. (lsh_string_sequence_number, lsh_string_set_sequence_number): Deleted functions. * src/lsh.c (write_packet): Don't use lsh_string_sequence_number. (do_lsh_default_handler): Don't handle EXC_USERAUTH. * src/io.c (read_raw, finish_io_exception, make_io_exception): #if:ed out. * src/exception.h (EXC_AUTH, EXC_USERAUTH, EXC_USERAUTH_SPECIAL, EXC_FINISH, EXC_FINISH_CHANNEL, EXC_FINISH_READ, EXC_FINISH_IO, EXC_FINISH_PENDING): Deleted unused exception types. 2005-09-15 Niels Möller * src/channel.c (alloc_channel): Use lsh_space_realloc. (send_global_request_responses): Deleted q argument. Updated callers. (send_channel_request_responses): Likewise. (parse_channel_request): Deleted function. Merged in handle_channel_request. (parse_channel_open): Deleted function. Merged in handle_channel_open. * src/xalloc.c (debug_realloc, xrealloc, lsh_space_realloc): New functions. (lsh_space_alloc) [!DEBUG_ALLOC]: Use xalloc. * src/arglist.c: Use lsh_space_alloc, lsh_space_realloc and lsh_space_free. * src/Makefile.am (liblsh_a_SOURCES): Added channel_io. Removed channel_forward.c, client_pty.c, client_x11.c, gateway.c, gateway_channel.c and server_x11.c, which are currently not working. * src/transport_forward.c: Updated for changes to ssh_write.c. * src/server_session.c (class server_session): Use channel_write_state and channel_read_state instead of lsh_fd objects. (do_kill_server_session): New method. (oop_write_stdin): New function. (do_receive): Use channel_io_write. (oop_read_stdout, oop_read_stderr): New functions. (do_send_adjust): Use channel_io_start_read. (do_eof): Send ^D if stdin is a pty. Call channel_write_state_close if there's no buffered data. (do_exit_shell): Use channel_maybe_close. (spawn_process): Rewrote i/o setup. (x11_request_handler): #if:ed out x11 support for now. * src/lshd.c (lshd_service_request_handler, lshd_packet_handler): Use TRANSPORT_WRITE_FLAG_PUSH, not SSH_WRITE_FLAG_PUSH. * src/lshd-connection.c (class connection): Inherit channel_table, not resource. (kill_connection): Check the alive flag, and don't call exit here. (write_packet): Reintroduced connection argument. Use KILL_RESOURCE on errors. Make sure the packet is deallocated. (disconnect): Use KILL_RESOURCE, rather than exit. (do_write_packet): This is now a method of the channel_table class. (make_connection): Deleted exception_handler argument. Call io_register_fd. Disabled pty support for now. (do_exc_lshd_connection_handler): Deleted. * src/lsh.c (class connection): Inherit channel_table, not resource. (kill_connection): Check the alive flag, and don't call exit here. (write_packet): Adapted to changes to ssh_write.c. Make sure the packet is deallocated. (do_write_packet): This is now a method of the channel_table class. (make_connection): Deleted exception handler argument. (fork_lsh_transport): Deleted exception handler argument. Don't call io_set_nonblocking here. * src/lsh-transport.c: Updated for changes to transport_write.c/ssh_write.c. * src/io.c: Deleted HAVE_POLL conditionals. #if:ed out most of the old i/o code. (global_oop_source, global_nfiles): Renamed, was source and nfiles. (io_register_fd, io_close_fd): New functions. (io_init): Reverted back to returning void. * src/client_pty.c (do_client_winch_handler): Use CHANNEL_TABLE_WRITE, not A_WRITE. * src/client_session.c (class client_session): Renamed, was client_session_channel. Use channel_read_state and channel_write_state instead of lsh_fd objects. (do_kill_client_session): New method. (oop_write_stdout, oop_write_stderr): New functions. (do_client_session_close): Deleted method. (do_client_session_eof): Updated to use channel_write_state_close. (do_receive): Use channel_io_write. (oop_read_stdin): New function. (do_send_adjust): Use channel_io_start_read. (command client_start_io): Rewritten. (make_client_session_channel): Don't set up a close handler. Rewritten i/o setup. Take fd:s rather than lsh_fd objects as argument. * src/client.c (do_exit_status, do_exit_signal): DEcrement the sinks counter. (class detach_callback): #if:ed out. (make_client_start_session): Deleted wrapper function. (client_maybe_pty): #if:ed out pty support for now. (client_maybe_x11): #if:ed out x11 support for now. (make_client_session): Adapted to changed make_client_session_channel. * src/channel_commands.c: Use CHANNEL_TABLE_WRITE instead of A_WRITE. Use CAST_SUBTYPE when casting to class channel_table. * src/transport.c: Updated for changes to transport_write.c/ssh_write.c. * src/channel.c (format_open_failure, format_channel_success) (format_channel_failure): Made static. * src/channel.h (enum channel_data_type): New enum. (enum channel_flag): Use an enum to define the channel flags. (CHANNEL_CLOSE_AT_EOF): Deleted. (class ssh_channel): Inherit resource, not flow_controlled. New attribute local_channel_number. Renamed channel_number to remote_channel_number. Deleted resource list and close method. New attribute sinks. (class channel_table): Inherit resource. Changed attribute write to a method. Deleted resource list. (CHANNEL_TABLE_WRITE): New method. * src/channel.c (PROTOCOL_ERROR): Redefine macro (kind of kludgy). (channel_pending_close, channel_finished): New functions, replacing the EXC_FINISH_PENDING and EXC_FINISH_CHANNEL exceptions. (format_global_failure, format_global_success) (format_open_confirmation, prepare_window_adjust): Made static. (class exc_finish_channel_handler): Deleted. (do_exc_finish_channel_handler, make_exc_finish_channel_handler): Deleted. (init_channel_table): Replaces make_channel_table. New arguments write and kill. (kill_channels): New function. (use_channel): Removed argument local_channel_number. (register_channel): Don't set up any exception handler. Initialize channel->local_channel_number. (lookup_channel, lookup_channel_reserved): Added asserts. (channel_adjust_rec_window): New function. Replaces adjust_rec_window. (channel_maybe_close): New function. (handle_channel_eof, channel_eof): Use channel_maybe_close. (handle_channel_close, handle_open_failure, channel_close): Use channel_finished. (channel_transmit_data, channel_transmit_extended): Send the data, rather than returning a formatted packet. * src/channel_io.h, src/channel_io.c: New files. 2005-09-14 Niels Möller * src/transport_write.c (make_transport_write_state): Initialize ingore and threshold. (select_write_size): New function, moved from ssh_write.c. (update_status, write_data, write_flush): New functions, replacing code in ssh_write.c. (transport_write_packet, transport_write_line) (transport_write_flush): Updated to changes in ssh_write_state. * src/transport.h (class transport_write_state): New attributes threshold and ignore, moved from class ssh_write_state. (enum transport_write_status): New status constants, replaces enum ssh_write_status. (enum transport_write_flag): New flags, replaces ssh_write_flag. * src/ssh_write.c (init_ssh_write_state, make_ssh_write_state): Deleted threshold argument. (select_write_size): Moved to transport_write.c. (ssh_write_flush): Return amount of data actually written rather than buffered. New argument to_write with the preferred write size. (ssh_write_enqueue): Renamed and made non-static. Old name was enqueue. (ssh_write_data): Rewritten, doesn't handle ignore packets. New argument to_write, and returns amount of data actually written rather than buffered. * src/ssh_write.h (class ssh_write_state): Removed attributes threshold and ignore (moved to class transport_write_state). (enum ssh_write_status): Deleted. * src/lsh_string.c (lsh_string_read): Loop on EINTR. 2005-09-13 Niels Möller * src/service_read.c (service_read_packet): Check if self->packet_length is zero first. Fixes bug when reading small packets. * src/werror.c (werror_format): Made static. Don't write program name. (werror_hexdump): Use werror_format, to avoid redundant program name output. (werror_title): New function. Updated all users of werror_vformat to use it. (werror_vformat): Don't write program name. New specifier %T. (packet_types): Include this generated array here, used for %T. 2005-09-08 Niels Möller * src/lsh.c: Pass on --host-db option to lsh-transport. 2005-09-07 Niels Möller * src/testsuite/functions.sh (run_lsh): For the time being, don't use -z (it's not implemented at the server side). * src/Makefile.am (liblsh_a_SOURCES): Added arglist.h. * src/lsh.c: Accept more options, which are passed on to the lsh-transport program. * src/lsh-transport.c: Use algorithms_argp, to accept algorithm selection options. * src/io.c (make_lsh_fd): Set neither the non-blocking nor the close-on-exec flag on stdio file descriptors. (io_init_fd): Made static, and removed argument. * src/arglist.c, src/arglist.h: New files. * src/testsuite/functions.sh: Use --background, not --daemon --no-syslog, when starting lshd. * src/ssh.h (SSH_DEFAULT_PORT): New constant. * src/lshd.c: Option handling. Current options: -p, -h, --daemonic, --background, --enable-core and --pid-file. Handle SIGHUP. * src/testsuite/functions.sh: Fixed typo in definition of LSH_TRANSPORT and friends. 2005-09-07 Niels Möller * src/lsh.c (oop_read_service): Adapted to channel_packet_handler changes. * src/lshd-connection.c (oop_read_service): Likewise. * src/channel.c (channel_packet_handler): Return 1 for success, or zero if message type is unimplemented. Take length and pointer as arguments, not a struct lsh_string *. All called functions (handle_global_request, etc) changed to take a struct simple_buffer * as argument, and made static. 2005-09-06 Niels Möller * src/lshd-connection.c (blocking_writev): New function. (write_packet): Use blocking_writev, instead of the ssh_write class. (class connection): Deleted attribute writer. (class connection_write): Deleted class. (make_connection_write_handler): Deleted function. (disconnect): Deleted connection argument. (do_exc_lshd_connection_handler): New function. (lshd_connection_exception_handler): New static object. * src/Makefile.am (liblsh_a_SOURCES): Removed some files: client_userauth.c, connection_commands.c, debug.c, gateway_commands.c, io_commands.c, read_packet.c, socks.c, tcpforward.c, tcpforward_commands.c, and write_packet.c. * src/lsh.c: Don't include io.h, io_commands.h and handshake.h. * src/lsh-decrypt-key.c: Include io.h, not io_commands.h. * src/lsh-writekey.c: Likewise. * src/dh_exchange.c: Include keyexchange.h, not connection.h. * src/command.c: Don't include connection.h. * src/keyexchange.c: Likewise. * src/server_pty.c: Likewise. * src/client.c: Don't include connection.h. (client_argp_parser): Ifed out tcp-forward handling. * src/channel.c (make_channel_table): Take an exception handler argument. * src/testsuite/functions.sh: Set and export LSH_TRANSPORT, LSHD_CONNECTION and LSHD_USERAUTH. * src/Makefile.am (bin_PROGRAMS): Reenable building of the lsh binary. * src/lsh.c (class connection): New class. (class lsh_options): Deleted most options. (read_known_hosts, read_user_keys, do_lsh_lookup, make_lsh_host_db, make_lsh_login, make_lsh_connect): Deleted functions that have moved to lsh-transport. (class lsh_host_db): Deleted class. (main_options): Ifed out unimplemented options. (main_argp_parser): Likewise. (transport_exit_callback, make_transport_exit_callback): New functions. (fork_lsh_transport): New function. (main): Call fork_lsh_transport. * src/lshd-userauth.c (main): Bugfix: Use LSHD_CONNECTION, not LSHD_USERAUTH. * src/lsh-transport.c (lsh_connect): New verbose messages. * src/client.c (format_service_request, do_accept_service) (make_accept_service_handler, do_request_service) (make_request_service): Deleted obsolete functions. (class accept_service_handler): Deleted. (client_options): Ifed out unimplemented flags. (client_argp_parser): Likewise. 2005-08-31 Niels Möller * src/lsh-transport.c (read_host_acls): Use GET_FILE_ENV. * src/lshd-userauth.c (main): Likewise. * src/lshd.c (make_configuration): Likewise. * src/environ.h.in (ENV_LSH_TRANSPORT, ENV_LSHD_CONNECTION) (ENV_LSHD_USERAUTH): New environment variables. (GET_FILE_ENV): New macro. (PATH_EXECUV): Deleted. Other PATH_* names renamed to FILE_*. (FILE_LSHD_CONNECTION, FILE_LSHD_USERAUTH, FILE_LSH_TRANSPORT): New filenames. 2005-08-31 Niels Möller * src/io.c (lsh_copy_file): Deleted unused function. 2005-08-16 Niels Möller * src/lshd.h: Deleted file. * src/transport.h (class transport_connection): New attribute write_margin. * src/transport.c (init_transport_connection): Initialize write_margin. (transport_connection_kill): Renamed function. Was transport_kill. (transport_write_almost_full): New function. (transport_start_write): Use transport_write_almost_full. (transport_stop_write): Likewise. (transport_send_packet): Slight simplification, using local variable writer. (transport_send_kexinit): Generating TRANSPORT_EVENT_STOP_APPLICATION, not TRANSPORT_EVENT_START_APPLICATION. * src/ssh.h (SSH_MAX_TRANSPORT_RESPONSE): New constant. * src/lsh-transport.c: Use transport_forward.c. Deleted old code for communicating with the service layer. * src/lshd.c: Likewise. * src/lsh-decode-key.c: Include parse.h. * src/Makefile.am (lshd_SOURCES, lsh_transport_SOURCES): Added transport_forward.c. * src/transport_forward.c: New file, implementing the forwarding of cleartext messages needed by lshd and lsh-transport. * src/transport_forward.h: New file. 2005-04-30 Niels Möller * src/abstract_crypto.c, src/abstract_crypto.h, src/publickey_crypto.c, src/publickey_crypto.h: Deleted files. * src/Makefile.am (liblsh_a_SOURCES): Removed abstract_crypto.c and publickey_crypto.c. (bin_PROGRAMS): For the time being, don't build lsh, lshg or srp-gen. * src/crypto.c: Moved utility functions here, from abstract_crypto.c. * src/crypto.h: Moved declarations here, from abstract_crypto.h and publickey_crypto.h. Updated all users. * src/werror.c (die): New function. * src/ssh_write.c (enqueue): Fixed bug in SSH_WRITE_FLAG_IGNORE handling. * src/lshd.c (oop_read_service): Do only a single read call. * src/lshd-userauth.c (write_packet): Use write_raw. (die): Deleted function, moved to werror.c. * src/lsh-transport.c (lsh_transport_event_handler): When handling TRANSPORT_EVENT_PUSH, check that service_writer is non-NULL. (make_lsh_transport_connection): Initialize service_reader and service_writer to NULL. (oop_read_service, oop_write_service): New functions. (lsh_transport_service_start_read) (lsh_transport_service_stop_read) (lsh_transport_service_start_write) (lsh_transport_service_stop_write): Implemented. (lsh_transport_packet_handler): Verbose message for USERAUTH_SUCCESS. Don't try to display the message list for USERAUTH_FAILURE. (start_service): Initialize service_reader and service_writer, and start reading. (lsh_transport_lookup_verifier): Fixed handling of capture_fd. 2005-04-29 Niels Möller * src/lsh-transport.c (lsh_transport_packet_handler): Fixed handling of SERVICE_ACCEPT. Handle USERAUTH_SUCCESS and USERAUTH_FAILURE. (start_userauth): Try publickey authentication. (read_user_key): New function, based on lsh.c:read_user_keys. (main_argp_parser): Call read_user_key. 2005-04-28 Niels Möller * src/lsh-transport.c (enum lsh_transport_state): New type. (class lsh_transport_connection): New attribute state. (lsh_transport_event_handler): Send a service request after keyexchange is complete. (lsh_transport_packet_handler): Handle SSH_MSG_SERVICE_ACCEPT. (main_options): New options --userauth and --no-userauth. 2005-04-27 Niels Möller * src/lsh-transport.c (lsh_transport_lookup_verifier) (make_lsh_transport_lookup_verifier): Host db handling, mostly copied from lsh.c. * src/io.c (write_raw): Return an integer success indication, not an exception. Updated all callers. * src/abstract_crypto.c (hash_string_l): New function. * src/client_keyexchange.h: Deleted. * src/transport_read.h: Deleted. * src/Makefile.am (lsh_transport_SOURCES): Added client_keyexchange.c. (liblsh_a_SOURCES): Deleted lookup_verifier.c. * src/server_keyexchange.c (server_dh_init): Adapted to new keyexchange_algorithm interface. * src/transport.c (transport_kexinit_handler): Likewise. * src/io.c (io_set_blocking): Deleted again. * src/lshd-connection.c (oop_read_service): Do only a single read call. Then we can keep the fd in blocking-mode at all times. * src/lsh-transport.c: Reorganized to use transport_connection. * src/lookup_verifier.c, src/lookup_verifier.h: Deleted files. Moved declaration to keyexchange.c. * src/keyexchange.h (class keyexchange_algorithm): Changed init method to take a transport connection as argument. (class lookup_verifier): Moved here, from lookup_verifier.h. * src/client_keyexchange.c: Rewritten, to work with the new transport layer. 2005-04-26 Niels Möller * src/lshd-connection.c: Use service_read_state interface. (make_connection): Set stdin into non-blocking mode, and use atexit to restore it. * src/io.c (io_set_blocking): Reintroduced function. Used by lshd-connection. 2005-04-26 Niels Möller * src/lshd.c (oop_read_service, lshd_service_start_read) (lshd_service_stop_read): New functions, using the service_read_state interface. (oop_write_service): New function, replacing lshd_service_read_handler. (lshd_service_request_handler): Set service pipe into non-blocking mode. * src/lshd.h (class lshd_connection): New attributes service_read_active and service_write_active. Use service_read_state, not lshd_service_read_state. * src/server_keyexchange.c (server_dh_handler): Pass zero flags to transport_send_packet. * src/transport.c (init_transport_connection): Allocate read_packet. (oop_timer_retry): New function. (transport_start_read): Use oop_timer_retry to implement retrying. (transport_write_pending): Split into two functions, ... (transport_start_write, transport_stop_write): ... new functions. (transport_send_packet): New argument flags. Let a NULL packet imply a push of buffered data. Updated callers. * src/transport.h (class transport_connection): Renamed write_pending to write_active. * src/ssh_write.c (ssh_write_available): New function. * src/service_read.c: New file. Reads the service protocol using an interface similar to transport_read. 2005-04-24 Niels Möller * src/transport_read.c (class transport_read_state): New attribute read_status. Deleted output_buffer. (readable_p): New function. (read_some): Determine if the read data needs to be pushed, and storing this information in read_status. (find_line, transport_read_line, decode_packet) (transport_read_packet): Changed return type to enum transport_read_status. * src/transport.c (transport_process_packet): New function, extracted from... (oop_read_ssh): ... Call transport_process_packet. Check return value, on zero, prepare for retrying the packet later. * src/transport.h (TRANSPORT_EVENT_PUSH): New event type. (enum transport_read_status): Return type from transport read calls. (class transport_connection): New attributes read_buffer, retry_length and retry_seqno. Changed packet_handler method to return an int. 2005-04-23 Niels Möller * src/transport.h (class transport_write_state): Moved declaration here. (transport_connection): New attribute read_active. * src/transport.c (transport_start_read, transport_stop_read): New functions. (oop_write_ssh): Updated to new ssh_write_state interface. (transport_handshake): Likewise. * src/transport_write.c: Updated to new ssh_write_state interface. (make_ignore_packet): New function. (transport_write_packet): Generate SSH_MSG_IGNORE packets. (transport_write_flush): Likewise. * src/ssh_write.c: Rewritten. Now uses a hard limit on buffer size, supports ignore-data, and a better push mechanism. * src/lshd.c (lshd_event_handler): Implemented flow control. (lshd_line_handler): Fixed format string for verbose output. (lshd_service_handler): Updated to new ssh_write_state interface. (lshd_service_request_handler): Likewise. (make_configuration): Use make_server_dh_exchange and make_dh_group14. (SERVICE_WRITE_THRESHOLD, SERVICE_WRITE_BUFFER_SIZE): New constants. * src/lshd-connection.c (CONNECTION_WRITE_THRESHOLD) (CONNECTION_WRITE_BUFFER_SIZE): New constants. (write_packet): Updated to new ssh_write_state interface. (make_connection): Likewise. * src/server_keyexchange.c (server_dh_exchange): dh_params is a class, not a struct. (make_server_dh_exchange): Take a dh_params object as argument. (make_server_dh_group1_sha1, make_server_dh_group14_sha1): Deleted functions. * src/dh_exchange.c (make_dh_params): Replaces init_dh_params. (make_dh_group1): Replaces init_dh_group1. (make_dh_group14): Replaces init_dh_group14. * src/publickey_crypto.h (class dh_params): Should be a class, not a struct. 2005-04-22 Niels Möller * src/lshd.c (kill_lshd_connection): Use transport_kill. (lshd_event_handler): Enable service when receiving a TRANSPORT_EVENT_KEYEXCHANGE_COMPLETE event. Return 0 for all events. 2005-04-20 Niels Möller * src/transport_read.c (make_transport_read_state): More thorough initialization. (decode_packet): Update seqno properly. * src/transport.h (class transport_connection): Event handler method now returns an int. * src/transport.c (transport_kill): New function. (transport_close): Reorganized close handling. Book-keeping for buffers to drain should be more sane now. (oop_read_ssh): Pass on messages in the 0-19 range to the application, including SERVICE_REQUEST and SERVICE_ACCEPT. (transport_write_pending): New close logic. * src/ssh.h (SSH_FIRST_KEYEXCHANGE_GENERIC): New constant. 2005-04-20 Niels Möller * src/transport.c (packet_types): Table of packet type names. (transport_kexinit_handler): The KEYEXCHANGE_INIT method takes a randomness generator as the second argument. Disconnect if the method returns NULL. (oop_read_ssh): More debug messages. Call reset_kexinit_state when handling NEWKEYS. (transport_keyexchange_finish): Set kex state to KEX_STATE_NEWKEYS. * src/lshd.c (packet_types): Deleted table, moved to transport.c. * src/kexinit.c, src/kexinit.h, src/kexinit_state.c: Deleted files. * src/server_keyexchange.c (server_dh_handler): Fixed diffie-hellman bug. Debug messages with session key and exchange hash. * src/lshd.h: Deleted unused declarations. * src/lshd.c (make_configuration): Use make_server_dh_group14_sha1. 2005-04-19 Niels Möller * src/transport_write.c (transport_write_packet): Assert that packet is non-empty. * src/transport_read.c (find_line): Fixed off-by-one type. (transport_read_packet): Fixed parsing of packet header. * src/transport.c (class transport_timeout): New class. (transport_timeout, transport_timeout_close): New functions. (transport_close): New function. (transport_kexinit_handler): New function. (transport_timeout_reexchange, transport_timeout_keyexchange): New functions. (oop_read_ssh): Bug fixes. (transport_write_pending): Generate events, depending on kex.write_state. (transport_send_kexinit): Implemented timeouts, tracking of the write state, and partial support for sending a speculative first keyexchange packet. (transport_keyexchange_finish): New function. (transport_handshake): New function. * src/ssh_write.c (ssh_write_flush): Bugfixes for the cases that the buffer is empty or is emtied. (ssh_write_data): Fixed update of the total size. * src/lshd.c: Updated to work with new transport code. Keyexchange interface is incomplete. * src/lsh_string.c (lsh_string_move): Typo fix. * src/Makefile.am (lshd_SOURCES): Added server_keyexchange.c. (liblsh_a_SOURCES): Removed some files that don't compile at the moment. * src/dh_exchange.c: Reorganized, to fit with new transport code. Server-specific code moved to server_keyexchange; the same should be done tot he client-specific code, but that's not done yet. * src/publickey_crypto.h (class zn_group): Deleted, together with the corresponding functions. (struct dh_params): New struct, replacing the dh_method class. (struct dh_state): New struct, replacing the dh_instance class. * src/keyexchange.c: Reorganized to fit with new transport code. Moved code here from kexinit_state. Deleted code dealing with timeouts. * src/server_keyexchange.c: Rewrote diffie-hellman key exchange. Deleted SRP support. 2005-04-18 Niels Möller * src/Makefile.am (lshd_SOURCES, lsh_transport_SOURCES): Added transport.c and transport_write.c. * src/lsh_string.h (lsh_string_move): Fixed typo in declaration. 2005-04-18 Niels Möller * src/transport_read.c: Rewritten to not use ssh_read. * src/ssh_write.h (class ssh_write_state): New attribute size, with the total amount of buffered data. * src/ssh_write.c (ssh_write_flush): New function, which doesn't know about liboop. (ssh_write_data): Call ssh_write_flush. * src/transport_write.c: New file. 2005-04-17 Niels Möller * src/lsh_string.c (lsh_string_move): New function. * src/ssh.h (SSH_MAX_LINE): New constant. 2005-04-16 Niels Möller * src/Makefile.am (bin_PROGRAMS): Added lsh-transport. (lsh_transport_SOURCES): New variable. * src/lsh-transport.c: Rough outline. Compiles, connects, and doesn't do much more. * src/server_authorization.c, src/server_authorization.h, src/server_keyexchange.c, src/server_keyexchange.h, src/server_password.c, src/server_publickey.c, src/server_userauth.c, src/server_userauth.h, src/unix_user.c, src/userauth.c, src/userauth.h: Deleted files. * src/unix_process.c (spawn_parent): Use make_logout_notice, to make sure that we don't try to send signals to children that have been reaped. * src/Makefile.am (lshd_SOURCES): Added transport_read.c. * src/lshd.c (lshd_service_handler, lshd_service_request_handler): Use plain functions, not packet_handler objects. * src/lshd_keyexchange.c (lshd_kexinit_handler): Likewise. * src/lshd.h (DEFINE_PACKET_HANDLER): Deleted macro. * src/lshd-connection.c (write_packet): Don't call fatal on read errors. (class connection_read_state): New class. Adapted to new ssh_read interface. * src/lshd_keyexchange.c (lshd_newkeys_handler): Install new keys in the transport_read_state object. * src/lshd.c: Updated to use new transport_read_state class. (class lshd_read_error): Deleted class. * src/lshd.h (class lshd_read_state): Inherit transport_read_state. (class lshd_read_handler): Deleted class. (class lshd_service_read_state): New class. (class lshd_connection): Deleted attributes rec_max_packet, rec_mac, rec_crypto and rec_compress, they're now in the transport_read_state class. Changed type of service_reader to lshd_service_read_state. * src/transport_read.h: New file. (class transport_read_state): New class. * src/transport_read.c: New file. Code moved from lshd_read.c * src/ssh_read.h (error_callback): Deleted class. (class ssh_read_state): Renamed process method to process_header. Renamed handler to handle_data, error to io_error, and made them methods of this class. * src/ssh_read.c: Corresponding updates. * src/service_read.c (service_process_header): Updated for io_error rename. 2005-04-15 Niels Möller * src/lsh-transport.c: New file. * src/ssh.h (SSH_DISCONNECT_RESERVED): Deleted. * src/server_pty.c (pty_open_master): Removed #else. * src/lshd.c (connection_write_data, lshd_service_handler): Better error handlign when write fails. * src/exception.c (make_protocol_exception): Don't refer to SSH_DISCONNECT_RESERVED. 2005-04-14 Niels Möller * src/Makefile.am (liblsh_a_SOURCES): Deleted obsolete files server_authorization.c server_keyexchange.c, server_password.c server_publickey.c, server_userauth.c, unix_user.c, and userauth.c. * src/unix_process.c: #if:ed out all utmp/wtmp code, since it can't work without extra privileges. (exec_shell, spawn_shell): New functions, replacing the obsolete USER_SPAWN method. * src/server_x11.c (class server_x11_socket): Deleted uid attribute. (delete_x11_socket): Deleted function, folded into... (do_kill_x11_socket): ... deleted uid-changing code. (server_x11_listen) Deleted function responsible for uid changes. open_x11_socket is sufficient. (server_x11_setup): Deleted user argument. Use the display number instead of the user name when forming the name of the Xauthority file. Use the new function spawn_shell. * src/server_session.c (spawn_process): Deleted user argument. Use spawn_shell. (spawn_process): Deleted support for peer. (do_spawn_subsystem, shell_request_handler, exec_request_handler): Updated to new spawn_shell conventions. (pty_request_handler): Updated to new pty_open_master. Use DEFINE_CHANNEL_REQUEST. (x11_request_handler): Updated to new server_x11_setup. Use DEFINE_CHANNEL_REQUEST. * src/server_pty.c (pty_check_permissions, pty_grantpt_uid): Deleted functions. (pty_open_master): Deleted pty support for systems lacking UNIX98 pty:s. Deleted uid argument. * src/reaper.c: Deleted the object-oriented interface. (reaper_global): New global variable. (reaper_init, reaper_handle): New functions. * src/reaper.h (class reaper): Deleted. * src/lshd.c: Friendlier error messages if initialization fails. * src/lshd-connection.c (main): Call reaper_init. (make_connection): Support for pty-req and x11-req. * src/client_userauth.h: Don't include userauth.h. * src/lookup_verifier.h (LOOKUP_VERIFIER): Deleted argument for the key holder. * src/lsh.h (struct lsh_user): Deleted declaration. * src/lsh_process.h: New file. * configure.ac: Warn if UNIX98 pty:s are unavailable. 2005-02-19 Niels Möller * src/server_session.c (shell_request_handler): Added trace output. * src/lshd-userauth.c (main): Use argp for options parsing. * src/lshd.c (main): Likewise. * src/lshd-connection.c (write_packet): New function. (disconnect): New function. (read_handler): Implemented. Ignores userauth messages, and uses channel_packet_handler. (write_handler): Use write_packet. (make_connection): Make "session" a recognized channel type, and "shell" a recognized channel request type. 2005-02-18 Niels Möller * src/channel.c (make_channel_table): Initialize self->resources. (handle_channel_open): More debug output. (channel_packet_handler): New function. 2005-02-17 Niels Möller * src/lshd-connection.c: Implemented reading and writing of packets for the ssh-connection service. * src/service_read.c (service_process_header): New file and function. Used to be lshd.c:lshd_process_service_header. * src/lshd.h (lshd_read_state): Include a connection attribute. * src/lshd_read.c (lshd_process_ssh_header): Deleted class. (lshd_process_ssh_header): This function nowacts as a method for the lshd_read_state class. * src/ssh_read.h (class header_callback): Deleted. Instead, use a method on the ssh_read_state class. * src/handshake.c (init_connection_service): Pass a dummy argument to make_channel_table. * src/channel.c (make_channel_table): New argument write, saying where to output ssh messages. For now, initialize the exception handler to NULL. * src/Makefile.am (liblsh_a_SOURCES): Moved ssh_read.c and ssh_write.c here. 2005-02-16 Niels Möller * src/handshake.c (init_connection_service): Moved function here, from channel.h. It doesn't really belong here, though. * src/connection.h (ssh_connection): Removed attributes that have been moved to the kexinit_state class. * src/channel.h, src/channel.c: Purged dependence on ssh_connection. Updated all users. 2005-02-15 Niels Möller * src/Makefile.am (sbin_PROGRAMS): Added lshd-connection. * src/lshd-connection.c: New file. * src/lshd-userauth.c: Use the session-id provided by the transport layer. Implemented the rest of publickey authentication. * src/lshd.c (lshd_service_request_handler): Pass --session-id option to child process. 2005-02-15 Niels Möller * src/lshd-userauth.c (start_service): New function. (service_error): New function. (get_verifier): Implemented, except for the actual signature verification. * src/dsa.c (make_ssh_dss_verifier): Take length and pointer as arguments, not a struct lsh_string *. Updated callers. * src/rsa.c (make_ssh_rsa_verifier): Likewise. * src/lshd-userauth.c: Implemented user lookup, and part of publickey authentication. * src/werror.c (werror_vformat): Call werror_flush here. Removed corresponding calls from users of werror_vformat. * src/Makefile.am (sbin_PROGRAMS): Added lshd-userauth. * src/lshd-userauth.c: New file. * src/lshd.c (lshd_service_handler): Don't free the packet. (lshd_service_request_handler): Send a SERVICE_ACCEPT reply. 2005-02-14 Niels Möller * src/lshd.c (connection_write_data): Use ssh_write_data. Proper error handling still missing. (lshd_process_service_header): New function and class. (lshd_service_read_handler, make_lshd_service_read_handler): New functions. (lshd_service_request_handler): Setup i/o with service process. (lshd_handshake): Call ssh_read_start. * src/lshd.h (class lshd_connection): New attributes: writer, service_reader and service_writer. * src/ssh_read.c (ssh_read_set_callback, ssh_read_stop) (ssh_read_start): New functions, to make it possible to stop and restart reading. Use them through out the code. * src/lshd.h, src/lshd_read.c, src/lshd_keyexchange.c: New file. 2005-02-14 Niels Möller * src/Makefile.am (lshd_SOURCES): Added ssh_write.c. * src/ssh_write.h, src/ssh_write.c: New files. * src/queue.h (FOR_OBJECT_QUEUE): Check for end of queue *before* casting the node to struct object_queue_node. (FOR_STRING_QUEUE): New macro. 2005-02-13 Niels Möller * src/lshd.c (lshd_service_request_handler): New handler. Almost implemented handling of service requests. 2005-02-12 Niels Möller * src/ssh_read.c (oop_ssh_read_packet): When a packet is finished, register a callback for reading the next header. Replaced use of the exception facility with a simpler error_callback. * src/server.c (read_host_key): Deleted support for spki keys. Also #if:ed out everything but this function. * src/lshd.c (connection_write_data): Primitive function for sending ssh messages over the network. (connection_write_packet, connection_disconnect): New functions. (lshd_handle_ssh_packet): Handle all messages (except SERVICE_REQUEST) needed for the transport protocol. (make_configuration): New function. * src/lsh.c (main_argp_parser): Deleted support for the name diffie-hellman-group2-sha1. * src/connection.c, src/connection.h: Use kexinit_state. * src/handshake.c: Likewise. * src/dh_exchange.c (init_dh_instance): Take a kexinit_state as argument, instead of an ssh_connection. Updated callers. * src/format.c (format_disconnect, format_unimplemented) (format_newkeys): Moved these trivial functions here, for lack of a better place. * src/atoms.in (diffie-hellman-group2-sha1): Deleted obsolete name. * src/algorithms.c (algorithms_argp_parser): Use default_hostkey_algorithms. (default_hostkey_algorithms): New function. Disabled spki support. (default_compression_algorithms, default_mac_algorithms) (default_crypto_algorithms): Made non-static. * src/Makefile.am (liblsh_a_SOURCES): Added encrypt.c, kexinit.c and kexinit_state.c. (lshd_SOURCES): Added lshd_read.c lshd_keyexchange.c. * src/encrypt.c (encrypt_packet): New file. Function extracted from write_packet. * src/write_packet.c (do_write_packet): Use encrypt_packet. * src/kexinit.h, src/kexinit.c, src/kexinit_state.c: New files. Moved code here, that is independent from ssh_connection, from... * src/keyexchange.c. * src/kexinit.h (kexinit_state): New struct. 2005-02-03 Niels Möller * src/lshd.c (lshd_read_state): New class. Moved definition super class ssh_read_state to ssh_read.h and ssh_read.c. * src/exception.h (PROTOCOL_ERROR_DISCONNECT): New macro. * src/Makefile.am (liblsh_a_SOURCES): Removed oop-line-file.c. (lshd_SOURCES): Include ssh_read.c. * src/ssh_read.c, src/ssh_read.h: New files. 2005-02-03 Niels Möller * src/resource.c (resource_list_is_empty): New function. * src/io.c (io_init): Return the oop source. Also moved the inclusion of oop.h from io.c to io.h. * src/exception.h (PROTOCOL_ERROR): Use a static exception object. 2005-02-02 Niels Möller * src/Makefile.am (liblsh_a_SOURCES): Added oop-line-file.c. * src/oop-line.h: Line reading interface, based on liboop. * src/oop-line-file.c: Implementation of the interface. 2006-05-16 Niels Möller * Merged experimental branch. Below changes are from the mainline. 2006-05-09 Niels Möller * configure.ac: Bumped version number to 2.0.4. * Released lsh-2.0.3. 2006-05-08 Niels Möller * doc/ssh-conv.1: Changed to ordinary line breaks in example ssh-conv output. * src/connection.c (do_connection_flow_controlled) (connection_send_kex): Trace output for hard_limit changes. * Man pages: Applied patch from Stefan Pfetzing, addressing long lines and non-ascii characters. 2006-05-04 Niels Möller * src/testsuite/daemon-fd-test: Reverted previous change. Use a single-digit fd. 2006-05-03 Niels Möller * src/testsuite/daemon-fd-test: Avoid using exec with no arg, for better portability. * src/daemon.c (daemon_started_by_inetd): Deleted debug message. 2006-05-01 Niels Möller * src/testsuite/lshg-cat-test: Fixed message for compare_output. * src/daemon.c (daemon_init): When backgrounding, let the parent process use _exit rather than exit. We used to let the intermediate process wait on the child, in order to print out a message for any unexpected status code. But then we get a race in the testsuite, because that process may keep the listen sockets open even after the main process has deleted its pid file. * src/lshd.c (main): Fixed handling of stderr, with --no-syslog. 2006-04-29 Niels Möller * configure.ac: Check for function getdtablesize. * src/testsuite/Makefile.am (TS_SH): Added daemon-fd-test. * src/testsuite/daemon-1-test: Renamed file to... * src/testsuite/daemon-fd-test: ... new file. Improved test, using /proc/self/fd. * src/lshd.c (main): Improved daemonic behaviour. Call daemon_close_fds. When --daemonic --no-syslog is given, still perform all daemonic processing except for the redirect of stderr to /dev/null. * src/daemon.h: Updated prototypes. Deleted C++ guard. * src/daemon.c (daemon_pidfile): Deleted #if:ed out file locking code. (daemon_started_by_init, daemon_started_by_inetd): Made static. (daemon_detect): New function, split out from daemon_init. (daemon_dup_null): Likewise. (getdtablesize): New function, for systems that don't have it in libc. (daemon_close_fds): New function. (daemon_init): New argument with the daemon mode. Split handling of fd:s to the new functions daemon_dup_null and daemon_close_fds. 2006-04-28 Niels Möller * src/testsuite/daemon-1-test: New test. Test that lshd doesn't leak any fd:s to child processes. 2006-02-09 Niels Möller * doc/index.html: Updated sshtools link, after prodding from Jerrad Pierce. 2006-01-27 Niels Möller * configure.ac: Bumped version to 2.0.3. * Released lsh-2.0.2. * NEWS: Entry for 2.0.2. 2006-01-23 Niels Möller * src/xauth.c (x11_forward): Commented out unused class. * src/lsh-make-seed.c (spawn_source_process): Explicitly close dev_null fd in child process. * src/unix_random.c (do_device_source, random_init): Use io_set_close_on_exec, to avoid fd:s leaking to user shells. * src/werror.c (werror_argp_parser): Likewise. * src/server_pty.c (pty_open_master): Likewise. * src/unix_interact.c (make_unix_interact): Likewise (even if this is in the client). * src/io.c (lsh_pushd_fd): Likewise. (lsh_pushd): Likewise. Also fixed EINTR logic. 2005-11-28 Niels Möller * src/testsuite/lcp-test: Skip test if /bin/bash doesn't exist. 2005-11-26 Niels Möller * src/testsuite/lsh-6-test (ALGORITHMS): Try both aes-cbc and aes-ctr. * src/dummy.c (ctr_crypt): New dummy implementation. * src/lsh_string.c (lsh_string_ctr_crypt): New function. * src/crypto.c (class aes_cbc_instance): Renamed class, was aes_instance. Renamed the corresponding functions too. (aes_ctr_instance): New class. (do_aes_ctr_crypt, make_aes_ctr_instance): New functions. (crypto_aes256_ctr_algorithm): New algorithm. * src/algorithms.c (all_symmetric_algorithms): Added ATOM_AES256_CTR. (all_crypto_algorithms): Likewise. (lookup_crypto): Check for "aes256-ctr" and "aes-ctr". * src/atoms.in: Added symbols for counter mode ciphers. 2005-11-25 Niels Möller * misc/run-tests (find_program): If argument contains a slash (most likely because VPATH expansion in make), return the filename as is. * .bootstrap: Don't exit if src/nettle/aclocal.m4 already exists. Make all symlinks before checking for the "links" argument. * configure.ac (LSH_GCC_FUNCTION_NAME): Deleted use of this macro. Deleted the checks for the sizes of short, int and long. Use -Wno-pointer-sign when compiling with gcc-4.x. 2005-11-25 Niels Möller * misc/run-tests: New -v option, propagated to test programs. * src/ssh-conv: Fixed syntax error in awk program. 2005-11-23 Niels Möller * src/xalloc.h (number_of_strings): Deleted declaration. 2005-11-20 Niels Möller * src/ssh-conv: In the awk script, check for ssh-dsa and ssh-rsa only when state == 0. * misc/run-tests: Added --debug option. If used, the teardown-env script is not run. 2005-11-07 Niels Möller * .bootstrap: Link config.sub and config.guess to the nettle and spki subdirectories. * acinclude.m4 (LSH_CCPIC): AC_REQUIRE AC_CANONICAL_HOST, and use $host_os instead of uname. (LSH_RPATH_INIT): Likewise. * config.guess, config.sub: Moved files from src/nettle. 2005-10-16 Niels Möller * acinclude.m4 (LSH_GCC_ATTRIBUTES): Put the declaration and definition of the test function in the declarations argument of AC_TRY_COMPILE. It used to end up inside main. 2005-10-15 Niels Möller * acinclude.m4 (GMP_TRY_ASSEMBLE): New macro. 2005-10-05 Niels Möller * doc/lsh.texinfo: Use @documentencoding ISO-8859-1. 2005-09-23 Niels Möller * acinclude.m4 (LSH_FUNC_ALLOCA): Moved inclucion of malloc.h and check of HAVE_MALLOC_H inside #ifndef __GNUC__. On FreeBSD 4.9, malloc.h exists but generates obsoleteness warnings when used. 2005-09-07 Niels Möller * doc/lsh.texinfo (sexp): Updated documentation on sexp-conv --hash. 2005-09-06 Niels Möller * src/parse_config.c (parse_groups): Made group name optional. * src/lsh-decode-key.c (lsh_decode_key): Removed redundant "lsh-decode-key:" prefix from messages. 2005-07-02 Niels Möller * src/client.c (init_client_options): Use gc_global for the resource list. Needed for consistent gc if the connection fails. 2005-03-16 Niels Möller * configure.ac: Bumped version to 2.0.2. * Released 2.0.1. * NEWS: Entry for 2.0.1. * src/atoms.in: Deleted diffie-hellman-group2-sha1. * src/lsh.c (main_argp_parser): Deleted support for diffie-hellman-group2-sha1. * src/lshd.c (main_argp_parser): Likewise. 2005-03-14 Niels Möller * src/testsuite/lsh-7-test: Set $HOME when invoking lsh, to prevent it from picking up files in the real $HOME/.lsh directory. * src/testsuite/rapid7-lsh-test: Likewise. * src/unix_interact.c (read_password): Ask for passwords also in quiet mode. Reported by Georg Sauthoff. * src/charset.c (ucs4_is_control): Don't treat '\n' as a dangerous control character. Reported by Georg Sauthoff. 2005-02-12 Niels Möller * src/keyexchange.c (parse_kexinit): Bugfix (DOS). 2005-02-01 Niels Möller * src/exception.h (HANDLER_CONTEXT): Don't use FUNCTION_NAME. * src/lsh_string.h (lsh_string_alloc): Likewise. * acinclude.m4 (LSH_GCC_FUNCTION_NAME): The __FUNCTION__ feature of gcc has been obsoleted, so don't bother testing for it. (This makes trace messages less useful). 2004-12-22 Niels Möller * src/lsh-make-seed.c (get_system): Fixed handling of error from read, bug #1477. 2004-12-08 Niels Möller * configure.ac: Bumped version to 2.0.1. 2004-12-07 Niels Möller * Released lsh-2.0. * src/environ.h.in (USER_NAME_FROM_ENV): Examine $LOGNAME before $USER. This is the same behaviour as emacs and rcs. 2004-12-07 Pontus Freyhult * doc/lsh.texinfo (Action options): Added --detach and --write-pid options. (Features): Added section about gateway mode. (Invoking lshg): New node. (Action options): Added --subsystem option. (Invoking lshd): Added --subsystems option. 2004-12-06 Niels Möller * configure.ac: Bumped version to 2.0. 2004-12-05 Niels Möller * src/lshg.c (do_exc_lshg_handler): Exit only for EXC_IO_CONNECT errors. 2004-12-05 Niels Möller * src/testsuite/tcpip-remote-test: Don't run tcpconnect with /dev/null as standard input; for some reason, that doesn't work on SunOS-5.4. 2004-11-30 Niels Möller * src/testsuite/functions.sh (test_done): New function, used when exiting the testscripts. This is instead of using trap, which seemed to be unreliable on SunOS-5.4. (spawn_lshd): On failure, return exit code 1 from the function, instead of invoking test_fail. * src/testsuite/lsh-6-test: Fixed handling of return value from spawn_lshd. * src/testsuite/lcp-test: Use die instead of test_fail. * src/testsuite/lsh-decrypt-key-test: Likewise. * src/testsuite/inetd-test: Use test_done. * src/testsuite/keygen-1-test: Likewise. * src/testsuite/keygen-2-test: Likewise. * src/testsuite/lsh-1-test: Likewise. * src/testsuite/lsh-2-test: Likewise. * src/testsuite/lsh-3-test: Likewise. * src/testsuite/lsh-5-test: Likewise. * src/testsuite/lsh-7-test: Likewise. * src/testsuite/lsh-8-test: Likewise. * src/testsuite/lsh-9-test: Likewise. * src/testsuite/lsh-encrypted-key-test: Likewise. * src/testsuite/lshd-no-auth-test: Likewise. * src/testsuite/lshg-1-test: Likewise. * src/testsuite/lshg-tcpip-local-test: Likewise. * src/testsuite/seed-test: Likewise. * src/testsuite/socks4-test: Likewise. * src/testsuite/socks5-test: Likewise. * src/testsuite/tcpip-local-in-use-test: Likewise. * src/testsuite/tcpip-local-test: Likewise. * src/testsuite/tcpip-remote-test: Likewise. * src/testsuite/write-key-1-test: Likewise. * src/testsuite/write-key-2-test: Likewise. * src/testsuite/x11-1-test: Likewise. 2004-11-26 Niels Möller * src/io.c (io_bind_local): NUL-terminate AF_UNIX socket name. 2004-11-25 Niels Möller * misc/xenofarm.sh: Don't insist on using GNU make. If we're not using GNU make, disable dependency tracking, since it wont' work with nettle. 2004-11-23 Niels Möller * acinclude.m4 (LSH_DEPENDENCY_TRACKING): New configure flag --disable-dependency-tracking. New substitution DEP_INCLUDE. * src/lshg.c (make_lshg_connect): New argument, resource. (main): Pass options->super.resources to make_lshg_connect. * src/gateway_commands.c (gateway_make_connection): New argument, a resource to be adopted by the connection. (gateway_init): Likewise. (gateway_accept): Pass a NULL-resource to gateway_make_connection. 2004-11-22 Niels Möller * src/client.c (init_client_options): Init the resources list. (make_client_session): Use IO_STDERR. Add the session resources to options->resources, instead of calling gc_global. * src/client.h (client_options): New attribute, resources. * src/srp-gen.c (main_argp_parser): Updated for changes to io_write_file. * src/lshd.c: Updated for changes to handshake_command. Pass a NULL resource. (make_lshd_listen_callback): Updated for changes to make_handshake_info. * src/lsh.c (do_lsh_lookup): Use a single A_WRITE to write the acl-entry to a file. (make_lsh_connect): New argument resource. Deleted kexinit argument (it's now part of handshake_info). Use the new protect command, to pass the resource to handshake, and destroy it on exceptions. (main_argp_parser): Updated for changes io_write_file. (main): Updated for changes to make_lsh_connect and make_handshake_info. Pass options->super.resources to the handshake command. * src/io.c (WITH_LIBOOP_SIGNAL_ADAPTER): Compile time choice of whether or not to use the liboop signal adapter. (io_init) [WITH_LIBOOP_SIGNAL_ADAPTER]: Create signal adapter. (io_final) [WITH_LIBOOP_SIGNAL_ADAPTER]: Destroy signal adapter. (make_lsh_fd): Files of both types IO_STDIO and IO_STDERR are shared. Bugfix: Don't reset type to zero. (write_only_file): New class. (do_write_only_file, make_io_write_file): New function. (io_write_file): Don't create a lsh_fd. Instead, use the simpler write_only_file, and return a struct abstract_write *. These files are never closed. (close_fd): Don't close files of type IO_STDERR. For files of type IO_STDIO, close them, and map the fd to /dev/null. * src/io.h (io_type): New enum constant IO_STDERR. * src/handshake.c (make_handshake_info): New argument kexinit. (handshake_command): New first argument, a resource to be adopted by the connection. Deleted the kexinit argument, kexinit is now passed as an attribute of handshake_info. * src/handshake.h (handshake_info): New attribute kexinit. * src/gc.c (gc_iterate_objects): New function (#if:ed out), for debugging purposes. * src/command.c (catch_collect_body): Deleted unused class. (do_catch_collect_body, make_catch_collect_body, do_catch_simple): Deleted functions. (protect_handler): New class. (protect_command)): New command. * src/command.h (catch_command): Deleted unused class. 2004-11-20 Pontus Freyhult * doc/Makefile.am (man_MANS): Added new manpages so they'll be installed. (EXTRA_DIST): Added man_MANS. * doc/lsh.texinfo (Files and environment variables): Added documentation for LSHFLAGS, LSHGFLAGS, SSH_CLIENT and SSH_TTY. (Converting keys): Added lsh-export-key example. Rewrote part about lshs SPKI format slightly. * doc/lshg.1: LSHGFLAGS, not LSHG_FLAGS. * doc/lshg.1: LSHFLAGS, not LSH_FLAGS. * doc/ssh-conv.1, doc/lsh-upgrade.1, doc/lsh-make-seed.1, doc/lsh-keygen.1, doc/lsh-keygen.1, doc/lsh-export-key.1, doc/lsh-decrypt-key.1, doc/lsh-decode-key.1, doc/lsh-writekey.1, doc/lsh-authorize.1, doc/lsh-upgrade-key.1, doc/lsh.1, doc/lshd.8, doc/lshg.1: Added disclaimer pointing to info system. * doc/ssh-conv.1 (lsh-decode-key): New manpage. * doc/lsh-upgrade.1: Misc. fixes. * doc/lsh-make-seed.1: New manpage. * doc/lsh-keygen.1: New manpage. * doc/lsh-export-key.1: New manpage. * doc/lsh-decrypt-key.1: New manpage. * doc/lsh-decode-key.1: New manpage. * doc/lsh-writekey.1: New manpage. 2004-11-19 Niels Möller * src/io.c (io_final): Assert that nfiles == 0. (do_buffered_read): Added trace output on EOF. (do_consuming_read): Likewise. (close_fd_write): Added trace output. Close the file if there's no write buffer and no read callback. * src/io.h (class lsh_fd): Deleted unused attribute next. 2004-11-19 Pontus Freyhult * doc/lsh-authorize.1, doc/lsh-upgrade-key.1, doc/lsh-upgrade.1, doc/lsh.1, doc/lshd.8, doc/lshg.1: Added missing dot in AUTHOR sentence. * doc/lsh.texinfo (Converting keys): Added example for sshd host. (Features): Added bit about SOCKS proxy feature. * src/lshg.c (main_options): Added missing dot in -G option help. * doc/lsh.1: Updated for lsh 2.0. * doc/lshd.8: Updated for lsh 2.0. * doc/lshg.1: New man page. * doc/lsh-authorize.1: New man page. * doc/lsh-upgrade.1: New man page. * doc/lsh-upgrade-key.1: New man page. 2004-11-18 Niels Möller * acinclude.m4 (LSH_DEPENDENCY_TRACKING): Use [!...] instead of [^...] for inverted character classes in case. * src/Makefile.am (bin_SCRIPTS): Install the lcp script. * src/lsh-export-key.c (enum output_mode): New enum. (encode_base64_line): New function. (sexp_to_ssh2_key): Alternative output formats, fingerprint and openssh single-line format. (main_options): New options --fingerprint and --openssh. (make_options): Make standard format the default output format. (main_argp_parser): Handle new options. * src/spki.c (spki_make_verifier): New third argument for returning the name of the algorithm. Updated callers. * misc/xenofarm.sh (oopcfgargs): Disable all add-on liboop adapters. 2004-11-18 Niels Möller * README: Updated examples, and the lists of needed tools and libraries. * misc/xenofarm.sh (oopcfgargs): Build liboop with --disable-shared. 2004-11-17 Niels Möller * src/unix_random.c (do_trivia_source): Check HAVE_GETRUSAGE. * src/lsh-writekey.c (main_argp_parser): Fixed C99-ism. 2004-11-16 Niels Möller * misc/getopt.h: Deleted __ from argument names in prototypes, i.e. "argc", not "__argc". Needed for mingw compilation. * .bootstrap: Typo fix. * misc/getopt.c, misc/getopt1.c, misc/getopt.h: Moved files here. Linked into the directories that need them by ./.bootstrap. * src/environ.h.in (USER_NAME_FROM_ENV): Check $USER first. 2004-11-14 Niels Möller * src/io.c (handle_nonblock_error): Ignore errno ENOTTY. FreeBSD 5 returns this error code when we try to set /dev/null in non-blocking mode. * src/environ.h.in (USER_NAME_FROM_ENV): New macro, which consults both $LOGNAME and $USER. * src/client.c (init_client_options): Use it. * src/srp-gen.c (make_srp_gen_options): Likewise. * src/lshd.c (main_argp_parser): Likewise. * src/lsh-writekey.c (main_argp_parser): Likewise. * src/server_pty.c: When using snprintf, NUL-terminate the strings explicitly. * .bootstrap: Link misc/vsnprintf.c info the argp and sftp directories. * misc/vsnprintf.c: Portable and public domain implementation of snprintf and vsnprintf, copied from http://www.fiction.net/blong/programs/snprintf.c, with some minor fixes. This file is moved here from the src/argp directory. * src/testsuite/Makefile.am (CLEANFILES): Delete testfiles lcp-file-*.txt (TS_SH): Added lcp-test. * src/testsuite/lcp-test: Test cases for lcp. 2004-11-13 Niels Möller * src/lcp: Reviewed, and fixed some bugs. Looks at $LCP_RSH, instead of $LCP_SSH. * acinclude.m4 (LSH_DEPENDENCY_TRACKING): Don't add dependency files themselves as targets. * misc/xenofarm.sh (status): There's no config.h in the liboop directory, so don't try to copy it. 2004-11-12 Niels Möller * misc/xenofarm.sh (--make-program): New command line option. 2004-11-09 Niels Möller * src/lsh-krb-checkpw.c (main): Noted that the current code seems to work only with Heimdal, not MIT kerberos. * configure.ac: Check for krb5_verify_user_lrealm, and disable kerberos support if not found. 2004-11-09 Niels Möller * doc/lsh.texinfo: Set UPDATED-FOR to 2.0. * misc/xenofarm.sh: Fixed typos in the oop-related tasks. 2004-11-07 Niels Möller * doc/lsh.texinfo (Action options): Documented -D (socks forwarding). * misc/xenofarm.sh: If a liboop dist is included in the build package, install it in $pfx before trying to build lsh. 2004-10-26 Niels Möller * acinclude.m4 (LSH_DEPENDENCY_TRACKING): Need extra quoting in case pattern. 2004-10-20 Niels Möller * acinclude.m4 (LSH_DEPENDENCY_TRACKING): Disable dependency tracking for gcc-2. 2004-10-20 Niels Möller * .bootstrap: Link install-sh, texinfo.tex, COPYING and INSTALL into the nettle subdir. 2004-10-19 Niels Möller * acinclude.m4 (LSH_DEPENDENCY_TRACKING): New macro. (LSH_MAKE_CONDITIONAL): New macro. * .bootstrap: In the nettle subdir, link acinclude.m4 as aclocal.m4, not acinclude.m4. 2004-10-08 Niels Möller * src/client_userauth.c (do_userauth_info_request): Enforce limits on the length of name and instruction. Prepend the name and an empty line to the instruction. * src/unix_interact.c (unix_dialog): Deleted instruction argument, display dialog->instruction instead. * src/interact.h (interact_dialog): New instruction attribute. (INTERACT_DIALOG): Deleted instruction argument. * src/interact.c (make_interact_dialog): Initialize self->instruction to NULL. 2004-10-07 Niels Möller * src/lsh-writekey.c (main_argp_parser): When --server is given, don't use encryption by default. * src/testsuite/login-auth-test (LSHD_FLAGS): Use --login-shell instead of --login-program. * doc/lsh.texinfo: Updated for version 1.5.6. * src/lshd.c (make_lshd_options): New default: Enable X11 forwarding. (main_options): Deleted broken --login-program option. * src/lsh-writekey.c (make_lsh_writekey_options): New default: Encrypt private key using aes256-cbc. * src/lsh-keygen.c (make_lsh_keygen_options): New default: Generate RSA keys. * src/testsuite/keygen-1-test: Pass -c none to lsh-writekey. * src/testsuite/keygen-2-test: Likewise. * src/testsuite/lsh-decrypt-key-test: Likewise. * src/testsuite/setup-env: Likewise. * src/testsuite/write-key-1-test: Likewise. * src/testsuite/write-key-2-test: Likewise. 2004-10-06 Niels Möller * src/testsuite/Makefile.am (EXTRA_DIST): Added UTF-8-test.txt. 2004-10-05 Niels Möller * src/Makefile.am (GPERF_FLAGS): Added -k21, to distinguish diffie-hellman-group1-sha1 and diffie-hellman-group2-sha1. * src/lsh.c (main_argp_parser): Support "diffie-hellman-group2-sha1". * src/lshd.c (main_argp_parser): Likewise. * src/atoms.in (diffie-hellman-group2-sha1): New name, for now an alias to diffie-hellman-group14-sha1. * src/testsuite/inetd-test: Start lshd with --daemon --no-syslog. Note that this test is not yet enabled, and inetd mode not working. * src/parse.c (parse_utf8): Keep track of the length of invalid sequences. Moved the check for overlong sequences, not it's done after the complete sequence is processed. * src/charset.c (low_utf8_to_local): If utf8_tolerant is set, replace invalid utf8 sequences with '?'. Used mainly by the testsuite. * src/charset.h (enum utf8_flag): New flag utf8_tolerant. * src/testsuite/utf8-test.c: New test program. * src/testsuite/Makefile.am (TS_PROGS): Added utf8-test. * src/testsuite/UTF-8-test.txt: Markus Kuhn's utf8 testfile. * src/testsuite/functions.sh: Added -q to LSHD_FLAGS again. 2004-10-02 Niels Möller * src/daemon.c (daemon_started_by_inetd): More debug output. Implemented client-side "keyboard-interactive". * src/unix_interact.c (unix_read_password): Split off... (read_password): New function, reads password and doesn't free prompt. (unix_dialog): New function. * src/ssh.h (SSH_MSG_USERAUTH_INFO_REQUEST) (SSH_MSG_USERAUTH_INFO_RESPONSE): New constants. * src/server_password.c (do_authenticate): Disallow control characters in user names. * src/server_userauth.c (do_none_preauth): Likewise. * src/server_publickey.c (do_authenticate): Likewise. * src/parse.c (parse_utf8): New argument *utf8_length. Treat overlong sequences surrigates and the non-characters 0xfffe and 0xffff as errors. * src/lsh.c (make_lsh_login): Use keyboard-interactive, if the other methods fail. * src/scm/gaba.scm (make-freer): Free elements of allocated arrays, i.e. variables of type "space". * src/interact.h (interact_dialog): New class. (INTERACT_DIALOG): New method. * src/interact.c (make_interact_dialog): New function. * src/debug.c (do_debug): Censor packets of type SSH_MSG_USERAUTH_INFO_RESPONSE. * src/client_userauth.c (client_password_method): Renamed class to... (client_userauth_interactive_method): ... Used for both "password" and "keyboard-interactive". (format_userauth_kbdinteract, format_userauth_info_response): New functions. (client_kbdinteract_state, userauth_info_request_handler): New classes. (do_userauth_info_request, make_userauth_info_request_handler) (do_kbdinteract_failure, make_client_kbdinteract_state) (do_kbdinteract_login, make_client_kbdinteract_auth): New functions. * src/atoms.in: Added "keyboard-interactive". Changes to utf8 decoding. * src/charset.h (enum utf8_flag): New enum. * src/charset.c (utf8_to_local, low_utf8_to_local): Implemented control character fitlering. Replaced STRICT argument with two flags utf8_replace and utf8_paranoid. (ucs4_is_control): New function. (local_is_utf8): Deleted function. * src/werror.c (werror_vformat): Improved utf8 handling. Always convert with utf8_replace, and add utf8_paranoid in paranoia mode. 2004-09-22 Niels Möller * acinclude.m4 (LSH_CCPIC): Don't use -fpic on cygwin. 2004-08-31 Niels Möller * acinclude.m4 (LSH_CCPIC): New macro. 2004-07-16 Niels Möller * src/client.c (do_background_process): Fixed C99-ism. 2004-06-22 Niels Möller * src/parse.c (parse_utf8): Use unsigned variables. * src/testsuite/inetd-test: New test case, not yet enabled. 2004-06-17 Niels Möller * src/parse.c (parse_utf8): Check that the buffer doesn't end in the middle of an utf8 sequence. 2004-06-15 Niels Möller * src/version.h (SOFTWARE_SLOGAN): New macro; string appended to the software version in the initial handshake. * src/lsh.c (main_argp_parser): Added support for diffie-hellman-group14-sha1. * src/lshd.c (main_argp_parser): Likewise. * src/dh_exchange.c (make_dh14): New function. * src/publickey_crypto.c (zn_member): Deleted unused method. (zn_range, zn_invert, zn_mul, zn_exp, zn_exp_ui, zn_add, zn_sub): Non-static functions replaces the GROUP_COMBINE etc methods. (make_group_zn, make_ring_zn): Deleted functions... (make_ssh_group): ... replaced by new funtion. (make_ssh_group1, make_ssh_ring_srp_1): Use make_ssh_group. (make_ssh_group14): New function. * src/publickey_crypto.h (abstract_group): Deleted class and methods. (zn_group): Declare class here, and plain functions for using it. Replaced all uses of struct abstract_group with const struct zn_group. (dh_instance): Use const for the dh_method pointer. * src/atoms.in: Added diffie-hellman-group14-sha1. 2004-06-12 Niels Möller * configure.ac: Bumped version to 1.5.6. * Released lsh-1.5.5. 2004-06-10 Niels Möller * src/keyexchange.c (parse_kexinit): Deleted unused argument peer_flags. * misc/Makefile.am (EXTRA_DIST): Include tsocks-forcelocal.patch. * src/algorithms.c (lookup_hash): Deleted unused function. (all_symmetric_algorithms): Deleted old aes alias rijndael-cbc@lysator.liu.se. Added official serpent name serpent256-cbc. The alias serpent-cbc@lysator.liu.se should be removed at a later date. (all_crypto_algorithms): Likewise. (lookup_crypto): Likewise. * src/atoms.in: Deleted spki-related atoms, now handled by libspki. Also deleted pkcs5-related atoms that aren't used. Deleted rijndael-cbc@lysator.liu.se. 2004-06-09 Niels Möller * src/testsuite/functions.sh: Removed -q from LSHD_FLAGS. * src/server_pty.c (SYSTEM_GROUP): New macro. (pty_check_permissions): If there's no "tty" group, try "system". * src/testsuite/Makefile.am (TS_SH): Removed ssh1-fallback-test. (EXTRA_DIST): Removed fake-sshd1. * src/testsuite/fake-sshd1, src/testsuite/ssh1-fallback-test: Deleted files. * src/version.h (SSH1_SERVER_PROTOCOL_VERSION): Deleted. * src/Makefile.am (liblsh_a_SOURCES): Removed ssh1_fallback.c. * src/lshd.c: Removed the ssh1-fallback option. * src/handshake.c (do_line): Made the server disallow banner lines from clients. * configure.ac: Deleted option --with-sshd1. * src/io.c (io_set_blocking): Deleted function. * src/handshake.c (connection_line_handler): Deleted fd and fallback attributes. (make_connection_read_line): Deleted fd and fallback arguments. (make_handshake_info): Deleted fallback argument. Updated callers. (do_line): Deleted ssh1-fallback handling. * src/ssh1_fallback.h, src/ssh1_fallback.c: Deleted file. * src/handshake.h (handshake_info): Deleted fallback attribute. * doc/lsh.texinfo (Invoking lshd): Deleted --ssh1-fallback. * src/keyexchange.c (KEXINIT_MAX_ALGORITMS): Increased limit to 500. (parse_kexinit): Deleted code handling of PEER_KEXINIT_LANGUAGE_KLUDGE. * src/handshake.c (compat_peer_flags): #if:ed out function. * src/connection.h (enum peer_flags): Deleted constants. * configure.ac: Deleted option --disable-datafellows-workarounds. * src/proxy_x11forward.c (do_proxy_open_x11): Deleted code handling PEER_X11_OPEN_KLUDGE. 2004-06-08 Niels Möller * src/client.c (client_prepend_action): New function. * src/client.c (client_options): New option --write-pid, to be used together with -B. (do_background_process): Optionally write the child pid to stdout. (make_background_process): New function. (client_argp_parser): When processing -B, pass the value of write_pid to make_background_process. (client_argp_parser): Handle --write-pid. Testsuite tweaks. * src/testsuite/lshg-1-test, src/testsuite/lshg-cat-2-test, src/testsuite/lshg-cat-test, src/testsuite/lshg-tcpip-local-test, src/testsuite/socks4-test, src/testsuite/socks5-test, src/testsuite/tcpip-local-in-use-test, src/testsuite/tcpip-local-test: Deleted unnessary sleep calls. * src/testsuite/functions.sh (at_connect): For the tcpip-local-in-use-test to work, we must record the mini-inetd pid, and kill it before exiting. * src/testsuite/functions.sh (spawn_lsh, spawn_lshg): Use new --write-pd option and -B to start processes in the background. * src/lsh.c (main_argp_parser): Use client_prepend_action to make sure that the gateway is started first. Removal of old bug-compatibility code. * src/handshake.c: Deleted most of the bug-compatibility flags. * src/client_userauth.c (do_userauth_pk_ok): Deleted handling of PEER_USERAUTH_REQUEST_KLUDGE. * src/server_publickey.c (do_authenticate): Likewise. * src/server.c (format_service_accept_kludge): Deleted function. (do_service_request): Deleted handling of PEER_SERVICE_ACCEPT_KLUDGE. * src/client.c (do_accept_service): Deleted handling of PEER_SERVICE_ACCEPT_KLUDGE. * src/proxy.c (do_proxy_accept_service): Likewise. * src/dsa.c (do_dsa_verify, do_dsa_sign): Deleted handling of ATOM_SSH_DSS_KLUDGE_LOCAL. * src/client_keyexchange.c (do_handle_dh_reply): Deleted handling of PEER_SSH_DSS_KLUDGE. * src/server_keyexchange.c (do_init_server_dh): Likewise. * src/server_publickey.c (do_authenticate): Likewise. * src/atoms.in: Deleted ssh-dss-kludge@lysator.liu.se. 2004-06-08 Niels Möller * src/client.c (client_options): Deleted --cvs-workaround option. (client_argp_parser): Deleted handling of --cvs-workaround. (fork_input): Deleted function. (fork_output): Deleted function. (make_client_session): Keep our original stdio fd:s in blocking mode, and pass the type IO_STDIO to make_lsh_fd when appropriate. (do_detach_cb): Resetting stdio to blocking mode is no longer needed. * src/client.h (client_options): Deleted stdin_fork, stdout_fork and stderr_fork attributes. * src/werror.c (set_error_nonblocking): Deleted function. * src/server_session.c (spawn_process): Pass correct type (IO_NORMAL or IO_PTY) to make_lsh_fd. io_set_type is no longer needed. * src/io.h (enum io_type): New type IO_STDIO. * src/io.c (io_final): No longer any need to reset stdio file descriptors to blocking mode. (write_raw_with_poll): Deleted function. (io_set_type): Deleted function. (io_init_fd): New argument, allowing certain fd:s to remain in blocking mode. (make_lsh_fd): New argument TYPE. Updated callers. (close_fd): Don't close fd:s that are of type IO_STDIO. 2004-04-07 Niels Möller * src/server_pty.c (pty_open_slave): More verbose messages on failure. * src/write_packet.c (do_write_packet): Deleted debug output that may contain passwords. 2004-03-20 Niels Möller * configure.ac: Use AC_CONFIG_AUX_DIR([.]). 2004-03-18 Niels Möller * misc/run-tests (test_program): Strip .exe suffix from name. 2004-03-17 Niels Möller * src/testsuite/Makefile.am (TS_SH): Run the socks4 and socks5 tests. This is pointless, and hopefully harmless, on machines that don't have my hacked version of tsocks. * src/socks.c (socks_reply): Send a version 4 reply, if appropriate. (do_read_socks): Almost implemented socks4. Handling of username is slightly broken. * src/testsuite/socks4-test: New file. * src/testsuite/socks4-config: New file. * misc/tsocks-forcelocal.patch: New file. * misc/tsocks-forcelocal.patch: Also patch the tsocks script to look for the library in $libdir. 2004-03-15 Niels Möller * src/testsuite/socks5-config: Added forcelocal keyword. 2004-03-01 Niels Möller * src/testsuite/functions.sh (need_tsocks): New function. 2004-03-01 Niels Möller * acinclude.m4 (LSH_FUNC_ALLOCA): Check for malloc.h, and include it if it exists. Needed for alloca on windows. 2004-02-29 Niels Möller * src/testsuite/socks5-config: tsocks configuration file for socks5 test case. * src/testsuite/socks5-test: New socks5 test. * src/testsuite/tcpip-local-test: Check both directions of forwarded channel. * src/io.c (io_connect_list): Avoid resource leakage if the address list is empty, or all connection attempts fail immediately. * src/socks.c (do_read_socks): Bugfix, update self->pos. * src/client.c (client_arg_unsigned): Typo fix. * src/lshg.c (main_options): Deleted short options -I and -D. The corresponding long options --send-debug and --send-ignore remains. * src/socks.c (do_read_socks): Fixed bugs in parsing of client's first message. 2004-02-27 Niels Möller * src/client.c (client_argp_parser): New command line option -D, --forward-socks. (client_arg_unsigned): New function. * src/lshd.c: Don't include tcpforward_commands.h. * src/tcpforward_commands.c (make_open_tcpip_command): Made non-static. (open_direct_tcpip): Moved declaration back here, reverting yesterday's change. * src/tcpforward_commands.h: Deleted file. Prototypes moved to... * src/tcpforward.h: ...here. * src/socks.c: Rewritten. A successful connect should transform the control channel into a data channel. * src/process_atoms: Added extra quotes needed to get the length of "*" into atoms_table.c. * src/lsh.c (main): make_lsh_connect now returns a struct command *, so can delete one CAST_SUBTYPE. * src/channel_forward.c (channel_forward_start_io_read): New function. 2004-02-26 Niels Möller * src/lsh_string.c (lsh_string_ntop): Use const void * for the input. * src/tcpforward_commands.h (open_direct_tcpip, OPEN_DIRECT_TCPIP): Moved declarations here... * src/tcpforward_commands.c: ... from here. * src/socks.c: New file. * src/Makefile.am (liblsh_a_SOURCES): Added socks.c. * src/scm/gaba.scm (process-expr): Let the generated code return a struct command *, not a struct lsh_object *. * src/dummy.c (cbc_encrypt, cbc_decrypt): Use nettle_crypt_func for typing. 2004-02-25 Niels Möller * misc/xenofarm.sh (cfgwarn, makewarn, ckprgwarn): Renamed variables log, warn and fail. 2004-02-24 Niels Möller * misc/xenofarm.sh (dotask): Fixed handling of $var. (cfgwarn, makewarn, ckprgwarn): Use $task when constructing filenames. * misc/xenofarm.sh: Fixed tasks argpmake and nettlemake. New tasks ckargp and cknettle. * src/Makefile.am (lshg_SOURCES, lshg_LDADD): Avoid linking with nettle. Need to link with dummy.o instead. * src/dummy.c: New file. * misc/xenofarm.sh (cfgargs): Add the flags we want to use to cfgargs. (dotask): New optional argument with the name of the status variable. 2004-02-20 Niels Möller * src/process_atoms: Fixes to make it work with Solaris /bin/sh. Replaced uses of echo -n with printf(1), and ${#foo} with `expr $foo : '.*'`. 2004-02-20 Niels Möller * src/scm/Makefile.am (EXTRA_DIST): Deleted make-char-classes. * configure.ac: Deleted tests for bash. * src/Makefile.am (atoms_gperf.c, atoms_table.c): Don't use bash to run process_atoms script. (packet_types.h): Don't use bash to run the invert-defs script. 2004-02-19 Niels Möller * src/scm/guile-compat.scm: Deleted most of the contents. * src/scm/make-char-classes.scm: Deleted obsolete file. 2004-02-18 Niels Möller * src/Makefile.am (prime_table.h, sexp_table.h, digit_table.h): Deleted rules for building obsolete files. 2004-02-18 Pontus Sköld * src/process_atoms: Converted script from bash to /bin/sh. 2004-02-17 Niels Möller * src/unix_user.c (do_lookup_user) [!HAVE_SHADOW_H]: Enable shadow database code only if shadow.h can be included. * src/unix_process.c (do_logout_notice): Deleted gratious semicolon at end of function definition. (do_utmp_cleanup): Use UTMPX_UT_EXIT___E_TERMINATION and UTMPX_UT_EXIT_UT_TERMINATION. * configure.ac: Check for ut_exit.__e_termination and ut_exit.ut_termination in struct utmp and struct utmpx. 2004-02-16 Niels Möller * configure.ac: Added gss-related configure checks (patch from Simon Josefsson). 2004-02-15 Niels Möller * src/testsuite/Makefile.am (AM_CPPFLAGS): Need -I.., in order to include nettle-types.h. * src/unix_user.c (do_lookup_user): Just ignore shadow database if getspnam returns NULL. * src/lsh.h: #include nettle/types.h instead of inttypes.h. * src/atoms.h: #include lsh.h instead of inttypes.h. * src/charset.h: Likewise. * src/tty.h: Likewise. * src/testsuite/testutils.h: Likewise. * configure.ac: Bumped version to 1.5.5. 2004-02-13 Niels Möller * src/ssh.h: Added GSSAPI constants (patch from Simon Josefsson). * src/atoms.in: New symbol "gssapi". 2004-02-12 Niels Möller * src/io.c (address_info2sockaddr) [!HAVE_GETADDRINFO]: Updated code to work with new string abstraction. 2004-02-12 Niels Möller * configure.ac: No space between "-I" and include directories. 2004-02-08 Niels Möller * Released lsh-1.5.4. Implemented flow control for the connections write_buffer. The buffer is now of limited size. When it starts to get large, channel i/o is disabled. If it hits the limit, the connection is closed. * src/connection.c (WRITE_BUFFER_MAX, WRITE_BUFFER_MARGIN): New constants. (connection_flow_controlled): New class. (do_connection_flow_controlled): Reenable channel i/o when we have room in the write buffer. (make_ssh_connection): Initialize ssh_connection attributes wakeup, soft_limit and hard_limit. (connection_init_io): Changed argument type from struct abstract_write to struct lsh_fd. Install flow control on the socket's write_buffer. Deleted the randomness argument, and don't call make_packet_write. This way, both handshake_command and gateway_make_connection can call this function. (connection_wakeup): New function, which installs a wakeup callback on the connection. (connection_send_kex): Compare the size of the write_buffer to the soft and hard limits. (connection_send_kex_end): Invoke wakeup callback, if it's non-NULL. * src/connection.h (ssh_connection): New attribute socket, replaces old attribute raw. New attributes hard_limit and soft_limit. * src/read_data.c (do_read_data_query): Stop reading, if connection->hard_limit is set, indicating an almost full write_buffer for the connection. * src/handshake.c (handshake_command): Adapt to changed connection_init_io. Use connection->socket instead of connection->raw. * src/gateway_commands.c (gateway_make_connection): Use connection_init_io, so that flow control is set up properly. * src/channel.c (window_adjust_handler): Deleted redundant assert. (do_channels_after_keyexchange): Renamed to do_channels_wakeup. No longer needs to reinstall the handler. (init_connection_service): Use connection_wakeup, not connection_after_keyexchange. 2004-02-07 Niels Möller * install-sh: Removed from CVS repository. Let automake supply it. * acinclude.m4 (LSH_FUNC_ALLOCA): Include , if available, also when compiling with gcc. 2004-01-08 Niels Möller * src/rsync/rsync.h: Don't include inttypes.h, just let define uint8_t and other types. * src/Makefile.am (AM_CPPFLAGS): Added -I./nettle. Needed to find the nettle-types.h include file when building outside of the source directory. (packet_types.h): Changed rule to use $< to refer to the input file. * src/testsuite/Makefile.am (AM_CPPFLAGS): Added -I../nettle. * src/rsync/Makefile.am (AM_CPPFLAGS): Added -I../nettle. 2004-01-08 Niels Möller * src/tcpforward.c (do_channel_open_direct_tcpip): Log direct-tcpip request. (do_tcpip_forward_request): Log forward-tcpip request. 2004-01-08 Niels Möller * configure.ac: No space between "-L" and library directories. 2004-01-07 Niels Möller * acinclude.m4 (AX_CREATE_STDINT_H): Copied macro definition from http://ac-archive.sourceforge.net/guidod/ax_create_stdint_h.html. 2003-11-18 Niels Möller * src/unix_process.c (utmp_book_keeping) [UTMPX_UT_SYSLEN]: Use lsh_string_length. 2003-11-17 Niels Möller * src/read_packet.c (class read_packet): New attribute mac_computed. (lsh_string_realloc): Deleted function. (do_read_packet, make_read_packet): Allocate block_buffer, mac_buffer and mac_computed at creation time, using SSH_MAX_BLOCK_SIZE and SSH_MAX_MAC_SIZE. * src/ssh.h (SSH_MAX_BLOCK_SIZE, SSH_MAX_MAC_SIZE): New constants, with the implementations's maximum block size and mac size. 2003-11-16 Niels Möller * src/lsh-writekey.c (main_argp_parser): Move declaration to support C90. * src/Makefile.am (liblsh_a_SOURCES): Added lsh_string.c. * src/lsh_string.c, src/lsh_string.h: New files, with a private string implementation. The point is that no other code should write directly into strings or other buffers. * src/gateway_commands.c (class read_gateway_packet): Use an lsh_string for the header buffer, not a plain char array. * src/read_line.c (class read_line): Likewise, for the line buffer. * src/write_buffer.h, src/write_buffer.c (class write_buffer): Likewise for the output buffer. * src/pkcs5.c (pkcs5_derive_key): Take lsh_string arguments, and return key as an lsh_string. Also use lsh_strings internally, instead of plain char buffers. * src/format.c (ssh_format_write, ssh_vformat_write) (format_hex_string, format_decimal, write_decimal_length): Take a lsh_string and position for the destination. Updated to use functions from lsh_string.c. Moved some functions to lsh_string.c. (lsh_string_colonize): Use const for input string. Use lsh_string_putc. (lsh_string_bubblebabble): Use lsh_string_putc. No need for explicit NUL-termination. Use const for input string. * src/format.c (ssh_format): Changed definition of %r, now stores the start position of the reserved area, not a pointer. Updated all callers. * src/lock_file.c, src/lsh-make-seed.c, src/server_session.c, src/server_x11.c: #include lsh_string.h. * src/spki.c (spki_hash_data): Rewritten to use hash_digest_string instead of hash_digest. * src/testsuite/testutils.c (decode_hex): Use const for input. Also other updates for lsh_string changes. * src/zlib.c (do_zlib): Use lsh_string_zlib. Updated for lsh_string changes. * src/werror.c (werror_decimal): Rewrote to not use format_decimal. (werror_hexdump): Use const for input. (werror_vformat): Updated for lsh_string changes. * src/unix_user.c (kerberos_check_pw, do_verify_password): Updated for lsh_string changes. * src/unix_interact.c (unix_yes_or_no): Updated for lsh_string changes. * src/string_buffer.h (struct string_buffer): Replaced current pointer with an integer position. * src/string_buffer.c: Updated for lsh_string changes. * src/spki.c (spki_pkcs5_encrypt): Use const for input argument. * src/server_userauth.c (do_handle_userauth): Updated for lsh_string changes. * src/server_publickey.c (do_authenticate): Updated for lsh_string changes. * src/server_pty.c (pty_open_slave): Updated for lsh_string changes. * src/read_file.c (do_read_file): Updated for lsh_string changes. * src/parse_config.c: #include lsh_string.h. * src/lsh.h: Removed declarations for lsh_string. This is now provate to lsh_string.c. Only kept a forward declaration of struct lsh_string, and a declaration of lsh_string_free. * src/lsh-export-key.c (encode_base64): Use lsh_string.c functions. * src/lsh-decrypt-key.c (main): Updated for lsh_string changes. * src/lsh-decode-key.c (main): Use lsh_string_base64_decode. * src/io.c (do_consuming_read, io_read_file_raw): Use lsh_string_read. (do_write_callback): Updated for lsh_string changes. (sockaddr2info): Use lsh_string_ntop. * src/handshake.c (compat_peer_flags, split_version_string) (do_line): Use const for input strings. * src/read_line.h (class line_handler): Use a const for the handler method. * src/dsa.c (make_ssh_dss_verifier): Use a lsh_string for the input. Updated for lsh_string changes. * src/rsa.c (make_ssh_rsa_verifier): Likewise. * src/publickey_crypto.h: Updated prototypes. * src/sexp.c (lsh_sexp_format): Function renamed to lsh_string_format_sexp, and moved to lsh_string.c. Updated callers. * src/daemon.c (daemon_pidfile): Updated for lsh_string changes. * src/client_keyexchange.c (do_handle_dh_reply): Updated for lsh_string changes. * src/client.c (rebuild_command_line): Use lsh_string_write. * src/charset.c: Updated for lsh_string changes. (low_utf8_to_local): Use const for input. * src/xalloc.c: Removed string related functions. Moved to lsh_string.c. * src/gc.c (gc): Use lsh_get_number_of_strings to access string counter. (gc_final): Call lsh_string_final_check. * src/abstract_crypto.h (CRYPT): Changed method to take an lsh_string and an index for source and destination. Also changed the order of source and destination arguments. (MAC_DIGEST): Take a lsh_string and index for the destination. * src/crypto.c: Rewrote cipher classes to use functions in lsh_string.c, instead of writing directly into the output string. (hash_digest_string): New function. (hash_digest): New function. (do_hmac_digest): Use lsh_string_write_hmac. * src/channel.c: Updated for lsh_string changes. * src/client_escape.c: Likewise. * src/client_userauth.c: Likewise. * src/client_x11.c: Likewise. * src/connection.c: Likewise. * src/debug.c: Likewise. * src/dh_exchange.c: Likewise. * src/keyexchange.c: Likewise. * src/lsh-writekey.c: Likewise. * src/lsh.c: Likewise. * src/read_packet.c: Likewise. * src/server.c: Likewise. * src/spki.c: Likewise. * src/srp-gen.c: Likewise. * src/srp_exchange.c: Likewise. * src/tcpforward.c: Likewise. * src/tty.c: Likewise. * src/unix_process.c: Likewise. * src/unix_random.c: Likewise. * src/write_packet.c: Likewise. * src/xauth.c: Likewise. 2003-11-11 Niels Möller * src/Makefile.am (liblsh_a_SOURCES): Deleted unpad.c. * src/xalloc.c (lsh_object_free): Changed to take a const argument. * src/read_packet.c (do_read_packet): Moved code for stripping padding and inflating read packets to this function. * src/handshake.c (do_line): Deleted calls to make_packet_unpad and make_packet_inflate. * src/unpad.c, src/unpad.h: Deleted files. * src/compress.c (class packet_compressor): Deleted class. (make_packet_codec): Deleted function. * src/compress.h (make_packet_deflate, make_packet_inflate): Deleted macros. 2003-11-10 Niels Möller * src/connection.c (connection_send_kex): New function, replacing macro C_WRITE_NOW. Updated all callers. * src/read_file.h: Deleted file. Moved declarations to... * src/abstract_io.h: ... here. Deleted all inclusions of read_file.h. 2003-11-09 Niels Möller * src/debug.h: Deleted file. Moved declarations to... * src/connection.h: ... here. Deleted all inclusions of debug.h. 2003-11-08 Niels Möller * src/Makefile.am (liblsh_a_SOURCES): Removed pad.c, encrypt.c. Added write_packet.c. * src/compress.c (do_packet_inflate): Keep sequence number. * src/pad.c, src/pad.h, src/encrypt.c, src/encrypt.h: Deleted files. * src/write_packet.c: New file and function, to replace pad.c and encrypt.c. * src/client.c, src/connection.c: Don't include pad.h and encrypt.h. * src/connection.h: Prototype for make_write_packet. * src/connection.c (connection_init_io): Use make_write_packet. 2003-10-30 Niels Möller * src/connection.h (C_WRITE): Deleted macro. Updated all callers to use connection_send directly. Changed gateway protocol, to not use any extra padding. * src/gateway_commands.c (do_read_gateway): New function (make_read_gateway): New function. (do_gateway_pad): New extra padding. (gateway_make_connection): No need to call make_packet_unpad. * src/abstract_io.h (class read_handler): Use a const uint8_t * argument for the handler method. * src/read_file.c (do_read_file): Const argument. * src/read_line.c (do_read_line): Likewise. * src/read_packet.c (do_read_packet): Likewise. 2003-10-23 Niels Möller * src/server_userauth.c: Rewrote comment about userauth serialization. * src/io.c (close_fd): Deleted fd = -1 special case. * src/connection.c (connection_lock, connection_unlock): Simplified. (do_exc_connection_handler): Deleted handling of EXC_PAUSE_CONNECTION and EXC_PAUSE_START_CONNECTION. * src/exception.h (EXC_PAUSE_CONNECTION) (EXC_PAUSE_START_CONNECTION): Deleted exception types. * src/dsa_keygen.c, src/rsa_keygen.c: Deleted files. Moved the dsa_generate_key and rsa_generate_key functions to ... * src/lsh-keygen.c: ... here. * src/dsa.c (generic_dsa_verify): Deleted function. (generic_dsa_sign): Likewise. 2003-10-22 Niels Möller * src/client_x11.c (client_x11_auth_info): Deleted commented out class. * src/server_session.c (do_alloc_pty): Return channel in question. (do_window_change_request): Likewise. (do_spawn_subsystem): Likewise. * src/gateway_channel.c (do_gateway_channel_request): Added FIXME on returned value. * src/server_x11.c (do_xauth_exit): Likewise. * src/client.c (do_exit_status): Return the channel in question to the continuation. (do_exit_signal): Likewise. * src/channel.c (channel_request_continuation): Expanded FIXME comment. * src/parse.h: Include nettle/bignum.h instead of bignum.h. * src/format.h: Don't include bignum.h. * src/keyexchange.h: Likewise. * src/publickey_crypto.c: Likewise. * src/werror.h: Likewise. * src/dh_exchange.c (dh_generate_secret): Use nettle_mpz_random. Needs inclusion of nettle/bignum.h. * src/bignum.c, src/bignum.h: Deleted files. * src/Makefile.am (liblsh_a_SOURCES): Deleted bignum.c * configure.ac: Bumped version to 1.5.4. * src/interact.h (INTERACT_READ_PASSWORD): Deleted the forth argument FREE. Now the prompt string is always consumed. Updated all callers. * src/unix_interact.c (unix_read_password): Deleted fourth argument FREE. * src/lsh.h: Forward declaration of catch_report_collect. * src/channel_forward.h: ... and deleted corresponding declaration here. * src/abstract_compress.c, src/abstract_compress.h: Deleted files. Moved contents to... * src/compress.c, src/compress.h: ... here. Updated users. * src/Makefile.am (liblsh_a_SOURCES): Removed abstract_compress. 2003-10-10 Niels Möller * src/unix_user.c (do_read_file_fail): Return the created exception. * src/lshd.c (main_argp_parser): Use getenv(ENV_LOGNAME), not getenv("LOGNAME"). 2003-10-05 Niels Möller * src/lsh.c (read_user_keys): Display error message for missing identity file only in verbose mode. Suggested by Thomas Krennwallner. 2003-09-27 Niels Möller * src/gateway_channel.c (do_channel_open_forward): Moved creation of ORIGIN channel object from here... (do_gateway_channel_open_continuation): ... to here. (make_gateway_channel_open_continuation): Deleted ORIGIN argument. * src/channel.c (channel_open_handler): Bugfix for the case that alloc_channel fails. 2003-09-26 Niels Möller * src/channel.c (login_service_command): Deleted redundant command. * src/lshd.c (main_options): #if:ed out login-auth-mode-user. (main_argp_parser): For login-auth-mode, we don't need a user database. Instead use make_unix_user_self and make_userauth_none_permit. (install_session_handler): New command. (lshd_login_service): Take the "session" channel open handler as argument. We don't need a general list of connection hooks. Use init_connection_service, not the reduntant init_login_service. (make_lshd_login_service): Simplified a little. * src/server_userauth.c (do_none_preauth, server_userauth_none_preauth): Userauth "none" handler which succeeds only if the user was authenticated during key exchange. (userauth_none_permit): New class. (do_none_permit): Userauth "none" handler which always succeeds. (make_userauth_none_permit): New function. (userauth_none): Deleted class. (do_none_authenticate, make_userauth_none): Deleted functions. * src/unix_user.c (chdir_home): Deleted function. (exec_shell): Take separate arguments for shell, home, name, uid and gid, not a struct unix_user. (spawn_error, spawn_parent, spawn_child): New helper functions, broken out of do_spawn. (do_spawn): Use helper functions. (unix_user_self): New class. (do_verify_password_fail, do_file_exists_fail, do_read_file_fail): Dummy methods. (do_spawn_self): Spawn method for unix_user_self class. (make_unix_user_self): New function. (unix_current_user): Deleted function. 2003-09-25 Niels Möller * src/io.c (do_connect_list_callback): Fixed error message. errno is not valid here. 2003-09-25 Pontus Sköld * src/channel.c (login_service_command): Use init_connection_service instead of init_login_service. (init_login_service): Removed redundant function. 2003-09-22 Niels Möller * README: Updated the instructions for building from CVS. List tcputils as a program needed for the testsuite. 2003-09-20 Niels Möller * misc/mkdiff: Copied mkdiff script from the old lsh_1_2_BRANCH. 2003-09-19 Niels Möller * Released lsh-1.5.3. * src/channel.c (init_login_service): Added FIXME: for the purpose of this function. * src/io.c (close_fd): Added FIXME: on the fd->fd == -1 hack. 2003-09-19 Niels Möller * configure.ac: Bumped version to 1.5.3. * src/client_keyexchange.c (do_handle_srp_reply): Fixed missing returns after disconnect_kex_failed and PROTOCOL_ERROR. * src/client_userauth.c (do_exc_userauth_disconnect): Clarified comment. * src/channel_commands.c (do_channel_open_command): Added missing return EXCEPTION_RAISE. Fixed also in 1.4.3. * src/testsuite/Makefile.am (TS_SH): Fixed syntax error. * src/testsuite/lshd-random-input-test: New test case that connects to lshd and sends some random data. 2003-09-18 Niels Möller * src/read_line.c (do_read_line): Fixed buffer overrun bug, initially reported by Bennett Todd. Fixed also in stable branch. 2003-09-18 Niels Möller * distribution-key.gpg: Updated key, new signatures and new expire date. 2003-09-16 Pontus Sköld * src/lsh-writekey.c (main): Check that the given key isn't empty. * src/lsh-upgrade-key: Set a restrictive umask. Encrypted keys are no longer stored unencrypted in a temporary file, just piped through the conversion chain like unencrypted keys are. * src/lsh-writekey.c (process_private): Moved reading of passphrase here. (main_argp_parser): Reading of passphrase from tty is now done in process_private if required. * src/testsuite/lshd-no-auth-test: New test to verify lshd fails gracefully when it may use no authentication method. * src/testsuite/Makefile.am (TS_SH): Use new lshd-no-auth-test. 2003-09-15 Pontus Sköld * src/testsuite/Makefile.am (TS_SH): Use new test for login-auth mode. * src/testsuite/login-auth-test: New test for login-auth mode. * src/lshd.c: New defines OPT_LOGIN_AUTH_USER, OPT_OPT_NO_LOGIN_AUTH_MODE, OPT_LOGIN_AUTH_USER and OPT_BANNER_FILE. (lshd_options): New attributes with_loginauthmode, loginauthmode_user and banner_file. (make_lshd_options): Initialize new attributes. (main_options): New options for login-auth-mode and banner-file. (main_argp_parser): Make a userdb if using login-auth-mode too. Bugfix; make sure self->userauth_algorithms is initialized, even if we're using srp. Add a permissive userauth_none to self->userauth_algorithms if using login-auth mode. Handle new options. (lshd_login_service): New class. (make_lshd_login_service): New function. (make_lshd_listen_callback): Read banner-file and pass as a string to make_handshake_info is desired. (main): Use the login service in login-auth mode. * src/server_userauth.c (userauth_none): New class. (do_none_authenticate): Added code for login-auth-mode to auto login a specific user. (make_userauth_none): New function. * src/server_userauth.h (make_userauth_none): Declaration, removed static userauth_none. * src/unix_user.c (unix_current_user): New function, return username of current user. * src/lsh.c (main): Pass extra NULL to make_handshake_info. * src/handshake.c (make_handshake_info): New parameter banner_text, init attribute. * src/handshake.h (handshake_info): New attribute banner_text. (make_handshake_info): New parameter. * src/channel.h: Declarataions for init_login_service, login_service_command annd INIT_LOGIN_SERVICE. * src/channel.c (init_login_service): New function to setup a login service. (login_service_command): Command to setup a connection for login service. 2003-08-17 Niels Möller * src/scm/gaba.scm (out): Ignore #f entries. (process-class): New keyword condition, for preprocessor conditionals. 2003-06-28 Niels Möller * src/zlib.c (do_zlib): Changed messages from verbose to debug, to reduce clutter. 2003-06-12 Niels Möller * Released lsh-1.5.2 2003-06-10 Niels Möller * src/lsh.c (read_known_hosts): Fixed error message when host-acls doesn't exist. * src/testsuite/lsh-decrypt-key-test (fname, keyname): Store files in $TEST_HOME. 2003-06-06 Niels Möller * src/Makefile.am (EXTRA_DIST): Added lsh-upgrade-key. 2003-06-06 Pontus Sköld * src/lsh-upgrade-key: New script to upgrade keys. * src/Makefile.am (bin_SCRIPTS): Added lsh-upgrade-key. 2003-06-05 Niels Möller * src/testsuite/lsh-encrypted-key-test: The lsh-authorize script is located in the source directory. * src/unix_interact.c (unix_read_password): Added trace messages. (unix_set_askpass): Added trace message. Assert that askpass is non-NULL. * src/spki.c (spki_pkcs5_decrypt): Cosmetic fix of warning message. * src/lsh.c (read_user_keys): Cosmetic fix of trace message. * src/client.c (client_argp_parser): Fixed --askpass option. The argp parser should never use optarg. 2003-06-05 Niels Möller * src/unix_interact.c (unix_read_password): Prompt for password only if we have a tty, and the quiet flag is unset. 2003-06-05 Pontus Sköld * src/lsh-decrypt-key.c: New file to provide new utility lsh-decrypt-key. * src/Makefile.am (bin_PROGRAMS): Added new utility lsh-decrypt-key. * src/testsuite/lsh-decrypt-key-test: New test to test lsh-decrypt-key. * src/testsuite/Makefile.am (TS_SH): Use new lsh-decrypt-key-test. 2003-06-05 Niels Möller * src/io.c (io_resolv_address): In the code using getaddrinfo, zero the sockaddr_in first using memset, to ensure that sockaddr_in.sin_zero really is zero, on the systems (e.g. AIX) that need that. 2003-06-04 Niels Möller * src/testsuite/lsh-encrypted-key-test: Use printf instead of echo in the askpass helper program. There should be no trailing newline character. * src/lsh-krb-checkpw.c: Include . * src/unix_interact.c (unix_read_password): The askpass code leaked the prompt string. Fixed. * src/spki.c (spki_pkcs5_decrypt): The label string was leaked. Fixed. 2003-06-04 Niels Möller * src/spki.c (spki_pkcs5_encrypt): The method identifier is "Xpkcs5v2", not "xpkcs5v2". (spki_pkcs5_decrypt): Rewrote function. (parse_pkcs5, parse_pkcs5_payload): New helper functions for spki_pkcs5_decrypt. 2003-06-03 Pontus Sköld * src/testsuite/Makefile.am (TS_SH): Added lsh-encrypted-key-test. * src/testsuite/lsh-encrypted-key-test: Test for encrypted (password protected) key functionality in lsh. 2003-06-01 Niels Möller * src/io.c (do_listen_callback): To get enough space, PEER must be a sockaddr_in (if the IPv6 type sockaddr_storage isn't available). (fd2info): Likewise. 2003-05-24 Niels Möller * src/lsh-make-seed.c: Fixed nesting of WITH_ZLIB #if:s. Also disable the zlib code. * misc/xenofarm.sh: Use cp in stead of mv, when putting files into the result package. * src/server_x11.c (server_x11_setup): Don't use non-constant initializer. Sun cc doesn't support it. 2003-05-22 Niels Möller * src/testsuite/Makefile.am: Don't use -O0 in AM_CFLAGS, as it breaks the AIX build. 2003-05-21 Niels Möller * src/reaper.c (do_reaper_callback): Check if WCOREDUMP is defined before using it. 2003-05-20 Niels Möller * src/unix_interact.c (unix_read_password): Fixed argv bug for the askpass program. * src/client.c: Implemented --askpass option. * src/unix_interact.c (unix_read_password): Use any specified askpass program. Deleted the password_fd code. (unix_set_askpass): New function. (make_unix_interact): Initialize askpass and set_askpass. * src/interact.h (INTERACT_SET_ASKPASS): New method. * src/io.c (lsh_popen_read): Improved warning messages. * configure.ac: If seteuid is not available, but setresuid is, let config.h #define seteuid in terms of setresuid. 2003-05-19 Niels Möller * src/unix_user.c (do_read_file): Set the process gid, and reset the supplimentary groups list, before opening the file. * configure.ac: Check for seteuid and setresuid. 2003-05-16 Niels Möller * configure.ac: Check for struct utmp.ut_exit.e_termination and struct utmpx.ut_exit.e_termination. * src/unix_process.c (do_utmp_cleanup): Fix for HPUX, which uses non-standard names for the fields of struct utmpx's ut_exit. 2003-05-14 Niels Möller * src/io.c (io_resolv_address): More fixes for the non getaddrinfo code. 2003-05-14 Niels Möller * src/unix_interact.c (unix_interact): New attribute password_fd. (unix_read_password): Read password from password_fd, unless it's -1. (make_unix_interact): Initialize password_fd to -1. 2003-05-13 Niels Möller * src/io.c (io_resolv_address): Fixes for the non getaddrinfo code. 2003-05-13 Niels Möller * acinclude.m4 (LSH_FUNC_STRSIGNAL): Use a dummy STRSIGNAL if none of strsignal, sys_siglist or _sys_siglist exists. * src/io.c (lsh_popen_read): Use STRSIGNAL macro. 2003-05-12 Niels Möller * src/crypto.h (FOR_BLOCKS): Deleted unused macro. * src/lsh-execuv.c: Don't include lsh_types.h. * src/lsh-krb-checkpw.c: Likewise. * src/lsh.c (do_lsh_lookup): Fix syntax of generated ACL entries (bug 1030). * misc/make-am (environ_deps): Deleted code for generating .dist_deps. * src/.dist_headers: Deleted memxor.h and lsh_types.h. * src/.dist_headers, src/.dist_classes: Deleted proxy-related files. * configure.ac: Updated AC_CONFIG_SRCDIR, as lsh_types.h no longer exists. 2003-05-12 Niels Möller * configure.ac: Don't AC_REPLACE_FUNCS(memxor), just use the memxor function in nettle. * doc/HACKING: Documented current include file ordering rules. * src/lsh.h (MAX, MIN, SQR, STRING_LINE): Moved miscellaneous macros here. Used to be in lsh_types.h. * Reordered includes in most or all .c-files. All should now include config.h. * src/lsh_types.h: Deleted file. * src/.dist_deps: Deleted file. * src/memxor.h, src/memxor.c: Deleted files. * src/Makefile.am (BUILT_SOURCES): Use BUILT_SOURCES to get environ.h built. .dist_deps no longer needed. * acinclude.m4 (LSH_GCC_FUNCTION_NAME, LSH_FUNC_ALLOCA) (LSH_FUNC_STRERROR, LSH_FUNC_STRSIGNAL): New macros. * configure.ac: Use them. 2003-05-12 Pontus Sköld * src/lsh-upgrade: Upgrade any authorized public keys and re-authorize them. 2003-04-23 Niels Möller * src/Makefile.am (gcov-list): Don't include files with full code coverage in the list. * src/testsuite/Makefile.am (TS_SH): Added tcpip-local-in-use-test. 2003-04-22 Niels Möller * src/tcpforward_commands.c (forward_local_port): Use prog1 to delay bind call until the connection is established. * src/testsuite/tcpip-local-in-use-test: New test case, to check the error handling for "address already in use". * src/unix_user.c (exec_shell): Build the argument list for lsh-execuv only if we need to change uid. Include the name of the exec:ed program if exec fails. * src/lsh.c (main): Use addr_queue instead of sockaddr_list. * src/lshd.c: Likewise. * src/io_commands.c (connect_list_command): Take a connect_list_state as argument. * src/io.h (connect_list_state): Moved class definition to the header file. * src/io.c (sockaddr_cons): Deleted function. (io_resolv_address) Use addr_queue instead of sockaddr_list. (io_listen_list): Likewise. (connect_attempt): Likewise. (make_connect_list_state): Made non-static. (connect_list_callback): Moved c and e attributes here, from connect_list_state. (io_connect_list): Take a connect_list_state as argument. * src/queue.c (make_addr_queue_node): Initialize the size field. * src/queue.h (struct lsh_queue): Added length field. * src/queue.c: New queue type addr_queue, for handling lists of sockaddr:esses. Let lsh_queue keep track of the length. * src/lsh.c (do_lsh_lookup): Deleted old code handling the ssh-rsa-pkcs1@lysator.liu.se algorithm id. 2003-04-22 Niels Möller * src/lsh.c (lsh_verifier_command): Deleted command. (make_lsh_login): New function, replacing lsh_login_command. (make_lsh_userauth): Deleted GABA-expression. (make_lsh_connect): Take a login command as a parameter. (main): Updated calls to make_lsh_connect and make_lsh_login. 2003-04-21 Niels Möller * src/lsh.c (make_lsh_connect): Take actions as a parameter. (options2service): Deleted command. (lsh_options): Deleted service attribute. Always ask for the userauth service. (make_lsh_userauth): Deleted expression. (make_lsh_connect): Take keys as parameter. Always ask for userauth service. (main): Deleted call of make_lsh_userauth. Pass keys to make_lsh_connect instead. * src/lshg.c (make_lshg_connect): Likewise. * src/gateway.c: Include string.h. * src/client.c (client_options2actions): Deleted command. * src/io.c (make_address_info_c): Deleted function. 2003-04-20 Niels Möller * src/spki.c (make_ssh_hostkey_tag): Use a plain NUL-terminated string to identify the host. (spki_pkcs5_decrypt): Fixed string leak. The label string wasn't freed properly on failure. * src/lshd.c (do_exc_lshd_handler): It seems we need an exception handler after all, which catches and logs i/o errors. * src/lsh.c (options2identities): Deleted command. (lsh_host_db): Use a NUL-terminated string to identify the host. (do_lsh_lookup): Likewise. (make_lsh_host_db): Likewise. (make_lsh_userauth): Take keys as a parameter. Don't use options2identities. (make_lsh_connect): Take options as a parameter, and the remote address list as argument. Use connect_list. (main): Call io_resolv_address, read_known_hosts, read_user_keys and make_lsh_userauth here. * src/io_commands.c (connect_list_command): New command. * src/io.c (do_connect_list_callback): Update fd->label. * src/handshake.c (handshake_command): Allow a NULL lv->peer. * src/gateway.c (make_gateway_address): Take a plain NUL-termianted string to identify the target. * src/client.c (client_options2remote): Deleted command. (client_argp_parser): Don't call make_address_info_c. * src/client.h (client_options): Replaced remote attribute with a plain NUL-termianted string, and renamed to target. * src/lshg.c: Updated for the struct client_options renaming remote->target. * src/testsuite/functions.sh (spawn_lshd): Reduced sleep. 2003-04-16 Niels Möller * src/lshd.c (main): No need to check for make_lshd_options returnning NULL. * src/.dist_classes (dist_classes): Deleted io_commands.h.x. * src/io_commands.h (io_write_file_info): Deleted class. * src/io_commands.c (io_write_file_command) (make_io_write_file_info): Deleted unused functions. * src/lshd.c (do_exc_lshd_handler, make_lshd_exception_handler): Deleted functions. * src/exception.h (EXC_RANDOMNESS_LOW_ENTROPY, EXC_APP): Deleted unused exceptions. * src/io.c (io_read_file): Deleted unused function. * src/testsuite/functions.sh (spawn_lshd): Check exit code from lshd. Print out the lshd pid. (spawn_lsh): Print out the lsh pid. * src/Makefile.am (gcov-list): New target for running gcov. * src/io_commands.c (listen_list_command): Deleted command. Replaced by the io_listen_list function. * src/lshd.c (options2local, options2keys, options2tcp_wrapper) (close_on_sighup): Deleted commands. * src/keyexchange.c (kexinit_filter): Deleted command. * src/lshd.c (main): Reorganization, do more work before io_run, including reading host keys and binding sockets directly in main. Moved the daemonization later, so that the forground process doesn't exit until after the ports are bound. Fixed an fd leak in the server tcpip-forwarding code. * src/tcpforward.c (do_tcpip_forward_request_continuation): Use remember_resource to associate the bound fd to the connection. (make_tcpip_forward_request_continuation): New argument, connection. (do_tcpip_forward_request): Pass the connection to make_tcpip_forward_request_continuation. * src/io.c (io_listen_list): New function. 2003-04-15 Niels Möller * src/testsuite/functions.sh (spawn_lshd): Use -HUP, not -9, for killing lshd. * src/werror.c (fatal) [WITH_GCOV]: Call fork, so that we can call exit() and also dump core. * src/server.c (read_host_key): Fixed string leak. * src/io.c (make_connect_callback): Made non-static. (io_connect): Changed interface, to take an io_callback instead of a continuation. The caller has to use make_connect_callback to get the old functionality. (io_connect_local): Adapted to new io_connect interface, and call make_connect_list_callback. * src/client_x11.c (channel_open_x11): Likewise. * src/io_commands.c (do_connect): Likewise. * src/io.c (connect_list_state): New class. (do_connect_list_kill): New function. (make_connect_list_state): New function. (connect_attempt): New function. (connect_list_callback): New class. (do_connect_list_callback): New function. (make_connect_list_callback): New function. (io_connect_list): New function. * src/io.h (sockaddr_list): Renamed attribute, addr -> address. * configure.ac: New option --enable-profiling. * src/.gdbinit: New file. 2003-04-14 Niels Möller * src/io.c (io_resolv_address): Changed interface, to avoid local conversion of service names to port numbers. This way, all that's needed for SRV-records is proper support in getaddrinfo. * src/lshd.c (parse_interface): Changed interface to use plain NUL-terminated strings. (main_argp_parser): Updated for new io_resolv_address interface. 2003-04-14 Niels Möller * src/testsuite/functions.sh: Use INTERFACE=localhost, as we now support non-numerical interface names. (spawn_lshd): Must put -p option before --interface. * src/lshd.c (parse_interface): New function. (main_argp_parser): Implemented multiple --interface options. (make_lshd_listen): Use listen_list, to list on severala ddresses in parallel. Don't use the bind command. * src/io.c (io_resolv_address): Changed return type, now returns the number of resolved addresses. * doc/lsh.texinfo (Invoking lshd): Document the use of multiple --interface options. 2003-04-13 Niels Möller * src/testsuite/Makefile.am (EXTRA_PROGRAMS): Added testutils, as a kludge to get automake to track dependencies for testutils.o. * src/io_commands.c (listen_list_command): New command. * src/io.h (sockaddr_list): New class. * src/io.c (io_resolv_address): New function. (sockaddr_cons): New function. * src/client_session.c (make_client_session_channel): Added place holder for send break escape handler (#if:ed out for now) 2003-04-11 Niels Möller * src/client_pty.c (do_kill_client_tty_resource): Call set_error_raw. (do_pty_continuation): Likewise. * src/client_escape.c (escape_help): New class. (do_escape_help): Escape function that lists all defined escapes. (make_escape_help): New function. (make_escape_info): Install help. (escape_dispatch): Updated to use the escape_callback type. * src/client.c: Use DEFINE_ESCAPE. * src/suspend.c (suspend_callback): Likewise. * src/client.h (escape_callback): New class, which inherits lsh_callback and adds a help string. (class escape_info): Use it. (DEFINE_ESCAPE): New macro. * src/werror.c (set_error_raw): New function, for telling the werror functions when the tty is set to raw mode. (werror_putc): In raw mode, add a \r before each \n. (werror_write_raw): Renamed the old werror_write function. (werror_write): New function that inserts \r in the output when approrpriate. * src/Makefile.am (MAINTAINERCLEANFILES, class-map): Updated to use dist_classes, not dist_x_files. 2003-03-24 Pontus Sköld * contrib/solpkg.sh.in: Added my script to create Solaris packages. * contrib/Makefile.am: Include script in EXTRA_DIST * configure.ac: Added hooks for Solaris package script. 2003-03-14 Niels Möller * src/io.c (handle_nonblock_error): New function, ignoring ENODEV errors. Needed for freebsd, where setting the non-block flag on /dev/null fails. (io_set_nonblocking, io_set_blocking): Use handle_nonblock_error. 2003-03-13 Niels Möller * src/io.c (io_set_nonblocking, io_set_blocking) (io_set_close_on_exec): Fixed error messages. 2003-03-05 Niels Möller * configure.ac: Bumped version to 1.5.2. * src/testsuite/Makefile.am (LDADD): Use DOTDOT_LIBARGP, instead of the GNU make specific addprefix function. * configure.ac (DOTDOT_LIBARGP): New substitution 2003-03-04 Niels Möller * misc/xenofarm.sh (make): Don't use -k flag, it seems to mask errors. * src/Makefile.am (environ.h): Avoid requiring GNU make for this rule. 2003-03-02 Niels Möller * src/unix_random.c: Include before . * src/io.c: Include , not . 2003-03-01 Niels Möller * src/lsh-upgrade: Note that we need to upgrade private keys too. 2003-02-28 Niels Möller * Released lsh-1.5.1. * src/spki.c (spki_pkcs5_decrypt): Typo fix, it's "password-encrypted", not "password_encrypted". 2003-02-27 Niels Möller * src/testsuite/rapid7-lsh-test: ln -sf is not portable, so delete the symlink "current" explicitly using rm. 2003-02-27 Niels Möller * src/testsuite/rapid7-lsh-test: Skip test if tcputils is missing. * src/testsuite/rapid7-lshd-test: Likewise. 2003-02-27 Niels Möller * src/testsuite/rapid7-lshd-test: Use $srdir for locating the test pdu:s. * src/testsuite/rapid7-lsh-test: Likewise. 2003-02-26 Niels Möller * src/testsuite/rapid7-lsh-test: Bugfixes, and some adaption to the lsh testsuite framework. * src/testsuite/rapid7-lshd-test: Likewise. * src/testsuite/functions.sh (werror, die): New functions. 2003-02-26 Pontus Sköld * src/lsh-krb-checkpw.c: Include config.h if available. 2003-02-25 Niels Möller * src/testsuite/Makefile.am (AM_CPPFLAGS): Use $(srcdir)/.. * src/testsuite/.dist_rapid7: Typo fix. 2003-02-25 Niels Möller * src/rsync/Makefile.am (AM_CPPFLAGS): Use $(srcdir)/.. 2003-02-24 Niels Möller * src/testsuite/Makefile.am (TS_SH): Added rapid-7-lsh-test and rapid-7-lshd-test. (EXTRA_DIST): Use $(dist_rapid7), and include .dist_rapid7 which defines it. * src/testsuite/.dist_rapid7: New file, listing rapid7 files. * rapid7-ssh-pdu: New directory, containing rapid7's testsuite. * configure.ac: Bumped version to 1.5.1. * src/rsync/Makefile.am: Use AM_CPPFLAGS = -I.. to get include files in the main src directory. * src/testsuite/Makefile.am: Likewise. * configure.ac: Use AC_GNU_SOURCE. Don't add -I$srcdir/src -DLSH to CPPFLAGS. * src/lsh.c (read_known_hosts): Fixed the message about old known_hosts files. 2003-02-23 Niels Moller * src/scm/gaba.scm (main): Simplified. Explicitly use echo, otherwise scsh-0.6 seems to return a non-zero exit code. * acinclude.m4 (LSH_GCC_ATTRIBUTES): New macro, copied from lsh's configure.ac. * configure.ac: Use it. * .bootstrap: Link acinclude.m4 to argp and sftp subdirectories. 2003-02-19 Niels Möller * src/nettle/acinclude.m4, src/spki/acinclude.m4: Deleted files, let .bootstrap make links to the top-level acinclude.m4 instead. * acinclude.m4: Renamed macros to start with the LSH_-prfix. Deleted unused code. Updated configure.ac to match. (LSH_TYPE_SOCKLEN_T): Moved AH_TEMPLATE into the macro body. * .bootstrap: Link acinclude.m4 into the src/nettle and src/spki directories. Added command line option "links", that skips the autoconf and automake bootstrap. * misc/Makefile.am (EXTRA_DIST): Removed bootstrap.sh. Added make-am. * Makefile.am (EXTRA_DIST): Added .bootstrap. * doc/Makefile.am (EXTRA_DIST): Don't distribute Makefile.am.in. (%.txt): Resurrected the rule for building txt from nroff. Needed for srp-spec.txt. * src/Makefile.am (EXTRA_DIST): Likewise. * .bootstrap: New link from src/nettle/examples and src/sftp/testsuite to run-tests. 2003-02-18 Niels Möller * src/Makefile.am (bootstrap): Bootstrap the spki dirctory too. (EXTRA_DIST): dist_x_files and cvs_headers renamed to dist_classes and dist_headers. * doc/Makefile.am (EXTRA_DIST): Deleted man_MANS. * misc/bootstrap.sh: Deleted old bootstrap file. * src/.dist_classes, src/.dist_headers: Reformatted so that they can be included directly in the Makefile. * src/.dist_deps: Dependencies on environ.h. * misc/run-tests: Moved testsuite driver here, and symlink it from all directories that need it. * misc/make-am: New script, for generating the files src/.dist_headers, src/.dist_classes and src/.dist_deps. Replaces * make_am, src/used_headers, src/cvs_headers: Deleted files. * .bootstrap: Bugfixes. * Makefile.am.in: Removed all these files. Use plain Makefile.am instead. 2003-02-18 Niels Möller * configure.ac: Added check for inet_ntop in -lnsl. Check for -lnsl before checking for -lsocket, to avoid strange confusion with Solaris' library dependencies. 2003-02-17 Niels Möller * misc/xenofarm.sh: Fixed make --version test. 2003-02-17 Niels Möller * misc/xenofarm.sh: Make sure PATH is exported. Redirect stderr output from make --version. 2003-02-17 Niels Möller * src/testsuite/testutils.c: Use uint32_t and friends, not UINT32. * misc/xenofarm.sh (cfgwarn): Fixed sed expression. 2003-02-16 Niels Möller * src/.dist_classes: Deleted read_base64.c.x. * src/.dist_headers: Deleted digits.h * src/debug.c (send_debug, send_verbose): Deleted unused funtions. * .bootstrap: New file, to replace misc/bootstrap.sh. * General cleanup. Use types uint32_t and friends instead of UINT32. Include files in the order config.h, C headers, system headers, lsh headers. Deleted RCS id strings. Affects most files. * src/digits.h, src/read_base64.c: Deleted obsolete file. * src/Makefile.am.in (liblsh_a_SOURCES): Removed read_base64.c. * configure.ac: Added missing LSH_RPATH_FIX between the checks for gmp and liboop. Use AH_BOTTOM to define NORETURN, PRINTF_STYLE and UNUSED. 2003-02-15 Niels Möller * src/io.h (lsh_fd): Deleted old hanged_up attribute. * src/gateway_commands.c (gateway_setup_command): Deleted old #if:ed out command. * src/format.c (ssh_vformat_length): Deleted some old #if:ed out code. * src/io.c (do_buffered_read): Likewise. * src/xalloc.c (lsh_object_free): Likewise. * src/proxy.c (do_proxy_offer_service): Likewise. * src/io_commands.h: Deleted old prototypes make_listen_local and make_connect_local. 2003-02-14 Niels Möller * src/Makefile.am.in (bin_SCRIPTS): Added lsh-upgrade. 2003-02-12 Niels Möller * src/unix_user.c (do_spawn): Added FIXME on error reporting. * misc/xenofarm.sh (cfgwarn): Delete warning about using an absolute path for srcdir. 2003-02-11 Niels Möller * misc/xenofarm.sh: Compile with make -k. 2003-02-10 Niels Möller * src/.dist_classes: Deleted lsh_proxy.c.x and sexp-conv.c.x. * src/dsa.c (do_dsa_sign): Use tokens in format string to lsh_sexp_format. * src/dsa_keygen.c (dsa_generate_key): Likewise. * src/lsh.c (do_lsh_lookup): Likewise. * src/srp_exchange.c (srp_make_verifier): Likewise. * src/rsa_keygen.c (rsa_generate_key): Likewise. * src/rsa.c (do_rsa_public_spki_key): Likewise. * src/spki.c (spki_pkcs5_encrypt, make_ssh_hostkey_tag) (spki_hash_data): Likewise. * src/sexp-conv.c, src/sexp_test.c: Deleted file, not used anymore. * misc/xenofarm.sh: Collect config.h files from subdirectories. 2003-02-09 Niels Möller * src/testsuite/Makefile.am (TS_PROGS): Added sockaddr2info-test. * src/testsuite/testutils.h: Include io.h. * src/testsuite/sockaddr2info-test.c: New test case. * src/io.c (sockaddr2info): Use inet_ntop for formatting AF_INET6 addresses. 2003-02-07 Niels Möller * src/lsh.c (do_lsh_lookup): The public key should be wrapped in a subject expression in the generated acl:s. * src/io.c (sockaddr2info): #ifed out broken IPv6 code. 2003-02-06 Niels Möller * src/Makefile.am.in (DISTCLEANFILES): Delete environ.h. * src/testsuite/conv-3-test: Updated test for current sexp-conv. * misc/xenofarm.sh: Try to add /usr/local/bin and /usr/ccs/bin to PATH, if needed. 2003-02-05 Niels Möller * src/keyexchange.c (KEXINIT_MAX_ALGORITMS_SUN): New constant. (parse_kexinit): Added argument peer_flag. Use larger list limit than parsing the language lists from Sun's sshd. (do_handle_kexinit): Updated call to parse_kexinit. * src/handshake.c: Added workaround for "Sun_SSH_1.0". * src/connection.h: New constant PEER_KEXINIT_LANGUAGE_KLUDGE. 2003-02-04 Niels Möller * Moved argp-related entries from this file to src/argp/ChangeLog. 2003-01-27 Niels Möller * src/rsa_keygen.c, src/rsa.c: Updated for nettle rsa renaming. * configure.ac: Fixed syntax error when testing $x_includes and $x_libraries. 2003-01-24 Niels Möller * configure.ac: --with-lib-path should add to LDFLAGS, not replace it. * misc/xenofarm.sh (dotask cfg): Pass --with-include-path and --with-lib-path to configure. On some systems /usr/local/lib and /usr/local/include are not searched by default. 2003-01-22 Niels Möller * src/spki.c (spki_add_acl): Use spki_acl_process. (spki_authorize): Adapted to changed spki_acl_by_subject_first and spki_acl_by_subject_next. 2003-01-21 Niels Möller * misc/xenofarm.sh: Don't run make distcheck, as it leaves some write-protected directories in the tree. 2003-01-20 Niels Möller * misc/xenofarm.sh: Dont cd into src before running make check and make distcheck. * src/testsuite/functions.sh (need_tcputils): Use test_skip. * misc/xenofarm.sh (timeecho): Fixed typo. 2003-01-19 Niels Möller * misc/xenofarm.sh (timeecho): Set LC_ALL=C before calling date. * src/testsuite/functions.sh (need_tcputils): New function. Use it in the testcases that depend on tcputils: tcpip-local-test, tcpip-remote-test, lshg-tcpip-test and ssh1-fallback-test. 2003-01-17 Niels Möller * src/Makefile.am.in: Added explicit dependencies for objects depending on environ.h. Must figure out some better way to do that. 2003-01-16 Niels Möller * src/Makefile.am.in (EXTRA_DIST): Added environ.h.in. (generated_sources): Don't list environ.h here, as it's system dependent. * misc/xenofarm.sh: Fixed invocation of dotask, which should take four arguments. (dotask): Don't create $task.pass, they're not used anymore. 2003-01-15 Niels Möller * misc/xenofarm.sh: Updated to use new format for reporting the result. 2003-01-14 Niels Möller * src/.dist_classes: sexp.h.x has disappeared. * misc/bootstrap.sh: Bootstrap spki subdir. Removed redundant automake calls. 2003-01-14 Niels Möller * misc/xenofarm.sh: New file. Added build instructions, following the lyskom-server example. * src/.dist_classes: hmac.c.x, md5.c.x and sha.c.x have disappeared. 2003-01-14 Niels Möller * configure.ac (AC_PATH_X): Check not only $no_x, also check if $x_includes and $x_libraries are empty before adding new flags. * src/scm/gaba.scm (nth): New function. The elisp/Common Lisp/MACLisp style function, which takes the index as the first argument. (make-output): Updated call of nth. * src/scm/guile-compat.scm (nth): Deleted function. Needed for scsh, not just guile. 2003-01-14 Niels Möller * src/.dist_classes: sexp.c.x and spki.c.x have disappeared. * src/.dist_headers: dsa.h has disappeared. 2003-01-13 Niels Möller * src/.dist_headers, src/.dist_classes: Check into cvs, to make it easier for xenofarm to build a distribution directly from cvs. 2003-01-13 Niels Möller * src/scm/compiler.scm (let-and): Fixed syntax error in syntax-rules. * misc/bootstrap.sh: Use plain automake -a, no extra arguments. 2003-01-12 Niels Möller * src/unix_user.c: Use macros in environ.h, when defining environment veriables. * src/lshd.c: Use PATH_KERBEROS_HELPER, defined in environ.h. * src/environ.h.in: Define a bunch of PATH_* and ENV_* constants. * src/client.c: Include environ.h, and use those macros for all getenv calls. * src/client_pty.c: Likewise. * src/gateway.c: Likewise. * src/lsh-keygen.c: Likewise. * src/lsh-make-seed.c: Likewise. * src/lsh-writekey.c: Likewise. * src/lsh.c: Likewise. * src/server_session.c: Likewise. * src/server_x11.c: Likewise. * src/srp-gen.c: Likewise. * src/unix_random.c: Likewise. * src/xauth.c: Likewise. * src/Makefile.am.in (environ.h): Fixed commands. (generated_sources): Added environ.h. * doc/lsh.texinfo (Files and environment variables): Document POSIXLY_CORRECT. * configure.ac: Don't try AC_DEFINE:ing PREFIX and SBINDIR. Those substitutions are now performed at make-time. 2003-01-10 Niels Möller * src/lsh.c (read_known_hosts): Display upgrade message only if the --host-db option wasn't used. Changed user messages to say "host-acls" instead of "known_hosts". 2003-01-10 Niels Möller * src/lsh-upgrade: New shell script. * src/testsuite/testutils.c (test_spki_match): Rewrote to use the new spki functions. Always fail on parse errors. * src/testsuite/spki-tag-test.c (test_main): Include the leading "(tag ..." in the tested expressions. * src/testsuite/Makefile.am (LDADD): Added libspki.a. * src/spki.c (make_ssh_hostkey_tag): Include the outer "(tag ...)" expression. (spki_add_acl): New function. (spki_lookup): Fixed some compile time errors. (spki_authorize): Likewise. * src/lsh.c (read_known_hosts): Don't read known_hosts any more, just display a warning message saying that it needs conversion. (read_known_hosts): spki_add_acl now takes an spki_iterator. (do_lsh_lookup): The access expression includes the complete tag expression, not just the body of it. * src/lsh-pam-checkpw.c: Include config.h. * src/Makefile.am.in (LDADD): Add libspki.a. 2003-01-09 Niels Möller * src/lsh.c (read_known_hosts): Display a message if an old known_hosts file is used. * src/daemon.c (daemon_init): Fork once more, to lose process session leadership. * src/spki.c: Deleted old spki implementation. (spki_lookup, spki_authorize): New functions. (do_spki_acl_db_mark, do_spki_acl_db_free): New functions. * src/lsh.c (read_known_hosts): Read new known-hosts file as "~/.lsh/host-acls", and filter it through sexp-conv. Fall back to the old file name "~/.lsh/known_hosts" if the new file doesn't exist. (do_lsh_lookup): Use the new spki_lookup function. (do_lsh_lookup): Use new spki_authorize function. (do_lsh_lookup): Disable spki fingerprinting for now. * src/io.c (lsh_popen): New argument for recording the child pid. (lsh_popen_read): New function. * doc/lsh.texinfo (Files and environment variables): Document SEXP_CONV. 2003-01-08 Niels Möller * src/Makefile.am.in (environ.h): New rule for creating environ.h from environ.h.in. 2003-01-02 Niels Möller * src/Makefile.am.in (SUBDIRS): Compile in spki subdir. * configure.ac: Configure subdir src/spki. 2003-01-02 Niels Möller * src/io.c (lsh_popen): New function. 2003-01-02 Pontus Sköld * configure.ac: Check for alarm. * src/lsh-pam-checkpw.c (main): Set an alarm to exit after TIMEOUT (currently 600) seconds. * src/lsh-krb-checkpw.c (main): Dito. 2002-12-11 Niels Möller * src/lsh-writekey.c (process_private): If no encryption, dup the input string. 2002-12-04 Niels Möller * src/dsa.c (do_dsa_sign): Use %0s, not %z, when formatting s-expressions. (do_dsa_public_spki_key): Likewise. * src/spki.c (spki_pkcs5_encrypt): Likewise. (make_ssh_hostkey_tag): Likewise. (spki_hash_data): Likewise. * src/rsa_keygen.c (rsa_generate_key): Likewise. * src/rsa.c (do_rsa_public_spki_key): Likewise. * src/lsh.c (do_lsh_lookup): Likewise. * src/dsa_keygen.c (dsa_generate_key): Likewise. 2002-11-16 Niels Möller * src/testsuite/key-1.private, src/testsuite/key-2.private: Updated keys. * src/testsuite/conv-1-test, src/testsuite/conv-2-test, src/testsuite/dsa-test.c, src/testsuite/export-1-test, src/testsuite/rsa-test.c: Updated key s-expressions to match new format. Positive numbers must start with an octed with the most significant bit zero. * src/srp_exchange.c (srp_hash_password): Use nettle_mpz_set_str_256_u. (make_srp_entry): Check sign of verifier. * src/spki.c (spki_pkcs5_decrypt): Use sexp_iterator_get_uint32. * src/sexp.c (lsh_sexp_to_uint32): Deleted function (similar function added to nettle, sexp_iterator_get_uint32). * src/rsa.c (do_rsa_verify): Use nettle_mpz_set_str_256_u. * src/parse.c (parse_bignum): Use nettle_mpz_set_str_256_s. * src/format.c (ssh_vformat_length): Use nettle's bignum functions. (ssh_vformat_write): Likewise. * src/dsa.c (do_dsa_verify): Use nettle_mpz_set_str_256_u. (dsa_blob_length): Use nettle_mpz_sizeinbase_256_u. (dsa_blob_write): Use nettle_mpz_get_str_256. * src/bignum.c (limbs_to_octets): Deleted function. (bignum_parse_s): Deleted function. (mpz_size_of_complement): Deleted function. (bignum_format_s_length): Deleted function. (bignum_format_s): Deleted function. (bignum_parse_u): Deleted function. (bignum_format_u_length): Deleted function. (bignum_write): Deleted function. (bignum_format_u): Deleted function. (bignum_random_size): Made static. (bignum_random_size): Use nettle_mpz_set_str_256_u. * src/Makefile.am.in (lshg_LDADD): lshg needs to be linked with nettle now, that the bignum functions used by ssh_format have moved there. It should be possible to get lshg to work without either nettle or gmp, currently it won't. 2002-11-13 Niels Möller * src/spki.c (do_spki_authorize): Need braces around FOR_OBJECT_QUEUE loop. 2002-11-11 Niels Möller * src/Makefile.am.in (noinst_PROGRAMS): Don't build prime_table. * src/digit_table.c: Deleted file. * src/prime_table.c: Deleted file. * src/sexp_parser.c: Deleted file. * src/digits.c: Deleted file. * src/bignum.c (bignum_small_factor): Deleted function. (bignum_next_prime): Deleted function. (bignum_random_prime): Deleted function. * src/lsh-decode-key.c (main): Use nettle's functions for base64 decoding. * src/Makefile.am.in: Don't build digit_table.h. (liblsh_a_SOURCES): Removed digits.c. 2002-11-10 Niels Möller * src/lsh.c (do_lsh_default_handler): Deleted handling of obsolete exception types EXC_SEXP_SYNTAX and EXC_SPKI_TYPE. * src/lshd.c (do_exc_lshd_handler): Likewise. * src/srp_exchange.c (srp_make_verifier): Adapted to new sexp code. (make_srp_entry): Likewise. * src/srp-gen.c: Adapted to new sexp code. * src/server_keyexchange.c (do_server_srp_read_verifier): Adapted to new sexp code. * src/server_authorization.c (do_key_lookup): Adapted to new sexp code. * src/server.c (read_host_key): Adapted to new sexp code. * src/rsa_keygen.c (rsa_generate_key): Adapted to new sexp code. * src/lshd.c: Adapted to new sexp code. * src/lsh.c (read_known_hosts): Adapted to new sexp code. (read_user_keys): Likewise. (do_lsh_lookup): Likewise. * src/lsh-keygen.c: Adapted to new sexp code. * src/lsh-writekey.c: Likewise. * src/lsh-decode-key.c: Adapted to new sexp code. * src/testsuite/testutils.c (test_sign): Adapted to new sexp code. (test_spki_match): Likewise. * src/spki.h (spki_exception): Deleted class. * src/spki.c: Adapted to new sexp code. (make_spki_exception): Deleted function. (spki_make_public_key): Deleted function, the PUBLIC_SPKI_KEY method can be used directly.directly. (spki_hash_sexp): Deleted function. (subject_match_hash): #if:ed out function for now. (spki_subject_by_hash): Likewise. (do_spki_lookup): #if:ed out lookup by hash. (spki_algorithm_lookup): New function. (spki_get_type): Deleted, moved similar code to sexp.c. * src/exception.h (EXC_SEXP, EXC_SPKI): Deleted SEXP and SPKI-related exceptions. * src/sexp.c: Rewrote using nettle's sexp functions. * src/sexp.h: Matching rewrite of declarations. * src/rsa.c (encode_rsa_sig_val): Deleted function. (decode_rsa_sig_val): Deleted function. (spki_init_rsa_verifier): Deleted function. (make_rsa_verifier_internal): Deleted function. (do_rsa_verify): Adapted to new sexp code. (do_rsa_public_spki_key): Likewise. (do_rsa_sign): Likewise. (make_rsa_verifier): Use rsa_keypair_from_sexp_alist. (make_rsa_signer): Likewise. * src/publickey_crypto.h: Added dsa declarations (used to be in dsa.h). * src/lsh.h: Removed forward declaration of sexp structs. * src/lsh-export-key.c (encode_base64): New function (was in sexp.c earlier). (sexp_to_ssh2_key): Adapted to new sexp code. * src/lsh-authorize: Use new sexp-conv program. Check exit status of sexp-conv. * src/dsa_keygen.c (dsa_generate_key): Adapted to new sexp code. * src/dsa.h: Deleted file. * src/dsa.c (make_dsa_verifier_internal): Deleted function. (encode_dsa_sig_val): Deleted function. (decode_dsa_sig_val): Deleted function. (do_dsa_verify): Adapted to new sexp code. (do_dsa_public_spki_key): Return a string, in canonical or transport syntax. (make_dsa_verifier): Use nettle's dsa_keypair_from_sexp_alist. (make_dsa_signer): Likewise. * src/abstract_crypto.h (PUBLIC_SPKI_KEY): Changed method, now returns a string and takes an extra argument to say if it should use transport syntax. * src/Makefile.am.in (bin_PROGRAMS): Don't build sexp-conv. (sbin_PROGRAMS): Don't build lsh_proxy. * src/testsuite/lsh-6-test (LSHD_FLAGS): Bugfix, test_success was used improperly, making the testcase always succeed. * src/testsuite/keygen-1-test: Use $SEXP_CONV. * src/testsuite/keygen-2-test: Likewise. * src/testsuite/functions.sh (SEXP_CONV): Use nettle's sexp-conv program. * src/testsuite/conv-1-test: Use $SEXP_CONV, with explicit line width. * src/testsuite/conv-2-test: Use $SEXP_CONV. * src/testsuite/conv-3-test: Skip test for now, new sexp-conv doesn't support hex output. * src/testsuite/Makefile.am (check): Set LD_LIBRARY_PATH when running tests. 2002-11-07 Niels Möller * configure.ac: Don't use quotes with AM_CONFIG_HEADER, it seems to confuse automake. Bugfix: Don't generate nettle/Makefile here. * src/testsuite/functions.sh: Tolerate unset failing. 2002-11-04 Pontus Sköld * src/testsuite/functions.sh: Unset LSHGFLAGS and LSHFLAGS. * src/client.c (envp_parse): Certain versions of argp needs to be fed with ARGP_NO_ERRS for this to work. * misc/Makefile.am.in: Removed obsolete reference to (and include of) ctags.mk. * doc/Makefile.am.in: Removed inclusion of ctags.mk. 2002-11-03 Niels Möller * misc/Makefile.am.in: Don't include ctags.mk. * src/testsuite/testutils.c (test_sign): Use SIGN and VERIFY, not the obsolete methods SIGN_SPKI and VERIFY_SPKI. * src/testsuite/Makefile.am (AM_CFLAGS): Use AM_CFLAGS to disable optimization. Don't set CFLAGS explicitly. * misc/ctags.mk: Deleted file. Not needed anymore, since automake supports ctags it out of the box. * Makefile.am.in: Don't include ctags.mk. * src/Makefile.am.in: Likewise. * src/rsa_keygen.c (get_random): Deleted function. Replaced by ... * src/randomness.c (lsh_random): New function. * src/rsa.c (do_rsa_verify): Recognize algorithm "spki". (do_rsa_sign): Likewise. (do_rsa_verify_spki): Deleted function. (do_rsa_sign_spki): Likewise. * src/dsa_keygen.c (dsa_generate_key): Rewrote to use nettle's dsa_generate_keypair function. 2002-11-02 Niels Möller * src/dsa.c (dsa_hash): Deleted function. (generic_dsa_verify): Rewrote to use nettle's dsa_verify. (do_dsa_verify_spki, do_dsa_sign_spki): Deleted method. (generic_dsa_sign): Rewrote to use nettle's dsa_sign. (dsa_blob_length): Use struct dsa_signature for the argument. (dsa_blob_write): Likewise. (encode_dsa_sig_val): Likewise. (decode_dsa_sig_val): Likewise. (make_dsa_signer): Use dsa_private_key_init. (class dsa_verifier): Use nettle's struct dsa_public_key. (class dsa_signer): Use nettle's struct dsa_private_key. (do_dsa_verify): Recognize algorithm "spki". (do_dsa_sign): Likewise. * src/bignum.c (bignum_write): Use const. * src/atoms.in: New atom "spki", for generic spki operations. * src/abstract_crypto.h (SIGN_SPKI, VERIFY_SPKI): Deleted methods used only by the testsuite. 2002-11-01 Pontus Sköld * src/testsuite/Makefile.am (TS_SH): New test lsh-9-test. * src/testsuite/lsh-9-test: Test for LSHFLAGS. * src/client.h (client_options): New attribute, inhibit_actions. Declaration of envp_parse. * src/client.c (envp_parse): New function envp_parse. (client_argp_parser): Honour inhibit_actions. (init_client_options): Initialize inhibit_actions. * src/lshg.c (main_argp_parser): Honour inhibit_actions. (main): Use envp_parse. * src/lsh.c (main_argp_parser): Honour inhibit_actions. (main): Use envp_parse. 2002-10-23 Pontus Sköld * src/client_x11.c (parse_display): Handle special case DISPLAY=unix:x.y for local delivery. * src/client.c (do_detach_cb): New function replacing do_detach_cb_first and do_detach_cb_second. (do_detach_cb_first): Deleted. (do_detach_cb_second): Deleted. (make_detach_callback): Use new function stead of do_detach_cb_first. 2002-10-22 Pontus Sköld * src/client.c: Include io.h. (detach_callback): New class to handle detachment and synchronization with fds. (detach_resource): New class used for synchonization with channel disappearance. (do_detach_res_kill): Kill method for detach_resource. (make_detach_resource): New function. (do_detach_cb_second): New function that does the actual detaching. (do_detach_cb_first): Callback for synchronization with fds. (make_detach_callback): New function. (init_client_options): Set options->detach_end to 0 (detachment disabled by default). (client_options): Help message for detach and no-detach. (make_client_session): If options->detach_end, make a callback for stdout and set a resource on the channel to synchronize. Also reset options->detach_end to 0 (so it only affects one action). (client_argp_parser): Handle detach and no-detach. * src/client.h: New variable in client_options: detach_end. 2002-10-03 Niels Möller * configure.ac: Use AC_SEARCH_LIBS instead of AC_CHECK_LIB when looking for libnsl, so we don't pick it up unless it really is needed. 2002-10-02 Pontus Sköld * src/lshd.c: Include if it exists. (main): setrlimit to raise max number of open files if available. * configure.ac: Check for and setrlimit. 2002-10-02 Pontus Sköld * configure.ac: Don't AC_PATH_PROG for bash, m4 and groff if given. Made them precious. 2002-10-01 Niels Möller * src/testsuite/run-tests (test_program): Use basename (fix copied from src/nettle/examples/). 2002-09-12 Niels Möller * Released lsh-1.5.0. * misc/make-dist: Deleted obsolete make check-more call. * src/keyexchange.c (kex_make_encrypt, kex_make_decrypt): Changed interface so that we can both support the "none" cipher, and return failure for weak keys. (install_keys): Updated to the new kex_make_encrypt and kex_make_decrypt interface. * configure.ac: Deleted the ipv6 test that tried to create an ipv6 socket. 2002-09-03 Pontus Sköld * src/server_x11.c (XAUTH_PROGRAM): Use predefined value if available and built in default if not. * configure.ac: Search for xauth. 2002-09-02 Pontus Sköld * src/testsuite/lsh-8-test: New test. Check whatever unencrypted sessions work. 2002-08-30 Pontus Sköld * src/testsuite/functions.sh: Defaults need to be quoted if they contain spaces. 2002-08-29 Niels Möller * src/testsuite/x11-1-test: Renamed, was lshd-x11-1-test. * src/testsuite/functions.sh (test_fail, test_result): Call exit. (test_skip): New function. (check_x11_support): New function. * src/testsuite/Makefile.am (distclean-local): Delete files and directories created by the test cases. (EXTRA_DIST): Distribute key-2.private and fake-sshd1. * src/lsh.c (main_options, main_argp_parser): Handle X11 options only if WITH_X11_FORWARD is defined. 2002-08-28 Niels Möller * doc/lsh.texinfo (Top): Use @ififo around the @top directive, to get rid of the empty menu item inthe html output. * configure.ac: Bumped version to 1.5. 2002-08-28 Niels Möller * doc/index.html: New file. * src/lsh-authorize: Use the construction ": ${var:=default}". * src/testsuite/functions.sh: New variables TEST_HOME and SEXP_CONV. Changed the initialization of LSH_YARROW_SEED_FILE. Use TEST_HOME when running lsh and lshd. Should make the tests independent of our own ~/.lsh. Also updated comments in test-scripts that said they were dependent on ~/.lsh. Use the construction ": ${var:=default}". * src/testsuite/setup-env: New script to set up a HOME-directory for the tests. * src/testsuite/lshd-x11-1-test: New test. * src/lsh-authorize: Set SEXP_CONV to "sexp-conv", unless that variable is already defined by the caller. * src/server_x11.c (SUN_LEN): #define SUN_LEN if needed. 2002-08-27 Niels Möller * src/server_x11.c (new_x11_channel): We don't have any ip-address of the client, so send <"unix-domain", 0> as the peer address. 2002-08-27 Niels Möller * src/server_pty.c (pty_open_slave): Removed call to setsid(), moved to... * src/unix_user.c (do_spawn): Call setsid(). Was previously done by the pty code, and only in the pty case. Fixed also in 1.4 branch. * src/server_session.c (init_spawn_info): Save the SSH_CLIENT value in the session struct, so that it can be gc:ed properly. * src/charset.c (low_utf8_to_local): Use lsh_string_trunc. * src/digits.c (decode_base64): Likewise. * src/io.c (do_consuming_read): Likewise. * src/read_base64.c (do_read_base64): Likewise. * src/read_file.c (do_read_file): Likewise. * src/string_buffer.c (string_buffer_final_write): Likewise. (string_buffer_final): Likewise. * src/channel.c (channel_data_handler): Likewise. (channel_extended_data_handler): Likewise. * src/tty.c (tty_encode_term_mode): Likewise. * src/abstract_crypto.c (crypt_string): Check that input is a multiple of the block size. (crypt_string_unpad): Use lsh_string_trunc. * src/format.c (lsh_string_trunc): New function, needed to get proper NUL-termination when strings are truncated. * src/server_x11.c (do_xauth_exit): Fixed format strings for error messages. 2002-08-27 Niels Möller * src/server_x11.c (server_x11_setup): Bugfix, really call server_x11_listen. 2002-08-26 Niels Möller * src/server_x11.c (OPEN_FORWARDED_X11): Added forward declaration. (server_x11_callback): Renamed (was server_x11_forward), and enabled. (server_x11_socket): New attribute display_number. (open_x11_socket): Pass an exception handler to io_bind_sockaddr. Start listening on the socket. Record the display_number. (server_x11_setup): Added argument single (and fail if it is non-zero). Updated caller in server_session.c. Call server_x11_setup. Ues the real display number when formatting the DISPLAY string. * src/channel_forward.c (catch_channel_open): Moved here... * src/tcpforward_commands.c: ...from here. * src/tcpforward_commands.c (tcpip_connect_io_command): Renamed, was tcpip_connect_io. (do_tcpip_start_io): Deleted, replaced by channel_forward_start_io. * src/tcpforward.c: No need to include string.h and errno.h. * src/tty.c: Likewise. * src/server_userauth.c: No need to include string.h. * src/randomness.c: No need to include errno.h. * src/read_packet.c: Likewise. * src/io_commands.h (make_listen_local, make_connect_local): Deleted prototypes. * src/werror.c (werror_vformat): Added %e specifier. Updated all errno printing functions to use it. (werror_format): New function. (fatal): Compile time flag to display pid and hang, instead of aborting. Useful for debugging. 2002-08-25 Niels Möller * src/server_x11.c (new_x11_channel): New function. (open_forwarded_x11): New command. * src/lsh.c (main_argp_parser): Updated call of make_gateway_setup. * src/io_commands.c (bind_local_command): New command. (do_listen_local): Deleted function. (make_listen_local): Deleted function. (do_connect_local): Deleted old #if:ed out function. (make_connect_local): Deleted old #if:ed out function. * src/gateway_commands.c (make_gateway_setup): Take a local_info as argument. Use the new bind_local command. * src/lsh.h: Added forward declarations for structs in command.h. Removed the inclusion of command.h from other header files. * src/channel_forward.c (start_io_command): New command, to replace tcpip_start_io. * src/lsh_proxy.c (lsh_proxy_listen): Replaced listen_callback with new bind and listen commands. 2002-08-24 Niels Möller * src/io_commands.c (do_listen): Deleted function. (listen_with_callback): Deleted command. * src/lshd.c (make_lshd_listen): Replaced listen_callback with new bind and listen commands. * src/io_commands.c (listen_command): New command, to replace listen_with_callback. (bind_address_command): New command. * src/io.c (make_listen_callback): Use a command, not a continuation, to represent the callback. Updated callers. * src/io_commands.c (do_listen): Use io_bind_sockaddr. (do_listen_local): Use io_bind_local. * src/io.c (io_bind_sockaddr): New function. (io_listen_fd): Take a struct lsh_fd * as argument, instead of an int. (io_listen): Use io_bind_sockaddr. (io_listen, io_listen_fd): Deleted function io_listen. Renamed io_listen_fd to io_listen. (io_bind_local): New function replacing io_listen_local. Updated callers. 2002-08-11 Niels Möller * src/unix_user.c (do_read_file): Use seteuid, not setuid. * src/server_x11.c (server_x11_socket): New class. (delete_x11_socket): New function. (do_kill_x11_socket): New function. (open_x11_socket): New function. (server_x11_listen): New function. * src/lshd.c: Enable X11 support. * src/server_session.c: Likewise. * src/io.c (io_listen_fd): New function. (io_listen): Use io_listen_fd. (lsh_popd): Renamed safe_popd, and made non-static. (lsh_pushd_fd): New function. (lsh_pushd): Renamed safe_pushd, and use lsh_pushd_fd. Also added arguments result and secret. Updated all callers. 2002-07-18 Niels Möller * configure.ac: Use -ggdb3 for gcc, except for gcc-2.96. 2002-07-05 Niels Möller * src/lshd.c: Disabled incomplete x11 forwarding for now. * src/server_session.c: Likewise. * src/server_x11.c: Likewise. 2002-07-03 Pontus Sköld * src/lshg.c: Include to get execvp declaration, define LSH_FILENAME if not defined. (lshg_options): New attribute fallback_lsh. (make_options): Initialize fallback_lsh. (main_options): New option -G to handle fallback. (main_argp_parser): Handle new option. (main_argp): Added missing space in message. (lshg_exception_handler): New class. (do_exc_lshg_handler): If the exception was because there was no usable gateway and fallback is enabled, launch lsh instead. (make_lshg_exception_handler): No longer call make_exception_handler but construct the object ourself. (main): make_lshg_exception_handler takes more arguments to handle the lsh fallback. * src/io_commands.c (connect_local_command): Check if the connection was successfull and raise an exception otherwise. 2002-07-02 Niels Möller * src/unix_user.c (do_spawn): Allow err[1] and out[1] to be the same fd. * src/server_x11.c (do_xauth_exit): Log a message if xauth failed. (server_x11_setup): Fixed format of display string. (server_x11_setup): Use an absolute filename for the xauth program. (server_x11_setup): Added missing new line on the xauth command line. * src/server_session.c (init_spawn_info): Set DISPLAY and XAUTHORITY, if x11 forwarding was requested. Updated callers, as the size of env changed. (do_x11_req): Bugfix, the single flag is one byte, not four. * src/Makefile.am.in (liblsh_a_SOURCES): Added server_x11.c. 2002-06-28 Niels Möller * src/lshd.c (main_options): New options, --tcpip-forward, --no-tcpip-forward (earlier there was no option for disabling tcpip forward), --x11-forward and --no-x11-forward. (main_argp_parser): Handle x11 options. (main): Install handler for x11-req, if appropriate. * src/server_session.h (x11_req_handler): Declare handler. * src/server_session.c (do_x11_req): Fixed error message. 2002-06-27 Niels Möller * src/lsh_proxy.c (main) [WITH_X11_FORWARD]: Fixed type warning. * src/lsh.c (main_argp_parser): Use STATIC_REPORT_EXCEPTION_INFO, and const. * src/lshd.c (main): Likewise. * configure.ac: Fixed type, enable_x11_forward should work now. * src/server_x11.c (server_x11_setup): Bugfixes. Send cookie on xauth stdin. * src/tcpforward_commands.c (open_tcpip_report): Declare const.: * src/server_session.c (do_x11_req): Use server_x11_setup. * src/channel.c (channel_request_handler): Use a const report_exception_info. (global_request_handler): Likewise. * src/exception.c (make_report_exception_handler): Use a const report_exception_info object. * src/command.c (make_catch_report_apply): Likewise. 2002-06-27 Pontus Sköld * src/testsuite/string-test.c (test_main): Added extra bubble babble check for a typo Richard Kettlewell discovered. 2002-06-26 Pontus Sköld * src/format.c (lsh_string_bubblebabble): Fixed stupid typo making w occur in bubble babble fingerprint where it should be z. Also fixed the size of the cons array. 2002-06-26 Niels Möller * src/unix_user.c (do_lookup_user): Don't treat accounts with a single "*" in the paswd-field as disabled. * src/spki.c (spki_pkcs5_decrypt): Bug fixes. Friendlier pass phrase prompt. * src/unix_user.c (do_verify_password): Interpret short passwd-fields as password login disabled. (do_lookup_user): Improved rules for dealing with shadow passwords, disabled accounts, etc. * src/io.c (do_write_callback): Added some code to ignore write errors for the final , but #if:ed out the code again. * src/client_userauth.c (do_none_login): Print a verbose message. (send_password): Likewise. (do_userauth_pk_ok): Likewise. (do_publickey_login): Likewise. * src/client_session.c (do_client_io): Updated invocations of make_channel_io_exception_handler. * src/server_session.c (spawn_process): Create a silent exception handler for i/o errors on stdout, to avoid cluttering down the log. * src/channel.c (make_channel_io_exception_handler): New argument silent. * configure.ac: Bumped version to 1.4.2. * src/lsh.c (read_user_keys): Support aes for encrypted private keys. 2002-06-26 Niels Möller * src/lsh-make-seed.c (get_dev_random): Bugfix: Actually try both /dev/random and /dev/urandom. * doc/lsh.texinfo (lshd basics): Changed invokation of lsh-keygen. 2002-06-25 Niels Möller * src/server_x11.c, src/server_x11.h: New files. (make_xauth_exit_callback): New function. (server_x11_setup): New function. * src/server_session.c (server_session): New attribute x11. (do_x11_req): New function. 2002-06-23 Pontus Sköld * configure.ac: Cosmetic changes of message shown when libwrap detection fails. 2002-06-18 Niels Möller * src/server_session.c (spawn_process): Call io_set_type, if stdin is a pty. (do_eof): Removed the pty ^D hack,a s it's now taken care of by close_fd_write. 2002-06-17 Niels Möller * src/io.c (io_set_type): New function. (close_fd_nicely): Call close_fd_write, for handling the write-related work. (close_fd_write): If the fd is a pty, write a EOF (^D) character. * src/io.h (lsh_fd): New attribute TYPE. 2002-06-05 Niels Möller * configure.ac: Bumped version to 1.4.1. New option --enable-initgroups-workaround, copied from the 1.2 branch. 2002-06-04 Niels Möller * Released lsh-1.4. * src/rsa.c (do_rsa_public_spki_key): Reverted the 2001-01-24 change "rsa-pkcs1-sha1" -> "rsa-pkcs1". * src/testsuite/conv-2-test, src/testsuite/conv-3-test: Updated testcases. 2002-05-30 Pontus Sköld * src/server_session.c (init_spawn_info): Require more entries available for environment variables. Set SSH_TTY if appropiate as well as SSH_CLIENT. (shell_request_handler): Reserve more environment variable entries. (exec_request_handler): Dito. (do_spawn_subsystem): Dito. * src/io_commands.c (do_connect_continuation): Derive local address_info from fd and pass to make_listen_value. * src/io.c (make_listen_value): Takes an extra struct address_info* to initialize local with. (do_listen_callback): Get a local address_info and pass to make_listen_value. (fd2info): New function. * src/io.h: New variable local in listen_value. make_listen_value takes an extra struct address_info*. (fd2info): declaration of new function. * src/gateway_commands.c (gateway_make_connection): Also pass lv->local to make_ssh_connection. * src/handshake.c (handshake_command): dito. * src/connection.h: New variable local in ssh_connection. make_ssh_connection takes an extra struct address_info*. * src/connection.c (make_ssh_connection): dito. 2002-05-24 Pontus Sköld * src/io.c (io_final): Set stdin, stdout and stderr to blocking mode. * src/io_commands.c (do_tcp_wrapper): Send a copy of self->msg to A_WRITE instead of the string itself. 2002-05-15 Pontus Sköld * configure.ac: Added things neccessarry for tcp wrappers to work. * src/lshd.c (OPTIONS2TCP_WRAPPER): New command. New options: --tcpwrappers, --no-tcpwrappers, --tcpwrappers-msg. * src/io_commands.c: Include if building with tcp wrappers. Also include . (tcp_wrapper): New class. (do_tcp_wrapper): New function. (do_tcp_wrapper): New function. * src/io_commands.h (make_tcp_wrapper): Definition of new function. 2002-05-14 Pontus Sköld * src/algorithms.c (list_algorithms): Added missing newline after the list of algorithms. (list_hostkey_algorithms): dito. 2002-05-13 Pontus Sköld * src/lsh.c (make_options): Don't fail totally if we can't create a randomness source. (main_argp_parser): Do argp_failure unless we have a valid randomness object. * src/lshd.c (main): Check for a correctly initialized random object in options. (make_lshd_options): Don't return failure if random creation failed, just initialize signature_algorithms with a null random source (this should enable users without a seed to do lsh --help and normal users to do lshd --help). (main_argp_parser): Do argp_failure unless we have a valid randomness object. 2002-05-06 Niels Möller * README: Document requirement of autoconf-2.52 and automake-1.6.1. * configure.ac: Require autoconf-2.52. 2002-05-06 Niels Möller * configure.ac (CFLAGS): Don't enable -Waggregate-return. 2002-05-06 Niels Möller * src/gateway_channel.c (do_gateway_channel_open): Undid previous change. Let channel.c:check_rec_max_packet adjust the rec_max_packet size if needed, when it gets to the channel. (do_gateway_channel_open_continuation): Likewise. * src/channel.c (check_rec_max_packet): New function, that adjusts our advertised rec_window_size so that we won't exceed the connection's packet size limit. (format_open_confirmation): Call check_rec_max_packet. (format_channel_open_s): Likewise. (format_channel_open): Likewise. * src/read_data.c (do_read_data_query): Undid previous change. Now look at only send_window_size and send_max_packet. 2002-05-05 Niels Möller * configure.ac: Pass no options to AM_INIT_AUTOMAKE. 2002-05-05 Niels Möller * configure.ac: Update for automake-1.6. * src/gateway_channel.c (do_channel_open_forward): Added a FIXME comment. We should install a new exception handler here. * configure.ac: Renamed file, used to be configure.in. * configure.in: Bumped version number to 1.4. * doc/lsh.texinfo (Algorithm options): Updated description of the default cipher. We now use AES, not triple-DES. 2002-05-02 Niels Möller * src/gateway_channel.c (do_gateway_channel_open): Limit rec_max_packet to SSH_MAX_PACKET. (do_gateway_channel_open_continuation): Likewise. * src/channel.c (parse_channel_open): Don't subtract SSH_MAX_PACKET_FUZZ here, it's handled in read_data.c. * src/server_session.c (make_server_session): Likewise. * src/client_session.c (make_client_session_channel): Likewise. * src/channel_forward.c (init_channel_forward): Likewise. * src/read_data.c (do_read_data_query): Don't read more than send_max_packet - SSH_MAX_PACKET_FUZZ, as to not exceed the receivers maximum packet size. 2002-04-04 Pontus Sköld * src/lsh.c (do_lsh_lookup): Cosmetic changes of unauthenticated key fingerprint text. 2002-04-03 Pontus Sköld * src/format.c (lsh_string_bubblebabble_c): New function to define the che bubble babble checksum series, used by lsh_string_bubblebabble. * src/lsh.c (do_lsh_lookup): Rearranged the unauthenticated key fingerprint display somewhat and added bubble babble SHA1 of keyblob (which seems to be what OpenSSH is using at least). * src/format.c (lsh_string_bubblebabble): New function to bubblebabble a string. * src/format.h (lsh_string_bubblebabble): New function to bubblebabble a string. * src/testsuite/string-test.c (test_main): Added checks for lsh_string_bubblebabble. * src/lsh.c (do_lsh_lookup): Output the fingerprint of the remote host according to draft-ietf-secsh-fingerprint-00.txt (and keep the old way of outputing). * src/format.c (lsh_string_colonize): New function to insert colons in a lsh_string. * src/format.h (lsh_string_colonize): Likewise * src/testsuite/string-test.c (test_main): Added tests for lsh_string_colonize. * src/client.c (client_options): Bugfix: OPT_SUBSYSTEM shouldn't be inside char quotes. 2002-03-27 Niels Möller * src/io.c (lsh_oop_stop_callback): Use the OOP_HALT constant. * src/client_x11.c (do_client_channel_x11_receive): Allow lowercase letters 'l' and 'b' for the endianness indicator. * src/client.c: Removed the short alias, -C, for the --subsystem option. 2002-03-26 Niels Möller * src/lsh-authorize: Don't use &>-redirects, as /bin/sh doesn't understand that. Noticed by Timshell Knoll. 2002-03-25 Niels Möller * src/lsh-execuv.c: Deleted utmp stuff, this is not the right place for that. 2002-03-26 Pontus Sköld * configure.in: If with_scheme is absolute, don't AC_PATH_PROG for it but just use it directly. * src/client.c (client_options): Added implication of no-pty in subsystem help text if PTY-support is enabled. (client_argp_parser): Turn of pty-request if there is a subsystem request. 2002-03-22 Niels Möller * src/sexp-conv.c (main): Add newline at end of --raw-hash output. 2002-03-20 Pontus Sköld * src/testsuite/lsh-1-test: Run "exec 0" instead of "exec" in case the last command in the user's startup files ended with nonzero exit status. * src/testsuite/lsh-5-test: Likewise. * src/testsuite/lsh-6-test: Likewise. * src/testsuite/lshg-1-test: grep -q changed to redirection to /dev/null. * src/testsuite/ssh1-fallback-test: Likewise. 2002-03-20 Niels Möller * src/testsuite/run-tests (test_program): Added missing single quote. 2002-03-20 Niels Möller * src/testsuite/functions.sh (at_connect): Put -- between the options and the arguments, as that is the correct place according to POSIX. * src/testsuite/lsh-7-test: Rewrote !command-expressions as an if expression, to work with /bin/sh. 2002-03-20 Niels Möller * src/io.c (address_info2sockaddr): Zero-terminate the default_preferences list. 2002-03-20 Niels Möller * src/client_session.c (make_client_session_channel): Clear the CHANNEL_CLOSE_AT_EOF flag. * src/testsuite/run-tests (test_program): Test the exit status of the right process. * src/testsuite/fail-test: New, always failing, testcase. For testing run-tests. * src/testsuite/functions.sh (at_connect): Don't use -- in argument list to mini-inetd, appearantly Solaris' getopt doesn't handle that. 2002-03-19 Niels Möller * src/io.c (address_info2sockaddr): Prefer AF_INET addresses over AF_INET6 (as it seems common that localhost has an ipv6 address that doesn't work). Even better would be to try all addresses, but that has to wait for later. 2002-03-19 Pontus Sköld * src/sftp/testsuite/*-test: grep -q is XPG4, which not all greps (notably Solaris /bin/grep) are. * src/sftp/testsuite/run-tests: Replaced bashims. 2002-03-19 Pontus Sköld * src/testsuite/seed-test: Fixed bashism. 2002-03-19 Pontus Sköld * src/testsuite/run-tests: Replaced bashims. 2002-03-19 Pontus Sköld * src/unix_process.c: Added GETUTXID and UPDWTMPX. (do_utmp_cleanup): Write cleared entry to wtmp{,x} with updwtmp{,x} if logwtmp is not available. (utmp_book_keeping): Likewise. 2002-03-18 Niels Möller * src/lsh-pam-checkpw.c: Include stdlib.h. 2002-03-18 Niels Möller * src/testsuite/conv-3-test: New test program. * contrib/lshd.debian.init: Check for existance of /var/spool/lsh/yarrow-seed-file. (restart): New target, which sends SIGHUP to the running lshd and then starts a new one. * src/testsuite/runtests: Old testscript removed. * src/testsuite/Makefile.am (check-some, check-more): Use run-tests, not runtests. * src/io.c (io_run): Check for OOP_ERROR. This means we need at least liboop-0.8. * src/server_userauth.c (do_handle_userauth): Free username on failure. * src/server_publickey.c (do_authenticate): Free username and keyblob on failure. * src/lshd.c (lshd_options): New field resources, that keeps track of resources to be killed at sighup or program exit. (make_lshd_options): Create the resource list, and register it with the gc. (pid_file_resource): New class. (sighup_close_callback): New class. (do_sighup_close_callback): New SIGHUP handler. (make_sighup_close_callback): New function. (close_on_sighup): New command. (make_lshd_listen): Close listen socket on SIGHUP. (do_terminate_callback): Always catch SIGTERM. (install_signal_handlers): Renamed the function install_terminate_handler. Now installs handlers for both SIGHUP and SIGTERM. (main): Arrange for the pidfile to be deleted at exit or SIGHUP. * src/io.c (nfiles): New global variable. (lsh_oop_stop_callback): New function. (lsh_oop_stop): New function. (lsh_oop_cancel_stop): New function. (io_nfiles): New function. (close_fd): Decrement nfiles, and call lsh_oop_stop when no files are left. (make_lsh_fd): Increment nfiles. * src/format.c (ssh_format): Use the format string as the debugging "clue" for the string. * configure.in (CFLAGS): Don't use -ggdb3, as it seems to be broken on sparc. * src/unix_process.c: Unified utmp/utmpx code. 2002-03-18 Pontus Sköld * src/unix_process.c: Make certain WTMP_FILE and WTMPX_FILE are defined. * configure.in: Can't check for structs with AC_CHECK_MEMBER, check for a sub member instead. * src/unix_process.c (do_utmp_cleanup): Rewrote to use utmpx if both utmpx and utmp is available. Also, don't search for an existing entry but construct a new one and putut{,x}line it. Don't clear fields explicitly (the memset). (utmp_book_keeping): Prefer utmpx, and don't search for existing entries. Bugfix: gettimeofday takes two arguments, pass 0 as second (timezone). 2002-03-18 Pontus Sköld * configure.in: Check for utmpx symmetrically to utmp. Check for more members of struct utmp. Check for members of struct utmpx. 2002-03-18 Niels Möller * src/lsh-keygen.c (main): Updated to use the rewritten rsa_generate_key. 2002-03-17 Niels Möller * src/rsa_keygen.c (rsa_generate_key): Rewrote to use nettle's RSA key generation. Deleted the argument E. * src/lsh-writekey.c (main_argp_parser): Initialize a randomness generator only if needed (i.e. if the key is going to be encrypted), and let the --server determine which seed-file is used. * src/lsh-writekey.c (main): New option --server, that writes the output files where the server expects its host key. * src/lsh-writekey.c (main): Check that files doesn't exist before reading the key, but don't create the files until they are actually written to. (file_exists): New fucntion. (check_file): New function. (open_file): New function. (open_private_file): Deleted function. (open_public_file): Deleted function. * src/lsh-keygen.c (do_lsh_keygen_handler): Deleted obsolete function. * src/lsh-keygen.c (main): New option --server, that uses the server's seed-file. * src/unix_user.c (safe_close): New function. (do_spawn): Avoid close(-1). 2002-03-17 Pontus * src/unix_process.c (do_utmp_cleanup): Set ut_type to USER_PROCESS before calling getutid (neccessary on my Linux system, and shouldn't break anything). Make a working copy to modify. Do some logging. 2002-03-16 Niels Möller * src/unix_user.c (exec_shell): Bugfix, fixed test for login-mode. * src/unix_process.c (do_utmp_cleanup): Compute suitable values for ut_line and ut_id. (strip_tty_name): Deleted function. (do_utmp_cleanup): Modify utmp by setutmp, getutid, pututline. (utmp_book_keeping): Likewise. * configure.in (SCHEME_NAME): Simple check for gmp.h, don't look for gmp2/gmp.h. Check for ut_time, ut_tv, ut_pid and ut_exit memebers in struct utmp. Check for __gmpz_getlimbn, introduced in gmp-3.1. Dropped support for gmp2 (as Nettle doesn't support it anyway). * src/unix_user.c (do_chdir_home): Deleted function. (change_uid): Deleted function. * src/unix_process.c (unix_process_setup): Removed login argument again. (utmp_book_keeping): Always create utmp entries as USER_PROCESS, not LOGIN_PROCESS. * src/unix_user.c (do_fork_process): Deleted function. (do_exec_shell): Deleted function. * src/userauth.h (USER_CHDIR_HOME): Deleted method. (USER_FORK): Deleted method. (USER_EXEC): Deleted method. * src/unix_user.c (make_process_resource): Deleted old code. * src/server_session.c (spawn_process): Deleted old code. (shell_request_handler): Likewise. (exec_request_handler): Likewise. (do_spawn_subsystem): Likewise. * src/server_session.c (format_exit_signal): Removed "Process killed by" from the message. (spawn_process): Rewrote function, using USER_SPAWN and struct spawn_info. Updated the shell_request, exec_request and subsystem_request handlers. (init_spawn_info): New function. (do_spawn_subsystem): Fixed argument list, should be -c . * src/unix_user.c (exec_shell): Added the real login shell to the lsh-execuv argument list. (do_spawn): Bug fix, don't reference info->pty->tty_name if info->pty is NULL. (make_unix_user): Initialize the spawn pointer. * src/unix_process.c: Added some trace calls. 2002-03-15 Niels Möller * src/userauth.h (struct spawn_info): Struct with information for the new USER_SPAWN method. (USER_SPAWN): New method. * src/unix_user.c (chdir_home): New function. (exec_shell): New function. (do_spawn): New function. #if:ed out code that has been moved to unix_process.c. (do_lookup_user): Use /bin/sh as login shell if there's no login shell in the passwd-database. * src/unix_process.c (unix_process_setup): Adding login argument, which should be non-zero for a login session. * src/reaper.h (reap): Deleted this super class. Updated users. * src/Makefile.am.in (liblsh_a_SOURCES): Added unix_process.c. (lsh_execuv_LDADD): lsh-execuv need not be linked with liblsh. * configure.in: Check for more utmp related functions. 2002-03-14 Niels Möller * src/unix_process.c: New file, to replace the process stuff in unix_user.c 2002-03-14 Pontus * configure.in: Added check for libpam if PAM is enabled. 2002-03-14 Niels Möller * src/resource.h (REMEMBER_RESOURCE): Deleted method, use an ordinary fucntion remember_resource instead. Updated all callers. * src/resource.c (concrete_resource_list): Deleted class, put all information directly in the resource_lsit class. (remember_resource): New public function. * configure.in: Removed check for 8-bit clean m4. * src/channel.c (do_channels_after_keyexchange): New function. (init_connection_service): Call connection_after_keyexchange, to start reading again after a key exchange. * src/gateway_channel.c (do_send_adjust): Call FLOW_CONTROL_REPORT only if i > 0. * src/handshake.c (handshake_command): Call connection_after_keyexchange. * src/connection.h (ssh_connection): Renamed established attribute to keyexchange_done. * src/connection.c (make_ssh_connection): Deleted the continuation argument. (connection_after_keyexchange): New function. * src/read_data.c (do_read_data_query): Check the connection's send_kex_only flag. * src/keyexchange.c (keyexchange_finish): Moved invocation of connection->established... * src/connection.c (connection_send_kex_end): ...to here. * src/resource.c (do_remember_resource): Assert that resource is non-NULL. * src/keyexchange.c (send_kexinit): Create a new kexinit struct. Disable key-expire timer during the key exchange. (make_kexinit_handler): Deleted init argument, it's now stored with the connection. (SESSION_KEY_LIFETIME_CLIENT, SESSION_KEY_LIFETIME_SERVER): New constants. (do_handle_newkeys): Install key expire timeout. (set_reexchange_timeout): New function. * src/io.c (lsh_oop_register_callout, lsh_oop_cancel_callout): Added trace call. * src/handshake.c (handshake_command): Store the make_kexinit object in the connection's kexinit attribute. * src/connection.h (ssh_connection): New attribute kexinit, needed for initiating keyexchange. * src/algorithms.c (all_crypto_algorithms): Prefer aes256. (default_crypto_algorithms): Likewise. * src/Makefile.am.in (EXTRA_PROGRAMS): Added lsh-pam-checkpw. 2002-03-13 Niels Möller * src/keyexchange.c (send_kexinit): Renamed from initiate_keyexchange. Updated callers. Disable the key re-exchange timer. (do_handle_kexinit): Call send_kexinit, instead of duplicating it. * src/testsuite/Makefile.am (TS_PROGS): Added parse-config-test. * src/string_buffer.c (string_buffer_putc): New constant BUFFER_INCREMENT. Code still not used. * src/ssh.h (SSH_FIRST_KEYEXCHANGE_SPECIFIC): New constant. * src/parse_config.c (parse_setting): Return a status code, to get the handling of ignored keywords right. Updated callers. (parse_hosts): Return a status code. Updated callers. * src/lshg.c (do_lshg_send_ignore): Use C_WRITE_NOW. * src/keyexchange.c (initiate_keyexchange): Call connection_send_kex_start. Use C_WRITE_NOW. (do_handle_kexinit): Likewise. (do_handle_newkeys): For uniformity, reset the NEWKEYS handler to &connection_fail_handler, even though NULL should work fine. (keyexchange_finish): Use C_WRITE_NOW. Call connection_send_kex_end. #if:ed out the code sending DEBUG messages at this point. * src/handshake.c (compat_info): SSH-3.0 still needs the PEER_SEND_NO_DEBUG flag. Also updated code to use the the peer_flag enum. * src/client_keyexchange.c (do_init_client_dh): Use C_WRITE_NOW. (do_handle_srp_reply): Likewise. (do_init_client_srp): Likewise. * src/server_keyexchange.c (do_handle_dh_init): Likewise. (do_srp_server_proof_handler): Likewise. (do_server_srp_read_verifier): Likewise. * src/config_parse.y: Deleted file, use a recursive-descent parser instead. * src/Makefile.am.in (liblsh_a_SOURCES): Added parse_config.c. Removed disconnect.c * src/disconnect.c, src/disconnect.h: Deleted files, code moved to connection.c. * src/debug.c (send_debug_message): Use C_WRITE_NOW. (send_debug, send_verbose): #if:ed out fucntions. * src/connection.h (enum connection_flag, enum peer_flag, enum kex_state): New enum types. (C_WRITE_NOW): New macro. * src/connection.c (connection_handle_packet): Don't allow random messages during key exchange. (connection_disconnect_handler, format_disconnect): Moved code from disconnect.c. (connection_send): New function, queueing messages during key exchange. (connection_send_kex_start): New function. (connection_send_kex_end): New function. 2002-03-11 Niels Möller * src/testsuite/testutils.h: Include werror.h. * src/testsuite/parse-config-test.c: New file. * src/parse_config.c: Work in progress. Added linenumber handling and comments. 2002-03-05 Niels Möller Cleaned up the bug compatibility tests. * src/handshake.c (compat_peer_flags): New function. (do_line): Call compat_peer_flags. * src/abstract_crypto.c (hash_string): Declare the input string as const. (mac_string): Likewise. * src/testsuite/testutils.c (test_hash): New function. (test_mac): New function. (test_sign): New function. (do_bad_random): New function, stupid randomness source for the test programs to use. (test_spki_match, test_spki_grant, test_spki_deny): New functions. * src/testsuite/run-tests: Improved testscript, copied from nettle/testsuite. * src/testsuite/testutils.c: Utility functions used by test programs. Don't use m4 to generate test programs. Added C files to CVS, deleted m4 files. * src/testsuite/Makefile.am: Deleted m4 files and rules. 2002-03-04 Niels Möller * src/parse_config.c, src/parse_config.h: New files. A lexer and a recursive-descent parser for config files. 2002-02-27 Niels Möller * src/config_parse.y: New file, for parsing config files. * src/unix_interact.c (do_make_raw): Modify the terminal's VMIN and VTIME values. * src/io.c (io_callout): Added an argument, the number of seconds until the callout should be invoked. * src/handshake.c (handshake_command): Make the connection timeout if handshake is not completed within 10 minutes. * src/gc.c (gc_register): Updated call of io_callout. * src/connection.c (connection_set_timeout): New function. (connection_clear_timeout): New function. * src/channel.c (init_connection_service): Cancel the connection's timeout timer. 2002-02-22 Niels Möller * src/client.c (init_client_options): Initialize port to NULL, in order to get the fallback from "ssh" -> 22 to work. FIXED in 1.2 branch. (client_argp_parser): Fixed port error message not to try printing NULL. FIXED in 1.2 branch. 2002-02-21 Niels Möller * src/server_session.c (make_pty): Simple bugfix, pty->master was lost too early. (spawn_process): Use an extra pipe for syncronization. The parent process won't proceed until the child is finished with it's pty processing. This works around a Solaris problem where reading the master side of the pty before the slave has been opened results in EINVAL. (do_alloc_pty): Bugfix, record the new pty properly. 2002-02-19 Niels Möller * src/server_session.c (spawn_process): Let the child process open the slave side of the pty. (do_alloc_pty): Don't open or touch the slave side of the pty, just open the master side and store the mode of the client,a nd the window dimensions, in the pty_info struct for use later. * src/server_pty.c (do_kill_pty_info): Don't touch slave tty (as it's not opened yet). (pty_open_master): Renamed the pty_allocate function. Now opens only the master pty. Opening the slave as well has too many side effects, in particular, pushing the pty-related STREAMS modules on Solaris have the side effect of making the pty the controlling process of the lshd server (if it's running in daemonic mode). (pty_open_slave): Renamed function tty_setctty. Now responsible also for opening the slave side of the pty, pushing STREAMS modules, and setting the tty state. * src/server_pty.h: Include tty.h. (pty_info)): Deleted slave attribute. Added attributes dims and mode. * configure.in (CPPFLAGS): Don't zap old value. * src/crypto.c (make_aes_cbc_instance): Use aes_set_encrypt_key and aes_set_decrypt_key. aes_set_key is obsolete. 2002-02-07 Niels Möller * src/sftp/.bootstrap: Added -a flag to automake invocation. * src/sftp/sftp_c.c: Constness fixes. * src/sftp/sftp_bind.c (lsftp_open_connection): Bugfix, don't use i and i++ in the same expression. (lsftp_wait_not_eof): #if:ed out, not used anywhere. (lsftp_remove_sftp_cb): Likewise. Constness fixes, changed calling conventions not to pass and return structs. * src/sftp/lsftp.c (lsftp_num_commands): Declared function static. (lsftp_interactive_mainloop): Likewise. (lsftp_noninteractive_mainloop): Likewise. * src/sftp/dc.c (lsftp_dc_free_index): Made function static. (lsftp_dc_make_index): Likewise. (lsftp_dc_r_sloppy_glob): Likewise. (lsftp_dc_path_no_glob): Likewise. (lsftp_dc_path_first_glob): Likewise. General constification. * src/sftp/commands.c: Constification. Fixed warnings for mising prototypes and unused arguments. * src/sftp/commands.h (command_func): New typedef. * src/sftp/rl.c, src/sftp/rl.h: Fixed prototypes for funtions taking no arguments. * src/sftp/misc_fun.c (mgetenv): Fixed "valren" typo. (lsftp_skip_common): Use const char * for arguments and return value. (filename_part): Likewise. * src/sftp/str_utils.c (lsftp_unqoute): #if:ed out, this function isn't used anywhere. Constified, now uses const char * for most strings. * src/sftp/sftp_c.h (struct sftp_mem): Use UINT32, instead of signed int. (sftp_callback_func): New typedef. (struct sftp_callback): Changed prototype for nextfun. Changed UINT64 to off_t. Changed all prototypes to not pass and return structs without using pointers. * src/sftp/sftp_c.c: General change of calling conventions. Pass struct * and const struct *, instead of passing and returning structures "by-value". * src/sftp/buffer.c (sftp_packet_size): New function. (sftp_read_packet): Call clearerr after checking for error and eof. 2002-02-06 Niels Möller Checked in Pontus Sköld's lsftp client. * src/sftp/Makefile.am (lsftp_SOURCES): New make variable. * src/sftp/commands.c: New file. * src/sftp/commands.h: New file. * src/sftp/dc.c: New file. * src/sftp/dc.h: New file. * src/sftp/lsftp.c: New file. * src/sftp/lsftp.h: New file. * src/sftp/misc_fun.c: New file. * src/sftp/misc_fun.h: New file. * src/sftp/rl.c: New file. * src/sftp/rl.h: New file. * src/sftp/sftp_bind.c: New file. * src/sftp/sftp_bind.h: New file. * src/sftp/sftp_c.c: New file. * src/sftp/sftp_c.h: New file. * src/sftp/str_utils.c: New file. * src/sftp/str_utils.h: New file. 2002-02-01 Niels Möller * src/sftp/sftp-test-client.c: Deleted old code. (sftp_client_get_status): New function, for parsing -02 draft status messages. Use it everywhere. Applied Pontus Sköld's patch to comply with the -02 draft. * src/sftp/sftp-server.c (sftp_send_status): Added human-readable message and language tag. (sftp_process_mkdir): Get file attributes from the message, and honor permission bits, if available. (sftp_process_readlink): New function. (sftp_process_symlink): New function. (main): Added sftp_process_readlink and sftp_process_symlink to the dispatch table. * src/sftp/sftp.h (SSH_FXP_READLINK, SSH_FXP_SYMLINK): New message types. 2002-01-31 Niels Möller * src/lsh-pam-checkpw.c: Cosmetic changes. * src/Makefile.am.in (sbin_PROGRAMS): Added @PAM_PROGRAM@. * configure.in: PAM configuration. Command line option --disable-pam, check for security/pam_appl.h, substitution of PAM_PROGRAM. 2002-01-31 Niels Möller * src/lsh-writekey.c (open_public_file): Fixed error message. 2002-01-24 Niels Möller * src/sexp.c (sexp_format): Add a newline at the end of expressions in transport syntax. * src/sexp-conv.c (process_replace): New function. (parse_replace): New function. (main_options): New option --replace. (main_argp_parser): Handle OPT_REPLACE. (main): Call io_init and io_final. Needed to get the callback registered by the gc to work. (main): Call process_replace. (main): Don't add trailing newlines; let sexp_format do that. * src/io.c: Added assert checking that source is non-NULL, in functions that need it. * src/gc.c (gc): Print a verbose message at the start of gc. 2002-01-22 Niels Möller * src/unix_interact.c (do_make_raw): Added FIXME: about tty TIME and VMIN settings. * src/scm/gaba.scm (make-class): Added FIXME:-comment about offsetof. 2002-01-21 Niels Möller * src/xalloc.h (NEW_VAR_OBJECT, CLONE_VAR_OBJECT, CLONED_VAR_OBJECT): New macros. * src/xalloc.c (lsh_var_alloc): New function. (lsh_object_alloc): Use lsh_var_alloc. (lsh_var_clone): New function. (lsh_object_clone): Use lsh_var_clone. * src/list.c (lsh_list_alloc): Moved function here, from xalloc.c. Now uses lsh_var_alloc. 2002-01-20 Niels Möller * src/crypto.c (hash_update, hash_digest, hash_copy, make_hash): New functions using struct nettle_hash. (make_hmac_algorithm): Reorganized hmac implementation again. Now uses struct nettle_hash. Updated all users. * src/algorithms.c (all_symmetric_algorithms): Changed back to use make_hmac_algorithm. * src/abstract_crypto.h (hash_instance): Rewrote, use nettle, replaced methods with ordinary functions. (mac_instance): New class, before it was just analias for hash_instance. * src/Makefile.am.in (liblsh_a_SOURCES): Removed md5.c and sha.c. 2002-01-17 Niels Möller * src/md5.c, src/sha.c: Deleted files. The wrapper code was moved to crypto.c, and now uses struct nettle_hash. 2002-01-16 Niels Möller * src/pkcs5-test.c (main): Use crypto_hmac_sha1_algorithm. * src/lock_file.c (do_lsh_file_lock): Improved error message. * src/algorithms.c (all_symmetric_algorithms): Don't use make_hmac_algorithm. * src/crypto.c: Rewrote the hmac code to use Nettle. * src/hmac.c, src/Makefile.am.in: Deleted file hmac.c. 2002-01-14 Niels Möller * src/rsa.c (make_rsa_signer): Take advantage of rsa_public_key and rsa_private_key being independent structs now. General cleanup and deletion of old code. * src/spki.c (spki_hash_sexp): Bugfix, don't hash the data once. Bug reported by Werner Koch. * src/sexp_parser.c (sexp_parse): Added advanced-hex syntax, as an alias for the ordinary (but not implemented) advanced syntax. * src/sexp.c: Added new format "advanced-hex" that uses hex instead of base64. (encode_hex): New function. * src/rsa_keygen.c (rsa_generate_key): Renamed key type to "rsa-pkcs1". * src/rsa.c: Use nettle's rsa implementation. Deleted support for rsa-md5. Needs some more cleanup. * src/publickey_crypto.h: Moved rsa-related declarations here. * src/rsa.h: rsa.h is now obsolete. * src/lsh.c (read_user_keys): Added ATOM_RSA_PKCS1. * src/server.c (read_host_key): Likewise. * src/format.c (format_hex_string): Export this function. * src/atoms.in: Added "rsa-pkcs1". * src/algorithms.c (all_signature_algorithms): Deleted support for rsa-md5. 2002-01-13 Niels Möller * configure.in (lsh_cv_c_attribute): Consider __FUNCTION__ broken in gcc-3. 2002-01-09 Niels Möller * src/dsa.c (dsa_hash): Don't call sha1_final. * src/dsa_keygen.c (hash): Likewise. * src/lsh.h (struct lsh_string_header): Empty structs are not allowed by ANSI-C, so don't declare this one unless debugging is enabled. * src/lsh_proxy.c: Don't use randomness_with_poll. * src/lshd.c (main): Pass the correct type to make_simple_kexinit. * src/md5.c (do_md5_digest): Don't call md5_final and md5_init. * src/sha.c (do_sha_digest): Don't call sha1_final and sha1_init. * src/rsync/generate.c, src/rsync/receive.c, src/rsync/send.c: Removed calls of md5_final. 2001-12-16 Niels Möller * Released lsh-1.3.6. 2001-12-16 Niels Möller * src/lock_file.c: Include sys/types.h and sys/stat.h, needed on Solaris. 2001-12-14 Niels Möller * src/dsa_keygen.c (dsa_generate_key): Fixed declaration and code mixup. * src/rsa_keygen.c (rsa_generate_key): Likewise. 2001-12-14 Niels Möller * src/testsuite/Makefile.am (CLEANFILES, DISTCLEANFILES): Added fiels generated by the test, in order to make make distcheck happy. * src/used_headers: Update for automake-1.5, dependency files are now named foo.Po. * src/Makefile.am.in: Changed rules for prime_table.h and digit_table.h. Now they depend only on the source file, not on the executable. * doc/lsh.texinfo (lsh-make-seed): New section. (Files and environment variables): Wrote a file list. 2001-12-12 Niels Möller * doc/lsh.texinfo (Files and environment variables): Documented environment variables. * misc/make-dist: Deleted the strip_rsa function. * src/testsuite/functions.sh (LSH_YARROW_SEED_FILE): Export variable. Also create the seed file if needed. * src/testsuite/seed-test: Use the -q --sloppy flags when invoking lsh-make-seed. * src/sexp.c (sexp_format): Add newline at the end of the "advanced" syntax representation. Changed all internal uses of sexp_format to use the method SEXP_FORMAT instead. * src/sexp-conv.c (main): Deleted code for newline-terminating output. * src/rsa.c (make_rsa_signer): Call mpz_init for all bignum instance variables. * src/lsh-make-seed.c: New option --server. (main): If invoked with the quiet option (-q), never ask the user to type randomly. * src/lock_file.h (LSH_FILE_LOCK): New argument RETRIES. * src/lock_file.c (do_lsh_file_lock): If locking fails, optionally retry a few times. * src/client_x11.c (make_forward_x11): Assert that the randomness generator is of "good" quality. * src/rsa_keygen.c (rsa_generate_key): Likewise. * src/keyexchange.c (make_simple_kexinit): Likewise. * src/dsa_keygen.c (dsa_generate_key): Likewise. * src/dsa.c (generic_dsa_sign): Likewise. * src/dh_exchange.c (make_dh): Likewise. * src/Makefile.am.in (sbin_PROGRAMS): Install lsh-krb-checkpw in $prefix/sbin, not $prefix/bin. * src/randomness.c: Deleted old generators. * src/randomness.h: Deleted all classes but randomness. New method RANDOM_ADD. * src/unix_random.c: Rewrote to use yarrow. Updated users. * src/werror.c (werror_progress): Fixed test of verbose and quite flags. 2001-12-08 Niels Möller * src/lsh-pam-checkpw.c: New helper program for verifying passwords against PAM. Written by Pontus Sköld. 2001-12-07 Niels Möller * src/unix_user.c: Added comments on how to fix use of setuid. * src/lsh-make-seed.c: Added option --sloppy. * src/lsh-execuv.c: New file. Helper program for securely exec:ing user programs. 2001-12-05 Niels Möller * src/werror.c (werror_progress): New function. * src/ssh-conv: Shortened if-statement. * src/lsh-make-seed.c (main_argp_parser): Use the right default file name. (get_dev_mem): #if:ed out this code, it's dangerous on some systems. (get_system): Implemented this, including reading some /proc files. Implemented (get_interact): Implemented. (main): Move locking later, until we want to write the file. Implemented the actual writing of the seed-file data. * src/lsh-authorize: Fixed bash-isms, don't use "if !", use "$HOME" rather than "~". * src/lock_file.c (do_lsh_file_lock): Initialize info attribute in new object. (do_lsh_file_lock_p): New function, corresponding to a new method for checking if a lock exists, without creating one. * src/client_x11.c (make_client_x11_display): Fixed werror format string. * src/channel_forward.c: Use CAST_SUBTYPE in channel_forward's methods. Needed because it is subclassed as client_x11_channel. * src/Makefile.am.in (liblsh_a_SOURCES): Added lock_file.c. 2001-12-02 Niels Möller * src/lock_file.c, src/lock_file.c: New files. Locking mechanism for the seed file. 2001-11-23 Niels Möller * src/sftp/sftp-server.c (sftp_process_readdir): Clear errno before calling readdir. 2001-11-22 Niels Möller * src/sftp/sftp-server.c (sftp_attrib_from_stat): Bugfix, use |, not ||. Noticed by Pontus Sköld. 2001-11-20 Niels Möller * src/zlib.c (make_zlib_instance): Check return valus from inflateInit and deflateInit. * src/lsh-make-seed.c (update_zlib): New function. (get_dev_mem): Implemented reading of /dev/mem. 2001-11-14 Niels Möller * src/lsh-make-seed.c (get_dev_random): Implement reading of /dev/random. 2001-11-14 Niels Möller * src/Makefile.am.in (bin_PROGRAMS): Added lsh-make-seed. * src/lsh-make-seed.c: New program, for creating the initial seed file. * src/testsuite/seed-test: New file, testing lsh-make-seed. 2001-11-06 Niels Möller * configure.in: Bumped version to 1.3.6. 2001-11-02 Niels Möller * src/server_session.c (do_eof): Use close_fd_write instead of close_fd_nicely. 2001-10-30 Niels Möller * src/client_session.c (make_client_session_channel): Added fixme-comment. 2001-10-30 Niels Möller * src/channel_forward.c (do_channel_forward_eof): Don't call shutdown(), use close_fd_write instead. * src/io.c (do_write_callback): Use close_fd_write if buffer is closed and becomes empty. (close_fd_write): New function. * src/rsa.c: Comment fixes. 2001-10-29 Niels Möller * src/testsuite/Makefile.am (TS_MORE_SH): Added lshg-1-test. * src/server_session.c (do_eof): Signal EOF on the process' stdin. 2001-10-26 Niels Möller * src/sftp/sftp-server.c (sftp_process_read): Use the same type for done as for length, UINT32. * src/xauth.c (xauth_lookup): Bugfix for ipv6 addresses. 2001-10-25 Niels Möller * src/sftp/buffer.c (READ_UINT64): Use off_t instead of UINT64, which isn't defined. 2001-10-24 Niels Möller * src/read_packet.c (do_read_packet): If we get EOF on a packet boundary, raise EXC_FINISH_READ, not EXC_PROTOCOL. * src/connection.c (do_exc_connection_handler): Added a comment for the EXC_FINISH_READ case. * configure.in (BASH): Unset BASH if it has the value "/bin/sh". 2001-10-23 Niels Möller * src/testsuite/lshg-1-test: New test program. * src/client.c (make_subsystem_request): New function, contributed by Pontus Sköld. (client_options): New option --subsystem. (client_subsystem_session): New function. (client_command_session): Don't ask for a pty by default. (client_maybe_pty): New argument default_pty. (client_argp_parser): Handle subsystem option. 2001-10-22 Niels Möller * Makefile.am.in (MAINTAINERCLEANFILES): Don't use += for assigning this variable. * src/Makefile.am.in (MAINTAINERCLEANFILES): Likewise. 2001-10-15 Niels Möller Released lsh-1.3.5. * src/testsuite/cast128-test.m4: New cast-128 cbc testcase. * src/crypto.c (crypto_cast128_cbc_algorithm): New algorithm, replacing the code in cast.c. (crypto_serpent256_cbc_algorithm): New algorithm, replacing the code in serpent.c * src/serpent.c, src/cast.c, src/blowfish.c, src/cbc.c, src/cascade.c: Deleted files. * src/abstract_crypto.c (crypto_invert): Deleted function. (gcd): Deleted function. (lcm): Deleted function. * src/crypto.c (crypto_serpent256_cbc_algorithm): New algorithm, replacing code in serpent.c. * src/testsuite/blowfish-test.m4: New testcase for blowfish-128 cbc. * src/crypto.c (crypto_blowfish_cbc_algorithm): New algorithm, replacing the code in blowfish.c. * src/Makefile.am.in (liblsh_a_SOURCES): Deleted blowfish.c. * src/testsuite/twofish-test.m4: Updated test case to test twofish_cbc. * src/testsuite/des-test.m4: Updated test case to test des3_cbc. * src/idea.c: Deleted file. * src/des.c, src/twofish.c: Deleted files, replaced by code in crypto.c. * src/crypto.c (crypto_twofish256_cbc_algorithm): New algorithm, replacing the code in twofish.c. (make_des3_cbc_instance): Initialize the iv properly. 2001-10-14 Niels Möller * src/crypto.c (crypto_aes256_cbc_algorithm): Renamed, was aes256_cbc_algorithm. (crypto_des3_cbc_algorithm): New algorithm, to replace the code in des.c. Doesn't quite work yet. * src/algorithms.c (all_symmetric_algorithms): Use crypto_des3_cbc_algorithm. * src/Makefile.am.in (liblsh_a_SOURCES): Deleted des.c. 2001-10-05 Niels Möller * src/arcfour.c, src/rijndael.c: Deleted files. Code moved to crypto.c. * src/testsuite/aes-test.m4: New testcase; NIST:s testcases for aes256-cbc. * src/testsuite/macros.m4 (TS_TEST_CRYPTO): Added optional 6:th argument for iv. * src/testsuite/Makefile.am (TS_PROGS): Added aes-test. * src/crypto.h, src/crypto.c: Deleted aes128_cbc_algorithm and aes192_cbc_algorithm. 2001-10-05 Niels Möller * src/crypto.c: New file, with glue to Nettle. * src/algorithms.c (all_symmetric_algorithms): Replaced references to rijndael_algorithm with aes256_cbc_algorithm. * src/Makefile.am.in (liblsh_a_SOURCES): Added crypto.c. Deleted arcfour.c and rijndael.c. 2001-10-03 Niels Möller * src/Makefile.am.in (liblsh_a_SOURCES): Deleted sexp_commands.c and spki_commands.c. * src/sexp_commands.c, src/sexp_commands.h, src/spki_commands.c, src/spki_commands.h: Deleted obsolete files. * src/lshd.c (options2keys): New command, that uses read_host_key, and replaces options2keyfile. * src/lsh_proxy.c: Likewise. * src/server.c (read_host_key): New function replacing spki_read_hostkey. * src/spki_commands.c (make_pkcs5_decrypt): Deleted function. (do_spki_decrypt): Deleted function. (spki_password_decrypt): Deleted class. (make_spki_read_userkeys): Deleted function. (spki_read_userkeys): Deleted expression. (spki_return_userkeys): Deleted command. (spki_add_userkey_command): Deleted command. (do_spki_add_userkey): Deleted function. (spki_read_userkey_context): Deleted class. * src/spki.c (spki_sexp_to_signer): Added argument algorithm_name. (spki_pkcs5_decrypt): New function, replacing make_pkcs5_decrypt. * src/lsh.c (read_user_keys): New function, replacing do_options2identities and make_spki_read_userkeys. * src/spki_commands.c (make_spki_read_acls): Deleted function. (spki_read_acl): Deleted expression. (do_spki_add_acl): Deleted function. (spki_add_acl_command): Deleted command. (spki_command): Deleted class. (spki_signer2verifier): Deleted command. (spki_verifier2public): Deleted command. * src/resource.c (do_kill_all): Added trace message. * src/lsh.c (read_known_hosts): New function, replacing make_spki_read_acls. (do_options2known_hosts): Deleted function. * src/client.c (make_client_session): Register the channel's resource list with the gc. * src/testsuite/lsh-7-test: New test, verifying that connecting, without a proper entry in known_hosts, fails. * src/testsuite/Makefile.am (TS_MORE_PROGS): Added lsh-7-test. * src/sexp_commands.c (make_sexp_print_raw_hash): Deleted function. (sexp_print_raw_hash): Deleted command. (do_sexp_print): Deleted function. (make_sexp_print_command): Deleted function. (make_sexp_print_to): Deleted function. * src/spki.c (spki_sexp_to_signer): New function. (spki_pkcs5_encrypt): New function. * src/spki_commands.c (spki_sexp2signer_command): Deleted command, replaced with function spki_sexp_to_signer. (make_pkcs5_encrypt): Deleted, replaced with spki_pkcs5_encrypt function. * src/lsh-writekey.c: Rewrote to use io_read_file_raw and write_raw, without using any commands or io_run. * src/lsh-decode-key.c: Likewise. 2001-10-03 Niels Möller * src/lsh-export-key.c: No longer needs to include sexp_commands.h. * src/server_keyexchange.c (server_srp_read_verifier): Renamed class (was srp_init_continuation) and changed super class to abstract_write. (do_server_srp_read_verifier): Work with new USER_READ_FILE conventions. (do_handle_srp_init): Likewise. * src/lsh.h: Forward declare abstract_write. * src/unix_user.c (exc_read_user_file_handler): New class. (do_read_file): Updated for new USER_READ_FILE conventions. * src/userauth.h (lsh_user): Changed the arguments to USER_READ_FILE, now takes an abstract_write that will receive the file contents, not command_continuation. 2001-10-02 Niels Möller * src/spki.c (spki_hash_sexp): New function. * src/spki_commands.c (make_spki_hash): Deleted function. (spki_hash): Deleted class. (spki_hash_md5): Deleted command. (spki_hash_sha1): Deleted command. * src/lsh-decode-key.c (do_decode_key): Free CONTENTS properly. 2001-10-02 Niels Möller * src/lsh-export-key.c (main): Rewrote to use io_read_file_raw and write_raw, without using any commands or io_run. * src/sexp-conv.c (main): Likewise. * src/io.c (io_read_file_raw): New function, for reading an entire file into a string. Uses string_buffer. * src/gc.c (gc_final): Check that root_set is non-null before calling KILL_RESOURCE_LIST. 2001-09-30 Niels Möller * src/io.c (do_write_prepare): Deleted function. (do_consuming_read): Deleted old code to deal with fd->hanged_up. (do_write_callback): Call write_buffer_pre_write instead of FD_PREPARE. * src/io.h (FD_PREPARE): Deleted method. 2001-09-28 Niels Möller * src/server_session.c (do_eof): Use close_fd_nicely instead of write_buffer_close. * src/sexp_test.c (do_close): Likewise. * src/io.c (do_write_close): Deleted function. (close_fd): Set the flag write_buffer->closed directly, instead of calling FD_WRITE_CLOSE. (close_fd_nicely): Don't use FD_WRITE_CLOSE, instead, set the write_buffer->closed flag, and close the fd if the write_buffer is empty. * src/io.h (FD_WRITE_CLOSE): Deleted method. * src/write_buffer.c (write_buffer_close): Deleted. The closed flag is now set by close_fd and close_fd_nicely. Everybody else should be using those functions. * src/tcpforward_commands.c (install_forwarded_tcpip_handler): Static command deleted, not used anywhere. 2001-09-28 Niels Möller * src/tty.c (tty_setwinsize): Rows and columns were mixed up. Fixed. * src/server_session.c (make_pty): Reorganized to be more readable. (spawn_process): DEleted local variable uses_pty. Instead NULL session->pty if no pty is in use. (do_window_change_request): Use the fd connected to the process' stdin for manipulating the pty. (do_alloc_pty): Check that we haven't started a process already. 2001-09-27 Niels Möller * src/server_session.h (window_change_request_handler): Declare object. * src/lshd.c (main): Install window_change_request_handler for session channels. * src/tcpforward_commands.c: Made some more objects static. * src/spki_commands.c (spki_parse_key): Deleted class. (spki_sexp2signer_command): Define using DEFINE_COMMAND2. (spki_sexp2keypair_command): Likewise. * src/sexp.c: Use const struct sexp * in more places. * src/resource.c (dont_free_live_resource): Check that resource is dead. Don't look at gc_final_p. * src/lsh-export-key.c (do_ssh2_print_command): Updated for new sexp_check_type prototype. * src/spki.c: Likewise. * src/srp_exchange.c (make_srp_entry): Likewise. 2001-09-27 Niels Möller * src/resource.c (make_resource_list): Renamed functions, was empty_resource_list. Updated all callers. (dont_free_live_resource): #if:ed out check of gc_final_p. * src/io_commands.c: Deleted old function do_io_read_file. * src/io.c: Deleted old backend code. (io_run): Check for OOP_ERROR. #if:ed out for now, as it is not defined in liboop-0.7. * src/client.c (accept_service_handler): Deleted exception_handler attribute. (do_accept_service): Use the connection's exception handler for raising protocol error. (make_accept_service_handler): Deleted exception_handler argument. * src/channel.c (send_channel_request_responses): Deleted connection argument. (make_channel_request_response): Likewise. (channel_request_exception_handler): Deleted connection attribute. (make_channel_request_exception_handler): Deleted connection argument. 2001-09-26 Niels Möller * src/server_session.c (shell_request_handler, exec_request_handler): Defined as static objects using DEFINE_CHANNEL_REQUEST. Updated users. * src/io_commands.c (connect_simple_comand, connect_connection_command): New static commands, replacing make_simple_connect and make_connect_connection. Updated users. * src/client_x11.c (channel_open_x11): Define as a static object using DEFINE_CHANNEL_OPEN. Updated users. * src/channel.h (DEFINE_CHANNEL_OPEN): New macro. (DEFINE_CHANNEL_REQUEST): New macro. * src/zlib.c (zlib_deflate): Bugfix: Call deflateEnd, not inflateEnd, when deleting a deflate object. FIX copied from 1.2 branch. * src/sftp/xmalloc.c: Include string.h. 2001-09-25 Niels Möller * src/gc.c (gc_register): Set gc_scheduled flag before creating the gc callout. * src/io.c (lsh_oop_time_callback): New function. (lsh_oop_register_callout): New function. (lsh_oop_cancel_callout): New function. (do_kill_callout): New function. (io_callout): Deleted delay argument, as delays are not currently implemented. * src/lsh-writekey.c (lsh_writekey_options2private_file): Dup string before passing it to make_io_write_file_info. (lsh_writekey_options2public_file): Updated call to make_io_write_file_info. * src/sexp.c (do_format_sexp_vector): Fixed string leak in pretty-printing code. * src/io_commands.c (make_io_write_file_info): Changed type of the NAME argument. Now a struct lsh_string *. * src/io.c (io_final): Call gc_final. That makes sure that all callbacks are cancelled. Updated callers to not use gc_final, only io_final. * src/gc.c (gc_final): Always define gc_fianl, and kill the resources in the root set. Deallocation and checks for leaks is still done only when DEBUG_ALLOC is defined. 2001-09-24 Niels Möller * src/xalloc.c (lsh_object_check): Better message on type error. (lsh_object_check_subtype): Likewise. * src/lsh-writekey.c (make_writekey): Chenged order of options and stdin arguments. Delay call of read_sexp. * src/command.c (gaba_apply): Assert that a value has been returned. 2001-09-24 Niels Möller * src/scm/gaba.scm (process-expr): Handle empty parameter list. * src/io.c: Deleted class io_backend. Register signal handlers and files with gc_global() instead. Deleted all references to io_backend in the rest of the source files. Doesn't quite work yet. * src/gc.c (gc_global): New function. (root_set): New global variable. * Liboop code (without gc) seems to work now. Tagging as MILESTONE_LIBOOP_20010924. * src/write_buffer.c (write_buffer_close): Call close_fd if buffer is empty. * src/unix_interact.c (window_subscriber): Added attribute interact, which points to the corresponding unix_interact. (do_kill_window_subscriber): New function, which updates the number of subscribers and removes the SIGWINCH handler if there are no subscribers left. (unix_interact): Added attributes backend, winch_handler and nsubscribers. (unix_window_change_subscribe): Keep track of number of subscribers, and install the signal handler if it is needed. (make_unix_interact): Don't install any signal handler yet. * src/lshd.c (main): Changed the behaviour of the --no-syslog option. Now --daemon --no-syslog puts the process into the background without the rest of the daemonic setup. These option names should be changed to something more correct, but it is used only be the testsuite. * src/io.c (lsh_oop_signal_callback): Better trace message. (lsh_oop_signal_callback): Return OOP_CONTINUE. (lsh_oop_fd_read_callback): Return OOP_CONTINUE. (lsh_oop_register_read_fd): Check want_read, so we don't try to register the callback twice. (lsh_oop_fd_write_callback): Fixed assertion. (lsh_oop_fd_write_callback): Return OOP_CONTINUE. (lsh_oop_register_write_fd): Check want_write, so we don't try to register the callback twice. (io_run): Print a trace message if/when oop_sys_run returns. (do_connect_callback): Improved trace messages. (io_connect): Initialize fd->write before calling lsh_oop_register_write_fd. (io_listen): Initialize fd->read before calling lsh_oop_register_read_fd. (close_fd): Call lsh_oop_cancel_read_fd and lsh_oop_cancel_write_fd before clearing the alive flag. 2001-09-23 Niels Möller * src/io.c: Added trace messages to liboop-related functions. * src/write_buffer.c: Include io.h. 2001-09-21 Niels Möller * configure.in: Check for liboop. * src/io.c (make_io_backend): Call new function io_init(). (lsh_oop_register_read_fd): Updated the want_read flag. Changed most functions to call this function instead of updating the flag directly. (lsh_oop_cancel_read_fd): Likewise. (lsh_oop_register_write_fd): Analogous changes for the want_write flag. (lsh_oop_cancel_write_fd): Likewise. (do_exc_finish_read_handler): Use lsh_oop_register_read_fd and lsh_oop_cancel_read_fd. * src/write_buffer.c (make_write_buffer): Added fd argument. (do_write): Call lsh_oop_register_write_fd when buffer gets non-empty. * src/reaper.c (make_reaper): Adapted to new io_signal_handler behaviour. * src/unix_interact.c (make_unix_interact): Likewise. * src/channel_forward.c (do_channel_forward_send_adjust): Use lsh_oop_register_read_fd. * src/client_session.c (do_send_adjust): Likewise. (do_client_io): Likewise. * src/server_session.c (do_send_adjust): Likewise. 2001-09-19 Niels Möller * src/server_keyexchange.c (do_init_server_dh): Fixed bug in the PEER_SSH_DSS_KLUDGE workaround. FIX copied from 1.2 branch. 2001-09-18 Niels Möller * src/io.c (lsh_oop_cancel_signal): New function. (do_write_callback): Call FD_PREPARE. (close_fd): Call lsh_oop_cancel_fd. (close_fd_nicely): Likewise. (close_fd_read): Likewise. 2001-09-18 Niels Möller * src/io.c (lsh_oop_glue): New class. (make_lsh_oop_glue): New function. (lsh_oop_signal_callback): New function. (lsh_oop_register_signal): New function. (lsh_oop_fd_callback): New function. (lsh_oop_register_fd): New function. 2001-09-17 Niels Möller * src/io.c: Started experimental conversion to use liboop. 2001-09-16 Niels Möller * doc/lsh.texinfo: Moved table of contents first. * src/dsa.c (do_dsa_sign): Display any unexpected algorithm atom before crashing. 2001-09-13 Niels Möller * src/io.c (address_info2sockaddr): Fixed debug invocation. FIX copied from 1.2 branch. 2001-09-12 Niels Möller * src/werror.c (werror_vformat): Don't crash if %a gets a zero argument. FIXED in 1.2 branch. 2001-09-09 Niels Möller * src/des.c (make_des_instance): Use the des_fix_parity function in nettle. 2001-09-05 Niels Möller * src/crypto.h: Deleted last traces of idea support. * src/atoms.in: Likewise. * src/algorithms.c: Likewise. * src/Makefile.am.in: Likewise. * src/testsuite/lsh-6-test: New test, exercising the various -c options. * configure.in: Bumped version to 1.3.5. 2001-09-04 Niels Möller * Released lsh-1.3.4. 2001-09-04 Niels Möller * doc/lsh.texinfo: Updated for 1.3.4. In particular, added doc on X forwarding, -x, -B, and --log-file options, and encrypted private keys. Deleted the paragraph about the obsolete --userauth option. * src/client.c (client_command_session): Ask for a pty also for (supposedly non-interactive) exec sessions. 2001-09-03 Niels Möller * src/xauth.c (xauth_process): New function, using XauReadAuth. (xauth_lookup): Use xauth_process instead of XauGetAuthByAddr. * src/client_x11.c (make_client_x11_display): Initialize the fake cookie properly. * src/xauth.h: New file with the xauth_lookup prototype. * src/xauth.c (xauth_lookup): Deleted address_length argument. Bug fixes. 2001-09-03 Niels Möller * src/xauth.c: Rewrote to use libXau. * src/client_x11.c (client_x11_auth_info): Deleted class; merged with client_x11_display. (parse_display): Take a client_x11_display as argument. Do xauth lookup. (get_client_x11_auth_info): Deleted function. * src/client.c (DEFINE_CALLBACK): Declare self argument as UNUSED. * src/Makefile.am.in (liblsh_a_SOURCES): Added xauth.c. * configure.in: Check for X, libXau and XauGetAuthByAddr. * src/client_x11.c (client_x11_channel): New fields auth_length and name_length, for recording the decoded lengths in the setup message. (X11_SETUP_MAX_LENGTH): Defined as 48, which is the size of a message with a 16 octet cookie. Updated description of the X11 connection setup message. (LE_READ_UINT16, LE_WRITE_UINT16): New macros. (do_client_channel_x11_receive): Bug fixes, seems to work now. * src/suspend.h: Declare suspend_callback as extern. Noticed by Jean-Pierre. 2001-09-03 Niels Möller * src/client_x11.c: Added comment about observed X11 packets (that seem contrary to the documentation in RFC 1013. (do_client_channel_x11_receive): Print received cookie, for debugging purposes. (make_forward_x11): Print generated fake cookie, for debugging purposes. (parse_display): Fixed ssh_format invocation creating the local socket name. (do_channel_open_x11): Fixed invocation of verbose(). (do_format_request_x11_forward): Get the connection from the channel, now that the connection pointer is available there. (do_format_request_x11_forward): Hex encode the cookie. That's ugly, but needed for compatibility. * src/client_pty.c: Dropped lsh:-prefix on messages, it's added automatically in werror.c. * src/client.c (client_maybe_x11): Write a message if DISPLAY not set or it's value doesn't make sense. 2001-09-02 Niels Möller * src/client.c (make_client_session): Added escape sequences q, v and d, for controlling the verbosity flags. (client_argp_parser): Look at used_x11 after setting up the shell session. * src/lshg.c (make_options): Pass NULL random to init_client_options. * src/client_x11.c (make_client_x11_display): Free the fake cookie if we fail. (make_forward_x11): Make up a random cookie. * src/client.c (init_client_options): New argument RANDOM. (client_maybe_x11): Pass on RANDOM to make_forward_x11. * src/client.h (client_options): Moved RANDOM attribute here, from lsh_options. 2001-09-01 Niels Möller * src/client.c: Moved -x option to lsh.c. * src/channel.c (register_channel): Deleted connection argument. * src/channel.h (ssh_channel): Replaced the write pointer with a pointer to the connection. (channel_request): Deleted connection argument. * src/channel.h (CHANNEL_REQUEST): Likewise. * src/resource.c (init_resource): Renamed from resource_init, for consistency. Updated all callers. * src/lsh.h (struct client_x11_display): Forward declare. * src/client_x11.h: Deleted, prototypes moved to client.h. * src/client.h (client_options): New attributes with_x11 and used_x11. * src/client.c (client_maybe_pty): New function. (client_maybe_x11): New function. (client_shell_session): Use client_maybe_pty and client_maybe_x11. (client_command_session): Use client_maybe_x11. (client_argp_parser): --x11-forward should be a modifier option, not an action. * src/channel.h (channel_table): Added attribute x11_display. * src/Makefile.am.in (liblsh_a_SOURCES): Added client_x11.c. 2001-08-31 Niels Möller * src/client.c (client_argp_parser): Implemented -X flag. 2001-08-30 Niels Möller * src/xauth.c: New file. * src/client_x11.c: Work in progress. (client_x11_auth_info): New class. * src/channel_forward.c (init_channel_forward): New function, extracted from make_channel_forward. 2001-08-30 Niels Möller * configure.in: Bumped version to 1.3.4. 2001-08-29 Niels Möller * Released lsh-1.3.3. 2001-08-29 Niels Möller * src/sftp/testsuite: Fixed scripts to work outside of $srcdir. * src/sftp/buffer.c, src/sftp/client.c: Include string.h. * src/algorithms.c (all_symmetric_algorithms): Use aes256-cbc as an alias for rijndael. (lookup_crypto): Recognize aes256-cbc, aes-cbc and aes. 2001-08-23 Niels Möller * src/connection.c (do_exc_connection_handler): Display exception message. Suggested by Jonas Bofjäll. XXX: Fix in 1.2 branch. 2001-08-28 Niels Möller * src/sftp/testsuite/run-tests: Use srcdir when starting scripts. * src/Makefile.am.in (liblsh_a_SOURCES): Added channel_forward.c. * src/channel_forward.h: Renamed the tcpip_channel to channel_forward, and moved it to a separate file. It's not really tcpip-forwarding specific, and can be reused for x11-forwarding. * src/lsh_types.h (READ_UINT16): Fixed shift count. XXX: Fix in 1.2 branch. * src/parse.c (parse_uint16): New function. (parse_string16): New function. 2001-08-27 Niels Möller * src/sftp/testsuite/Makefile.am (EXTRA_DIST): Use EXTRA_DIST, not DISTFILES. cd to $srcdir when running the tests. * src/sftp/Makefile.am (EXTRA_DIST): Include header files in the dist. * buffer.c, buffer.h, client.c, client.h: Added copyright notices. * src/sftp/testsuite/Makefile.am: New file. * src/sftp/sftp-server.c (struct sftp_file): New struct with fd and position. (enum struct sftp_handle_type): Renamed constants to HANDLE_TYPE_FILE and HANDLE_TYPE_DIRECTORY. (handle_t): Deleted typedef. (HANDLE_FILE): New macro replacing HANDLE_FD. (sftp_read): New function. Keep track of position, and use seek/pread only when appropriate. (sftp_write): Likewise. * src/sftp/configure.in (AC_OUTPUT): Generate testsuite/Makefile. * src/sftp/client.c: Minor fixes; deleted unused variables, static declared functions. * src/sftp/Makefile.am (SUBDIRS): Added testsuite. * src/Makefile.am.in (SUBDIRS): Added sftp. * misc/bootstrap.sh: Bootstrap the src/sftp subdirectory. * configure.in: Configure the src/sftp subdirectory. 2001-08-26 Niels Möller * src/testsuite/export-1-test: Don't use $srcdir for finding lsh-export-key. * src/zlib.c (do_zlib): Don't print any message if Z_BUF_ERROR happens with avail_in = 0. * src/lshd.c (main_options): New experimental option --subsystems. (parse_subsystem_list): New function. (main_argp_parser): Handle --subsystems. (main): Install a subsystems handler, if appropriate. * src/server_session.c (shell_request): Deleted unused reaper attribute. (lookup_subsystem): New function. (do_spawn_subsystem): New function. (make_subsystem_handler): New function. 2001-08-21 Niels Möller * src/client_userauth.c (make_client_publickey_auth): Initialize TYPE attribute properly. * src/server_userauth.c (server_userauth_none): New authentication method. * src/lshd.c (main_argp_parser): Install a handler for the "none" authentication method. (main): Always require user authentication (used to allow clients to start the ssh-connection service directly, under the same restrictions as for "none" authentication). * src/lsh.c (main_options): Deleted options --userauth and --no-userauth. (lsh_login_command): Try the "none" authentication method. * src/handshake.c (handshake_command): Use CAST_SUBTYPE. * src/connection_commands.c (connection_if_srp): Deleted command. * src/command.c (do_command_4): Use CAST_SUBTYPE, in case command_4 is inherited. (do_command_3): Use CAST_SUBTYPE, in case command_3 is inherited. (do_command_2): Use CAST_SUBTYPE, command_2 is inherited by sexp_print_command. * src/client_userauth.c (format_userauth_none): New function. (make_client_none_auth): New function. 2001-08-12 Niels Möller * src/client.c (do_exit): New callback function. (make_client_session): Bind the sequence . to exit. (client_options): New action option -B, --background. (background_process): New command. (client_argp_parser): Implement -B. * src/lshg.c (main_argp_parser): Check that make_gateway_address doesn't return NULL. XXX: Fix in 1.2 branch. (options2info): Use self->gateway. XXX: Fix in 1.2 branch. 2001-07-30 Niels Möller * src/testsuite/export-1-test: Fixed invocation of compare_output. 2001-07-06 Niels Möller * src/io_commands.c (io_write_file_command): Bugfix. * src/command.h (command_simple): Deleted class. (STATIC_COMMAND_SIMPLE): Deleted macro. (DEFINE_COMMAND_SIMPLE): Deleted macro. (catch_command): Inherit command, not command_simple. * src/command.c (do_call_simple_command): Deleted. (catch_collect_body): Inherit command, not command_simple. * src/sexp_commands.h (sexp_print_command): Inherit command_2. * src/lsh_proxy.c (proxy_destination): Use DEFINE_COMMAND2. * src/lsh-writekey.c: Don't use DEFINE_COMMAND_SIMPLE. * src/lsh.c: Likewise. * src/lshd.c: Likewise. * src/lshg.c: Likewise. * src/proxy.c: Likewise. * src/spki_commands.c: Likewise. * src/keyexchange.c (kexinit_filter): Redefined using DEFINE_COMMAND2. * src/io_commands.c (io_write_file_command): Use DEFINE_COMMAND. (connect_local_command): Likewise. (io_log_peer_command): Likewise. * src/gateway_commands.c (gateway_setup_command): Use DEFINE_COMMAND. (gateway_accept): Use DEFINE_COMMAND2. * src/lsh-writekey.c: Don't use command_simple. * src/connection_commands.c (connection_remember): Redefined using DEFINE_COMMAND2. * src/channel.c (connection_service_command): Use DEFINE_COMMAND, not DEFINE_COMMAND_SIMPLE. * src/client.c (client_options2remote): Likewise. (client_options2actions) Likewise. 2001-07-05 Niels Möller * src/testsuite/Makefile.am (TS_SH): Added export-1-test. * src/lsh-export-key.c (ssh2_print_command): Inherit command_2. Don't use command_simple. 2001-07-04 Niels Möller * src/command.c (collect_state_1): Deleted class. (collect_state_1): Deleted class. (collect_state_2): Deleted class. (collect_state_3): Deleted class. (make_collect_state_1): Deleted function. (make_collect_state_2): Deleted function. * src/command.h (command_2): Made invoke a method, not a function pointer. Updated users. (COMMAND_2_INVOKE): New macro. (collect_info_3): Deleted class. (collect_info_2): Deleted class. (collect_info_1): Deleted class. (STATIC_COLLECT_1): Deleted macro. (STATIC_COLLECT_2): Deleted macro. (STATIC_COLLECT_2_FINAL): Deleted macro. (STATIC_COLLECT_3_FINAL): Deleted macro. * src/channel_commands.h (install_info): Inherit command_2, instead of collect_info_2. * src/testsuite/functions.sh (spawn_lshd): Pass --no-syslog to lshd, not --log-file. * src/tcpforward_commands.c (open_forwarded_tcpip): Redefined using DEFINE_COMMAND2. (open_direct_tcpip): Likewise. (remote_listen_command): Likewise. (make_request_tcpip_forward_command): Deleted function. Moved code to remote_listen_command. (make_direct_tcpip_handler): Redefined using DEFINE_COMMAND. (make_tcpip_forward_handler): Likewise. * src/sexp_commands.c (sexp_print_raw_hash): Redefined using DEFINE_COMMAND3. * src/proxy.c (chain_connections): Redefined using DEFINE_COMMAND3. * src/command.c (do_trace_continuation): Use trace(... %t ...). * src/werror.c (logfile_flag): Deleted global variable. (werror_vformat): Added %t, for printing the object type. * src/lshd.c: New option --no-syslog. * src/io_commands.c (listen_with_callback): Redefined using DEFINE_COMMAND3. * src/handshake.c (handshake_command): Redefined using DEFINE_COMMAND4. * src/connection_commands.c (connection_if_srp): Redefined using DEFINE_COMMAND3. (make_connection_if_srp): Use make_command_3_invoke_2. * src/combinators.c (command_Cp): Bugfix, changed argument order. 2001-07-03 Niels Möller * src/testsuite/runtests (srcdir): By default, use `pwd`, not ".". * src/testsuite/functions.sh: Don't set srcdir here. (spawn_lshd): Send messages to lshd.log. * src/werror.c (logfile_flag): New global variable. (syslog_flag): Deleted. (werror_argp_parser): Set logfile_flag of a log file option is encountered. * src/lshd.c (main): Don't use syslog if the user provided an explicit log-file option. * src/combinators.c (command_C): Redefined using DEFINE_COMMAND3. (command_Cp): Redefined using DEFINE_COMMAND4, but disabled the new version as it doesn't quite work. * src/testsuite/macros.m4: Include string.h. * src/combinators.c (command_Sp): Redefined using DEFINE_COMMAND4. (command_B): Redefined using DEFINE_COMMAND3. (command_Bp): Redefined using DEFINE_COMMAND4. * src/command.c (command_4_invoke_3): New class. (make_command_4_invoke_3): New function. (command_4_invoke_2): New class. (make_command_4_invoke_2): New function. (command_4_invoke): New class. (make_command_4_invoke): New function. * src/command.h (command_4): New class. (DEFINE_COMMAND4): New macro. * src/gateway_commands.c: Include string.h. * configure.in: Bumped version to 1.3.3. 2001-07-02 Niels Möller * src/combinators.c (command_I): Redefined using DEFINE_COMMAND. Updated users as the type was changed in the process. (command_K): Redefined using DEFINE_COMMAND2. (command_S): Redefined using DEFINE_COMMAND3. * src/command.c: New class. (make_command_2_invoke): New function. (command_3_invoke_2): New class. (make_command_3_invoke_2): New function. (command_3_invoke): New class. (make_command_3_invoke): New function. (progn_command): Use DEFINE_COMMAND isntead of DEFINE_COMMAND_SIMPLE. * src/command.h: Started replacing command_simple and the collect_info_n classes with simpler schemes. (command_2): New class. (DEFINE_COMMAND2): New macro. (command_3): New class. (DEFINE_COMMAND3): New macro. * src/connection_commands.c (connection_require_userauth): Changed invocation of DEFINE_COMMAND. * src/gateway_commands.c (gateway_init): Likewise. * src/command.h (DEFINE_COMMAND): Changed macro to not take the function arguments as arguments. * src/command.c (gaba_apply): Rewrote to not use COMMAND_SIMPLE_CALL. (do_command_unimplemented): Deleted function. 2001-06-27 Niels Möller * acinclude.m4: Added template for socklen_t definition. * acconfig.h: Deleted definitions, use AH_TEMPLATE in configure.in instead. Can this file be removed completely now? * configure.in: Added AH_TEMPLATE calls. Deleted test for offsetof. * src/client_escape.c (newlinep): New function. Treat NL and CR equivalently. (scan_escape): Simplified. Also doesn't use memchr anymore. * src/io.c (io_listen_local): Use plain offsetof. (io_connect_local): Likewise. * src/lsh_types.h (OFFSET_OF): Deleted definition, simply trust stddef.h. * src/server_userauth.c (do_exc_userauth_handler): Let the connection's exception handler deal with EXC_PROTOCOL (fixed somewhat differently in the 1.2.x branch). 2001-06-26 Niels Möller * configure.in: Deleted IDEA support. * src/process_atoms (atom2define): Changed invocation of tr to be compatible with the Solaris 8 tr. 2001-06-26 Niels Möller * src/client_escape.c (NEWLINE): New macro. (do_escape_handler): Reset state to GOT_NONE appropriately. * src/client.c (client_argp_parser): Added empty statement after label. (make_client_session): Bind ^Z to suspend. 2001-06-24 Niels Möller * src/xalloc.h (CHECK_TYPE) [DEBUG_ALLOC]: Added parentheses. * src/xalloc.h (CHECK_SUBTYPE) [DEBUG_ALLOC]: Likewise. * src/werror.c (werror_vformat): Implemented the 'p' (paranoia) modifier for %c. * src/client_escape.c (escape_dispatch): Use %pc with werror. * src/client.c (make_client_session): Check if stdin is a tty, when deciding on the default for escape char handling. 2001-06-20 Niels Möller * src/client_escape.c (do_escape_handler): Fixed the EOF case. 2001-06-19 Niels Möller * src/client_session.c (client_read_stdin): New function, for installing the escape-char handler on stdin. (do_client_io): Use client_read_stdin. (make_client_session_channel): Added argument escape. * src/client_escape.c: Moved suspend-related code to suspend.c. * src/client.c (client_escape_info): New function. (client_options): New option ---escape-char or 'e'. (make_client_session): Seet up escape char info. (client_argp_parser): Handle escape-char option. Call suspend_install_handler. * src/Makefile.am.in (liblsh_a_SOURCES): Added suspend.c. * src/unix_interact.c: Moved suspend-related code to suspend.c. * src/suspend.c, src/suspend.h: New files. * configure.in: Bumped version to 1.3.2. 2001-06-17 Niels Möller * src/rsync/rsync.h: Include , not . * src/channel.c (alloc_channel): Initialize new channel-entries to NULL. * src/cast.c: Adapted to nettle. * Makefile.am.in (DOTDISTS): Deleted references to the symmetric subdirectory. (MAKEFILESAM): Likewise. * configure.in (AC_CONFIG_FILES): Likewise. * doc/HACKING (ROAD MAP): Updated to mention nettle. * doc/lsh.texinfo: Added @dircategory and @direntry. * src/twofish.c: Adapted to nettle. 2001-06-15 Niels Möller * src/blowfish.c: nettle updates. * src/serpent.c: Likewise. * configure.in: Configure in the src/nettle sub directory. * misc/bootstrap.sh: Invoke the nettle .bootstrap script. 2001-06-13 Niels Möller * misc/bootstrap.sh: Bootstrap the nettle subdirectory. * src/rsync/: Updated to libnettle conventions. * configure.in (CPPFLAGS): Add -LSH and -I$srcdir/src, needed by src/rsync/. 2001-06-12 Niels Möller * src/dsa.c, src/dsa_keygen.c, src/md5.c, src/rijndael.c, src/sha.c: Adapted to the nettle API. * configure.in: Use src/nettle instead of src/symmetric. * src/Makefile.am.in: Likewise. * src/testsuite/Makefile.am: Likewise. 2001-06-09 Niels Möller * src/io.c (do_consuming_read): In the EOF case, call close_fd_read after A_WRITE. 2001-06-07 Niels Möller * src/io.c (do_kill_io_backend): Let close_fd do it's work. 2001-06-06 Niels Möller * src/io.c (close_fd): Really close the fd, and invoke any close callback. (io_iter): Simplified handling of closed files. Simply unlink them, close_fd has to do the rest of the work. 2001-05-29 Niels Möller * acinclude.m4: AC_CHECK_MEMBER: Deleted definition (a similar macro is included in autoconf-2.50). AC_CHECK_VAR: Deleted. (AC_CHECK_KRB_LIB): Don't use changequote. * configure.in: Set SRP_PROGRAM. Require autoconf-2.50. Use the new AC_CHECK_MEMBERS macro. * src/unix_user.c: Update for autoconf-2.50, changed HAVE_UT_NAME to HAVE_STRUCT_UTMP_NAME, and similarly for other defines. 2001-05-23 Niels Möller * configure.in: Some cleanup, and update for autoconf-2.50. Some more work needed. 2001-05-17 Niels Möller * configure.in: Set SRP_PROGRAM. * src/Makefile.am.in (EXTRA_PROGRAMS): Added srp-gen. (bin_PROGRAMS): Use SRP_PROGRAM, don't compile srp-gen if SRP-support is disabled. * src/testsuite/write-key-2-test: Fixed test; check for output files in the testhome directory. * src/unix_user.c: Fixed dummy definition of struct utmp (spotted by Tomi Ollila). 2001-05-16 Niels Möller * configure.in: Bumped version to 1.3.1. * Released 1.3.0. 2001-05-15 Niels Möller * src/scm/gaba.scm: Some more cleanup. * src/lshd.c (do_exc_lshd_handler): Handle EXC_RESOLVE. FIXED in 1.2 branch (2001-09-13). * src/testsuite/functions.sh (spawn_lshd): Use 127.0.0.1 instead of localhost. FIXED in 1.2 branch (2001-09-13). * src/scm/gaba.scm (append-deep): Deleted. (type->category): Deleted. (type->declaration): Deleted. (type->mark): Deleted. (type->free): Deleted. (fix-method): Deleted. (do-instance-struct): Deleted. (do-struct): Deleted. (do-mark-function): Deleted. (do-free-function): Deleted. (do-struct-mark-function): Deleted. (do-struct-free-function): Deleted. (do-class): Deleted. 2001-05-15 Niels Möller * src/scm/gaba.scm: Rewrote the functions for generating C code. 2001-05-15 Niels Möller * configure.in: Updated version number to 1.3.0. 2001-05-14 Niels Möller * src/gc.c (gc) [!DEBUG_ALLOC]: Don't use number_of_strings. 2001-05-11 Niels Möller * src/testsuite/functions.sh (PIDFILE): New variable, with absolute path to the pid-file. FIXED in 1.2 branch. (spawn_lshd): $PIDFILE. FIXED in 1.2 branch. 2001-05-03 Niels Möller * src/lshd.c (main): Start the background randomness poll *after* forking into the background. FIXED in 1.2 branch. * src/testsuite/functions.sh (spawn_lshd): Use --daemon flag. 2001-05-02 Niels Möller * sexp_streamed_parser.c: Deleted file. * src/unix_user.c (format_env_pair): Return const char *. (format_env_pair_c): Likewise. (do_exec_shell): Use const char ** for argv and envp. * src/xalloc.c (lsh_free): Cast to void * before calling free, as free doesn't accept const void *. (lsh_string_free): Changed argument type to const struct lsh_string *. (lsh_space_free): Bug-fix. (lsh_space_alloc): Use lsh_malloc, not xalloc directly. (lsh_space_free): Changed argument type to const void *. * src/userauth.h (lsh_user): Use const char ** for argv. 2001-05-01 Niels Möller * src/unix_interact.c (unix_read_password): Use const prompt string. (unix_yes_or_no): Likewise. * src/srp_exchange.c (make_srp_entry): Use const struct lsh_string for the salt. * src/spki_commands.c (do_spki_decrypt): Use const struct lsh_string. * src/spki.c (subject_match_hash): Use const struct lsh_string. (do_spki_tag_prefix_match): Likewise. (spki_subject_by_hash): Likewise. (do_spki_lookup): Likewise. * src/sexp_parser.c (skip_space): New function, skipping whitespace and comments. (sexp_parse_transport): Allow whitespace and comments. * src/sexp_commands.c: Don't use the streamed sexp parser. (sexp_parser): New class. (do_sexp_parse_once): New function. (do_sexp_parse_many): New function. (do_read_sexp_continue): Deleted function. (make_read_sexp_continuation): Deleted function. (read_sexp_exception_handler): Deleted class. (do_read_sexp_exception_handler): Deleted function. (make_read_sexp_exception_handler): Deleted function. (make_sexp_parser): New function. (make_read_sexp_command): New argument MAX_SIZE. * src/sexp.c: Constification, use const struct lsh_string for all sexp-related strings. 2001-04-26 Niels Möller * src/scm/gaba.scm: Added const type modifier. * src/sexp-conv.c (MAX_SEXP_SIZE): New constant, used with make_read_sexp_command. * src/server_session.c (do_spawn_exec): Use const char * for argv entries. * src/server_keyexchange.c (MAX_SRP_SIZE): New constant, used with make_read_sexp_command. * src/lsh-writekey.c (MAX_SEXP_SIZE): New constant. Used with STATIC_READ_SEXP. * src/lsh-export-key.c (MAX_KEY_SIZE): New constant. Use with make_read_sexp_command. * src/io.c (do_buffered_read): Call close_fd_read on error. This way, the user doensn't have to use an exception handler just for closing the file. * src/interact.h (interact): Use const for prompt arguments. * src/format.c (lsh_get_cstring): Use const for input and output. * src/pkcs5.c (pkcs5_derive_key): Declare password and salt input as const. * src/abstract_crypto.c (crypt_string): Declare the input string const. Nevertheless, reuse it for output in case FREE is true. (crypt_string_pad): Declare input string const. (crypt_string_unpad): Likewise. * src/Makefile.am.in (liblsh_a_SOURCES): Deleted sexp_streamed_parser.c. 2001-04-25 Niels Möller * src/keyexchange.c (do_handle_newkeys): Added verbose message when receiving NEWKEYS. (do_handle_kexinit): Added verbose message when receiving KEXINIT message. * src/parse.c (parse_next_atom): Tolerate empty atoms, for compatibility with "SSH-1.99-2.0.13 (non-commercial)". XXX Fix in 1.2 branch? 2001-04-17 Niels Möller * src/testsuite/Makefile.am (TS_MORE_SH): Added tests lshg-cat-test, lshg-cat-2-test and ssh1-fallback-test. * src/testsuite/functions.sh: Renamed SERVERFLAGS to LSHD_FLAGS, CLIENTFLAGS to LSH_FLAGS, and added LSHG_FLAGS. * src/testsuite/lshg-cat-2-test: New test. * src/testsuite/lshg-cat-test: Sleep some, waiting for lsh to connect. * src/sftp/.bootstrap: Don't run ./configure. * src/werror.c (werror_argp_parser): Initialize program_name at ARGP_KEY_INIT time. * src/resource.c (dont_free_live_resource): Be more quiet during gc_final. * src/lshg.c (do_exc_lshg_handler): Fixed werror format string. Fixed in 1.2 branch. * src/lsh.c (do_lsh_lookup): If the user decides to trust the key, add it to the spki_context. * src/lcp: Replaced the bashism "==" with "=". * src/gc.c (gc_final_p): New variable, non-zero during gc_final(). * src/client_session.c (make_client_session_channel): Register stdio files as resources. 2001-04-12 Niels Möller * src/lshd.c (main_argp_parser): Bugfix: Use the supplied interface! Fixed in 1.2 branch. * src/testsuite/ssh1-fallback-test: New test. * src/testsuite/lshg-cat-test: New test. * src/testsuite/fake-sshd1: New file. * src/testsuite/functions.sh (spawn_lshd): Pass arguments to lshd. Fixed in 1.2 branch. (exec_lshg): New function. * src/ssh1_fallback.c (fall_back_to_ssh1): Reset the fd to blocking mode. Fixed in 1.2 branch. * src/io.c (io_set_blocking): New function. Added in 1.2 branch. (do_exc_finish_read_handler): Close fd immediately on EXC_FINISH_IO. Fixed in 1.2 branch. 2001-04-11 Niels Möller * src/userauth.h (lsh_process): New class. (lsh_user): The fork_method now returns the child as an lsh_process. * src/unix_user.c (process_resource): Inherit lsh_process. (do_signal_process): New function. * src/unix_interact.c (install_suspend_handler): New function. (stop_handler): New signal handler for TSTP, that sets and resets the tty modes. * src/tty.c (tty_getwinsize): Take a struct terminal_dimensions * as argument. (tty_setwinsize): Likewise. * src/server_session.c (server_session): Changed type of process attribute to lsh_process. Updated uses. (do_alloc_pty): Check request syntax in all cases, even if there's no pty. (do_window_change_request): New function. * src/interact.h (struct terminal_dimensions): Moved definition... * src/tty.h (struct terminal_dimensions): ...to here. * src/client_pty.c: Include tty.h. * src/client.h (escape_info): New class. * src/Makefile.am.in (liblsh_a_SOURCES): Added client_escape.c. * src/client_escape.c: New file. 2001-04-10 Niels Möller * src/client.c (make_client_session): Use set_error_nonblocking. 2001-04-09 Niels Möller * src/werror.c (set_error_nonblocking): New function. (set_error_stream): Deleted WITH_POLL argument. (werror_options): Aded option --log-file. (werror_argp_parser): Process --log-file option. * ANNOUNCE: Changed "COPYRIGHT" to "LICENSE", by rms' request. Fixed in 1.2 branch. 2001-04-08 Niels Möller * src/lsh.c (main_argp_parser): Deleted old -L handling (moved to client.c). * src/sexp_commands.c (do_print_raw_hash_simple): Deleted unused function. * src/sexp.c (sexp_sn): Deleted unused function. * src/io.c (make_listen_callback_no_peer): Deleted unused function. * src/gc.c (gc): Display number of strings. * src/client_session.c (do_client_session_eof): Deleted old code that closed stdin here. * src/client.c (do_exit_status): Deleted old code sending CHANNEL_EOF here. (do_exit_signal): Likewise. (do_exit_signal): Signals in the exit-signal message are no longer encoded as integers. XXX Fix in 1.2 branch? * src/channel.c (do_exc_finish_channel_handler): Deleted old (#if:ed out) code for raising EXC_FINISH_READ. (channel_close_handler): Deleted old code calling the channel's EOF handler here. * src/lsh.c (main): Call io_final. * src/io.h (lsh_fd): Added label attribute. * src/io.c (kill_fd): Deleted. (io_backend): Inherit resource. (do_kill_io_backend): New function. (make_io_backend): Call resource_init. (io_final): New function. (init_file): New argument LABEL. (make_lsh_fd): New rgument LABEL. Updated callers. (close_fd): Display label. (io_iter): Display label. * src/lsh-writekey.c (make_writekey): Deleted unneeded global definitions. * src/resource.c (dont_free_live_resource): Changed again, to issue a fatal error. * src/sexp_parser.h: Deleted unused file. * src/testsuite/Makefile.am (TS_PROGS): Added string-test. * src/testsuite/macros.m4 (TS_CHECK): New macro. * src/testsuite/string-test.m4: New tests for string related functions, currently only lsh_get_cstring. * src/format.c (ssh_cformat): Deleted. Replaced all uses with ssh_format. (make_cstring_l): Deleted. (make_cstring): Deleted. (lsh_get_cstring): New function. * src/werror.c (write_syslog): Don't use make_cstring_l. * src/unix_user.c (do_verify_password): Use lsh_get_cstring. (do_read_file): Likewise. (do_read_file): Likewise. (format_env_pair): Likewise. (do_exec_shell): Likewise. (make_unix_user): Likewise. (do_lookup_user): Likewise. * src/unix_interact.c (unix_read_password): Use lsh_get_cstring. * src/server_session.c (do_spawn_exec): Use lsh_get_cstring. * src/lsh.h (NUL_TERMINATED): Deleted. * src/format.h (format_cstring, make_string): Renamed function. And made it a macro. Updated callers. * src/adns.c (do_resolve): Use lsh_get_cstring. Don't use NUL_TERMINATED. * src/io.c (address_info2sockaddr): Likewise. (make_local_info): Likewise. (io_listen_local): Likewise. (io_connect_local): Likewise. 2001-04-05 Niels Möller * src/testsuite/functions.sh (run_lsh): Quote the command better. * src/xalloc.c (lsh_string_alloc): Fixes, now compiles both with and without DEBUG_ALLOC. * src/werror.c (werror_argp_parser): Added missing break. (werror): Handle the case where both verbose_flag and quiet_flag are set. * src/io.c (do_consuming_read): Free the string properly on EOF or error. XXX Fix in 1.2 branch? * src/client_userauth.c (make_client_userauth): Convert username to utf8 once, here. Updated callers. Previously, the converted strings leaked. * src/client_session.c (do_client_session_eof): Use close_fd_nicely. Otherwise we lose data. FIXED in 1.2 branch. * src/Makefile.am.in (atoms_gperf.c): Massage gperf output to reduce the number of compilation warnings. 2001-04-05 Niels Möller * src/gc.c (gc_final): Check for leaked strings, and write any clues. * src/lsh.h (struct lsh_string_header): Added more debug info. * src/xalloc.c (all_strings): New variable, for debugging. (sanity_check_string_list): New function. (lsh_string_alloc_clue): New function, remembering allocated strings. (lsh_string_free): Unregister string. * src/werror.c (werror_vformat): Pass arguments to werror_write in the correct order. (werror_vformat): Likewise. 2001-04-04 Niels Möller * src/testsuite/Makefile.am (CFLAGS): Reintroduced -O0, to make compilation faster. * src/client.c, src/client_keyexchange.c, src/client_userauth.c, src/debug.c, src/disconnect.c, src/proxy.c, src/proxy_x11forward.c, src/server.c, src/server_keyexchange.c, src/server_userauth.c: Packet handlers should no longer free packets. * src/xalloc.c (number_of_strings): Define only if DEBUG_ALLOC. (lsh_string_alloc): NUL-terminate strings, for simplicity. (lsh_string_free): Check that string is still NUL-terminated. * src/werror.c (program_name): New variable. (werror_argp_parser): Initialize program_name. (werror_vformat): Prefix messages with program_name. (werror_vformat): Simplified code in 'z' case. * src/proxy_userauth.c (do_forward_success): dup packet before forwarding it. Packet handlers should no longer free packets. * src/channel.c (RETURN, END): Deleted macros. Packet handlers should no longer free packets. * src/keyexchange.c (do_handle_kexinit): dup packet when storing it in the connection struct. (do_handle_newkeys): Packet handlers should no longer free packets. * src/write_buffer.c (make_write_buffer): Renamed write_buffer_alloc to make_write_buffer. Updated callers. * src/gc.c (gc_final): Check number_of_objects and number_of_strings. * src/connection.c (connection_handle_packet): Always free the packet here. Packet handlers no longer needs to do that. (connection_handle_packet): Accept SSH_MSG_IGNORE and SSH_MSG_DEBUG in the KEX_STATE_NEWKEYS state. * configure.in: Bumped version to 1.3. * lsh-1.2 released. * distribution-key.gpg: Updated key, more signatures and later expiration date. * src/sftp/Makefile.am (sftp_test_client_SOURCES): Added werror.c and client.c * src/sftp/sftp-test-client.c (struct client_ctx): Moved to client.h (werror_program_name): Defined here. * src/sftp/client.c, src/sftp/client.h, src/sftp/werror.c, src/sftp/werror.h: New files. 2001-04-03 Niels Möller * src/sftp/testsuite/put-1-test: Check that the new file exists. Use $TESTHOME for referring to the local file. * src/sftp/sftp-test-client.c (do_put): Fixes and simplifications. 2001-04-03 Niels Möller * src/sftp/sftp-test-client.c (do_open): New function. (do_close): New function. (do_get): Use do_open and do_close. 2001-04-02 Niels Möller * configure.in: Bumped version to 1.2. * src/Makefile.am.in (EXTRA_DIST): Added lcp. * src/Makefile.am.in (noinst_SCRIPTS): Added the experimental lcp script. 2001-04-02 Niels Möller * src/sftp/sftp-server.c (sftp_process_read): Fixed size passed to pread. (debug): Added a prototype saying that it takes printf-style arguments. 2001-04-02 Niels Möller * src/sftp/sftp-server.c (sftp_process_realpath): Fixed invocation of pathconf(). Include stdarg.h. * src/sftp/testsuite: Adapted shell scripts to /bin/sh. Removed uses of the "function" keyword, and use a full path when sourcing common.sh. * src/sftp/testsuite/run-tests: Use /bin/bash, as we use bash-specific parameter expansion. 2001-04-01 Niels Möller * src/sftp/Makefile.am (sftp_server_SOURCES, sftp_test_client_SOURCES): Added xmalloc.c. * src/sftp/xmalloc.c: New file. Defines xmalloc, xrealloc and xstrdup. * src/sftp/sftp-test-client.c (do_put): Use xmalloc. * src/sftp/sftp-server.c (sftp_get_user): New function. (sftp_get_group): Likewise. (struct sftp_ctx): Added user_cache and group_cache. (sftp_init): Initialize user_cache and group_cache. (sftp_put_longname): Take a sftp_ctx * as argument. Use sftp_get_user and sftp_get_group. * src/sftp/buffer.c: Use xmalloc and xrealloc. * src/sftp/idcache.c: Rewrite. * src/sftp/Makefile.am (sftp_server_SOURCES): Added idcache.c. * src/sftp/sftp-server.c: Use the functions from idcache.c. * src/sftp/idcache.c: #include idcache.h. #if:ed out prototypes and functions that aren't needed. Use malloc instead of xmalloc. * src/sftp/idcache.h: New file. * src/sftp/testsuite/setup-env: Clean up first. * src/sftp/testsuite/get-1-test: New testcase. * src/sftp/testsuite/ls-1-test: Likewise. * src/sftp/testsuite/ls-2-test: Likewise * src/sftp/testsuite/common.sh (PROGRAMDIR): New variable, holding an absolute path to the directory where the programs are. * src/sftp/sftp-test-client.c (sftp_client_get_id): New function. (do_ls): Fixes and some simplification. (do_get): Simplified. The old more featureful implementation left #if:ed out. * src/sftp/sftp-server.c (debug): New function. (sftp_get_name): New function. (struct sftp_dir): New struct. (sftp_lstat_in_dir): New function. (sftp_process_readdir): Handle directories that are not our current working directory. (parse_options): New function, currently only handling -d. * src/sftp/buffer.c (sftp_check_input): Don't modify i->left here. (sftp_get_data): ...but do it here instead. (sftp_free_string): Reintroduced this function. (sftp_get_string): This function now requires the user to deallocate the string. (sftp_get_string_auto): Simpler function, that deallocates strings automatically. (sftp_read_packet): Return failure (0), rather than crashing, if there is data leftover from the previous packet. (sftp_put_final_length): Calculate the length correctly. (sftp_put_reset): Fixed assertion. (sftp_put_attrib): Likewise. * src/sftp/Makefile.am (noinst_PROGRAMS): Added dump-hex. * src/sftp/sftp.h: Converted from #define:s to enums. * src/sftp/dump-hex.c: New program that copies data from stdin to stdout, and writes a hex dump to stderr in the process. * src/sftp/debug-server: New script to dump communication between sftp-server and sftp-test-client. * src/sftp/configure.in: Added to cvs. 2001-03-31 Niels Möller * src/sftp/acconfig.h: Added HAVE_GCC_ATTRIBUTE. * src/sftp/.bootstrap: New file. 2001-03-30 Niels Möller * src/sftp/sftp-test-client.c (do_ls): Print the long name. * src/sftp/sftp-server.c (sftp_get_name): New function. (HANDLE_TYPE, HANDLE_DIR, HANDLE_FD): New macros. Fixed handles. Simplified, deleting all sftp_free_string calls. Use pread and pwrite, where available. * src/sftp/buffer.c (struct sftp_input): Added array of strings, so that callers don't have to free them explicitly. (sftp_put_reset): New funtion. (sftp_get_uint64): Use off_t, conditionalized on its size. (sftp_put_uint64): Likewise. * src/sftp/Makefile.am: Use AUTOMAKE_OPTIONS = foreign, added sftp-test-client. 2001-03-28 Niels Möller * src/lcp (split spec): New function for splitting arguments. Checked in first working version. 2001-03-27 Niels Möller * doc/srp-spec.nroff: Bumped version number, updated dates, and added a section Further questions. 2001-03-26 Niels Möller * Released lsh-1.1.9. * misc/Makefile.am.in (EXTRA_DIST): Added more files to the dist: libgcc2.c-patch, bootstrap.sh and make-dist. * configure.in: By default, disable debug-alloc and debug-trace. * src/testsuite/keygen-2-test: Use a smaller key size, 777 bits, for speed. * src/testsuite/keygen-1-test: Use NIST security level 2 (640 bits), for speed. 2001-03-25 Niels Möller * src/testsuite/functions.sh (spawn_lshd): Use kill -9 to stop lshd; otherwise lshd catching SIGTERM leads to timing problems. * Released lsh-1.1.9. * misc/libgcc2.c-patch: gcc patch. * src/crypto.c: Deleted obsolete file. * src/testsuite/Makefile.am (CFLAGS): -O0 is not needed anymore, since most of the rijndael tests were deleted. * src/proxy_userauth.c (do_proxy_userauth_continuation): Don't use FORCE_APPLY. * src/command.h (delayed_apply): Deleted class. * configure.in: Bumped version to 1.1.9. * src/testsuite/rijndael-test.m4: Deleted most tests, left 4 for each key size. * src/werror.c (fatal): If compiling with gcov, use exit(255) instead of abort. * src/spki_commands.c (parse_private_key): Use fatal instead of abort. * src/sexp.c (sexp_sn): #if:ed out. * src/resource.c (dont_free_live_resource): Call werror, not fatal. Currently, this is normal iff it happens during gc_final. * src/proxy_userauth.c (do_handle_userauth): Don't use make_delay_continuation. * src/lshg.c (main): Call gc_final. * src/lshd.c (main): Call gc_final. When compiling with gcov, catch the TERM signal and call exit() sometime later. * src/lsh.c: Call gc_final(). * src/lsh-keygen.c: Use fatal(), not abort(). * src/io_commands.c (remember_continuation): Deleted class. (do_remember_continuation): Deleted function. (make_remember_continuation): Deleted function. (do_listen): Deleted arguments resources and lookup. Updated callers. (do_simple_listen): Deleted function. (make_simple_listen): Deleted function. * src/gc.c (gc_final): New function. * src/command.c (make_delayed_apply): Deleted function. (delay_continuation): Deleted class. (do_delay_continuation): Deleted function. (make_delay_continuation): Deleted function. * src/channel.c (connection_service): Deleted class. * doc/lsh.texinfo (Invoking lsh): Added a note saying that ordering is important. * doc/TODO (TESTING): Added info on missing tests. * configure.in: Define WITH_GCOV when compiling for gcov. * acconfig.h (WITH_GCOV): New symbol. 2001-03-24 Niels Möller * src/lsh_proxy.c (main): Use listen_callback instead of simple_listen. 2001-03-22 Niels Möller * src/alist.c (alist_add): #if:ed out unused function. 2001-03-21 Niels Möller * src/client_password.c: Deleted. * src/lshd.c (install_terminate_handler): Catch SIGTERM and arrange for exit(0) to be called on termination. 2001-03-20 Niels Möller * src/lshg.c: Include client.h (used to include client.c. Argh!). * src/lsh.h: Forward-declare struct interact. * src/lsh.c: Don't include client_pty.h. * src/client_session.c: Include client.h, not client_session.h. * src/client_pty.c: Include client.h, not client_pty.h. * src/client.h (make_pty_request): Moved declaration here. * src/client.c: Don't include client_pty.h. * src/client_session.h, src/client_pty.h: Deleted. * src/Makefile.am.in (class-map): Let the shell find the awk program. 2001-03-19 Niels Möller * src/scm/gaba.scm (class-annotate): New function. * src/make-class-map: Beautified output. * src/lsh-keygen.c (main): Don't use blocking_write. * src/blocking_write.h, src/blocking_write.c: Deleted. * src/Makefile.am.in (liblsh_a_SOURCES): Removed blocking_write.c. 2001-03-16 Niels Möller * ANNOUNCE: Updated, preparing for lsh-1.2. * src/server_session.c (format_exit_signal): Represent a signal as a string, not an integer. * src/translate_signal.c: Likewise. * src/client.c (do_exit_signal): Don't use the signal name from the packet, only the message. * src/atoms.in: Added standard signals. * src/resource.c (do_remember_resource): Bugfix: Use KILL_RESOURCE, not KILL. 2001-03-15 Niels Möller * doc/srp-spec.nroff: Fixed definition of m2, pointed out by Tom Holroyd. 2001-03-14 Niels Möller * src/Makefile.am.in (class-map): Added rule for generating class-map. * src/make-class-map: New awk script for describing the class hierarchy. Almost working. 2001-03-14 Niels Möller * src/tcpforward.h (remote_port): Deleted c attribute. * src/string_buffer.c (string_buffer_length): Deleted. * src/spki_commands.h (make_spki_parse_key): Deleted. * src/spki_commands.c (spki_read_acls_command): Deleted. * src/sexp.h (sexp_iterator): Deleted set method. (SEXP_SET): Deleted. * src/sexp.c (do_nil_get): New function. (do_nil_assoc): New function. (do_nil_left): New function. (do_nil_next): New function. (make_iter_nil): New function. (do_format_nil): New function. (sexp_nil): New definition, that isn't a cons. (do_vector_set): Deleted. (sexp_iter_cons): deleted. (do_cons_get): Deleted. (do_cons_set): Deleted. (do_cons_assoc): Deleted. (do_cons_left): Deleted. (do_cons_next): Deleted. (make_iter_cons): Deleted. (do_format_sexp_tail): Deleted. (do_format_sexp_cons): Deleted. (sexp_c): Deleted. * src/server_session.h (make_server_connection_service): Deleted. * src/proxy_userauth.c (do_userauth_proxy): Don't use make_once_continuation. * src/lsh.c (do_lsh_default_handler): Don't use EXC_SERVICE. * src/keyexchange.h (make_install_new_keys: Deleted. * src/io_commands.c (collect_connect_port): Deleted. (connect_with_port): Deleted. * src/handshake.c: Adapted to change in collect_info_3. * src/gateway.c (gateway): Disabled unused class. * src/exception.c (dummy_exception): Deleted. * src/digits.c (simple_decode_base64): Deleted. * src/command.h (collect_info_4): Deleted. * src/combinators.c: Adapted to change in collect_info_3. * src/command.c (do_collect_4): Deleted. (make_collect_state_3): Deleted. (make_once_continuation): Deleted. (make_catch_report_collect_body): Deleted. (collect_state_2): Deleted attribute next. * src/client.c (make_client_options): Deleted, as it wasn't used. * src/channel_commands.h (channel_command): Deleted, it wasn't used. * src/channel.h: Deleted old code (CONNECTION_START and format_channel_open_a). * src/alist.h: Deleted ALIST_KEYS. 2001-03-13 Niels Möller * src/dsa_keygen.h, src/packet_ignore.c, src/packet_ignore.h, src/password.c, src/password.h, src/proxy_channel.h, src/session.c, src/session.h:Removed obsolete files. 2001-03-12 Niels Möller * configure.in: Bumped version to 1.1.8. * src/client_session.c (do_client_session_eof): Close stdout and stderr, not stdin. * src/client.c (do_exit_status): Don't call channel_eof. This way, the behavior is more similar to other ssh clients. * src/channel.c (channel_request_handler): Display more info about unexpected packets. (channel_close_handler): Don't display the "unexpected channel close" message if CHANNEL_NO_WAIT_FOR_EOF is set. Don't invoke the CHANNEL_EOF callback. (channel_eof): Use the new CHANNEL_NO_WAIT_FOR_EOF flag. (init_channel): Set CHANNEL_CLOSE_AT_EOF by default. (channel_read_close_callback): Improved comment. * src/channel.h (CHANNEL_NO_WAIT_FOR_EOF): New flag. * src/tcpforward.c (do_tcpip_eof): Use the SHUT_WR constant, which is defined in io.h if needed. * src/server_session.c (spawn_process): Clear CHANNEL_CLOSE_AT_EOF. (do_exit_shell): Set CHANNEL_CLOSE_AT_EOF and CHANNEL_NO_WAIT_FOR_EOF. * src/gateway_channel.c (make_gateway_channel): Clear CHANNEL_CLOSE_AT_EOF. * src/io.h (SHUTDOWN_UNIX): Moved shutdown workaround from io.c, and added a _UNIX-suffix on the macros to indicate that they are for AF_UNIX sockets only. * src/scm/gaba.scm (string-upcase): Moved definition to guile-compat.scm. scsh already provides string-upcase, and the definition here trigs a bug in string->list in scsh-0.5.2. 2001-03-12 Niels Möller * src/io.c (io_iter): Handle POLLERR. 2001-03-07 Niels Möller * doc/TODO: scsh-0.5.2 is truly free software! Removed paragraph describing the scsh situation. * README: Say that scsh-0.5.2 is needed. * src/scm/guile-compat.scm (char-set=): New function, for compatibility with scsh-0.5.2. (char-set:empty): New variable, likewise. * src/scm/make-char-classes.scm (char-set-assoc): A real function now, as I'm not sure that the usual assoc handles char-sets. (char-set-empty?): Use char-set:empty (new in scsh-0.5.2). (char-set=?): Removed function, scsh-0.5.2 provides a similar function named char-set=. 2001-02-28 Niels Möller * src/client.c (init_client_options): Initialize stderr_fork = 1. (client_options): New option --no-cvs-workaround. (client_argp_parser): Handle --no-cvs-workaround. 2001-02-25 Niels Möller * Refer to a function foo as "foo", not "foo()", in messages and comments. (GNU coding standard). 2001-02-22 Niels Möller * src/randomness.c (do_arcfour_random): Spelling fix. * Released lsh-1.1.7. 2001-02-22 Niels Möller * src/io.c (close_fd_read): New function. (do_buffered_read): Call close_fd_read on EOF. This stops reading from the file, and also marks it for closing unless it has a write callback. (do_consuming_read): Likewise. 2001-02-21 Niels Möller * src/io.c (do_consuming_read): Added an assert do check that want_read is true. Check fd->hanged_up first. 2001-02-21 Niels Möller * src/srp_exchange.c (srp_format_proofs): First argument to MAKE_MAC must not have side effects. * src/lsh-keygen.c (main): First argument to A_WRITE must not have side effects. * src/gateway_channel.c (do_gateway_channel_request): First argument to COMMAND_CALL must not have side effects. (do_channel_open_forward): Likewise. * src/lsh.c (do_options2identities): Likewise. * src/connection_commands.c (do_connection_if_srp): Don't use a complex expression as the first argument to COMMAND_CALL. * src/command.h (COMMAND_CALL): Generate a compile error if the first argument is not an lvalue. 2001-02-20 Niels Möller * doc/HACKING: Added section CAVEAT. 2001-02-20 Niels Möller * src/io.c, src/io.h, src/reaper.c, src/unix_interact.c: Added volatile modifier to all uses of sig_atomic_t. * src/client_userauth.c (do_userauth_success): Use verbose, not werror, for success message. 2001-02-19 Niels Möller * src/testsuite/Makefile.am (TS_MORE_PROGS): Added lshg-tcpip-local-test. 2001-02-18 Niels Möller * src/testsuite/tcpip-local-test: Don't pass -r to tcpconnect. grep the output from tcpconnect. * src/testsuite/tcpip-remote-test: Likewise. * src/testsuite/lshg-tcpip-local-test: New test case. * src/testsuite/functions.sh (spawn_lshg): New function. * src/resource.c (do_remember_resource): If the resource list is dead, immediately kill any resources added to it. * src/lsh.c (main_argp_parser): Check if the action list is empty at ARGP_KEY_END. * src/lshg.c (main_argp_parser): Likewise. * src/io.c (do_consuming_read): Don't close the fd on EOF. (do_buffered_read): Likewise. (sockaddr2info): Silently return NULL for AF_UNIX addresses. * src/client.c (client_argp_parser): Don't check that the length of the action list is non-zero at ARGP_KEY_END. lsh.c may add a gatewaying action later. * configure.in: Bumped version to 1.1.7. 2001-02-13 Niels Möller * src/sftp/sftp-test-client.c: Added more code from Pontus Sköld. 2001-02-13 Niels Möller * src/channel.c (do_exc_finish_channel_handler): Check channel_count to determine if there are channels left. The code used to just check next_channel, which was broken. (alloc_channel): Update channel_count. (dealloc_channel): Likewise. (do_exc_finish_channel_handler): The handler for EXC_FINISH_PENDING shouldn't raise EXC_FINISH_READ. * src/channel.h (channel_table): New attribute channel_count. * src/bignum.c (bignum_random): Added a comment about biased numbers. 2001-02-11 Niels Möller * src/sftp/sftp-server.c: Updated copyright notice to mention Markus Friedl. * src/sftp/filemode.c, src/sftp/filemode.h, src/sftp/idcache.c: New files, copied from GNU Fileutils-4.0. * src/sftp/sftp-test-client.c: Added dummy functions do_ls, do_get, do_put and do_stat, and call them from main. * src/sftp/sftp-server.c: Merged code from Pontus Sköld. (sftp_put_longname_mode): New function. (sftp_put_longname): New function. (sftp_put_filename): New function. (getuser): New dummy function. (getgroup): New dummy function. * src/sftp/buffer.c: Let most output-related functions call exit() directly on failure. (sftp_put_reserve_length): New function, replacing sftp_put_reserve. (sftp_put_length): New function. (sftp_put_final_length): New function. (sftp_put_printf): New function. (sftp_put_strftime): New function. (sftp_clear_attrib): Moved here from sftp-server.c. (sftp_skip_extension): Likewise. (sftp_get_attrib): Likewise. (sftp_put_attrib): Likewise. 2001-02-11 Pavel Roskin * acinclude.m4: Always quote first argument to AC_DEFUN to allow redefining existing macros. * configure.in: Quote the second argument to AC_SEARCH_LIBGMP. 2001-02-08 Niels Möller * src/keyexchange.c (do_kexinit_filter): Don't crash if there are no appropriate hostkeys. 2001-02-08 Niels Möller * src/dsa.c (generic_dsa_sign): Commented out debug statement that leaks information about the secret key. 2001-02-07 Niels Möller * src/algorithms.c (filter_algorithms): Document that the functions may return NULL, and never returns an empty list. 2001-02-04 Niels Möller * Released lsh-1.1.6. * src/ssh-conv (SSH_CONV): Got rid of the bash:isms "if !" and "&>". 2001-02-04 Niels Möller * doc/lsh.texinfo (Action options): Edited the description of the -g, not calling it "gateway mode", as the word "gateway" is associated with the '-G' option. (Invoking lshd): Documented --kerberos-passwords, --password-helper and --login-shell. Changed UPDATED-FOR to 1.1.6. * configure.in: Bumped version to 1.1.6. * src/testsuite/Makefile.am (TS_SH, TS_MORE_SH): Added a few more tests. * src/testsuite/functions.sh: New variable HOSTKEY for configuring which hostkey to use. * src/unix_user.c (unix_user_db): New attribute login_shell. (do_lookup_user): Let self->login_shell, if non-NULL, override the login shell in the passwd database. (make_unix_user_db): New argument login_shell. * src/rsa_keygen.c (rsa_generate_key): Changed "e not invertible" message from werror() to debug(). * src/lshd.c (main_options): New option --login-shell. * src/lsh-keygen.c (main): When generating an rsa key, display a better message before trying again. * src/client_keyexchange.c (do_handle_dh_reply): If the server's signature doesn't verify, display a warning message before disconnecting. * src/rsa.c (parse_ssh_rsa_public): Call rsa_check_size, to make sure that the ->size attribute is initialized. * src/testsuite/key-2.private: Created an RSA testkey. * src/testsuite/write-key-1-test, src/testsuite/write-key-2-test: Renamed keygen-test and keygen-2-test. * src/testsuite/conv-2-test: New test for reading an openssh rsa key. * src/testsuite/conv-1-test: Renamed conv-test. 2001-01-31 Niels Möller * src/server_publickey.c (do_authenticate): Include algorithm atom in "Unknown publickey algorithm"-message. * src/process_atoms (table): Fixed first reverse entry, { "UNKNOWN", 7}. * src/lsh-authorize: Redirect output from the type command to /dev/null. * src/server_password.c (do_authenticate): Don't free the username twice. * src/server_authorization.c (do_key_lookup): Support ssh-rsa keys. * src/lshd.c (main_argp_parser): Support RSA keys for publickey userauth. * src/io.c (io_iter): Changed POLLHUP handling some more. Now POLLHUP && !POLLIN is treated as EOF. 2001-01-31 Niels Möller * src/testsuite/lsh-cat-test: Use compare_output. * src/testsuite/lsh-1-test: Use test_success. * src/testsuite/lsh-2-test: Likewise. * src/testsuite/lsh-3-test: Likewise. * src/testsuite/lsh-4-test: Likewise. * src/testsuite/tcpip-local-test: Likewise. * src/testsuite/tcpip-remote-test: Likewise. * src/testsuite/keygen-2-test: Use functions.sh and test_success. * src/testsuite/keygen-test: Likewise. * src/testsuite/functions.sh (at_exit): Fixed the at_exit mechanism. The previous code always exited successfully. (test_result): New variable for keeping the desired exit status. (test_fail): New function. (test_success): Likewise. (compare_output): Likewise. * src/testsuite/Makefile.am (TS_SH): Added conv-test. * src/testsuite/conv-test: New test program. * src/unix_random.c (background_poll): Changed werror() to debug(). (start_background_poll): Changed werror() to verbose(). * src/tcpforward.c (do_tcpip_eof): Removed channel close logic, now in channel.c, channel_of_handler. * src/ssh-conv: Don't look for lsh-decode-key in the current directory. Added command line options --help, --usage, --decode-with. * src/server_session.c (do_eof): Removed channel close logic, now in channel.c, channel_of_handler. (do_exit_shell): Added a verbose() message. * src/lsh-decode-key.c: Include rsa.h. Added program name prefix to the diagnostic messages. * src/io.c (do_buffered_read, do_consuming_read): Don't call read() if fd->hanged_up is set. (init_file): Initialize hanged_up. 2001-01-30 Niels Möller * src/io.c (io_iter): Improved handling of POLLHUP. Set the fd->hanged_up flag before calling FD_READ(). * src/io.h (lsh_fd): New attribute hanged_up. * src/client.c (do_exit_status): Added a verbose() message. * src/channel.c (channel_read_close_callback): Call channel_eof, not channel_close. (channel_eof_handler): Moved the channel close decision here. 2001-01-29 Niels Möller * src/ssh-conv: Support ssh-rsa keys. * src/lsh-decode-key.c (do_decode_key): Support ssh-rsa keys. 2001-01-24 Niels Möller * src/spki_commands.c (parse_private_key): Generate keypairs with algorithms ATOM_SSH_RSA, ATOM_SPKI_SIGN_RSA and ATOM_SPKI_SIGN_DSS. * src/rsa.c (do_rsa_verify): Replaced ATOM_RSA_PKCS1_SHA1 with ATOM_SSH_RSA, and replaced ATOM_SPKI with ATOM_SPKI_SIGN_RSA and ATOM_SPKI_SIGN_DSS. (do_rsa_sign): Likewise. (parse_ssh_rsa_public): New function. (make_ssh_rsa_verifier): New function. * src/pkcs5-test.c: Include both unistd.h and stdlib.h, do get a declaration of getopt(). * src/lsh.c (do_lsh_lookup): Handle ATOM_SSH_RSA. (do_lsh_lookup): Replace ATOM_SPKI with ATOM_SPKI_SIGN_RSA and ATOM_SPKI_SIGN_DSS. * src/dsa.c (do_dsa_verify): Check that there's no trailing garbage. (do_dsa_verify): Replace ATOM_SPKI with ATOM_SPKI_SIGN_RSA and ATOM_SPKI_SIGN_DSS. (do_dsa_sign): Likewise. * src/atoms.in: Updated algorithm names to match draft-ietf-secsh-transport-09.txt. * src/algorithms.c (algorithms_argp_parser): Replace ATOM_SPKI with ATOM_SPKI_SIGN_RSA and ATOM_SPKI_SIGN_DSS. (lookup_hostkey_algorithm): Likewise. * src/Makefile.am.in: Removed $(srcdir) prefixes from targets. * src/testsuite/Makefile.am (%.c): Likewise. * configure.in (PREFIX): Replace NONE with $ac_default_prefix. (SBINDIR): MAke a #define from sbindin. Currently broken. * acconfig.h: Added SBINDIR. 2001-01-23 Niels Möller * src/tcpforward.c (do_tcpip_eof): Call shutdown(socket, SHUT_WR), to signal to the local peer that there's no more data. 2001-01-18 Niels Möller * src/lshd.c (KERBEROS_HELPER): Added /sbin/ between PREFIX and the program name. Note that PREFIX seems to get a bogus value "NONE" if the default prefix is used. * src/sftp: New directory. Not compiled or used by default. 2001-01-17 Niels Möller * src/lsh_types.h: Improved formatting. * src/channel.c (alloc_channel): Use UINT32, not int, for new_size. 2001-01-15 Niels Möller * misc/bootstrap.sh: Fixed comment. * src/lsh-keygen.c (main_argp_parser): Don't use optarg (reported by jps). * Added Markus Friedl's sftp-server.c to contrib, for some random hacking. 2001-01-10 Niels Möller * src/pkcs5-test.c: Include stdlib.h instead of getopt.h. 2001-01-10 Niels Möller * Released lsh-1.1.5. * configure.in: Bumped version to 1.1.5. 2001-01-09 Niels Möller * src/rsync/send.c: Deleted old code. * src/rsync/send.c (rsync_send_init): Rewrote. Allocates a slightly larger buffer. (rsync_send_eof): New function. (rsync_send_copy_in): Deleted th dst argument. Update sum_md5 and size. (rsync_send_read): New function. (rsync_send_search): New function. (rsync_send_flush): New function. (rsync_send_write): New function. (rsync_send): Rewrote and simplified. Now uses fewer states, simpler eof handling, and calls several smaller functions. * src/rsync/rsync.h (RSYNC_SUM_SIZE): Rename RSYNC_SUM_LENGTH. (rsync_result_t): New enum for return types. (struct rsync_receive_state): Renamed attribute full_sum to sum_md5. (struct rsync_receive_state): Made the state attribute an enum. Moved the constants from receive.c, and renamed them to use a RSYNC_RECIEVE_-prefix. (struct rsync_send_state): Changed state and buffering. * src/rsync/generate.c, src/rsync/receive.c, src/rsync/send.c, src/rsync/rsync.h: Changed return types from int to enum rsync_result_t. * src/rsync/checksum.c (rsync_search): Renamed argument FOUND to DONE, and set it properly for both successful and unsuccessful searches. * src/rsync/receive.c (rsync_receive_mode): Use an enum instead of defines. (rsync_update): Hash data on output. (rsync_receive) STATE_LITERAL: Update avail_in and next_in after calling rsync_update. 2001-01-02 Niels Möller * src/unix_random.c (random_sources): Fixed bug in initialization of the HAS_ALTERNATIVE fields. Noted by jps. 2000-12-28 Niels Möller * src/lsh.c: Don't include unistd.h. (main_argp_parser): Fixed bogus references to optarg (reported by jps). 2000-12-23 Niels Möller * Released lsh-1.1.4. 2000-12-23 Niels Möller * src/Makefile.am.in (EXTRA_DIST): Removed references to the getopt files getopt.c, getopt.h and getopt1.c. * configure.in: Removed getopt-related tests (previously just commented out). 2000-12-23 Niels Möller * src/getopt.c, src/getopt1.c, src/getopt.h: Removed. 2000-12-22 Niels Möller * src/testsuite/Makefile.am (LDADD): Link with libargp. ($(srcdir)/%.c): Fix $(srcdir)-handling. * src/Makefile.am.in (bootstrap): New target, replaces the post-configure work previously done by misc/bootstrap.sh * Makefile.am.in (bootstrap): New target. 2000-12-11 Niels Möller * src/lsh.c (do_options2identities): Pass two alists to make_spki_read_userkeys (reported by jps). * src/spki_commands.c (make_spki_read_userkeys): Use separate alists for symmetric algorithms and signature algorithms (reported by jps). * src/abstract_crypto.c (crypt_string_unpad): Adjust length properly (reported by jps). 2000-12-09 Niels Möller * src/Makefile.am.in (LDADD, lshg_LDADD): Use @LIBARGP@ * misc/bootstrap.sh: Use set -e. Bootstrap in the src/argp subdirectory. 2000-11-27 Niels Möller * configure.in: Use AC_LIB_ARGP. * acinclude.m4 (AC_LIB_ARGP): New test. 2000-11-27 Niels Möller * Released lsh-1.1.3. * src/client.c (client_argp_parser): Handle remote_forward properly, and install a channel_open_forwarded_tcpip handler if needed (recovered from an earlier lsh.c). Some other cleanup. * src/abstract_crypto.h: Some cleanup. * src/abstract_io.h: Likewise. * src/channel.c: Likewise. * src/channel.h: Likewise. * src/channel_commands.h: Likewise. * src/connection.h: Likewise. * src/connection_commands.c: Likewise. * src/dh_exchange.c: Likewise. * src/exception.h: Likewise. * src/gateway.c: Likewise. * src/gateway_channel.c: Likewise. * src/gateway_commands.c: Likewise. * src/handshake.c: Likewise. * src/handshake.h: Likewise. * src/io.h: Likewise. * src/io_commands.c: Likewise. * src/io_commands.h: Likewise. * src/keyexchange.h: Likewise. * src/lsh.c: Likewise. * src/lsh_proxy.c: Likewise. * src/lshg.c: Likewise. * src/publickey_crypto.h: Likewise. * src/randomness.c: Likewise. * src/randomness.h: Likewise. * src/read_packet.c: Likewise. * src/rsa.c: Likewise. * src/server_pty.h: Likewise. * src/server_session.c: Likewise. * src/sexp.h: Likewise. * src/sexp_parser.c: Likewise. * src/sexp_streamed_parser.c: Likewise. * src/sexp_test.c: Likewise. * src/spki_commands.c: Likewise. * src/spki_commands.h: Likewise. * src/ssh1_fallback.c: Likewise. * src/tcpforward.c: Likewise. * src/unix_random.c: Likewise. * src/zlib.c: Likewise. 2000-11-26 Niels Möller * src/parse.c (parse_rest, parse_rest_copy): Renamed parse_rest to parse_rest_copy. New function parse_rest. * src/gateway_channel.c (do_gateway_channel_request): Use format_channel_request_i(). (gateway_channel_open_continuation): New attribute fallback. (do_gateway_channel_open_continuation): Set the target channel's request_fallback pointer. (do_channel_open_forward): Set the origin channel's request_fallback pointer. * src/channel.h (ssh_channel): Added request_fallback attribute. (channel_request_info): New struct. (channel_request): Use a channel_request_info argument. * src/channel.c (parse_channel_request): New function. (DEFINE_PACKET_HANDLER): Use parse_channel_request. Invoke request fallback if appropriate. (init_channel): Initialize request_fallback = NULL. (format_channel_open_s): Use a struct lsh_string for the type argument. (format_channel_request_i): New function. * src/spki_commands.c (spki_read_userkeys): Try to decrypt the key. (make_spki_read_userkeys): New argument tty. If supplied, try to decrypt password protected keys. * src/proxy_agentforward.c (do_proxy_open_auth_agent): Updated to use struct channel_open_info. * src/proxy_x11forward.c (do_proxy_open_x11): Likewise. * src/proxy_tcpforward.c (do_proxy_open_direct_tcpip): Likewise. * src/proxy_session.c (do_proxy_open_session): Likewise. * src/server_session.c (do_open_session): Likewise. * src/tcpforward.c: Likewise. * src/parse.c (parse_rest): New function. * src/lshg.c: Use new client.c option parsing. * src/lsh_proxy.c: Adapted to stricter alist typing. * src/lshd.c: Likewise. * src/reaper.c: Likewise. * src/server_publickey.c: Likewise. * src/spki.c: Likewise. * src/lsh.c: Moved some of the option parsing to client.c. * src/gateway_commands.c (gateway_make_connection): Install an open_fallback. * src/gateway_channel.c (gateway_channel_open_command): Use a string instead of an atom to represent the chennel type. (do_gateway_channel_open): Use format_channel_opn_s(). (make_gateway_channel_open_command): Take an struct channel_open_info * as argument. (do_channel_open_forward): New function. (gateway_channel_open_forward): Channel open handler that forwards any channel open request, of any type. * src/client_session.c (client_session_channel): Renamed the class client_session. * src/client.h (CLIENT_ARGP_ACTION_GROUP): New constant. (CLIENT_ARGP_MODIFIER_GROUP): New constant. (client_options): New class. * src/client.c: Moved most of the option parsing from lsh.c to this file. * src/channel.c (make_channel_table): Initialize open_fallback = NULL; (global_request_handler): Prepared for using a fallback handler. (channel_request_handler): Likewise. (channel_open_continuation): Renamed attributes to send_window_size and send_max_packet. (parse_channel_open): New function. (DEFINE_PACKET_HANDLER): Use parse_channel_open. Invoke open_fallback if there's no more specific handler for the channel type. (format_channel_open_s): New function. (format_channel_open_a): New function (currently #if:ed out). * src/channel.h (struct channel_open_info): New struct to represent the common information in SSH_MSH_CHANNEL_OPEN. (channel_table): New attribute open_fallback. (channel_open): Use a channel_open_info for the arguments. * src/alist.h (alist): Use struct lsh_object *, not void *, to pass values. * src/alist.c (alist_select): New function. * src/algorithms.c (make_algorithms_options): New function. * doc/TODO: Some updates. * configure.in: Bumped version to 1.1.3. 2000-11-20 Niels Möller * src/algorithms.h, src/client.h, src/client_keyexchange.c, src/client_userauth.c, src/connection.c, src/format.h, src/interact.c, src/interact.h, src/io.c, src/io.h, src/lsh-writekey.c, src/lsh.c, src/lshd.c, src/reaper.c, src/reaper.h, src/server_session.c, src/spki.c, src/spki_commands.c, src/srp-gen.c, src/tty.c, src/tty.h: Removed old #if:ed out code. * ChangeLog: Rotated ChangeLog, creating ChangeLog.2.