kevin@msa3b.UUCP (Kevin P. Kleinfelter) (01/30/91)
I'm writing a program very similar to telnet. It creates a pseudo-tty and then forks itself, with one process handling I/O over my network, and the other process will execl /bin/login. The idea is that /bin/login's /dev/tty is at one end of the pseudo-tty, and my other process is at the other end, simply passing I/O over my network. 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. 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.) How does telnet convince TSM/login to run? -- Kevin Kleinfelter @ Dun and Bradstreet Software, Inc (404) 239-2347 {emory,gatech}!nanovx!msa3b!kevin Look closely at the return address. It is nanovx and NOT nanovAx.
jfh@rpp386.cactus.org (John F Haugh II) (01/31/91)
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
rudy@chukran.austin.ibm.com (02/02/91)
There was something on this group many months ago. My recollection is that you first need to put a utmp entry for your logger and port into the utmp file before execing login. This is SVID behavior. Anyway look at references to utmp in info for how to manipulate the /etc/utmp file. ********************************************************************* IBM AIX Porting Center | RSCS: CHUKRAN at AUSTIN 11400 Burnet Rd. | AWDnet: rudy@chukran.austin.ibm.com Internal ZIP 2830 | internet: chukran@austin.iinus1.ibm.com Austin, Texas 78758 | Voice: 512-838-4674 Tieline: 678-4674 *********************************************************************