home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: SHell self-extracting ARchive
(archive/shar).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| SHell self-extracting ARchive (archive/shar)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| C source, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/329 Shell Archive Format
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 73 6f 75 72 63 65 73 | 2e 75 6e 69 78 0a 46 72 |.sources|.unix.Fr|
|00000020| 6f 6d 3a 20 62 72 6e 73 | 74 6e 64 40 6e 79 75 2e |om: brns|tnd@nyu.|
|00000030| 65 64 75 20 28 44 61 6e | 20 42 65 72 6e 73 74 65 |edu (Dan| Bernste|
|00000040| 69 6e 29 0a 53 75 62 6a | 65 63 74 3a 20 76 32 35 |in).Subj|ect: v25|
|00000050| 69 31 33 30 3a 20 47 65 | 6e 65 72 61 6c 69 7a 65 |i130: Ge|neralize|
|00000060| 64 20 69 6e 74 65 72 66 | 61 63 65 20 74 6f 20 70 |d interf|ace to p|
|00000070| 73 65 75 64 6f 2d 74 74 | 79 20 64 65 76 69 63 65 |seudo-tt|y device|
|00000080| 73 2c 20 50 61 72 74 30 | 34 2f 30 39 0a 53 65 6e |s, Part0|4/09.Sen|
|00000090| 64 65 72 3a 20 75 6e 69 | 78 2d 73 6f 75 72 63 65 |der: uni|x-source|
|000000a0| 73 2d 6d 6f 64 65 72 61 | 74 6f 72 40 70 61 2e 64 |s-modera|tor@pa.d|
|000000b0| 65 63 2e 63 6f 6d 0a 41 | 70 70 72 6f 76 65 64 3a |ec.com.A|pproved:|
|000000c0| 20 76 69 78 69 65 40 70 | 61 2e 64 65 63 2e 63 6f | vixie@p|a.dec.co|
|000000d0| 6d 0a 0a 53 75 62 6d 69 | 74 74 65 64 2d 42 79 3a |m..Submi|tted-By:|
|000000e0| 20 62 72 6e 73 74 6e 64 | 40 6e 79 75 2e 65 64 75 | brnstnd|@nyu.edu|
|000000f0| 20 28 44 61 6e 20 42 65 | 72 6e 73 74 65 69 6e 29 | (Dan Be|rnstein)|
|00000100| 0a 50 6f 73 74 69 6e 67 | 2d 4e 75 6d 62 65 72 3a |.Posting|-Number:|
|00000110| 20 56 6f 6c 75 6d 65 20 | 32 35 2c 20 49 73 73 75 | Volume |25, Issu|
|00000120| 65 20 31 33 30 0a 41 72 | 63 68 69 76 65 2d 4e 61 |e 130.Ar|chive-Na|
|00000130| 6d 65 3a 20 70 74 79 34 | 2f 70 61 72 74 30 34 0a |me: pty4|/part04.|
|00000140| 0a 23 21 20 2f 62 69 6e | 2f 73 68 0a 23 20 54 68 |.#! /bin|/sh.# Th|
|00000150| 69 73 20 69 73 20 61 20 | 73 68 65 6c 6c 20 61 72 |is is a |shell ar|
|00000160| 63 68 69 76 65 2e 20 20 | 52 65 6d 6f 76 65 20 61 |chive. |Remove a|
|00000170| 6e 79 74 68 69 6e 67 20 | 62 65 66 6f 72 65 20 74 |nything |before t|
|00000180| 68 69 73 20 6c 69 6e 65 | 2c 20 74 68 65 6e 20 75 |his line|, then u|
|00000190| 6e 70 61 63 6b 0a 23 20 | 69 74 20 62 79 20 73 61 |npack.# |it by sa|
|000001a0| 76 69 6e 67 20 69 74 20 | 69 6e 74 6f 20 61 20 66 |ving it |into a f|
|000001b0| 69 6c 65 20 61 6e 64 20 | 74 79 70 69 6e 67 20 22 |ile and |typing "|
|000001c0| 73 68 20 66 69 6c 65 22 | 2e 20 20 54 6f 20 6f 76 |sh file"|. To ov|
|000001d0| 65 72 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |erwrite |existing|
|000001e0| 0a 23 20 66 69 6c 65 73 | 2c 20 74 79 70 65 20 22 |.# files|, type "|
|000001f0| 73 68 20 66 69 6c 65 20 | 2d 63 22 2e 20 20 59 6f |sh file |-c". Yo|
|00000200| 75 20 63 61 6e 20 61 6c | 73 6f 20 66 65 65 64 20 |u can al|so feed |
|00000210| 74 68 69 73 20 61 73 20 | 73 74 61 6e 64 61 72 64 |this as |standard|
|00000220| 20 69 6e 70 75 74 20 76 | 69 61 0a 23 20 75 6e 73 | input v|ia.# uns|
|00000230| 68 61 72 2c 20 6f 72 20 | 62 79 20 74 79 70 69 6e |har, or |by typin|
|00000240| 67 20 22 73 68 20 3c 66 | 69 6c 65 22 2c 20 65 2e |g "sh <f|ile", e.|
|00000250| 67 2e 2e 20 20 49 66 20 | 74 68 69 73 20 61 72 63 |g.. If |this arc|
|00000260| 68 69 76 65 20 69 73 20 | 63 6f 6d 70 6c 65 74 65 |hive is |complete|
|00000270| 2c 20 79 6f 75 0a 23 20 | 77 69 6c 6c 20 73 65 65 |, you.# |will see|
|00000280| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 6d | the fol|lowing m|
|00000290| 65 73 73 61 67 65 20 61 | 74 20 74 68 65 20 65 6e |essage a|t the en|
|000002a0| 64 3a 0a 23 09 09 22 45 | 6e 64 20 6f 66 20 61 72 |d:.#.."E|nd of ar|
|000002b0| 63 68 69 76 65 20 34 20 | 28 6f 66 20 39 29 2e 22 |chive 4 |(of 9)."|
|000002c0| 0a 23 20 43 6f 6e 74 65 | 6e 74 73 3a 20 20 42 4c |.# Conte|nts: BL|
|000002d0| 55 52 42 20 49 4e 53 54 | 41 4c 4c 2e 63 20 4e 4f |URB INST|ALL.c NO|
|000002e0| 54 45 53 20 53 45 43 55 | 52 49 54 59 20 53 59 53 |TES SECU|RITY SYS|
|000002f0| 43 4f 4e 46 20 54 45 53 | 54 53 20 63 68 65 63 6b |CONF TES|TS check|
|00000300| 70 74 79 73 2e 63 0a 23 | 20 20 20 65 6e 76 2e 63 |ptys.c.#| env.c|
|00000310| 20 66 6d 74 2e 63 20 73 | 63 61 6e 2e 63 0a 23 20 | fmt.c s|can.c.# |
|00000320| 57 72 61 70 70 65 64 20 | 62 79 20 76 69 78 69 65 |Wrapped |by vixie|
|00000330| 40 63 6f 67 6e 69 74 69 | 6f 6e 2e 70 61 2e 64 65 |@cogniti|on.pa.de|
|00000340| 63 2e 63 6f 6d 20 6f 6e | 20 57 65 64 20 46 65 62 |c.com on| Wed Feb|
|00000350| 20 31 39 20 31 33 3a 33 | 35 3a 30 34 20 31 39 39 | 19 13:3|5:04 199|
|00000360| 32 0a 50 41 54 48 3d 2f | 62 69 6e 3a 2f 75 73 72 |2.PATH=/|bin:/usr|
|00000370| 2f 62 69 6e 3a 2f 75 73 | 72 2f 75 63 62 20 3b 20 |/bin:/us|r/ucb ; |
|00000380| 65 78 70 6f 72 74 20 50 | 41 54 48 0a 69 66 20 74 |export P|ATH.if t|
|00000390| 65 73 74 20 2d 66 20 27 | 42 4c 55 52 42 27 20 2d |est -f '|BLURB' -|
|000003a0| 61 20 22 24 7b 31 7d 22 | 20 21 3d 20 22 2d 63 22 |a "${1}"| != "-c"|
|000003b0| 20 3b 20 74 68 65 6e 20 | 0a 20 20 65 63 68 6f 20 | ; then |. echo |
|000003c0| 73 68 61 72 3a 20 57 69 | 6c 6c 20 6e 6f 74 20 63 |shar: Wi|ll not c|
|000003d0| 6c 6f 62 62 65 72 20 65 | 78 69 73 74 69 6e 67 20 |lobber e|xisting |
|000003e0| 66 69 6c 65 20 5c 22 27 | 42 4c 55 52 42 27 5c 22 |file \"'|BLURB'\"|
|000003f0| 0a 65 6c 73 65 0a 65 63 | 68 6f 20 73 68 61 72 3a |.else.ec|ho shar:|
|00000400| 20 45 78 74 72 61 63 74 | 69 6e 67 20 5c 22 27 42 | Extract|ing \"'B|
|00000410| 4c 55 52 42 27 5c 22 20 | 5c 28 34 33 34 30 20 63 |LURB'\" |\(4340 c|
|00000420| 68 61 72 61 63 74 65 72 | 73 5c 29 0a 73 65 64 20 |haracter|s\).sed |
|00000430| 22 73 2f 5e 58 2f 2f 22 | 20 3e 27 42 4c 55 52 42 |"s/^X//"| >'BLURB|
|00000440| 27 20 3c 3c 27 45 4e 44 | 5f 4f 46 5f 46 49 4c 45 |' <<'END|_OF_FILE|
|00000450| 27 0a 70 74 79 20 69 73 | 20 6d 65 61 6e 74 20 61 |'.pty is| meant a|
|00000460| 73 20 74 68 65 20 73 6f | 6c 65 20 69 6e 74 65 72 |s the so|le inter|
|00000470| 66 61 63 65 20 62 65 74 | 77 65 65 6e 20 70 73 65 |face bet|ween pse|
|00000480| 75 64 6f 2d 74 65 72 6d | 69 6e 61 6c 73 20 61 6e |udo-term|inals an|
|00000490| 64 20 74 68 65 20 72 65 | 73 74 0a 6f 66 20 74 68 |d the re|st.of th|
|000004a0| 65 20 73 79 73 74 65 6d | 2e 20 52 69 63 68 20 53 |e system|. Rich S|
|000004b0| 61 6c 7a 20 73 61 69 64 | 20 6f 66 20 70 74 79 20 |alz said| of pty |
|000004c0| 33 2e 30 3a 20 60 60 54 | 68 69 73 20 69 73 20 74 |3.0: ``T|his is t|
|000004d0| 68 65 20 47 69 6e 73 75 | 20 6b 6e 69 66 65 20 28 |he Ginsu| knife (|
|000004e0| 69 74 0a 73 6c 69 63 65 | 73 2c 20 69 74 20 64 69 |it.slice|s, it di|
|000004f0| 63 65 73 2c 20 69 74 20 | 6e 65 76 65 72 20 72 75 |ces, it |never ru|
|00000500| 73 74 73 29 20 74 68 61 | 74 20 44 61 6e 20 68 61 |sts) tha|t Dan ha|
|00000510| 73 20 62 65 65 6e 20 74 | 61 6c 6b 69 6e 67 20 61 |s been t|alking a|
|00000520| 62 6f 75 74 20 69 6e 0a | 63 6f 6d 70 2e 75 6e 69 |bout in.|comp.uni|
|00000530| 78 2e 77 69 7a 61 72 64 | 73 2f 69 6e 74 65 72 6e |x.wizard|s/intern|
|00000540| 61 6c 73 20 66 6f 72 20 | 73 6f 6d 65 20 74 69 6d |als for |some tim|
|00000550| 65 20 6e 6f 77 2e 20 49 | 74 20 69 73 20 61 20 6d |e now. I|t is a m|
|00000560| 69 6e 64 2d 62 6c 6f 77 | 65 72 2e 27 27 0a 42 75 |ind-blow|er.''.Bu|
|00000570| 74 20 49 20 6a 75 73 74 | 20 63 6f 75 6c 64 6e 27 |t I just| couldn'|
|00000580| 74 20 6c 65 61 76 65 20 | 77 65 6c 6c 20 65 6e 6f |t leave |well eno|
|00000590| 75 67 68 20 61 6c 6f 6e | 65 2c 20 73 6f 20 68 65 |ugh alon|e, so he|
|000005a0| 72 65 27 73 20 70 74 79 | 20 34 2e 30 2c 20 61 20 |re's pty| 4.0, a |
|000005b0| 76 61 73 74 6c 79 0a 69 | 6d 70 72 6f 76 65 64 20 |vastly.i|mproved |
|000005c0| 72 65 77 72 69 74 65 20 | 6f 66 20 74 68 65 20 65 |rewrite |of the e|
|000005d0| 6e 74 69 72 65 20 70 61 | 63 6b 61 67 65 2e 20 41 |ntire pa|ckage. A|
|000005e0| 20 74 61 73 74 65 20 6f | 66 20 77 68 61 74 20 69 | taste o|f what i|
|000005f0| 74 20 68 61 73 20 74 6f | 20 6f 66 66 65 72 3a 0a |t has to| offer:.|
|00000600| 58 0a 58 2a 20 49 6d 70 | 72 6f 76 65 64 20 73 65 |X.X* Imp|roved se|
|00000610| 63 75 72 69 74 79 20 2d | 20 70 74 79 20 33 2e 30 |curity -| pty 3.0|
|00000620| 20 6f 66 66 65 72 65 64 | 20 74 74 79 20 73 65 63 | offered| tty sec|
|00000630| 75 72 69 74 79 20 61 68 | 65 61 64 20 6f 66 20 69 |urity ah|ead of i|
|00000640| 74 73 20 74 69 6d 65 2d | 2d 2d 0a 73 65 76 65 72 |ts time-|--.sever|
|00000650| 61 6c 20 6d 6f 6e 74 68 | 73 20 61 66 74 65 72 77 |al month|s afterw|
|00000660| 61 72 64 73 2c 20 53 75 | 6e 20 72 65 6c 65 61 73 |ards, Su|n releas|
|00000670| 65 64 20 61 20 60 60 63 | 72 69 74 69 63 61 6c 27 |ed a ``c|ritical'|
|00000680| 27 20 73 65 63 75 72 69 | 74 79 20 70 61 74 63 68 |' securi|ty patch|
|00000690| 0a 77 69 74 68 20 65 73 | 73 65 6e 74 69 61 6c 6c |.with es|sentiall|
|000006a0| 79 20 74 68 65 20 73 61 | 6d 65 20 73 65 63 75 72 |y the sa|me secur|
|000006b0| 69 74 79 20 74 65 73 74 | 73 2e 20 4e 6f 77 20 70 |ity test|s. Now p|
|000006c0| 74 79 20 34 2e 30 20 6f | 66 66 65 72 73 20 70 72 |ty 4.0 o|ffers pr|
|000006d0| 6f 76 65 6e 0a 73 65 63 | 75 72 69 74 79 2e 20 41 |oven.sec|urity. A|
|000006e0| 6c 74 68 6f 75 67 68 20 | 79 6f 75 20 63 61 6e 20 |lthough |you can |
|000006f0| 69 6e 73 74 61 6c 6c 20 | 61 6e 64 20 75 73 65 20 |install |and use |
|00000700| 74 68 65 20 70 61 63 6b | 61 67 65 20 77 69 74 68 |the pack|age with|
|00000710| 6f 75 74 0a 70 72 69 76 | 69 6c 65 67 65 73 2c 20 |out.priv|ileges, |
|00000720| 73 79 73 74 65 6d 20 61 | 64 6d 69 6e 69 73 74 72 |system a|dministr|
|00000730| 61 74 6f 72 73 20 63 61 | 6e 20 69 6e 73 74 61 6c |ators ca|n instal|
|00000740| 6c 20 70 74 79 20 34 2e | 30 20 73 6f 20 74 68 61 |l pty 4.|0 so tha|
|00000750| 74 20 69 74 0a 58 5f 67 | 75 61 72 61 6e 74 65 65 |t it.X_g|uarantee|
|00000760| 73 5f 20 74 68 61 74 20 | 6e 6f 62 6f 64 79 20 65 |s_ that |nobody e|
|00000770| 6c 73 65 20 68 61 73 20 | 61 63 63 65 73 73 20 74 |lse has |access t|
|00000780| 6f 20 79 6f 75 72 20 74 | 74 79 2e 20 49 27 6d 20 |o your t|ty. I'm |
|00000790| 6f 66 66 65 72 69 6e 67 | 20 61 0a 63 61 73 68 20 |offering| a.cash |
|000007a0| 72 65 77 61 72 64 20 66 | 6f 72 20 61 6e 79 6f 6e |reward f|or anyon|
|000007b0| 65 20 77 68 6f 20 63 61 | 6e 20 73 75 62 76 65 72 |e who ca|n subver|
|000007c0| 74 20 74 68 65 73 65 20 | 67 75 61 72 61 6e 74 65 |t these |guarante|
|000007d0| 65 73 2e 0a 58 0a 58 2a | 20 53 65 73 73 69 6f 6e |es..X.X*| Session|
|000007e0| 20 6d 61 6e 61 67 65 6d | 65 6e 74 20 2d 20 49 66 | managem|ent - If|
|000007f0| 20 79 6f 75 20 72 75 6e | 20 79 6f 75 72 20 73 68 | you run| your sh|
|00000800| 65 6c 6c 20 75 6e 64 65 | 72 20 70 74 79 2c 20 61 |ell unde|r pty, a|
|00000810| 6e 64 20 74 68 65 0a 63 | 6f 6e 6e 65 63 74 69 6f |nd the.c|onnectio|
|00000820| 6e 20 69 73 20 68 75 6e | 67 20 75 70 2c 20 79 6f |n is hun|g up, yo|
|00000830| 75 20 63 61 6e 20 6c 6f | 67 20 69 6e 20 61 67 61 |u can lo|g in aga|
|00000840| 69 6e 20 61 6e 64 20 72 | 65 63 6f 6e 6e 65 63 74 |in and r|econnect|
|00000850| 2e 20 54 68 65 20 73 65 | 73 73 69 6f 6e 0a 6d 61 |. The se|ssion.ma|
|00000860| 6e 61 67 65 6d 65 6e 74 | 20 6d 6f 64 65 6c 20 69 |nagement| model i|
|00000870| 73 20 65 78 74 72 65 6d | 65 6c 79 20 73 69 6d 70 |s extrem|ely simp|
|00000880| 6c 65 2d 2d 2d 69 74 20 | 68 61 73 20 6a 75 73 74 |le---it |has just|
|00000890| 20 74 68 72 65 65 20 70 | 72 69 6d 69 74 69 76 65 | three p|rimitive|
|000008a0| 73 2d 2d 2d 0a 79 65 74 | 20 70 6f 77 65 72 66 75 |s---.yet| powerfu|
|000008b0| 6c 20 65 6e 6f 75 67 68 | 20 74 6f 20 61 63 63 6f |l enough| to acco|
|000008c0| 6d 70 6c 69 73 68 20 74 | 72 69 63 6b 79 20 74 61 |mplish t|ricky ta|
|000008d0| 73 6b 73 2c 20 73 75 63 | 68 20 61 73 20 72 65 63 |sks, suc|h as rec|
|000008e0| 6f 72 64 69 6e 67 20 74 | 68 65 0a 6f 75 74 70 75 |ording t|he.outpu|
|000008f0| 74 20 66 72 6f 6d 20 61 | 20 70 72 6f 63 65 73 73 |t from a| process|
|00000900| 20 61 66 74 65 72 20 74 | 68 65 20 70 72 6f 63 65 | after t|he proce|
|00000910| 73 73 20 68 61 73 20 73 | 74 61 72 74 65 64 2e 20 |ss has s|tarted. |
|00000920| 41 20 70 61 70 65 72 20 | 69 6e 20 74 68 65 0a 70 |A paper |in the.p|
|00000930| 61 63 6b 61 67 65 2c 20 | 60 60 41 6e 20 69 6e 74 |ackage, |``An int|
|00000940| 72 6f 64 75 63 74 69 6f | 6e 20 74 6f 20 73 65 73 |roductio|n to ses|
|00000950| 73 69 6f 6e 20 6d 61 6e | 61 67 65 6d 65 6e 74 2c |sion man|agement,|
|00000960| 27 27 20 6c 65 61 64 73 | 20 65 76 65 6e 20 6e 6f |'' leads| even no|
|00000970| 76 69 63 65 0a 75 73 65 | 72 73 20 74 68 72 6f 75 |vice.use|rs throu|
|00000980| 67 68 20 63 6f 6d 70 65 | 74 65 6e 74 20 75 73 65 |gh compe|tent use|
|00000990| 20 6f 66 20 73 65 73 73 | 69 6f 6e 20 6d 61 6e 61 | of sess|ion mana|
|000009a0| 67 65 6d 65 6e 74 20 63 | 6f 6d 6d 61 6e 64 73 2e |gement c|ommands.|
|000009b0| 0a 58 0a 58 2a 20 41 75 | 74 6f 6d 61 74 69 63 20 |.X.X* Au|tomatic |
|000009c0| 69 6e 73 74 61 6c 6c 61 | 74 69 6f 6e 20 2d 20 70 |installa|tion - p|
|000009d0| 74 79 20 34 2e 30 20 63 | 6f 6d 65 73 20 77 69 74 |ty 4.0 c|omes wit|
|000009e0| 68 20 61 20 63 6f 6d 70 | 6c 65 74 65 6c 79 20 61 |h a comp|letely a|
|000009f0| 75 74 6f 6d 61 74 65 64 | 0a 63 6f 6e 66 69 67 75 |utomated|.configu|
|00000a00| 72 65 2f 63 6f 6d 70 69 | 6c 65 2f 69 6e 73 74 61 |re/compi|le/insta|
|00000a10| 6c 6c 2f 76 65 72 69 66 | 79 2d 63 6f 6e 66 69 67 |ll/verif|y-config|
|00000a20| 75 72 61 74 69 6f 6e 20 | 73 65 74 75 70 2e 20 49 |uration |setup. I|
|00000a30| 74 20 77 69 6c 6c 20 63 | 6f 6e 66 69 67 75 72 65 |t will c|onfigure|
|00000a40| 0a 69 74 73 65 6c 66 20 | 70 72 6f 70 65 72 6c 79 |.itself |properly|
|00000a50| 20 66 6f 72 20 6d 6f 73 | 74 20 70 6f 70 75 6c 61 | for mos|t popula|
|00000a60| 72 20 73 79 73 74 65 6d | 73 20 77 69 74 68 6f 75 |r system|s withou|
|00000a70| 74 20 68 75 6d 61 6e 20 | 69 6e 70 75 74 2e 0a 58 |t human |input..X|
|00000a80| 0a 58 2a 20 4d 6f 64 75 | 6c 61 72 69 74 79 20 2d |.X* Modu|larity -|
|00000a90| 20 57 68 65 6e 20 49 20 | 73 61 79 20 74 68 61 74 | When I |say that|
|00000aa0| 20 70 74 79 20 69 73 20 | 6d 65 61 6e 74 20 61 73 | pty is |meant as|
|00000ab0| 20 74 68 65 20 73 6f 6c | 65 20 69 6e 74 65 72 66 | the sol|e interf|
|00000ac0| 61 63 65 20 74 6f 0a 70 | 73 65 75 64 6f 2d 74 65 |ace to.p|seudo-te|
|00000ad0| 72 6d 69 6e 61 6c 73 2c | 20 49 20 6d 65 61 6e 20 |rminals,| I mean |
|00000ae0| 69 74 21 20 70 74 79 20 | 64 6f 65 73 6e 27 74 20 |it! pty |doesn't |
|00000af0| 67 65 74 20 69 6e 20 74 | 68 65 20 77 61 79 20 6f |get in t|he way o|
|00000b00| 66 20 64 69 72 65 63 74 | 2c 0a 65 66 66 69 63 69 |f direct|,.effici|
|00000b10| 65 6e 74 20 70 73 65 75 | 64 6f 2d 74 65 72 6d 69 |ent pseu|do-termi|
|00000b20| 6e 61 6c 20 49 2f 4f 2e | 20 53 6f 20 79 6f 75 20 |nal I/O.| So you |
|00000b30| 63 61 6e 20 75 73 65 20 | 69 74 20 61 73 20 61 20 |can use |it as a |
|00000b40| 63 6f 6d 70 6f 6e 65 6e | 74 20 6f 66 20 6f 74 68 |componen|t of oth|
|00000b50| 65 72 0a 70 72 6f 67 72 | 61 6d 73 20 77 68 69 63 |er.progr|ams whic|
|00000b60| 68 20 61 64 64 20 69 6e | 70 75 74 20 6c 69 6e 65 |h add in|put line|
|00000b70| 20 65 64 69 74 69 6e 67 | 2c 20 76 69 72 74 75 61 | editing|, virtua|
|00000b80| 6c 20 73 63 72 65 65 6e | 20 73 75 70 70 6f 72 74 |l screen| support|
|00000b90| 2c 20 6f 72 20 6f 74 68 | 65 72 0a 66 61 6e 63 79 |, or oth|er.fancy|
|00000ba0| 20 66 65 61 74 75 72 65 | 73 2e 20 70 74 79 20 68 | feature|s. pty h|
|00000bb0| 61 6e 64 6c 65 73 20 6a | 75 73 74 20 6f 6e 65 20 |andles j|ust one |
|00000bc0| 6a 6f 62 2c 20 61 6e 64 | 20 68 61 6e 64 6c 65 73 |job, and| handles|
|00000bd0| 20 69 74 20 73 6f 20 63 | 6c 65 61 6e 6c 79 20 74 | it so c|leanly t|
|00000be0| 68 61 74 0a 79 6f 75 27 | 6c 6c 20 6e 65 76 65 72 |hat.you'|ll never|
|00000bf0| 20 68 61 76 65 20 74 6f | 20 64 75 70 6c 69 63 61 | have to| duplica|
|00000c00| 74 65 20 70 73 65 75 64 | 6f 2d 74 65 72 6d 69 6e |te pseud|o-termin|
|00000c10| 61 6c 20 63 6f 64 65 20 | 69 6e 20 61 6e 6f 74 68 |al code |in anoth|
|00000c20| 65 72 20 70 72 6f 67 72 | 61 6d 2e 0a 58 0a 58 2a |er progr|am..X.X*|
|00000c30| 20 46 72 65 65 20 75 74 | 69 6c 69 74 69 65 73 20 | Free ut|ilities |
|00000c40| 2d 20 70 74 79 20 34 2e | 30 20 63 6f 6d 65 73 20 |- pty 4.|0 comes |
|00000c50| 77 69 74 68 20 65 76 65 | 6e 20 6d 6f 72 65 20 75 |with eve|n more u|
|00000c60| 73 65 66 75 6c 20 75 74 | 69 6c 69 74 69 65 73 20 |seful ut|ilities |
|00000c70| 74 68 61 6e 0a 70 74 79 | 20 33 2e 30 2e 20 49 74 |than.pty| 3.0. It|
|00000c80| 20 69 6e 63 6c 75 64 65 | 73 20 74 65 6e 20 69 6d | include|s ten im|
|00000c90| 70 72 6f 76 65 64 20 63 | 6c 6f 6e 65 73 20 6f 66 |proved c|lones of|
|00000ca0| 20 73 74 61 6e 64 61 72 | 64 20 75 74 69 6c 69 74 | standar|d utilit|
|00000cb0| 69 65 73 2c 20 6e 6f 74 | 61 62 6c 79 0a 61 20 76 |ies, not|ably.a v|
|00000cc0| 65 72 73 69 6f 6e 20 6f | 66 20 60 60 73 63 72 69 |ersion o|f ``scri|
|00000cd0| 70 74 27 27 20 77 68 69 | 63 68 20 6d 61 6b 65 73 |pt'' whi|ch makes|
|00000ce0| 20 61 20 70 72 6f 70 65 | 72 20 75 74 6d 70 20 65 | a prope|r utmp e|
|00000cf0| 6e 74 72 79 3b 20 61 6e | 64 20 74 68 69 72 74 79 |ntry; an|d thirty|
|00000d00| 20 6e 65 77 0a 74 6f 6f | 6c 73 20 72 61 6e 67 69 | new.too|ls rangi|
|00000d10| 6e 67 20 66 72 6f 6d 20 | 61 64 6d 69 6e 69 73 74 |ng from |administ|
|00000d20| 72 61 74 69 76 65 20 68 | 65 6c 70 65 72 73 20 74 |rative h|elpers t|
|00000d30| 6f 20 60 60 74 73 63 72 | 69 70 74 27 27 2c 20 77 |o ``tscr|ipt'', w|
|00000d40| 68 69 63 68 20 72 65 63 | 6f 72 64 73 0a 61 6e 20 |hich rec|ords.an |
|00000d50| 69 6e 74 65 72 61 63 74 | 69 76 65 20 73 65 73 73 |interact|ive sess|
|00000d60| 69 6f 6e 20 5f 69 6e 63 | 6c 75 64 69 6e 67 20 74 |ion _inc|luding t|
|00000d70| 68 65 20 74 69 6d 69 6e | 67 20 62 65 74 77 65 65 |he timin|g betwee|
|00000d80| 6e 20 63 68 61 72 61 63 | 74 65 72 73 5f 2e 20 50 |n charac|ters_. P|
|00000d90| 6f 77 65 72 0a 75 73 65 | 72 73 20 77 69 6c 6c 20 |ower.use|rs will |
|00000da0| 61 70 70 72 65 63 69 61 | 74 65 20 60 60 6e 6f 62 |apprecia|te ``nob|
|00000db0| 75 66 27 27 2c 20 77 68 | 69 63 68 20 75 73 65 73 |uf'', wh|ich uses|
|00000dc0| 20 70 74 79 20 74 6f 20 | 74 72 61 6e 73 70 61 72 | pty to |transpar|
|00000dd0| 65 6e 74 6c 79 20 74 75 | 72 6e 0a 6f 66 66 20 73 |ently tu|rn.off s|
|00000de0| 74 64 69 6f 20 62 75 66 | 66 65 72 69 6e 67 20 69 |tdio buf|fering i|
|00000df0| 6e 20 61 6e 79 20 70 72 | 6f 67 72 61 6d 2e 0a 58 |n any pr|ogram..X|
|00000e00| 0a 58 2a 20 46 72 65 65 | 20 6c 69 62 72 61 72 69 |.X* Free| librari|
|00000e10| 65 73 20 2d 20 54 68 65 | 20 70 74 79 20 70 61 63 |es - The| pty pac|
|00000e20| 6b 61 67 65 20 63 6f 6d | 65 73 20 77 69 74 68 20 |kage com|es with |
|00000e30| 73 65 76 65 72 61 6c 20 | 6f 66 20 6d 79 20 66 61 |several |of my fa|
|00000e40| 76 6f 72 69 74 65 0a 6c | 69 62 72 61 72 69 65 73 |vorite.l|ibraries|
|00000e50| 3a 20 65 6e 76 2c 20 66 | 6d 74 2c 20 67 65 74 6f |: env, f|mt, geto|
|00000e60| 70 74 2c 20 72 61 64 69 | 78 73 6f 72 74 2c 20 72 |pt, radi|xsort, r|
|00000e70| 61 6c 6c 6f 63 2c 20 73 | 63 61 6e 2c 20 73 69 67 |alloc, s|can, sig|
|00000e80| 64 66 6c 2c 20 73 69 67 | 73 63 68 65 64 2c 0a 73 |dfl, sig|sched,.s|
|00000e90| 6f 64 2c 20 74 69 6d 65 | 72 2c 20 75 73 65 72 6e |od, time|r, usern|
|00000ea0| 61 6d 65 2e 20 59 6f 75 | 20 63 61 6e 20 75 73 65 |ame. You| can use|
|00000eb0| 20 61 6c 6c 20 6f 66 20 | 74 68 65 73 65 20 66 6f | all of |these fo|
|00000ec0| 72 20 79 6f 75 72 20 6f | 77 6e 20 70 72 6f 67 72 |r your o|wn progr|
|00000ed0| 61 6d 73 2e 0a 58 0a 58 | 2a 20 50 4f 53 49 58 20 |ams..X.X|* POSIX |
|00000ee0| 73 75 70 70 6f 72 74 20 | 2d 20 70 74 79 20 34 2e |support |- pty 4.|
|00000ef0| 30 20 77 6f 72 6b 73 20 | 77 69 74 68 6f 75 74 20 |0 works |without |
|00000f00| 74 72 6f 75 62 6c 65 20 | 75 6e 64 65 72 20 70 6f |trouble |under po|
|00000f10| 70 75 6c 61 72 20 50 4f | 53 49 58 2f 42 53 44 0a |pular PO|SIX/BSD.|
|00000f20| 73 79 73 74 65 6d 73 2c | 20 69 6e 63 6c 75 64 69 |systems,| includi|
|00000f30| 6e 67 20 55 6c 74 72 69 | 78 20 34 2e 31 20 61 6e |ng Ultri|x 4.1 an|
|00000f40| 64 20 53 75 6e 4f 53 20 | 34 2e 31 2e 31 2e 20 41 |d SunOS |4.1.1. A|
|00000f50| 6c 6c 20 74 68 65 20 6a | 6f 62 20 63 6f 6e 74 72 |ll the j|ob contr|
|00000f60| 6f 6c 0a 66 65 61 74 75 | 72 65 73 20 68 61 76 65 |ol.featu|res have|
|00000f70| 20 62 65 65 6e 20 61 64 | 61 70 74 65 64 20 74 6f | been ad|apted to|
|00000f80| 20 77 6f 72 6b 20 77 69 | 74 68 20 50 4f 53 49 58 | work wi|th POSIX|
|00000f90| 20 6a 6f 62 20 63 6f 6e | 74 72 6f 6c 2e 20 70 74 | job con|trol. pt|
|00000fa0| 79 20 73 68 6f 75 6c 64 | 0a 61 6c 73 6f 20 62 65 |y should|.also be|
|00000fb0| 20 69 6e 63 6c 75 64 65 | 64 20 77 69 74 68 20 42 | include|d with B|
|00000fc0| 53 44 20 34 2e 34 2e 0a | 58 0a 58 2a 20 44 65 74 |SD 4.4..|X.X* Det|
|00000fd0| 61 69 6c 65 64 20 64 6f | 63 75 6d 65 6e 74 61 74 |ailed do|cumentat|
|00000fe0| 69 6f 6e 20 2d 20 4c 65 | 74 20 79 6f 75 72 20 77 |ion - Le|t your w|
|00000ff0| 6f 72 72 69 65 73 20 61 | 62 6f 75 74 20 69 6e 63 |orries a|bout inc|
|00001000| 6f 6d 70 6c 65 74 65 20 | 70 72 6f 67 72 61 6d 0a |omplete |program.|
|00001010| 64 6f 63 75 6d 65 6e 74 | 61 74 69 6f 6e 20 62 65 |document|ation be|
|00001020| 20 6f 76 65 72 2e 20 54 | 68 65 20 70 74 79 20 70 | over. T|he pty p|
|00001030| 61 63 6b 61 67 65 20 69 | 6e 63 6c 75 64 65 73 20 |ackage i|ncludes |
|00001040| 6d 6f 72 65 20 74 68 61 | 6e 20 66 69 76 65 20 74 |more tha|n five t|
|00001050| 68 6f 75 73 61 6e 64 0a | 6c 69 6e 65 73 20 6f 66 |housand.|lines of|
|00001060| 20 64 6f 63 75 6d 65 6e | 74 61 74 69 6f 6e 3a 20 | documen|tation: |
|00001070| 66 6f 72 74 79 20 71 75 | 69 63 6b 2d 72 65 66 65 |forty qu|ick-refe|
|00001080| 72 65 6e 63 65 20 6d 61 | 6e 20 70 61 67 65 73 3b |rence ma|n pages;|
|00001090| 20 70 61 70 65 72 73 20 | 6f 6e 0a 63 6f 6e 74 72 | papers |on.contr|
|000010a0| 6f 6c 6c 69 6e 67 20 74 | 74 79 73 2c 20 6a 6f 62 |olling t|tys, job|
|000010b0| 20 63 6f 6e 74 72 6f 6c | 2c 20 73 65 73 73 69 6f | control|, sessio|
|000010c0| 6e 20 6d 61 6e 61 67 65 | 6d 65 6e 74 2c 20 61 6e |n manage|ment, an|
|000010d0| 64 20 75 73 65 72 20 6c | 6f 67 20 66 69 6c 65 73 |d user l|og files|
|000010e0| 3b 0a 65 78 74 65 6e 73 | 69 76 65 20 6e 6f 74 65 |;.extens|ive note|
|000010f0| 73 20 6f 6e 20 70 74 79 | 20 69 6e 74 65 72 6e 61 |s on pty| interna|
|00001100| 6c 73 20 61 6e 64 20 70 | 6f 72 74 69 6e 67 20 69 |ls and p|orting i|
|00001110| 73 73 75 65 73 3b 20 61 | 6e 64 20 6d 6f 72 65 2e |ssues; a|nd more.|
|00001120| 0a 58 0a 4f 6b 61 79 2c | 20 65 6e 6f 75 67 68 20 |.X.Okay,| enough |
|00001130| 68 79 70 65 2e 20 57 68 | 61 74 27 73 20 70 74 79 |hype. Wh|at's pty|
|00001140| 20 67 6f 6f 64 20 66 6f | 72 3f 20 4f 6e 63 65 20 | good fo|r? Once |
|00001150| 75 70 6f 6e 20 61 20 74 | 69 6d 65 20 6e 65 74 68 |upon a t|ime neth|
|00001160| 61 63 6b 20 77 6f 75 6c | 64 2c 0a 69 66 20 79 6f |ack woul|d,.if yo|
|00001170| 75 20 77 65 72 65 20 6c | 75 63 6b 79 2c 20 70 72 |u were l|ucky, pr|
|00001180| 6f 64 75 63 65 20 63 68 | 61 72 61 63 74 65 72 73 |oduce ch|aracters|
|00001190| 20 77 69 74 68 20 62 6f | 74 68 20 61 20 72 69 6e | with bo|th a rin|
|000011a0| 67 20 6f 66 20 70 6f 6c | 79 6d 6f 72 70 68 20 61 |g of pol|ymorph a|
|000011b0| 6e 64 0a 61 20 72 69 6e | 67 20 6f 66 20 70 6f 6c |nd.a rin|g of pol|
|000011c0| 79 6d 6f 72 70 68 20 63 | 6f 6e 74 72 6f 6c 2e 20 |ymorph c|ontrol. |
|000011d0| 49 20 77 61 6e 74 65 64 | 20 74 6f 20 72 75 6e 20 |I wanted| to run |
|000011e0| 6e 65 74 68 61 63 6b 20 | 69 6e 73 69 64 65 20 61 |nethack |inside a|
|000011f0| 20 73 63 72 69 70 74 0a | 77 68 69 63 68 20 77 6f | script.|which wo|
|00001200| 75 6c 64 20 6b 65 65 70 | 20 72 65 72 6f 6c 6c 69 |uld keep| rerolli|
|00001210| 6e 67 20 63 68 61 72 61 | 63 74 65 72 73 20 75 6e |ng chara|cters un|
|00001220| 74 69 6c 20 69 74 20 73 | 61 77 20 74 68 61 74 20 |til it s|aw that |
|00001230| 63 6f 6d 62 69 6e 61 74 | 69 6f 6e 2e 0a 58 28 50 |combinat|ion..X(P|
|00001240| 6c 61 79 69 6e 67 20 62 | 79 20 74 68 65 20 72 75 |laying b|y the ru|
|00001250| 6c 65 73 20 77 61 73 20 | 6e 65 76 65 72 20 6d 79 |les was |never my|
|00001260| 20 66 6f 72 74 65 2e 29 | 20 55 6e 66 6f 72 74 75 | forte.)| Unfortu|
|00001270| 6e 61 74 65 6c 79 2c 20 | 6e 65 74 68 61 63 6b 20 |nately, |nethack |
|00001280| 64 69 64 6e 27 74 0a 6c | 69 6b 65 20 68 61 76 69 |didn't.l|ike havi|
|00001290| 6e 67 20 69 74 73 20 69 | 6e 70 75 74 20 61 6e 64 |ng its i|nput and|
|000012a0| 20 6f 75 74 70 75 74 20 | 72 65 64 69 72 65 63 74 | output |redirect|
|000012b0| 65 64 2e 20 53 6f 20 49 | 20 77 72 6f 74 65 20 74 |ed. So I| wrote t|
|000012c0| 68 65 20 66 69 72 73 74 | 0a 76 65 72 73 69 6f 6e |he first|.version|
|000012d0| 73 20 6f 66 20 70 74 79 | 2e 20 60 60 70 74 79 20 |s of pty|. ``pty |
|000012e0| 6e 65 74 68 61 63 6b 27 | 27 20 77 6f 72 6b 65 64 |nethack'|' worked|
|000012f0| 20 6a 75 73 74 20 6c 69 | 6b 65 20 60 60 6e 65 74 | just li|ke ``net|
|00001300| 68 61 63 6b 27 27 20 62 | 75 74 20 63 6f 75 6c 64 |hack'' b|ut could|
|00001310| 0a 62 65 20 69 6e 76 6f | 6b 65 64 20 69 6e 20 74 |.be invo|ked in t|
|00001320| 68 65 20 6d 69 64 64 6c | 65 20 6f 66 20 61 20 70 |he middl|e of a p|
|00001330| 69 70 65 20 69 6e 73 69 | 64 65 20 61 20 73 63 72 |ipe insi|de a scr|
|00001340| 69 70 74 2e 20 41 73 20 | 74 68 65 20 79 65 61 72 |ipt. As |the year|
|00001350| 73 20 77 65 6e 74 0a 62 | 79 2c 20 70 74 79 20 62 |s went.b|y, pty b|
|00001360| 65 63 61 6d 65 20 73 6f | 6d 65 77 68 61 74 20 6d |ecame so|mewhat m|
|00001370| 6f 72 65 20 70 6f 77 65 | 72 66 75 6c 20 61 6e 64 |ore powe|rful and|
|00001380| 20 66 6c 65 78 69 62 6c | 65 2c 20 62 75 74 20 69 | flexibl|e, but i|
|00001390| 74 73 20 62 61 73 69 63 | 0a 66 75 6e 63 74 69 6f |ts basic|.functio|
|000013a0| 6e 20 68 61 73 20 61 6c | 77 61 79 73 20 72 65 6d |n has al|ways rem|
|000013b0| 61 69 6e 65 64 20 74 68 | 65 20 73 61 6d 65 3a 20 |ained th|e same: |
|000013c0| 74 6f 20 72 75 6e 20 70 | 72 6f 67 72 61 6d 73 2c |to run p|rograms,|
|000013d0| 20 65 73 70 65 63 69 61 | 6c 6c 79 0a 58 60 60 69 | especia|lly.X``i|
|000013e0| 6e 74 65 72 61 63 74 69 | 76 65 27 27 20 70 72 6f |nteracti|ve'' pro|
|000013f0| 67 72 61 6d 73 2c 20 75 | 6e 64 65 72 20 61 20 70 |grams, u|nder a p|
|00001400| 73 65 75 64 6f 2d 74 74 | 79 2e 20 44 65 73 70 69 |seudo-tt|y. Despi|
|00001410| 74 65 20 74 68 69 73 20 | 73 69 6e 67 6c 65 2d 6d |te this |single-m|
|00001420| 69 6e 64 65 64 0a 61 74 | 74 69 74 75 64 65 2c 20 |inded.at|titude, |
|00001430| 70 74 79 20 68 61 73 20 | 77 6f 72 6d 65 64 20 69 |pty has |wormed i|
|00001440| 74 73 20 77 61 79 20 69 | 6e 74 6f 20 74 68 65 20 |ts way i|nto the |
|00001450| 73 6f 6c 75 74 69 6f 6e | 73 20 74 6f 20 64 6f 7a |solution|s to doz|
|00001460| 65 6e 73 20 6f 66 0a 70 | 72 6f 62 6c 65 6d 73 2c |ens of.p|roblems,|
|00001470| 20 72 61 6e 67 69 6e 67 | 20 66 72 6f 6d 20 62 75 | ranging| from bu|
|00001480| 66 66 65 72 20 63 6f 6e | 74 72 6f 6c 20 74 6f 20 |ffer con|trol to |
|00001490| 61 75 74 6f 6d 61 74 69 | 6e 67 20 74 65 6c 6e 65 |automati|ng telne|
|000014a0| 74 20 73 63 72 69 70 74 | 73 20 74 6f 0a 6d 61 6b |t script|s to.mak|
|000014b0| 69 6e 67 20 72 6c 6f 67 | 69 6e 64 20 73 65 63 75 |ing rlog|ind secu|
|000014c0| 72 65 2e 20 50 73 65 75 | 64 6f 2d 74 65 72 6d 69 |re. Pseu|do-termi|
|000014d0| 6e 61 6c 20 63 6f 64 65 | 20 73 65 65 6d 73 20 74 |nal code| seems t|
|000014e0| 6f 20 73 70 72 69 6e 67 | 20 75 70 0a 65 76 65 72 |o spring| up.ever|
|000014f0| 79 77 68 65 72 65 3b 20 | 70 74 79 20 69 73 20 79 |ywhere; |pty is y|
|00001500| 6f 75 72 20 77 65 61 70 | 6f 6e 20 74 6f 20 73 6c |our weap|on to sl|
|00001510| 61 73 68 20 74 68 61 74 | 20 63 6f 64 65 20 74 6f |ash that| code to|
|00001520| 20 61 20 73 69 6e 67 6c | 65 20 6c 69 6e 65 2e 0a | a singl|e line..|
|00001530| 58 45 6e 6a 6f 79 21 0a | 58 0a 58 2d 2d 2d 44 61 |XEnjoy!.|X.X---Da|
|00001540| 6e 20 42 65 72 6e 73 74 | 65 69 6e 2c 20 62 72 6e |n Bernst|ein, brn|
|00001550| 73 74 6e 64 40 6e 79 75 | 2e 65 64 75 0a 45 4e 44 |stnd@nyu|.edu.END|
|00001560| 5f 4f 46 5f 46 49 4c 45 | 0a 69 66 20 74 65 73 74 |_OF_FILE|.if test|
|00001570| 20 34 33 34 30 20 2d 6e | 65 20 60 77 63 20 2d 63 | 4340 -n|e `wc -c|
|00001580| 20 3c 27 42 4c 55 52 42 | 27 60 3b 20 74 68 65 6e | <'BLURB|'`; then|
|00001590| 0a 20 20 20 20 65 63 68 | 6f 20 73 68 61 72 3a 20 |. ech|o shar: |
|000015a0| 5c 22 27 42 4c 55 52 42 | 27 5c 22 20 75 6e 70 61 |\"'BLURB|'\" unpa|
|000015b0| 63 6b 65 64 20 77 69 74 | 68 20 77 72 6f 6e 67 20 |cked wit|h wrong |
|000015c0| 73 69 7a 65 21 0a 66 69 | 0a 23 20 65 6e 64 20 6f |size!.fi|.# end o|
|000015d0| 66 20 27 42 4c 55 52 42 | 27 0a 66 69 0a 69 66 20 |f 'BLURB|'.fi.if |
|000015e0| 74 65 73 74 20 2d 66 20 | 27 49 4e 53 54 41 4c 4c |test -f |'INSTALL|
|000015f0| 2e 63 27 20 2d 61 20 22 | 24 7b 31 7d 22 20 21 3d |.c' -a "|${1}" !=|
|00001600| 20 22 2d 63 22 20 3b 20 | 74 68 65 6e 20 0a 20 20 | "-c" ; |then . |
|00001610| 65 63 68 6f 20 73 68 61 | 72 3a 20 57 69 6c 6c 20 |echo sha|r: Will |
|00001620| 6e 6f 74 20 63 6c 6f 62 | 62 65 72 20 65 78 69 73 |not clob|ber exis|
|00001630| 74 69 6e 67 20 66 69 6c | 65 20 5c 22 27 49 4e 53 |ting fil|e \"'INS|
|00001640| 54 41 4c 4c 2e 63 27 5c | 22 0a 65 6c 73 65 0a 65 |TALL.c'\|".else.e|
|00001650| 63 68 6f 20 73 68 61 72 | 3a 20 45 78 74 72 61 63 |cho shar|: Extrac|
|00001660| 74 69 6e 67 20 5c 22 27 | 49 4e 53 54 41 4c 4c 2e |ting \"'|INSTALL.|
|00001670| 63 27 5c 22 20 5c 28 36 | 32 33 31 20 63 68 61 72 |c'\" \(6|231 char|
|00001680| 61 63 74 65 72 73 5c 29 | 0a 73 65 64 20 22 73 2f |acters\)|.sed "s/|
|00001690| 5e 58 2f 2f 22 20 3e 27 | 49 4e 53 54 41 4c 4c 2e |^X//" >'|INSTALL.|
|000016a0| 63 27 20 3c 3c 27 45 4e | 44 5f 4f 46 5f 46 49 4c |c' <<'EN|D_OF_FIL|
|000016b0| 45 27 0a 58 23 69 6e 63 | 6c 75 64 65 20 3c 70 77 |E'.X#inc|lude <pw|
|000016c0| 64 2e 68 3e 0a 58 23 69 | 6e 63 6c 75 64 65 20 3c |d.h>.X#i|nclude <|
|000016d0| 67 72 70 2e 68 3e 0a 58 | 23 69 6e 63 6c 75 64 65 |grp.h>.X|#include|
|000016e0| 20 3c 73 74 64 69 6f 2e | 68 3e 0a 58 23 69 6e 63 | <stdio.|h>.X#inc|
|000016f0| 6c 75 64 65 20 3c 73 79 | 73 2f 74 79 70 65 73 2e |lude <sy|s/types.|
|00001700| 68 3e 0a 58 23 69 6e 63 | 6c 75 64 65 20 3c 73 79 |h>.X#inc|lude <sy|
|00001710| 73 2f 66 69 6c 65 2e 68 | 3e 0a 58 23 69 6e 63 6c |s/file.h|>.X#incl|
|00001720| 75 64 65 20 3c 73 79 73 | 2f 73 74 61 74 2e 68 3e |ude <sys|/stat.h>|
|00001730| 0a 58 23 69 6e 63 6c 75 | 64 65 20 22 63 6f 6e 66 |.X#inclu|de "conf|
|00001740| 69 67 2f 70 74 79 62 69 | 6e 2e 68 22 0a 58 23 69 |ig/ptybi|n.h".X#i|
|00001750| 6e 63 6c 75 64 65 20 22 | 63 6f 6e 66 69 67 2f 70 |nclude "|config/p|
|00001760| 74 79 64 69 72 2e 68 22 | 0a 58 23 69 6e 63 6c 75 |tydir.h"|.X#inclu|
|00001770| 64 65 20 22 63 6f 6e 66 | 69 67 2f 70 74 79 67 72 |de "conf|ig/ptygr|
|00001780| 6f 75 70 2e 68 22 0a 58 | 23 69 6e 63 6c 75 64 65 |oup.h".X|#include|
|00001790| 20 22 63 6f 6e 66 69 67 | 2f 73 65 73 73 63 6f 6e | "config|/sesscon|
|000017a0| 6e 66 69 6c 65 2e 68 22 | 0a 58 23 69 6e 63 6c 75 |nfile.h"|.X#inclu|
|000017b0| 64 65 20 22 63 6f 6e 66 | 69 67 2f 73 65 73 73 66 |de "conf|ig/sessf|
|000017c0| 69 6c 65 2e 68 22 0a 58 | 23 69 6e 63 6c 75 64 65 |ile.h".X|#include|
|000017d0| 20 3c 75 74 6d 70 2e 68 | 3e 0a 58 23 69 6e 63 6c | <utmp.h|>.X#incl|
|000017e0| 75 64 65 20 22 63 6f 6e | 66 69 67 2f 75 74 6d 70 |ude "con|fig/utmp|
|000017f0| 66 69 6c 65 2e 68 22 0a | 58 23 69 6e 63 6c 75 64 |file.h".|X#includ|
|00001800| 65 20 22 63 6f 6e 66 69 | 67 2f 77 74 6d 70 66 69 |e "confi|g/wtmpfi|
|00001810| 6c 65 2e 68 22 0a 58 23 | 69 6e 63 6c 75 64 65 20 |le.h".X#|include |
|00001820| 22 63 6f 6e 66 69 67 2f | 70 74 79 67 72 6f 75 70 |"config/|ptygroup|
|00001830| 2e 68 22 0a 58 0a 63 68 | 61 72 20 70 74 79 62 69 |.h".X.ch|ar ptybi|
|00001840| 6e 5b 5d 20 3d 20 50 54 | 59 42 49 4e 3b 0a 63 68 |n[] = PT|YBIN;.ch|
|00001850| 61 72 20 70 74 79 64 69 | 72 5b 5d 20 3d 20 50 54 |ar ptydi|r[] = PT|
|00001860| 59 44 49 52 3b 0a 63 68 | 61 72 20 73 65 73 73 63 |YDIR;.ch|ar sessc|
|00001870| 6f 6e 6e 6e 6f 77 5b 5d | 20 3d 20 53 45 53 53 43 |onnnow[]| = SESSC|
|00001880| 4f 4e 4e 4e 4f 57 5f 46 | 49 4c 45 3b 0a 63 68 61 |ONNNOW_F|ILE;.cha|
|00001890| 72 20 73 65 73 73 63 6f | 6e 6e 6c 6f 67 5b 5d 20 |r sessco|nnlog[] |
|000018a0| 3d 20 53 45 53 53 43 4f | 4e 4e 4c 4f 47 5f 46 49 |= SESSCO|NNLOG_FI|
|000018b0| 4c 45 3b 0a 63 68 61 72 | 20 73 65 73 73 6e 6f 77 |LE;.char| sessnow|
|000018c0| 5b 5d 20 3d 20 53 45 53 | 53 4e 4f 57 5f 46 49 4c |[] = SES|SNOW_FIL|
|000018d0| 45 3b 0a 63 68 61 72 20 | 73 65 73 73 6c 6f 67 5b |E;.char |sesslog[|
|000018e0| 5d 20 3d 20 53 45 53 53 | 4c 4f 47 5f 46 49 4c 45 |] = SESS|LOG_FILE|
|000018f0| 3b 0a 63 68 61 72 20 75 | 74 6d 70 5b 5d 20 3d 20 |;.char u|tmp[] = |
|00001900| 55 54 4d 50 5f 46 49 4c | 45 3b 0a 63 68 61 72 20 |UTMP_FIL|E;.char |
|00001910| 77 74 6d 70 5b 5d 20 3d | 20 57 54 4d 50 5f 46 49 |wtmp[] =| WTMP_FI|
|00001920| 4c 45 3b 0a 58 0a 73 74 | 61 74 69 63 20 69 6e 74 |LE;.X.st|atic int|
|00001930| 20 6e 75 6d 20 3d 20 30 | 3b 0a 58 0a 76 6f 69 64 | num = 0|;.X.void|
|00001940| 20 73 65 63 74 69 6f 6e | 28 73 29 0a 63 68 61 72 | section|(s).char|
|00001950| 20 2a 73 3b 0a 58 7b 0a | 58 20 2b 2b 6e 75 6d 3b | *s;.X{.|X ++num;|
|00001960| 0a 58 20 70 72 69 6e 74 | 66 28 22 5c 6e 25 64 2e |.X print|f("\n%d.|
|00001970| 20 25 73 2e 5c 6e 22 2c | 6e 75 6d 2c 73 29 3b 0a | %s.\n",|num,s);.|
|00001980| 58 7d 0a 58 0a 69 6e 74 | 20 64 6f 6e 74 73 6b 69 |X}.X.int| dontski|
|00001990| 70 28 73 2c 74 2c 75 29 | 0a 63 68 61 72 20 2a 73 |p(s,t,u)|.char *s|
|000019a0| 3b 0a 63 68 61 72 20 2a | 74 3b 0a 63 68 61 72 20 |;.char *|t;.char |
|000019b0| 2a 75 3b 0a 58 7b 0a 58 | 20 63 68 61 72 20 62 75 |*u;.X{.X| char bu|
|000019c0| 66 5b 31 30 30 5d 3b 0a | 58 20 63 68 61 72 20 66 |f[100];.|X char f|
|000019d0| 6f 72 6d 61 74 5b 32 30 | 30 5d 3b 0a 58 20 73 70 |ormat[20|0];.X sp|
|000019e0| 72 69 6e 74 66 28 66 6f | 72 6d 61 74 2c 22 21 20 |rintf(fo|rmat,"! |
|000019f0| 25 73 3a 20 22 2c 73 29 | 3b 0a 58 20 70 72 69 6e |%s: ",s)|;.X prin|
|00001a00| 74 66 28 66 6f 72 6d 61 | 74 2c 74 2c 75 29 3b 0a |tf(forma|t,t,u);.|
|00001a10| 58 20 69 66 20 28 66 67 | 65 74 73 28 62 75 66 2c |X if (fg|ets(buf,|
|00001a20| 73 69 7a 65 6f 66 28 62 | 75 66 29 2c 73 74 64 69 |sizeof(b|uf),stdi|
|00001a30| 6e 29 20 3d 3d 20 30 29 | 0a 58 20 20 20 72 65 74 |n) == 0)|.X ret|
|00001a40| 75 72 6e 20 30 3b 0a 58 | 20 69 66 20 28 62 75 66 |urn 0;.X| if (buf|
|00001a50| 5b 30 5d 20 3d 3d 20 27 | 6f 27 29 0a 58 20 20 7b |[0] == '|o').X {|
|00001a60| 0a 58 20 20 20 70 75 74 | 73 28 22 4f 6b 61 79 2e |.X put|s("Okay.|
|00001a70| 22 29 3b 0a 58 20 20 20 | 72 65 74 75 72 6e 20 31 |");.X |return 1|
|00001a80| 3b 0a 58 20 20 7d 0a 58 | 20 69 66 20 28 62 75 66 |;.X }.X| if (buf|
|00001a90| 5b 30 5d 20 3d 3d 20 27 | 73 27 29 0a 58 20 20 7b |[0] == '|s').X {|
|00001aa0| 0a 58 20 20 20 70 75 74 | 73 28 22 53 6b 69 70 70 |.X put|s("Skipp|
|00001ab0| 65 64 2e 22 29 3b 0a 58 | 20 20 20 72 65 74 75 72 |ed.");.X| retur|
|00001ac0| 6e 20 30 3b 0a 58 20 20 | 7d 0a 58 20 72 65 74 75 |n 0;.X |}.X retu|
|00001ad0| 72 6e 20 31 3b 0a 58 7d | 0a 58 0a 63 6f 70 79 66 |rn 1;.X}|.X.copyf|
|00001ae0| 32 64 28 66 6e 2c 64 69 | 72 66 6e 29 0a 63 68 61 |2d(fn,di|rfn).cha|
|00001af0| 72 20 2a 66 6e 3b 0a 63 | 68 61 72 20 2a 64 69 72 |r *fn;.c|har *dir|
|00001b00| 66 6e 3b 0a 58 7b 0a 58 | 20 69 6e 74 20 66 64 6f |fn;.X{.X| int fdo|
|00001b10| 6c 64 3b 0a 58 20 69 6e | 74 20 66 64 6e 65 77 3b |ld;.X in|t fdnew;|
|00001b20| 0a 58 20 69 6e 74 20 72 | 3b 0a 58 20 69 6e 74 20 |.X int r|;.X int |
|00001b30| 6e 3b 0a 58 20 69 6e 74 | 20 77 3b 0a 58 20 63 68 |n;.X int| w;.X ch|
|00001b40| 61 72 20 62 75 66 5b 31 | 36 33 38 34 5d 3b 0a 58 |ar buf[1|6384];.X|
|00001b50| 0a 58 20 66 64 6f 6c 64 | 20 3d 20 6f 70 65 6e 28 |.X fdold| = open(|
|00001b60| 66 6e 2c 4f 5f 52 44 4f | 4e 4c 59 29 3b 0a 58 20 |fn,O_RDO|NLY);.X |
|00001b70| 69 66 20 28 66 64 6f 6c | 64 20 3d 3d 20 2d 31 29 |if (fdol|d == -1)|
|00001b80| 0a 58 20 20 20 72 65 74 | 75 72 6e 20 2d 31 3b 0a |.X ret|urn -1;.|
|00001b90| 58 20 66 64 6e 65 77 20 | 3d 20 6f 70 65 6e 28 64 |X fdnew |= open(d|
|00001ba0| 69 72 66 6e 2c 4f 5f 57 | 52 4f 4e 4c 59 20 7c 20 |irfn,O_W|RONLY | |
|00001bb0| 4f 5f 43 52 45 41 54 20 | 7c 20 4f 5f 54 52 55 4e |O_CREAT || O_TRUN|
|00001bc0| 43 2c 30 36 30 30 29 3b | 0a 58 20 69 66 20 28 66 |C,0600);|.X if (f|
|00001bd0| 64 6e 65 77 20 3d 3d 20 | 2d 31 29 0a 58 20 20 7b |dnew == |-1).X {|
|00001be0| 20 63 6c 6f 73 65 28 66 | 64 6f 6c 64 29 3b 20 72 | close(f|dold); r|
|00001bf0| 65 74 75 72 6e 20 2d 31 | 3b 20 7d 0a 58 20 77 68 |eturn -1|; }.X wh|
|00001c00| 69 6c 65 20 28 28 72 20 | 3d 20 72 65 61 64 28 66 |ile ((r |= read(f|
|00001c10| 64 6f 6c 64 2c 62 75 66 | 2c 73 69 7a 65 6f 66 28 |dold,buf|,sizeof(|
|00001c20| 62 75 66 29 29 29 20 3e | 20 30 29 0a 58 20 20 7b |buf))) >| 0).X {|
|00001c30| 0a 58 20 20 20 6e 20 3d | 20 30 3b 0a 58 20 20 20 |.X n =| 0;.X |
|00001c40| 77 68 69 6c 65 20 28 6e | 20 3c 20 72 29 0a 58 20 |while (n| < r).X |
|00001c50| 20 20 20 7b 0a 58 20 20 | 20 20 20 77 20 3d 20 77 | {.X | w = w|
|00001c60| 72 69 74 65 28 66 64 6e | 65 77 2c 62 75 66 20 2b |rite(fdn|ew,buf +|
|00001c70| 20 6e 2c 72 20 2d 20 6e | 29 3b 0a 58 20 20 20 20 | n,r - n|);.X |
|00001c80| 20 69 66 20 28 77 20 3d | 3d 20 2d 31 29 0a 58 20 | if (w =|= -1).X |
|00001c90| 20 20 20 20 20 7b 0a 58 | 20 20 20 20 20 20 20 63 | {.X| c|
|00001ca0| 6c 6f 73 65 28 66 64 6f | 6c 64 29 3b 20 63 6c 6f |lose(fdo|ld); clo|
|00001cb0| 73 65 28 66 64 6e 65 77 | 29 3b 20 72 65 74 75 72 |se(fdnew|); retur|
|00001cc0| 6e 20 2d 31 3b 0a 58 20 | 20 20 20 20 20 7d 0a 58 |n -1;.X | }.X|
|00001cd0| 20 20 20 20 20 6e 20 2b | 3d 20 77 3b 0a 58 20 20 | n +|= w;.X |
|00001ce0| 20 20 7d 0a 58 20 20 7d | 0a 58 20 63 6c 6f 73 65 | }.X }|.X close|
|00001cf0| 28 66 64 6e 65 77 29 3b | 0a 58 20 63 6c 6f 73 65 |(fdnew);|.X close|
|00001d00| 28 66 64 6f 6c 64 29 3b | 0a 58 20 69 66 20 28 72 |(fdold);|.X if (r|
|00001d10| 20 3d 3d 20 2d 31 29 0a | 58 20 20 20 72 65 74 75 | == -1).|X retu|
|00001d20| 72 6e 20 2d 31 3b 0a 58 | 20 72 65 74 75 72 6e 20 |rn -1;.X| return |
|00001d30| 30 3b 0a 58 7d 0a 58 0a | 73 74 61 74 69 63 20 63 |0;.X}.X.|static c|
|00001d40| 68 61 72 20 2a 70 74 79 | 75 6e 61 6d 65 20 3d 20 |har *pty|uname = |
|00001d50| 22 70 74 79 22 3b 0a 58 | 0a 63 68 6f 77 6e 70 74 |"pty";.X|.chownpt|
|00001d60| 79 28 66 6e 29 0a 63 68 | 61 72 20 2a 66 6e 3b 0a |y(fn).ch|ar *fn;.|
|00001d70| 58 7b 0a 58 20 73 74 72 | 75 63 74 20 70 61 73 73 |X{.X str|uct pass|
|00001d80| 77 64 20 2a 6f 77 6e 3b | 0a 58 20 6f 77 6e 20 3d |wd *own;|.X own =|
|00001d90| 20 67 65 74 70 77 6e 61 | 6d 28 70 74 79 75 6e 61 | getpwna|m(ptyuna|
|00001da0| 6d 65 29 3b 0a 58 20 69 | 66 20 28 21 6f 77 6e 29 |me);.X i|f (!own)|
|00001db0| 0a 58 20 20 20 72 65 74 | 75 72 6e 20 2d 31 3b 0a |.X ret|urn -1;.|
|00001dc0| 58 20 72 65 74 75 72 6e | 20 63 68 6f 77 6e 28 66 |X return| chown(f|
|00001dd0| 6e 2c 6f 77 6e 2d 3e 70 | 77 5f 75 69 64 2c 2d 31 |n,own->p|w_uid,-1|
|00001de0| 29 3b 0a 58 7d 0a 58 0a | 63 68 67 72 70 74 74 79 |);.X}.X.|chgrptty|
|00001df0| 28 66 6e 29 0a 63 68 61 | 72 20 2a 66 6e 3b 0a 58 |(fn).cha|r *fn;.X|
|00001e00| 7b 0a 58 20 73 74 72 75 | 63 74 20 67 72 6f 75 70 |{.X stru|ct group|
|00001e10| 20 2a 67 72 70 3b 0a 58 | 20 67 72 70 20 3d 20 67 | *grp;.X| grp = g|
|00001e20| 65 74 67 72 6e 61 6d 28 | 22 74 74 79 22 29 3b 0a |etgrnam(|"tty");.|
|00001e30| 58 20 69 66 20 28 21 67 | 72 70 29 0a 58 20 20 20 |X if (!g|rp).X |
|00001e40| 72 65 74 75 72 6e 20 2d | 31 3b 0a 58 20 72 65 74 |return -|1;.X ret|
|00001e50| 75 72 6e 20 63 68 6f 77 | 6e 28 66 6e 2c 2d 31 2c |urn chow|n(fn,-1,|
|00001e60| 67 72 70 2d 3e 67 72 5f | 67 69 64 29 3b 0a 58 7d |grp->gr_|gid);.X}|
|00001e70| 0a 58 0a 74 6f 75 63 68 | 28 66 6e 29 0a 63 68 61 |.X.touch|(fn).cha|
|00001e80| 72 20 2a 66 6e 3b 0a 58 | 7b 0a 58 20 69 6e 74 20 |r *fn;.X|{.X int |
|00001e90| 66 64 3b 0a 58 20 66 64 | 20 3d 20 6f 70 65 6e 28 |fd;.X fd| = open(|
|00001ea0| 66 6e 2c 4f 5f 57 52 4f | 4e 4c 59 20 7c 20 4f 5f |fn,O_WRO|NLY | O_|
|00001eb0| 43 52 45 41 54 2c 30 36 | 34 34 29 3b 0a 58 20 69 |CREAT,06|44);.X i|
|00001ec0| 66 20 28 66 64 20 3d 3d | 20 2d 31 29 0a 58 20 20 |f (fd ==| -1).X |
|00001ed0| 20 72 65 74 75 72 6e 20 | 2d 31 3b 0a 58 20 63 6c | return |-1;.X cl|
|00001ee0| 6f 73 65 28 66 64 29 3b | 0a 58 20 69 66 20 28 63 |ose(fd);|.X if (c|
|00001ef0| 68 6d 6f 64 28 66 6e 2c | 30 36 34 34 29 20 3d 3d |hmod(fn,|0644) ==|
|00001f00| 20 2d 31 29 0a 58 20 20 | 20 72 65 74 75 72 6e 20 | -1).X | return |
|00001f10| 2d 31 3b 0a 58 20 69 66 | 20 28 63 68 6f 77 6e 70 |-1;.X if| (chownp|
|00001f20| 74 79 28 66 6e 29 20 3d | 3d 20 2d 31 29 0a 58 20 |ty(fn) =|= -1).X |
|00001f30| 20 20 72 65 74 75 72 6e | 20 2d 31 3b 0a 58 20 72 | return| -1;.X r|
|00001f40| 65 74 75 72 6e 20 30 3b | 0a 58 7d 0a 58 0a 73 74 |eturn 0;|.X}.X.st|
|00001f50| 61 74 69 63 20 63 68 61 | 72 20 43 48 4f 50 54 59 |atic cha|r CHOPTY|
|00001f60| 53 53 5b 31 30 30 5d 20 | 3d 20 22 63 68 6f 77 6e |SS[100] |= "chown|
|00001f70| 20 70 74 79 20 25 73 2f | 25 73 22 3b 0a 58 0a 64 | pty %s/|%s";.X.d|
|00001f80| 6f 62 69 6e 28 66 6e 2c | 6c 65 76 65 6c 29 0a 63 |obin(fn,|level).c|
|00001f90| 68 61 72 20 2a 66 6e 3b | 0a 69 6e 74 20 6c 65 76 |har *fn;|.int lev|
|00001fa0| 65 6c 3b 0a 58 7b 0a 58 | 20 63 68 61 72 20 64 69 |el;.X{.X| char di|
|00001fb0| 72 66 6e 5b 73 69 7a 65 | 6f 66 28 70 74 79 62 69 |rfn[size|of(ptybi|
|00001fc0| 6e 29 20 2b 20 35 30 5d | 3b 0a 58 20 73 70 72 69 |n) + 50]|;.X spri|
|00001fd0| 6e 74 66 28 64 69 72 66 | 6e 2c 22 25 73 2f 25 73 |ntf(dirf|n,"%s/%s|
|00001fe0| 22 2c 70 74 79 62 69 6e | 2c 66 6e 29 3b 0a 58 20 |",ptybin|,fn);.X |
|00001ff0| 69 66 20 28 64 6f 6e 74 | 73 6b 69 70 28 22 63 70 |if (dont|skip("cp|
|00002000| 20 25 73 20 25 73 22 2c | 66 6e 2c 70 74 79 62 69 | %s %s",|fn,ptybi|
|00002010| 6e 29 29 0a 58 20 20 20 | 69 66 20 28 63 6f 70 79 |n)).X |if (copy|
|00002020| 66 32 64 28 66 6e 2c 64 | 69 72 66 6e 29 20 3d 3d |f2d(fn,d|irfn) ==|
|00002030| 20 2d 31 29 0a 58 20 20 | 20 20 20 70 65 72 72 6f | -1).X | perro|
|00002040| 72 28 22 63 6f 70 79 20 | 66 61 69 6c 65 64 22 29 |r("copy |failed")|
|00002050| 3b 0a 58 20 73 77 69 74 | 63 68 28 6c 65 76 65 6c |;.X swit|ch(level|
|00002060| 29 0a 58 20 20 7b 0a 58 | 20 20 20 63 61 73 65 20 |).X {.X| case |
|00002070| 30 3a 0a 58 20 20 20 20 | 20 69 66 20 28 64 6f 6e |0:.X | if (don|
|00002080| 74 73 6b 69 70 28 22 63 | 68 6d 6f 64 20 37 35 35 |tskip("c|hmod 755|
|00002090| 20 25 73 2f 25 73 22 2c | 70 74 79 62 69 6e 2c 66 | %s/%s",|ptybin,f|
|000020a0| 6e 29 29 0a 58 20 20 20 | 20 20 20 20 69 66 20 28 |n)).X | if (|
|000020b0| 63 68 6d 6f 64 28 64 69 | 72 66 6e 2c 30 37 35 35 |chmod(di|rfn,0755|
|000020c0| 29 20 3d 3d 20 2d 31 29 | 0a 58 09 20 70 65 72 72 |) == -1)|.X. perr|
|000020d0| 6f 72 28 22 63 68 6d 6f | 64 3a 20 63 61 6e 6e 6f |or("chmo|d: canno|
|000020e0| 74 20 63 68 61 6e 67 65 | 20 6d 6f 64 65 22 29 3b |t change| mode");|
|000020f0| 0a 58 20 20 20 20 20 62 | 72 65 61 6b 3b 0a 58 20 |.X b|reak;.X |
|00002100| 20 20 63 61 73 65 20 31 | 3a 0a 58 20 20 20 20 20 | case 1|:.X |
|00002110| 69 66 20 28 64 6f 6e 74 | 73 6b 69 70 28 22 63 68 |if (dont|skip("ch|
|00002120| 6d 6f 64 20 37 35 35 20 | 25 73 2f 25 73 22 2c 70 |mod 755 |%s/%s",p|
|00002130| 74 79 62 69 6e 2c 66 6e | 29 29 0a 58 20 20 20 20 |tybin,fn|)).X |
|00002140| 20 20 20 69 66 20 28 63 | 68 6d 6f 64 28 64 69 72 | if (c|hmod(dir|
|00002150| 66 6e 2c 30 37 35 35 29 | 20 3d 3d 20 2d 31 29 0a |fn,0755)| == -1).|
|00002160| 58 09 20 70 65 72 72 6f | 72 28 22 63 68 6d 6f 64 |X. perro|r("chmod|
|00002170| 3a 20 63 61 6e 6e 6f 74 | 20 63 68 61 6e 67 65 20 |: cannot| change |
|00002180| 6d 6f 64 65 22 29 3b 0a | 58 20 20 20 20 20 62 72 |mode");.|X br|
|00002190| 65 61 6b 3b 0a 58 20 20 | 20 63 61 73 65 20 32 3a |eak;.X | case 2:|
|000021a0| 0a 58 20 20 20 20 20 69 | 66 20 28 64 6f 6e 74 73 |.X i|f (donts|
|000021b0| 6b 69 70 28 22 63 68 67 | 72 70 20 74 74 79 20 25 |kip("chg|rp tty %|
|000021c0| 73 2f 25 73 22 2c 70 74 | 79 62 69 6e 2c 66 6e 29 |s/%s",pt|ybin,fn)|
|000021d0| 29 0a 58 20 20 20 20 20 | 20 20 69 66 20 28 63 68 |).X | if (ch|
|000021e0| 67 72 70 74 74 79 28 64 | 69 72 66 6e 29 20 3d 3d |grptty(d|irfn) ==|
|000021f0| 20 2d 31 29 0a 58 09 20 | 70 65 72 72 6f 72 28 22 | -1).X. |perror("|
|00002200| 63 68 67 72 70 3a 20 63 | 61 6e 6e 6f 74 20 63 68 |chgrp: c|annot ch|
|00002210| 61 6e 67 65 20 67 72 6f | 75 70 22 29 3b 0a 58 20 |ange gro|up");.X |
|00002220| 20 20 20 20 69 66 20 28 | 64 6f 6e 74 73 6b 69 70 | if (|dontskip|
|00002230| 28 22 63 68 6d 6f 64 20 | 32 37 35 35 20 25 73 2f |("chmod |2755 %s/|
|00002240| 25 73 22 2c 70 74 79 62 | 69 6e 2c 66 6e 29 29 0a |%s",ptyb|in,fn)).|
|00002250| 58 20 20 20 20 20 20 20 | 69 66 20 28 63 68 6d 6f |X |if (chmo|
|00002260| 64 28 64 69 72 66 6e 2c | 30 32 37 35 35 29 20 3d |d(dirfn,|02755) =|
|00002270| 3d 20 2d 31 29 0a 58 09 | 20 70 65 72 72 6f 72 28 |= -1).X.| perror(|
|00002280| 22 63 68 6d 6f 64 3a 20 | 63 61 6e 6e 6f 74 20 63 |"chmod: |cannot c|
|00002290| 68 61 6e 67 65 20 6d 6f | 64 65 22 29 3b 0a 58 20 |hange mo|de");.X |
|000022a0| 20 20 20 20 62 72 65 61 | 6b 3b 0a 58 20 20 20 63 | brea|k;.X c|
|000022b0| 61 73 65 20 33 3a 0a 58 | 20 20 20 20 20 69 66 20 |ase 3:.X| if |
|000022c0| 28 64 6f 6e 74 73 6b 69 | 70 28 43 48 4f 50 54 59 |(dontski|p(CHOPTY|
|000022d0| 53 53 2c 70 74 79 62 69 | 6e 2c 66 6e 29 29 0a 58 |SS,ptybi|n,fn)).X|
|000022e0| 20 20 20 20 20 20 20 69 | 66 20 28 63 68 6f 77 6e | i|f (chown|
|000022f0| 70 74 79 28 64 69 72 66 | 6e 29 20 3d 3d 20 2d 31 |pty(dirf|n) == -1|
|00002300| 29 0a 58 09 20 70 65 72 | 72 6f 72 28 22 63 68 6f |).X. per|ror("cho|
|00002310| 77 6e 3a 20 63 61 6e 6e | 6f 74 20 63 68 61 6e 67 |wn: cann|ot chang|
|00002320| 65 20 6f 77 6e 65 72 22 | 29 3b 0a 58 20 20 20 20 |e owner"|);.X |
|00002330| 20 69 66 20 28 64 6f 6e | 74 73 6b 69 70 28 22 63 | if (don|tskip("c|
|00002340| 68 6d 6f 64 20 34 37 35 | 35 20 25 73 2f 25 73 22 |hmod 475|5 %s/%s"|
|00002350| 2c 70 74 79 62 69 6e 2c | 66 6e 29 29 0a 58 20 20 |,ptybin,|fn)).X |
|00002360| 20 20 20 20 20 69 66 20 | 28 63 68 6d 6f 64 28 64 | if |(chmod(d|
|00002370| 69 72 66 6e 2c 30 34 37 | 35 35 29 20 3d 3d 20 2d |irfn,047|55) == -|
|00002380| 31 29 0a 58 09 20 70 65 | 72 72 6f 72 28 22 63 68 |1).X. pe|rror("ch|
|00002390| 6d 6f 64 3a 20 63 61 6e | 6e 6f 74 20 63 68 61 6e |mod: can|not chan|
|000023a0| 67 65 20 6d 6f 64 65 22 | 29 3b 0a 58 20 20 20 20 |ge mode"|);.X |
|000023b0| 20 62 72 65 61 6b 3b 0a | 58 20 20 7d 0a 58 7d 0a | break;.|X }.X}.|
|000023c0| 58 0a 6d 61 69 6e 28 61 | 72 67 63 2c 61 72 67 76 |X.main(a|rgc,argv|
|000023d0| 29 0a 69 6e 74 20 61 72 | 67 63 3b 0a 63 68 61 72 |).int ar|gc;.char|
|000023e0| 20 2a 61 72 67 76 5b 5d | 3b 0a 58 7b 0a 58 20 69 | *argv[]|;.X{.X i|
|000023f0| 66 20 28 61 72 67 76 5b | 31 5d 29 0a 58 20 20 7b |f (argv[|1]).X {|
|00002400| 0a 58 20 20 20 70 74 79 | 75 6e 61 6d 65 20 3d 20 |.X pty|uname = |
|00002410| 61 72 67 76 5b 31 5d 3b | 0a 58 20 20 20 73 70 72 |argv[1];|.X spr|
|00002420| 69 6e 74 66 28 43 48 4f | 50 54 59 53 53 2c 22 63 |intf(CHO|PTYSS,"c|
|00002430| 68 6f 77 6e 20 25 73 20 | 25 25 73 2f 25 25 73 22 |hown %s |%%s/%%s"|
|00002440| 2c 70 74 79 75 6e 61 6d | 65 29 3b 0a 58 20 20 7d |,ptyunam|e);.X }|
|00002450| 0a 58 20 70 72 69 6e 74 | 66 28 22 49 20 61 73 73 |.X print|f("I ass|
|00002460| 75 6d 65 20 79 6f 75 27 | 76 65 20 61 6c 72 65 61 |ume you'|ve alrea|
|00002470| 64 79 20 73 65 74 20 75 | 70 20 61 20 25 73 20 75 |dy set u|p a %s u|
|00002480| 73 65 72 20 61 6e 64 20 | 61 20 74 74 79 20 28 25 |ser and |a tty (%|
|00002490| 64 29 20 67 72 6f 75 70 | 2e 5c 6e 5c 6e 22 2c 70 |d) group|.\n\n",p|
|000024a0| 74 79 75 6e 61 6d 65 2c | 50 54 59 47 52 4f 55 50 |tyuname,|PTYGROUP|
|000024b0| 29 3b 0a 58 20 70 72 69 | 6e 74 66 28 22 45 61 63 |);.X pri|ntf("Eac|
|000024c0| 68 20 61 63 74 69 6f 6e | 20 77 69 6c 6c 20 62 65 |h action| will be|
|000024d0| 20 70 72 69 6e 74 65 64 | 20 62 65 66 6f 72 65 20 | printed| before |
|000024e0| 69 74 20 69 73 20 72 75 | 6e 2e 20 50 72 65 73 73 |it is ru|n. Press|
|000024f0| 20 72 65 74 75 72 6e 20 | 74 6f 20 70 72 6f 63 65 | return |to proce|
|00002500| 65 64 2e 5c 6e 22 29 3b | 0a 58 20 70 72 69 6e 74 |ed.\n");|.X print|
|00002510| 66 28 22 54 79 70 65 20 | 73 6b 69 70 20 28 6f 72 |f("Type |skip (or|
|00002520| 20 61 6e 79 74 68 69 6e | 67 20 62 65 67 69 6e 6e | anythin|g beginn|
|00002530| 69 6e 67 20 77 69 74 68 | 20 61 6e 20 73 29 20 74 |ing with| an s) t|
|00002540| 6f 20 73 6b 69 70 20 61 | 20 73 74 65 70 2e 5c 6e |o skip a| step.\n|
|00002550| 22 29 3b 0a 58 0a 58 20 | 73 65 63 74 69 6f 6e 28 |");.X.X |section(|
|00002560| 22 4d 61 6b 65 20 70 74 | 79 20 73 65 73 73 69 6f |"Make pt|y sessio|
|00002570| 6e 20 64 69 72 65 63 74 | 6f 72 79 22 29 3b 0a 58 |n direct|ory");.X|
|00002580| 20 69 66 20 28 64 6f 6e | 74 73 6b 69 70 28 22 6d | if (don|tskip("m|
|00002590| 6b 64 69 72 20 25 73 22 | 2c 70 74 79 64 69 72 2c |kdir %s"|,ptydir,|
|000025a0| 22 22 29 29 0a 58 20 20 | 20 69 66 20 28 6d 6b 64 |"")).X | if (mkd|
|000025b0| 69 72 28 70 74 79 64 69 | 72 2c 30 37 30 30 29 20 |ir(ptydi|r,0700) |
|000025c0| 3d 3d 20 2d 31 29 0a 58 | 20 20 20 20 20 70 65 72 |== -1).X| per|
|000025d0| 72 6f 72 28 22 6d 6b 64 | 69 72 3a 20 63 61 6e 6e |ror("mkd|ir: cann|
|000025e0| 6f 74 20 63 72 65 61 74 | 65 20 64 69 72 65 63 74 |ot creat|e direct|
|000025f0| 6f 72 79 22 29 3b 0a 58 | 20 69 66 20 28 64 6f 6e |ory");.X| if (don|
|00002600| 74 73 6b 69 70 28 22 63 | 68 6f 77 6e 20 25 73 20 |tskip("c|hown %s |
|00002610| 25 73 22 2c 70 74 79 75 | 6e 61 6d 65 2c 70 74 79 |%s",ptyu|name,pty|
|00002620| 64 69 72 29 29 0a 58 20 | 20 20 69 66 20 28 63 68 |dir)).X | if (ch|
|00002630| 6f 77 6e 70 74 79 28 70 | 74 79 64 69 72 29 20 3d |ownpty(p|tydir) =|
|00002640| 3d 20 2d 31 29 0a 58 20 | 20 20 20 20 70 65 72 72 |= -1).X | perr|
|00002650| 6f 72 28 22 63 68 6f 77 | 6e 3a 20 63 61 6e 6e 6f |or("chow|n: canno|
|00002660| 74 20 63 68 61 6e 67 65 | 20 6f 77 6e 65 72 22 29 |t change| owner")|
|00002670| 3b 0a 58 0a 58 20 73 65 | 63 74 69 6f 6e 28 22 4d |;.X.X se|ction("M|
|00002680| 61 6b 65 20 70 74 79 20 | 62 69 6e 61 72 79 20 64 |ake pty |binary d|
|00002690| 69 72 65 63 74 6f 72 79 | 22 29 3b 0a 58 20 69 66 |irectory|");.X if|
|000026a0| 20 28 64 6f 6e 74 73 6b | 69 70 28 22 6d 6b 64 69 | (dontsk|ip("mkdi|
|000026b0| 72 20 25 73 22 2c 70 74 | 79 62 69 6e 2c 22 22 29 |r %s",pt|ybin,"")|
|000026c0| 29 0a 58 20 20 20 69 66 | 20 28 6d 6b 64 69 72 28 |).X if| (mkdir(|
|000026d0| 70 74 79 62 69 6e 2c 30 | 37 30 30 29 20 3d 3d 20 |ptybin,0|700) == |
|000026e0| 2d 31 29 0a 58 20 20 20 | 20 20 70 65 72 72 6f 72 |-1).X | perror|
|000026f0| 28 22 6d 6b 64 69 72 3a | 20 63 61 6e 6e 6f 74 20 |("mkdir:| cannot |
|00002700| 63 72 65 61 74 65 20 64 | 69 72 65 63 74 6f 72 79 |create d|irectory|
|00002710| 22 29 3b 0a 58 20 69 66 | 20 28 64 6f 6e 74 73 6b |");.X if| (dontsk|
|00002720| 69 70 28 22 63 68 6d 6f | 64 20 37 35 35 20 25 73 |ip("chmo|d 755 %s|
|00002730| 22 2c 70 74 79 62 69 6e | 2c 22 22 29 29 0a 58 20 |",ptybin|,"")).X |
|00002740| 20 20 69 66 20 28 63 68 | 6d 6f 64 28 70 74 79 62 | if (ch|mod(ptyb|
|00002750| 69 6e 2c 30 37 35 35 29 | 20 3d 3d 20 2d 31 29 0a |in,0755)| == -1).|
|00002760| 58 20 20 20 20 20 70 65 | 72 72 6f 72 28 22 63 68 |X pe|rror("ch|
|00002770| 6d 6f 64 3a 20 63 61 6e | 6e 6f 74 20 63 68 61 6e |mod: can|not chan|
|00002780| 67 65 20 6d 6f 64 65 22 | 29 3b 0a 58 0a 58 20 73 |ge mode"|);.X.X s|
|00002790| 65 63 74 69 6f 6e 28 22 | 4d 61 6b 65 20 73 65 73 |ection("|Make ses|
|000027a0| 73 69 6f 6e 20 61 6e 64 | 20 73 65 73 73 69 6f 6e |sion and| session|
|000027b0| 2d 63 6f 6e 6e 65 63 74 | 69 6f 6e 20 6c 6f 67 20 |-connect|ion log |
|000027c0| 66 69 6c 65 73 22 29 3b | 0a 58 20 69 66 20 28 64 |files");|.X if (d|
|000027d0| 6f 6e 74 73 6b 69 70 28 | 22 74 6f 75 63 68 20 25 |ontskip(|"touch %|
|000027e0| 73 22 2c 73 65 73 73 6e | 6f 77 2c 22 22 29 29 0a |s",sessn|ow,"")).|
|000027f0| 58 20 20 20 69 66 20 28 | 74 6f 75 63 68 28 73 65 |X if (|touch(se|
|00002800| 73 73 6e 6f 77 29 20 3d | 3d 20 2d 31 29 0a 58 20 |ssnow) =|= -1).X |
|00002810| 20 20 20 20 70 65 72 72 | 6f 72 28 22 74 6f 75 63 | perr|or("touc|
|00002820| 68 3a 20 63 61 6e 6e 6f | 74 20 74 6f 75 63 68 20 |h: canno|t touch |
|00002830| 66 69 6c 65 22 29 3b 0a | 58 20 69 66 20 28 64 6f |file");.|X if (do|
|00002840| 6e 74 73 6b 69 70 28 22 | 74 6f 75 63 68 20 25 73 |ntskip("|touch %s|
|00002850| 22 2c 73 65 73 73 6c 6f | 67 2c 22 22 29 29 0a 58 |",sesslo|g,"")).X|
|00002860| 20 20 20 69 66 20 28 74 | 6f 75 63 68 28 73 65 73 | if (t|ouch(ses|
|00002870| 73 6c 6f 67 29 20 3d 3d | 20 2d 31 29 0a 58 20 20 |slog) ==| -1).X |
|00002880| 20 20 20 70 65 72 72 6f | 72 28 22 74 6f 75 63 68 | perro|r("touch|
|00002890| 3a 20 63 61 6e 6e 6f 74 | 20 74 6f 75 63 68 20 66 |: cannot| touch f|
|000028a0| 69 6c 65 22 29 3b 0a 58 | 20 69 66 20 28 64 6f 6e |ile");.X| if (don|
|000028b0| 74 73 6b 69 70 28 22 74 | 6f 75 63 68 20 25 73 22 |tskip("t|ouch %s"|
|000028c0| 2c 73 65 73 73 63 6f 6e | 6e 6e 6f 77 2c 22 22 29 |,sesscon|nnow,"")|
|000028d0| 29 0a 58 20 20 20 69 66 | 20 28 74 6f 75 63 68 28 |).X if| (touch(|
|000028e0| 73 65 73 73 63 6f 6e 6e | 6e 6f 77 29 20 3d 3d 20 |sessconn|now) == |
|000028f0| 2d 31 29 0a 58 20 20 20 | 20 20 70 65 72 72 6f 72 |-1).X | perror|
|00002900| 28 22 74 6f 75 63 68 3a | 20 63 61 6e 6e 6f 74 20 |("touch:| cannot |
|00002910| 74 6f 75 63 68 20 66 69 | 6c 65 22 29 3b 0a 58 20 |touch fi|le");.X |
|00002920| 69 66 20 28 64 6f 6e 74 | 73 6b 69 70 28 22 74 6f |if (dont|skip("to|
|00002930| 75 63 68 20 25 73 22 2c | 73 65 73 73 63 6f 6e 6e |uch %s",|sessconn|
|00002940| 6c 6f 67 2c 22 22 29 29 | 0a 58 20 20 20 69 66 20 |log,""))|.X if |
|00002950| 28 74 6f 75 63 68 28 73 | 65 73 73 63 6f 6e 6e 6c |(touch(s|essconnl|
|00002960| 6f 67 29 20 3d 3d 20 2d | 31 29 0a 58 20 20 20 20 |og) == -|1).X |
|00002970| 20 70 65 72 72 6f 72 28 | 22 74 6f 75 63 68 3a 20 | perror(|"touch: |
|00002980| 63 61 6e 6e 6f 74 20 74 | 6f 75 63 68 20 66 69 6c |cannot t|ouch fil|
|00002990| 65 22 29 3b 0a 58 20 0a | 58 20 73 65 63 74 69 6f |e");.X .|X sectio|
|000029a0| 6e 28 22 4d 61 6b 65 20 | 75 74 6d 70 20 61 6e 64 |n("Make |utmp and|
|000029b0| 20 77 74 6d 70 20 66 69 | 6c 65 73 20 28 6e 6f 74 | wtmp fi|les (not|
|000029c0| 65 3a 20 75 74 6d 70 20 | 77 69 6c 6c 20 62 65 20 |e: utmp |will be |
|000029d0| 6f 77 6e 65 64 20 62 79 | 20 70 74 79 29 22 29 3b |owned by| pty)");|
|000029e0| 0a 58 20 69 66 20 28 64 | 6f 6e 74 73 6b 69 70 28 |.X if (d|ontskip(|
|000029f0| 22 74 6f 75 63 68 20 25 | 73 22 2c 75 74 6d 70 2c |"touch %|s",utmp,|
|00002a00| 22 22 29 29 0a 58 20 20 | 20 69 66 20 28 74 6f 75 |"")).X | if (tou|
|00002a10| 63 68 28 75 74 6d 70 29 | 20 3d 3d 20 2d 31 29 0a |ch(utmp)| == -1).|
|00002a20| 58 20 20 20 20 20 70 65 | 72 72 6f 72 28 22 74 6f |X pe|rror("to|
|00002a30| 75 63 68 3a 20 63 61 6e | 6e 6f 74 20 74 6f 75 63 |uch: can|not touc|
|00002a40| 68 20 66 69 6c 65 22 29 | 3b 0a 58 20 69 66 20 28 |h file")|;.X if (|
|00002a50| 64 6f 6e 74 73 6b 69 70 | 28 22 74 6f 75 63 68 20 |dontskip|("touch |
|00002a60| 25 73 22 2c 77 74 6d 70 | 2c 22 22 29 29 0a 58 20 |%s",wtmp|,"")).X |
|00002a70| 20 20 69 66 20 28 74 6f | 75 63 68 28 77 74 6d 70 | if (to|uch(wtmp|
|00002a80| 29 20 3d 3d 20 2d 31 29 | 0a 58 20 20 20 20 20 70 |) == -1)|.X p|
|00002a90| 65 72 72 6f 72 28 22 74 | 6f 75 63 68 3a 20 63 61 |error("t|ouch: ca|
|00002aa0| 6e 6e 6f 74 20 74 6f 75 | 63 68 20 66 69 6c 65 22 |nnot tou|ch file"|
|00002ab0| 29 3b 0a 58 0a 58 20 73 | 65 63 74 69 6f 6e 28 22 |);.X.X s|ection("|
|00002ac0| 43 6f 70 79 20 65 78 65 | 63 75 74 61 62 6c 65 73 |Copy exe|cutables|
|00002ad0| 20 69 6e 74 6f 20 70 74 | 79 20 62 69 6e 61 72 79 | into pt|y binary|
|00002ae0| 20 64 69 72 65 63 74 6f | 72 79 22 29 3b 0a 58 20 | directo|ry");.X |
|00002af0| 64 6f 62 69 6e 28 22 61 | 72 67 76 30 22 2c 31 29 |dobin("a|rgv0",1)|
|00002b00| 3b 0a 58 20 64 6f 62 69 | 6e 28 22 62 69 66 66 22 |;.X dobi|n("biff"|
|00002b10| 2c 31 29 3b 0a 58 20 64 | 6f 62 69 6e 28 22 63 68 |,1);.X d|obin("ch|
|00002b20| 65 63 6b 70 74 79 73 22 | 2c 31 29 3b 0a 58 20 64 |eckptys"|,1);.X d|
|00002b30| 6f 62 69 6e 28 22 63 6f | 6e 64 6f 6d 22 2c 30 29 |obin("co|ndom",0)|
|00002b40| 3b 0a 58 20 64 6f 62 69 | 6e 28 22 63 74 72 6c 76 |;.X dobi|n("ctrlv|
|00002b50| 22 2c 31 29 3b 0a 58 20 | 64 6f 62 69 6e 28 22 64 |",1);.X |dobin("d|
|00002b60| 69 73 63 6f 6e 6e 65 63 | 74 22 2c 33 29 3b 0a 58 |isconnec|t",3);.X|
|00002b70| 20 64 6f 62 69 6e 28 22 | 65 78 63 6c 6f 66 66 22 | dobin("|excloff"|
|00002b80| 2c 31 29 3b 0a 58 20 64 | 6f 62 69 6e 28 22 65 78 |,1);.X d|obin("ex|
|00002b90| 63 6c 6f 6e 22 2c 31 29 | 3b 0a 58 20 64 6f 62 69 |clon",1)|;.X dobi|
|00002ba0| 6e 28 22 6c 6f 63 6b 22 | 2c 31 29 3b 0a 58 20 64 |n("lock"|,1);.X d|
|00002bb0| 6f 62 69 6e 28 22 6d 65 | 73 67 22 2c 31 29 3b 0a |obin("me|sg",1);.|
|00002bc0| 58 20 64 6f 62 69 6e 28 | 22 6e 6f 62 75 66 22 2c |X dobin(|"nobuf",|
|00002bd0| 30 29 3b 0a 58 20 64 6f | 62 69 6e 28 22 70 74 79 |0);.X do|bin("pty|
|00002be0| 22 2c 33 29 3b 0a 58 20 | 64 6f 62 69 6e 28 22 72 |",3);.X |dobin("r|
|00002bf0| 65 63 6f 6e 6e 65 63 74 | 22 2c 33 29 3b 0a 58 20 |econnect|",3);.X |
|00002c00| 64 6f 62 69 6e 28 22 73 | 63 72 69 70 74 22 2c 30 |dobin("s|cript",0|
|00002c10| 29 3b 0a 58 20 64 6f 62 | 69 6e 28 22 73 63 72 69 |);.X dob|in("scri|
|00002c20| 70 74 2e 74 69 64 79 22 | 2c 30 29 3b 0a 58 20 64 |pt.tidy"|,0);.X d|
|00002c30| 6f 62 69 6e 28 22 73 65 | 73 73 22 2c 30 29 3b 0a |obin("se|ss",0);.|
|00002c40| 58 20 64 6f 62 69 6e 28 | 22 73 65 73 73 6b 69 6c |X dobin(|"sesskil|
|00002c50| 6c 22 2c 33 29 3b 0a 58 | 20 64 6f 62 69 6e 28 22 |l",3);.X| dobin("|
|00002c60| 73 65 73 73 6c 69 73 74 | 22 2c 33 29 3b 0a 58 20 |sesslist|",3);.X |
|00002c70| 64 6f 62 69 6e 28 22 73 | 65 73 73 6d 65 6e 75 22 |dobin("s|essmenu"|
|00002c80| 2c 31 29 3b 0a 58 20 64 | 6f 62 69 6e 28 22 73 65 |,1);.X d|obin("se|
|00002c90| 73 73 6e 61 6d 65 22 2c | 33 29 3b 0a 58 20 64 6f |ssname",|3);.X do|
|00002ca0| 62 69 6e 28 22 73 65 73 | 73 77 68 65 72 65 22 2c |bin("ses|swhere",|
|00002cb0| 31 29 3b 0a 58 20 64 6f | 62 69 6e 28 22 73 65 73 |1);.X do|bin("ses|
|00002cc0| 73 77 68 6f 22 2c 31 29 | 3b 0a 58 20 64 6f 62 69 |swho",1)|;.X dobi|
|00002cd0| 6e 28 22 74 69 6f 63 73 | 74 69 22 2c 31 29 3b 0a |n("tiocs|ti",1);.|
|00002ce0| 58 20 64 6f 62 69 6e 28 | 22 74 70 6c 61 79 22 2c |X dobin(|"tplay",|
|00002cf0| 31 29 3b 0a 58 20 64 6f | 62 69 6e 28 22 74 72 65 |1);.X do|bin("tre|
|00002d00| 63 6f 72 64 22 2c 31 29 | 3b 0a 58 20 64 6f 62 69 |cord",1)|;.X dobi|
|00002d10| 6e 28 22 74 73 63 72 69 | 70 74 22 2c 30 29 3b 0a |n("tscri|pt",0);.|
|00002d20| 58 20 64 6f 62 69 6e 28 | 22 74 74 79 22 2c 31 29 |X dobin(|"tty",1)|
|00002d30| 3b 0a 58 20 64 6f 62 69 | 6e 28 22 74 74 79 64 65 |;.X dobi|n("ttyde|
|00002d40| 74 61 63 68 22 2c 31 29 | 3b 0a 58 20 64 6f 62 69 |tach",1)|;.X dobi|
|00002d50| 6e 28 22 74 74 79 70 72 | 6f 74 65 63 74 22 2c 30 |n("ttypr|otect",0|
|00002d60| 29 3b 0a 58 20 64 6f 62 | 69 6e 28 22 75 73 65 72 |);.X dob|in("user|
|00002d70| 73 22 2c 31 29 3b 0a 58 | 20 64 6f 62 69 6e 28 22 |s",1);.X| dobin("|
|00002d80| 75 74 6d 70 69 6e 69 74 | 22 2c 31 29 3b 0a 58 20 |utmpinit|",1);.X |
|00002d90| 64 6f 62 69 6e 28 22 77 | 61 69 74 66 6f 72 22 2c |dobin("w|aitfor",|
|00002da0| 31 29 3b 0a 58 20 64 6f | 62 69 6e 28 22 77 61 6c |1);.X do|bin("wal|
|00002db0| 6c 22 2c 32 29 3b 0a 58 | 20 64 6f 62 69 6e 28 22 |l",2);.X| dobin("|
|00002dc0| 77 68 6f 22 2c 31 29 3b | 0a 58 20 64 6f 62 69 6e |who",1);|.X dobin|
|00002dd0| 28 22 77 68 6f 61 6d 69 | 22 2c 31 29 3b 0a 58 20 |("whoami|",1);.X |
|00002de0| 64 6f 62 69 6e 28 22 77 | 72 69 74 65 22 2c 32 29 |dobin("w|rite",2)|
|00002df0| 3b 0a 58 20 64 6f 62 69 | 6e 28 22 77 74 6d 70 72 |;.X dobi|n("wtmpr|
|00002e00| 6f 74 61 74 65 22 2c 30 | 29 3b 0a 58 20 64 6f 62 |otate",0|);.X dob|
|00002e10| 69 6e 28 22 73 65 73 73 | 72 6f 74 61 74 65 22 2c |in("sess|rotate",|
|00002e20| 30 29 3b 0a 58 20 64 6f | 62 69 6e 28 22 73 63 6c |0);.X do|bin("scl|
|00002e30| 6f 67 72 6f 74 61 74 65 | 22 2c 30 29 3b 0a 58 20 |ogrotate|",0);.X |
|00002e40| 64 6f 62 69 6e 28 22 73 | 65 73 73 6e 6f 77 69 6e |dobin("s|essnowin|
|00002e50| 69 74 22 2c 30 29 3b 0a | 58 20 64 6f 62 69 6e 28 |it",0);.|X dobin(|
|00002e60| 22 73 63 6e 6f 77 69 6e | 69 74 22 2c 30 29 3b 0a |"scnowin|it",0);.|
|00002e70| 58 0a 58 20 73 65 63 74 | 69 6f 6e 28 22 41 64 64 |X.X sect|ion("Add|
|00002e80| 20 6c 6f 67 20 66 69 6c | 65 20 72 6f 74 61 74 69 | log fil|e rotati|
|00002e90| 6f 6e 73 20 74 6f 20 64 | 61 69 6c 79 2c 20 77 65 |ons to d|aily, we|
|00002ea0| 65 6b 6c 79 2c 20 6f 72 | 20 6d 6f 6e 74 68 6c 79 |ekly, or| monthly|
|00002eb0| 20 63 72 6f 6e 20 73 63 | 72 69 70 74 73 22 29 3b | cron sc|ripts");|
|00002ec0| 0a 58 20 70 72 69 6e 74 | 66 28 22 49 27 6c 6c 20 |.X print|f("I'll |
|00002ed0| 6c 65 61 76 65 20 74 68 | 69 73 20 74 6f 20 79 6f |leave th|is to yo|
|00002ee0| 75 2e 5c 6e 22 29 3b 0a | 58 20 70 72 69 6e 74 66 |u.\n");.|X printf|
|00002ef0| 28 22 59 6f 75 20 6d 61 | 79 20 77 61 6e 74 20 74 |("You ma|y want t|
|00002f00| 6f 20 69 6e 76 6f 6b 65 | 20 77 74 6d 70 72 6f 74 |o invoke| wtmprot|
|00002f10| 61 74 65 2c 20 73 65 73 | 73 72 6f 74 61 74 65 2c |ate, ses|srotate,|
|00002f20| 20 6f 72 20 73 63 6c 6f | 67 72 6f 74 61 74 65 2e | or sclo|grotate.|
|00002f30| 5c 6e 22 29 3b 0a 58 0a | 58 20 73 65 63 74 69 6f |\n");.X.|X sectio|
|00002f40| 6e 28 22 41 64 64 20 75 | 74 6d 70 2f 73 65 73 73 |n("Add u|tmp/sess|
|00002f50| 6e 6f 77 2f 73 63 6e 6f | 77 20 69 6e 69 74 69 61 |now/scno|w initia|
|00002f60| 6c 69 7a 61 74 69 6f 6e | 73 20 74 6f 20 2f 65 74 |lization|s to /et|
|00002f70| 63 2f 72 63 2e 6c 6f 63 | 61 6c 22 29 3b 0a 58 20 |c/rc.loc|al");.X |
|00002f80| 70 72 69 6e 74 66 28 22 | 49 27 6c 6c 20 6c 65 61 |printf("|I'll lea|
|00002f90| 76 65 20 74 68 69 73 20 | 74 6f 20 79 6f 75 2e 5c |ve this |to you.\|
|00002fa0| 6e 22 29 3b 0a 58 20 70 | 72 69 6e 74 66 28 22 59 |n");.X p|rintf("Y|
|00002fb0| 6f 75 20 6d 61 79 20 77 | 61 6e 74 20 74 6f 20 69 |ou may w|ant to i|
|00002fc0| 6e 76 6f 6b 65 20 75 74 | 6d 70 69 6e 69 74 2c 20 |nvoke ut|mpinit, |
|00002fd0| 73 65 73 73 6e 6f 77 69 | 6e 69 74 2c 20 6f 72 20 |sessnowi|nit, or |
|00002fe0| 73 63 6e 6f 77 69 6e 69 | 74 2e 5c 6e 22 29 3b 0a |scnowini|t.\n");.|
|00002ff0| 58 0a 58 20 65 78 69 74 | 28 30 29 3b 0a 58 7d 0a |X.X exit|(0);.X}.|
|00003000| 45 4e 44 5f 4f 46 5f 46 | 49 4c 45 0a 69 66 20 74 |END_OF_F|ILE.if t|
|00003010| 65 73 74 20 36 32 33 31 | 20 2d 6e 65 20 60 77 63 |est 6231| -ne `wc|
|00003020| 20 2d 63 20 3c 27 49 4e | 53 54 41 4c 4c 2e 63 27 | -c <'IN|STALL.c'|
|00003030| 60 3b 20 74 68 65 6e 0a | 20 20 20 20 65 63 68 6f |`; then.| echo|
|00003040| 20 73 68 61 72 3a 20 5c | 22 27 49 4e 53 54 41 4c | shar: \|"'INSTAL|
|00003050| 4c 2e 63 27 5c 22 20 75 | 6e 70 61 63 6b 65 64 20 |L.c'\" u|npacked |
|00003060| 77 69 74 68 20 77 72 6f | 6e 67 20 73 69 7a 65 21 |with wro|ng size!|
|00003070| 0a 66 69 0a 23 20 65 6e | 64 20 6f 66 20 27 49 4e |.fi.# en|d of 'IN|
|00003080| 53 54 41 4c 4c 2e 63 27 | 0a 66 69 0a 69 66 20 74 |STALL.c'|.fi.if t|
|00003090| 65 73 74 20 2d 66 20 27 | 4e 4f 54 45 53 27 20 2d |est -f '|NOTES' -|
|000030a0| 61 20 22 24 7b 31 7d 22 | 20 21 3d 20 22 2d 63 22 |a "${1}"| != "-c"|
|000030b0| 20 3b 20 74 68 65 6e 20 | 0a 20 20 65 63 68 6f 20 | ; then |. echo |
|000030c0| 73 68 61 72 3a 20 57 69 | 6c 6c 20 6e 6f 74 20 63 |shar: Wi|ll not c|
|000030d0| 6c 6f 62 62 65 72 20 65 | 78 69 73 74 69 6e 67 20 |lobber e|xisting |
|000030e0| 66 69 6c 65 20 5c 22 27 | 4e 4f 54 45 53 27 5c 22 |file \"'|NOTES'\"|
|000030f0| 0a 65 6c 73 65 0a 65 63 | 68 6f 20 73 68 61 72 3a |.else.ec|ho shar:|
|00003100| 20 45 78 74 72 61 63 74 | 69 6e 67 20 5c 22 27 4e | Extract|ing \"'N|
|00003110| 4f 54 45 53 27 5c 22 20 | 5c 28 35 35 30 38 20 63 |OTES'\" |\(5508 c|
|00003120| 68 61 72 61 63 74 65 72 | 73 5c 29 0a 73 65 64 20 |haracter|s\).sed |
|00003130| 22 73 2f 5e 58 2f 2f 22 | 20 3e 27 4e 4f 54 45 53 |"s/^X//"| >'NOTES|
|00003140| 27 20 3c 3c 27 45 4e 44 | 5f 4f 46 5f 46 49 4c 45 |' <<'END|_OF_FILE|
|00003150| 27 0a 52 61 6e 64 6f 6d | 20 69 6d 70 6c 65 6d 65 |'.Random| impleme|
|00003160| 6e 74 61 74 69 6f 6e 20 | 6e 6f 74 65 73 3a 0a 58 |ntation |notes:.X|
|00003170| 0a 4d 61 73 74 65 72 20 | 6e 6f 77 20 72 75 6e 73 |.Master |now runs|
|00003180| 20 77 69 74 68 20 75 69 | 64 20 73 65 74 20 74 6f | with ui|d set to|
|00003190| 20 65 75 69 64 2e 20 54 | 68 69 73 20 65 6e 73 75 | euid. T|his ensu|
|000031a0| 72 65 73 20 74 68 65 20 | 69 6e 74 65 67 72 69 74 |res the |integrit|
|000031b0| 79 20 6f 66 0a 76 61 72 | 69 6f 75 73 20 6c 6f 67 |y of.var|ious log|
|000031c0| 20 66 69 6c 65 73 20 61 | 74 20 74 68 65 20 65 78 | files a|t the ex|
|000031d0| 70 65 6e 73 65 20 6f 66 | 20 70 72 6f 70 65 72 20 |pense of| proper |
|000031e0| 43 50 55 20 74 69 6d 65 | 20 61 63 63 6f 75 6e 74 |CPU time| account|
|000031f0| 69 6e 67 2e 20 4f 6e 20 | 74 68 65 0a 6f 74 68 65 |ing. On |the.othe|
|00003200| 72 20 68 61 6e 64 2c 20 | 74 65 6c 6e 65 74 64 20 |r hand, |telnetd |
|00003210| 61 6e 64 20 72 6c 6f 67 | 69 6e 64 20 72 75 6e 20 |and rlog|ind run |
|00003220| 61 73 20 72 6f 6f 74 2c | 20 73 6f 20 77 68 6f 20 |as root,| so who |
|00003230| 63 61 72 65 73 3f 0a 58 | 0a 54 68 65 20 72 6f 74 |cares?.X|.The rot|
|00003240| 61 74 65 20 73 63 72 69 | 70 74 73 20 6b 6c 75 64 |ate scri|pts klud|
|00003250| 67 65 20 61 20 62 69 74 | 20 74 6f 20 70 72 65 73 |ge a bit| to pres|
|00003260| 65 72 76 65 20 74 68 65 | 20 6f 77 6e 65 72 20 6f |erve the| owner o|
|00003270| 66 20 65 61 63 68 20 6c | 6f 67 20 66 69 6c 65 2e |f each l|og file.|
|00003280| 0a 41 6e 79 20 62 65 74 | 74 65 72 20 73 6f 6c 75 |.Any bet|ter solu|
|00003290| 74 69 6f 6e 73 3f 0a 58 | 0a 4d 61 6b 65 66 69 6c |tions?.X|.Makefil|
|000032a0| 65 20 75 73 65 73 20 63 | 63 20 2d 45 20 61 6e 64 |e uses c|c -E and|
|000032b0| 20 6d 61 6b 65 73 20 73 | 65 76 65 72 61 6c 20 61 | makes s|everal a|
|000032c0| 73 73 75 6d 70 74 69 6f | 6e 73 20 61 62 6f 75 74 |ssumptio|ns about|
|000032d0| 20 63 70 70 20 66 6f 72 | 20 63 72 65 61 74 69 6e | cpp for| creatin|
|000032e0| 67 0a 77 74 6d 70 72 6f | 74 61 74 65 20 61 6e 64 |g.wtmpro|tate and|
|000032f0| 20 66 72 69 65 6e 64 73 | 2e 0a 58 0a 43 65 72 74 | friends|..X.Cert|
|00003300| 61 69 6e 20 43 20 70 72 | 6f 67 72 61 6d 73 20 68 |ain C pr|ograms h|
|00003310| 61 64 20 63 6f 6e 74 72 | 6f 6c 20 63 68 61 72 61 |ad contr|ol chara|
|00003320| 74 65 72 73 2c 20 62 75 | 74 20 74 68 65 79 27 72 |ters, bu|t they'r|
|00003330| 65 20 67 6f 6e 65 2e 20 | 73 63 72 69 70 74 2e 74 |e gone. |script.t|
|00003340| 69 64 79 0a 68 61 73 20 | 63 6f 6e 74 72 6f 6c 20 |idy.has |control |
|00003350| 63 68 61 72 61 63 74 65 | 72 73 2c 20 62 75 74 20 |characte|rs, but |
|00003360| 73 63 72 69 70 74 2e 74 | 69 64 79 2e 73 68 20 64 |script.t|idy.sh d|
|00003370| 6f 65 73 6e 27 74 2d 2d | 2d 4d 61 6b 65 66 69 6c |oesn't--|-Makefil|
|00003380| 65 20 66 69 78 65 73 20 | 69 74 2e 0a 58 0a 4e 6f |e fixes |it..X.No|
|00003390| 74 65 20 74 68 61 74 20 | 74 68 65 20 61 73 73 75 |te that |the assu|
|000033a0| 6d 70 74 69 6f 6e 20 6f | 66 20 74 77 6f 2d 62 79 |mption o|f two-by|
|000033b0| 74 65 20 74 74 79 20 65 | 78 74 65 6e 73 69 6f 6e |te tty e|xtension|
|000033c0| 73 20 72 75 6e 73 20 74 | 68 72 6f 75 67 68 6f 75 |s runs t|hroughou|
|000033d0| 74 20 74 68 65 0a 63 6f | 64 65 2e 0a 58 0a 49 74 |t the.co|de..X.It|
|000033e0| 20 6d 69 67 68 74 20 62 | 65 20 67 6f 6f 64 20 74 | might b|e good t|
|000033f0| 6f 20 68 61 76 65 20 74 | 68 65 20 6d 61 73 74 65 |o have t|he maste|
|00003400| 72 20 72 65 66 75 73 65 | 20 69 6e 66 6f 20 72 65 |r refuse| info re|
|00003410| 71 75 65 73 74 73 20 77 | 68 69 6c 65 20 70 72 65 |quests w|hile pre|
|00003420| 63 6f 2e 0a 58 0a 49 66 | 20 74 68 65 20 73 69 67 |co..X.If| the sig|
|00003430| 6e 61 6c 6c 65 72 20 63 | 61 6e 27 74 20 63 68 61 |naller c|an't cha|
|00003440| 6e 67 65 20 74 6f 20 50 | 54 59 44 49 52 2c 20 6f |nge to P|TYDIR, o|
|00003450| 72 20 69 66 20 69 74 20 | 63 61 6e 27 74 20 72 65 |r if it |can't re|
|00003460| 61 64 20 74 68 65 0a 65 | 78 74 65 6e 73 69 6f 6e |ad the.e|xtension|
|00003470| 20 6f 76 65 72 20 61 20 | 70 69 70 65 20 66 72 6f | over a |pipe fro|
|00003480| 6d 20 74 68 65 20 6d 61 | 73 74 65 72 2c 20 6f 72 |m the ma|ster, or|
|00003490| 20 69 66 20 76 61 72 69 | 6f 75 73 20 6f 74 68 65 | if vari|ous othe|
|000034a0| 72 0a 70 73 65 75 64 6f | 2d 70 6f 73 73 69 62 6c |r.pseudo|-possibl|
|000034b0| 65 20 63 6f 6e 64 69 74 | 69 6f 6e 73 20 68 61 70 |e condit|ions hap|
|000034c0| 70 65 6e 2c 20 74 68 65 | 20 6d 61 73 74 65 72 20 |pen, the| master |
|000034d0| 6d 61 79 20 65 6e 64 20 | 75 70 20 64 69 73 63 6f |may end |up disco|
|000034e0| 6e 6e 65 63 74 65 64 0a | 65 76 65 6e 20 69 66 20 |nnected.|even if |
|000034f0| 69 74 27 73 20 6e 6f 74 | 20 61 20 73 65 73 73 69 |it's not| a sessi|
|00003500| 6f 6e 2e 20 54 68 65 20 | 63 68 69 6c 64 20 77 69 |on. The |child wi|
|00003510| 6c 6c 20 6e 6f 74 20 72 | 75 6e 20 75 6e 74 69 6c |ll not r|un until|
|00003520| 20 74 68 65 20 66 69 72 | 73 74 0a 73 75 63 63 65 | the fir|st.succe|
|00003530| 73 73 66 75 6c 20 72 65 | 63 6f 6e 6e 65 63 74 2e |ssful re|connect.|
|00003540| 0a 58 0a 4e 6f 74 65 20 | 74 68 61 74 20 74 68 65 |.X.Note |that the|
|00003550| 20 6d 61 73 74 65 72 20 | 73 77 69 74 63 68 65 73 | master |switches|
|00003560| 20 63 6f 6e 74 72 6f 6c | 6c 69 6e 67 20 74 74 79 | control|ling tty|
|00003570| 73 20 6f 6e 6c 79 20 61 | 73 20 61 20 73 65 72 76 |s only a|s a serv|
|00003580| 69 63 65 20 74 6f 20 74 | 68 65 0a 73 6c 61 76 65 |ice to t|he.slave|
|00003590| 2e 20 4e 6f 74 68 69 6e | 67 20 69 6e 20 74 68 65 |. Nothin|g in the|
|000035a0| 20 70 74 79 20 63 6f 64 | 65 20 64 65 70 65 6e 64 | pty cod|e depend|
|000035b0| 73 20 6f 6e 20 68 61 76 | 69 6e 67 20 74 68 65 20 |s on hav|ing the |
|000035c0| 6e 65 77 20 74 74 79 20 | 61 73 20 61 20 63 74 74 |new tty |as a ctt|
|000035d0| 79 2e 0a 54 68 69 73 20 | 69 73 20 61 20 67 6f 6f |y..This |is a goo|
|000035e0| 64 20 74 68 69 6e 67 2c | 20 61 73 20 42 53 44 20 |d thing,| as BSD |
|000035f0| 64 6f 65 73 20 6e 6f 74 | 20 70 72 6f 76 69 64 65 |does not| provide|
|00003600| 20 61 6e 79 20 72 65 6c | 69 61 62 6c 65 20 77 61 | any rel|iable wa|
|00003610| 79 20 74 6f 0a 64 69 73 | 73 6f 63 69 61 74 65 20 |y to.dis|sociate |
|00003620| 66 72 6f 6d 20 74 68 65 | 20 63 75 72 72 65 6e 74 |from the| current|
|00003630| 20 63 6f 6e 74 72 6f 6c | 6c 69 6e 67 20 74 65 72 | control|ling ter|
|00003640| 6d 69 6e 61 6c 2e 20 28 | 45 78 65 72 63 69 73 65 |minal. (|Exercise|
|00003650| 3a 20 53 68 6f 77 20 68 | 6f 77 0a 54 49 4f 43 45 |: Show h|ow.TIOCE|
|00003660| 58 43 4c 20 6d 61 79 20 | 62 65 20 75 73 65 64 20 |XCL may |be used |
|00003670| 74 6f 20 70 72 65 76 65 | 6e 74 20 64 69 73 73 6f |to preve|nt disso|
|00003680| 63 69 61 74 69 6f 6e 2e | 29 0a 58 0a 4e 6f 74 65 |ciation.|).X.Note|
|00003690| 20 74 68 61 74 20 2d 52 | 20 66 6f 72 63 65 73 20 | that -R| forces |
|000036a0| 2d 54 2d 2d 2d 61 20 6c | 6f 74 20 6f 66 20 74 68 |-T---a l|ot of th|
|000036b0| 69 6e 67 73 20 63 6f 75 | 6c 64 20 67 6f 20 77 72 |ings cou|ld go wr|
|000036c0| 6f 6e 67 20 6f 74 68 65 | 72 77 69 73 65 2e 0a 58 |ong othe|rwise..X|
|000036d0| 0a 4e 6f 74 65 20 74 68 | 61 74 20 74 68 65 20 73 |.Note th|at the s|
|000036e0| 6c 61 76 65 20 75 6e 62 | 6c 6f 63 6b 73 20 76 61 |lave unb|locks va|
|000036f0| 72 69 6f 75 73 20 73 69 | 67 6e 61 6c 73 20 61 6e |rious si|gnals an|
|00003700| 64 20 73 65 74 73 20 76 | 61 72 69 6f 75 73 20 6f |d sets v|arious o|
|00003710| 74 68 65 72 73 20 74 6f | 0a 53 49 47 5f 44 46 4c |thers to|.SIG_DFL|
|00003720| 3b 20 74 68 69 73 20 77 | 69 6c 6c 20 75 6e 64 6f |; this w|ill undo|
|00003730| 20 61 6e 79 20 62 6c 6f | 63 6b 69 6e 67 20 73 65 | any blo|cking se|
|00003740| 74 20 75 70 20 62 65 66 | 6f 72 65 20 70 74 79 20 |t up bef|ore pty |
|00003750| 77 61 73 20 69 6e 76 6f | 6b 65 64 2e 0a 58 0a 55 |was invo|ked..X.U|
|00003760| 6e 64 65 72 20 2d 52 2c | 20 74 68 65 20 6d 61 73 |nder -R,| the mas|
|00003770| 74 65 72 20 77 69 6c 6c | 20 69 67 6e 6f 72 65 20 |ter will| ignore |
|00003780| 74 68 65 20 74 6f 73 74 | 6f 70 20 73 65 74 74 69 |the tost|op setti|
|00003790| 6e 67 20 6f 6e 20 74 68 | 65 20 6f 72 69 67 69 6e |ng on th|e origin|
|000037a0| 61 6c 20 74 74 79 2e 0a | 54 68 65 72 65 27 73 20 |al tty..|There's |
|000037b0| 6e 6f 20 67 6f 6f 64 20 | 77 61 79 20 74 6f 20 73 |no good |way to s|
|000037c0| 6f 6c 76 65 20 74 68 69 | 73 2d 2d 2d 69 66 20 79 |olve thi|s---if y|
|000037d0| 6f 75 20 63 6f 6e 73 69 | 64 65 72 20 69 74 20 61 |ou consi|der it a|
|000037e0| 20 70 72 6f 62 6c 65 6d | 2e 0a 58 0a 54 68 65 72 | problem|..X.Ther|
|000037f0| 65 27 64 20 62 65 20 61 | 20 72 61 63 65 20 62 65 |e'd be a| race be|
|00003800| 74 77 65 65 6e 20 66 64 | 73 69 67 6c 65 72 20 61 |tween fd|sigler a|
|00003810| 6e 64 20 66 64 73 69 67 | 32 75 73 20 69 66 20 62 |nd fdsig|2us if b|
|00003820| 6f 74 68 20 6d 61 73 74 | 65 72 20 61 6e 64 0a 73 |oth mast|er and.s|
|00003830| 69 67 6c 65 72 20 77 72 | 6f 74 65 20 61 6e 64 20 |igler wr|ote and |
|00003840| 62 6c 6f 63 6b 65 64 20 | 61 74 20 6f 6e 63 65 2e |blocked |at once.|
|00003850| 20 54 68 65 20 73 6f 6c | 75 74 69 6f 6e 20 69 73 | The sol|ution is|
|00003860| 20 73 69 6d 70 6c 65 3a | 20 66 64 73 69 67 32 75 | simple:| fdsig2u|
|00003870| 73 20 69 73 0a 58 2a 4f | 4e 4c 59 2a 20 66 6f 72 |s is.X*O|NLY* for|
|00003880| 20 73 69 67 6c 65 72 2d | 74 6f 2d 6d 61 73 74 65 | sigler-|to-maste|
|00003890| 72 20 63 6f 6d 6d 75 6e | 69 63 61 74 69 6f 6e 2e |r commun|ication.|
|000038a0| 20 54 68 65 20 73 69 67 | 6e 61 6c 6c 65 72 20 6e | The sig|naller n|
|000038b0| 65 76 65 72 20 77 61 69 | 74 73 20 66 6f 72 0a 61 |ever wai|ts for.a|
|000038c0| 20 72 65 70 6c 79 20 6f | 6e 20 61 6e 20 66 64 73 | reply o|n an fds|
|000038d0| 69 67 32 75 73 20 6d 65 | 73 73 61 67 65 3b 20 69 |ig2us me|ssage; i|
|000038e0| 6e 73 74 65 61 64 20 69 | 74 20 6c 69 73 74 65 6e |nstead i|t listen|
|000038f0| 73 20 61 74 74 65 6e 74 | 69 76 65 6c 79 20 66 6f |s attent|ively fo|
|00003900| 72 20 6f 74 68 65 72 0a | 63 6f 6d 6d 61 6e 64 73 |r other.|commands|
|00003910| 2e 20 28 53 69 6d 69 6c | 61 72 6c 79 2c 20 66 64 |. (Simil|arly, fd|
|00003920| 73 69 67 6c 65 72 20 69 | 73 20 6f 6e 6c 79 20 66 |sigler i|s only f|
|00003930| 6f 72 20 6d 61 73 74 65 | 72 2d 74 6f 2d 73 69 67 |or maste|r-to-sig|
|00003940| 6c 65 72 0a 63 6f 6d 6d | 75 6e 69 63 61 74 69 6f |ler.comm|unicatio|
|00003950| 6e 2c 20 62 75 74 20 6f | 6e 6c 79 20 6f 6e 65 20 |n, but o|nly one |
|00003960| 77 61 79 20 69 73 20 6e | 65 63 65 73 73 61 72 79 |way is n|ecessary|
|00003970| 20 74 6f 20 61 76 6f 69 | 64 20 64 65 61 64 6c 6f | to avoi|d deadlo|
|00003980| 63 6b 2e 29 0a 58 0a 53 | 75 6e 20 62 72 6f 6b 65 |ck.).X.S|un broke|
|00003990| 20 74 68 65 20 62 65 68 | 61 76 69 6f 72 20 6f 66 | the beh|avior of|
|000039a0| 20 67 65 74 64 74 61 62 | 6c 65 73 69 7a 65 28 29 | getdtab|lesize()|
|000039b0| 3b 20 49 20 64 6f 6e 27 | 74 20 63 61 72 65 2e 0a |; I don'|t care..|
|000039c0| 58 0a 58 0a 58 0a 63 6f | 6d 6d 61 6e 64 20 74 6f |X.X.X.co|mmand to|
|000039d0| 20 63 68 61 6e 67 65 20 | 66 6c 61 67 72 65 61 64 | change |flagread|
|000039e0| 69 6e 67 3f 0a 58 0a 61 | 74 20 6c 61 73 74 20 70 |ing?.X.a|t last p|
|000039f0| 6f 73 73 69 62 6c 65 20 | 6d 6f 6d 65 6e 74 2c 20 |ossible |moment, |
|00003a00| 63 68 65 63 6b 20 61 6c | 6c 20 69 66 64 65 66 73 |check al|l ifdefs|
|00003a10| 0a 58 0a 58 0a 73 68 6f | 75 6c 64 20 74 74 79 64 |.X.X.sho|uld ttyd|
|00003a20| 65 74 61 63 68 20 74 72 | 61 73 68 20 61 6c 6c 20 |etach tr|ash all |
|00003a30| 74 74 79 20 64 65 73 63 | 72 69 70 74 6f 72 73 3f |tty desc|riptors?|
|00003a40| 0a 58 0a 73 68 6f 75 6c | 64 20 77 72 69 74 65 20 |.X.shoul|d write |
|00003a50| 69 73 61 74 74 79 28 29 | 20 61 6e 64 20 66 72 69 |isatty()| and fri|
|00003a60| 65 6e 64 73 2c 20 75 73 | 65 20 61 20 63 61 63 68 |ends, us|e a cach|
|00003a70| 65 20 6f 66 20 2f 64 65 | 76 20 73 74 61 74 73 0a |e of /de|v stats.|
|00003a80| 61 6c 73 6f 2c 20 69 73 | 61 74 74 79 28 29 20 73 |also, is|atty() s|
|00003a90| 68 6f 75 6c 64 20 6c 6f | 6f 6b 20 61 74 20 74 74 |hould lo|ok at tt|
|00003aa0| 79 2a 20 62 65 66 6f 72 | 65 20 6f 74 68 65 72 73 |y* befor|e others|
|00003ab0| 2e 20 64 65 76 6e 61 6d | 65 2e 63 2e 2e 2e 0a 76 |. devnam|e.c....v|
|00003ac0| 65 72 69 66 79 20 63 61 | 63 68 65 64 20 64 65 76 |erify ca|ched dev|
|00003ad0| 69 63 65 2d 3e 6e 61 6d | 65 20 6d 61 70 70 69 6e |ice->nam|e mappin|
|00003ae0| 67 20 62 79 20 64 6f 69 | 6e 67 20 6f 6e 65 20 73 |g by doi|ng one s|
|00003af0| 74 61 74 28 29 3f 0a 58 | 0a 69 66 20 73 79 73 74 |tat()?.X|.if syst|
|00003b00| 65 6d 20 72 75 6e 73 20 | 6f 75 74 20 6f 66 20 66 |em runs |out of f|
|00003b10| 64 73 2c 20 77 6f 6e 27 | 74 20 62 65 20 61 62 6c |ds, won'|t be abl|
|00003b20| 65 20 74 6f 20 74 61 6c | 6b 20 74 6f 20 6d 61 73 |e to tal|k to mas|
|00003b30| 74 65 72 2e 20 69 73 20 | 74 68 69 73 20 61 0a 70 |ter. is |this a.p|
|00003b40| 72 6f 62 6c 65 6d 3f 0a | 58 0a 69 66 20 61 20 70 |roblem?.|X.if a p|
|00003b50| 72 6f 67 72 61 6d 20 6c | 69 6b 65 20 73 65 73 73 |rogram l|ike sess|
|00003b60| 6c 69 73 74 20 67 65 74 | 73 20 73 74 6f 70 70 65 |list get|s stoppe|
|00003b70| 64 20 6f 72 20 62 6c 6f | 63 6b 65 64 2c 20 6d 61 |d or blo|cked, ma|
|00003b80| 73 74 65 72 20 77 6f 6e | 27 74 20 62 65 20 61 62 |ster won|'t be ab|
|00003b90| 6c 65 0a 74 6f 20 72 65 | 63 6f 6e 6e 65 63 74 2e |le.to re|connect.|
|00003ba0| 20 69 73 20 74 68 69 73 | 20 61 20 70 72 6f 62 6c | is this| a probl|
|00003bb0| 65 6d 3f 0a 58 0a 70 74 | 79 73 75 73 70 65 6e 64 |em?.X.pt|ysuspend|
|00003bc0| 20 2d 73 70 37 20 2d 20 | 73 75 73 70 65 6e 64 20 | -sp7 - |suspend |
|00003bd0| 61 73 20 69 66 20 63 68 | 69 6c 64 20 68 61 64 20 |as if ch|ild had |
|00003be0| 73 74 6f 70 70 65 64 0a | 70 74 79 63 6f 6e 74 20 |stopped.|ptycont |
|00003bf0| 2d 73 70 37 20 20 3f 3f | 3f 0a 70 74 79 20 2d 78 |-sp7 ??|?.pty -x|
|00003c00| 74 70 37 20 20 3f 3f 3f | 3f 3f 0a 58 0a 73 68 6f |tp7 ???|??.X.sho|
|00003c10| 75 6c 64 20 63 68 65 63 | 6b 70 74 79 73 20 64 6f |uld chec|kptys do|
|00003c20| 20 61 20 70 66 66 20 2f | 64 65 76 2f 74 74 79 2a | a pff /|dev/tty*|
|00003c30| 3f 0a 58 0a 6c 61 73 74 | 20 2d 20 63 6c 6f 6e 65 |?.X.last| - clone|
|00003c40| 0a 74 61 63 68 79 77 68 | 6f 0a 58 0a 69 66 20 63 |.tachywh|o.X.if c|
|00003c50| 68 69 6c 64 20 73 74 6f | 70 73 20 77 68 69 6c 65 |hild sto|ps while|
|00003c60| 20 6d 61 73 74 65 72 20 | 69 73 20 64 69 73 63 6f | master |is disco|
|00003c70| 6e 6e 65 63 74 65 64 2c | 20 73 74 6f 70 20 77 69 |nnected,| stop wi|
|00003c80| 6c 6c 20 62 65 20 68 65 | 6c 64 20 66 6f 72 0a 72 |ll be he|ld for.r|
|00003c90| 65 63 6f 6e 6e 65 63 74 | 69 6e 67 20 73 69 67 6e |econnect|ing sign|
|00003ca0| 61 6c 6c 65 72 3b 20 63 | 68 69 6c 64 20 77 69 6c |aller; c|hild wil|
|00003cb0| 6c 20 62 65 20 61 75 74 | 6f 6d 61 74 69 63 61 6c |l be aut|omatical|
|00003cc0| 6c 79 20 63 6f 6e 74 69 | 6e 75 65 64 20 6f 6e 0a |ly conti|nued on.|
|00003cd0| 72 65 63 6f 6e 6e 65 63 | 74 0a 58 0a 73 68 6f 75 |reconnec|t.X.shou|
|00003ce0| 6c 64 20 70 72 6f 62 61 | 62 6c 79 20 69 67 6e 6f |ld proba|bly igno|
|00003cf0| 72 65 20 53 49 47 50 49 | 50 45 20 66 6f 72 20 75 |re SIGPI|PE for u|
|00003d00| 74 69 6c 69 74 69 65 73 | 0a 58 0a 6e 6f 74 65 20 |tilities|.X.note |
|00003d10| 74 68 61 74 20 61 6e 20 | 69 6e 64 65 70 65 6e 64 |that an |independ|
|00003d20| 65 6e 74 20 73 65 73 73 | 6c 69 73 74 20 6d 61 79 |ent sess|list may|
|00003d30| 20 74 65 6d 70 6f 72 61 | 72 69 6c 79 20 73 68 6f | tempora|rily sho|
|00003d40| 77 20 6d 61 73 74 65 72 | 20 61 73 0a 64 69 73 63 |w master| as.disc|
|00003d50| 6f 6e 6e 65 63 74 65 64 | 0a 58 0a 64 65 66 69 6e |onnected|.X.defin|
|00003d60| 69 74 65 6c 79 20 73 68 | 6f 75 6c 64 20 6e 6f 74 |itely sh|ould not|
|00003d70| 20 6f 70 74 69 6d 69 7a | 65 20 73 69 67 73 63 68 | optimiz|e sigsch|
|00003d80| 65 64 0a 58 0a 58 0a 58 | 0a 66 72 6f 6d 20 70 74 |ed.X.X.X|.from pt|
|00003d90| 79 70 61 70 65 72 2e 39 | 3a 0a 58 3a 20 49 6e 73 |ypaper.9|:.X: Ins|
|00003da0| 74 65 61 64 20 6f 66 20 | 63 6f 70 79 69 6e 67 20 |tead of |copying |
|00003db0| 70 73 65 75 64 6f 2d 74 | 65 72 6d 69 6e 61 6c 20 |pseudo-t|erminal |
|00003dc0| 6d 6f 64 65 73 20 66 72 | 6f 6d 20 74 68 65 20 6f |modes fr|om the o|
|00003dd0| 72 69 67 69 6e 61 6c 20 | 74 65 72 6d 69 6e 61 6c |riginal |terminal|
|00003de0| 2c 20 70 74 79 0a 58 3a | 20 77 69 6c 6c 20 73 65 |, pty.X:| will se|
|00003df0| 74 20 75 70 20 61 20 67 | 65 6e 65 72 69 63 20 6e |t up a g|eneric n|
|00003e00| 65 77 2d 64 69 73 63 69 | 70 6c 69 6e 65 20 6c 69 |ew-disci|pline li|
|00003e10| 6e 65 2d 61 74 2d 61 2d | 74 69 6d 65 20 6d 6f 64 |ne-at-a-|time mod|
|00003e20| 65 2e 20 28 46 6f 6f 74 | 6e 6f 74 65 3a 0a 58 3a |e. (Foot|note:.X:|
|00003e30| 20 54 68 69 73 20 67 65 | 6e 65 72 69 63 20 6d 6f | This ge|neric mo|
|00003e40| 64 65 20 69 73 20 64 65 | 66 69 6e 65 64 20 69 6e |de is de|fined in|
|00003e50| 20 74 74 79 5f 69 6e 69 | 74 6d 6f 64 65 73 28 29 | tty_ini|tmodes()|
|00003e60| 20 69 6e 20 74 68 65 20 | 70 74 79 20 73 6f 75 72 | in the |pty sour|
|00003e70| 63 65 2e 20 49 74 0a 58 | 3a 20 73 68 6f 75 6c 64 |ce. It.X|: should|
|00003e80| 20 69 6e 73 74 65 61 64 | 20 62 65 20 64 65 73 63 | instead| be desc|
|00003e90| 72 69 62 65 64 20 69 6e | 20 66 75 72 74 68 65 72 |ribed in| further|
|00003ea0| 20 64 65 74 61 69 6c 20 | 69 6e 20 73 6f 6d 65 20 | detail |in some |
|00003eb0| 6d 61 6e 75 61 6c 20 70 | 61 67 65 2e 29 0a 6e 6f |manual p|age.).no|
|00003ec0| 77 20 64 65 66 69 6e 65 | 64 20 69 6e 20 74 74 79 |w define|d in tty|
|00003ed0| 64 66 6c 2e 37 2e 0a 58 | 3a 20 4e 6f 74 65 20 74 |dfl.7..X|: Note t|
|00003ee0| 68 61 74 20 70 74 79 20 | 68 61 6e 64 6c 65 73 20 |hat pty |handles |
|00003ef0| 6a 6f 62 20 63 6f 6e 74 | 72 6f 6c 0a 58 3a 20 63 |job cont|rol.X: c|
|00003f00| 6f 72 72 65 63 74 6c 79 | 0a 69 74 20 6e 6f 77 20 |orrectly|.it now |
|00003f10| 68 61 6e 64 6c 65 73 20 | 69 74 20 65 76 65 6e 20 |handles |it even |
|00003f20| 62 65 74 74 65 72 20 74 | 68 61 6e 20 63 6f 72 72 |better t|han corr|
|00003f30| 65 63 74 6c 79 2e 0a 58 | 3a 20 4e 6f 74 65 20 74 |ectly..X|: Note t|
|00003f40| 68 61 74 20 61 0a 58 3a | 20 73 65 73 73 69 6f 6e |hat a.X:| session|
|00003f50| 20 60 60 70 72 6f 67 72 | 61 6d 27 27 20 69 73 20 | ``progr|am'' is |
|00003f60| 61 6c 77 61 79 73 20 72 | 65 73 74 61 72 74 65 64 |always r|estarted|
|00003f70| 20 77 68 65 6e 20 69 74 | 20 69 73 20 72 65 63 6f | when it| is reco|
|00003f80| 6e 6e 65 63 74 65 64 2e | 0a 73 74 69 6c 6c 20 74 |nnected.|.still t|
|00003f90| 72 75 65 0a 58 3a 20 54 | 45 52 4d 20 73 69 67 6e |rue.X: T|ERM sign|
|00003fa0| 61 6c 73 0a 6e 6f 20 6c | 6f 6e 67 65 72 2d 2d 2d |als.no l|onger---|
|00003fb0| 6d 61 73 74 65 72 2d 73 | 69 67 6c 65 72 20 63 6f |master-s|igler co|
|00003fc0| 6d 6d 75 6e 69 63 61 74 | 69 6f 6e 20 75 73 65 73 |mmunicat|ion uses|
|00003fd0| 20 66 69 6c 65 20 64 65 | 73 63 72 69 70 74 6f 72 | file de|scriptor|
|00003fe0| 73 0a 58 3a 20 4e 6f 74 | 65 20 74 68 61 74 20 69 |s.X: Not|e that i|
|00003ff0| 66 20 69 74 20 77 65 72 | 65 6e 27 74 20 66 6f 72 |f it wer|en't for|
|00004000| 20 57 49 4e 43 48 20 68 | 61 6e 64 6c 69 6e 67 20 | WINCH h|andling |
|00004010| 61 6e 64 20 74 68 65 20 | 6b 65 72 6e 65 6c 20 73 |and the |kernel s|
|00004020| 75 70 70 6f 72 74 20 66 | 6f 72 0a 58 3a 20 63 6f |upport f|or.X: co|
|00004030| 6e 74 72 6f 6c 6c 69 6e | 67 20 74 65 72 6d 69 6e |ntrollin|g termin|
|00004040| 61 6c 73 2c 20 61 6c 6c | 20 6d 65 6e 74 69 6f 6e |als, all| mention|
|00004050| 20 6f 66 20 74 68 65 20 | 6f 72 69 67 69 6e 61 6c | of the |original|
|00004060| 20 74 74 79 20 63 6f 75 | 6c 64 20 64 69 73 61 70 | tty cou|ld disap|
|00004070| 70 65 61 72 0a 58 3a 20 | 66 72 6f 6d 20 74 68 65 |pear.X: |from the|
|00004080| 20 6d 61 73 74 65 72 2e | 20 54 68 69 73 20 77 6f | master.| This wo|
|00004090| 75 6c 64 20 67 72 65 61 | 74 6c 79 20 73 69 6d 70 |uld grea|tly simp|
|000040a0| 6c 69 66 79 20 72 65 63 | 6f 6e 6e 65 63 74 2c 20 |lify rec|onnect, |
|000040b0| 74 68 6f 75 67 68 20 73 | 6f 6d 65 0a 58 3a 20 73 |though s|ome.X: s|
|000040c0| 74 6f 70 70 69 6e 67 20 | 63 6f 6d 70 6c 65 78 69 |topping |complexi|
|000040d0| 74 79 20 77 6f 75 6c 64 | 20 6d 6f 76 65 20 69 6e |ty would| move in|
|000040e0| 74 6f 20 74 68 65 20 73 | 69 67 6e 61 6c 6c 65 72 |to the s|ignaller|
|000040f0| 2e 0a 74 68 69 73 20 69 | 73 20 6e 6f 77 20 64 6f |..this i|s now do|
|00004100| 6e 65 2d 2d 2d 77 69 6e | 63 68 20 61 6e 64 20 63 |ne---win|ch and c|
|00004110| 74 74 79 73 20 61 72 65 | 20 62 6f 74 68 20 68 61 |ttys are| both ha|
|00004120| 6e 64 6c 65 64 20 64 69 | 66 66 65 72 65 6e 74 6c |ndled di|fferentl|
|00004130| 79 20 6e 6f 77 0a 58 3a | 20 4c 69 6b 65 20 61 6c |y now.X:| Like al|
|00004140| 6c 20 70 72 6f 67 72 61 | 6d 73 2c 20 74 68 69 73 |l progra|ms, this|
|00004150| 20 70 74 79 20 69 6d 70 | 6c 65 6d 65 6e 74 61 74 | pty imp|lementat|
|00004160| 69 6f 6e 20 68 61 73 20 | 69 74 73 20 63 61 76 65 |ion has |its cave|
|00004170| 61 74 73 2e 20 42 65 63 | 61 75 73 65 20 74 68 65 |ats. Bec|ause the|
|00004180| 0a 58 3a 20 6d 61 73 74 | 65 72 20 6e 65 65 64 73 |.X: mast|er needs|
|00004190| 20 61 20 74 74 79 20 74 | 6f 20 72 65 63 6f 6e 6e | a tty t|o reconn|
|000041a0| 65 63 74 20 74 6f 2c 20 | 74 68 65 20 72 65 63 6f |ect to, |the reco|
|000041b0| 6e 6e 65 63 74 69 6e 67 | 20 73 69 67 6e 61 6c 6c |nnecting| signall|
|000041c0| 65 72 20 68 61 73 20 74 | 6f 0a 58 3a 20 68 61 76 |er has t|o.X: hav|
|000041d0| 65 20 61 20 66 69 6c 65 | 20 64 65 73 63 72 69 70 |e a file| descrip|
|000041e0| 74 6f 72 20 6f 70 65 6e | 20 61 6e 64 20 70 6f 69 |tor open| and poi|
|000041f0| 6e 74 69 6e 67 20 74 6f | 20 69 74 73 20 63 75 72 |nting to| its cur|
|00004200| 72 65 6e 74 20 74 74 79 | 2e 0a 6e 6f 20 6c 6f 6e |rent tty|..no lon|
|00004210| 67 65 72 20 74 72 75 65 | 0a 58 3a 20 41 73 20 64 |ger true|.X: As d|
|00004220| 6f 63 75 6d 65 6e 74 65 | 64 2c 20 70 73 65 75 64 |ocumente|d, pseud|
|00004230| 6f 2d 74 74 79 73 20 63 | 61 6e 6e 6f 74 20 68 61 |o-ttys c|annot ha|
|00004240| 6e 64 6c 65 20 45 4f 46 | 2e 0a 64 6f 65 73 6e 27 |ndle EOF|..doesn'|
|00004250| 74 20 72 65 61 6c 6c 79 | 20 6d 61 74 74 65 72 20 |t really| matter |
|00004260| 6e 6f 77 20 67 69 76 65 | 6e 20 6e 6f 62 75 66 0a |now give|n nobuf.|
|00004270| 58 3a 20 52 61 77 2d 6d | 6f 64 65 20 74 74 79 20 |X: Raw-m|ode tty |
|00004280| 70 72 6f 63 65 73 73 69 | 6e 67 20 69 73 20 70 72 |processi|ng is pr|
|00004290| 6f 62 6c 65 6d 61 74 69 | 63 2e 20 54 68 65 72 65 |oblemati|c. There|
|000042a0| 20 69 73 20 6e 6f 20 77 | 61 79 20 74 6f 20 73 65 | is no w|ay to se|
|000042b0| 74 20 61 0a 58 3a 20 74 | 65 72 6d 69 6e 61 6c 27 |t a.X: t|erminal'|
|000042c0| 73 20 6d 6f 64 65 73 20 | 73 6f 20 74 68 61 74 20 |s modes |so that |
|000042d0| 69 74 20 64 6f 65 73 20 | 6e 6f 20 70 72 6f 63 65 |it does |no proce|
|000042e0| 73 73 69 6e 67 20 61 6e | 64 20 61 63 74 73 20 6a |ssing an|d acts j|
|000042f0| 75 73 74 20 6c 69 6b 65 | 20 61 0a 58 3a 20 70 69 |ust like| a.X: pi|
|00004300| 70 65 2e 0a 64 69 74 74 | 6f 0a 58 3a 20 70 74 79 |pe..ditt|o.X: pty|
|00004310| 27 73 20 72 61 6e 64 6f | 6d 20 70 73 65 75 64 6f |'s rando|m pseudo|
|00004320| 2d 74 74 79 20 73 65 61 | 72 63 68 69 6e 67 20 73 |-tty sea|rching s|
|00004330| 68 6f 75 6c 64 20 6e 6f | 74 20 62 65 20 69 6e 20 |hould no|t be in |
|00004340| 61 20 66 69 78 65 64 20 | 6f 72 64 65 72 2e 0a 69 |a fixed |order..i|
|00004350| 74 20 69 73 6e 27 74 20 | 61 6e 79 20 6d 6f 72 65 |t isn't |any more|
|00004360| 0a 58 3a 20 4e 6f 6e 65 | 20 6f 66 20 74 68 65 20 |.X: None| of the |
|00004370| 61 62 6f 76 65 20 28 65 | 78 63 65 70 74 20 54 49 |above (e|xcept TI|
|00004380| 4f 43 45 58 43 4c 2c 20 | 62 75 74 20 74 68 65 72 |OCEXCL, |but ther|
|00004390| 65 20 61 72 65 20 73 74 | 69 6c 6c 20 72 61 63 65 |e are st|ill race|
|000043a0| 73 29 20 61 64 64 72 65 | 73 73 0a 58 3a 20 74 68 |s) addre|ss.X: th|
|000043b0| 65 20 70 72 6f 62 6c 65 | 6d 20 6f 66 20 61 20 62 |e proble|m of a b|
|000043c0| 61 63 6b 67 72 6f 75 6e | 64 20 70 72 6f 63 65 73 |ackgroun|d proces|
|000043d0| 73 20 6b 65 65 70 69 6e | 67 20 61 63 63 65 73 73 |s keepin|g access|
|000043e0| 20 74 6f 20 61 20 70 73 | 65 75 64 6f 2d 74 74 79 | to a ps|eudo-tty|
|000043f0| 2e 0a 58 3a 20 70 74 79 | 27 73 20 74 65 73 74 20 |..X: pty|'s test |
|00004400| 66 6f 72 20 70 72 65 76 | 69 6f 75 73 20 61 63 63 |for prev|ious acc|
|00004410| 65 73 73 20 69 73 20 63 | 6f 6d 70 6c 65 74 65 6c |ess is c|ompletel|
|00004420| 79 20 72 65 6c 69 61 62 | 6c 65 20 75 6e 64 65 72 |y reliab|le under|
|00004430| 20 73 6f 6d 65 0a 58 3a | 20 76 61 72 69 61 6e 74 | some.X:| variant|
|00004440| 73 20 6f 66 20 74 68 65 | 20 42 53 44 20 6b 65 72 |s of the| BSD ker|
|00004450| 6e 65 6c 2c 20 61 6e 64 | 20 63 6f 6d 70 6c 65 74 |nel, and| complet|
|00004460| 65 6c 79 20 75 6e 72 65 | 6c 69 61 62 6c 65 20 75 |ely unre|liable u|
|00004470| 6e 64 65 72 20 6f 74 68 | 65 72 73 2e 0a 6e 65 77 |nder oth|ers..new|
|00004480| 20 74 65 73 74 20 69 73 | 20 28 69 20 74 68 69 6e | test is| (i thin|
|00004490| 6b 29 20 63 6f 6d 70 6c | 65 74 65 6c 79 20 72 65 |k) compl|etely re|
|000044a0| 6c 69 61 62 6c 65 20 75 | 6e 64 65 72 20 61 6c 6c |liable u|nder all|
|000044b0| 20 76 61 72 69 61 6e 74 | 73 0a 58 3a 20 41 20 6d | variant|s.X: A m|
|000044c0| 75 63 68 20 62 65 74 74 | 65 72 20 73 6f 6c 75 74 |uch bett|er solut|
|000044d0| 69 6f 6e 20 69 73 20 74 | 6f 20 68 61 76 65 20 75 |ion is t|o have u|
|000044e0| 74 6d 70 20 69 6e 69 74 | 69 61 6c 69 7a 65 64 20 |tmp init|ialized |
|000044f0| 61 74 20 73 79 73 74 65 | 6d 20 73 74 61 72 74 75 |at syste|m startu|
|00004500| 70 20 74 6f 0a 58 3a 20 | 6c 69 73 74 20 61 6c 6c |p to.X: |list all|
|00004510| 20 61 76 61 69 6c 61 62 | 6c 65 20 70 74 79 73 2c | availab|le ptys,|
|00004520| 20 69 6e 20 74 68 65 20 | 6f 72 64 65 72 20 74 68 | in the |order th|
|00004530| 61 74 20 6c 6f 67 69 6e | 20 72 65 71 75 69 72 65 |at login| require|
|00004540| 73 3b 20 74 68 65 6e 20 | 70 74 79 20 77 69 6c 6c |s; then |pty will|
|00004550| 0a 58 3a 20 63 6f 6e 66 | 6f 72 6d 20 74 6f 20 74 |.X: conf|orm to t|
|00004560| 68 61 74 20 6f 72 64 65 | 72 2e 0a 6e 6f 77 20 64 |hat orde|r..now d|
|00004570| 6f 6e 65 2c 20 73 65 65 | 20 75 74 6d 70 69 6e 69 |one, see| utmpini|
|00004580| 74 20 28 74 68 61 6e 6b | 73 20 74 6f 20 70 61 75 |t (thank|s to pau|
|00004590| 6c 20 67 72 61 68 61 6d | 29 0a 58 3a 20 45 76 65 |l graham|).X: Eve|
|000045a0| 6e 20 62 65 74 74 65 72 | 20 77 6f 75 6c 64 20 62 |n better| would b|
|000045b0| 65 20 74 6f 20 64 65 64 | 69 63 61 74 65 20 61 20 |e to ded|icate a |
|000045c0| 66 69 6c 65 20 74 6f 0a | 58 3a 20 73 65 73 73 69 |file to.|X: sessi|
|000045d0| 6f 6e 20 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 3a 20 |on infor|mation: |
|000045e0| 2f 65 74 63 2f 73 74 6d | 70 2c 20 77 69 74 68 20 |/etc/stm|p, with |
|000045f0| 70 65 72 6d 61 6e 65 6e | 74 20 72 65 63 6f 72 64 |permanen|t record|
|00004600| 73 20 69 6e 20 2f 75 73 | 72 2f 61 64 6d 2f 74 74 |s in /us|r/adm/tt|
|00004610| 6d 70 2e 0a 6e 6f 77 20 | 64 6f 6e 65 2c 20 73 65 |mp..now |done, se|
|00004620| 73 73 6c 6f 67 2f 73 65 | 73 73 6e 6f 77 0a 58 3a |sslog/se|ssnow.X:|
|00004630| 20 54 68 65 20 61 73 73 | 6f 63 69 61 74 69 6f 6e | The ass|ociation|
|00004640| 20 62 65 74 77 65 65 6e | 20 63 6f 6e 6e 65 63 74 | between| connect|
|00004650| 69 6f 6e 73 20 61 6e 64 | 20 73 65 73 73 69 6f 6e |ions and| session|
|00004660| 73 20 69 73 20 73 74 69 | 6c 6c 20 6c 6f 67 69 63 |s is sti|ll logic|
|00004670| 61 6c 6c 79 0a 58 3a 20 | 73 65 70 61 72 61 74 65 |ally.X: |separate|
|00004680| 20 61 6e 64 20 62 65 6c | 6f 6e 67 73 20 69 6e 20 | and bel|ongs in |
|00004690| 79 65 74 20 61 6e 6f 74 | 68 65 72 20 66 69 6c 65 |yet anot|her file|
|000046a0| 3a 20 73 61 79 20 2f 65 | 74 63 2f 63 73 74 6d 70 |: say /e|tc/cstmp|
|000046b0| 20 61 6e 64 0a 58 3a 20 | 2f 75 73 72 2f 61 64 6d | and.X: |/usr/adm|
|000046c0| 2f 64 74 74 6d 70 2e 20 | 70 74 79 20 77 6f 75 6c |/dttmp. |pty woul|
|000046d0| 64 20 6d 61 69 6e 74 61 | 69 6e 20 74 68 65 73 65 |d mainta|in these|
|000046e0| 20 66 69 6c 65 73 20 61 | 6c 6f 6e 67 20 77 69 74 | files a|long wit|
|000046f0| 68 20 73 74 6d 70 20 61 | 6e 64 20 74 74 6d 70 2e |h stmp a|nd ttmp.|
|00004700| 0a 6e 6f 77 20 64 6f 6e | 65 2c 20 73 63 6c 6f 67 |.now don|e, sclog|
|00004710| 2f 73 63 6e 6f 77 0a 58 | 0a 45 4e 44 5f 4f 46 5f |/scnow.X|.END_OF_|
|00004720| 46 49 4c 45 0a 69 66 20 | 74 65 73 74 20 35 35 30 |FILE.if |test 550|
|00004730| 38 20 2d 6e 65 20 60 77 | 63 20 2d 63 20 3c 27 4e |8 -ne `w|c -c <'N|
|00004740| 4f 54 45 53 27 60 3b 20 | 74 68 65 6e 0a 20 20 20 |OTES'`; |then. |
|00004750| 20 65 63 68 6f 20 73 68 | 61 72 3a 20 5c 22 27 4e | echo sh|ar: \"'N|
|00004760| 4f 54 45 53 27 5c 22 20 | 75 6e 70 61 63 6b 65 64 |OTES'\" |unpacked|
|00004770| 20 77 69 74 68 20 77 72 | 6f 6e 67 20 73 69 7a 65 | with wr|ong size|
|00004780| 21 0a 66 69 0a 23 20 65 | 6e 64 20 6f 66 20 27 4e |!.fi.# e|nd of 'N|
|00004790| 4f 54 45 53 27 0a 66 69 | 0a 69 66 20 74 65 73 74 |OTES'.fi|.if test|
|000047a0| 20 2d 66 20 27 53 45 43 | 55 52 49 54 59 27 20 2d | -f 'SEC|URITY' -|
|000047b0| 61 20 22 24 7b 31 7d 22 | 20 21 3d 20 22 2d 63 22 |a "${1}"| != "-c"|
|000047c0| 20 3b 20 74 68 65 6e 20 | 0a 20 20 65 63 68 6f 20 | ; then |. echo |
|000047d0| 73 68 61 72 3a 20 57 69 | 6c 6c 20 6e 6f 74 20 63 |shar: Wi|ll not c|
|000047e0| 6c 6f 62 62 65 72 20 65 | 78 69 73 74 69 6e 67 20 |lobber e|xisting |
|000047f0| 66 69 6c 65 20 5c 22 27 | 53 45 43 55 52 49 54 59 |file \"'|SECURITY|
|00004800| 27 5c 22 0a 65 6c 73 65 | 0a 65 63 68 6f 20 73 68 |'\".else|.echo sh|
|00004810| 61 72 3a 20 45 78 74 72 | 61 63 74 69 6e 67 20 5c |ar: Extr|acting \|
|00004820| 22 27 53 45 43 55 52 49 | 54 59 27 5c 22 20 5c 28 |"'SECURI|TY'\" \(|
|00004830| 35 37 36 31 20 63 68 61 | 72 61 63 74 65 72 73 5c |5761 cha|racters\|
|00004840| 29 0a 73 65 64 20 22 73 | 2f 5e 58 2f 2f 22 20 3e |).sed "s|/^X//" >|
|00004850| 27 53 45 43 55 52 49 54 | 59 27 20 3c 3c 27 45 4e |'SECURIT|Y' <<'EN|
|00004860| 44 5f 4f 46 5f 46 49 4c | 45 27 0a 58 20 20 20 20 |D_OF_FIL|E'.X |
|00004870| 4d 6f 64 65 20 36 36 36 | 20 66 69 6c 65 73 20 61 |Mode 666| files a|
|00004880| 72 65 20 61 6c 77 61 79 | 73 20 64 61 6e 67 65 72 |re alway|s danger|
|00004890| 6f 75 73 2d 2d 2d 74 68 | 65 79 20 6c 65 74 20 61 |ous---th|ey let a|
|000048a0| 6e 79 6f 6e 65 20 72 65 | 61 64 20 6f 72 0a 58 20 |nyone re|ad or.X |
|000048b0| 20 20 20 77 72 69 74 65 | 20 61 6e 79 74 68 69 6e | write| anythin|
|000048c0| 67 2c 20 61 6c 6d 6f 73 | 74 20 75 6e 64 65 74 65 |g, almos|t undete|
|000048d0| 63 74 61 62 6c 79 2e 20 | 74 74 79 73 20 61 72 65 |ctably. |ttys are|
|000048e0| 20 70 61 72 74 69 63 75 | 6c 61 72 6c 79 0a 58 20 | particu|larly.X |
|000048f0| 20 20 20 64 61 6e 67 65 | 72 6f 75 73 20 62 65 63 | dange|rous bec|
|00004900| 61 75 73 65 20 74 68 65 | 20 64 61 74 61 20 72 65 |ause the| data re|
|00004910| 61 64 20 66 72 6f 6d 20 | 74 68 65 6d 20 63 6f 6e |ad from |them con|
|00004920| 74 72 6f 6c 73 20 70 72 | 61 63 74 69 63 61 6c 6c |trols pr|acticall|
|00004930| 79 0a 58 20 20 20 20 61 | 6c 6c 20 75 73 65 72 20 |y.X a|ll user |
|00004940| 70 72 6f 63 65 73 73 65 | 73 2c 20 61 6e 64 20 62 |processe|s, and b|
|00004950| 65 63 61 75 73 65 20 74 | 68 65 20 64 61 74 61 20 |ecause t|he data |
|00004960| 77 72 69 74 74 65 6e 20 | 74 6f 20 74 68 65 6d 0a |written |to them.|
|00004970| 58 20 20 20 20 63 6f 6e | 74 72 6f 6c 73 20 74 68 |X con|trols th|
|00004980| 65 73 65 20 77 65 69 72 | 64 20 74 68 69 6e 67 73 |ese weir|d things|
|00004990| 20 63 61 6c 6c 65 64 20 | 60 60 68 75 6d 61 6e 73 | called |``humans|
|000049a0| 27 27 20 73 69 74 74 69 | 6e 67 20 6f 6e 20 74 68 |'' sitti|ng on th|
|000049b0| 65 0a 58 20 20 20 20 6f | 74 68 65 72 20 73 69 64 |e.X o|ther sid|
|000049c0| 65 20 6f 66 20 74 68 65 | 20 73 63 72 65 65 6e 2e |e of the| screen.|
|000049d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000049e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000049f0| 2d 2d 2d 6d 65 0a 58 0a | 41 6e 20 61 74 74 61 63 |---me.X.|An attac|
|00004a00| 6b 65 72 20 63 61 6e 20 | 6d 61 69 6e 74 61 69 6e |ker can |maintain|
|00004a10| 20 61 63 63 65 73 73 20 | 74 6f 20 61 20 74 74 79 | access |to a tty|
|00004a20| 20 69 6e 20 73 65 76 65 | 72 61 6c 20 77 61 79 73 | in seve|ral ways|
|00004a30| 3a 20 28 4d 29 20 68 61 | 76 69 6e 67 20 74 68 65 |: (M) ha|ving the|
|00004a40| 0a 6d 61 73 74 65 72 20 | 73 69 64 65 20 28 73 61 |.master |side (sa|
|00004a50| 79 20 2f 64 65 76 2f 70 | 74 79 70 36 29 20 6f 70 |y /dev/p|typ6) op|
|00004a60| 65 6e 3b 20 28 53 29 20 | 68 61 76 69 6e 67 20 74 |en; (S) |having t|
|00004a70| 68 65 20 73 6c 61 76 65 | 20 73 69 64 65 20 28 74 |he slave| side (t|
|00004a80| 68 61 74 27 73 0a 58 2f | 64 65 76 2f 74 74 79 70 |hat's.X/|dev/ttyp|
|00004a90| 36 29 20 6f 70 65 6e 3b | 20 28 54 29 20 68 61 76 |6) open;| (T) hav|
|00004aa0| 69 6e 67 20 2f 64 65 76 | 2f 74 74 79 20 6f 70 65 |ing /dev|/tty ope|
|00004ab0| 6e 20 61 6e 64 20 73 6f | 6d 65 68 6f 77 20 72 65 |n and so|mehow re|
|00004ac0| 66 65 72 72 69 6e 67 20 | 74 6f 20 74 68 65 0a 74 |ferring |to the.t|
|00004ad0| 74 79 3b 20 28 43 29 20 | 68 61 76 69 6e 67 20 63 |ty; (C) |having c|
|00004ae0| 6f 6e 74 72 6f 6c 6c 69 | 6e 67 20 74 74 79 20 70 |ontrolli|ng tty p|
|00004af0| 36 2e 20 54 6f 20 73 65 | 65 20 77 68 65 74 68 65 |6. To se|e whethe|
|00004b00| 72 20 61 20 70 73 65 75 | 64 6f 2d 74 74 79 20 69 |r a pseu|do-tty i|
|00004b10| 73 0a 73 65 63 75 72 65 | 2c 20 70 74 79 20 6d 75 |s.secure|, pty mu|
|00004b20| 73 74 20 74 65 73 74 20 | 66 6f 72 20 65 61 63 68 |st test |for each|
|00004b30| 20 6f 66 20 74 68 65 73 | 65 20 66 6f 72 6d 73 20 | of thes|e forms |
|00004b40| 6f 66 20 61 63 63 65 73 | 73 2e 0a 58 0a 54 68 65 |of acces|s..X.The|
|00004b50| 20 73 79 73 74 65 6d 20 | 6d 75 73 74 20 70 72 6f | system |must pro|
|00004b60| 76 69 64 65 20 73 65 76 | 65 72 61 6c 20 61 73 73 |vide sev|eral ass|
|00004b70| 75 72 61 6e 63 65 73 2e | 20 28 31 29 20 54 6f 20 |urances.| (1) To |
|00004b80| 67 61 69 6e 20 4d 2c 20 | 61 20 70 72 6f 63 65 73 |gain M, |a proces|
|00004b90| 73 0a 6d 75 73 74 20 6f | 70 65 6e 20 2f 64 65 76 |s.must o|pen /dev|
|00004ba0| 2f 70 74 79 70 36 20 28 | 6f 72 20 72 65 63 65 69 |/ptyp6 (|or recei|
|00004bb0| 76 65 20 74 68 65 20 64 | 65 73 63 72 69 70 74 6f |ve the d|escripto|
|00004bc0| 72 20 66 72 6f 6d 20 61 | 6e 6f 74 68 65 72 20 70 |r from a|nother p|
|00004bd0| 72 6f 63 65 73 73 0a 77 | 69 74 68 20 4d 29 2e 20 |rocess.w|ith M). |
|00004be0| 28 32 29 20 49 66 20 61 | 6e 79 20 70 72 6f 63 65 |(2) If a|ny proce|
|00004bf0| 73 73 20 68 61 73 20 4d | 20 74 68 65 6e 20 6e 6f |ss has M| then no|
|00004c00| 20 70 72 6f 63 65 73 73 | 20 63 61 6e 20 6f 70 65 | process| can ope|
|00004c10| 6e 20 2f 64 65 76 2f 70 | 74 79 70 36 2e 0a 58 28 |n /dev/p|typ6..X(|
|00004c20| 33 29 20 54 6f 20 67 61 | 69 6e 20 53 2c 20 61 20 |3) To ga|in S, a |
|00004c30| 70 72 6f 63 65 73 73 20 | 6d 75 73 74 20 6f 70 65 |process |must ope|
|00004c40| 6e 20 2f 64 65 76 2f 74 | 74 79 70 36 20 28 6f 72 |n /dev/t|typ6 (or|
|00004c50| 20 72 65 63 65 69 76 65 | 20 74 68 65 20 64 65 73 | receive| the des|
|00004c60| 63 72 69 70 74 6f 72 0a | 66 72 6f 6d 20 61 6e 6f |criptor.|from ano|
|00004c70| 74 68 65 72 20 70 72 6f | 63 65 73 73 20 77 69 74 |ther pro|cess wit|
|00004c80| 68 20 53 29 2c 20 6f 62 | 65 79 69 6e 67 20 61 6e |h S), ob|eying an|
|00004c90| 79 20 70 72 6f 74 65 63 | 74 69 6f 6e 73 20 73 65 |y protec|tions se|
|00004ca0| 74 20 75 70 20 6f 6e 0a | 58 2f 64 65 76 2f 74 74 |t up on.|X/dev/tt|
|00004cb0| 79 70 36 2e 20 28 34 29 | 20 54 6f 20 67 61 69 6e |yp6. (4)| To gain|
|00004cc0| 20 54 2c 20 61 20 70 72 | 6f 63 65 73 73 20 6d 75 | T, a pr|ocess mu|
|00004cd0| 73 74 20 6f 70 65 6e 20 | 2f 64 65 76 2f 74 74 79 |st open |/dev/tty|
|00004ce0| 20 77 68 69 6c 65 20 69 | 74 20 68 61 73 20 43 0a | while i|t has C.|
|00004cf0| 58 28 6f 72 20 72 65 63 | 65 69 76 65 20 74 68 65 |X(or rec|eive the|
|00004d00| 20 64 65 73 63 72 69 70 | 74 6f 72 20 66 72 6f 6d | descrip|tor from|
|00004d10| 20 61 6e 6f 74 68 65 72 | 20 70 72 6f 63 65 73 73 | another| process|
|00004d20| 20 77 69 74 68 20 54 29 | 2e 20 28 35 29 20 54 6f | with T)|. (5) To|
|00004d30| 20 67 61 69 6e 20 43 2c | 0a 61 20 70 72 6f 63 65 | gain C,|.a proce|
|00004d40| 73 73 20 6d 75 73 74 20 | 61 6c 72 65 61 64 79 20 |ss must |already |
|00004d50| 68 61 76 65 20 4d 20 6f | 72 20 53 2c 20 6f 72 20 |have M o|r S, or |
|00004d60| 62 65 20 66 6f 72 6b 65 | 64 20 66 72 6f 6d 20 61 |be forke|d from a|
|00004d70| 6e 6f 74 68 65 72 20 70 | 72 6f 63 65 73 73 0a 77 |nother p|rocess.w|
|00004d80| 69 74 68 20 43 2c 20 6f | 72 20 6d 75 73 74 20 6f |ith C, o|r must o|
|00004d90| 70 65 6e 20 2f 64 65 76 | 2f 74 74 79 70 36 2e 20 |pen /dev|/ttyp6. |
|00004da0| 28 36 29 20 49 66 20 61 | 20 70 72 6f 63 65 73 73 |(6) If a| process|
|00004db0| 20 72 65 61 64 73 20 66 | 72 6f 6d 20 4d 2c 20 74 | reads f|rom M, t|
|00004dc0| 68 65 20 72 65 61 64 0a | 77 69 6c 6c 20 72 65 74 |he read.|will ret|
|00004dd0| 75 72 6e 20 30 20 28 6f | 72 20 2d 31 20 77 69 74 |urn 0 (o|r -1 wit|
|00004de0| 68 20 65 72 72 6e 6f 20 | 45 49 4f 29 20 69 66 20 |h errno |EIO) if |
|00004df0| 61 6e 64 20 6f 6e 6c 79 | 20 69 66 20 6e 6f 20 70 |and only| if no p|
|00004e00| 72 6f 63 65 73 73 20 68 | 61 73 20 53 20 6f 72 0a |rocess h|as S or.|
|00004e10| 54 2e 0a 58 0a 70 74 79 | 20 73 74 61 72 74 73 20 |T..X.pty| starts |
|00004e20| 62 79 20 6f 70 65 6e 69 | 6e 67 20 2f 64 65 76 2f |by openi|ng /dev/|
|00004e30| 70 74 79 70 36 2e 20 49 | 74 20 6b 65 65 70 73 20 |ptyp6. I|t keeps |
|00004e40| 2f 64 65 76 2f 70 74 79 | 70 36 20 6f 70 65 6e 20 |/dev/pty|p6 open |
|00004e50| 61 6e 64 20 6e 65 76 65 | 72 0a 70 61 73 73 65 73 |and neve|r.passes|
|00004e60| 20 69 74 20 74 6f 20 61 | 6e 6f 74 68 65 72 20 70 | it to a|nother p|
|00004e70| 72 6f 63 65 73 73 2c 20 | 73 6f 20 6e 6f 20 6f 74 |rocess, |so no ot|
|00004e80| 68 65 72 20 70 72 6f 63 | 65 73 73 20 77 69 6c 6c |her proc|ess will|
|00004e90| 20 65 76 65 72 20 68 61 | 76 65 20 4d 2e 0a 70 74 | ever ha|ve M..pt|
|00004ea0| 79 20 74 68 65 6e 20 6d | 61 6b 65 73 20 73 75 72 |y then m|akes sur|
|00004eb0| 65 20 74 68 61 74 20 2f | 64 65 76 2f 74 74 79 70 |e that /|dev/ttyp|
|00004ec0| 36 20 69 73 20 6f 77 6e | 65 64 20 62 79 20 69 74 |6 is own|ed by it|
|00004ed0| 73 20 65 66 66 65 63 74 | 69 76 65 20 75 69 64 2c |s effect|ive uid,|
|00004ee0| 20 61 6e 64 0a 63 68 61 | 6e 67 65 73 20 69 74 73 | and.cha|nges its|
|00004ef0| 20 6d 6f 64 65 20 74 6f | 20 30 32 30 30 2e 20 55 | mode to| 0200. U|
|00004f00| 6e 6c 65 73 73 20 69 74 | 20 63 61 6e 20 64 6f 20 |nless it| can do |
|00004f10| 74 68 69 73 2c 20 74 68 | 65 72 65 20 69 73 20 61 |this, th|ere is a|
|00004f20| 62 73 6f 6c 75 74 65 6c | 79 20 6e 6f 0a 63 68 61 |bsolutel|y no.cha|
|00004f30| 6e 63 65 20 6f 66 20 73 | 65 63 75 72 69 74 79 2c |nce of s|ecurity,|
|00004f40| 20 61 6e 64 20 70 74 79 | 20 77 6f 6e 27 74 20 65 | and pty| won't e|
|00004f50| 76 65 6e 20 74 72 79 20 | 74 68 65 20 6d 6f 72 65 |ven try |the more|
|00004f60| 20 70 6f 77 65 72 66 75 | 6c 20 74 65 73 74 73 2e | powerfu|l tests.|
|00004f70| 0a 58 0a 49 66 20 74 68 | 65 20 63 68 6d 6f 64 20 |.X.If th|e chmod |
|00004f80| 73 75 63 63 65 65 64 73 | 2c 20 6e 6f 20 75 6e 70 |succeeds|, no unp|
|00004f90| 72 69 76 69 6c 65 67 65 | 64 20 70 72 6f 63 65 73 |rivilege|d proces|
|00004fa0| 73 20 77 69 6c 6c 20 62 | 65 20 61 62 6c 65 20 74 |s will b|e able t|
|00004fb0| 6f 20 6f 70 65 6e 0a 58 | 2f 64 65 76 2f 74 74 79 |o open.X|/dev/tty|
|00004fc0| 70 36 2e 20 70 74 79 20 | 74 68 65 6e 20 63 6c 6f |p6. pty |then clo|
|00004fd0| 73 65 73 20 61 6e 79 20 | 64 65 73 63 72 69 70 74 |ses any |descript|
|00004fe0| 6f 72 73 20 69 74 20 68 | 61 64 20 6f 70 65 6e 20 |ors it h|ad open |
|00004ff0| 74 6f 20 2f 64 65 76 2f | 74 74 79 70 36 2c 0a 61 |to /dev/|ttyp6,.a|
|00005000| 6e 64 20 72 65 61 64 73 | 20 28 69 6e 20 6e 6f 6e |nd reads| (in non|
|00005010| 2d 62 6c 6f 63 6b 69 6e | 67 20 6d 6f 64 65 29 20 |-blockin|g mode) |
|00005020| 66 72 6f 6d 20 2f 64 65 | 76 2f 70 74 79 70 36 2e |from /de|v/ptyp6.|
|00005030| 20 49 74 20 63 61 6c 6c | 73 20 74 68 65 20 70 74 | It call|s the pt|
|00005040| 79 0a 69 6e 73 65 63 75 | 72 65 20 69 66 20 74 68 |y.insecu|re if th|
|00005050| 65 20 72 65 61 64 20 72 | 65 74 75 72 6e 73 20 61 |e read r|eturns a|
|00005060| 6e 79 74 68 69 6e 67 20 | 62 75 74 20 30 20 6f 72 |nything |but 0 or|
|00005070| 20 2d 31 2f 45 49 4f 2e | 20 4f 74 68 65 72 77 69 | -1/EIO.| Otherwi|
|00005080| 73 65 2c 20 69 74 0a 6b | 6e 6f 77 73 20 74 68 61 |se, it.k|nows tha|
|00005090| 74 20 61 74 20 73 6f 6d | 65 20 70 6f 69 6e 74 20 |t at som|e point |
|000050a0| 69 6e 20 74 69 6d 65 2c | 20 6e 6f 20 70 72 6f 63 |in time,| no proc|
|000050b0| 65 73 73 20 68 61 64 20 | 53 2c 20 54 2c 20 6f 72 |ess had |S, T, or|
|000050c0| 20 4d 20 28 65 78 63 65 | 70 74 0a 69 74 73 65 6c | M (exce|pt.itsel|
|000050d0| 66 29 2e 20 49 74 20 69 | 73 20 61 6e 20 65 61 73 |f). It i|s an eas|
|000050e0| 79 20 63 6f 6e 73 65 71 | 75 65 6e 63 65 20 6f 66 |y conseq|uence of|
|000050f0| 20 74 68 65 20 66 61 63 | 74 73 20 73 74 61 74 65 | the fac|ts state|
|00005100| 64 20 73 6f 20 66 61 72 | 20 74 68 61 74 20 6e 6f |d so far| that no|
|00005110| 0a 70 72 6f 63 65 73 73 | 20 77 69 6c 6c 20 65 76 |.process| will ev|
|00005120| 65 72 20 68 61 76 65 20 | 6f 72 20 61 63 71 75 69 |er have |or acqui|
|00005130| 72 65 20 53 20 6f 72 20 | 4d 20 75 6e 74 69 6c 20 |re S or |M until |
|00005140| 70 74 79 20 67 69 76 65 | 73 20 75 70 20 4d 2c 20 |pty give|s up M, |
|00005150| 63 68 61 6e 67 65 73 0a | 74 68 65 20 70 65 72 6d |changes.|the perm|
|00005160| 69 73 73 69 6f 6e 73 20 | 6f 6e 20 2f 64 65 76 2f |issions |on /dev/|
|00005170| 74 74 79 70 36 2c 20 6f | 72 20 6f 74 68 65 72 77 |ttyp6, o|r otherw|
|00005180| 69 73 65 20 67 69 76 65 | 73 20 61 77 61 79 20 74 |ise give|s away t|
|00005190| 68 65 20 73 68 6f 77 2e | 0a 58 0a 54 68 69 73 20 |he show.|.X.This |
|000051a0| 6c 65 76 65 6c 20 6f 66 | 20 73 65 63 75 72 69 74 |level of| securit|
|000051b0| 79 20 69 73 20 77 68 65 | 72 65 20 70 74 79 20 33 |y is whe|re pty 3|
|000051c0| 2e 30 2c 20 65 78 70 65 | 63 74 2c 20 61 6e 64 20 |.0, expe|ct, and |
|000051d0| 53 75 6e 27 73 20 70 61 | 74 63 68 65 64 0a 76 65 |Sun's pa|tched.ve|
|000051e0| 72 73 69 6f 6e 73 20 6f | 66 20 53 75 6e 4f 53 20 |rsions o|f SunOS |
|000051f0| 34 2e 31 2e 31 20 74 65 | 6c 6e 65 74 64 2f 72 6c |4.1.1 te|lnetd/rl|
|00005200| 6f 67 69 6e 64 20 73 74 | 6f 70 2e 20 54 68 65 20 |ogind st|op. The |
|00005210| 70 72 6f 62 6c 65 6d 20 | 69 73 20 74 68 61 74 20 |problem |is that |
|00005220| 73 6f 6d 65 0a 70 72 6f | 63 65 73 73 65 73 20 63 |some.pro|cesses c|
|00005230| 6f 75 6c 64 20 73 74 69 | 6c 6c 20 68 61 76 65 20 |ould sti|ll have |
|00005240| 43 20 61 6e 64 20 74 68 | 75 73 20 61 63 71 75 69 |C and th|us acqui|
|00005250| 72 65 20 54 2e 20 48 6f | 77 20 77 6f 75 6c 64 20 |re T. Ho|w would |
|00005260| 79 6f 75 20 74 65 73 74 | 0a 77 68 65 74 68 65 72 |you test|.whether|
|00005270| 20 74 68 65 72 65 20 61 | 72 65 20 61 6e 79 20 70 | there a|re any p|
|00005280| 72 6f 63 65 73 73 65 73 | 20 77 69 74 68 20 61 20 |rocesses| with a |
|00005290| 63 65 72 74 61 69 6e 20 | 63 6f 6e 74 72 6f 6c 6c |certain |controll|
|000052a0| 69 6e 67 20 74 74 79 3f | 20 49 27 76 65 0a 70 75 |ing tty?| I've.pu|
|000052b0| 62 6c 69 73 68 65 64 20 | 74 77 6f 20 63 6f 6d 70 |blished |two comp|
|000052c0| 72 65 68 65 6e 73 69 76 | 65 20 73 6f 6c 75 74 69 |rehensiv|e soluti|
|000052d0| 6f 6e 73 20 75 70 20 74 | 6f 20 6e 6f 77 3a 20 6f |ons up t|o now: o|
|000052e0| 6e 65 20 62 61 73 65 64 | 20 6f 6e 0a 65 6c 69 6d |ne based| on.elim|
|000052f0| 69 6e 61 74 69 6e 67 20 | 43 20 61 63 63 65 73 73 |inating |C access|
|00005300| 20 65 6e 74 69 72 65 6c | 79 2c 20 6f 6e 65 20 62 | entirel|y, one b|
|00005310| 61 73 65 64 20 6f 6e 20 | 75 73 69 6e 67 20 6d 79 |ased on |using my|
|00005320| 20 70 66 66 20 70 72 6f | 67 72 61 6d 20 74 6f 20 | pff pro|gram to |
|00005330| 6c 6f 6f 6b 0a 66 6f 72 | 20 53 43 4d 20 61 63 63 |look.for| SCM acc|
|00005340| 65 73 73 20 61 6c 6c 20 | 61 74 20 6f 6e 63 65 2e |ess all |at once.|
|00005350| 20 42 75 74 20 74 68 65 | 72 65 27 73 20 61 20 73 | But the|re's a s|
|00005360| 69 6d 70 6c 65 72 20 28 | 61 6c 62 65 69 74 20 73 |impler (|albeit s|
|00005370| 6f 6d 65 77 68 61 74 20 | 6c 65 73 73 0a 72 6f 62 |omewhat |less.rob|
|00005380| 75 73 74 20 61 6e 64 20 | 73 6f 6d 65 77 68 61 74 |ust and |somewhat|
|00005390| 20 73 6c 6f 77 65 72 29 | 20 73 6f 6c 75 74 69 6f | slower)| solutio|
|000053a0| 6e 2e 20 70 74 79 20 34 | 2e 30 20 73 69 6d 70 6c |n. pty 4|.0 simpl|
|000053b0| 79 20 69 6e 76 6f 6b 65 | 73 20 2f 62 69 6e 2f 70 |y invoke|s /bin/p|
|000053c0| 73 0a 63 67 61 78 74 70 | 36 20 61 6e 64 20 70 61 |s.cgaxtp|6 and pa|
|000053d0| 72 73 65 73 20 74 68 65 | 20 6f 75 74 70 75 74 2c |rses the| output,|
|000053e0| 20 6c 6f 6f 6b 69 6e 67 | 20 66 6f 72 20 70 72 6f | looking| for pro|
|000053f0| 63 65 73 73 20 49 44 73 | 20 6f 74 68 65 72 20 74 |cess IDs| other t|
|00005400| 68 61 6e 20 69 74 73 65 | 6c 66 0a 61 6e 64 20 74 |han itse|lf.and t|
|00005410| 68 61 74 20 6f 66 20 70 | 73 2e 20 28 49 74 20 61 |hat of p|s. (It a|
|00005420| 63 74 75 61 6c 6c 79 20 | 63 6f 75 6e 74 73 20 6e |ctually |counts n|
|00005430| 65 77 6c 69 6e 65 73 20 | 69 6e 20 74 68 65 20 6f |ewlines |in the o|
|00005440| 75 74 70 75 74 20 61 6e | 64 20 65 72 72 6f 72 20 |utput an|d error |
|00005450| 6f 66 0a 70 73 2e 20 49 | 66 20 74 68 65 72 65 20 |of.ps. I|f there |
|00005460| 69 73 20 73 6f 6d 65 20 | 70 72 6f 62 6c 65 6d 20 |is some |problem |
|00005470| 69 6e 76 6f 6b 69 6e 67 | 20 70 73 2c 20 74 68 65 |invoking| ps, the|
|00005480| 72 65 20 77 69 6c 6c 20 | 62 65 20 7a 65 72 6f 20 |re will |be zero |
|00005490| 6e 65 77 6c 69 6e 65 73 | 2e 0a 49 66 20 70 73 20 |newlines|..If ps |
|000054a0| 73 74 61 72 74 73 20 61 | 6e 64 20 70 72 69 6e 74 |starts a|nd print|
|000054b0| 73 20 61 6e 79 20 70 72 | 6f 63 65 73 73 65 73 20 |s any pr|ocesses |
|000054c0| 77 69 74 68 20 70 69 64 | 73 20 6f 74 68 65 72 20 |with pid|s other |
|000054d0| 74 68 61 6e 20 74 68 61 | 74 20 6f 66 20 70 74 79 |than tha|t of pty|
|000054e0| 0a 61 6e 64 20 70 73 20 | 69 74 73 65 6c 66 2c 20 |.and ps |itself, |
|000054f0| 74 68 65 72 65 20 77 69 | 6c 6c 20 62 65 20 6d 6f |there wi|ll be mo|
|00005500| 72 65 20 74 68 61 6e 20 | 6f 6e 65 20 6e 65 77 6c |re than |one newl|
|00005510| 69 6e 65 2e 20 54 68 69 | 73 20 69 73 20 73 61 66 |ine. Thi|s is saf|
|00005520| 65 20 61 67 61 69 6e 73 | 74 0a 73 74 72 61 6e 67 |e agains|t.strang|
|00005530| 65 20 70 72 6f 63 65 73 | 73 20 6e 61 6d 65 73 20 |e proces|s names |
|00005540| 61 6e 64 20 70 6f 6f 72 | 20 70 73 20 66 6f 72 6d |and poor| ps form|
|00005550| 61 74 74 69 6e 67 2c 20 | 62 75 74 20 69 74 20 64 |atting, |but it d|
|00005560| 6f 65 73 20 72 65 71 75 | 69 72 65 20 74 68 65 0a |oes requ|ire the.|
|00005570| 70 69 64 73 20 6f 66 20 | 70 74 79 20 61 6e 64 20 |pids of |pty and |
|00005580| 70 73 20 74 6f 20 62 65 | 20 70 6f 73 69 74 69 76 |ps to be| positiv|
|00005590| 65 20 69 6e 74 65 67 65 | 72 73 20 77 68 69 63 68 |e intege|rs which|
|000055a0| 20 66 69 74 20 69 6e 74 | 6f 20 61 6e 20 69 6e 74 | fit int|o an int|
|000055b0| 2e 29 20 4f 6e 20 61 0a | 53 75 6e 2c 20 66 6f 72 |.) On a.|Sun, for|
|000055c0| 20 69 6e 73 74 61 6e 63 | 65 2c 20 74 68 69 73 20 | instanc|e, this |
|000055d0| 65 78 74 72 61 20 74 65 | 73 74 20 74 61 6b 65 73 |extra te|st takes|
|000055e0| 20 30 2e 33 20 73 65 63 | 6f 6e 64 73 20 6f 6e 20 | 0.3 sec|onds on |
|000055f0| 70 74 79 20 73 74 61 72 | 74 75 70 2e 0a 4e 6f 74 |pty star|tup..Not|
|00005600| 65 20 74 68 61 74 20 70 | 74 79 20 69 6e 76 6f 6b |e that p|ty invok|
|00005610| 65 73 20 2f 62 69 6e 2f | 70 73 20 77 69 74 68 20 |es /bin/|ps with |
|00005620| 6f 6e 6c 79 20 74 68 65 | 20 70 72 69 76 69 6c 65 |only the| privile|
|00005630| 67 65 73 20 6f 66 20 69 | 74 73 20 72 65 61 6c 20 |ges of i|ts real |
|00005640| 75 69 64 2e 0a 58 0a 54 | 68 69 73 20 69 73 6e 27 |uid..X.T|his isn'|
|00005650| 74 20 61 73 20 72 6f 62 | 75 73 74 20 61 73 20 49 |t as rob|ust as I|
|00005660| 27 64 20 6c 69 6b 65 20 | 62 65 63 61 75 73 65 20 |'d like |because |
|00005670| 61 20 70 72 6f 63 65 73 | 73 20 63 6f 75 6c 64 20 |a proces|s could |
|00005680| 63 6f 6e 63 65 69 76 61 | 62 6c 79 0a 66 6f 72 6b |conceiva|bly.fork|
|00005690| 2c 20 65 78 69 74 20 69 | 6e 20 74 68 65 20 70 61 |, exit i|n the pa|
|000056a0| 72 65 6e 74 2c 20 61 6e | 64 20 68 61 76 65 20 70 |rent, an|d have p|
|000056b0| 73 20 6d 69 73 73 20 62 | 6f 74 68 20 70 72 6f 63 |s miss b|oth proc|
|000056c0| 65 73 73 65 73 20 77 69 | 74 68 6f 75 74 20 65 76 |esses wi|thout ev|
|000056d0| 65 6e 0a 70 72 69 6e 74 | 69 6e 67 20 61 6e 20 65 |en.print|ing an e|
|000056e0| 72 72 6f 72 20 6d 65 73 | 73 61 67 65 2e 20 49 66 |rror mes|sage. If|
|000056f0| 20 69 74 20 77 6f 72 6b | 73 2c 20 74 68 6f 75 67 | it work|s, thoug|
|00005700| 68 2c 20 69 74 20 67 75 | 61 72 61 6e 74 65 65 73 |h, it gu|arantees|
|00005710| 20 74 68 61 74 20 61 74 | 0a 73 6f 6d 65 20 70 6f | that at|.some po|
|00005720| 69 6e 74 20 69 6e 20 74 | 69 6d 65 2c 20 6e 6f 20 |int in t|ime, no |
|00005730| 70 72 6f 63 65 73 73 20 | 28 6f 74 68 65 72 20 74 |process |(other t|
|00005740| 68 61 6e 20 70 74 79 20 | 61 6e 64 20 70 73 29 20 |han pty |and ps) |
|00005750| 68 61 64 20 53 2c 20 4d | 2c 20 6f 72 20 43 0a 61 |had S, M|, or C.a|
|00005760| 63 63 65 73 73 2c 20 61 | 6e 64 20 73 69 6e 63 65 |ccess, a|nd since|
|00005770| 20 6e 6f 20 70 72 6f 63 | 65 73 73 20 63 61 6e 20 | no proc|ess can |
|00005780| 67 61 69 6e 20 53 20 6f | 72 20 4d 2c 20 6e 6f 20 |gain S o|r M, no |
|00005790| 70 72 6f 63 65 73 73 20 | 63 61 6e 20 67 61 69 6e |process |can gain|
|000057a0| 20 43 0a 65 69 74 68 65 | 72 2e 0a 58 0a 57 65 27 | C.eithe|r..X.We'|
|000057b0| 72 65 20 6e 6f 74 20 64 | 6f 6e 65 20 79 65 74 2e |re not d|one yet.|
|000057c0| 20 53 6f 6d 65 20 70 72 | 6f 63 65 73 73 20 6d 69 | Some pr|ocess mi|
|000057d0| 67 68 74 20 68 61 76 65 | 20 70 69 63 6b 65 64 20 |ght have| picked |
|000057e0| 75 70 20 54 20 61 63 63 | 65 73 73 20 66 72 6f 6d |up T acc|ess from|
|000057f0| 20 43 0a 61 63 63 65 73 | 73 2c 20 74 68 65 6e 20 | C.acces|s, then |
|00005800| 73 68 65 64 20 43 20 62 | 65 66 6f 72 65 20 70 73 |shed C b|efore ps|
|00005810| 20 64 65 74 65 63 74 65 | 64 20 69 74 2e 20 28 49 | detecte|d it. (I|
|00005820| 20 68 61 76 65 20 61 20 | 74 65 73 74 20 70 72 6f | have a |test pro|
|00005830| 67 72 61 6d 20 77 68 69 | 63 68 0a 63 61 6e 20 64 |gram whi|ch.can d|
|00005840| 6f 20 74 68 69 73 20 61 | 62 6f 75 74 20 6f 6e 65 |o this a|bout one|
|00005850| 20 74 69 6d 65 20 6f 75 | 74 20 6f 66 20 74 77 65 | time ou|t of twe|
|00005860| 6e 74 79 3b 20 74 68 69 | 73 20 69 73 6e 27 74 20 |nty; thi|s isn't |
|00005870| 6a 75 73 74 20 61 20 74 | 68 65 6f 72 65 74 69 63 |just a t|heoretic|
|00005880| 61 6c 0a 63 6f 6e 63 65 | 72 6e 2e 29 20 46 6f 72 |al.conce|rn.) For|
|00005890| 74 75 6e 61 74 65 6c 79 | 2c 20 70 74 79 20 63 61 |tunately|, pty ca|
|000058a0| 6e 20 6a 75 73 74 20 72 | 65 70 65 61 74 20 69 74 |n just r|epeat it|
|000058b0| 73 20 66 69 72 73 74 20 | 74 65 73 74 2c 20 64 65 |s first |test, de|
|000058c0| 74 65 63 74 69 6e 67 20 | 61 6e 79 0a 53 20 6f 72 |tecting |any.S or|
|000058d0| 20 54 20 61 63 63 65 73 | 73 2e 20 49 66 20 72 65 | T acces|s. If re|
|000058e0| 61 64 28 29 20 72 65 74 | 75 72 6e 73 20 30 20 6f |ad() ret|urns 0 o|
|000058f0| 72 20 2d 31 2f 45 49 4f | 2c 20 61 6c 6c 20 53 2c |r -1/EIO|, all S,|
|00005900| 20 54 2c 20 43 2c 20 61 | 6e 64 20 4d 20 61 63 63 | T, C, a|nd M acc|
|00005910| 65 73 73 0a 6f 75 74 73 | 69 64 65 20 6f 66 20 70 |ess.outs|ide of p|
|00005920| 74 79 20 69 73 20 28 49 | 20 62 65 6c 69 65 76 65 |ty is (I| believe|
|00005930| 29 20 63 6f 6d 70 6c 65 | 74 65 6c 79 20 67 6f 6e |) comple|tely gon|
|00005940| 65 2e 20 28 70 74 79 20 | 74 68 65 6e 20 63 68 6d |e. (pty |then chm|
|00005950| 6f 64 73 20 61 6e 64 0a | 63 68 6f 77 6e 73 20 74 |ods and.|chowns t|
|00005960| 68 65 20 74 74 79 20 73 | 6f 20 74 68 61 74 20 73 |he tty s|o that s|
|00005970| 74 61 6e 64 61 72 64 20 | 74 6f 6f 6c 73 20 77 6f |tandard |tools wo|
|00005980| 72 6b 2e 29 0a 58 0a 49 | 6e 20 72 65 74 72 6f 73 |rk.).X.I|n retros|
|00005990| 70 65 63 74 2c 20 49 20 | 64 6f 6e 27 74 20 72 65 |pect, I |don't re|
|000059a0| 61 6c 6c 79 20 6c 69 6b | 65 20 74 68 69 73 20 73 |ally lik|e this s|
|000059b0| 6f 6c 75 74 69 6f 6e 2e | 20 49 74 27 73 20 61 63 |olution.| It's ac|
|000059c0| 74 75 61 6c 6c 79 20 72 | 61 74 68 65 72 0a 70 6f |tually r|ather.po|
|000059d0| 72 74 61 62 6c 65 20 28 | 67 69 76 65 6e 20 42 53 |rtable (|given BS|
|000059e0| 44 2d 66 6c 61 76 6f 72 | 20 2f 62 69 6e 2f 70 73 |D-flavor| /bin/ps|
|000059f0| 2c 20 74 68 61 74 20 69 | 73 29 2c 20 62 75 74 20 |, that i|s), but |
|00005a00| 69 74 20 61 64 64 73 20 | 61 20 6e 6f 74 69 63 65 |it adds |a notice|
|00005a10| 61 62 6c 65 0a 64 65 6c | 61 79 20 61 74 20 70 74 |able.del|ay at pt|
|00005a20| 79 20 73 74 61 72 74 75 | 70 2e 20 49 20 61 67 72 |y startu|p. I agr|
|00005a30| 65 65 20 77 69 74 68 20 | 53 74 65 76 65 20 42 65 |ee with |Steve Be|
|00005a40| 6c 6c 6f 76 69 6e 20 74 | 68 61 74 20 69 74 20 6d |llovin t|hat it m|
|00005a50| 61 6b 65 73 20 6d 75 63 | 68 0a 6d 6f 72 65 20 73 |akes muc|h.more s|
|00005a60| 65 6e 73 65 20 74 6f 20 | 6c 65 61 76 65 20 61 20 |ense to |leave a |
|00005a70| 70 73 65 75 64 6f 2d 74 | 74 79 20 61 72 6f 75 6e |pseudo-t|ty aroun|
|00005a80| 64 20 28 61 6e 64 20 61 | 63 63 6f 75 6e 74 65 64 |d (and a|ccounted|
|00005a90| 20 74 6f 20 74 68 65 20 | 75 73 65 72 21 29 0a 75 | to the |user!).u|
|00005aa0| 6e 74 69 6c 20 74 68 65 | 20 75 73 65 72 20 68 61 |ntil the| user ha|
|00005ab0| 73 20 63 6c 6f 73 65 64 | 20 61 6c 6c 20 64 65 73 |s closed| all des|
|00005ac0| 63 72 69 70 74 6f 72 73 | 20 74 6f 20 69 74 2e 20 |criptors| to it. |
|00005ad0| 54 68 69 73 20 70 75 74 | 73 20 74 68 65 20 64 65 |This put|s the de|
|00005ae0| 6c 61 79 20 69 6e 0a 74 | 68 65 20 62 61 63 6b 67 |lay in.t|he backg|
|00005af0| 72 6f 75 6e 64 20 61 74 | 20 74 68 65 20 65 6e 64 |round at| the end|
|00005b00| 20 6f 66 20 61 20 70 74 | 79 20 73 65 73 73 69 6f | of a pt|y sessio|
|00005b10| 6e 2c 20 72 61 74 68 65 | 72 20 74 68 61 6e 20 69 |n, rathe|r than i|
|00005b20| 6e 20 74 68 65 0a 66 6f | 72 65 67 72 6f 75 6e 64 |n the.fo|reground|
|00005b30| 20 61 74 20 74 68 65 20 | 62 65 67 69 6e 6e 69 6e | at the |beginnin|
|00005b40| 67 2e 0a 58 0a 4c 69 66 | 65 20 77 6f 75 6c 64 20 |g..X.Lif|e would |
|00005b50| 68 61 76 65 20 62 65 65 | 6e 20 6d 75 63 68 20 73 |have bee|n much s|
|00005b60| 69 6d 70 6c 65 72 20 69 | 66 20 74 68 65 72 65 20 |impler i|f there |
|00005b70| 68 61 64 20 62 65 65 6e | 20 61 20 70 73 65 75 64 |had been| a pseud|
|00005b80| 6f 74 74 79 28 29 20 73 | 79 73 74 65 6d 0a 63 61 |otty() s|ystem.ca|
|00005b90| 6c 6c 2c 20 73 61 79 20 | 70 73 65 75 64 6f 74 74 |ll, say |pseudott|
|00005ba0| 79 28 66 64 29 20 69 6e | 74 20 66 64 5b 34 5d 2c |y(fd) in|t fd[4],|
|00005bb0| 20 77 68 69 63 68 20 61 | 6c 6c 6f 63 61 74 65 64 | which a|llocated|
|00005bc0| 20 61 20 6e 65 77 20 74 | 74 79 20 28 6a 75 73 74 | a new t|ty (just|
|00005bd0| 20 6c 69 6b 65 0a 61 20 | 70 69 70 65 21 29 20 61 | like.a |pipe!) a|
|00005be0| 6e 64 20 72 65 74 75 72 | 6e 65 64 20 6d 61 73 74 |nd retur|ned mast|
|00005bf0| 65 72 2d 72 65 61 64 20 | 6d 61 73 74 65 72 2d 77 |er-read |master-w|
|00005c00| 72 69 74 65 20 73 6c 61 | 76 65 2d 72 65 61 64 20 |rite sla|ve-read |
|00005c10| 73 6c 61 76 65 2d 77 72 | 69 74 65 0a 64 65 73 63 |slave-wr|ite.desc|
|00005c20| 72 69 70 74 6f 72 73 2e | 20 54 68 69 73 20 77 6f |riptors.| This wo|
|00005c30| 75 6c 64 20 61 6c 73 6f | 20 68 61 76 65 20 73 6f |uld also| have so|
|00005c40| 6c 76 65 64 20 61 6e 79 | 20 70 72 6f 62 6c 65 6d |lved any| problem|
|00005c50| 73 20 70 73 65 75 64 6f | 2d 74 74 79 73 20 68 61 |s pseudo|-ttys ha|
|00005c60| 76 65 0a 77 69 74 68 20 | 45 4f 46 2e 20 45 76 65 |ve.with |EOF. Eve|
|00005c70| 6e 20 77 69 74 68 6f 75 | 74 20 73 75 63 68 20 61 |n withou|t such a|
|00005c80| 20 72 61 64 69 63 61 6c | 20 63 68 61 6e 67 65 2c | radical| change,|
|00005c90| 20 74 68 65 72 65 27 73 | 20 6e 6f 20 72 65 61 73 | there's| no reas|
|00005ca0| 6f 6e 20 66 6f 72 20 43 | 20 6f 72 0a 54 20 61 63 |on for C| or.T ac|
|00005cb0| 63 65 73 73 20 74 6f 20 | 65 78 69 73 74 3b 20 77 |cess to |exist; w|
|00005cc0| 68 79 20 63 61 6e 27 74 | 20 74 68 65 20 63 75 72 |hy can't| the cur|
|00005cd0| 72 65 6e 74 20 74 74 79 | 20 62 65 20 6c 69 73 74 |rent tty| be list|
|00005ce0| 65 64 20 69 6e 20 61 6e | 20 65 6e 76 69 72 6f 6e |ed in an| environ|
|00005cf0| 6d 65 6e 74 0a 76 61 72 | 69 61 62 6c 65 2c 20 6c |ment.var|iable, l|
|00005d00| 69 6b 65 20 54 54 59 3d | 2f 64 65 76 2f 74 74 79 |ike TTY=|/dev/tty|
|00005d10| 70 36 3f 20 2f 64 65 76 | 2f 74 74 79 2c 20 63 6f |p6? /dev|/tty, co|
|00005d20| 6e 74 72 6f 6c 6c 69 6e | 67 20 74 74 79 73 2c 20 |ntrollin|g ttys, |
|00005d30| 61 6e 64 20 50 4f 53 49 | 58 0a 73 65 73 73 69 6f |and POSI|X.sessio|
|00005d40| 6e 73 20 68 75 72 74 20 | 73 65 63 75 72 69 74 79 |ns hurt |security|
|00005d50| 20 61 6e 64 20 6d 61 6b | 65 20 74 74 79 2d 6d 61 | and mak|e tty-ma|
|00005d60| 6e 69 70 75 6c 61 74 69 | 6e 67 20 70 72 6f 67 72 |nipulati|ng progr|
|00005d70| 61 6d 73 20 68 61 72 64 | 65 72 20 74 6f 0a 77 72 |ams hard|er to.wr|
|00005d80| 69 74 65 2e 20 49 20 63 | 61 6e 27 74 20 73 61 79 |ite. I c|an't say|
|00005d90| 20 65 78 61 63 74 6c 79 | 20 77 68 61 74 20 74 68 | exactly| what th|
|00005da0| 65 20 55 4e 49 58 20 70 | 68 69 6c 6f 73 6f 70 68 |e UNIX p|hilosoph|
|00005db0| 79 20 69 73 2c 20 62 75 | 74 20 74 68 61 74 20 73 |y is, bu|t that s|
|00005dc0| 75 72 65 0a 61 69 6e 27 | 74 20 69 74 2e 0a 58 0a |ure.ain'|t it..X.|
|00005dd0| 41 6e 79 77 61 79 2c 20 | 70 74 79 20 34 2e 30 20 |Anyway, |pty 4.0 |
|00005de0| 77 6f 72 6b 73 2e 20 49 | 74 20 66 69 74 73 20 69 |works. I|t fits i|
|00005df0| 6e 74 6f 20 63 75 72 72 | 65 6e 74 20 73 79 73 74 |nto curr|ent syst|
|00005e00| 65 6d 73 20 61 6e 64 20 | 63 6c 6f 73 65 73 20 65 |ems and |closes e|
|00005e10| 76 65 72 79 20 74 74 79 | 0a 73 65 63 75 72 69 74 |very tty|.securit|
|00005e20| 79 20 68 6f 6c 65 20 49 | 20 6b 6e 6f 77 2e 20 4e |y hole I| know. N|
|00005e30| 6f 77 20 49 27 6c 6c 20 | 70 75 74 20 6d 79 20 6d |ow I'll |put my m|
|00005e40| 6f 6e 65 79 20 77 68 65 | 72 65 20 6d 79 20 6d 6f |oney whe|re my mo|
|00005e50| 75 74 68 20 69 73 2e 20 | 49 20 77 69 6c 6c 0a 70 |uth is. |I will.p|
|00005e60| 61 79 20 24 31 30 30 2e | 30 30 20 74 6f 20 74 68 |ay $100.|00 to th|
|00005e70| 65 20 66 69 72 73 74 20 | 70 65 72 73 6f 6e 20 74 |e first |person t|
|00005e80| 6f 20 64 65 6d 6f 6e 73 | 74 72 61 74 65 20 74 68 |o demons|trate th|
|00005e90| 61 74 20 70 74 79 20 34 | 2e 30 27 73 20 73 65 63 |at pty 4|.0's sec|
|00005ea0| 75 72 69 74 79 0a 63 61 | 6e 20 62 65 20 64 65 66 |urity.ca|n be def|
|00005eb0| 65 61 74 65 64 2e 20 54 | 6f 20 66 69 6e 64 20 6f |eated. T|o find o|
|00005ec0| 75 74 20 65 78 61 63 74 | 6c 79 20 77 68 61 74 20 |ut exact|ly what |
|00005ed0| 69 73 20 72 65 71 75 69 | 72 65 64 20 74 6f 20 63 |is requi|red to c|
|00005ee0| 6c 61 69 6d 20 74 68 69 | 73 0a 70 72 69 7a 65 2c |laim thi|s.prize,|
|00005ef0| 20 73 65 6e 64 20 6d 65 | 20 65 2d 6d 61 69 6c 2e | send me| e-mail.|
|00005f00| 0a 45 4e 44 5f 4f 46 5f | 46 49 4c 45 0a 69 66 20 |.END_OF_|FILE.if |
|00005f10| 74 65 73 74 20 35 37 36 | 31 20 2d 6e 65 20 60 77 |test 576|1 -ne `w|
|00005f20| 63 20 2d 63 20 3c 27 53 | 45 43 55 52 49 54 59 27 |c -c <'S|ECURITY'|
|00005f30| 60 3b 20 74 68 65 6e 0a | 20 20 20 20 65 63 68 6f |`; then.| echo|
|00005f40| 20 73 68 61 72 3a 20 5c | 22 27 53 45 43 55 52 49 | shar: \|"'SECURI|
|00005f50| 54 59 27 5c 22 20 75 6e | 70 61 63 6b 65 64 20 77 |TY'\" un|packed w|
|00005f60| 69 74 68 20 77 72 6f 6e | 67 20 73 69 7a 65 21 0a |ith wron|g size!.|
|00005f70| 66 69 0a 23 20 65 6e 64 | 20 6f 66 20 27 53 45 43 |fi.# end| of 'SEC|
|00005f80| 55 52 49 54 59 27 0a 66 | 69 0a 69 66 20 74 65 73 |URITY'.f|i.if tes|
|00005f90| 74 20 2d 66 20 27 53 59 | 53 43 4f 4e 46 27 20 2d |t -f 'SY|SCONF' -|
|00005fa0| 61 20 22 24 7b 31 7d 22 | 20 21 3d 20 22 2d 63 22 |a "${1}"| != "-c"|
|00005fb0| 20 3b 20 74 68 65 6e 20 | 0a 20 20 65 63 68 6f 20 | ; then |. echo |
|00005fc0| 73 68 61 72 3a 20 57 69 | 6c 6c 20 6e 6f 74 20 63 |shar: Wi|ll not c|
|00005fd0| 6c 6f 62 62 65 72 20 65 | 78 69 73 74 69 6e 67 20 |lobber e|xisting |
|00005fe0| 66 69 6c 65 20 5c 22 27 | 53 59 53 43 4f 4e 46 27 |file \"'|SYSCONF'|
|00005ff0| 5c 22 0a 65 6c 73 65 0a | 65 63 68 6f 20 73 68 61 |\".else.|echo sha|
|00006000| 72 3a 20 45 78 74 72 61 | 63 74 69 6e 67 20 5c 22 |r: Extra|cting \"|
|00006010| 27 53 59 53 43 4f 4e 46 | 27 5c 22 20 5c 28 33 39 |'SYSCONF|'\" \(39|
|00006020| 37 37 20 63 68 61 72 61 | 63 74 65 72 73 5c 29 0a |77 chara|cters\).|
|00006030| 73 65 64 20 22 73 2f 5e | 58 2f 2f 22 20 3e 27 53 |sed "s/^|X//" >'S|
|00006040| 59 53 43 4f 4e 46 27 20 | 3c 3c 27 45 4e 44 5f 4f |YSCONF' |<<'END_O|
|00006050| 46 5f 46 49 4c 45 27 0a | 58 23 21 2f 62 69 6e 2f |F_FILE'.|X#!/bin/|
|00006060| 73 68 0a 58 23 20 50 75 | 62 6c 69 63 20 64 6f 6d |sh.X# Pu|blic dom|
|00006070| 61 69 6e 2e 0a 58 0a 58 | 23 20 43 6f 6e 66 69 67 |ain..X.X|# Config|
|00006080| 75 72 65 2c 20 65 61 74 | 20 79 6f 75 72 20 68 65 |ure, eat| your he|
|00006090| 61 72 74 20 6f 75 74 2e | 0a 58 0a 58 23 20 6d 61 |art out.|.X.X# ma|
|000060a0| 6b 65 20 73 75 72 65 20 | 77 65 27 72 65 20 75 73 |ke sure |we're us|
|000060b0| 69 6e 67 20 73 68 20 28 | 73 74 6f 6c 65 6e 20 66 |ing sh (|stolen f|
|000060c0| 72 6f 6d 20 43 6f 6e 66 | 69 67 75 72 65 29 0a 50 |rom Conf|igure).P|
|000060d0| 41 54 48 3d 27 2e 3a 2f | 62 69 6e 3a 2f 75 73 72 |ATH='.:/|bin:/usr|
|000060e0| 2f 62 69 6e 3a 2f 75 73 | 72 2f 6c 6f 63 61 6c 2f |/bin:/us|r/local/|
|000060f0| 62 69 6e 3a 2f 75 73 72 | 2f 75 63 62 3a 2f 75 73 |bin:/usr|/ucb:/us|
|00006100| 72 2f 6c 6f 63 61 6c 3a | 2f 75 73 72 2f 6c 62 69 |r/local:|/usr/lbi|
|00006110| 6e 3a 2f 65 74 63 27 0a | 65 78 70 6f 72 74 20 50 |n:/etc'.|export P|
|00006120| 41 54 48 20 7c 7c 20 28 | 65 63 68 6f 20 22 41 61 |ATH || (|echo "Aa|
|00006130| 72 67 68 21 20 54 68 69 | 73 20 69 73 6e 27 74 20 |rgh! Thi|s isn't |
|00006140| 73 68 2e 20 44 65 73 70 | 65 72 61 74 69 6f 6e 20 |sh. Desp|eration |
|00006150| 74 69 6d 65 2e 20 49 20 | 77 69 6c 6c 20 6e 6f 77 |time. I |will now|
|00006160| 20 66 65 65 64 20 6d 79 | 73 65 6c 66 20 74 6f 20 | feed my|self to |
|00006170| 73 68 2e 2e 2e 22 3b 20 | 65 78 65 63 20 73 68 20 |sh..."; |exec sh |
|00006180| 24 30 3b 20 73 68 20 24 | 30 3b 20 6b 69 6c 6c 20 |$0; sh $|0; kill |
|00006190| 24 24 29 0a 65 63 68 6f | 20 22 57 65 27 72 65 20 |$$).echo| "We're |
|000061a0| 75 73 69 6e 67 20 73 68 | 2e 20 47 6f 6f 64 2e 22 |using sh|. Good."|
|000061b0| 0a 58 0a 58 23 20 6d 61 | 6b 65 20 73 75 72 65 20 |.X.X# ma|ke sure |
|000061c0| 63 6d 70 20 77 6f 72 6b | 73 0a 69 66 20 63 6d 70 |cmp work|s.if cmp|
|000061d0| 20 52 45 41 44 4d 45 20 | 52 45 41 44 4d 45 20 3e | README |README >|
|000061e0| 2f 64 65 76 2f 6e 75 6c | 6c 20 32 3e 26 31 0a 74 |/dev/nul|l 2>&1.t|
|000061f0| 68 65 6e 20 69 66 20 63 | 6d 70 20 52 45 41 44 4d |hen if c|mp READM|
|00006200| 45 20 53 59 53 43 4f 4e | 46 20 3e 2f 64 65 76 2f |E SYSCON|F >/dev/|
|00006210| 6e 75 6c 6c 20 32 3e 26 | 31 0a 58 20 20 20 20 20 |null 2>&|1.X |
|00006220| 74 68 65 6e 20 65 63 68 | 6f 20 27 41 61 72 67 68 |then ech|o 'Aargh|
|00006230| 21 20 63 6d 70 20 72 65 | 74 75 72 6e 73 20 61 20 |! cmp re|turns a |
|00006240| 7a 65 72 6f 20 65 78 69 | 74 20 63 6f 64 65 20 66 |zero exi|t code f|
|00006250| 6f 72 20 64 69 66 66 65 | 72 65 6e 74 20 66 69 6c |or diffe|rent fil|
|00006260| 65 73 2e 20 54 68 69 73 | 20 69 73 20 68 6f 70 65 |es. This| is hope|
|00006270| 6c 65 73 73 2e 27 0a 58 | 09 20 20 65 78 69 74 20 |less.'.X|. exit |
|00006280| 31 0a 58 20 20 20 20 20 | 65 6c 73 65 20 65 63 68 |1.X |else ech|
|00006290| 6f 20 27 59 6f 75 20 68 | 61 76 65 20 61 20 6e 6f |o 'You h|ave a no|
|000062a0| 72 6d 61 6c 20 63 6d 70 | 2e 20 47 6f 6f 64 2e 27 |rmal cmp|. Good.'|
|000062b0| 0a 58 20 20 20 20 20 66 | 69 0a 65 6c 73 65 20 65 |.X f|i.else e|
|000062c0| 63 68 6f 20 27 41 61 72 | 67 68 21 20 63 6d 70 20 |cho 'Aar|gh! cmp |
|000062d0| 72 65 74 75 72 6e 73 20 | 61 20 6e 6f 6e 7a 65 72 |returns |a nonzer|
|000062e0| 6f 20 65 78 69 74 20 63 | 6f 64 65 20 66 6f 72 20 |o exit c|ode for |
|000062f0| 74 68 65 20 73 61 6d 65 | 20 66 69 6c 65 2e 20 54 |the same| file. T|
|00006300| 68 69 73 20 69 73 20 68 | 6f 70 65 6c 65 73 73 2e |his is h|opeless.|
|00006310| 27 0a 58 20 20 20 20 20 | 65 78 69 74 20 31 0a 66 |'.X |exit 1.f|
|00006320| 69 0a 58 0a 58 23 20 63 | 6f 6e 66 69 67 2f 70 6f |i.X.X# c|onfig/po|
|00006330| 73 69 78 2e 68 3a 20 74 | 65 73 74 20 66 6f 72 20 |six.h: t|est for |
|00006340| 73 65 74 73 69 64 28 29 | 0a 63 61 74 20 3e 20 2e |setsid()|.cat > .|
|00006350| 73 65 74 73 69 64 2e 24 | 24 2e 63 20 3c 3c 20 27 |setsid.$|$.c << '|
|00006360| 59 4f 57 27 0a 65 78 74 | 65 72 6e 20 73 65 74 73 |YOW'.ext|ern sets|
|00006370| 69 64 28 29 3b 20 6d 61 | 69 6e 28 29 20 7b 20 73 |id(); ma|in() { s|
|00006380| 65 74 73 69 64 28 29 3b | 20 7d 0a 59 4f 57 0a 69 |etsid();| }.YOW.i|
|00006390| 66 20 63 63 20 2d 6f 20 | 2e 73 65 74 73 69 64 2e |f cc -o |.setsid.|
|000063a0| 24 24 20 2e 73 65 74 73 | 69 64 2e 24 24 2e 63 20 |$$ .sets|id.$$.c |
|000063b0| 3e 2f 64 65 76 2f 6e 75 | 6c 6c 20 32 3e 26 31 0a |>/dev/nu|ll 2>&1.|
|000063c0| 74 68 65 6e 20 65 63 68 | 6f 20 27 59 6f 75 20 68 |then ech|o 'You h|
|000063d0| 61 76 65 20 73 65 74 73 | 69 64 28 29 2e 20 49 20 |ave sets|id(). I |
|000063e0| 61 73 73 75 6d 65 20 74 | 68 69 73 20 69 73 20 61 |assume t|his is a|
|000063f0| 20 50 4f 53 49 58 20 73 | 79 73 74 65 6d 2e 20 45 | POSIX s|ystem. E|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.