Commit f0e01e98 authored by Bart Martens's avatar Bart Martens

Import zssh_1.5c.debian.1.orig.tar.gz

[dgit import orig zssh_1.5c.debian.1.orig.tar.gz]
parents
mll@localhost.localdomain.27687:1062340461
\ No newline at end of file
version 1.5c
Jim Grishaw <jgrishaw@myrealbox.com>
- fixes for cygwin
- added tty test suite (test/ directory)
-----------------------------
version 1.5b
Richard Hoyle <rhoyle@cix.co.uk>
- fix problem with initial flush of tty on some systems (slackware 9.0)
- cleanup, got rid of c++ style comments, fixed warnings
-----------------------------
version 1.5a
- now compiles with readline v4.2
- works on MacOS X
config:
- detect readline headers
- fixed configure.in bug (-ltermcap not needed in AC_CHECK_LIB) (Jeff Squyres)
-----------------------------
v1.5
- now compiles under solaris
- added hostname in prompt
- fixed tilde expansion: used to done by glob()'s GLOB_TILDE option
which is not supported everywhere, and is buggy
( substitutes in ~/a/b but not in ~/a/b/c !)
some more code now replaces this ...
- improved completion : builtin, tilde and pathname completions
- cleaned/rewrote openpty.c
- ask user whether to continue after failed grantpt()
or if using a tty with dangerous perms
- check that old controlling tty has been dropped
- under linux use /dev/ptmx if available instead of /dev/pty*
- should be easier to port
- added 'suspend' and 'disconnect' builtins
- fixed race conditions due to fork()
- fixed signal handlers : they have to reset themselves so that it works
everywhere ...
- fixed some memory leaks
- cleaning cleaning cleaning
- added '--force' option to avoid being asked questions (doesn't suppres
warnings though)
- added '--' option to allow separation of zssh options from ssh options
- handle quotes in --shell option, so that we can now do some really weird
stuff such as:
zssh -s "sh -c 'ps aux | grep ssh'"
config:
- detect pty functions/devices available
- added '--disable-readline' option of configure to allow building zssh
without libreadline
- use -Wall compiler option if available
-----------------------------
v1.4
- added escape key help msg
- fixed rpm spec file bug
- added escape builtin : allows to change the escape key
- added -s switch to allow the remote shell to be changed
- fixed bug with child handling (delay in sfork)
- added hook builtin : allows to hook any proram to the tty/pty,
not just rz and sz
- added ztelnet hard link : remote logging prg defaults to "telnet -8 -E"
instead of "ssh -e none"
------------------------------
v1.3
- Fixed a bug that cause the app to segfault under FreeBSD
(globbing.c:27)
- Added redefinable escape sequence (environment variable and command
line arg)
- tilde expansion is now performed (provided the GLOB_TILDE flag is supported
by the glob(3) function)
------------------------------
v1.2*
- Install problem fixes mainly
------------------------------
v1.1
- Changed escape sequence from Alt-1 to ^@ (C-space)
Alt-1 is bound by default under window maker
and Ctrl-x sequences will be easier to customize.
------------------------------
v1.0
- Removed sending of "rz" command to the remote shell,
it seems it works just fine without !
- Fixed ^D in local shell... caused segfault
- ^C works when sz-ing (^X sent to interrupt remote rz)
rz-ing not tested yet
- Added test for both text and X11 Alt-1 key codes
- fixed bug in shell escapes handling : used to exit on parse error !
- Added builtin 'repeat'
- Now correctly flushes output after ^C during transfert
The tty should no longer be polluted !
This diff is collapsed.
zssh FAQ
------------------------
1) It doesn't even compile ! What should i do ?
Chances are your OS has not been tested yet. First delete config.h.in
and remake it using autoheader (you need autoconf installed). The
configure script can be regenerated using autoconf ...
2) It doesn't seem to work ! pressing ^@ (C-space) is ineffective.
You are maybe using a console/terminal emulator that does not allow
you to generate this code (Gnome Terminal is affected), or your window
manager is using this key, so underlying applications won't ever see
it ...
Try using another terminal emulator/escape sequence.
To change the escape sequence, either define the ZSSHESCAPE variable
or use the -z option for zssh.
3) It just doesn't transmit any file, though i invoke the sz/rz commands as
explained in the man page.
zssh depends on 3 other binaries to operate properly : ssh, sz and rz.
ssh is run from the local machine, sz and rz are run from _both_ the
local and remote machine.
Actually, when downloading remote runs sz, local runs rz
uploading local runs sz, remote runs rz.
zssh thus depends on the rz/sz package to be working on both machines,
_and_ of compatible versions. Make sure the problem does not come from
sz/rz before suspecting zssh.
4) I don't get my shell prompt back after file transfer completes !!!
Just press return 2 or 3 times and stay calm =)
5) File transfer is initiated but never completes
( ie a line like :
Bytes Sent: 38144/4610624 BPS:3424 ETA 22:15
or
Bytes Sent: 0/ 513 BPS:0 ETA 00:00 Retry 0: Got ZCAN
can be seen, but transfer never completes
)
Chances are the pty/tty on one of the systems are not 8-bit clean.
(Linux is 8-bit clean, NetBSD is not)
Using the -e (escape) option of sz should solve this problem.
6) It still doesn't work
Beware that any program interferring (ie non transparent) with the tty/pty
chain will likely prevent file tranfers from working.
For example, running 'screen' on the REMOTE side will prevent zssh from
working properly because it will be messing things between sz and rz :
------------------------REMOTE---------------------- ----------------------------LOCAL---------------------------
**************
/ ** sz **
****** ********** ******** ******* |/ /| **************
** rz ** <tty=pty> ** screen ** <tty=pty> ** sshd ** <==ssh_channel==> ** ssh ** <tty=pty> / <initial_tty=...
****** ********** ******** ******* *************** /
** zssh output **
***************
(screen on the local side is no problem of course)
Dependencies :
libreadline, libtermcap and their headers must be properly installed
(if you're using rpm, make sure the packages
readline, readline-devel, libtermcap, libtermcap-devel
are installed)
****************************************************************************
Just follow the usual steps :
> ./configure
(edit Makefile)
> make
> su
# make install
****************************************************************************
Testing tools:
the test/ directory has a few tools to trace tty problems.
****************************************************************************
NetBSD
------
you may have to tell configure where to find libreadline,
which is usually in /usr/pkg/lib :
CFLAGS=-I/usr/pkg/include LIBS=-L/usr/pkg/lib ./configure
****************************************************************************
If compilation fails, edit the Makefile produced by the configure script
to ensure it is correct for your system.
If you want to install the rz/sz commands from the lrzsz package
(probably because you don't have them, or they don't work), you'll
also have to :
> make lrzsz
> su
# make lrzsz_install
# make lrzsz_links (make symlinks : sz -> lsz, rz -> lrz ...)
** Also, make _sure_ the new programs are run and not the old ones
** -> Check your path / (re)move the old ones / do as you wish
** `whereis sz' should answer /usr/local/bin/sz (or where-ever you put it)
Also remember that sz and rz need to be installed on the remote host and
(preferably) be somewhat compatible with your local versions for the magic
to work. Hopefully, rz and sz will already be there and working =)
arch: tested on
- linux
- NetBSD
- OpenBSD
- FreeBSD
you're on your own anywhere else ... (though POSIX should be ok)
other make rules :
clean : cleans temporary and binary files
distclean : even removes autoconf files
config.h, Makefile
uninstall : remove installed files
#
# Makefile.in for zssh
#
# Made by Matthieu Lucotte
# Login <gounter@users.sourceforge.net>
#
# Started on Thu Jun 29 19:04:08 2000 Matthieu Lucotte
# Last update Mon Sep 22 22:18:54 2003
#
#System specific vars
prefix = @prefix@
exec_prefix = @exec_prefix@
MAKE = @MAKE@
INSTALL = @INSTALL@
TAR = @TAR@
AR = @AR@
RANLIB = @RANLIB@
CC = @CC@
CFLAGS = @CFLAGS@ @DEFS@ @EXTRA_CFLAGS@
CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@ @EXTRA_LIBS@
LDFLAGS = @LDFLAGS@
EXTRA_DEPS = @EXTRA_DEPS@
#uncomment this for debug infos
#CFLAGS += -DDEBUG
# old stuff. safely ignore.
#
# uncomment this if your keyboard doesn't send combined key codes packed
# The ALT-1 key will not be detected in this case, unless DUMB_KEYBOARD
# is defined
#CFLAGS += -DDUMB_KEYBOARD
#End of system specific vars
NAME = zssh
VERSION = $(shell cat VERSION)
PRGS = zssh ztelnet
MANS = $(PRGS:=.1)
# Files to be installed
FILES = $(PRGS) $(MANS)
SRC = completion.c doit.c escape.c escape_multi.c globbing.c init.c main.c misc.c openpty.c pc_test_escapes.c quote_removal.c signal.c split_words.c tilde_expansion.c util.c zmodem.c zmodem_act.c
OBJS = $(SRC:.c=.o)
INCL = config.h parse.h zssh.h
# archive and packaging stuff
# only used if you do a 'make rpm'
RPMDIR = /usr/src/redhat
# where to write archives
BACKDIR = ${HOME}/backup
# name of symlink to BACKDIR
BACKLINK = backup
# archives are chown-ed to BACKOWNER:BACKGROUP
BACKOWNER = 500
BACKGROUP = $(BACKOWNER)
TGZ = $(NAME)-$(VERSION).tgz
RPMSPEC = $(NAME).spec
RPMBUILDARCH = $(shell rpm --showrc | grep "^build arch" | cut -d: -f2 | xargs echo )
all: $(PRGS)
$(NAME) : $(EXTRA_DEPS) version.h ${OBJS}
$(CC) -o $(NAME) $(LDFLAGS) $(OBJS) $(LIBS)
ztelnet : $(NAME)
@-rm $@ > /dev/null 2>&1
ln $(NAME) $@
install :
strip $(NAME)
$(INSTALL) -m 0711 zssh @bindir@
ln -f @bindir@/zssh @bindir@/ztelnet
$(INSTALL) -m 0644 $(MANS) @mandir@/man1
uninstall :
-cd @bindir@ && rm $(PRGS)
-cd @mandir@/man1 && rm $(MANS)
fake_readline : force
-cd fake_readline && $(MAKE)
lrzsz :
cd lrzsz-0.12.20 && ./configure --prefix=@prefix@
cd lrzsz-0.12.20 && $(MAKE)
lrzsz_links :
ln -s @bindir@/lrz @bindir@/rz
ln -s @bindir@/lsz @bindir@/sz
ln -s @bindir@/lrb @bindir@/rb
ln -s @bindir@/lsb @bindir@/sb
ln -s @bindir@/lrx @bindir@/rx
ln -s @bindir@/lsx @bindir@/sx
lrzsz_install :
cd lrzsz-0.12.20 && $(MAKE) install
# create source archive in ~/backup
tgz $(TGZ) : distclean force
@cdir=`pwd` && cdir=`basename $$cdir` && cd .. && \
echo "#################################################" && \
echo $(TAR) -cvzf "$(BACKDIR)/$(TGZ)" "$$cdir" && \
echo "#################################################" && echo -n "Press return" && read f && \
$(TAR) -cvzf "$(BACKDIR)/$(TGZ)" "$$cdir"
ln -sf $(BACKDIR) $(BACKLINK)
# create rpm and srpm
rpm : $(RPMSPEC)
@echo -n "Be sure to 'make tgz' before 'make rpm'. Usually must be root to succeed. Press return if ok" && read f
cp -f $(BACKLINK)/$(TGZ) $(RPMDIR)/SOURCES
rpm -ba $(RPMSPEC)
$(INSTALL) -o $(BACKOWNER) -g $(BACKGROUP) -m 600 $(RPMDIR)/RPMS/$(RPMBUILDARCH)/$(NAME)-$(VERSION)-1.$(RPMBUILDARCH).rpm $(BACKLINK)
$(INSTALL) -o $(BACKOWNER) -g $(BACKGROUP) -m 600 $(RPMDIR)/SRPMS/$(NAME)-$(VERSION)-1.src.rpm $(BACKLINK)
$(RPMSPEC) : $(RPMSPEC:.spec=.spec.tpl)
echo "%define ZSSHVER $(VERSION)" > $(RPMSPEC)
cat $(RPMSPEC:.spec=.spec.tpl) >> $(RPMSPEC)
version.h : force
echo '#define ZSSH_VERSION "' `cat VERSION` ', built' `date` '"' > version.h
fun.h : $(SRC)
protos -o fun.h $(SRC)
TAGS :
etags *.[ch]
new : clean all
clean :
-rm *.o *~ *.a \#*\# core $(PRGS) typescript nohup.out $(RPMSPEC) $(BACKLINK)
distclean : clean
-rm Makefile config.cache config.status config.log config.scan config.h TAGS
-(cd lrzsz-0.12.20 && $(MAKE) distclean)
-(cd fake_readline && $(MAKE) distclean)
-(cd test && $(MAKE) distclean)
autoconf:
autoconf
autoheader
force :
$(OBJS) : $(INCL)
init.o : version.h
zssh
--------------------
zssh (Zmodem SSH) a program for interactively transferring files to a
remote machine while using the secure shell ( ssh ). It is intended to be
a convenient alternative to scp , allowing to transfer files without having
to open another session and re-authenticate oneself.
Files are transferred through the zmodem protocol, using the rz and sz
commands. If you don't already have them, the sz/rz programs can be
installed from Uwe Ohse's lrzsz package included in this directory.
for more information, see http://www.ohse.de/uwe/software/lrzsz.html
the readline library is also required.
See the file COPYING for copyright and warranty information.
See the file INSTALL for installation information.
See also the FAQ
Supported architectures currently include :
- linux
- NetBSD
- OpenBSD
- FreeBSD
but POSIX compliant OSes should do.
\ No newline at end of file
** DOC **
*********
todo:
- update INSTALL (configure arguments)
- and add a generic INSTALL file
** CODE **
**********
todo:
- find a solution for *bsd users
-> should neither be insecure, nor require suid privileges (...)
- add support for irix
(segfaults mysteriously for now ...)
- detect if telnet accepts '-8' and do something if this is not the case
- add ZSSH_FORCE env variable
done:
- check for readline headers in configure script
- works on MacOS X:
- updated config: readline depends on (n)curses instead of termcap on some systems
- don't use getpgid(): some systems don't have it
- now compiles with readline v4.2
/*
** acconfig.h
**
** Made by (Matthieu Lucotte)
** Login <gounter@users.sourceforge.net>
**
** Started on Sat Oct 6 02:21:45 2001 Matthieu Lucotte
** Last update Thu Oct 11 16:51:21 2001 Matthieu Lucotte
*/
/*
* acconfig.h - template used by autoheader to create config.h.in
* config.h.in - used by autoconf to create config.h
* config.h - created by autoconf; contains defines generated by autoconf
*/
@TOP@
/* Define if you have SYSV-style /dev/ptmx and /dev/pts/. */
#undef HAVE_DEV_PTMX
/* Define this if you have getpseudotty() (DYNIX/ptx 2.1) */
#undef HAVE_GETPSEUDOTTY
/* Define if you have /dev/pts and /dev/ptc devices (as in AIX). */
#undef HAVE_DEV_PTS_AND_PTC
/* Define this if you have sco-style pty:s (ptyp0, ..., ptyp9, ptyp10...) */
#undef HAVE_DEV_PTYP10
/* Define this if you have libreadline v4.2 or greater */
#undef HAVE_READLINE_4_2_OR_GREATER
dnl stolen and modified from readline, wich itself seems to have taken it from bash
AC_DEFUN(BASH_CHECK_LIB_TERMCAP,
[
if test "X$bash_cv_termcap_lib" = "X"; then
_bash_needmsg=yes
else
AC_MSG_CHECKING(which library has the termcap functions)
_bash_needmsg=
fi
AC_CACHE_VAL(bash_cv_termcap_lib,
[AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
[AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
[AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
bash_cv_termcap_lib=libtermcap)])])])
if test "X$_bash_needmsg" = "Xyes"; then
AC_MSG_CHECKING(which library has the termcap functions)
fi
AC_MSG_RESULT(using $bash_cv_termcap_lib)
dnl if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
dnl LDFLAGS="$LDFLAGS -L./lib/termcap"
dnl TERMCAP_LIB="./lib/termcap/libtermcap.a"
dnl TERMCAP_DEP="./lib/termcap/libtermcap.a"
dnl elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
if test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
TERMCAP_LIB=-ltermcap
TERMCAP_DEP=
elif test $bash_cv_termcap_lib = libncurses; then
TERMCAP_LIB=-lncurses
TERMCAP_DEP=
else
TERMCAP_LIB=-lcurses
TERMCAP_DEP=
fi
])
/*
** completion.c
**
** Made by (Matthieu Lucotte)
** Login <gounter@users.sourceforge.net>
**
** Started on Sun Oct 7 01:43:23 2001 Matthieu Lucotte
** Last update Mon Sep 1 22:57:07 2003
*/
#include "zssh.h"
#include <readline/readline.h>
#include <readline/history.h>
#ifdef HAVE_LIBREADLINE
/* for readline < 4.2 we have to use username_completion_function
* 4.2 we have to use rl_username_completion_function
* and so on ...
*/
#ifdef HAVE_READLINE_4_2_OR_GREATER
#define RL_USERNAME_COMPLETION_FUNCTION rl_username_completion_function
#define RL_FILENAME_COMPLETION_FUNCTION rl_filename_completion_function
#define RL_COMPLETION_MATCHES rl_completion_matches
#else /* readline < 4.2 */
#define RL_USERNAME_COMPLETION_FUNCTION username_completion_function
#define RL_FILENAME_COMPLETION_FUNCTION filename_completion_function
#define RL_COMPLETION_MATCHES completion_matches
#endif
/* **************************************************************** */
/* */
/* Interface to Readline Completion */
/* */
/* **************************************************************** */
/* Tell the GNU Readline library how to complete. We want to try to complete
on command names if this is the first word in the line, or on filenames
if not. */
void initialize_readline()
{
#ifdef DEBUG
printf("Using readline library version: %s\n", rl_library_version);
#endif
/* Allow conditional parsing of the ~/.inputrc file. */
rl_readline_name = "zssh";
/* inhibit default filename completion
so that if zssh_completion() fails nothing is completed */
rl_completion_entry_function = fake_generator;
/* Tell the completer that we want a crack first. */
rl_attempted_completion_function = (CPPFunction *) zssh_completion;
}
/* Attempt to complete on the contents of TEXT. START and END bound the
region of rl_line_buffer that contains the word to complete. TEXT is
the word to complete. We can use the entire contents of rl_line_buffer
in case we want to do some simple parsing. Return the array of matches,
or NULL if there aren't any. */
char **zssh_completion(text, start, end)
char *text;
int start;
int end;
{
char **matches;
matches = (char **)NULL;
/* printf("text: >%s<\n", text); */
/* If this word is at the start of the line, then it is a command
to complete. Otherwise it is the name of a file in the current
directory. */
if (!start)
matches = RL_COMPLETION_MATCHES(text, command_generator);
else if (text[0] == '~' && !strchr(text, '/'))
matches = RL_COMPLETION_MATCHES(text, RL_USERNAME_COMPLETION_FUNCTION);
/* matches = completion_matches(text, tilde_generator); */
else
matches = RL_COMPLETION_MATCHES(text, RL_FILENAME_COMPLETION_FUNCTION);
return (matches);
}
/* Generator function for command completion. STATE lets us know whether
to start from scratch; without any state (i.e. STATE == 0), then we
start at the top of the list. */
char *command_generator(text, state)
const char *text;
int state;
{
static int list_index, len;
char *name;
/* If this is a new word to complete, initialize now. This includes
saving the length of TEXT for efficiency, and initializing the index
variable to 0. */
if (!state)
{
list_index = 0;
len = strlen (text);
}
/* Return the next name which partially matches from the command list. */
while ((name = cmdtab[list_index].name))
{
list_index++;
if (strncmp(name, text, len) == 0)
return (strdup(name));
}
/* If no names matched, then return NULL. */
return ((char *)NULL);
}
/* Generator function for tilde completion. STATE lets us know whether
to start from scratch; without any state (i.e. STATE == 0), then we
start at the top of the list. */
#if 0
char *tilde_generator(text, state)
char *text;
int state;
{
struct passwd *pwd;
static int len;
/* If this is a new word to complete, initialize now. This includes
* saving the length of TEXT for efficiency, and initializing the index
* variable to 0.
*/
if (!state)
{
pwd = getpwent();
setpwent();
len = strlen(text + 1);
}
rl_filename_completion_desired = 1;
/* Return the next homedir which partially matches. */
while ((pwd = getpwent()))
{
if (strncmp(pwd->pw_name, text + 1, len) == 0)
return (str_cat("~", pwd->pw_name));
}
/* If no names matched, then return NULL. */
return ((char *)NULL);
}
#endif /* 0 */
char *fake_generator(text, state)
const char *text;
int state;
{
return (0);
}
#endif /* HAVE_LIBREADLINE */
/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
/*
** acconfig.h
**
** Made by (Matthieu Lucotte)
** Login <gounter@users.sourceforge.net>
**
** Started on Sat Oct 6 02:21:45 2001 Matthieu Lucotte
** Last update Thu Oct 11 16:51:21 2001 Matthieu Lucotte
*/
/*
* acconfig.h - template used by autoheader to create config.h.in
* config.h.in - used by autoconf to create config.h
* config.h - created by autoconf; contains defines generated by autoconf
*/
/* Define if the `getpgrp' function takes no argument. */
#undef GETPGRP_VOID
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you have SYSV-style /dev/ptmx and /dev/pts/. */
#undef HAVE_DEV_PTMX
/* Define this if you have getpseudotty() (DYNIX/ptx 2.1) */
#undef HAVE_GETPSEUDOTTY