Dash:
[t2.git] / package / network / netkit-rsh / hotfix-glibc.patch
blob0b31e2bc25b7f4ffb50b04fe206ea8b6e932d004
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../netkit-rsh/glibc.patch
5 # Copyright (C) 2009 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
17 diff -Naur ./rexecd/rexecd.c ../copy/rexecd/rexecd.c
18 --- ./rexecd/rexecd.c 2000-07-23 06:16:22.000000000 +0200
19 +++ ../copy/rexecd/rexecd.c 2008-06-13 21:33:11.000000000 +0200
20 @@ -223,7 +223,8 @@
21 static void
22 doit(struct sockaddr_in *fromp)
24 - char cmdbuf[ARG_MAX+1];
25 + char *cmdbuf;
26 + long cmdbuflen;
27 char user[16], pass[16];
28 struct passwd *pwd;
29 int s = -1;
30 @@ -242,6 +243,18 @@
31 #endif
32 #endif /* USE_PAM */
34 + cmdbuflen = sysconf (_SC_ARG_MAX);
35 + if (!(cmdbuflen > 0)) {
36 + syslog (LOG_ERR, "sysconf (_SC_ARG_MAX) failed");
37 + fatal ("sysconf (_SC_ARG_MAX) failed\n");
38 + }
40 + cmdbuf = malloc (++cmdbuflen);
41 + if (cmdbuf == NULL) {
42 + syslog (LOG_ERR, "Could not allocate space for cmdbuf");
43 + fatal ("Could not allocate space for cmdbuf\n");
44 + }
46 signal(SIGINT, SIG_DFL);
47 signal(SIGQUIT, SIG_DFL);
48 signal(SIGTERM, SIG_DFL);
49 @@ -291,7 +304,7 @@
51 getstr(user, sizeof(user), "username too long\n");
52 getstr(pass, sizeof(pass), "password too long\n");
53 - getstr(cmdbuf, sizeof(cmdbuf), "command too long\n");
54 + getstr(cmdbuf, cmdbuflen, "command too long\n");
55 #ifdef USE_PAM
56 #define PAM_BAIL if (pam_error != PAM_SUCCESS) { \
57 pam_end(pamh, pam_error); exit(1); \
58 diff -Naur ./rshd/rshd.c ../copy/rshd/rshd.c
59 --- ./rshd/rshd.c 2008-06-13 21:40:15.000000000 +0200
60 +++ ../copy/rshd/rshd.c 2008-06-13 21:45:04.000000000 +0200
61 @@ -337,7 +337,8 @@
62 static void
63 doit(struct sockaddr_in *fromp)
65 - char cmdbuf[ARG_MAX+1];
66 + char *cmdbuf;
67 + long cmdbuflen;
68 const char *theshell, *shellname;
69 char locuser[16], remuser[16];
70 struct passwd *pwd;
71 @@ -346,6 +347,18 @@
72 u_short port;
73 int pv[2], pid, ifd;
75 + cmdbuflen = sysconf (_SC_ARG_MAX);
76 + if (!(cmdbuflen > 0)) {
77 + syslog (LOG_ERR, "sysconf (_SC_ARG_MAX) failed");
78 + exit (1);
79 + }
81 + cmdbuf = malloc (++cmdbuflen);
82 + if (cmdbuf == NULL) {
83 + syslog (LOG_ERR, "Could not allocate space for cmdbuf");
84 + exit (1);
85 + }
87 signal(SIGINT, SIG_DFL);
88 signal(SIGQUIT, SIG_DFL);
89 signal(SIGTERM, SIG_DFL);