Subject: klpr compilation error (was: Re: cc: Internal compiler error)
To: None <current-users@NetBSD.ORG,>
From: Christopher J Mason <cmason+@CMU.EDU>
List: current-users
Date: 11/20/1996 22:43:52
[If there is a more appropriate list (netbsd-porting@netbsd.org??) for
this, let me know and I'll stop bothering current-users]

I want to thank the three people in the CC line above for their help. 
The following fixed my problems so far:

Excerpts from mail: 20-Nov-96 Re: cc: Internal compiler e.. by Mike
Long@analog.com 
> Add
> 
> #include <sys/types.h>
> #include <sys/cdefs.h>
> 
> after the '#ifndef SOLARIS' line.  There is a bug here; <sys/exec.h>
> should #include <sys/cdefs.h> for itself.
> 

Excerpts from mail: 20-Nov-96 Re: cc: Internal compiler e.. by David
Brownlee@mono.org 
>         one option is to
>         try compiling it _with_ optimisation (Sometimes, just sometimes
>         something will compile with optimisation that won't, though its
>         usually the other way around :)

However, now I'm getting:

gcc -g  -I/usr/local/include -I/quota -I./quota
-I/usr/include/kerberosIV  -I/usr/X11R6/include  -DCSRG_BASED    -DVFS
-DKERBEROS -DZEPHYR -DANDREW -DLACL -Iquota  -O -o klpd psutil.o lpd.o
lpdchar.o printjob.o recvjob.o    tcp_conn.o displayq.o rmjob.o common.o
printcap.o ms.o modes.o  secure.o admin.o        ossupport.o cmds.o
cmdtab.o startdaemon.o tools.o genid.o        -L/usr/local/lib -lzephyr
-lacl -lkafs -lcom_err -lkrb -ldes  
recvjob.c:899: Undefined symbol `__validuser' referenced from text segment
*** Error code 1

I've spent too much time on this already to just give up.  I'm doubtful
now that it'll work but I want to try to get it to atleast compile.  If
I do get it to compile and it doesn't work I'm afraid I will have to
give up because 

Here's the offending bit of code.  I have no idea what it's doing (or
trying to do):

[...]
char *
check_remhost()
{
    register char *cp, *sp;
    extern char from_host[];
    register FILE *hostf;
    char ahost[MAXHOSTNAMELEN];
    int baselen = -1;

    if(!strcasecmp(from_host, host)) return NULL;
#if 0
    syslog(LOG_DEBUG, "About to check on %s\n", from_host);
#endif
    sp = from_host;
    cp = ahost;
    while (*sp) {
        if (*sp == '.') {
            if (baselen == -1)
                baselen = sp - from_host;
            *cp++ = *sp++;
        } else {
            *cp++ = isupper(*sp) ? tolower(*sp++) : *sp++;
        }
    }
    *cp = '\0';
    hostf = fopen("/etc/hosts.lpd", "r");
#define DUMMY ":nobody::"
    if (hostf) {
        if (!_validuser(hostf, ahost, DUMMY, DUMMY, baselen)) {
    //       ^^^^^^^^^^
            (void) fclose(hostf);
            return NULL;
        }
        (void) fclose(hostf);
        return "\4";
    } else {
        /* Could not open hosts.lpd file */
        return NULL;
    }
}
[...]

Someone on a linux box did:

Excerpts from mail: 20-Nov-96 Re: klpr compilation... by Christofer D Chiappa 
> <griffon>:KeyserSoze-ttyp6:[32]~/lsrc/klpr/src$ nm -o /usr/lib/*.a |
> grep validuser
> /usr/lib/libc.a:rcmd.o:000007a0 T _validuser
> /usr/lib/libc_p.a:rcmd.o:000006f4 T _validuser
> /usr/lib/libg.a:rcmd.o:000006d4 T _validuser
> <griffon>:KeyserSoze-ttyp6:[33]~/lsrc/klpr/src$
> 

I can find this in src/lib/libc/net/rcmd.c:

int
__ivaliduser(hostf, raddr, luser, ruser)
	FILE *hostf;
	u_int32_t raddr;
	const char *luser, *ruser;
{...}

Any suggestions??

TIA.

-c
 _____________________________________________________________________
|Chris Mason - cmason@nyx.net  cmason@cmu.edu  http://ros.res.cmu.edu |
|"You can always count on a murderer for a fancy prose style."-Nabokov|
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~