summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:08:47 +0000
committerColin Watson <cjwatson@debian.org>2016-03-21 12:06:16 +0000
commit643bc17ada741a9ee5b86170ad313f83278e1f72 (patch)
tree04547ad9b5c583418121bad864385e9d6495ca8f
parent803865858838e2ccf1fa885ba14b9a11c4a3153e (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 5d720f77a..c978c1104 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4263,6 +4263,29 @@ AC_ARG_WITH([kerberos5],
4263AC_SUBST([GSSLIBS]) 4263AC_SUBST([GSSLIBS])
4264AC_SUBST([K5LIBS]) 4264AC_SUBST([K5LIBS])
4265 4265
4266# Check whether user wants systemd support
4267SYSTEMD_MSG="no"
4268AC_ARG_WITH(systemd,
4269 [ --with-systemd Enable systemd support],
4270 [ if test "x$withval" != "xno" ; then
4271 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
4272 if test "$PKGCONFIG" != "no"; then
4273 AC_MSG_CHECKING([for libsystemd])
4274 if $PKGCONFIG --exists libsystemd; then
4275 SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
4276 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
4277 CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
4278 SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
4279 AC_MSG_RESULT([yes])
4280 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
4281 SYSTEMD_MSG="yes"
4282 else
4283 AC_MSG_RESULT([no])
4284 fi
4285 fi
4286 fi ]
4287)
4288
4266# Looking for programs, paths and files 4289# Looking for programs, paths and files
4267 4290
4268PRIVSEP_PATH=/var/empty 4291PRIVSEP_PATH=/var/empty
@@ -5065,6 +5088,7 @@ echo " libedit support: $LIBEDIT_MSG"
5065echo " Solaris process contract support: $SPC_MSG" 5088echo " Solaris process contract support: $SPC_MSG"
5066echo " Solaris project support: $SP_MSG" 5089echo " Solaris project support: $SP_MSG"
5067echo " Solaris privilege support: $SPP_MSG" 5090echo " Solaris privilege support: $SPP_MSG"
5091echo " systemd support: $SYSTEMD_MSG"
5068echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 5092echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
5069echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 5093echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5070echo " BSD Auth support: $BSD_AUTH_MSG" 5094echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/sshd.c b/sshd.c
index c2d42f527..8802d18b2 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"
@@ -2058,6 +2062,11 @@ main(int ac, char **av)
2058 unsetenv("SSH_SIGSTOP"); 2062 unsetenv("SSH_SIGSTOP");
2059 } 2063 }
2060 2064
2065#ifdef HAVE_SYSTEMD
2066 /* Signal systemd that we are ready to accept connections */
2067 sd_notify(0, "READY=1");
2068#endif
2069
2061 /* Accept a connection and return in a forked child */ 2070 /* Accept a connection and return in a forked child */
2062 server_accept_loop(&sock_in, &sock_out, 2071 server_accept_loop(&sock_in, &sock_out,
2063 &newsock, config_s); 2072 &newsock, config_s);