summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:08:47 +0000
committerColin Watson <cjwatson@debian.org>2017-10-04 13:54:48 +0100
commitba3f6b85ede72ef42987f0069f5ed2b88ebe69fd (patch)
tree29c8b84887c3867a454f50d288ca6794bf8006d5
parent18950b79898be885c6b77d463367639647e54e28 (diff)
Add systemd readiness notification support
Bug-Debian: https://bugs.debian.org/778913 Forwarded: no Last-Update: 2017-08-22 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 3b30736b3..483a9038c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4389,6 +4389,29 @@ AC_ARG_WITH([kerberos5],
4389AC_SUBST([GSSLIBS]) 4389AC_SUBST([GSSLIBS])
4390AC_SUBST([K5LIBS]) 4390AC_SUBST([K5LIBS])
4391 4391
4392# Check whether user wants systemd support
4393SYSTEMD_MSG="no"
4394AC_ARG_WITH(systemd,
4395 [ --with-systemd Enable systemd support],
4396 [ if test "x$withval" != "xno" ; then
4397 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
4398 if test "$PKGCONFIG" != "no"; then
4399 AC_MSG_CHECKING([for libsystemd])
4400 if $PKGCONFIG --exists libsystemd; then
4401 SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
4402 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
4403 CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
4404 SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
4405 AC_MSG_RESULT([yes])
4406 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
4407 SYSTEMD_MSG="yes"
4408 else
4409 AC_MSG_RESULT([no])
4410 fi
4411 fi
4412 fi ]
4413)
4414
4392# Looking for programs, paths and files 4415# Looking for programs, paths and files
4393 4416
4394PRIVSEP_PATH=/var/empty 4417PRIVSEP_PATH=/var/empty
@@ -5196,6 +5219,7 @@ echo " libldns support: $LDNS_MSG"
5196echo " Solaris process contract support: $SPC_MSG" 5219echo " Solaris process contract support: $SPC_MSG"
5197echo " Solaris project support: $SP_MSG" 5220echo " Solaris project support: $SP_MSG"
5198echo " Solaris privilege support: $SPP_MSG" 5221echo " Solaris privilege support: $SPP_MSG"
5222echo " systemd support: $SYSTEMD_MSG"
5199echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 5223echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
5200echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 5224echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5201echo " BSD Auth support: $BSD_AUTH_MSG" 5225echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/sshd.c b/sshd.c
index a5a1193df..1fde5a63c 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 "ssh2.h" 94#include "ssh2.h"
@@ -1881,6 +1885,11 @@ main(int ac, char **av)
1881 } 1885 }
1882 } 1886 }
1883 1887
1888#ifdef HAVE_SYSTEMD
1889 /* Signal systemd that we are ready to accept connections */
1890 sd_notify(0, "READY=1");
1891#endif
1892
1884 /* Accept a connection and return in a forked child */ 1893 /* Accept a connection and return in a forked child */
1885 server_accept_loop(&sock_in, &sock_out, 1894 server_accept_loop(&sock_in, &sock_out,
1886 &newsock, config_s); 1895 &newsock, config_s);