[comp.windows.x] Why does xterm need NIS?

pjs@euclid.jpl.nasa.gov (Peter Scott) (06/26/91)

My Sun workstation is a minimal NIS (YP) client (although not
for much longer, after this).  Recently we rebooted the NIS
master, and while this was going on, I tried to start an xterm.
I got the error message

NIS: server not responding for domain "navdev"; still trying.

and it started successfully when the NIS master came back up.

Well, what does xterm (or any other X client) need NIS for when
I'm opening the window on the local host?  I did a trace on xterm
later, but the NIS master was up by then and I couldn't tell what
system calls were accessing NIS.


-- 
This is news.  This is your       |    Peter Scott, NASA/JPL/Caltech
brain on news.  Any questions?    |    (pjs@euclid.jpl.nasa.gov)

maslen@eng.sun.com (Thomas Maslen) (06/26/91)

pjs@euclid.jpl.nasa.gov (Peter Scott) writes:
>Well, what does xterm (or any other X client) need NIS for when
>I'm opening the window on the local host?  I did a trace on xterm
>later, but the NIS master was up by then and I couldn't tell what
>system calls were accessing NIS.

Well, here's a part-answer...  In the R4 sources, xterm/main.c contains calls 
to getpwuid().  If your /etc/passwd contains the "+" magic, and getpwuid() 
doesn't find the uid in /etc/passwd before the first "+" or "-", getpwuid will 
try to commune with NIS.

From a quick peek at the source, xterm seems to have a number of reasons to
call getpwuid:
      -	it wants the username in order to write a helpful utmp entry,
      -	something to do with initializing groups that I didn't trace,
      -	it wants to know your default shell,
      -	it may want to run login -p -f <username>

The resize program (xterm/resize.c) also calls getpwuid() to determine the
default shell.

It is entirely possible that other parts of xterm, or the library routines
it uses, end up invoking some of the other getXXXbyYYY() routines, e.g.
gethostbyname(); I haven't checked.

I'll close with the comment from the top of xterm/main.c (even before the
copyright notice)...

/*
 *                               W A R N I N G
 *
 * If you think you know what all of this code is doing, you are probably
 * very mistaken.  There be serious and nasty dragons here.
 *

>This is news.  This is your       |    Peter Scott, NASA/JPL/Caltech
>brain on news.  Any questions?    |    (pjs@euclid.jpl.nasa.gov)

Thomas Maslen
maslen@eng.sun.com

jludwig@pinocchio.encore.com (Jim Ludwig) (06/26/91)

xterm uses the /etc/passwd file to:
+ determine user's name for creating a utmp entry
+ initialize the user's groups (initgroups in BSD, other in other OS's)
+ get the user's default shell if the SHELL environment variable is not set
(see main.c if you have the code)

I would assume that the passwd file is handled by NIS and that's where
you're error is showing up.

Jim Ludwig
Encore Computer Corp
jludwig@encore.com