]>
Commit | Line | Data |
---|---|---|
1 | diff -urNp -x '*.orig' openssh-8.4p1.org/clientloop.c openssh-8.4p1/clientloop.c | |
2 | --- openssh-8.4p1.org/clientloop.c 2020-09-27 09:25:01.000000000 +0200 | |
3 | +++ openssh-8.4p1/clientloop.c 2021-03-01 11:29:10.909905265 +0100 | |
4 | @@ -127,6 +127,9 @@ extern int fork_after_authentication_fla | |
5 | /* Control socket */ | |
6 | extern int muxserver_sock; /* XXX use mux_client_cleanup() instead */ | |
7 | ||
8 | +/* if we process SIGPIPE */ | |
9 | +extern int enable_sigpipe; | |
10 | + | |
11 | /* | |
12 | * Name of the host we are connecting to. This is the name given on the | |
13 | * command line, or the Hostname specified for the user-supplied name in a | |
14 | @@ -1301,6 +1304,8 @@ client_loop(struct ssh *ssh, int have_pt | |
15 | ssh_signal(SIGQUIT, signal_handler); | |
16 | if (ssh_signal(SIGTERM, SIG_IGN) != SIG_IGN) | |
17 | ssh_signal(SIGTERM, signal_handler); | |
18 | + if (enable_sigpipe) | |
19 | + signal(SIGPIPE, signal_handler); | |
20 | ssh_signal(SIGWINCH, window_change_handler); | |
21 | ||
22 | if (have_pty) | |
23 | diff -urNp -x '*.orig' openssh-8.4p1.org/ssh.0 openssh-8.4p1/ssh.0 | |
24 | --- openssh-8.4p1.org/ssh.0 2020-09-27 09:42:10.000000000 +0200 | |
25 | +++ openssh-8.4p1/ssh.0 2021-03-01 11:29:10.909905265 +0100 | |
26 | @@ -446,6 +446,8 @@ DESCRIPTION | |
27 | -y Send log information using the syslog(3) system module. By | |
28 | default this information is sent to stderr. | |
29 | ||
30 | + -Z Enable SIGPIPE processing. | |
31 | + | |
32 | ssh may additionally obtain configuration data from a per-user | |
33 | configuration file and a system-wide configuration file. The file format | |
34 | and configuration options are described in ssh_config(5). | |
35 | diff -urNp -x '*.orig' openssh-8.4p1.org/ssh.1 openssh-8.4p1/ssh.1 | |
36 | --- openssh-8.4p1.org/ssh.1 2020-09-27 09:25:01.000000000 +0200 | |
37 | +++ openssh-8.4p1/ssh.1 2021-03-01 11:29:10.909905265 +0100 | |
38 | @@ -42,7 +42,7 @@ | |
39 | .Nd OpenSSH remote login client | |
40 | .Sh SYNOPSIS | |
41 | .Nm ssh | |
42 | -.Op Fl 46AaCfGgKkMNnqsTtVvXxYy | |
43 | +.Op Fl 46AaCfGgKkMNnqsTtVvXxYyZ | |
44 | .Op Fl B Ar bind_interface | |
45 | .Op Fl b Ar bind_address | |
46 | .Op Fl c Ar cipher_spec | |
47 | @@ -142,6 +142,11 @@ on the local machine as the source addre | |
48 | of the connection. | |
49 | Only useful on systems with more than one address. | |
50 | .Pp | |
51 | +.It Fl Z | |
52 | +Enables processing of SIGPIPE. Useful when using ssh output as input for | |
53 | +another process, for example in a shell script. Be careful - it may break | |
54 | +port/X11 forwarding when used. | |
55 | +.Pp | |
56 | .It Fl C | |
57 | Requests compression of all data (including stdin, stdout, stderr, and | |
58 | data for forwarded X11, TCP and | |
59 | diff -urNp -x '*.orig' openssh-8.4p1.org/ssh.c openssh-8.4p1/ssh.c | |
60 | --- openssh-8.4p1.org/ssh.c 2020-09-27 09:25:01.000000000 +0200 | |
61 | +++ openssh-8.4p1/ssh.c 2021-03-01 11:29:10.909905265 +0100 | |
62 | @@ -190,6 +190,9 @@ struct sshbuf *command; | |
63 | /* command to be executed */ | |
64 | struct sshbuf *command; | |
65 | ||
66 | +/* Enable sigpipe */ | |
67 | +int enable_sigpipe = 0; | |
68 | + | |
69 | /* # of replies received for global requests */ | |
70 | static int forward_confirms_pending = -1; | |
71 | ||
72 | @@ -203,7 +206,7 @@ static void | |
73 | usage(void) | |
74 | { | |
75 | fprintf(stderr, | |
76 | -"usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]\n" | |
77 | +"usage: ssh [-46AaCfGgKkMNnqsTtVvXxYyZ] [-B bind_interface]\n" | |
78 | " [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]\n" | |
79 | " [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]\n" | |
80 | " [-i identity_file] [-J [user@]host[:port]] [-L address]\n" | |
81 | @@ -722,7 +725,7 @@ main(int ac, char **av) | |
82 | ||
83 | again: | |
84 | while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx" | |
85 | - "AB:CD:E:F:GI:J:KL:MNO:PQ:R:S:TVw:W:XYy")) != -1) { | |
86 | + "AB:CD:E:F:GI:J:KL:MNO:PQ:R:S:TVw:W:XYyZ")) != -1) { | |
87 | switch (opt) { | |
88 | case '1': | |
89 | fatal("SSH protocol v.1 is no longer supported"); | |
90 | @@ -1066,6 +1069,9 @@ main(int ac, char **av) | |
91 | case 'F': | |
92 | config = optarg; | |
93 | break; | |
94 | + case 'Z': | |
95 | + enable_sigpipe = 1; | |
96 | + break; | |
97 | default: | |
98 | usage(); | |
99 | } |