|
|
1.1 ! root 1: .\" @(#)acucntrl.8c 6.2 (Berkeley) 7/29/85 ! 2: .\" ! 3: .TH acucntrl 8C "July 29, 1985" ! 4: .UC 6 ! 5: .SH NAME ! 6: acucntrl \- turn around tty line between dialin and dialout ! 7: .SH SYNOPSIS ! 8: .B /usr/lib/uucp/acucntrl ! 9: keyword ttyline ! 10: .SH DESCRIPTION ! 11: .PP ! 12: .I Acucntrl ! 13: turns around terminal line, enabling it to be used for both dialin and dialout. ! 14: On dialin a terminal line is assumed to have modem control enabled and a getty ! 15: process in existence waiting for logins. On dialout modem control is disabled ! 16: and there is no getty process. ! 17: .PP ! 18: This program must be run setuid to root. ! 19: .PP ! 20: .I keyword ! 21: is chosen from the list: ! 22: .I disable ! 23: or ! 24: .IR dialout , ! 25: to condition a line for dialout; ! 26: and ! 27: .I enable ! 28: or ! 29: .IR dialin , ! 30: to condition a line for dialin. ! 31: .PP ! 32: When the line is conditioned for dialing out, the login name of the real uid ! 33: of the process is placed in /etc/utmp in capitals. ! 34: This declares that the line is in use and acts as an additional locking ! 35: mechanism. ! 36: .I Acucntrl ! 37: will refuse to act if the /etc/utmp entry for the line is not null, ! 38: is not the the user's login name (capitalized or not), ! 39: and if the process is not running as the superuser. ! 40: The last condition is to allow the superuser to clear the state of the line. ! 41: .PP ! 42: Turning modem control on or off is handled by poking into /dev/kmem. ! 43: It is currently implemented for dz, dh, and dmf lines. ! 44: .PP ! 45: Under 4.2 BSD the program will also refuse to disable a line if carrier is ! 46: sensed on it. This is to avoid the dead period where someone has just dialed ! 47: in and made the connection but has not yet logged in. ! 48: .PP ! 49: .I Ttyline ! 50: can be either of the form tty* or /dev/tty*. ! 51: Enabling/disabling a line whose name does not begin with ttyd? is prohibited ! 52: unless the real uid of the process is 0 or if the login name corresponding to ! 53: the real uid is uucp. This is a security precaution. ! 54: .PP ! 55: Steps taken when disabling ! 56: .RI ( i . e . ! 57: setup for dialing out) ! 58: .IP 1) ! 59: check input arguments ! 60: .IP 2) ! 61: look in /etc/utmp to check that the line is not in use by another user ! 62: .IP 3) ! 63: disable modem control on line ! 64: .IP 4) ! 65: check for carrier on device ! 66: .IP 5) ! 67: change owner of device to real uid ! 68: .IP 6) ! 69: edit /etc/ttys, changing the first character of the appropriate line to 0 ! 70: .IP 7) ! 71: send a hangup to process 1 to poke init to disable getty ! 72: .IP 8) ! 73: post uid name in capitals in /etc/utmp to let world know device has been grabbed ! 74: .IP 9) ! 75: make sure that DTR is on ! 76: .PP ! 77: Steps taken when enabling ! 78: .RI ( i . e . ! 79: setup for dialin) ! 80: .IP 1) ! 81: check input arguments ! 82: .IP 2) ! 83: look in /etc/utmp to check that the line is not in use by another user ! 84: .IP 3) ! 85: make sure modem control on line is disabled ! 86: .IP 4) ! 87: turn off DTR to make sure line is hung up ! 88: .IP 5) ! 89: condition line: clear exclusive use and set hangup on close modes ! 90: .IP 6) ! 91: turn on modem control ! 92: .IP 7) ! 93: edit /etc/ttys, changing the first character of the appropriate line to 1 ! 94: .IP 8) ! 95: send a hangup to process 1 to poke init to enable getty ! 96: .IP 9) ! 97: clear uid name for /etc/utmp ! 98: .SH HISTORY ! 99: .PP ! 100: First written by Allan Wilkes (fisher!allan) ! 101: .PP ! 102: Modified June 8,1983 by W.Sebok (astrovax!wls) to poke the kernel rather ! 103: than use a kernel hack to turn on/off modem control, using a subroutine ! 104: stolen from a program written by Tsutomu Shimomura {astrovax,escher}!tsutomu ! 105: .PP ! 106: Worked over many times by W.Sebok ! 107: .RI ( i . e . ! 108: hacked to death) ! 109: .SH FILES ! 110: /dev/kmem, /vmunix, /etc/ttys, /etc/utmp, /dev/tty* ! 111: .SH BUGS ! 112: .PP ! 113: Sensing carrier requires the 4.2 BSD TIOCMGET ioctl call. Unfortunately this ! 114: ioctl is not implemented in the vanilla 4.2 BSD dh driver even though the ! 115: dz and dmf drivers use an emulation of the DH11's modem control bits. This ! 116: has been fixed here. ! 117: .PP ! 118: Some time (currently 2 seconds) is required between disabling modem control ! 119: and opening the device. This is probably because of a race with getty whose ! 120: open is finally being allowed to complete. This time interval may not be ! 121: enough on a loaded system. Because of this problem and the above problem with ! 122: the dh driver there is deliberately no error message given when the TIOCMGET ! 123: ioctl fails. ! 124: .PP ! 125: Previously there was similar synchronization problem with the init process. ! 126: When dialins are disabled the capitalized name of the process cannot be posted ! 127: into /etc/utmp until init has finished clearing /etc/utmp. However one does ! 128: not know how long that will take, and, on a loaded system, it can take quite ! 129: a while. This was solved by the strategy of 1) posting the name, 2) poking ! 130: init, 3) going into a loop where the process repeatedly waits a second and ! 131: checks whether the entry has been cleared from /etc/utmp, and 4) posting the ! 132: name again.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.