summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:08:47 +0000
committerColin Watson <cjwatson@debian.org>2019-06-21 16:14:04 +0100
commitd23f57ff1e85ded1298886968c9949282c4cba08 (patch)
tree28df8c880d3da3de41c12ec305f0b763419c2bec
parent734ffc23e368f9b0df085b4f191d66e21ed52d12 (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 ce16e7758..de140f578 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4526,6 +4526,29 @@ AC_ARG_WITH([kerberos5],
4526AC_SUBST([GSSLIBS]) 4526AC_SUBST([GSSLIBS])
4527AC_SUBST([K5LIBS]) 4527AC_SUBST([K5LIBS])
4528 4528
4529# Check whether user wants systemd support
4530SYSTEMD_MSG="no"
4531AC_ARG_WITH(systemd,
4532 [ --with-systemd Enable systemd support],
4533 [ if test "x$withval" != "xno" ; then
4534 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
4535 if test "$PKGCONFIG" != "no"; then
4536 AC_MSG_CHECKING([for libsystemd])
4537 if $PKGCONFIG --exists libsystemd; then
4538 SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
4539 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
4540 CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
4541 SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
4542 AC_MSG_RESULT([yes])
4543 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
4544 SYSTEMD_MSG="yes"
4545 else
4546 AC_MSG_RESULT([no])
4547 fi
4548 fi
4549 fi ]
4550)
4551
4529# Looking for programs, paths and files 4552# Looking for programs, paths and files
4530 4553
4531PRIVSEP_PATH=/var/empty 4554PRIVSEP_PATH=/var/empty
@@ -5332,6 +5355,7 @@ echo " libldns support: $LDNS_MSG"
5332echo " Solaris process contract support: $SPC_MSG" 5355echo " Solaris process contract support: $SPC_MSG"
5333echo " Solaris project support: $SP_MSG" 5356echo " Solaris project support: $SP_MSG"
5334echo " Solaris privilege support: $SPP_MSG" 5357echo " Solaris privilege support: $SPP_MSG"
5358echo " systemd support: $SYSTEMD_MSG"
5335echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 5359echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
5336echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 5360echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5337echo " BSD Auth support: $BSD_AUTH_MSG" 5361echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/sshd.c b/sshd.c
index 1e7ece588..48162b629 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"
@@ -1946,6 +1950,11 @@ main(int ac, char **av)
1946 } 1950 }
1947 } 1951 }
1948 1952
1953#ifdef HAVE_SYSTEMD
1954 /* Signal systemd that we are ready to accept connections */
1955 sd_notify(0, "READY=1");
1956#endif
1957
1949 /* Accept a connection and return in a forked child */ 1958 /* Accept a connection and return in a forked child */
1950 server_accept_loop(&sock_in, &sock_out, 1959 server_accept_loop(&sock_in, &sock_out,
1951 &newsock, config_s); 1960 &newsock, config_s);