1 From 70fe022f9dac760eaece0228cad17e3d29a57fb8 Mon Sep 17 00:00:00 2001
2 From: Simon Josefsson <simon@josefsson.org>
3 Date: Mon, 31 Jul 2023 13:59:05 +0200
4 Subject: [PATCH] CVE-2023-40303: Indent changes in previous commit.
7 Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=9122999252c7e21eb7774de11d539748e7bdf46d]
8 Signed-off-by: Khem Raj <raj.khem@gmail.com>
10 src/rcp.c | 42 ++++++++++++++++++++++++------------------
11 src/rlogin.c | 12 ++++++------
12 src/rsh.c | 24 ++++++++++++------------
13 src/rshd.c | 24 ++++++++++++------------
14 src/uucpd.c | 16 ++++++++--------
15 5 files changed, 62 insertions(+), 56 deletions(-)
17 diff --git a/src/rcp.c b/src/rcp.c
18 index cdcf8500..652f22e6 100644
21 @@ -347,9 +347,10 @@ main (int argc, char *argv[])
24 if (setuid (userid) == -1)
26 - error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
29 + error (EXIT_FAILURE, 0,
30 + "Could not drop privileges (setuid() failed)");
35 @@ -358,9 +359,10 @@ main (int argc, char *argv[])
38 if (setuid (userid) == -1)
40 - error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
43 + error (EXIT_FAILURE, 0,
44 + "Could not drop privileges (setuid() failed)");
49 @@ -548,9 +550,10 @@ toremote (char *targ, int argc, char *argv[])
52 if (setuid (userid) == -1)
54 - error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
57 + error (EXIT_FAILURE, 0,
58 + "Could not drop privileges (setuid() failed)");
63 @@ -645,9 +648,10 @@ tolocal (int argc, char *argv[])
66 if (seteuid (userid) == -1)
68 - error (EXIT_FAILURE, 0, "Could not drop privileges (seteuid() failed)");
71 + error (EXIT_FAILURE, 0,
72 + "Could not drop privileges (seteuid() failed)");
75 #if defined IP_TOS && defined IPPROTO_IP && defined IPTOS_THROUGHPUT
77 @@ -663,9 +667,10 @@ tolocal (int argc, char *argv[])
80 if (seteuid (effuid) == -1)
82 - error (EXIT_FAILURE, 0, "Could not drop privileges (seteuid() failed)");
85 + error (EXIT_FAILURE, 0,
86 + "Could not drop privileges (seteuid() failed)");
91 @@ -1465,9 +1470,10 @@ susystem (char *s, int userid)
94 if (setuid (userid) == -1)
96 - error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
99 + error (EXIT_FAILURE, 0,
100 + "Could not drop privileges (setuid() failed)");
103 execl (PATH_BSHELL, "sh", "-c", s, NULL);
105 diff --git a/src/rlogin.c b/src/rlogin.c
106 index c543de0c..4360202f 100644
109 @@ -648,14 +648,14 @@ try_connect:
110 to get the privileged port that rcmd () uses. We now want, however,
111 to run as the real user who invoked us. */
112 if (seteuid (uid) == -1)
114 - error (EXIT_FAILURE, 0, "Could not drop privileges (seteuid() failed)");
117 + error (EXIT_FAILURE, 0, "Could not drop privileges (seteuid() failed)");
120 if (setuid (uid) == -1)
122 - error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
125 + error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
128 doit (&osmask); /* The old mask will activate SIGURG and SIGUSR1! */
130 diff --git a/src/rsh.c b/src/rsh.c
131 index 6f60667d..179b47cd 100644
134 @@ -278,14 +278,14 @@ main (int argc, char **argv)
135 *argv = (char *) "rlogin";
137 if (seteuid (getuid ()) == -1)
139 - error (EXIT_FAILURE, errno, "seteuid() failed");
142 + error (EXIT_FAILURE, errno, "seteuid() failed");
145 if (setuid (getuid ()) == -1)
147 - error (EXIT_FAILURE, errno, "setuid() failed");
150 + error (EXIT_FAILURE, errno, "setuid() failed");
153 execv (PATH_RLOGIN, argv);
154 error (EXIT_FAILURE, errno, "cannot execute %s", PATH_RLOGIN);
155 @@ -551,14 +551,14 @@ try_connect:
158 if (seteuid (uid) == -1)
160 - error (EXIT_FAILURE, errno, "seteuid() failed");
163 + error (EXIT_FAILURE, errno, "seteuid() failed");
166 if (setuid (uid) == -1)
168 - error (EXIT_FAILURE, errno, "setuid() failed");
171 + error (EXIT_FAILURE, errno, "setuid() failed");
174 #ifdef HAVE_SIGACTION
176 diff --git a/src/rshd.c b/src/rshd.c
177 index 707790e7..3a153a18 100644
180 @@ -1848,16 +1848,16 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
182 /* Set the gid, then uid to become the user specified by "locuser" */
183 if (setegid ((gid_t) pwd->pw_gid) == -1)
185 - rshd_error ("Cannot drop privileges (setegid() failed)\n");
186 - exit (EXIT_FAILURE);
189 + rshd_error ("Cannot drop privileges (setegid() failed)\n");
190 + exit (EXIT_FAILURE);
193 if (setgid ((gid_t) pwd->pw_gid) == -1)
195 - rshd_error ("Cannot drop privileges (setgid() failed)\n");
196 - exit (EXIT_FAILURE);
199 + rshd_error ("Cannot drop privileges (setgid() failed)\n");
200 + exit (EXIT_FAILURE);
203 #ifdef HAVE_INITGROUPS
204 initgroups (pwd->pw_name, pwd->pw_gid); /* BSD groups */
205 @@ -1881,10 +1881,10 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
206 #endif /* WITH_PAM */
208 if (setuid ((uid_t) pwd->pw_uid) == -1)
210 - rshd_error ("Cannot drop privileges (setuid() failed)\n");
211 - exit (EXIT_FAILURE);
214 + rshd_error ("Cannot drop privileges (setuid() failed)\n");
215 + exit (EXIT_FAILURE);
218 /* We'll execute the client's command in the home directory
219 * of locuser. Note, that the chdir must be executed after
220 diff --git a/src/uucpd.c b/src/uucpd.c
221 index 29cfce35..fde7b9c9 100644
224 @@ -254,10 +254,10 @@ doit (struct sockaddr *sap, socklen_t salen)
225 dologin (pw, sap, salen);
227 if (setgid (pw->pw_gid) == -1)
229 - fprintf (stderr, "setgid() failed");
233 + fprintf (stderr, "setgid() failed");
236 #ifdef HAVE_INITGROUPS
237 initgroups (pw->pw_name, pw->pw_gid);
239 @@ -268,10 +268,10 @@ doit (struct sockaddr *sap, socklen_t salen)
242 if (setuid (pw->pw_uid) == -1)
244 - fprintf (stderr, "setuid() failed");
248 + fprintf (stderr, "setuid() failed");
252 execl (uucico_location, "uucico", NULL);
253 perror ("uucico server: execl");