summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:08:47 +0000
committerColin Watson <cjwatson@debian.org>2016-01-04 13:43:53 +0000
commit2bb85b3c756967d72efbf895a8908858ee4c2441 (patch)
treea5625e7bf897080e8a51a6f65e3815fedb71ec1e
parent707e1569fb7f883d9a7ad7a70ce4125581969136 (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 128889a28..eec2b727c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4213,6 +4213,29 @@ AC_ARG_WITH([kerberos5],
4213AC_SUBST([GSSLIBS]) 4213AC_SUBST([GSSLIBS])
4214AC_SUBST([K5LIBS]) 4214AC_SUBST([K5LIBS])
4215 4215
4216# Check whether user wants systemd support
4217SYSTEMD_MSG="no"
4218AC_ARG_WITH(systemd,
4219 [ --with-systemd Enable systemd support],
4220 [ if test "x$withval" != "xno" ; then
4221 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
4222 if test "$PKGCONFIG" != "no"; then
4223 AC_MSG_CHECKING([for libsystemd])
4224 if $PKGCONFIG --exists libsystemd; then
4225 SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
4226 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
4227 CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
4228 SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
4229 AC_MSG_RESULT([yes])
4230 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
4231 SYSTEMD_MSG="yes"
4232 else
4233 AC_MSG_RESULT([no])
4234 fi
4235 fi
4236 fi ]
4237)
4238
4216# Looking for programs, paths and files 4239# Looking for programs, paths and files
4217 4240
4218PRIVSEP_PATH=/var/empty 4241PRIVSEP_PATH=/var/empty
@@ -5014,6 +5037,7 @@ echo " MD5 password support: $MD5_MSG"
5014echo " libedit support: $LIBEDIT_MSG" 5037echo " libedit support: $LIBEDIT_MSG"
5015echo " Solaris process contract support: $SPC_MSG" 5038echo " Solaris process contract support: $SPC_MSG"
5016echo " Solaris project support: $SP_MSG" 5039echo " Solaris project support: $SP_MSG"
5040echo " systemd support: $SYSTEMD_MSG"
5017echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 5041echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
5018echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 5042echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5019echo " BSD Auth support: $BSD_AUTH_MSG" 5043echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/sshd.c b/sshd.c
index 7e72b9b84..19ee92b27 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"
@@ -2052,6 +2056,11 @@ main(int ac, char **av)
2052 unsetenv("SSH_SIGSTOP"); 2056 unsetenv("SSH_SIGSTOP");
2053 } 2057 }
2054 2058
2059#ifdef HAVE_SYSTEMD
2060 /* Signal systemd that we are ready to accept connections */
2061 sd_notify(0, "READY=1");
2062#endif
2063
2055 /* Accept a connection and return in a forked child */ 2064 /* Accept a connection and return in a forked child */
2056 server_accept_loop(&sock_in, &sock_out, 2065 server_accept_loop(&sock_in, &sock_out,
2057 &newsock, config_s); 2066 &newsock, config_s);