[comp.protocols.tcp-ip] tn3270 on SUNos 4.0

tomc@dftsrv.gsfc.nasa.gov (Tom Corsetti) (09/09/88)

Hi!
I'm posting this article for a friend here who has no access to 'news'.
He has a sun4 running sunos 4.0 (all the 4.3 bsd stuff).  He's trying
to get tn3270 (the telnet for emulating ibm 3270 type terminals) to 
work.  He says that it compiles ok using the makefile for 4.3 bsd.  But
when he tries to run it, he gets a segmentation fault when the software
appears to be trying to make a connection.  Has anyone out there got
any suggestions, or run into this problem before?  Thanks in advance!
                                             - Tom Corsetti

ehrlich@blitz (Dan Ehrlich) (09/12/88)

In article <57@dftsrv.gsfc.nasa.gov> tomc@dftsrv.gsfc.nasa.gov (Tom Corsetti) writes:
>Hi!
>I'm posting this article for a friend here who has no access to 'news'.
>He has a sun4 running sunos 4.0 (all the 4.3 bsd stuff).  He's trying
>to get tn3270 (the telnet for emulating ibm 3270 type terminals) to 
>work.  He says that it compiles ok using the makefile for 4.3 bsd.  But
>when he tries to run it, he gets a segmentation fault when the software
>appears to be trying to make a connection.  Has anyone out there got
>any suggestions, or run into this problem before?  Thanks in advance!
>                                             - Tom Corsetti

Somewhere in TN3270 a null pointer is being dereferenced.  I do not
remember exactly which module(s) was (were) at fault, but we found it
pretty quickly using DBX.  I will diff what we compiled on our Sun4
against what is running on our VAX and post the diffs if someelse
hasn't already done so.

Dan Ehrlich <ehrlich@blitz.cs.psu.edu> | Disclaimer: The opinions expressed are
The Pennsylvania State University      | my own, and should not be attributed
Department of Computer Science         | to anyone else, living or dead.
University Park, PA   16802            |

minshall@kinetics.UUCP (Greg Minshall) (09/15/88)

From article <57@dftsrv.gsfc.nasa.gov>, by tomc@dftsrv.gsfc.nasa.gov (Tom Corsetti):
> Hi!
> I'm posting this article for a friend here who has no access to 'news'.
> He has a sun4 running sunos 4.0 (all the 4.3 bsd stuff).  He's trying
> to get tn3270 (the telnet for emulating ibm 3270 type terminals) to 
> work.  He says that it compiles ok using the makefile for 4.3 bsd.  But
> when he tries to run it, he gets a segmentation fault when the software
> appears to be trying to make a connection.  Has anyone out there got
> any suggestions, or run into this problem before?  Thanks in advance!
>                                              - Tom Corsetti

This fix goes in telnet.c (or maybe tn3270.c, if you are using an
older version).  tn3270 (and telnet, for that matter) were using
a "varargs" routine without using the "varargs" mechanism.

Replace the routine "call()" with the code below.

Sorry, about that.

Greg Minshall

----
/*
 * Call routine with argc, argv set from args (terminated by 0).
 */
#include <varargs.h>
static
call(va_alist)
va_dcl
{
    va_list ap;
    typedef int (*intrtn_t)();
    intrtn_t routine;
    char *args[100];

    int argno = 0;

    va_start(ap);
    routine = (va_arg(ap, intrtn_t));
    while (args[argno++] = va_arg(ap, char *))
	;
    va_end(ap);
    return (*routine)(argno, args);
}

minshall@kinetics.UUCP (Greg Minshall) (09/16/88)

From article <626@kinetics.UUCP>, by minshall@kinetics.UUCP (Greg Minshall):
>     return (*routine)(argno, args);
Oops (sigh) that should be
>     return (*routine)(argno-1, args);

Greg Minshall

ps - the symptom with the first "fix" is that "quit" no longer works.