From brandt@fokus.gmd.de  Tue Dec  3 07:07:48 2002
Return-Path: <brandt@fokus.gmd.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 82B2437B404
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  3 Dec 2002 07:07:48 -0800 (PST)
Received: from mailhub.fokus.gmd.de (mailhub.fokus.gmd.de [193.174.154.14])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7D60A43E4A
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  3 Dec 2002 07:07:47 -0800 (PST)
	(envelope-from brandt@fokus.gmd.de)
Received: from beagle.fokus.gmd.de (beagle [193.175.132.100])
	by mailhub.fokus.gmd.de (8.11.6/8.11.6) with ESMTP id gB3F7jn24688
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 3 Dec 2002 16:07:45 +0100 (MET)
Received: from beagle.fokus.gmd.de (localhost [127.0.0.1])
	by beagle.fokus.gmd.de (8.12.6/8.12.6) with ESMTP id gB3F7jeU002226
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 3 Dec 2002 16:07:45 +0100 (CET)
	(envelope-from hbb@beagle.fokus.gmd.de)
Received: (from root@localhost)
	by beagle.fokus.gmd.de (8.12.6/8.12.6/Submit) id gB3F7j1X002225;
	Tue, 3 Dec 2002 16:07:45 +0100 (CET)
	(envelope-from hbb)
Message-Id: <200212031507.gB3F7j1X002225@beagle.fokus.gmd.de>
Date: Tue, 3 Dec 2002 16:07:45 +0100 (CET)
From: Hartmut Brandt <brandt@fokus.gmd.de>
Reply-To: Hartmut Brandt <brandt@fokus.gmd.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: telnetd does not set SO_DEBUG for -debug option
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         45967
>Category:       bin
>Synopsis:       telnetd does not set SO_DEBUG for -debug option
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    markm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 03 07:10:01 PST 2002
>Closed-Date:    Wed Aug 13 04:03:41 PDT 2003
>Last-Modified:  Wed Aug 13 04:03:41 PDT 2003
>Originator:     Hartmut Brandt
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Fraunhofer Fokus
>Environment:
System: FreeBSD beagle.fokus.gmd.de 5.0-CURRENT FreeBSD 5.0-CURRENT #4: Thu Oct 17 15:52:15 CEST 2002 hbb@beagle.fokus.gmd.de:/opt/obj/usr/src/sys/BEAGLE i386


	
>Description:

man telnet describes that the -debug option to telnetd sets the SO_DEBUG
option on the telnet socket. This is not actually the case.

>How-To-Repeat:

Compile a kernel with TCPDEBUG set.

Invoke telnetd -debug.

Establish a connection to the telnetd.

Call trpt and observe, that there is no output (for the telnetd sockets).
>Fix:

Apply the following patch to the telnetd source.


Index: telnetd.c
===================================================================
RCS file: /usr/ncvs/src/libexec/telnetd/telnetd.c,v
retrieving revision 1.33
diff -c -r1.33 telnetd.c
*** telnetd.c	30 Nov 2001 22:37:28 -0000	1.33
--- telnetd.c	3 Dec 2002 15:03:17 -0000
***************
*** 287,292 ****
--- 287,295 ----
  		    err(1, "socket");
  	    (void) setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
  				(char *)&on, sizeof(on));
+ 	    (void) setsockopt(s, SOL_SOCKET, SO_DEBUG,
+ 				(char *)&on, sizeof(on));
+ 
  	    if (bind(s, res->ai_addr, res->ai_addrlen) < 0)
  		err(1, "bind");
  	    if (listen(s, 1) < 0)
***************
*** 295,300 ****
--- 298,305 ----
  	    ns = accept(s, res->ai_addr, &foo);
  	    if (ns < 0)
  		err(1, "accept");
+ 	    (void) setsockopt(ns, SOL_SOCKET, SO_DEBUG,
+ 				(char *)&on, sizeof(on));
  	    (void) dup2(ns, 0);
  	    (void) close(ns);
  	    (void) close(s);
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->markm 
Responsible-Changed-By: kris 
Responsible-Changed-When: Fri Jul 18 15:02:25 PDT 2003 
Responsible-Changed-Why:  
Assign to telnet maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45967 
State-Changed-From-To: open->closed 
State-Changed-By: harti 
State-Changed-When: Wed Aug 13 04:02:49 PDT 2003 
State-Changed-Why:  
Patch okay'ed by markm and committed. 

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