summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:08:47 +0000
committerColin Watson <cjwatson@debian.org>2018-04-03 08:26:38 +0100
commit293675c88b02f0a5ba3896db73b2716e70d87b31 (patch)
tree3eac89ba9594a42e97aa91f03b5f05c40999e955
parent8e54091347c2c94ab3872e1b9448b40038a63bfb (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 3e23e60d6..eac143b4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4496,6 +4496,29 @@ AC_ARG_WITH([kerberos5],
4496AC_SUBST([GSSLIBS]) 4496AC_SUBST([GSSLIBS])
4497AC_SUBST([K5LIBS]) 4497AC_SUBST([K5LIBS])
4498 4498
4499# Check whether user wants systemd support
4500SYSTEMD_MSG="no"
4501AC_ARG_WITH(systemd,
4502 [ --with-systemd Enable systemd support],
4503 [ if test "x$withval" != "xno" ; then
4504 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
4505 if test "$PKGCONFIG" != "no"; then
4506 AC_MSG_CHECKING([for libsystemd])
4507 if $PKGCONFIG --exists libsystemd; then
4508 SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
4509 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
4510 CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
4511 SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
4512 AC_MSG_RESULT([yes])
4513 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
4514 SYSTEMD_MSG="yes"
4515 else
4516 AC_MSG_RESULT([no])
4517 fi
4518 fi
4519 fi ]
4520)
4521
4499# Looking for programs, paths and files 4522# Looking for programs, paths and files
4500 4523
4501PRIVSEP_PATH=/var/empty 4524PRIVSEP_PATH=/var/empty
@@ -5303,6 +5326,7 @@ echo " libldns support: $LDNS_MSG"
5303echo " Solaris process contract support: $SPC_MSG" 5326echo " Solaris process contract support: $SPC_MSG"
5304echo " Solaris project support: $SP_MSG" 5327echo " Solaris project support: $SP_MSG"
5305echo " Solaris privilege support: $SPP_MSG" 5328echo " Solaris privilege support: $SPP_MSG"
5329echo " systemd support: $SYSTEMD_MSG"
5306echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 5330echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
5307echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 5331echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5308echo " BSD Auth support: $BSD_AUTH_MSG" 5332echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/sshd.c b/sshd.c
index 1d645a170..3a86e66e7 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"
@@ -1933,6 +1937,11 @@ main(int ac, char **av)
1933 } 1937 }
1934 } 1938 }
1935 1939
1940#ifdef HAVE_SYSTEMD
1941 /* Signal systemd that we are ready to accept connections */
1942 sd_notify(0, "READY=1");
1943#endif
1944
1936 /* Accept a connection and return in a forked child */ 1945 /* Accept a connection and return in a forked child */
1937 server_accept_loop(&sock_in, &sock_out, 1946 server_accept_loop(&sock_in, &sock_out,
1938 &newsock, config_s); 1947 &newsock, config_s);