Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Dec 2002 16:07:45 +0100 (CET)
From:      Hartmut Brandt <brandt@fokus.gmd.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/45967: telnetd does not set SO_DEBUG for -debug option
Message-ID:  <200212031507.gB3F7j1X002225@beagle.fokus.gmd.de>

next in thread | raw e-mail | index | archive | help

>Number:         45967
>Category:       bin
>Synopsis:       telnetd does not set SO_DEBUG for -debug option
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 03 07:10:01 PST 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212031507.gB3F7j1X002225>