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 * src/argp/configure.ac: Use AH_TEMPLATE for PROGRAM_INVOCATION_NAME and PROGRAM_INVOCATION_SHORT_NAME. The third arg to AC_DEFINE_UNQUOTED seems not to work here. * 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 * src/argp/acconfig.h: Deleted file. * src/argp/configure.ac: Pass no arguments to AM_INIT_AUTOMAKE. Don't substitute LIBOBJS. * src/argp/acinclude.m4: Use the three-argument form of AC_DEFINE_UNQUOTED. * configure.ac: Pass no options to AM_INIT_AUTOMAKE. 2002-05-05 Niels Möller * configure.ac: Update for automake-1.6. * src/argp/configure.ac: Likewise. * 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. * src/argp/configure.ac: Likewise. * 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. * src/argp/configure.in: Bumped argp version to standalone-1.1. 2001-03-26 Niels Möller * src/argp/configure.in (CPPFLAGS): Added -D_GNU_SOURCE. 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/argp/argp-parse.c (argp_default_parser): Let OPT_HANG print the process id to stderr. * 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/argp/argp.h: #define PRINTF_STYLE, and use it instead of using __attribute__ directly. * 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-07 Niels Möller * src/argp/argp.h: Added _argp_short_program_name and __argp_short_program_name. * src/argp/argp-parse.c (parser_init): Use argp_short_program_name. (parser_parse_next): Removed old permutation handling code. 2001-01-06 Niels Möller * src/argp/argp-namefrob.h: Added _argp_short_program_name. 2001-01-02 Niels Möller * src/argp/argp-help.c (hol_entry_help): Avoid using a non-constant struct initializer. (UNUSED): Define as a macro expanding to __attribute__ ..., if compiling with gcc. * src/argp/argp-fmtstream.h (PRINTF_STYLE): Define this macro, to expand to __attribute__ ... if compiling with gcc. * src/argp/argp-fmtstream.c (__argp_fmtstream_write, __argp_fmtstream_puts, __argp_fmtstream_putc): Duplicate the inline definitions in argp-fmtstream.h, for compilers that don't do inlining. * 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). * src/argp/argp-help.c (fill_in_uparams): Use unsigned char * for VAR and ARG. Fixed calls of isalnum, isspace and friends, reported by Kalle Olavi Niemitalo. (canon_doc_option): Fixed calls of isalnum, isspace and friends, reported by Kalle Olavi Niemitalo. (hol_entry_cmp): Fixed calls of tolower, reported by Kalle Olavi Niemitalo. 2000-12-23 Niels Möller * Released lsh-1.1.4. 2000-12-23 Niels Möller * src/argp/acinclude.m4: New file. * src/argp/acinclude.m4: Reverted the definition of AC_CHECK_VAR to take includes as argument, and renamed it to ARGP_CHECK_VAR. 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 * Removed getopt.c, getopt.h and getopt1.c from the src/argp directory. * 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). * src/argp/argp-parse.c (match_option, ARGP_COMPLETE): #if:ed out completion code for long options. 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-30 Niels Möller * src/argp/argp-parse.c (match_option): Better abbreviations. Replaced try_getopt with args_only, changed calling convention for parser_parse_arg. * src/argp/configure.in: Don't check for getopt. * src/argp/argp.h: Don't include getopt.h. * src/argp/argp-parse.c (calc_sizes): Updated comment. 2000-11-29 Niels Möller * src/argp/configure.in: Use AC_REPLACE_FUNCS for mempcpy, strndup and strchrnul. (AC_CHECK_VAR): Changed second argument to take the type of the variable. * src/argp/argp-parse.c (struct parser): New fields posixly_correct and ordering. (parser_init): Choose ordering. (enum arg_type): New value ARG_LONG_ONLY. (parser_parse_next): Added error messages similar to getopt's. * src/argp/argp-help.c (STRNDUP): New macro to refer to strndup or __strndup, as appropriate. (STRERROR): Define this macro as a wrapper for strerror or sys_errlist. (__argp_basename): New function. * src/argp/argp-namefrob.h (__argp_basename): Added __argp_basename. * src/argp/Makefile.am (libargp_a_LIBADD): Include LIBOBJS in libargp.a. * src/argp/argp.h: Added prototype for _argp_basename and __argp_basename. * src/argp/strndup.c, src/argp/strchrnul.c src/argp/mempcpy.c: Moved replacement functions to separate files. 2000-11-28 Niels Möller * src/argp/argp-parse.c: Deleted getopt-related code. (struct parser): New field nextchar. Deleted fields try_getotp and long_opts. (find_short_option): New function. (match_option): New function. (find_long_option): New function. (struct parser_convert_state): Deleted field long_end. (convert_options): Don't build getopt_long-style option array. (parser_convert): Deleted FLAGS arument. (struct parser_sizes): Deleted field long_len. (parser_init): Set short_opts to NULL, unless ARGP_LONG_ONLY is used. (classify_arg): New function. (parser_parse_next): Don't use getopt_long(). 2000-11-27 Niels Möller * configure.in: Use AC_LIB_ARGP. * acinclude.m4 (AC_LIB_ARGP): New test. * src/argp/argp-help.c (argp_doc): Use the name strndup, not __strndup. That probably breaks glibc builds. 2000-11-27 Niels Möller * src/argp/argp-test.c (asprintf): Bug fix. * src/argp/argp.h: Dummy definition of __THROW. * src/argp/argp-test.c: Fixed asprintf implementation. * src/argp/argp-parse.c (__argp_usage, __option_is_short, __option_is_end): Define these function, in case the user isn't inlining them. * src/argp/argp-help.c: #define __mempcpy if needed. Use unsigned arguments to the ctype macros. Handle systems where program_invocation_name and program_invocation_short_name doesn't exist. * src/argp/argp-help.c (short_program_name): New function. * src/argp/Makefile.am: Use @LIBOBJS@ when building test program. * src/argp/configure.in: Check for getopt_long. Substitute LIBOBJS. Add -I$srcdir to CPPFLAGS. * src/argp: Added getopt.h, getopt.c and getopt1.c, which are needed for separate compilation of argp. 2000-11-27 Niels Möller * Updated argp from glibc-2.2. * 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.