[comp.unix.wizards] /etc/utmp

forrie@morwyn.UUCP (Forrie Aldrich) (05/06/91)

I am porting a couple of pd packages to my machine... one implements the
SHADOW password funcionality and the other is a pd GETTY program.  They
both seem to work fine, except that I have noticed something strange with
the information stored in the utmp file.

On my machine (a 3b1), we have a main window device which all process are
spawned on/from, /dev/window.  Then we have /dev/w1 through /dev/w12.  Each
process is usually given one of the w1-w12 names after it's run... for 
instance when I login under the normal 'login' program, I will see my
entry in the /etc/utmp file as saying that I have one of these w1-w12
devices.  But when I use the pd login program, the /etc/utmp file says
that I am on /dev/window, and it shouldn't be that way.

This prevents me from using a lot of custom software which apparently reads
the /etc/utmp file to see if you are logged in to a valid device or not.

My question is how can I get this program to work correctly?  My feeling
is that it's the login program that needs the 'tweaking', as getty merely
spawns the process off the main character /dev/window.  Whichever I am not
sure of.

Any help would be greatly appreciated.  I have spent a LONG time porting
these applications!  

Thanks in advance.

Forrie
-- 
--------------------=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--------------------
Forrest Aldrich, Jr.|   ...uunet!eci!morwyn!forrie       |forrie@morywn.UUCP
                    |  ...uunet!eci!zinn!morwyn!forrie   | 
CREATIVE CONNECTIONS|...uunet!unhd!unhtel!morwyn!forrie  |Graphic Illustration
------------------\-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-/------------------
                   \___ PO Box 1541 - Dover, NH  03820 ___/                   

toma@swsrv1.cirr.com (Tom Armistead) (05/10/91)

In article <97@morwyn.UUCP> forrie@morwyn.UUCP (Forrie Aldrich) writes:
>I am porting a couple of pd packages to my machine... one implements the
>SHADOW password funcionality and the other is a pd GETTY program.  They
>
	STUFF DELETED ...
>
>My question is how can I get this program to work correctly?  My feeling
>is that it's the login program that needs the 'tweaking', as getty merely
>spawns the process off the main character /dev/window.  Whichever I am not
>sure of.
>
>Any help would be greatly appreciated.  I have spent a LONG time porting
>these applications!  
>
>Thanks in advance.
>
>Forrie
>-- 
>--------------------=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--------------------
>Forrest Aldrich, Jr.|   ...uunet!eci!morwyn!forrie       |forrie@morywn.UUCP

This my understanding of what happens when someone logs in (not necessarily
fact - it would be nice to get the FACTS from someone who KNOWS them?).

When init spawns a process (from /etc/inittab) it creats a record in the
/etc/utmp file for that line in the inittab file.   When getty is spawned by
init, it looks up it's process ID in utmp file and updates that entry, setting
ut_line to the device passed to getty and ut_type to LOGIN_PROCESS.  When
getty accepts a username, it exec's /bin/login with that username as a command
line argument.  /bin/login then prompts for a password and, if valid, looks up
it's process id in the utmp file and sets ut_type to be USER_PROCESS and sets
ut_line to be the current tty name (minus the path).

So, in a long winded way, I think your right in that /bin/login is the one who
sets the final tty name in the utmp file and that is probally where your
problem is.

Maybe this will help you in tracking down the problem?

Tom
-- 
Tom Armistead - Software Services - 2918 Dukeswood Dr. - Garland, Tx  75040
===========================================================================
toma@swsrv1.cirr.com                {egsner,letni,ozdaltx,void}!swsrv1!toma

jfh@rpp386.cactus.org (John F Haugh II) (05/10/91)

In article <1991May10.065817.12017@swsrv1.cirr.com> toma@swsrv1.cirr.com (Tom Armistead) writes:
>So, in a long winded way, I think your right in that /bin/login is the one who
>sets the final tty name in the utmp file and that is probally where your
>problem is.

Nope.  /etc/getty is responsible for getting the tty name correct the
first time.  getty knows which device it opened, login doesn't.
-- 
John F. Haugh II        | Distribution to  | UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 255-8251 | GEnie PROHIBITED :-) |  Domain: jfh@rpp386.cactus.org
"If liberals interpreted the 2nd Amendment the same way they interpret the
 rest of the Constitution, gun ownership would be mandatory."