Commit 23c0d493 authored by Niels Möller's avatar Niels Möller
Browse files

Removed sftp files from old location.

Rev: src/sftp/.bootstrap:1.4(DEAD)
Rev: src/sftp/.c-style:1.2(DEAD)
Rev: src/sftp/.cvsignore:1.6(DEAD)
Rev: src/sftp/ChangeLog:1.66(DEAD)
Rev: src/sftp/
Rev: src/sftp/buffer.c:1.19(DEAD)
Rev: src/sftp/buffer.h:1.14(DEAD)
Rev: src/sftp/client.c:1.7(DEAD)
Rev: src/sftp/client.h:1.4(DEAD)
Rev: src/sftp/commands.c:1.18(DEAD)
Rev: src/sftp/commands.h:1.6(DEAD)
Rev: src/sftp/
Rev: src/sftp/dc.c:1.7(DEAD)
Rev: src/sftp/dc.h:1.7(DEAD)
Rev: src/sftp/debug-server:1.2(DEAD)
Rev: src/sftp/dump-hex.c:1.3(DEAD)
Rev: src/sftp/filemode.c:1.3(DEAD)
Rev: src/sftp/filemode.h:1.3(DEAD)
Rev: src/sftp/gnu_stuff.c:1.9(DEAD)
Rev: src/sftp/gnu_stuff.h:1.5(DEAD)
Rev: src/sftp/idcache.c:1.5(DEAD)
Rev: src/sftp/idcache.h:1.3(DEAD)
Rev: src/sftp/io.h:1.2(DEAD)
Rev: src/sftp/io_input.c:1.4(DEAD)
Rev: src/sftp/io_output.c:1.4(DEAD)
Rev: src/sftp/lsftp.1:1.3(DEAD)
Rev: src/sftp/lsftp.c:1.7(DEAD)
Rev: src/sftp/lsftp.h:1.3(DEAD)
Rev: src/sftp/misc_fun.c:1.5(DEAD)
Rev: src/sftp/misc_fun.h:1.4(DEAD)
Rev: src/sftp/rl.c:1.11(DEAD)
Rev: src/sftp/rl.h:1.5(DEAD)
Rev: src/sftp/sftp-server.8:1.3(DEAD)
Rev: src/sftp/sftp-server.c:1.22(DEAD)
Rev: src/sftp/sftp-test-client.c:1.15(DEAD)
Rev: src/sftp/sftp.h:1.6(DEAD)
Rev: src/sftp/sftp_bind.c:1.17(DEAD)
Rev: src/sftp/sftp_bind.h:1.10(DEAD)
Rev: src/sftp/sftp_c.c:1.10(DEAD)
Rev: src/sftp/sftp_c.h:1.8(DEAD)
Rev: src/sftp/str_utils.c:1.8(DEAD)
Rev: src/sftp/str_utils.h:1.5(DEAD)
Rev: src/sftp/testsuite/.cvsignore:1.2(DEAD)
Rev: src/sftp/testsuite/
Rev: src/sftp/testsuite/
Rev: src/sftp/testsuite/connect-test:1.4(DEAD)
Rev: src/sftp/testsuite/get-1-test:1.5(DEAD)
Rev: src/sftp/testsuite/ls-1-test:1.5(DEAD)
Rev: src/sftp/testsuite/ls-2-test:1.5(DEAD)
Rev: src/sftp/testsuite/put-1-test:1.5(DEAD)
Rev: src/sftp/testsuite/setup-env:1.5(DEAD)
Rev: src/sftp/testsuite/teardown-env:1.5(DEAD)
Rev: src/sftp/werror.c:1.4(DEAD)
Rev: src/sftp/werror.h:1.4(DEAD)
Rev: src/sftp/xmalloc.c:1.4(DEAD)
Rev: src/sftp/xmalloc.h:1.2(DEAD)
parent 3d3935d7
#! /bin/sh
aclocal && autoconf && autoheader && automake -a
2006-12-19 Niels Mller <>
* (AM_CPPFLAGS): Added -I../nettle, needed for
locating nettle-stdint.h in the build tree.
2006-05-08 Niels Mller <>
* Man pages: Applied patch from Stefan Pfetzing, addressing long
lines and non-ascii caharacters.
2006-04-27 Niels Mller <>
* rl.c: Disable readline support if the needed functions aren't available.
2004-11-19 Pontus Freyhult <>
* Added new manpages to man_MANS and EXTRA_DIST.
* sftp-server.8: New manpage.
* lsftp.1: New manpage.
2004-11-17 Niels Mller <>
* commands.c (com_chown): Always us unsigned char with isdigit.
(com_chgrp): Likewise.
* (LDADD): All programs need linking with $(LIBOBJS),
not just lsftp.
* Check for stadarg.h. Needed by vsnprintf.c.
2004-11-14 Niels Mller <>
* commands.c (uidstring, gidstring): When using snprintf,
NUL-terminate the result string explicitly.
* (lsftp_LDADD): Link lsftp with $(LIBOBJS), to pickup
snprintf and vsnprintf.
Added checks for snprintf and vsnprintf.
2004-11-13 Niels Mller <>
* dc.h: Reverted apache workaround. It turned out it was not
sufficient to solve the problem, there remained undefined
references to the function ap_signal.
2004-11-10 Niels Mller <>
* dc.h: Added workaround for broken fnmatch.h installed by apache.
2004-03-20 Niels Mller <>
2004-02-17 Niels Mller <>
* filemode.h: Always use prototypes.
2004-02-15 Niels Mller <>
* (AM_CPPFLAGS): Added -I.., needed for inclusion of
nettle-types.h. This is somewhat ugly, as sftp shouldn't really
depend on nettle or lsh.
* buffer.h: Include nettle/nettle-types.h, for unint32_t and
* sftp_c.h: Don't include inttypes.h or stdint.h, rely on buffer.h
doing the right thing.
2003-05-20 Niels Mller <>
* Commented out AC_FUNC_MALLOC.
2003-05-20 Niels Mller <>
* sftp.h (enum sftp_attr_flag): Use a #define for the
SSH_FILEXFER_ATTR_EXTENDED constant, as it's too large to fit in
an enum constant.
2003-05-16 Niels Mller <>
* Changed include file ordering, to follow the same conventions as
lsh and nettle: .c-files include config.h first, then system
files, and finally sftp files. .h-files never include config.h,
and they include system files before sftp files.
* dump-hex.c: Include config.h, to get alloca defined properly.
2003-03-02 Niels Mller <>
* buffer.c (sftp_put_uint64): Fixed WRITE_UINT32 search&replace
2003-02-26 Pontus Skld <>
* sftp_bind.c (lsftp_handle_packet): Only free(a) if free_a is
(lsftp_nullcb): Init free_a to false.
(lsftp_do_stat): Explicitly clear free_a.
(lsftp_do_chown): Set free_a.
(lsftp_do_chmod): dito.
(lsftp_handle_chall): Respect free_a.
* sftp_bind.h (struct lsftp_callback): New flag, free_a.
* buffer.h: If available, include <stdint.h> and <inttypes.h>.
* sftp_c.h: Dito.
* Also check for stdint.h.
2003-02-24 Niels Mller <>
* rl.c (lsftp_rl_remotefile_generator): Use const char.
2003-02-23 Niels Moller <nisse@carduelis>
* dc.c (lsftp_dc_r_isdir): Adapted to new sftp_attrib argument to
* commands.c (get_file_or_folder, com_chown, com_chgrp): Likewise.
* dc.h: Deleted the posixperms field, and replaced it with two
fields, has_permissions and permissions. That way we don't need
to compare (unsigned) mode_t:s to the special constant -1.
* sftp_bind.h (struct lsftp_callback): Deleted stat pointer.
* sftp_bind.c (lsftp_do_stat): Use a struct sftp_attrib for
reporting the result, not a struct stat.
(lsftp_handle_stat): Just copy the sftp_attrib struct, don't try
converting it to a struct stat.
* Use uint32_t and friends instead of UINT32.
2003-02-17 Niels Mller <>
* Deleted initial newline in readline warning.
2003-02-11 Niels Mller <>
* sftp_c.c (sftp_get_file_main): Added an explicit cast to kludge
around a bug in the constification.
2002-11-07 Pontus Skld <>
* rl.c (lsftp_rl_completion): Bugfix: Don't free memory for every
command checked.
2002-07-29 Pontus Skld <>
* Take advantage of lshg now understanding -G (pass
-G by default if compiling with lsh).
2002-07-18 Niels Mller <>
* Don't use -ggdb3 with gcc-2.96.
2002-06-27 Pontus Skld <>
* commands.c (com_mv): Use lsftp_dc_endglob instead of freeing the
strings in the glob.
(com_chown): Dito.
(put_file_or_folder): Cleaned up types of variables used.
(get_file_or_folder): Dito.
* sftp_bind.c (lsftp_do_cd): Pass a char** to lsftp_do_realpath.
* sftp_bind.h: lsftp_do_realpath takes a char** destptr, not const
* sftp_bind.c (lsftp_do_realpath): Dito.
2002-06-27 Pontus Skld <>
* commands.c (com_umask): Do an explicit cast of the parameter to
* str_utils.c (lsftp_s_strtok): Don't use strndup.
(lsftp_s_strtok): Removed unused variable.
2002-06-27 Pontus Skld <>
* commands.h: Include gnu_stuff.h to get declaration for
canonicalize_file_name compability function.
2002-06-25 Niels Mller <>
* gnu_stuff.c (help_option): Deleted spuriuos comma.
2002-06-25 Pontus Skld <>
* gnu_stuff.c (help_option): Added note about where to report
2002-06-06 Pontus Skld <>
* commands.c (com_lpwd): Don't assume getcwd with extended
functionality, use 8192 as a fallback if PATH_MAX is undefined.
* Check for canonicalize_file_name.
* commands.c (get_file_or_folder): Use canonicalize_file_name
instead of realpath.
(put_file_or_folder): Dito.
* gnu_stuff.c: Added compability function for systems without
* gnu_stuff.h: Declaration of compability function.
2002-06-05 Pontus Skld <>
* str_utils.h: Changed declaration of lsftp_s_strtok, take a
char** to fill in with a new allocated string instead of a buffer
and it's length.
* str_utils.c (lsftp_s_strtok): See above.
* commands.c: Changed to use the new lsftp_s_strtok.
* rl.c (lsftp_rl_completion): Dito.
* sftp_bind.c (lsftp_open_connection): Dito.
2002-05-26 Pontus Skld <>
* rl.c (lsftp_rl_remotefile_generator):
Bugfix. lsftp_unqualify_path returns a pointer into the given
string. We can't free that.
* commands.c (com_cd): Glob absolute paths only.
(com_rm): Dito.
(com_get): Dito.
(com_mv): Dito.
2002-05-25 Pontus Skld <>
* rl.c (lsftp_rl_remotefile_generator): (Hopefully) fixed
completion to behave correctly. Always glob on absolute path and
make them relative if neccessary when returning them.
* sftp_bind.c (lsftp_path_is_absolute): New function.
* sftp_bind.h: Declaration.
2002-05-23 Pontus Skld <>
* sftp_bind.c (lsftp_do_ls): Bail out if globbing failed.
2002-05-15 Pontus Skld <>
* commands.c (get_file_or_folder): Removed debug message.
* dc.c (lsftp_dc_r_startglob): Remove lsftp_unqualify_path calls,
I wonder why I thought they should be there from the beginning.
* commands.c (com_longhelp): New function (almost identical to the
old help function, just ignore the visible bit). Cosmetic fix at
the same time (an empty line inserted before the help for a
(com_help): Rewrote to just display all available commands in
short form (if called without arguments). If arguments are given,
leave it to longhelp.
* commands.h: New function com_longhelp.
* commands.c: Added longhelp entry to available commands, changed
text for help.
2002-05-06 Niels Mller <>
* (CFLAGS): Don't enable -Waggregate-return.
2002-05-05 Niels Mller <>
* acconfig.h: Deleted file.
* Pass no arguments to AM_INIT_AUTOMAKE. Use the
three-argument form of AC_DEFINE.
2002-05-05 Niels Mller <>
* Update for automake-1.6.
2002-04-02 Pontus Skld <>
* sftp-server.c (sftp_process_readdir): Include up to
MAX_DIRENTS_PER_REQUEST files in response to a single
SSH_FXP_READDIR. Should (and seems to) speed up directory
traversal dramatically.
2002-03-27 Niels Mller <>
* werror.c (_fatal): New function.
* sftp.h (SFTP_MAX_PACKET): New constant.
* sftp-test-client.c: Replaced FATAL with calls of fatal.
* sftp_bind.c: Likewise.
* sftp-server.c: Define the werror_program_name constant. Replaced
FATAL with calls of fatal.
* buffer.c: Moved the definitions of struct sftp_input and struct
sftp_output, and selected functions, to separate files io_input
and io_output. The code left in this file does not depend on the
details of those structs.
* (shared_src): New make variable listing
source files used by all clients and servers. Added io_input and
* io.h (sftp_make_output): New file with declarations that doesn't
fit in buffer.h, in particular the constructors for sftp_input and
* lsftp.c: Include werror.h, and define
* io_output.c: New file, with all the functions that need to knwo
about the internals of struct sftp_output.
* io_input.c: New file, with all the functions that need to knwo
about the internals of struct sftp_input.
* misc_fun.c (FATAL): Deleted function, use the fatal
function in werror.c instead.
2002-03-26 Pontus Skld <>
* sftp-server.c (MAX_DIRENTS_PER_REQUEST): New constant, the
maximum number of directory entries to include in response to one
* buffer.c (sftp_read_packet): Cosmetic fixes and a bugfix (if
sftp_get_data returns -1, it's not ok).
* gnu_stuff.c (help_option): Added an help text. It needs work but
is (hopefully) better than nothing.
2002-03-25 Pontus Skld <>
* buffer.c (sftp_read_packet): Loop to read data.
(sftp_get_data): Likewise.
(sftp_write_packet): Loop to write data.
* sftp_c.c (sftp_ls_main): Check return values from
* sftp-test-client.c (fork_server): Use fds, not FILE*s.
* sftp-server.c (sftp_init): Use fds, not FILE*s.
(main): Use fds STDIN_FILENO and STDOUT_FILENO instead of FILE*s
stdin and stdout.
* buffer.c: We need unistd.h to have read and write defined. And
we want errno to, so we need errno.h
(sftp_make_input): Use fd, not FILE*
(sftp_make_output): Likewise.
* sftp_bind.c (lsftp_close_connection): Use fd_to_transport and
fd_from_transport instead of to_transport and from_transport.
putting options for before and after in CPPFLAGS. Solves problem
with spaces in before- and after-opts.
* sftp_bind.c (lsftp_open_connection): Dont't use FILE* but fds
(lsftp_handshake): Use read instead of fread, and pass fds to
sftp_make_input and sftp_make_output.
* buffer.c (struct sftp_input): Use fd instead of FILE*.
(struct sftp_output): Likewise.
(sftp_get_data): Use read instead of fread.
(sftp_read_packet): Likewise.
(sftp_write_packet): Use write instead of fwrite.
* buffer.h: Changed prototype of sftp_make_input and
sftp_make_output to use fds instead of files.
2002-03-24 Pontus Skld <>
* Added --no-pty to default options if we're using
* commands.c (com_quit): Only call com_close if connected.
2002-03-23 Pontus Skld <>
* Removed -G from default after options.
2002-03-23 Pontus Skld <>
* (termcap): Added check for libtermcap. This should
help systems with a dynamically linked libreadline that depends on
2002-03-21 Pontus Skld <>
* Almost completely rewrote the checks for readline
and history, now actually uses the results of the library checks.
* rl.c: Use WITH_READLINE and WITH_HISTORY instead of header
* rl.h: Use <readline.h> and <history.h> if available.
2002-03-19 Pontus Skld <>
* sftp-server should go to sbin (or should it go to
libexec? Not bin anyway).
2002-03-18 Niels Mller <>
* commands.c (com_umask): Use unsigned char.
(com_chown): Likewise.
(com_chgrp): Likewise.
(handle_command): Unsigned char argument.
2002-03-14 Pontus <>
* Changed version number from 1.0 to 1.0-pre to make
sure noone thinks "to highly" of the code. Also removed debug code
that shouldn't have been checked in.
2002-02-27 Niels Mller <>
* gnu_stuff.c: Include stdlib.h and string.h.
2002-02-25 Pontus <>
* lsftp.c (main): Readded support for GNU-thingies (was lost
somehow some time ago).
* gnu_stuff.c (lsftp_welcome): Included Niels in welcome message.
(version_option): dito.
(do_gnu_stuff): New function to check for GNU-thingies.
* Added ugly fix to detect if we're part of the main
lsh distribution. If we are, assume $bindir/lshg works
* sftp_bind.c (lsftp_install_lsftp_cb): Return a pointer to the
callback instead.
(lsftp_do_rm): Adopted for new use of lsftp_install_lsftp_cb.
(lsftp_do_get): dito.
(lsftp_do_ls): dito.
(lsftp_do_chmod): dito.
(lsftp_do_mv): dito.
(lsftp_do_realpath): dito.
(string_comparer): Changed type for arguments from char** to const
* sftp_bind.h: Changed return type of lsftp_install_lsftp_cb from
int to struct lsftp_callback*.
* sftp_bind.c (lsftp_lsftp_cb_init): Fixed a bug using the same
memory both for sftp_cbs and lsftp_cbs, mumble!
2002-02-24 Pontus <>
* sftp_bind.c (lsftp_remove_lsftp_cb): Use lsftp_nullcb to clean
out callback.
(lsftp_handle_packet): Changed variable i (used twice) to r.
* sftp_bind.h: New function lsftp_nullcb.
* sftp_bind.c (lsftp_compact_sftp_cbs): Fixed a bug that would
loose callbacks before a hole if there were any more.
(lsftp_compact_lsftp_cbs): Fixed the same bug for struct
(lsftp_handle_packet): Clean out old state after callbacks, should
hopefully make things more robust.
(lsftp_nullcb): New function to clean a struct lsftp_callback.
* dc.c (lsftp_dc_init): Check that malloc succeeded before using
the memory (duh!).
* sftp_bind.c: Removed obsolete default callback array sizes.
* dc.c: Removed obsolete default dircache size.
* lsftp.c (main): Always init the callbacks.
* sftp_bind.c (lsftp_lsftp_cb_init): Also clear option flags.
* lsftp.c (main): Added some comments.
* sftp_bind.c (lsftp_do_put): Added some comments.
2002-02-22 Pontus <>
* (lsh_cv_c_attribute): Removed obsolete checks for
behaviour of stat and lstat.
2002-02-12 Pontus <>
* commands.c (com_mv): Didn't properly check for error in return value of
2002-02-11 Pontus <>
* sftp-server.c (sftp_process_realpath): Added deugging message.
(sftp_process): Added debugging message.
(sftp_process_symlink): Added debugging message.
* buffer.c (sftp_read_packet): If called with data left, flush
(read and throw away) remaining data.
* Created new as a merge of the from lsftp and the sftp package.
* Started new Changelog in sftp.
SUBDIRS = . testsuite
# Needed for finding the nettle include files in the source tree
# and nettle-stdint.h in the build tree.
AM_CPPFLAGS = -I$(srcdir)/.. -I../nettle
bin_PROGRAMS = lsftp
sbin_PROGRAMS = sftp-server
noinst_PROGRAMS = sftp-test-client dump-hex
man_MANS = lsftp.1 sftp-server.8
EXTRA_DIST = buffer.h client.h filemode.h idcache.h sftp.h werror.h xmalloc.h \
shared_src = buffer.c buffer.h io_input.c io_output.c io.h \
xmalloc.c werror.h werror.c
sftp_server_SOURCES = sftp-server.c $(shared_src) filemode.c idcache.c
sftp_test_client_SOURCES = sftp-test-client.c $(shared_src) client.c
lsftp_SOURCES = commands.c commands.h lsftp.c rl.c rl.h \
sftp_c.c sftp_c.h sftp.h sftp_bind.h sftp_bind.c \
str_utils.c str_utils.h lsftp.h dc.c dc.h \
gnu_stuff.h gnu_stuff.c misc_fun.c misc_fun.h \
/* buffer.c
* Reading and writing sftp data.
/* lsh, an implementation of the ssh protocol
* Copyright (C) 2001 Niels Mller
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
# include "config.h"
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include "buffer.h"
#include "xmalloc.h"
#include "sftp.h"
/* Input */
#define GET_DATA(i, buf) \
(sftp_get_data((i), sizeof((buf)), (buf)))
sftp_get_uint8(struct sftp_input *i, uint8_t *value)