summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:08:47 +0000
committerColin Watson <cjwatson@debian.org>2018-10-20 22:54:09 +0100
commitda34947128351bee9d2530574432190548f5be58 (patch)
treeda566d85ec60bbc41c826640196808fc51709a3c
parentdf56506f727e37c13346259bdcd5975e257a259d (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 917300b43..8a5db4cb5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4586,6 +4586,29 @@ AC_ARG_WITH([kerberos5],
4586AC_SUBST([GSSLIBS]) 4586AC_SUBST([GSSLIBS])
4587AC_SUBST([K5LIBS]) 4587AC_SUBST([K5LIBS])
4588 4588
4589# Check whether user wants systemd support
4590SYSTEMD_MSG="no"
4591AC_ARG_WITH(systemd,
4592 [ --with-systemd Enable systemd support],
4593 [ if test "x$withval" != "xno" ; then
4594 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
4595 if test "$PKGCONFIG" != "no"; then
4596 AC_MSG_CHECKING([for libsystemd])
4597 if $PKGCONFIG --exists libsystemd; then
4598 SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
4599 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
4600 CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
4601 SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
4602 AC_MSG_RESULT([yes])
4603 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
4604 SYSTEMD_MSG="yes"
4605 else
4606 AC_MSG_RESULT([no])
4607 fi
4608 fi
4609 fi ]
4610)
4611
4589# Looking for programs, paths and files 4612# Looking for programs, paths and files
4590 4613
4591PRIVSEP_PATH=/var/empty 4614PRIVSEP_PATH=/var/empty
@@ -5392,6 +5415,7 @@ echo " libldns support: $LDNS_MSG"
5392echo " Solaris process contract support: $SPC_MSG" 5415echo " Solaris process contract support: $SPC_MSG"
5393echo " Solaris project support: $SP_MSG" 5416echo " Solaris project support: $SP_MSG"
5394echo " Solaris privilege support: $SPP_MSG" 5417echo " Solaris privilege support: $SPP_MSG"
5418echo " systemd support: $SYSTEMD_MSG"
5395echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 5419echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
5396echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 5420echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5397echo " BSD Auth support: $BSD_AUTH_MSG" 5421echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/sshd.c b/sshd.c
index d7e77d343..a1c3970b3 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"
@@ -1990,6 +1994,11 @@ main(int ac, char **av)
1990 } 1994 }
1991 } 1995 }
1992 1996
1997#ifdef HAVE_SYSTEMD
1998 /* Signal systemd that we are ready to accept connections */
1999 sd_notify(0, "READY=1");
2000#endif
2001
1993 /* Accept a connection and return in a forked child */ 2002 /* Accept a connection and return in a forked child */
1994 server_accept_loop(&sock_in, &sock_out, 2003 server_accept_loop(&sock_in, &sock_out,
1995 &newsock, config_s); 2004 &newsock, config_s);