Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libtelnet Fix the check for insecure root logins in root...



details:   https://anonhg.NetBSD.org/src/rev/b1062e33e5fa
branches:  trunk
changeset: 580707:b1062e33e5fa
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu May 05 02:20:45 2005 +0000

description:
Fix the check for insecure root logins in rootterm():
- It was originally referring to a bogus version of `line'.
  (problem solved by using 'extern char *line' instead of 'extern char line[]')
- It wasn't stripping the leading "/dev/" off `line' before calling getttynam(3)

diffstat:

 lib/libtelnet/sra.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r 281926a26726 -r b1062e33e5fa lib/libtelnet/sra.c
--- a/lib/libtelnet/sra.c       Thu May 05 01:58:51 2005 +0000
+++ b/lib/libtelnet/sra.c       Thu May 05 02:20:45 2005 +0000
@@ -32,13 +32,14 @@
 #ifdef notdef
 __FBSDID("$FreeBSD: src/contrib/telnet/libtelnet/sra.c,v 1.16 2002/05/06 09:48:02 markm Exp $");
 #else
-__RCSID("$NetBSD: sra.c,v 1.3 2005/04/19 03:19:46 christos Exp $");
+__RCSID("$NetBSD: sra.c,v 1.4 2005/05/05 02:20:45 lukem Exp $");
 #endif
 
 #ifdef SRA
 #ifdef ENCRYPTION
 #include <sys/types.h>
 #include <arpa/telnet.h>
+#include <paths.h>
 #include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -63,7 +64,7 @@
 IdeaData ik;
 
 extern int auth_debug_mode;
-extern char line[];
+extern char *line;             /* see sys_term.c */
 
 static int sra_valid = 0;
 static int passwd_sent = 0;
@@ -429,9 +430,14 @@
 }
 
 static int
-rootterm(char *ttyn)
+rootterm(const char *ttyname)
 {
        struct ttyent *t;
+       const char *ttyn;
+
+       ttyn = ttyname;
+       if (strncmp(ttyn, _PATH_DEV, sizeof(_PATH_DEV)-1) == 0)
+               ttyn += sizeof(_PATH_DEV) - 1;
 
        return ((t = getttynam(ttyn)) && t->ty_status & TTY_SECURE);
 }



Home | Main Index | Thread Index | Old Index