From archie@packetdesign.com  Wed Jun 12 16:12:00 2002
Return-Path: <archie@packetdesign.com>
Received: from mailman.packetdesign.com (dns.packetdesign.com [65.192.41.10])
	by hub.freebsd.org (Postfix) with ESMTP id D1CC437B400
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Jun 2002 16:11:54 -0700 (PDT)
Received: from bubba.packetdesign.com (bubba.packetdesign.com [192.168.0.223])
	by mailman.packetdesign.com (8.11.6/8.11.6) with ESMTP id g5CNBri35442
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Jun 2002 16:11:53 -0700 (PDT)
	(envelope-from archie@packetdesign.com)
Received: (from archie@localhost)
	by bubba.packetdesign.com (8.11.6/8.11.6) id g5CNBqM29132;
	Wed, 12 Jun 2002 16:11:52 -0700 (PDT)
	(envelope-from archie)
Message-Id: <200206122311.g5CNBqM29132@bubba.packetdesign.com>
Date: Wed, 12 Jun 2002 16:11:52 -0700 (PDT)
From: Archie Cobbs <archie@packetdesign.com>
Reply-To: Archie Cobbs <archie@packetdesign.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: core dump bug in sshd
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         39206
>Category:       bin
>Synopsis:       core dump bug in sshd
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 12 16:20:01 PDT 2002
>Closed-Date:    Mon Jul 14 03:48:26 PDT 2003
>Last-Modified:  Mon Jul 14 03:48:26 PDT 2003
>Originator:     Archie Cobbs
>Release:        FreeBSD 4.5-RELEASE i386
>Organization:
Packet Design
>Environment:
System: FreeBSD bubba.packetdesign.com 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Sun Feb 3 10:00:07 PST 2002 archie@bubba.packetdesign.com:/usr/obj/usr/src/sys/BUBBA i386


>Description:

	Compiling sshd with -Wall produces the following output from GCC
	when -DHAVE_LOGIN_CAP is not used.

	The "newcommand" warning and the "do_child" warnings represent
	potential core dumps it appears.

	auth1.c: In function `do_authloop':
	auth1.c:88: warning: unused variable `authlog'
	session.c: In function `do_login':
	session.c:668: warning: unused variable `buf'
	session.c:666: warning: unused variable `f'
	session.c:667: warning: `newcommand' might be used uninitialized in this function
	session.c: In function `do_child':
	session.c:1299: warning: char format, different type arg (arg 3)

	Note: I've hacked the makefile to compile it like I want
	it but not any of the sources.

>How-To-Repeat:

>Fix:

	Not sure if the fix for "ttyname" is correct, but here goes:

diff -ur /usr/src/crypto/openssh/auth1.c ./auth1.c
--- /usr/src/crypto/openssh/auth1.c	Thu Sep 27 18:33:33 2001
+++ ./auth1.c	Wed Jun 12 16:05:48 2002
@@ -85,7 +85,6 @@
 	u_int ulen;
 	int type = 0;
 	struct passwd *pw = authctxt->pw;
-	void (*authlog) (const char *fmt,...) = verbose;
 #ifdef HAVE_LOGIN_CAP
 	login_cap_t *lc;
 #endif /* HAVE_LOGIN_CAP */
diff -ur /usr/src/crypto/openssh/session.c ./session.c
--- /usr/src/crypto/openssh/session.c	Sun Dec  2 16:53:28 2001
+++ ./session.c	Wed Jun 12 16:09:15 2002
@@ -663,9 +663,11 @@
 void
 do_login(Session *s, const char *command)
 {
-	FILE *f;
-	char *time_string, *newcommand;
+	char *time_string, *newcommand = NULL;
+#ifdef HAVE_LOGIN_CAP
 	char buf[256];
+	FILE *f;
+#endif
 	char hostname[MAXHOSTNAMELEN];
 	socklen_t fromlen;
 	struct sockaddr_storage from;
@@ -1288,7 +1290,7 @@
 		if (login_getcapbool(lc, "requirehome", 0)) {
 			(void)printf("Home directory not available\n");
 			log("LOGIN %.200s REFUSED (HOMEDIR) ON TTY %.200s",
-				pw->pw_name, ttyname);
+				pw->pw_name, ttyname(0));
 			exit(254);
 		}
 #endif /* HAVE_LOGIN_CAP */
@@ -1296,7 +1298,7 @@
 		if (chdir("/") < 0) {
 			(void)printf("Cannot find root directory\n");
 			log("LOGIN %.200s REFUSED (ROOTDIR) ON TTY %.200s",
-				pw->pw_name, ttyname);
+				pw->pw_name, ttyname(0));
 			exit(254);
 		}
 		if (!check_quietlogin(s, command) || *pw->pw_dir)

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Fri Jun 14 17:56:42 PDT 2002 
Responsible-Changed-Why:  


http://www.freebsd.org/cgi/query-pr.cgi?pr=39206 
Responsible-Changed-From-To: des->freebsd-bugs 
Responsible-Changed-By: des 
Responsible-Changed-When: Sun Jun 23 14:45:50 PDT 2002 
Responsible-Changed-Why:  
I am no longer interested in maintaining OpenSSH. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=39206 
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: kris 
Responsible-Changed-When: Sat Jul 12 17:58:05 PDT 2003 
Responsible-Changed-Why:  
Assign to SSH maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=39206 
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Mon Jul 14 03:48:25 PDT 2003 
State-Changed-Why:  
OBE, resubmit if still a problem with more recent versions. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=39206 
>Unformatted:
