Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!pmafire!uudell!sequoia!rpp386!jfh From: jfh@rpp386.cactus.org (John F Haugh II) Newsgroups: comp.unix.aix Subject: Re: telnet and login Message-ID: <19014@rpp386.cactus.org> Date: 31 Jan 91 04:00:17 GMT References: <1515@msa3b.UUCP> Reply-To: jfh@rpp386.cactus.org (John F Haugh II) Organization: Lone Star Cafe and BBS Service Lines: 50 X-Clever-Slogan: Recycle or Die. In article <1515@msa3b.UUCP> kevin@msa3b.UUCP (Kevin P. Kleinfelter) writes: >The trouble is that login tells me that I must execute it from a top-level >shell. I've tried running this program from inittab (so its parent will >be init). That doesn't help. I've tried reversing the processes, so that >the login process had been tried as parent and as child. You need to have a wrapper program add an entry in /etc/utmp for the process which is going to exec() the login process. The utmp file entry must include the process ID of the current process (login will have the same PID after the exec) and the name of the pty (with /dev/ stripped off) you got. Something like this should initialize the utmp entry - struct utmp utmp; char *cp, *ttyname(); memset ((void *) &utmp, 0, sizeof utmp); cp = ttyname (0); if (strncmp (cp, "/dev/", 5) == 0) cp += 5; (void) strncpy (utmp.ut_line, cp); (void) time (&utmp.ut_time); utmp.ut_pid = getpid (); utmp.ut_type = INIT_PROCESS; You may have to change "INIT_PROCESS" to "LOGIN_PROCESS". You have to write this entry to either the same location in /etc/utmp as an already existing entry for this tty name, or the end of the file. You also need to set ut_type to "DEAD_PROCESS" after the process exits or your user's will complain that "who" is reporting dead processes. >I can always write my own version of login, but that seems inappropriate. >(This maybe should be in comp.unix.programmer, but I think that they would >know little about TSM on AIX.) Considering how many of the IBM/Austin programmers read this group, it would be counter-productive to ask anywheres else but here. >How does telnet convince TSM/login to run? As I describe above. It does use a few extra flags, for example "-h" to get the host name into ut_host (you might want to do this), "-p" will preserve the environment, and a few others. -- John F. Haugh II UUCP: ...!cs.utexas.edu!rpp386!jfh Ma Bell: (512) 832-8832 Domain: jfh@rpp386.cactus.org "13 of 17 valedictorians in Boston High Schools last spring were immigrants or children of immigrants" -- US News and World Report, May 15, 1990