summaryrefslogtreecommitdiff
path: root/debian/patches/sigstop.patch
blob: 43d3937e516af6f453609a2c120118a8b7ba63be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From a91715df66fc2a0b7792e87a864c334f4cb15043 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Sun, 9 Feb 2014 16:10:17 +0000
Subject: Support synchronisation with service supervisor using SIGSTOP

Author: Robie Basak <robie.basak@ubuntu.com>
Forwarded: no
Last-Update: 2014-04-14

Patch-Name: sigstop.patch
---
 sshd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sshd.c b/sshd.c
index f2f54b51..a2ca2d3e 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1892,6 +1892,16 @@ main(int ac, char **av)
 			}
 		}
 
+		if (getenv("SSH_SIGSTOP")) {
+			/* Tell service supervisor that we are ready. */
+			kill(getpid(), SIGSTOP);
+			/* The service supervisor only ever expects a single
+			 * STOP signal, so do not ever signal it again, even
+			 * in the case of a re-exec or future children.
+			 */
+			unsetenv("SSH_SIGSTOP");
+		}
+
 		/* Accept a connection and return in a forked child */
 		server_accept_loop(&sock_in, &sock_out,
 		    &newsock, config_s);