--- openssh-5.1p1.ori/debian/rules	2009-08-31 19:11:51.000000000 +0200
+++ openssh-5.1p1/debian/rules	2009-08-31 19:01:11.000000000 +0200
@@ -42,8 +42,10 @@
   ifeq (,$(findstring :$(DEB_HOST_ARCH_CPU):,:hppa:m68k:))
     # Use position-independent executables to take advantage of address space
     # layout randomisation. TODO: This should be done in configure.
-    PIE_CFLAGS := -fPIE
-    PIE_LDFLAGS := -fPIE -pie
+    #PIE_CFLAGS := -fPIE
+    #PIE_LDFLAGS := -fPIE -pie
+    PIE_CFLAGS := -I/usr/include
+    PIE_LDFLAGS := -L/usr/lib
   endif
 endif
 
@@ -96,10 +98,10 @@
 
 # Compiler flags.
 cflags := $(OPTFLAGS) $(PIE_CFLAGS)
-cflags += -DLOGIN_PROGRAM=\"/bin/login\" -DLOGIN_NO_ENDOPT
-cflags += -DSSH_EXTRAVERSION=\"$(SSH_EXTRAVERSION)\"
+cflags += -DLOGIN_NO_ENDOPT
+cflags += -DSSH_EXTRAVERSION
 cflags_udeb := -Os
-cflags_udeb += -DSSH_EXTRAVERSION=\"$(SSH_EXTRAVERSION)\"
+cflags_udeb += -DSSH_EXTRAVERSION
 confflags += --with-cflags='$(cflags)'
 confflags_udeb += --with-cflags='$(cflags_udeb)'
 
@@ -114,7 +116,7 @@
 build-deb-stamp:
 	dh_testdir
 	mkdir -p build-deb
-	cd build-deb && ../configure $(confflags)
+	cd build-deb && ../configure --without-zlib-version-check $(confflags)
 
 ifeq ($(DEB_HOST_ARCH_OS),linux)
 	# Some 2.2 kernels have trouble with setres[ug]id() (bug #239999).
@@ -133,7 +135,7 @@
 build-udeb-stamp:
 	dh_testdir
 	mkdir -p build-udeb
-	cd build-udeb && ../configure $(confflags_udeb)
+	cd build-udeb && ../configure --without-zlib-version-check $(confflags_udeb)
 	# Debian's /var/log/btmp has inappropriate permissions.
 	perl -pi -e 's,.*#define USE_BTMP .*,/* #undef USE_BTMP */,' build-udeb/config.h
 	# Avoid libnsl linkage. Ugh.
--- openssh-5.1p1.ori/pathnames.h	2009-08-31 19:11:51.000000000 +0200
+++ openssh-5.1p1/pathnames.h	2009-08-31 18:49:46.000000000 +0200
@@ -171,7 +171,7 @@
 # ifdef LOGIN_PROGRAM_FALLBACK
 #  define LOGIN_PROGRAM         LOGIN_PROGRAM_FALLBACK
 # else
-#  define LOGIN_PROGRAM         "/usr/bin/login"
+#  define LOGIN_PROGRAM         "/bin/login"
 # endif
 #endif /* LOGIN_PROGRAM */
 
--- openssh-5.1p1.ori/version.h	2009-08-31 19:11:51.000000000 +0200
+++ openssh-5.1p1/version.h	2009-08-31 18:53:53.000000000 +0200
@@ -4,7 +4,7 @@
 
 #define SSH_PORTABLE	"p1"
 #ifdef SSH_EXTRAVERSION
-#define SSH_RELEASE	SSH_VERSION SSH_PORTABLE " " SSH_EXTRAVERSION
+#define SSH_RELEASE	SSH_VERSION SSH_PORTABLE " " "Debian-5"
 #else
 #define SSH_RELEASE	SSH_VERSION SSH_PORTABLE
 #endif
--- openssh-5.1p1.ori/debian/control	2009-08-31 19:11:51.000000000 +0200
+++ openssh-5.1p1/debian/control	2009-08-31 19:10:23.000000000 +0200
@@ -37,7 +37,7 @@
 Package: openssh-server
 Priority: optional
 Architecture: any
