summaryrefslogtreecommitdiff
path: root/debian/patches/systemd-readiness.patch
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:10:02 +0000
committerColin Watson <cjwatson@debian.org>2015-12-21 16:11:43 +0000
commitc496d67c169ac7914a78348371a4dac70c05bfbb (patch)
tree18d8bfa4a436bad93c6bd2b9e59ffe5f996dfcfb /debian/patches/systemd-readiness.patch
parent2df85bb3e650f484fd3c95f2be89f4cc1bd0a341 (diff)
parent480b475c69faf9cfa748cc445e36201bc7a81b80 (diff)
Add systemd readiness notification support (closes: #778913).
Diffstat (limited to 'debian/patches/systemd-readiness.patch')
-rw-r--r--debian/patches/systemd-readiness.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/debian/patches/systemd-readiness.patch b/debian/patches/systemd-readiness.patch
new file mode 100644
index 000000000..bbe3b2cd5
--- /dev/null
+++ b/debian/patches/systemd-readiness.patch
@@ -0,0 +1,84 @@
1From 818791ef8edf087481bd49eb32335c8d7e1953d6 Mon Sep 17 00:00:00 2001
2From: Michael Biebl <biebl@debian.org>
3Date: Mon, 21 Dec 2015 16:08:47 +0000
4Subject: Add systemd readiness notification support
5
6Bug-Debian: https://bugs.debian.org/778913
7Forwarded: no
8Last-Update: 2015-12-21
9
10Patch-Name: systemd-readiness.patch
11---
12 configure.ac | 24 ++++++++++++++++++++++++
13 sshd.c | 9 +++++++++
14 2 files changed, 33 insertions(+)
15
16diff --git a/configure.ac b/configure.ac
17index 128889a..eec2b72 100644
18--- a/configure.ac
19+++ b/configure.ac
20@@ -4213,6 +4213,29 @@ AC_ARG_WITH([kerberos5],
21 AC_SUBST([GSSLIBS])
22 AC_SUBST([K5LIBS])
23
24+# Check whether user wants systemd support
25+SYSTEMD_MSG="no"
26+AC_ARG_WITH(systemd,
27+ [ --with-systemd Enable systemd support],
28+ [ if test "x$withval" != "xno" ; then
29+ AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
30+ if test "$PKGCONFIG" != "no"; then
31+ AC_MSG_CHECKING([for libsystemd])
32+ if $PKGCONFIG --exists libsystemd; then
33+ SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
34+ SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
35+ CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
36+ SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
37+ AC_MSG_RESULT([yes])
38+ AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
39+ SYSTEMD_MSG="yes"
40+ else
41+ AC_MSG_RESULT([no])
42+ fi
43+ fi
44+ fi ]
45+)
46+
47 # Looking for programs, paths and files
48
49 PRIVSEP_PATH=/var/empty
50@@ -5014,6 +5037,7 @@ echo " MD5 password support: $MD5_MSG"
51 echo " libedit support: $LIBEDIT_MSG"
52 echo " Solaris process contract support: $SPC_MSG"
53 echo " Solaris project support: $SP_MSG"
54+echo " systemd support: $SYSTEMD_MSG"
55 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
56 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
57 echo " BSD Auth support: $BSD_AUTH_MSG"
58diff --git a/sshd.c b/sshd.c
59index 7e72b9b..4d28dc0 100644
60--- a/sshd.c
61+++ b/sshd.c
62@@ -85,6 +85,10 @@
63 #include <prot.h>
64 #endif
65
66+#ifdef HAVE_SYSTEMD
67+#include <systemd/sd-daemon.h>
68+#endif
69+
70 #include "xmalloc.h"
71 #include "ssh.h"
72 #include "ssh1.h"
73@@ -2011,6 +2015,11 @@ main(int ac, char **av)
74 /* ignore SIGPIPE */
75 signal(SIGPIPE, SIG_IGN);
76
77+#ifdef HAVE_SYSTEMD
78+ /* Signal systemd that we are ready to accept connections */
79+ sd_notify(0, "READY=1");
80+#endif
81+
82 /* Get a connection, either from inetd or a listening TCP socket */
83 if (inetd_flag) {
84 server_accept_inetd(&sock_in, &sock_out);