summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-12-21 16:08:47 +0000
committerColin Watson <cjwatson@debian.org>2017-01-16 15:02:54 +0000
commit0fd4134a3ef467e1e69db5b19b7903cf306ec64b (patch)
tree88aaff5e5238955b39f9ecca5d899cff6c339030
parent218ecbc433b69b8584000380626a9d9aa31c095b (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 4747ce4a5..9f59794bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4364,6 +4364,29 @@ AC_ARG_WITH([kerberos5],
4364AC_SUBST([GSSLIBS]) 4364AC_SUBST([GSSLIBS])
4365AC_SUBST([K5LIBS]) 4365AC_SUBST([K5LIBS])
4366 4366
4367# Check whether user wants systemd support
4368SYSTEMD_MSG="no"
4369AC_ARG_WITH(systemd,
4370 [ --with-systemd Enable systemd support],
4371 [ if test "x$withval" != "xno" ; then
4372 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
4373 if test "$PKGCONFIG" != "no"; then
4374 AC_MSG_CHECKING([for libsystemd])
4375 if $PKGCONFIG --exists libsystemd; then
4376 SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
4377 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
4378 CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
4379 SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
4380 AC_MSG_RESULT([yes])
4381 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
4382 SYSTEMD_MSG="yes"
4383 else
4384 AC_MSG_RESULT([no])
4385 fi
4386 fi
4387 fi ]
4388)
4389
4367# Looking for programs, paths and files 4390# Looking for programs, paths and files
4368 4391
4369PRIVSEP_PATH=/var/empty 4392PRIVSEP_PATH=/var/empty
@@ -5167,6 +5190,7 @@ echo " libedit support: $LIBEDIT_MSG"
5167echo " Solaris process contract support: $SPC_MSG" 5190echo " Solaris process contract support: $SPC_MSG"
5168echo " Solaris project support: $SP_MSG" 5191echo " Solaris project support: $SP_MSG"
5169echo " Solaris privilege support: $SPP_MSG" 5192echo " Solaris privilege support: $SPP_MSG"
5193echo " systemd support: $SYSTEMD_MSG"
5170echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 5194echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
5171echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 5195echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5172echo " BSD Auth support: $BSD_AUTH_MSG" 5196echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/sshd.c b/sshd.c
index b6826c842..027daa9d8 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"
@@ -1888,6 +1892,11 @@ main(int ac, char **av)
1888 unsetenv("SSH_SIGSTOP"); 1892 unsetenv("SSH_SIGSTOP");
1889 } 1893 }
1890 1894
1895#ifdef HAVE_SYSTEMD
1896 /* Signal systemd that we are ready to accept connections */
1897 sd_notify(0, "READY=1");
1898#endif
1899
1891 /* Accept a connection and return in a forked child */ 1900 /* Accept a connection and return in a forked child */
1892 server_accept_loop(&sock_in, &sock_out, 1901 server_accept_loop(&sock_in, &sock_out,
1893 &newsock, config_s); 1902 &newsock, config_s);