summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--pty.c42
-rw-r--r--ssh-agent.c6
-rw-r--r--ssh-keyscan.c14
4 files changed, 64 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 3252d4214..201aa4283 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,25 @@
120001215
2 - (stevesk) OpenBSD CVS updates:
3 - markus@cvs.openbsd.org 2000/12/13 16:26:53
4 [ssh-keyscan.c]
5 fatal already adds \n; from stevesk@pobox.com
6 - markus@cvs.openbsd.org 2000/12/13 16:25:44
7 [ssh-agent.c]
8 remove redundant spaces; from stevesk@pobox.com
9 - ho@cvs.openbsd.org 2000/12/12 15:50:21
10 [pty.c]
11 When failing to set tty owner and mode on a read-only filesystem, don't
12 abort if the tty already has correct owner and reasonably sane modes.
13 Example; permit 'root' to login to a firewall with read-only root fs.
14 (markus@ ok)
15 - deraadt@cvs.openbsd.org 2000/12/13 06:36:05
16 [pty.c]
17 KNF
18
120001213 1920001213
2 - (djm) Make sure we reset the SIGPIPE disposition after we fork. Report 20 - (djm) Make sure we reset the SIGPIPE disposition after we fork. Report
3 from Andreas M. Kirchwitz <amk@krell.zikzak.de> 21 from Andreas M. Kirchwitz <amk@krell.zikzak.de>
4 - (stevesk) OpenSSH CVS update: 22 - (stevesk) OpenBSD CVS update:
5 - markus@cvs.openbsd.org 2000/12/12 15:30:02 23 - markus@cvs.openbsd.org 2000/12/12 15:30:02
6 [ssh-keyscan.c ssh.c sshd.c] 24 [ssh-keyscan.c ssh.c sshd.c]
7 consistently use __progname; from stevesk@pobox.com 25 consistently use __progname; from stevesk@pobox.com
@@ -62,7 +80,7 @@
62 tweak comment to reflect real location of pid file; ok provos@ 80 tweak comment to reflect real location of pid file; ok provos@
63 - (stevesk) Import <sys/queue.h> from OpenBSD for systems that don't 81 - (stevesk) Import <sys/queue.h> from OpenBSD for systems that don't
64 have it (used in ssh-keyscan). 82 have it (used in ssh-keyscan).
65 - (stevesk) OpenSSH CVS update: 83 - (stevesk) OpenBSD CVS update:
66 - markus@cvs.openbsd.org 2000/12/06 19:57:48 84 - markus@cvs.openbsd.org 2000/12/06 19:57:48
67 [ssh-keyscan.c] 85 [ssh-keyscan.c]
68 err(3) -> internal error(), from stevesk@sweden.hp.com 86 err(3) -> internal error(), from stevesk@sweden.hp.com
diff --git a/pty.c b/pty.c
index 40bfd5290..d05cb89a7 100644
--- a/pty.c
+++ b/pty.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: pty.c,v 1.16 2000/09/07 21:13:37 markus Exp $"); 15RCSID("$OpenBSD: pty.c,v 1.18 2000/12/13 06:36:05 deraadt Exp $");
16 16
17#ifdef HAVE_UTIL_H 17#ifdef HAVE_UTIL_H
18# include <util.h> 18# include <util.h>
@@ -291,6 +291,7 @@ pty_setowner(struct passwd *pw, const char *ttyname)
291 struct group *grp; 291 struct group *grp;
292 gid_t gid; 292 gid_t gid;
293 mode_t mode; 293 mode_t mode;
294 struct stat st;
294 295
295 /* Determine the group to make the owner of the tty. */ 296 /* Determine the group to make the owner of the tty. */
296 grp = getgrnam("tty"); 297 grp = getgrnam("tty");
@@ -302,11 +303,36 @@ pty_setowner(struct passwd *pw, const char *ttyname)
302 mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH; 303 mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH;
303 } 304 }
304 305
305 /* Change ownership of the tty. */ 306 /*
306 if (chown(ttyname, pw->pw_uid, gid) < 0) 307 * Change owner and mode of the tty as required.
307 fatal("chown(%.100s, %d, %d) failed: %.100s", 308 * Warn but continue if filesystem is read-only and the uids match.
308 ttyname, pw->pw_uid, gid, strerror(errno)); 309 */
309 if (chmod(ttyname, mode) < 0) 310 if (stat(ttyname, &st))
310 fatal("chmod(%.100s, 0%o) failed: %.100s", 311 fatal("stat(%.100s) failed: %.100s", ttyname,
311 ttyname, mode, strerror(errno)); 312 strerror(errno));
313
314 if (st.st_uid != pw->pw_uid || st.st_gid != gid) {
315 if (chown(ttyname, pw->pw_uid, gid) < 0) {
316 if (errno == EROFS && st.st_uid == pw->pw_uid)
317 error("chown(%.100s, %d, %d) failed: %.100s",
318 ttyname, pw->pw_uid, gid,
319 strerror(errno));
320 else
321 fatal("chown(%.100s, %d, %d) failed: %.100s",
322 ttyname, pw->pw_uid, gid,
323 strerror(errno));
324 }
325 }
326
327 if ((st.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO)) != mode) {
328 if (chmod(ttyname, mode) < 0) {
329 if (errno == EROFS &&
330 (st.st_mode & (S_IRGRP | S_IROTH)) == 0)
331 error("chmod(%.100s, 0%o) failed: %.100s",
332 ttyname, mode, strerror(errno));
333 else
334 fatal("chmod(%.100s, 0%o) failed: %.100s",
335 ttyname, mode, strerror(errno));
336 }
337 }
312} 338}
diff --git a/ssh-agent.c b/ssh-agent.c
index b98d95501..c5e4447c4 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-agent.c,v 1.42 2000/12/09 14:06:54 markus Exp $ */ 1/* $OpenBSD: ssh-agent.c,v 1.43 2000/12/13 23:25:44 markus Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: ssh-agent.c,v 1.42 2000/12/09 14:06:54 markus Exp $"); 40RCSID("$OpenBSD: ssh-agent.c,v 1.43 2000/12/13 23:25:44 markus Exp $");
41 41
42#include "ssh.h" 42#include "ssh.h"
43#include "rsa.h" 43#include "rsa.h"
@@ -242,7 +242,7 @@ process_sign_request2(SocketEntry *e)
242 int ok = -1; 242 int ok = -1;
243 243
244 datafellows = 0; 244 datafellows = 0;
245 245
246 blob = buffer_get_string(&e->input, &blen); 246 blob = buffer_get_string(&e->input, &blen);
247 data = buffer_get_string(&e->input, &dlen); 247 data = buffer_get_string(&e->input, &dlen);
248 248
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 13f9673b5..60341c9e9 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -329,9 +329,9 @@ conalloc(char *iname, char *oname)
329 } while ((s = tcpconnect(name)) < 0); 329 } while ((s = tcpconnect(name)) < 0);
330 330
331 if (s >= maxfd) 331 if (s >= maxfd)
332 fatal("conalloc: fdno %d too high\n", s); 332 fatal("conalloc: fdno %d too high", s);
333 if (fdcon[s].c_status) 333 if (fdcon[s].c_status)
334 fatal("conalloc: attempt to reuse fdno %d\n", s); 334 fatal("conalloc: attempt to reuse fdno %d", s);
335 335
336 fdcon[s].c_fd = s; 336 fdcon[s].c_fd = s;
337 fdcon[s].c_status = CS_CON; 337 fdcon[s].c_status = CS_CON;
@@ -355,7 +355,7 @@ confree(int s)
355{ 355{
356 close(s); 356 close(s);
357 if (s >= maxfd || fdcon[s].c_status == CS_UNUSED) 357 if (s >= maxfd || fdcon[s].c_status == CS_UNUSED)
358 fatal("confree: attempt to free bad fdno %d\n", s); 358 fatal("confree: attempt to free bad fdno %d", s);
359 free(fdcon[s].c_namebase); 359 free(fdcon[s].c_namebase);
360 free(fdcon[s].c_output_name); 360 free(fdcon[s].c_output_name);
361 if (fdcon[s].c_status == CS_KEYS) 361 if (fdcon[s].c_status == CS_KEYS)
@@ -455,7 +455,7 @@ conread(int s)
455 return; 455 return;
456 break; 456 break;
457 default: 457 default:
458 fatal("conread: invalid status %d\n", c->c_status); 458 fatal("conread: invalid status %d", c->c_status);
459 break; 459 break;
460 } 460 }
461 461
@@ -548,7 +548,7 @@ nexthost(int argc, char **argv)
548static void 548static void
549usage(void) 549usage(void)
550{ 550{
551 fatal("usage: %s [-t timeout] { [--] host | -f file } ...\n", __progname); 551 fatal("usage: %s [-t timeout] { [--] host | -f file } ...", __progname);
552 return; 552 return;
553} 553}
554 554
@@ -580,11 +580,11 @@ main(int argc, char **argv)
580 580
581 maxfd = fdlim_get(1); 581 maxfd = fdlim_get(1);
582 if (maxfd < 0) 582 if (maxfd < 0)
583 fatal("%s: fdlim_get: bad value\n", __progname); 583 fatal("%s: fdlim_get: bad value", __progname);
584 if (maxfd > MAXMAXFD) 584 if (maxfd > MAXMAXFD)
585 maxfd = MAXMAXFD; 585 maxfd = MAXMAXFD;
586 if (maxcon <= 0) 586 if (maxcon <= 0)
587 fatal("%s: not enough file descriptors\n", __progname); 587 fatal("%s: not enough file descriptors", __progname);
588 if (maxfd > fdlim_get(0)) 588 if (maxfd > fdlim_get(0))
589 fdlim_set(maxfd); 589 fdlim_set(maxfd);
590 fdcon = xmalloc(maxfd * sizeof(con)); 590 fdcon = xmalloc(maxfd * sizeof(con));