|
|
9070b3 |
commit 0e22b79bfde45a7cf7a2e51a68ec11c4285f3b31
|
|
|
9070b3 |
Author: Jakub Jelen <jjelen@redhat.com>
|
|
|
9070b3 |
Date: Mon Nov 21 15:04:06 2016 +0100
|
|
|
9070b3 |
|
|
|
9070b3 |
systemd stuff
|
|
|
9070b3 |
|
|
|
9070b3 |
diff --git a/configure.ac b/configure.ac
|
|
|
9070b3 |
index 2ffc369..162ce92 100644
|
|
|
9070b3 |
--- a/configure.ac
|
|
|
9070b3 |
+++ b/configure.ac
|
|
|
9070b3 |
@@ -4265,6 +4265,30 @@ AC_ARG_WITH([kerberos5],
|
|
|
9070b3 |
AC_SUBST([GSSLIBS])
|
|
|
9070b3 |
AC_SUBST([K5LIBS])
|
|
|
9070b3 |
|
|
|
9070b3 |
+# Check whether user wants systemd support
|
|
|
9070b3 |
+SYSTEMD_MSG="no"
|
|
|
9070b3 |
+AC_ARG_WITH(systemd,
|
|
|
9070b3 |
+ [ --with-systemd Enable systemd support],
|
|
|
9070b3 |
+ [ if test "x$withval" != "xno" ; then
|
|
|
9070b3 |
+ AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
|
|
|
9070b3 |
+ if test "$PKGCONFIG" != "no"; then
|
|
|
9070b3 |
+ AC_MSG_CHECKING([for libsystemd])
|
|
|
9070b3 |
+ if $PKGCONFIG --exists libsystemd; then
|
|
|
9070b3 |
+ SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
|
|
|
9070b3 |
+ SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
|
|
|
9070b3 |
+ CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
|
|
|
9070b3 |
+ SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
|
|
|
9070b3 |
+ AC_MSG_RESULT([yes])
|
|
|
9070b3 |
+ AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
|
|
|
9070b3 |
+ SYSTEMD_MSG="yes"
|
|
|
9070b3 |
+ else
|
|
|
9070b3 |
+ AC_MSG_RESULT([no])
|
|
|
9070b3 |
+ fi
|
|
|
9070b3 |
+ fi
|
|
|
9070b3 |
+ fi ]
|
|
|
9070b3 |
+)
|
|
|
9070b3 |
+
|
|
|
9070b3 |
+
|
|
|
9070b3 |
# Looking for programs, paths and files
|
|
|
9070b3 |
|
|
|
9070b3 |
PRIVSEP_PATH=/var/empty
|
|
|
9070b3 |
@@ -5097,6 +5121,7 @@ echo " libedit support: $LIBEDIT_MSG"
|
|
|
9070b3 |
echo " Solaris process contract support: $SPC_MSG"
|
|
|
9070b3 |
echo " Solaris project support: $SP_MSG"
|
|
|
9070b3 |
echo " Solaris privilege support: $SPP_MSG"
|
|
|
9070b3 |
+echo " systemd support: $SYSTEMD_MSG"
|
|
|
9070b3 |
echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
|
|
|
9070b3 |
echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
|
|
|
9070b3 |
echo " BSD Auth support: $BSD_AUTH_MSG"
|
|
|
9070b3 |
diff --git a/contrib/sshd.service b/contrib/sshd.service
|
|
|
9070b3 |
new file mode 100644
|
|
|
9070b3 |
index 0000000..e0d4923
|
|
|
9070b3 |
--- /dev/null
|
|
|
9070b3 |
+++ b/contrib/sshd.service
|
|
|
9070b3 |
@@ -0,0 +1,16 @@
|
|
|
9070b3 |
+[Unit]
|
|
|
9070b3 |
+Description=OpenSSH server daemon
|
|
|
9070b3 |
+Documentation=man:sshd(8) man:sshd_config(5)
|
|
|
9070b3 |
+After=network.target
|
|
|
9070b3 |
+
|
|
|
9070b3 |
+[Service]
|
|
|
9070b3 |
+Type=notify
|
|
|
9070b3 |
+ExecStart=/usr/sbin/sshd -D $OPTIONS
|
|
|
9070b3 |
+ExecReload=/bin/kill -HUP $MAINPID
|
|
|
9070b3 |
+KillMode=process
|
|
|
9070b3 |
+Restart=on-failure
|
|
|
9070b3 |
+RestartPreventExitStatus=255
|
|
|
9070b3 |
+
|
|
|
9070b3 |
+[Install]
|
|
|
9070b3 |
+WantedBy=multi-user.target
|
|
|
9070b3 |
+
|
|
|
9070b3 |
diff --git a/sshd.c b/sshd.c
|
|
|
9070b3 |
index 816611c..b8b9d13 100644
|
|
|
9070b3 |
--- a/sshd.c
|
|
|
9070b3 |
+++ b/sshd.c
|
|
|
9070b3 |
@@ -85,6 +85,10 @@
|
|
|
9070b3 |
#include <prot.h>
|
|
|
9070b3 |
#endif
|
|
|
9070b3 |
|
|
|
9070b3 |
+#ifdef HAVE_SYSTEMD
|
|
|
9070b3 |
+#include <systemd/sd-daemon.h>
|
|
|
9070b3 |
+#endif
|
|
|
9070b3 |
+
|
|
|
9070b3 |
#include "xmalloc.h"
|
|
|
9070b3 |
#include "ssh.h"
|
|
|
9070b3 |
#include "ssh2.h"
|
|
|
9070b3 |
@@ -1888,6 +1892,11 @@ main(int ac, char **av)
|
|
|
9070b3 |
}
|
|
|
9070b3 |
}
|
|
|
9070b3 |
|
|
|
9070b3 |
+#ifdef HAVE_SYSTEMD
|
|
|
9070b3 |
+ /* Signal systemd that we are ready to accept connections */
|
|
|
9070b3 |
+ sd_notify(0, "READY=1");
|
|
|
9070b3 |
+#endif
|
|
|
9070b3 |
+
|
|
|
9070b3 |
/* Accept a connection and return in a forked child */
|
|
|
9070b3 |
server_accept_loop(&sock_in, &sock_out,
|
|
|
9070b3 |
&newsock, config_s);
|