--- autossh-1.4c.orig/debian/docs
+++ autossh-1.4c/debian/docs
@@ -0,0 +1 @@
+README
--- autossh-1.4c.orig/debian/logcheck.ignore.workstation
+++ autossh-1.4c/debian/logcheck.ignore.workstation
@@ -0,0 +1,4 @@
+^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ autossh\[[[:digit:]]+\]: starting ssh \(count [[:digit:]]+\)$
+^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ autossh\[[[:digit:]]+\]: ssh child pid is [[:digit:]]+$
+^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ autossh\[[[:digit:]]+\]: ssh exited prematurely with status [[:digit:]]+; autossh exiting$
+^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ autossh\[[[:digit:]]+\]: received signal to exit \([[:digit:]]+\)$
--- autossh-1.4c.orig/debian/copyright
+++ autossh-1.4c/debian/copyright
@@ -0,0 +1,33 @@
+This package was debianized by Filippo Giunchedi <filippo@esaurito.net> on
+Mon, 23 Dec 2002 16:36:39 +0000.
+
+It was downloaded from http://www.harding.motd.ca/autossh/
+
+Upstream Author: Carson Harding <harding@motd.ca>
+
+Copyright:
+
+ Copyright (c) Carson Harding, 2002.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are freely permitted.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+debian/rscreen is
+
+ Copyright (C) Carson Harding, 2002.
+ Copyright (C) Axel Beckert, 2011.
+
+and licensed under the same terms as autossh itself and the original
+rscreen by Carson Harding.
--- autossh-1.4c.orig/debian/autossh_wrapper
+++ autossh-1.4c/debian/autossh_wrapper
@@ -0,0 +1,54 @@
+#!/bin/sh
+# little wrapper to choose a random port for autossh, falling back to $fallback_port
+
+fallback_port="21021"
+tcpstat="/proc/net/tcp"
+
+# take an hex port and check whether it is in use (i.e. locally bound) in
+# $tcpstat
+# unix command semantics: if in use return 0 else return 1
+port_in_use() {
+ if egrep -q "^[0-9 ]+: [0-9A-F]{8}:$1" $tcpstat ; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+echo "$@" | egrep -q -- '-f?M ?[0-9]+' # backward compatibility, skip guess if -M is passed
+
+if [ $? -gt 0 ] && [ -z "$AUTOSSH_PORT" ]; then
+ portguess=""
+ if [ -r "/dev/urandom" ] && [ -r "$tcpstat" ]; then
+ for t in $(seq 1 42); do
+ # get a random hex
+ randport=$( od -x -N2 -An /dev/urandom | tr -d ' ' )
+
+ # increase it a little "bit"
+ randport=$( /usr/bin/printf "%04x" $(( 0x$randport | 0x8000 )) )
+ randport_1=$( /usr/bin/printf "%04x" $(( 0x$randport + 1 )) )
+
+ # check if port is in use, possibile race condition between here
+ # and the exec
+ if ! port_in_use $randport && ! port_in_use $randport_1; then
+ portguess=$(( 0x$randport ))
+ break
+ fi
+ done
+ fi
+
+ if [ -z "$portguess" ]; then
+ fallback=$( /usr/bin/printf "%04x" $fallback_port )
+ fallback_1=$( /usr/bin/printf "%04x" $(( 0x$fallback + 1 )) )
+ if ! port_in_use $fallback && ! port_in_use $fallback_1; then
+ portguess=$fallback_port
+ else
+ echo "unable to find a suitable tunnel port"
+ exit 1
+ fi
+ fi
+
+ export AUTOSSH_PORT="$portguess"
+fi
+
+exec /usr/lib/autossh/autossh "$@"
--- autossh-1.4c.orig/debian/dirs
+++ autossh-1.4c/debian/dirs
@@ -0,0 +1,4 @@
+usr
+usr/bin
+usr/share/doc/autossh/examples
+usr/lib/autossh
--- autossh-1.4c.orig/debian/autossh.dirs
+++ autossh-1.4c/debian/autossh.dirs
@@ -0,0 +1,3 @@
+usr/share/man/man1
+usr/lib/autossh
+usr/bin
\ No newline at end of file
--- autossh-1.4c.orig/debian/manpages
+++ autossh-1.4c/debian/manpages
@@ -0,0 +1 @@
+autossh.1
--- autossh-1.4c.orig/debian/install
+++ autossh-1.4c/debian/install
@@ -0,0 +1,3 @@
+autossh usr/lib/autossh
+debian/autossh-argv0 usr/bin
+debian/rscreen usr/bin
--- autossh-1.4c.orig/debian/README.Debian
+++ autossh-1.4c/debian/README.Debian
@@ -0,0 +1,12 @@
+autossh for Debian README
+=========================
+autossh is wrapped to choose a random port or fall back to 21021 the real
+binary is /usr/lib/autossh/autossh
+
+In this version of autossh the commandline switch -M overrides AUTOSSH_PORT
+environment, as opposed to default upstream behaviour (see
+http://bugs.debian.org/238150#msg6 and following)
+
+Note: if your ssh client/server version is recent enough you can obtain similar
+behaviour by setting ClientAliveCountMax and ServerAliveInterval in
+/etc/ssh/sshd_config. See sshd_config(5).
--- autossh-1.4c.orig/debian/rules
+++ autossh-1.4c/debian/rules
@@ -0,0 +1,95 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+else
+CROSS= --build $(DEB_BUILD_GNU_TYPE)
+endif
+
+include /usr/share/quilt/quilt.make
+
+configure: patch
+
+config.status: configure
+ dh_testdir
+ dh_autotools-dev_updateconfig
+ # Add here commands to configure the package.
+ ./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
+ sed -e 's/-lnsl//g' -i Makefile
+
+
+build: build-arch build-indep
+build-arch: build-stamp
+build-indep: build-stamp
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ #docbook-to-man debian/autossh.sgml > autossh.1
+
+ touch $@
+
+clean: unpatch
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ [ ! -f Makefile ] || $(MAKE) distclean
+ dh_autotools-dev_restoreconfig
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_prep
+ dh_installdirs
+
+ # Add here commands to install the package into debian/autossh.
+ dh_install
+
+ install -m0755 $(CURDIR)/debian/autossh_wrapper \
+ $(CURDIR)/debian/autossh/usr/bin/autossh
+
+ ln -s ssh-argv0.1.gz \
+ $(CURDIR)/debian/autossh/usr/share/man/man1/autossh-argv0.1.gz
+ ln -s rscreen $(CURDIR)/debian/autossh/usr/bin/rtmux
+ ln -s rscreen $(CURDIR)/debian/autossh/usr/bin/ruscreen
+
+ dh_installlogcheck
+
+# Build architecture-independent files here.
+binary-indep: install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs CHANGES
+ dh_installdocs
+ dh_installexamples
+# dh_install
+ dh_installman
+ dh_lintian
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- autossh-1.4c.orig/debian/changelog
+++ autossh-1.4c/debian/changelog
@@ -0,0 +1,241 @@
+autossh (1.4c-1) unstable; urgency=low
+
+ * New upstream bugfix release
+ - Drop patch 000_configure_with-ssh_fix.diff (applied upstream)
+ - Refreshed patches 010_override_cmdline_port.diff and
+ 040_manpage_debian.diff
+ - Removed hunks from patch 030_manpage_fix.diff which have been
+ applied upstream, refresh the rest.
+ * Add recommended build-arch and build-indep targets to debian/rules,
+ fixes lintian warning debian-rules-missing-recommended-target.
+ * Add lintian override for package-contains-broken-symlink (as that
+ symlink points to a file from a dependency)
+ * Make debian/rscreen to also work with tmux.
+ + Install symbolic links rtmux and ruscreen (for enforcing UTF-8) to
+ rscreen
+ + Mention debian/rscreen in debian/copyright.
+ * Make debian/rscreen and its symlinks source /etc/${BASENAME}rc and
+ ~/.${BASENAME}rc
+ * Make debian/rscreen honour -h and --help, make usage message more verbose.
+
+ -- Axel Beckert <abe@debian.org> Sat, 19 Nov 2011 03:41:58 +0100
+
+autossh (1.4b-6) unstable; urgency=low
+
+ * Build-Depend on openssh-client to allow configure to find the path to
+ the ssh binary.
+
+ -- Axel Beckert <abe@debian.org> Mon, 25 Jul 2011 02:28:28 +0200
+
+autossh (1.4b-5) unstable; urgency=low
+
+ * New Maintainers (Closes: #605423)
+ + Move to Git (new Vcs-* headers)
+ * Bump Standards-Version to 3.9.2 (no changes)
+ * Add "Enhances: openssh-client, ssh-client"
+ * Move from cdbs+simple-patchsys to debhelper+quilt
+ + Refreshed all patches and added descriptions
+ + Update build dependencies appropriately
+ + Install autossh and autossh-argv0 via dh_install
+ + Install logcheck stuff via dh_installlogcheck
+ + Use dh_autotools-dev_*config instead of manually handling
+ config.{sub,guess}
+ * Remove deletion of no more created directories and files
+ * Install (slightly modified) example script rscreen to /usr/bin
+ (LP: #410357)
+ * Do not link against libnsl (fixes dpkg-shlibdeps warning)
+ * Add README.source from /usr/share/doc/quilt/ to make Lintian happy
+
+ -- Axel Beckert <abe@debian.org> Mon, 25 Jul 2011 01:24:55 +0200
+
+autossh (1.4b-4) unstable; urgency=low
+
+ [ Thorsten Glaser ]
+ * debian/patches/000_configure_with-ssh_fix.diff: Remove, create
+ a proper fix in debian/patches/000_configure_fix.diff (the closing
+ parenthesis of AC_HELP_STRING was placed wrong)
+ * debian/patches/000_configure_fix.diff: Add proper check for the
+ existence of __progname (taken from OpenSSH-portable), replace
+ upstream’s check for declaration when what we really need to see
+ is existence of the symbol (Closes: #531937)
+ * debian/control: Remove “Tag:” header lintian complains about,
+ see the following mailing list thread for the reason:
+ - http://lists.alioth.debian.org/pipermail/debtags-devel/2007-January/001567.html
+ - http://lists.alioth.debian.org/pipermail/debtags-devel/2007-February/001593.html
+ * Fix a couple of lintian warnings:
+ - debian/README.Debian: spelling-error-in-readme-debian
+ - debian/patches/030_manpage_fix.diff,
+ debian/patches/040_manpage_debian.diff: hyphen-used-as-minus-sign
+ * Bump Standards-Version to 3.8.3, no relevant changes
+ * Call autoconf and autoheader to regenerate buildsystem after patching
+ * Fix spelling error in debian/patches/040_manpage_debian.diff
+
+ [ Filippo Giunchedi ]
+ * Merge patch from Thorsten Glaser fixing also an RC bug, thanks!
+
+ -- Filippo Giunchedi <filippo@debian.org> Sun, 10 Jan 2010 11:21:00 +0100
+
+autossh (1.4b-3) unstable; urgency=low
+
+ * Cosmetic changes to autossh wrapper
+ * Fix FTBFS on mips/mipsel by adding -fPIC to CFLAGS (Closes: #531937)
+
+ -- Filippo Giunchedi <filippo@debian.org> Fri, 05 Jun 2009 19:08:51 +0200
+
+autossh (1.4b-2) unstable; urgency=low
+
+ * Include autossh-argv0 shamelessly copied/adapted from ssh-argv0
+ * Add debian/patches/040_manpage_debian.diff to reference README.Debian for
+ autossh debian-specific behavior (Closes: #523861)
+ * Install logcheck ignore rules into
+ /etc/logcheck/ignore.d.workstation/autossh (Closes: #505659)
+ * Add ${misc:Depends} as lintian requested
+ * Update to S-V 3.8.1, no changes needed
+
+ -- Filippo Giunchedi <filippo@debian.org> Sat, 23 May 2009 19:08:46 +0200
+
+autossh (1.4b-1) unstable; urgency=low
+
+ * New upstream release
+ * debian/patches/manpage_fix.diff: fix spurious .El (Closes: #447654)
+ * Report failure when unable to find a tunnel port (Closes: #443087)
+
+ -- Filippo Giunchedi <filippo@debian.org> Tue, 24 Jun 2008 13:01:25 +0200
+
+autossh (1.4a-3) unstable; urgency=low
+
+ * get command line handling of -M right.
+ * add NEWS file announcing the random guess feature
+
+ -- Filippo Giunchedi <filippo@debian.org> Mon, 01 Oct 2007 23:34:18 +0200
+
+autossh (1.4a-2) unstable; urgency=low
+
+ * fix configure to properly handle --with-ssh
+ * pass --with-ssh=/usr/bin/ssh to configure
+ * improved the autossh wrapper while testing random ports
+
+ -- Filippo Giunchedi <filippo@debian.org> Mon, 01 Oct 2007 23:26:06 +0200
+
+autossh (1.4a-1) unstable; urgency=low
+
+ * New upstream release (Closes: #389985)
+ * migration to cdbs
+ * split patch for overriding -M on commandline into debian/patches
+ * the autossh wrapper now tries random ports (Closes: #230780)
+ * fix typo in the manpage and the bullet list (Closes: #441035)
+
+ -- Filippo Giunchedi <filippo@debian.org> Fri, 28 Sep 2007 11:57:04 +0200
+
+autossh (1.3-4) unstable; urgency=low
+
+ * explicitly depend on ssh-client | openssh-client (Closes: #315049)
+ * pass -M to ssh if used after --, patch by Paul Brook (Closes: #320280)
+
+ -- Filippo Giunchedi <filippo@debian.org> Thu, 15 Sep 2005 10:47:04 +0200
+
+autossh (1.3-3) unstable; urgency=low
+
+ * fixed weird bug when AUTOSSH_PORT and -M are present
+
+ -- Filippo Giunchedi <filippo@debian.org> Sun, 26 Jun 2005 19:45:35 +0200
+
+autossh (1.3-2) unstable; urgency=low
+
+ * changed Depends: ssh to Depends: ssh-client since ssh is now a
+ transitional package (Closes: #315049)
+
+ -- Filippo Giunchedi <filippo@debian.org> Mon, 20 Jun 2005 13:06:16 +0200
+
+autossh (1.3-1) unstable; urgency=low
+
+ * new upstream release
+ * fixed bad strcpy() usage
+ * backported default behaviour, -M overrides environment as expected
+
+ -- Filippo Giunchedi <filippo@debian.org> Sat, 18 Jun 2005 21:48:14 +0200
+
+autossh (1.2g-3) unstable; urgency=low
+
+ * fixed strcpy() with overlapping strings as pointed out by Steve Langasek
+
+ -- Filippo Giunchedi <filippo@debian.org> Tue, 24 May 2005 18:31:24 +0200
+
+autossh (1.2g-2) unstable; urgency=low
+
+ * fixes important bug when AUTOSSH_PORT=0 (Closes: #309744)
+ * do not strip "f" from arguments passed to ssh (backported from autossh 1.3)
+
+ -- Filippo Giunchedi <filippo@debian.org> Thu, 19 May 2005 14:41:12 +0200
+
+autossh (1.2g-1) unstable; urgency=low
+
+ * New upstream release
+ * added sponsor martin f krafft as uploader
+ * -M from the commandline overrides enviroment AUTOSSH_PORT, this changes
+ upstram's behaviour. see #238148
+ * moved /usr/bin/autossh.real to /usr/lib/autossh/autossh and removed the
+ lintian override, thanks to martin f krafft
+
+ -- Filippo Giunchedi <filippo@esaurito.net> Mon, 16 Nov 2004 20:53:57 +0100
+
+autossh (1.2f-3) unstable; urgency=low
+
+ * fixed -M and AUTOSSH_PORT handling, this should now work as expected (i.e.
+ -M overrides enviroment)
+
+ -- Filippo Giunchedi <filippo@esaurito.net> Fri, 2 Apr 2004 22:44:26 +0200
+
+autossh (1.2f-2) unstable; urgency=low
+
+ * changed autossh_wrapper to use AUTOSSH_PORT instead of -M and modified
+ autossh.c to -M always override AUTOSSH_PORT (Closes: #238148)
+ * fixed autossh chocking on empty (but set) AUTOSSH_PORT (Closes: #238150)
+
+ -- Filippo Giunchedi <filippo@esaurito.net> Fri, 19 Mar 2004 17:34:19 +0100
+
+autossh (1.2f-1) unstable; urgency=low
+
+ * New upstream version, fixed -f behaviour
+ * increased timeout to 15 seconds, removed unused variable, fixed manpage
+ typo, patch by Michael Shields (Closes: #233567, #233568)
+ * added lintian override for autossh.real
+
+ -- Filippo Giunchedi <filippo@esaurito.net> Mon, 23 Feb 2004 12:10:18 +0100
+
+autossh (1.2e-2) unstable; urgency=low
+
+ * fixed argument passing in autossh wrapper plus exec, patch by Gael Queri
+ (Closes: #228371)
+ * updated Standards-Version and minor changes
+
+ -- Filippo Giunchedi <filippo@esaurito.net> Sun, 19 Jan 2004 23:00:30 +0100
+
+autossh (1.2e-1) unstable; urgency=low
+
+ * New upstream release
+ * fixed -f handling in new release (Closes: #191719)
+
+ -- Filippo Giunchedi <filippo@esaurito.net> Sat, 15 Nov 2003 14:02:58 +0100
+
+autossh (1.2d-1) unstable; urgency=low
+
+ * New upstream release
+ * /usr/bin/autossh is a wrapper to set autossh.real default port [21021]
+ (Closes: #177511)
+
+ -- Filippo Giunchedi <filippo@esaurito.net> Fri, 20 Jun 2003 22:25:22 +0200
+
+autossh (1.2c-2) unstable; urgency=low
+
+ * updated Standards-Version
+ * removed dh_make boilerplate in copyright (now lintian error-free)
+
+ -- Filippo Giunchedi <filippo@esaurito.net> Sat, 11 Jan 2003 17:56:41 +0100
+
+autossh (1.2c-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Filippo Giunchedi <filippo@esaurito.net> Mon, 23 Dec 2002 16:36:39 +0000
+
--- autossh-1.4c.orig/debian/README.source
+++ autossh-1.4c/debian/README.source
@@ -0,0 +1,58 @@
+This package uses quilt to manage all modifications to the upstream
+source. Changes are stored in the source package as diffs in
+debian/patches and applied during the build.
+
+To configure quilt to use debian/patches instead of patches, you want
+either to export QUILT_PATCHES=debian/patches in your environment
+or use this snippet in your ~/.quiltrc:
+
+ for where in ./ ../ ../../ ../../../ ../../../../ ../../../../../; do
+ if [ -e ${where}debian/rules -a -d ${where}debian/patches ]; then
+ export QUILT_PATCHES=debian/patches
+ break
+ fi
+ done
+
+To get the fully patched source after unpacking the source package, cd to
+the root level of the source package and run:
+
+ quilt push -a
+
+The last patch listed in debian/patches/series will become the current
+patch.
+
+To add a new set of changes, first run quilt push -a, and then run:
+
+ quilt new <patch>
+
+where <patch> is a descriptive name for the patch, used as the filename in
+debian/patches. Then, for every file that will be modified by this patch,
+run:
+
+ quilt add <file>
+
+before editing those files. You must tell quilt with quilt add what files
+will be part of the patch before making changes or quilt will not work
+properly. After editing the files, run:
+
+ quilt refresh
+
+to save the results as a patch.
+
+Alternately, if you already have an external patch and you just want to
+add it to the build system, run quilt push -a and then:
+
+ quilt import -P <patch> /path/to/patch
+ quilt push -a
+
+(add -p 0 to quilt import if needed). <patch> as above is the filename to
+use in debian/patches. The last quilt push -a will apply the patch to
+make sure it works properly.
+
+To remove an existing patch from the list of patches that will be applied,
+run:
+
+ quilt delete <patch>
+
+You may need to run quilt pop -a to unapply patches first before running
+this command.
--- autossh-1.4c.orig/debian/autossh.lintian-overrides
+++ autossh-1.4c/debian/autossh.lintian-overrides
@@ -0,0 +1 @@
+autossh binary: package-contains-broken-symlink usr/share/man/man1/autossh-argv0.1.gz ssh-argv0.1.gz
--- autossh-1.4c.orig/debian/control
+++ autossh-1.4c/debian/control
@@ -0,0 +1,22 @@
+Source: autossh
+Section: net
+Priority: optional
+Maintainer: Axel Beckert <abe@debian.org>
+Uploaders: Franziska Lichtblau <rhalina@old-forest.org>
+Build-Depends: debhelper (>= 7), autoconf (>= 2.59), autotools-dev, quilt, openssh-client
+Build-Conflicts: autoconf2.13
+Homepage: http://www.harding.motd.ca/autossh/
+Vcs-Git: git://anonscm.debian.org/collab-maint/autossh.git
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/autossh.git
+Standards-Version: 3.9.2
+
+Package: autossh
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, openssh-client | ssh-client
+Enhances: openssh-client, ssh-client
+Description: Automatically restart SSH sessions and tunnels
+ autossh is a program to start an instance of ssh and monitor it, restarting it
+ as necessary should it die or stop passing traffic. The idea is from rstunnel
+ (Reliable SSH Tunnel), but implemented in C. Connection monitoring is done
+ using a loop of port forwardings. It backs off on the rate of connection
+ attempts when experiencing rapid failures such as connection refused.
--- autossh-1.4c.orig/debian/watch
+++ autossh-1.4c/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://www.harding.motd.ca/autossh/autossh-(.*)\.tgz
--- autossh-1.4c.orig/debian/compat
+++ autossh-1.4c/debian/compat
@@ -0,0 +1 @@
+5
--- autossh-1.4c.orig/debian/rscreen
+++ autossh-1.4c/debian/rscreen
@@ -0,0 +1,72 @@
+#!/bin/sh
+#
+# Script to use autossh to open up a remote screen session, or
+# reconnect to an existing one. Based on autossh's original rscreen
+# example script as installed on Debian systems into
+# /usr/share/doc/autossh/rscreen, but with more generally usable
+# defaults
+#
+# Copyright (C) Carson Harding, 2002.
+# Copyright (C) Axel Beckert, 2011.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are freely permitted.
+#
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+BASENAME=`basename $0`
+usage() {
+ echo <<EOF
+Usage: $BASENAME [autossh or ssh options] <host>
+
+If \$RSCREEN_COMMAND is set (either in the environment, in
+/etc/${BASENAME}rc, or in ~/.${BASENAME}rc), it will be used instead of screen
+or tmux. Use this feature if you want to supply additional screen
+options or tmux commands. (Using \$RTMUX_COMMAND does not work!)
+
+EOF
+}
+
+if [ -z "$1" ]; then
+ usage
+ exit 1
+elif [ "$1" = "-h" -o "$1" = "--help" ]; then
+ usage
+ exit 0
+fi
+
+if [ -r /etc/${BASENAME}rc ]; then
+ . /etc/${BASENAME}rc
+fi
+
+if [ -r ~/.${BASENAME}rc ]; then
+ . ~/.${BASENAME}rc
+fi
+
+if [ -z "$SSH_AUTH_SOCK" ]; then
+ eval `ssh-agent -s`
+ ssh-add
+fi
+
+if [ -n "$RSCREEN_COMMAND" ]; then
+ exec autossh -t "$@" "$RSCREEN_COMMAND"
+elif [ "$BASENAME" = "rtmux" ]; then
+ exec autossh -t "$@" "tmux a || tmux new"
+elif [ "$BASENAME" = "ruscreen" ]; then
+ # screen with explicit UTF-8 setting
+ exec autossh -t "$@" "screen -RdU"
+else
+ # Fall back to normal screen
+ exec autossh -t "$@" "screen -Rd"
+fi
--- autossh-1.4c.orig/debian/autossh-argv0
+++ autossh-1.4c/debian/autossh-argv0
@@ -0,0 +1,34 @@
+#! /bin/sh -e
+
+# Adapted from ssh-argv0 for usage with autossh
+# Note: the ssh-argv0(1) manpage is left as-is because autossh is meant as a
+# commandline replacement for ssh
+
+# Copyright (c) 2001 Jonathan Amery.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+if [ "${0##*/}" = "autossh-argv0" ]
+then
+ echo 'autossh-argv0: This script should not be run like this, see ssh-argv0(1) and autossh(1) for details' 1>&2
+ exit 1
+fi
+exec autossh "${0##*/}" "$@"
--- autossh-1.4c.orig/debian/NEWS
+++ autossh-1.4c/debian/NEWS
@@ -0,0 +1,9 @@
+autossh (1.4a-3) unstable; urgency=low
+
+ Automatic (random) guess of the port has been introduced, this means you can
+ invoke autossh <host> without specifying -M <monitorport>.
+
+ Backward compatibility is retained, you are free to use -M to force a
+ specific monitor port or use autossh -- -M <host> for passing -M to ssh.
+
+ -- Filippo Giunchedi <filippo@debian.org> Mon, 08 Oct 2007 22:29:54 +0200
--- autossh-1.4c.orig/debian/examples
+++ autossh-1.4c/debian/examples
@@ -0,0 +1,2 @@
+autossh.host
+rscreen
--- autossh-1.4c.orig/debian/source/format
+++ autossh-1.4c/debian/source/format
@@ -0,0 +1 @@
+1.0
--- autossh-1.4c.orig/debian/patches/040_manpage_debian.diff
+++ autossh-1.4c/debian/patches/040_manpage_debian.diff
@@ -0,0 +1,19 @@
+Add debian-specific behaviour to the man page.
+
+Index: autossh/autossh.1
+===================================================================
+--- autossh.orig/autossh.1 2011-11-19 02:57:51.000000000 +0100
++++ autossh/autossh.1 2011-11-19 02:59:13.000000000 +0100
+@@ -268,6 +268,12 @@
+ .Fl M
+ flag. A value of 0 turns the monitoring function off.
+ .El
++.Sh DEBIAN-SPECIFIC BEHAVIOR
++The debian version of autossh uses a wrapper to automatically select a free
++monitoring port and
++.Fl M
++overrides AUTOSSH_PORT, see
++/usr/share/doc/autossh/README.Debian for further information.
+ .Sh AUTHOR
+ .Nm
+ was written by Carson Harding.
--- autossh-1.4c.orig/debian/patches/020_use_destdir_makefile.diff
+++ autossh-1.4c/debian/patches/020_use_destdir_makefile.diff
@@ -0,0 +1,15 @@
+Support for $DESTDIR in the Makefile.
+
+Index: autossh/Makefile.in
+===================================================================
+--- autossh.orig/Makefile.in 2011-06-05 00:10:01.000000000 +0200
++++ autossh/Makefile.in 2011-06-05 00:26:15.000000000 +0200
+@@ -6,7 +6,7 @@
+
+ SSH= @path_ssh@
+
+-prefix= @prefix@
++prefix= ${DESTDIR}@prefix@
+ exec_prefix= @exec_prefix@
+ bindir= @bindir@
+ datadir= @datadir@
--- autossh-1.4c.orig/debian/patches/010_override_cmdline_port.diff
+++ autossh-1.4c/debian/patches/010_override_cmdline_port.diff
@@ -0,0 +1,64 @@
+Switches priority of -M commandline option and $AUTOSSH_PORT environment variable.
+
+Index: autossh/autossh.c
+===================================================================
+--- autossh.orig/autossh.c 2011-11-19 02:48:58.000000000 +0100
++++ autossh/autossh.c 2011-11-19 02:49:09.000000000 +0100
+@@ -183,7 +183,7 @@
+ if (code) {
+ fprintf(stderr, "\n");
+ fprintf(stderr,
+- " -M specifies monitor port. May be overridden by"
++ " -M specifies monitor port. Overrides the"
+ " environment\n"
+ " variable AUTOSSH_PORT. 0 turns monitoring"
+ " loop off.\n"
+@@ -282,14 +282,17 @@
+ */
+ get_env_args();
+
+- /*
++ /* if we got it from the environment */
++ if (env_port)
++ writep = env_port;
++
++ /*
+ * We accept all ssh args, and quietly pass them on
+ * to ssh when we call it.
+ */
+ while ((ch = getopt(argc, argv, OPTION_STRING)) != -1) {
+ switch(ch) {
+ case 'M':
+- if (!env_port)
+ writep = optarg;
+ break;
+ case 'V':
+@@ -313,9 +316,6 @@
+ }
+ }
+
+- /* if we got it from the environment */
+- if (env_port)
+- writep = env_port;
+
+ /*
+ * We must at least have a monitor port and a remote host.
+@@ -409,7 +409,7 @@
+ continue;
+ }
+ }
+- if (wp && env_port && !done_fwds) {
++ if (wp && !done_fwds) {
+ add_arg("-L");
+ add_arg(wmbuf);
+ if (!echop) {
+@@ -417,7 +417,8 @@
+ add_arg(rmbuf);
+ }
+ done_fwds = 1;
+- } else if (!sawargstop && argv[i][0] == '-' && argv[i][1] == 'M') {
++ }
++ if (!sawargstop && argv[i][0] == '-' && argv[i][1] == 'M') {
+ if (argv[i][2] == '\0')
+ i++;
+ if (wp && !done_fwds) {
--- autossh-1.4c.orig/debian/patches/series
+++ autossh-1.4c/debian/patches/series
@@ -0,0 +1,4 @@
+010_override_cmdline_port.diff
+020_use_destdir_makefile.diff
+030_manpage_fix.diff
+040_manpage_debian.diff
--- autossh-1.4c.orig/debian/patches/030_manpage_fix.diff
+++ autossh-1.4c/debian/patches/030_manpage_fix.diff
@@ -0,0 +1,83 @@
+Fix some stuff in the man page. (Should be better sent to upstream. :-)
+
+Index: autossh/autossh.1
+===================================================================
+--- autossh.orig/autossh.1 2011-11-19 02:34:15.000000000 +0100
++++ autossh/autossh.1 2011-11-19 02:57:51.000000000 +0100
+@@ -60,7 +60,6 @@
+ .Nm
+ tries to distinguish the manner of death of the ssh process it
+ is monitoring and act appropriately. The rules are:
+-.Bl -tag -width Ds
+ .It 1.
+ If the ssh process exited normally (for example, someone typed
+ "exit" in an interactive session),
+@@ -126,14 +125,14 @@
+ poll time (usually 10 minutes).
+ .Nm
+ can be "prodded" to retry by signalling it, perhaps with
+-SIGHUP ("kill -HUP").
++SIGHUP ("kill \-HUP").
+ .Pp
+ .Ss Connection setup
+ .Pp
+ As connections must be established unattended, the use of
+ .Nm
+ requires that some form of automatic authentication be set up. The use
+-of RSAAuthentication with ssh-agent is the recommended method. The
++of RSAAuthentication with ssh\-agent is the recommended method. The
+ example wrapper script attempts to check if there is an agent running
+ for the current environment, and to start one if there isn't.
+ .Pp
+@@ -160,8 +159,8 @@
+ using.
+ .Nm
+ will send test data on the base monitoring port, and
+-receive it back on the port above. For example, if you specify "-M
+-20000",
++receive it back on the port above. For example, if you specify
++.Dq Fl M 20000 ,
+ .Nm
+ will set up forwards so that it can send data on port
+ 20000 and receive it back on 20001.
+@@ -241,12 +240,14 @@
+ .It Ev AUTOSSH_MAXSTART
+ Specifies how many times ssh should be started. A negative number
+ means no limit on the number of times ssh is started. The default
+-value is -1.
++value is \-1.
+ .It Ev AUTOSSH_MESSAGE
+ Append message to echo message sent when testing connections.
+ .It Ev AUTOSSH_NTSERVICE
+ (Cygwin only.) When set to "yes" , autossh sets up to run as an NT
+-service under cygrunsrv. This adds the -N flag for ssh if not already
++service under cygrunsrv. This adds the
++.Fl N
++flag for ssh if not already
+ set, sets the log output to stdout, and changes the behaviour on ssh
+ exit so that it will restart even on a normal exit.
+ .It Ev AUTOSSH_PATH
+@@ -261,15 +262,18 @@
+ poll time.
+ .It Ev AUTOSSH_PORT
+ Sets the connection monitoring port. Mostly in case ssh appropriates
+--M at some time. But because of this possible use, AUTOSSH_PORT
+-overrides the -M flag. A value of 0 turns the monitoring function off.
++.Fl M
++at some time. But because of this possible use, AUTOSSH_PORT
++overrides the
++.Fl M
++flag. A value of 0 turns the monitoring function off.
+ .El
+ .Sh AUTHOR
+ .Nm
+ was written by Carson Harding.
+ .Sh SEE ALSO
+ .Xr ssh 1 ,
+-.Xr ssh-add 1 ,
+-.Xr ssh-agent 1 ,
+-.Xr ssh-keygen 1 ,
++.Xr ssh\-add 1 ,
++.Xr ssh\-agent 1 ,
++.Xr ssh\-keygen 1 ,
+ .Xr cygrunsrv 1 .