openssh/openssh-9.5p1-systemd.patch

89 lines
2.7 KiB
Diff
Raw Normal View History

2023-11-06 15:17:50 +03:00
diff -ur openssh-9.5p1/configure.ac openssh-9.5p1_patched/configure.ac
--- openssh-9.5p1/configure.ac 2023-10-04 07:34:10.000000000 +0300
+++ openssh-9.5p1_patched/configure.ac 2023-11-06 14:04:09.309023624 +0300
@@ -4814,6 +4814,30 @@
AC_SUBST([K5LIBS])
2023-11-06 15:17:50 +03:00
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
2023-11-06 15:17:50 +03:00
@@ -5613,6 +5637,7 @@
echo " Solaris process contract support: $SPC_MSG"
echo " Solaris project support: $SP_MSG"
echo " Solaris privilege support: $SPP_MSG"
+echo " systemd support: $SYSTEMD_MSG"
echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
echo " BSD Auth support: $BSD_AUTH_MSG"
2023-11-06 15:17:50 +03:00
diff -Naur openssh-9.5p1/contrib/sshd.service openssh-9.5p1_patched/contrib/sshd.service
--- openssh-9.5p1/contrib/sshd.service 1970-01-01 03:00:00.000000000 +0300
+++ openssh-9.5p1_patched/contrib/sshd.service 2023-11-06 14:04:09.309023624 +0300
@@ -0,0 +1,16 @@
+[Unit]
+Description=OpenSSH server daemon
+Documentation=man:sshd(8) man:sshd_config(5)
+After=network.target
+
+[Service]
+Type=notify
+ExecStart=/usr/sbin/sshd -D $OPTIONS
+ExecReload=/bin/kill -HUP $MAINPID
+KillMode=process
+Restart=on-failure
+RestartPreventExitStatus=255
+
+[Install]
+WantedBy=multi-user.target
+
2023-11-06 15:17:50 +03:00
diff -ur openssh-9.5p1/sshd.c openssh-9.5p1_patched/sshd.c
--- openssh-9.5p1/sshd.c 2023-11-06 14:00:40.499853793 +0300
+++ openssh-9.5p1_patched/sshd.c 2023-11-06 14:04:09.310023601 +0300
@@ -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"
2023-11-06 15:17:50 +03:00
@@ -2098,6 +2102,11 @@
}
}
+#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);