Created
April 4, 2024 08:59
-
-
Save gomasy/2d229cebddf80c6a40325edf1f9bb43f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/configure.ac b/configure.ac | |
index 82e8bb7..a431e05 100644 | |
--- a/configure.ac | |
+++ b/configure.ac | |
@@ -4870,6 +4870,30 @@ AC_SUBST([GSSLIBS]) | |
AC_SUBST([K5LIBS]) | |
AC_SUBST([CHANNELLIBS]) | |
+# Check whether user wants systemd support | |
+SYSTEMD_MSG="no" | |
+AC_ARG_WITH(systemd, | |
+ [ --with-systemd Enable systemd support], | |
+ [ if test "x$withval" != "xno" ; then | |
+ AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no]) | |
+ if test "$PKGCONFIG" != "no"; then | |
+ AC_MSG_CHECKING([for libsystemd]) | |
+ if $PKGCONFIG --exists libsystemd; then | |
+ SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd` | |
+ SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd` | |
+ CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS" | |
+ SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS" | |
+ AC_MSG_RESULT([yes]) | |
+ AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.]) | |
+ SYSTEMD_MSG="yes" | |
+ else | |
+ AC_MSG_RESULT([no]) | |
+ fi | |
+ fi | |
+ fi ] | |
+) | |
+ | |
+ | |
# Looking for programs, paths and files | |
PRIVSEP_PATH=/var/empty | |
diff --git a/sshd.c b/sshd.c | |
index b4f2b97..b3d23bb 100644 | |
--- a/sshd.c | |
+++ b/sshd.c | |
@@ -88,6 +88,10 @@ | |
#include <prot.h> | |
#endif | |
+#ifdef HAVE_SYSTEMD | |
+#include <systemd/sd-daemon.h> | |
+#endif | |
+ | |
#include "xmalloc.h" | |
#include "ssh.h" | |
#include "ssh2.h" | |
@@ -2093,6 +2097,11 @@ main(int ac, char **av) | |
} | |
} | |
+#ifdef HAVE_SYSTEMD | |
+ /* Signal systemd that we are ready to accept connections */ | |
+ sd_notify(0, "READY=1"); | |
+#endif | |
+ | |
/* Accept a connection and return in a forked child */ | |
server_accept_loop(&sock_in, &sock_out, | |
&newsock, config_s); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment