Subject: bin/581: small bug in telnet src
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Brian D. Carlstrom <bdc@JOLT.MIT.EDU>
List: netbsd-bugs
Date: 11/20/1994 13:35:05
>Number:         581
>Category:       bin
>Synopsis:       small bug in telnet src
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 20 13:35:03 1994
>Originator:     Brian D. Carlstrom
>Organization:
"MIT AI Lab	"
>Release:        1.0
>Environment:
	
System: NetBSD fnord.mit.edu 1.0 NetBSD 1.0 (FNORD) #0: Fri Oct 21 15:03:57 EDT 1994 bdc@fnord.mit.edu:/usr/src/sys/arch/i386/compile/FNORD i386


>Description:

In a part of the telnet/commands.c file, an ifdef'ed out part of the
code for pre-4.3 systems has a incorrect number of arguments, probably
because they used the sugary SetSockOpt when they wanted setsockopt.

>How-To-Repeat:

look below line 494, given below. the #else part has a SetSockOpt that
takes 5 arguments, when it takes 4. however, setsockopt would make
sense there i believe:

    static int
togdebug()
{
#ifndef	NOT43
    if (net > 0 &&
	(SetSockOpt(net, SOL_SOCKET, SO_DEBUG, debug)) < 0) {
	    perror("setsockopt (SO_DEBUG)");
    }
#else	/* NOT43 */
    if (debug) {
	if (net > 0 && SetSockOpt(net, SOL_SOCKET, SO_DEBUG, 0, 0) < 0)
	    perror("setsockopt (SO_DEBUG)");
    } else
	printf("Cannot turn off socket debugging\n");
#endif	/* NOT43 */
    return 1;
}

>Fix:

change the like to be "SetSockOpt(net,SOL_SOCKET,SO_DEBUG,1)" (to turn it on),
or change it to "setsockopt(net,SOL_SOCKET,SO_DEBUG,0,0) to just use the
straight syscall...like i saidm this code doesnt seem to be in use really or this would have been found easily. stumbled on it looking for SockOpt examples

-bri
>Audit-Trail:
>Unformatted: