summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:08:47 +0000
committerColin Watson <cjwatson@debian.org>2020-06-07 10:25:35 +0100
commitfe8c9983321154a61f4f06be602f925f1fd24ee7 (patch)
treebe9f98203d3e01f0d6cfe4b7eeadcb9ade890441
parent9b1d6a32944943b6b18861b97868c463bf5a6e8c (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 812b7218f..7e0584d2c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4730,6 +4730,29 @@ AC_ARG_WITH([kerberos5],
4730AC_SUBST([GSSLIBS]) 4730AC_SUBST([GSSLIBS])
4731AC_SUBST([K5LIBS]) 4731AC_SUBST([K5LIBS])
4732 4732
4733# Check whether user wants systemd support
4734SYSTEMD_MSG="no"
4735AC_ARG_WITH(systemd,
4736 [ --with-systemd Enable systemd support],
4737 [ if test "x$withval" != "xno" ; then
4738 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
4739 if test "$PKGCONFIG" != "no"; then
4740 AC_MSG_CHECKING([for libsystemd])
4741 if $PKGCONFIG --exists libsystemd; then
4742 SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
4743 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
4744 CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
4745 SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
4746 AC_MSG_RESULT([yes])
4747 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
4748 SYSTEMD_MSG="yes"
4749 else
4750 AC_MSG_RESULT([no])
4751 fi
4752 fi
4753 fi ]
4754)
4755
4733# Looking for programs, paths and files 4756# Looking for programs, paths and files
4734 4757
4735PRIVSEP_PATH=/var/empty 4758PRIVSEP_PATH=/var/empty
@@ -5542,6 +5565,7 @@ echo " libldns support: $LDNS_MSG"
5542echo " Solaris process contract support: $SPC_MSG" 5565echo " Solaris process contract support: $SPC_MSG"
5543echo " Solaris project support: $SP_MSG" 5566echo " Solaris project support: $SP_MSG"
5544echo " Solaris privilege support: $SPP_MSG" 5567echo " Solaris privilege support: $SPP_MSG"
5568echo " systemd support: $SYSTEMD_MSG"
5545echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 5569echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
5546echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 5570echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5547echo " BSD Auth support: $BSD_AUTH_MSG" 5571echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/sshd.c b/sshd.c
index baee13506..d2d1877d4 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"
@@ -2026,6 +2030,11 @@ main(int ac, char **av)
2026 } 2030 }
2027 } 2031 }
2028 2032
2033#ifdef HAVE_SYSTEMD
2034 /* Signal systemd that we are ready to accept connections */
2035 sd_notify(0, "READY=1");
2036#endif
2037
2029 /* Accept a connection and return in a forked child */ 2038 /* Accept a connection and return in a forked child */
2030 server_accept_loop(&sock_in, &sock_out, 2039 server_accept_loop(&sock_in, &sock_out,
2031 &newsock, config_s); 2040 &newsock, config_s);