summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:08:47 +0000
committerColin Watson <cjwatson@debian.org>2019-10-09 23:07:49 +0100
commitab765b2bd55062a704f09da8f8c1c4ad1d6630a7 (patch)
tree4666d70abf9be2304f2f7d882166f53b2812c490
parent4360244ab2ed367bdb2c836292e761c589355950 (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 e894db9fc..c119d6fd1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4499,6 +4499,29 @@ AC_ARG_WITH([kerberos5],
4499AC_SUBST([GSSLIBS]) 4499AC_SUBST([GSSLIBS])
4500AC_SUBST([K5LIBS]) 4500AC_SUBST([K5LIBS])
4501 4501
4502# Check whether user wants systemd support
4503SYSTEMD_MSG="no"
4504AC_ARG_WITH(systemd,
4505 [ --with-systemd Enable systemd support],
4506 [ if test "x$withval" != "xno" ; then
4507 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
4508 if test "$PKGCONFIG" != "no"; then
4509 AC_MSG_CHECKING([for libsystemd])
4510 if $PKGCONFIG --exists libsystemd; then
4511 SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
4512 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
4513 CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
4514 SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
4515 AC_MSG_RESULT([yes])
4516 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
4517 SYSTEMD_MSG="yes"
4518 else
4519 AC_MSG_RESULT([no])
4520 fi
4521 fi
4522 fi ]
4523)
4524
4502# Looking for programs, paths and files 4525# Looking for programs, paths and files
4503 4526
4504PRIVSEP_PATH=/var/empty 4527PRIVSEP_PATH=/var/empty
@@ -5305,6 +5328,7 @@ echo " libldns support: $LDNS_MSG"
5305echo " Solaris process contract support: $SPC_MSG" 5328echo " Solaris process contract support: $SPC_MSG"
5306echo " Solaris project support: $SP_MSG" 5329echo " Solaris project support: $SP_MSG"
5307echo " Solaris privilege support: $SPP_MSG" 5330echo " Solaris privilege support: $SPP_MSG"
5331echo " systemd support: $SYSTEMD_MSG"
5308echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 5332echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
5309echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 5333echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5310echo " BSD Auth support: $BSD_AUTH_MSG" 5334echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/sshd.c b/sshd.c
index 4e8ff0662..5e7679a33 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"
@@ -1951,6 +1955,11 @@ main(int ac, char **av)
1951 } 1955 }
1952 } 1956 }
1953 1957
1958#ifdef HAVE_SYSTEMD
1959 /* Signal systemd that we are ready to accept connections */
1960 sd_notify(0, "READY=1");
1961#endif
1962
1954 /* Accept a connection and return in a forked child */ 1963 /* Accept a connection and return in a forked child */
1955 server_accept_loop(&sock_in, &sock_out, 1964 server_accept_loop(&sock_in, &sock_out,
1956 &newsock, config_s); 1965 &newsock, config_s);