summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:08:47 +0000
committerColin Watson <cjwatson@debian.org>2016-08-07 12:18:44 +0100
commitfe97848e044743f0bac019a491ddf0138f84e14a (patch)
tree0084a88c61978fb65b803aa85c001e25b89c8f1b
parent8d765e441787d024e76369496316105fe736d3ba (diff)
Add systemd readiness notification support
Bug-Debian: https://bugs.debian.org/778913 Forwarded: no Last-Update: 2016-01-04 Patch-Name: systemd-readiness.patch
-rw-r--r--configure.ac24
-rw-r--r--sshd.c9
2 files changed, 33 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index f822fb31c..6cafb1535 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4319,6 +4319,29 @@ AC_ARG_WITH([kerberos5],
4319AC_SUBST([GSSLIBS]) 4319AC_SUBST([GSSLIBS])
4320AC_SUBST([K5LIBS]) 4320AC_SUBST([K5LIBS])
4321 4321
4322# Check whether user wants systemd support
4323SYSTEMD_MSG="no"
4324AC_ARG_WITH(systemd,
4325 [ --with-systemd Enable systemd support],
4326 [ if test "x$withval" != "xno" ; then
4327 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
4328 if test "$PKGCONFIG" != "no"; then
4329 AC_MSG_CHECKING([for libsystemd])
4330 if $PKGCONFIG --exists libsystemd; then
4331 SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
4332 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
4333 CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
4334 SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
4335 AC_MSG_RESULT([yes])
4336 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
4337 SYSTEMD_MSG="yes"
4338 else
4339 AC_MSG_RESULT([no])
4340 fi
4341 fi
4342 fi ]
4343)
4344
4322# Looking for programs, paths and files 4345# Looking for programs, paths and files
4323 4346
4324PRIVSEP_PATH=/var/empty 4347PRIVSEP_PATH=/var/empty
@@ -5121,6 +5144,7 @@ echo " libedit support: $LIBEDIT_MSG"
5121echo " Solaris process contract support: $SPC_MSG" 5144echo " Solaris process contract support: $SPC_MSG"
5122echo " Solaris project support: $SP_MSG" 5145echo " Solaris project support: $SP_MSG"
5123echo " Solaris privilege support: $SPP_MSG" 5146echo " Solaris privilege support: $SPP_MSG"
5147echo " systemd support: $SYSTEMD_MSG"
5124echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 5148echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
5125echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 5149echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5126echo " BSD Auth support: $BSD_AUTH_MSG" 5150echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/sshd.c b/sshd.c
index 837409bf2..868df9e65 100644
--- a/sshd.c
+++ b/sshd.c
@@ -85,6 +85,10 @@
85#include <prot.h> 85#include <prot.h>
86#endif 86#endif
87 87
88#ifdef HAVE_SYSTEMD
89#include <systemd/sd-daemon.h>
90#endif
91
88#include "xmalloc.h" 92#include "xmalloc.h"
89#include "ssh.h" 93#include "ssh.h"
90#include "ssh1.h" 94#include "ssh1.h"
@@ -2117,6 +2121,11 @@ main(int ac, char **av)
2117 unsetenv("SSH_SIGSTOP"); 2121 unsetenv("SSH_SIGSTOP");
2118 } 2122 }
2119 2123
2124#ifdef HAVE_SYSTEMD
2125 /* Signal systemd that we are ready to accept connections */
2126 sd_notify(0, "READY=1");
2127#endif
2128
2120 /* Accept a connection and return in a forked child */ 2129 /* Accept a connection and return in a forked child */
2121 server_accept_loop(&sock_in, &sock_out, 2130 server_accept_loop(&sock_in, &sock_out,
2122 &newsock, config_s); 2131 &newsock, config_s);