-Depends: ${shlibs:Depends}, debconf (>= 1.2.0) | debconf-2.0, libpam-runtime (>= 0.76-14), libpam-modules (>= 0.72-9), adduser (>= 3.9), dpkg (>= 1.9.0), openssh-client (= ${binary:Version}), lsb-base (>= 3.2-13), libssl0.9.8 (>= 0.9.8g-9), openssh-blacklist, procps
+Depends: ${shlibs:Depends}, debconf (>= 1.2.0) | debconf-2.0, libpam-runtime (>= 0.76-14), libpam-modules (>= 0.72-9), adduser (>= 3.9), dpkg (>= 1.9.0), openssh-client (= 1:5.1p1-5), lsb-base (>= 2.0-7), libssl0.9.7 (>= 0.9.7e-3sarge5), openssh-blacklist, procps
 Recommends: xauth, openssh-blacklist-extra
 Conflicts: ssh (<< 1:3.8.1p1-9), ssh-nonfree (<<2), ssh-socks, ssh2, sftp, rsh-client (<<0.16.1-1), ssh-krb5 (<< 1:4.3p2-7)
 Replaces: ssh, openssh-client (<< 1:3.8.1p1-11), ssh-krb5
--- openssh-5.1p1.ori/debian/openssh-server.init	2009-08-31 19:11:51.000000000 +0200
+++ openssh-5.1p1/debian/openssh-server.init	2009-09-08 18:57:44.000000000 +0200
@@ -21,6 +21,92 @@
     . /etc/default/ssh
 fi
 
+log_daemon_msg () {
+	if [ -z "${1:-}" ]; then
+		return 1
+	fi
+	if [ -z "${2:-}" ]; then
+		echo -n "$1:"
+		return
+	fi
+	echo "$1: $2"
+}
+
+log_action_msg () {
+	echo "$@."
+}
+
+pidofproc () {
+    local pidfile line i pids= status specified pid
+    pidfile=
+    specified=
+    
+    OPTIND=1
+    while getopts p: opt ; do
+        case "$opt" in
+            p)  pidfile="$OPTARG"; specified=1;;
+        esac
+    done
+    shift $(($OPTIND - 1))
+
+    base=${1##*/}
+    if [ ! "$specified" ]; then
+        pidfile="/var/run/$base.pid"
+    fi
+
+    if [ -n "${pidfile:-}" -a -e "$pidfile" ]; then
+        read pid < "$pidfile"
+        if [ -n "${pid:-}" ]; then
+            if $(kill -0 "${pid:-}" 2> /dev/null); then
+                echo "$pid"
+                return 0
+            elif ps "${pid:-}" >/dev/null 2>&1; then
+                echo "$pid"
+                return 0 # program is running, but not owned by this user
+            else
+                return 1 # program is dead and /var/run pid file exists
+            fi
+        fi
+    fi
+    if [ -x /bin/pidof -a ! "$specified" ]; then
+        status="0"
+        /bin/pidof -o %PPID -x $1 || status="$?"
+        if [ "$status" = 1 ]; then
+            return 3 # program is not running
+        fi
+        return 0
+    fi
+    return 4 # program or service is unknown
+}
+status_of_proc () {
+    local pidfile daemon name status
+
+    pidfile=
+    OPTIND=1
+    while getopts p: opt ; do
+        case "$opt" in
+            p)  pidfile="$OPTARG";;
+        esac
+    done
+    shift $(($OPTIND - 1))
+
+    if [ -n "$pidfile" ]; then
+        pidfile="-p $pidfile"
+    fi
+    daemon="$1"
+    name="$2"
+
+    status="0"
+    pidofproc $pidfile $daemon >/dev/null || status="$?"
+    if [ "$status" = 0 ]; then
+        log_success_msg "$name is running"
+        return 0
+    else
+        log_failure_msg "$name is not running"
+        return $status
+    fi
+}
+
 . /lib/lsb/init-functions
 
 if [ -n "$2" ]; then
@@ -72,7 +158,6 @@
 }
 
 export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
-
 case "$1" in
   start)
 	check_privsep_dir
