summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:08:47 +0000
committerColin Watson <cjwatson@debian.org>2017-03-29 01:40:56 +0100
commitbd5c1cc302550e4caf8c3a6942f48a784f347b58 (patch)
treeedfeafbf71d21b05557dd48a294baab0ce509f7f
parenta91715df66fc2a0b7792e87a864c334f4cb15043 (diff)
Add systemd readiness notification support
Bug-Debian: https://bugs.debian.org/778913 Forwarded: no Last-Update: 2016-01-04 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 a92425dbc..9d89bc351 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4376,6 +4376,29 @@ AC_ARG_WITH([kerberos5],
4376AC_SUBST([GSSLIBS]) 4376AC_SUBST([GSSLIBS])
4377AC_SUBST([K5LIBS]) 4377AC_SUBST([K5LIBS])
4378 4378
4379# Check whether user wants systemd support
4380SYSTEMD_MSG="no"
4381AC_ARG_WITH(systemd,
4382 [ --with-systemd Enable systemd support],
4383 [ if test "x$withval" != "xno" ; then
4384 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
4385 if test "$PKGCONFIG" != "no"; then
4386 AC_MSG_CHECKING([for libsystemd])
4387 if $PKGCONFIG --exists libsystemd; then
4388 SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
4389 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
4390 CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
4391 SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
4392 AC_MSG_RESULT([yes])
4393 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
4394 SYSTEMD_MSG="yes"
4395 else
4396 AC_MSG_RESULT([no])
4397 fi
4398 fi
4399 fi ]
4400)
4401
4379# Looking for programs, paths and files 4402# Looking for programs, paths and files
4380 4403
4381PRIVSEP_PATH=/var/empty 4404PRIVSEP_PATH=/var/empty
@@ -5180,6 +5203,7 @@ echo " libldns support: $LDNS_MSG"
5180echo " Solaris process contract support: $SPC_MSG" 5203echo " Solaris process contract support: $SPC_MSG"
5181echo " Solaris project support: $SP_MSG" 5204echo " Solaris project support: $SP_MSG"
5182echo " Solaris privilege support: $SPP_MSG" 5205echo " Solaris privilege support: $SPP_MSG"
5206echo " systemd support: $SYSTEMD_MSG"
5183echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 5207echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
5184echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 5208echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5185echo " BSD Auth support: $BSD_AUTH_MSG" 5209echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/sshd.c b/sshd.c
index a2ca2d3e5..8996e0e83 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"
@@ -1902,6 +1906,11 @@ main(int ac, char **av)
1902 unsetenv("SSH_SIGSTOP"); 1906 unsetenv("SSH_SIGSTOP");
1903 } 1907 }
1904 1908
1909#ifdef HAVE_SYSTEMD
1910 /* Signal systemd that we are ready to accept connections */
1911 sd_notify(0, "READY=1");
1912#endif
1913
1905 /* Accept a connection and return in a forked child */ 1914 /* Accept a connection and return in a forked child */
1906 server_accept_loop(&sock_in, &sock_out, 1915 server_accept_loop(&sock_in, &sock_out,
1907 &newsock, config_s); 1916 &newsock, config_s);