home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume14 / 3bconnect next >
SHell self-extracting ARchive  |  1988-05-08  |  53.3 KB

view JSON data     |     view as text     |     open on a Mac     |     open on a PC

This file was processed as: SHell self-extracting ARchive (archive/shar).

You can browse this item here: 3bconnect

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news or mail, 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)
100% xdgMime message/rfc822 default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 53 75 62 6a 65 63 74 3a | 20 20 76 31 34 69 30 38 |Subject:| v14i08|
|00000010| 35 3a 20 20 33 42 32 20 | 45 74 68 65 72 6e 65 74 |5: 3B2 |Ethernet|
|00000020| 20 43 6f 6e 6e 65 63 74 | 69 6f 6e 20 61 6e 64 20 | Connect|ion and |
|00000030| 46 69 6c 65 20 54 72 61 | 6e 73 66 65 72 20 55 74 |File Tra|nsfer Ut|
|00000040| 69 6c 69 74 79 0a 4e 65 | 77 73 67 72 6f 75 70 73 |ility.Ne|wsgroups|
|00000050| 3a 20 63 6f 6d 70 2e 73 | 6f 75 72 63 65 73 2e 75 |: comp.s|ources.u|
|00000060| 6e 69 78 0a 53 65 6e 64 | 65 72 3a 20 73 6f 75 72 |nix.Send|er: sour|
|00000070| 63 65 73 0a 41 70 70 72 | 6f 76 65 64 3a 20 72 73 |ces.Appr|oved: rs|
|00000080| 61 6c 7a 40 75 75 6e 65 | 74 2e 55 55 2e 4e 45 54 |alz@uune|t.UU.NET|
|00000090| 0a 0a 53 75 62 6d 69 74 | 74 65 64 2d 62 79 3a 20 |..Submit|ted-by: |
|000000a0| 44 61 76 65 20 53 65 74 | 74 6c 65 20 3c 6d 63 76 |Dave Set|tle <mcv|
|000000b0| 61 78 21 6f 73 63 61 72 | 2e 73 6d 62 2e 63 6f 2e |ax!oscar|.smb.co.|
|000000c0| 75 6b 21 64 61 76 65 40 | 75 75 6e 65 74 2e 75 75 |uk!dave@|uunet.uu|
|000000d0| 2e 6e 65 74 3e 0a 50 6f | 73 74 69 6e 67 2d 6e 75 |.net>.Po|sting-nu|
|000000e0| 6d 62 65 72 3a 20 56 6f | 6c 75 6d 65 20 31 34 2c |mber: Vo|lume 14,|
|000000f0| 20 49 73 73 75 65 20 38 | 35 0a 41 72 63 68 69 76 | Issue 8|5.Archiv|
|00000100| 65 2d 6e 61 6d 65 3a 20 | 33 62 63 6f 6e 6e 65 63 |e-name: |3bconnec|
|00000110| 74 0a 0a 5b 20 20 49 20 | 64 6f 6e 27 74 20 68 61 |t..[ I |don't ha|
|00000120| 76 65 20 61 20 33 42 2c | 20 73 6f 20 79 6f 75 27 |ve a 3B,| so you'|
|00000130| 72 65 20 6f 6e 20 79 6f | 75 72 20 6f 77 6e 2e 20 |re on yo|ur own. |
|00000140| 20 2d 2d 72 24 20 20 5d | 0a 0a 54 68 69 73 20 73 | --r$ ]|..This s|
|00000150| 65 74 20 69 73 20 63 61 | 6c 6c 65 64 20 27 63 6f |et is ca|lled 'co|
|00000160| 6e 6e 65 63 74 27 2c 20 | 61 6e 64 20 69 73 20 61 |nnect', |and is a|
|00000170| 20 75 74 69 6c 69 74 79 | 20 66 6f 72 20 41 54 26 | utility| for AT&|
|00000180| 54 20 33 42 32 0a 33 42 | 4e 45 54 20 28 65 74 68 |T 3B2.3B|NET (eth|
|00000190| 65 72 6e 65 74 29 20 6e | 65 74 77 6f 72 6b 73 2c |ernet) n|etworks,|
|000001a0| 20 70 72 6f 76 69 64 69 | 6e 67 20 61 20 72 65 6d | providi|ng a rem|
|000001b0| 6f 74 65 20 6c 6f 67 69 | 6e 20 66 61 63 69 6c 69 |ote logi|n facili|
|000001c0| 74 79 2c 20 61 6e 64 20 | 61 0a 66 69 6c 65 20 74 |ty, and |a.file t|
|000001d0| 72 61 6e 73 66 65 72 20 | 63 61 70 61 62 69 6c 69 |ransfer |capabili|
|000001e0| 74 79 2e 0a 0a 09 44 61 | 76 65 2e 0a 2d 2d 2d 2d |ty....Da|ve..----|
|000001f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000200| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 43 |--------|-------C|
|00000210| 55 54 20 48 45 52 45 2d | 2d 2d 2d 2d 2d 2d 2d 2d |UT HERE-|--------|
|00000220| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000230| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 0a 23 21 20 2f 62 |--------|--.#! /b|
|00000240| 69 6e 2f 73 68 0a 23 20 | 54 68 69 73 20 69 73 20 |in/sh.# |This is |
|00000250| 61 20 73 68 65 6c 6c 20 | 61 72 63 68 69 76 65 2c |a shell |archive,|
|00000260| 20 6d 65 61 6e 69 6e 67 | 3a 0a 23 20 31 2e 20 52 | meaning|:.# 1. R|
|00000270| 65 6d 6f 76 65 20 65 76 | 65 72 79 74 68 69 6e 67 |emove ev|erything|
|00000280| 20 61 62 6f 76 65 20 74 | 68 65 20 23 21 20 2f 62 | above t|he #! /b|
|00000290| 69 6e 2f 73 68 20 6c 69 | 6e 65 2e 0a 23 20 32 2e |in/sh li|ne..# 2.|
|000002a0| 20 53 61 76 65 20 74 68 | 65 20 72 65 73 75 6c 74 | Save th|e result|
|000002b0| 69 6e 67 20 74 65 78 74 | 20 69 6e 20 61 20 66 69 |ing text| in a fi|
|000002c0| 6c 65 2e 0a 23 20 33 2e | 20 45 78 65 63 75 74 65 |le..# 3.| Execute|
|000002d0| 20 74 68 65 20 66 69 6c | 65 20 77 69 74 68 20 2f | the fil|e with /|
|000002e0| 62 69 6e 2f 73 68 20 28 | 6e 6f 74 20 63 73 68 29 |bin/sh (|not csh)|
|000002f0| 20 74 6f 20 63 72 65 61 | 74 65 3a 0a 23 09 52 45 | to crea|te:.#.RE|
|00000300| 41 44 4d 45 0a 23 09 4d | 61 6b 65 66 69 6c 65 0a |ADME.#.M|akefile.|
|00000310| 23 09 63 6f 6e 6e 65 63 | 74 2e 31 0a 23 09 72 63 |#.connec|t.1.#.rc|
|00000320| 70 2e 31 0a 23 09 73 65 | 72 76 65 72 2e 63 0a 23 |p.1.#.se|rver.c.#|
|00000330| 09 63 6f 6e 6e 65 63 74 | 2e 63 0a 23 09 72 63 70 |.connect|.c.#.rcp|
|00000340| 2e 63 0a 23 09 65 74 68 | 2e 63 0a 23 09 69 70 61 |.c.#.eth|.c.#.ipa|
|00000350| 64 64 72 2e 63 0a 23 09 | 74 61 6c 6b 2e 63 0a 23 |ddr.c.#.|talk.c.#|
|00000360| 09 73 75 62 2e 63 0a 23 | 09 66 69 6c 65 2e 63 0a |.sub.c.#|.file.c.|
|00000370| 23 09 74 65 72 6d 69 6e | 61 74 65 2e 63 0a 23 09 |#.termin|ate.c.#.|
|00000380| 6d 79 6e 6f 64 65 2e 63 | 0a 23 09 66 74 70 2e 63 |mynode.c|.#.ftp.c|
|00000390| 0a 23 09 6e 69 2e 68 0a | 23 09 66 74 70 2e 68 0a |.#.ni.h.|#.ftp.h.|
|000003a0| 65 78 70 6f 72 74 20 50 | 41 54 48 3b 20 50 41 54 |export P|ATH; PAT|
|000003b0| 48 3d 2f 62 69 6e 3a 2f | 75 73 72 2f 62 69 6e 3a |H=/bin:/|usr/bin:|
|000003c0| 24 50 41 54 48 0a 65 63 | 68 6f 20 73 68 61 72 3a |$PATH.ec|ho shar:|
|000003d0| 20 22 65 78 74 72 61 63 | 74 69 6e 67 20 27 52 45 | "extrac|ting 'RE|
|000003e0| 41 44 4d 45 27 22 20 27 | 28 34 31 35 39 20 63 68 |ADME'" '|(4159 ch|
|000003f0| 61 72 61 63 74 65 72 73 | 29 27 0a 69 66 20 74 65 |aracters|)'.if te|
|00000400| 73 74 20 2d 66 20 27 52 | 45 41 44 4d 45 27 0a 74 |st -f 'R|EADME'.t|
|00000410| 68 65 6e 0a 09 65 63 68 | 6f 20 73 68 61 72 3a 20 |hen..ech|o shar: |
|00000420| 22 77 69 6c 6c 20 6e 6f | 74 20 6f 76 65 72 2d 77 |"will no|t over-w|
|00000430| 72 69 74 65 20 65 78 69 | 73 74 69 6e 67 20 66 69 |rite exi|sting fi|
|00000440| 6c 65 20 27 52 45 41 44 | 4d 45 27 22 0a 65 6c 73 |le 'READ|ME'".els|
|00000450| 65 0a 63 61 74 20 3c 3c | 20 5c 53 48 41 52 5f 45 |e.cat <<| \SHAR_E|
|00000460| 4f 46 20 3e 20 27 52 45 | 41 44 4d 45 27 0a 41 54 |OF > 'RE|ADME'.AT|
|00000470| 26 54 20 33 42 32 20 45 | 74 68 65 72 6e 65 74 20 |&T 3B2 E|thernet |
|00000480| 43 6f 6e 6e 65 63 74 69 | 6f 6e 20 61 6e 64 20 46 |Connecti|on and F|
|00000490| 69 6c 65 20 54 72 61 6e | 73 66 65 72 20 55 74 69 |ile Tran|sfer Uti|
|000004a0| 6c 69 74 79 0a 0a 54 68 | 69 73 20 70 61 63 6b 61 |lity..Th|is packa|
|000004b0| 67 65 20 61 6c 6c 6f 77 | 73 20 79 6f 75 20 74 6f |ge allow|s you to|
|000004c0| 20 6c 6f 67 69 6e 20 74 | 6f 20 6f 74 68 65 72 20 | login t|o other |
|000004d0| 33 42 32 20 63 6f 6d 70 | 75 74 65 72 73 20 63 6f |3B2 comp|uters co|
|000004e0| 6e 6e 65 63 74 65 64 20 | 76 69 61 20 33 42 6e 65 |nnected |via 3Bne|
|000004f0| 74 2c 20 0a 69 6e 20 61 | 20 73 69 6d 69 6c 61 72 |t, .in a| similar|
|00000500| 20 66 61 73 68 69 6f 6e | 20 74 6f 20 27 63 75 27 | fashion| to 'cu'|
|00000510| 2c 20 61 6e 64 20 61 6c | 73 6f 20 74 6f 20 74 72 |, and al|so to tr|
|00000520| 61 6e 73 66 65 72 20 66 | 69 6c 65 73 20 61 63 72 |ansfer f|iles acr|
|00000530| 6f 73 73 20 74 68 65 20 | 65 74 68 65 72 6e 65 74 |oss the |ethernet|
|00000540| 2e 0a 0a 43 4f 4e 4e 45 | 43 54 0a 0a 27 43 6f 6e |...CONNE|CT..'Con|
|00000550| 6e 65 63 74 27 20 70 72 | 6f 76 69 64 65 73 20 61 |nect' pr|ovides a|
|00000560| 20 73 69 6d 70 6c 65 20 | 63 6f 6e 6e 65 63 74 69 | simple |connecti|
|00000570| 6f 6e 20 74 6f 20 61 20 | 73 68 65 6c 6c 20 6f 6e |on to a |shell on|
|00000580| 20 74 68 65 20 72 65 6d | 6f 74 65 20 6d 61 63 68 | the rem|ote mach|
|00000590| 69 6e 65 2c 20 6c 69 6e | 6b 65 64 0a 74 6f 20 79 |ine, lin|ked.to y|
|000005a0| 6f 75 72 20 74 65 72 6d | 69 6e 61 6c 20 76 69 61 |our term|inal via|
|000005b0| 20 70 69 70 65 73 2e 20 | 49 6e 69 74 69 61 6c 6c | pipes. |Initiall|
|000005c0| 79 2c 20 59 4f 55 52 20 | 74 65 72 6d 69 6e 61 6c |y, YOUR |terminal|
|000005d0| 20 77 69 6c 6c 20 62 65 | 20 64 6f 69 6e 67 20 74 | will be| doing t|
|000005e0| 68 65 20 65 63 68 6f 69 | 6e 67 0a 28 69 6e 20 63 |he echoi|ng.(in c|
|000005f0| 6f 6e 74 72 61 73 74 20 | 74 6f 20 27 63 75 27 29 |ontrast |to 'cu')|
|00000600| 2c 20 77 69 74 68 20 6c | 69 6e 65 73 20 73 68 69 |, with l|ines shi|
|00000610| 70 70 65 64 20 61 63 72 | 6f 73 73 20 74 68 65 20 |pped acr|oss the |
|00000620| 65 74 68 65 72 6e 65 74 | 20 6f 6e 6c 79 20 77 68 |ethernet| only wh|
|00000630| 65 6e 20 79 6f 75 0a 68 | 69 74 20 52 45 54 55 52 |en you.h|it RETUR|
|00000640| 4e 2e 0a 0a 59 6f 75 20 | 63 61 6e 20 66 6f 72 63 |N...You |can forc|
|00000650| 65 20 74 68 65 20 63 6f | 6e 6e 65 63 74 69 6f 6e |e the co|nnection|
|00000660| 20 69 6e 74 6f 20 27 72 | 61 77 27 20 6d 6f 64 65 | into 'r|aw' mode|
|00000670| 20 28 65 61 63 68 20 63 | 68 61 72 61 63 74 65 72 | (each c|haracter|
|00000680| 20 73 68 69 70 70 65 64 | 20 61 73 20 74 79 70 65 | shipped| as type|
|00000690| 64 2c 0a 72 65 6d 6f 74 | 65 20 65 6e 64 20 64 6f |d,.remot|e end do|
|000006a0| 69 6e 67 20 74 68 65 20 | 65 63 68 6f 69 6e 67 29 |ing the |echoing)|
|000006b0| 20 62 79 20 73 65 6e 64 | 69 6e 67 20 61 20 51 55 | by send|ing a QU|
|000006c0| 49 54 20 73 69 67 6e 61 | 6c 2e 20 54 68 69 73 20 |IT signa|l. This |
|000006d0| 61 6c 6c 6f 77 73 20 79 | 6f 75 20 74 6f 0a 75 73 |allows y|ou to.us|
|000006e0| 65 20 73 63 72 65 65 6e | 20 65 64 69 74 6f 72 73 |e screen| editors|
|000006f0| 20 6f 6e 20 74 68 65 20 | 72 65 6d 6f 74 65 20 6d | on the |remote m|
|00000700| 61 63 68 69 6e 65 2e 0a | 41 20 66 75 72 74 68 65 |achine..|A furthe|
|00000710| 72 20 51 55 49 54 20 73 | 69 67 6e 61 6c 20 67 65 |r QUIT s|ignal ge|
|00000720| 74 73 20 79 6f 75 20 62 | 61 63 6b 20 69 6e 74 6f |ts you b|ack into|
|00000730| 20 27 63 6f 6f 6b 65 64 | 27 20 6d 6f 64 65 20 2d | 'cooked|' mode -|
|00000740| 20 74 68 69 73 20 69 73 | 20 69 6e 64 69 63 61 74 | this is| indicat|
|00000750| 65 64 20 62 79 0a 27 5b | 63 6f 6f 6b 65 64 5d 27 |ed by.'[|cooked]'|
|00000760| 20 61 70 70 65 61 72 69 | 6e 67 20 6f 6e 20 79 6f | appeari|ng on yo|
|00000770| 75 72 20 74 65 72 6d 69 | 6e 61 6c 2e 20 55 6e 66 |ur termi|nal. Unf|
|00000780| 6f 72 74 75 6e 61 74 65 | 6c 79 2c 20 74 68 69 73 |ortunate|ly, this|
|00000790| 20 6d 65 61 6e 73 20 74 | 68 61 74 20 79 6f 75 0a | means t|hat you.|
|000007a0| 63 61 6e 27 74 20 73 65 | 6e 64 20 51 55 49 54 20 |can't se|nd QUIT |
|000007b0| 73 69 67 6e 61 6c 73 20 | 74 6f 20 70 72 6f 63 65 |signals |to proce|
|000007c0| 73 73 65 73 20 77 68 69 | 63 68 20 79 6f 75 20 73 |sses whi|ch you s|
|000007d0| 74 61 72 74 20 6f 6e 20 | 74 68 65 20 72 65 6d 6f |tart on |the remo|
|000007e0| 74 65 20 68 6f 73 74 2e | 0a 53 6f 72 72 79 20 61 |te host.|.Sorry a|
|000007f0| 62 6f 75 74 20 74 68 69 | 73 2e 20 49 6e 74 65 72 |bout thi|s. Inter|
|00000800| 72 75 70 74 73 20 67 65 | 74 20 70 72 6f 63 65 73 |rupts ge|t proces|
|00000810| 73 65 64 20 4f 4b 2c 20 | 74 68 6f 75 67 68 2e 0a |sed OK, |though..|
|00000820| 0a 59 6f 75 20 63 6c 6f | 73 65 20 74 68 65 20 63 |.You clo|se the c|
|00000830| 6f 6e 6e 65 63 74 69 6f | 6e 20 62 79 20 74 79 70 |onnectio|n by typ|
|00000840| 69 6e 67 20 5e 44 20 61 | 74 20 79 6f 75 72 20 74 |ing ^D a|t your t|
|00000850| 65 72 6d 69 6e 61 6c 20 | 28 69 6e 20 63 6f 6f 6b |erminal |(in cook|
|00000860| 65 64 20 6d 6f 64 65 29 | 20 2d 0a 69 66 20 79 6f |ed mode)| -.if yo|
|00000870| 75 20 77 61 6e 74 20 74 | 6f 20 73 65 6e 64 20 5e |u want t|o send ^|
|00000880| 44 20 74 6f 20 74 68 65 | 20 72 65 6d 6f 74 65 20 |D to the| remote |
|00000890| 65 6e 64 2c 20 79 6f 75 | 20 4d 55 53 54 20 62 65 |end, you| MUST be|
|000008a0| 20 69 6e 20 27 72 61 77 | 27 20 6d 6f 64 65 2e 0a | in 'raw|' mode..|
|000008b0| 0a 54 68 65 20 62 69 67 | 20 70 72 6f 62 6c 65 6d |.The big| problem|
|000008c0| 20 69 73 20 74 68 61 74 | 20 79 6f 75 72 20 72 65 | is that| your re|
|000008d0| 6d 6f 74 65 20 73 68 65 | 6c 6c 20 68 61 73 20 73 |mote she|ll has s|
|000008e0| 74 64 69 6e 2c 20 73 74 | 64 6f 75 74 2c 20 61 6e |tdin, st|dout, an|
|000008f0| 64 20 73 74 64 65 72 72 | 20 0a 63 6f 6e 6e 65 63 |d stderr| .connec|
|00000900| 74 65 64 20 74 6f 20 50 | 49 50 45 53 2c 20 72 61 |ted to P|IPES, ra|
|00000910| 74 68 65 72 20 74 68 61 | 6e 20 61 20 72 65 61 6c |ther tha|n a real|
|00000920| 20 74 74 79 2c 20 77 68 | 69 63 68 20 63 61 6e 20 | tty, wh|ich can |
|00000930| 63 61 75 73 65 20 63 65 | 72 74 61 69 6e 20 63 6f |cause ce|rtain co|
|00000940| 6d 6d 61 6e 64 73 0a 28 | 65 2e 67 2e 20 73 74 74 |mmands.(|e.g. stt|
|00000950| 79 29 20 74 6f 20 66 61 | 69 6c 2e 0a 0a 50 43 2d |y) to fa|il...PC-|
|00000960| 49 4e 54 45 52 46 41 43 | 45 2e 0a 49 66 20 79 6f |INTERFAC|E..If yo|
|00000970| 75 20 68 61 76 65 20 50 | 43 2d 49 4e 54 45 52 46 |u have P|C-INTERF|
|00000980| 41 43 45 20 69 6e 73 74 | 61 6c 6c 65 64 2c 20 74 |ACE inst|alled, t|
|00000990| 68 65 6e 20 79 6f 75 20 | 63 61 6e 20 63 6f 6e 6e |hen you |can conn|
|000009a0| 65 63 74 20 74 6f 20 6f | 6e 65 20 6f 66 20 74 68 |ect to o|ne of th|
|000009b0| 65 20 0a 70 73 65 75 64 | 6f 2d 74 74 79 20 64 65 |e .pseud|o-tty de|
|000009c0| 76 69 63 65 73 20 70 72 | 6f 76 69 64 65 64 20 62 |vices pr|ovided b|
|000009d0| 79 20 74 68 65 20 64 72 | 69 76 65 72 2c 20 62 79 |y the dr|iver, by|
|000009e0| 20 75 73 69 6e 67 20 74 | 68 65 20 27 2d 6c 27 20 | using t|he '-l' |
|000009f0| 6f 70 74 69 6f 6e 20 6f | 66 20 27 63 6f 6e 6e 65 |option o|f 'conne|
|00000a00| 63 74 27 0a 54 68 69 73 | 20 67 65 74 73 20 79 6f |ct'.This| gets yo|
|00000a10| 75 20 61 20 72 65 6d 6f | 74 65 20 73 68 65 6c 6c |u a remo|te shell|
|00000a20| 20 63 6f 6e 6e 65 63 74 | 65 64 20 74 6f 20 61 20 | connect|ed to a |
|00000a30| 27 72 65 61 6c 27 20 74 | 74 79 20 64 65 76 69 63 |'real' t|ty devic|
|00000a40| 65 2c 20 61 6e 64 20 0a | 61 75 74 6f 6d 61 74 69 |e, and .|automati|
|00000a50| 63 61 6c 6c 79 20 70 75 | 74 73 20 79 6f 75 20 69 |cally pu|ts you i|
|00000a60| 6e 20 27 72 61 77 27 20 | 6d 6f 64 65 2e 0a 0a 59 |n 'raw' |mode...Y|
|00000a70| 6f 75 20 63 6c 6f 73 65 | 20 74 68 69 73 20 74 79 |ou close| this ty|
|00000a80| 70 65 20 6f 66 20 63 6f | 6e 6e 65 63 74 69 6f 6e |pe of co|nnection|
|00000a90| 20 62 79 20 73 65 6e 64 | 69 6e 67 20 61 20 51 55 | by send|ing a QU|
|00000aa0| 49 54 20 73 69 67 6e 61 | 6c 2e 0a 0a 0a 52 43 50 |IT signa|l....RCP|
|00000ab0| 0a 27 72 63 70 27 20 70 | 72 6f 76 69 64 65 73 20 |.'rcp' p|rovides |
|00000ac0| 61 20 73 69 6d 70 6c 65 | 2c 20 62 75 74 20 65 66 |a simple|, but ef|
|00000ad0| 66 65 63 74 69 76 65 2c | 20 6d 65 74 68 6f 64 20 |fective,| method |
|00000ae0| 6f 66 20 74 72 61 6e 73 | 66 65 72 72 69 6e 67 20 |of trans|ferring |
|00000af0| 66 69 6c 65 73 20 61 63 | 72 6f 73 73 0a 74 68 65 |files ac|ross.the|
|00000b00| 20 6e 65 74 77 6f 72 6b | 2e 20 54 68 65 20 73 79 | network|. The sy|
|00000b10| 6e 74 61 78 20 72 65 73 | 65 6d 62 6c 65 73 20 27 |ntax res|embles '|
|00000b20| 75 75 63 70 27 2e 0a 0a | 0a 0a 57 48 41 54 20 59 |uucp'...|..WHAT Y|
|00000b30| 4f 55 20 4e 45 45 44 20 | 54 4f 20 44 4f 20 54 4f |OU NEED |TO DO TO|
|00000b40| 20 49 4e 53 54 41 4c 4c | 20 49 54 2e 0a 0a 61 29 | INSTALL| IT...a)|
|00000b50| 20 46 69 6e 64 20 6f 75 | 74 20 74 68 65 20 65 74 | Find ou|t the et|
|00000b60| 68 65 72 6e 65 74 20 61 | 64 64 72 65 73 73 65 73 |hernet a|ddresses|
|00000b70| 20 6f 66 20 61 6c 6c 20 | 6d 61 63 68 69 6e 65 73 | of all |machines|
|00000b80| 20 6f 6e 20 74 68 65 20 | 6e 65 74 77 6f 72 6b 2e | on the |network.|
|00000b90| 0a 09 55 73 65 20 27 6e | 69 74 61 62 6c 65 27 2c |..Use 'n|itable',|
|00000ba0| 20 6f 72 20 74 68 65 20 | 70 72 6f 67 72 61 6d 20 | or the |program |
|00000bb0| 27 6d 79 6e 6f 64 65 27 | 20 70 72 6f 76 69 64 65 |'mynode'| provide|
|00000bc0| 64 2e 0a 09 0a 62 29 20 | 53 65 74 20 75 70 20 61 |d....b) |Set up a|
|00000bd0| 20 6d 61 70 20 66 69 6c | 65 20 27 2f 75 73 72 2f | map fil|e '/usr/|
|00000be0| 6c 69 62 2f 65 74 68 65 | 72 6e 65 74 2e 61 64 64 |lib/ethe|rnet.add|
|00000bf0| 72 27 20 77 68 69 63 68 | 20 6d 61 70 73 20 74 68 |r' which| maps th|
|00000c00| 65 20 6e 61 6d 65 73 20 | 6f 66 0a 79 6f 75 72 20 |e names |of.your |
|00000c10| 68 6f 73 74 73 20 74 6f | 20 74 68 65 20 72 69 67 |hosts to| the rig|
|00000c20| 68 74 6d 6f 73 74 20 32 | 20 64 69 67 69 74 73 20 |htmost 2| digits |
|00000c30| 6f 66 20 74 68 65 69 72 | 20 65 74 68 65 72 6e 65 |of their| etherne|
|00000c40| 74 20 61 64 64 72 65 73 | 73 2e 20 0a 54 68 65 73 |t addres|s. .Thes|
|00000c50| 65 20 73 68 6f 75 6c 64 | 20 62 65 20 75 6e 69 71 |e should| be uniq|
|00000c60| 75 65 20 2d 20 69 66 20 | 6e 6f 74 2c 20 63 68 61 |ue - if |not, cha|
|00000c70| 6e 67 65 20 74 68 65 20 | 76 61 6c 75 65 20 6f 66 |nge the |value of|
|00000c80| 20 4c 53 42 20 69 6e 20 | 27 6e 69 2e 68 27 20 0a | LSB in |'ni.h' .|
|00000c90| 74 6f 20 75 73 65 20 61 | 6e 79 20 70 61 69 72 20 |to use a|ny pair |
|00000ca0| 6f 66 20 64 69 67 69 74 | 73 20 77 68 69 63 68 20 |of digit|s which |
|00000cb0| 61 72 65 20 75 6e 69 71 | 75 65 20 66 6f 72 20 79 |are uniq|ue for y|
|00000cc0| 6f 75 72 20 6e 65 74 77 | 6f 72 6b 2e 0a 0a 0a 45 |our netw|ork....E|
|00000cd0| 2e 67 2e 20 0a 6f 73 63 | 61 72 09 38 30 2e 30 30 |.g. .osc|ar.80.00|
|00000ce0| 2e 31 30 2e 33 30 2e 31 | 38 2e 66 32 20 20 20 20 |.10.30.1|8.f2 |
|00000cf0| 20 20 20 20 0a 6f 6c 69 | 76 65 20 20 20 38 30 2e | .oli|ve 80.|
|00000d00| 30 30 2e 31 30 2e 33 30 | 2e 30 62 2e 34 35 0a 0a |00.10.30|.0b.45..|
|00000d10| 2f 75 73 72 2f 6c 69 62 | 2f 65 74 68 65 72 6e 65 |/usr/lib|/etherne|
|00000d20| 74 2e 61 64 64 72 3a 0a | 0a 09 09 6f 73 63 61 72 |t.addr:.|...oscar|
|00000d30| 09 66 32 0a 09 09 6f 6c | 69 76 65 09 34 35 0a 0a |.f2...ol|ive.45..|
|00000d40| 0a 63 29 20 53 65 74 20 | 75 70 20 61 6e 20 69 6e |.c) Set |up an in|
|00000d50| 69 74 74 61 62 20 65 6e | 74 72 79 20 74 6f 20 72 |ittab en|try to r|
|00000d60| 75 6e 20 74 68 65 20 73 | 65 72 76 65 72 2e 0a 0a |un the s|erver...|
|00000d70| 65 2e 67 2e 20 28 61 73 | 73 75 6d 69 6e 67 20 73 |e.g. (as|suming s|
|00000d80| 65 72 76 65 72 20 69 73 | 20 27 2f 75 73 72 2f 6c |erver is| '/usr/l|
|00000d90| 69 62 2f 73 65 72 76 65 | 72 27 29 0a 0a 09 65 74 |ib/serve|r')...et|
|00000da0| 3a 32 3a 72 65 73 70 61 | 77 6e 3a 2f 75 73 72 2f |:2:respa|wn:/usr/|
|00000db0| 6c 69 62 2f 73 65 72 76 | 65 72 0a 09 0a 49 74 27 |lib/serv|er...It'|
|00000dc0| 73 20 69 6d 70 6f 72 74 | 61 6e 74 20 74 68 61 74 |s import|ant that|
|00000dd0| 20 74 68 69 73 20 6c 69 | 6e 65 20 69 73 20 70 72 | this li|ne is pr|
|00000de0| 6f 70 65 72 6c 79 20 64 | 65 66 69 6e 65 64 21 20 |operly d|efined! |
|00000df0| 0a 44 4f 20 4e 4f 54 20 | 44 45 46 49 4e 45 20 41 |.DO NOT |DEFINE A|
|00000e00| 4e 59 20 49 4e 50 55 54 | 20 4f 52 20 4f 55 54 50 |NY INPUT| OR OUTP|
|00000e10| 55 54 20 46 49 4c 45 53 | 20 46 4f 52 20 54 48 49 |UT FILES| FOR THI|
|00000e20| 53 20 50 52 4f 43 45 53 | 53 2e 0a 0a 0a 64 29 20 |S PROCES|S....d) |
|00000e30| 4d 61 6b 65 20 73 75 72 | 65 20 74 68 61 74 20 79 |Make sur|e that y|
|00000e40| 6f 75 20 68 61 76 65 20 | 65 6e 6f 75 67 68 20 27 |ou have |enough '|
|00000e50| 70 6f 72 74 27 20 73 74 | 72 75 63 74 75 72 65 73 |port' st|ructures|
|00000e60| 20 61 6c 6c 6f 63 61 74 | 65 64 20 69 6e 20 74 68 | allocat|ed in th|
|00000e70| 65 20 4e 49 20 64 72 69 | 76 65 72 2e 0a 20 20 20 |e NI dri|ver.. |
|00000e80| 59 6f 75 20 63 61 6e 20 | 64 6f 20 74 68 69 73 20 |You can |do this |
|00000e90| 74 68 72 6f 75 67 68 20 | 74 68 65 20 27 70 61 63 |through |the 'pac|
|00000ea0| 6b 61 67 65 6d 67 6d 74 | 2f 33 62 6e 65 74 2f 6e |kagemgmt|/3bnet/n|
|00000eb0| 69 64 72 69 76 65 72 22 | 20 6f 70 74 69 6f 6e 20 |idriver"| option |
|00000ec0| 69 6e 20 27 73 79 73 61 | 64 6d 27 0a 09 49 20 68 |in 'sysa|dm'..I h|
|00000ed0| 61 76 65 20 32 30 20 70 | 6f 72 74 73 2c 20 31 20 |ave 20 p|orts, 1 |
|00000ee0| 62 75 66 66 65 72 20 70 | 65 72 20 70 6f 72 74 2c |buffer p|er port,|
|00000ef0| 20 31 35 31 34 20 62 75 | 66 66 65 72 20 73 69 7a | 1514 bu|ffer siz|
|00000f00| 65 20 2d 20 74 68 69 73 | 20 61 6c 6c 6f 77 73 0a |e - this| allows.|
|00000f10| 09 6d 65 20 61 74 20 6c | 65 61 73 74 20 35 20 63 |.me at l|east 5 c|
|00000f20| 6f 6e 63 75 72 72 65 6e | 74 20 27 63 6f 6e 6e 65 |oncurren|t 'conne|
|00000f30| 63 74 73 27 20 28 49 27 | 76 65 20 6e 6f 74 20 74 |cts' (I'|ve not t|
|00000f40| 72 69 65 64 20 6d 6f 72 | 65 29 0a 20 20 20 59 6f |ried mor|e). Yo|
|00000f50| 75 20 68 61 76 65 20 74 | 6f 20 72 65 62 6f 6f 74 |u have t|o reboot|
|00000f60| 20 66 6f 72 20 74 68 65 | 20 72 65 63 6f 6e 66 69 | for the| reconfi|
|00000f70| 67 20 74 6f 20 62 65 63 | 6f 6d 65 20 65 66 66 65 |g to bec|ome effe|
|00000f80| 63 74 69 76 65 2e 0a 20 | 20 20 0a 65 29 20 46 69 |ctive.. | .e) Fi|
|00000f90| 6e 64 20 6f 75 74 20 79 | 6f 75 72 20 76 61 6c 75 |nd out y|our valu|
|00000fa0| 65 20 6f 66 20 4e 50 52 | 4f 43 2c 20 66 72 6f 6d |e of NPR|OC, from|
|00000fb0| 20 74 68 65 20 66 69 6c | 65 20 2f 65 74 63 2f 6d | the fil|e /etc/m|
|00000fc0| 61 73 74 65 72 2e 64 2f | 4b 45 52 4e 45 4c 0a 20 |aster.d/|KERNEL. |
|00000fd0| 20 20 44 65 66 69 6e 65 | 20 74 68 69 73 20 76 61 | Define| this va|
|00000fe0| 6c 75 65 20 69 6e 20 27 | 6e 69 2e 68 27 0a 09 0a |lue in '|ni.h'...|
|00000ff0| 0a 66 29 20 54 6f 20 63 | 6f 6e 6e 65 63 74 2c 20 |.f) To c|onnect, |
|00001000| 73 61 79 20 27 63 6f 6e | 6e 65 63 74 20 3c 68 6f |say 'con|nect <ho|
|00001010| 73 74 3e 27 0a 0a 65 2e | 67 2e 0a 09 63 6f 6e 6e |st>'..e.|g...conn|
|00001020| 65 63 74 20 6f 6c 69 76 | 65 0a 09 0a 0a 0a 42 55 |ect oliv|e.....BU|
|00001030| 47 53 0a 0a 54 54 59 3a | 0a 59 6f 75 27 72 65 20 |GS..TTY:|.You're |
|00001040| 6e 6f 74 20 63 6f 6e 6e | 65 63 74 65 64 20 74 6f |not conn|ected to|
|00001050| 20 61 20 74 74 79 20 61 | 74 20 74 68 65 20 72 65 | a tty a|t the re|
|00001060| 6d 6f 74 65 20 65 6e 64 | 2c 20 73 6f 20 63 65 72 |mote end|, so cer|
|00001070| 74 61 69 6e 20 63 6f 6d | 6d 61 6e 64 73 20 61 72 |tain com|mands ar|
|00001080| 65 6e 27 74 0a 67 6f 69 | 6e 67 20 74 6f 20 77 6f |en't.goi|ng to wo|
|00001090| 72 6b 2e 20 53 63 72 65 | 65 6e 20 65 64 69 74 6f |rk. Scre|en edito|
|000010a0| 72 73 20 77 69 6c 6c 20 | 77 6f 72 6b 2c 20 62 75 |rs will |work, bu|
|000010b0| 74 20 6f 6e 6c 79 20 69 | 66 20 79 6f 75 20 75 73 |t only i|f you us|
|000010c0| 65 20 74 68 65 6d 20 77 | 68 65 6e 20 79 6f 75 27 |e them w|hen you'|
|000010d0| 72 65 0a 69 6e 20 27 72 | 61 77 27 20 6d 6f 64 65 |re.in 'r|aw' mode|
|000010e0| 2e 0a 0a 45 4f 54 3a 0a | 54 68 65 72 65 27 73 20 |...EOT:.|There's |
|000010f0| 6e 6f 20 77 61 79 20 74 | 6f 20 73 65 6e 64 20 45 |no way t|o send E|
|00001100| 4f 54 20 74 6f 20 61 20 | 72 65 6d 6f 74 65 20 70 |OT to a |remote p|
|00001110| 72 6f 63 65 73 73 2e 20 | 54 79 70 69 6e 67 20 5e |rocess. |Typing ^|
|00001120| 44 20 6f 6e 20 79 6f 75 | 72 20 74 65 72 6d 69 6e |D on you|r termin|
|00001130| 61 6c 20 77 69 6c 6c 0a | 63 6c 6f 73 65 20 74 68 |al will.|close th|
|00001140| 65 20 63 6f 6e 6e 65 63 | 74 69 6f 6e 2e 20 48 6f |e connec|tion. Ho|
|00001150| 77 65 76 65 72 2c 20 77 | 68 65 6e 20 79 6f 75 20 |wever, w|hen you |
|00001160| 64 6f 20 61 20 63 6c 6f | 73 65 2c 20 61 6c 6c 20 |do a clo|se, all |
|00001170| 79 6f 75 72 20 72 65 6d | 6f 74 65 20 70 72 6f 63 |your rem|ote proc|
|00001180| 65 73 73 65 73 0a 67 65 | 74 20 73 65 6e 74 20 61 |esses.ge|t sent a|
|00001190| 20 68 61 6e 67 75 70 20 | 73 69 67 6e 61 6c 2c 20 | hangup |signal, |
|000011a0| 77 68 69 63 68 20 75 73 | 75 61 6c 6c 79 20 61 6d |which us|ually am|
|000011b0| 6f 75 6e 74 73 20 74 6f | 20 74 68 65 20 73 61 6d |ounts to| the sam|
|000011c0| 65 20 74 68 69 6e 67 2e | 0a 0a 45 54 48 45 52 4e |e thing.|..ETHERN|
|000011d0| 45 54 20 41 44 44 52 45 | 53 53 3a 0a 54 68 65 20 |ET ADDRE|SS:.The |
|000011e0| 65 74 68 65 72 6e 65 74 | 20 61 64 64 72 65 73 73 |ethernet| address|
|000011f0| 65 73 20 77 68 69 63 68 | 20 61 72 65 20 75 73 65 |es which| are use|
|00001200| 64 20 62 79 20 74 68 69 | 73 20 70 61 63 6b 61 67 |d by thi|s packag|
|00001210| 65 20 61 72 65 20 4e 4f | 54 20 67 75 61 72 61 6e |e are NO|T guaran|
|00001220| 74 65 65 64 20 74 6f 0a | 62 65 20 75 6e 69 71 75 |teed to.|be uniqu|
|00001230| 65 2c 20 61 6e 64 20 6d | 61 79 20 69 6e 74 65 72 |e, and m|ay inter|
|00001240| 66 65 72 65 20 77 69 74 | 68 20 6f 74 68 65 72 20 |fere wit|h other |
|00001250| 65 74 68 65 72 6e 65 74 | 20 61 70 70 6c 69 63 61 |ethernet| applica|
|00001260| 74 69 6f 6e 73 2e 20 28 | 33 42 6e 65 74 20 61 6e |tions. (|3Bnet an|
|00001270| 64 0a 50 43 2d 49 6e 74 | 65 72 66 61 63 65 20 73 |d.PC-Int|erface s|
|00001280| 65 65 6d 20 74 6f 20 62 | 65 20 4f 4b 2c 20 74 68 |eem to b|e OK, th|
|00001290| 6f 75 67 68 29 2e 0a 0a | 49 66 20 79 6f 75 20 67 |ough)...|If you g|
|000012a0| 65 74 20 63 6f 6e 66 6c | 69 63 74 73 20 77 69 74 |et confl|icts wit|
|000012b0| 68 20 6f 74 68 65 72 20 | 70 61 63 6b 61 67 65 73 |h other |packages|
|000012c0| 2c 20 79 6f 75 20 6d 69 | 67 68 74 20 68 61 76 65 |, you mi|ght have|
|000012d0| 20 74 6f 20 63 68 61 6e | 67 65 20 74 68 65 20 76 | to chan|ge the v|
|000012e0| 61 6c 75 65 73 0a 69 6e | 20 73 65 72 76 65 72 5b |alues.in| server[|
|000012f0| 5d 20 61 6e 64 20 63 6c | 69 65 6e 74 5b 5d 20 69 |] and cl|ient[] i|
|00001300| 6e 20 27 6e 69 2e 68 27 | 20 28 5b 31 5d 20 61 6e |n 'ni.h'| ([1] an|
|00001310| 64 20 5b 32 5d 29 0a 0a | 54 68 65 79 20 61 72 65 |d [2])..|They are|
|00001320| 20 63 75 72 72 65 6e 74 | 6c 79 20 73 65 74 20 74 | current|ly set t|
|00001330| 6f 20 30 78 30 32 20 30 | 78 30 32 20 2d 20 74 68 |o 0x02 0|x02 - th|
|00001340| 69 73 20 69 73 20 74 6f | 74 61 6c 6c 79 20 61 72 |is is to|tally ar|
|00001350| 62 69 74 72 61 72 79 2c | 0a 73 6f 20 66 65 65 6c |bitrary,|.so feel|
|00001360| 20 66 72 65 65 20 74 6f | 20 63 68 61 6e 67 65 20 | free to| change |
|00001370| 69 74 20 61 73 20 79 6f | 75 20 77 69 73 68 2e 0a |it as yo|u wish..|
|00001380| 54 68 65 20 72 65 73 74 | 20 6f 66 20 74 68 65 20 |The rest| of the |
|00001390| 62 79 74 65 73 20 69 6e | 20 73 65 72 76 65 72 5b |bytes in| server[|
|000013a0| 5d 20 61 6e 64 20 63 6c | 69 65 6e 74 5b 5d 20 77 |] and cl|ient[] w|
|000013b0| 69 6c 6c 20 62 65 20 4f | 4b 2e 0a 0a 52 45 4d 4f |ill be O|K...REMO|
|000013c0| 54 45 20 53 48 45 4c 4c | 20 54 45 52 4d 49 4e 41 |TE SHELL| TERMINA|
|000013d0| 54 49 4f 4e 3a 0a 49 66 | 20 74 68 65 20 72 65 6d |TION:.If| the rem|
|000013e0| 6f 74 65 20 73 68 65 6c | 6c 20 64 69 65 73 2c 20 |ote shel|l dies, |
|000013f0| 66 6f 72 20 61 6e 79 20 | 72 65 61 73 6f 6e 2c 20 |for any |reason, |
|00001400| 79 6f 75 20 77 6f 6e 27 | 74 20 62 65 20 69 6e 66 |you won'|t be inf|
|00001410| 6f 72 6d 65 64 20 75 6e | 74 69 6c 20 79 6f 75 20 |ormed un|til you |
|00001420| 0a 61 74 74 65 6d 70 74 | 20 74 6f 20 73 65 6e 64 |.attempt| to send|
|00001430| 20 69 74 20 73 6f 6d 65 | 20 69 6e 70 75 74 2e 0a | it some| input..|
|00001440| 0a 41 44 44 49 4e 47 20 | 46 45 41 54 55 52 45 53 |.ADDING |FEATURES|
|00001450| 2e 0a 49 66 20 79 6f 75 | 20 70 75 74 20 61 6e 79 |..If you| put any|
|00001460| 20 66 61 6e 63 79 20 62 | 69 74 73 20 69 6e 2c 20 | fancy b|its in, |
|00001470| 70 6c 65 61 73 65 20 6c | 65 74 20 6d 65 20 6b 6e |please l|et me kn|
|00001480| 6f 77 21 0a 0a 47 6f 6f | 64 20 6c 75 63 6b 21 0a |ow!..Goo|d luck!.|
|00001490| 0a 44 61 76 65 20 53 65 | 74 74 6c 65 2c 20 64 61 |.Dave Se|ttle, da|
|000014a0| 76 65 40 73 6d 62 2e 63 | 6f 2e 75 6b 0a 53 48 41 |ve@smb.c|o.uk.SHA|
|000014b0| 52 5f 45 4f 46 0a 69 66 | 20 74 65 73 74 20 34 31 |R_EOF.if| test 41|
|000014c0| 35 39 20 2d 6e 65 20 22 | 60 77 63 20 2d 63 20 3c |59 -ne "|`wc -c <|
|000014d0| 20 27 52 45 41 44 4d 45 | 27 60 22 0a 74 68 65 6e | 'README|'`".then|
|000014e0| 0a 09 65 63 68 6f 20 73 | 68 61 72 3a 20 22 65 72 |..echo s|har: "er|
|000014f0| 72 6f 72 20 74 72 61 6e | 73 6d 69 74 74 69 6e 67 |ror tran|smitting|
|00001500| 20 27 52 45 41 44 4d 45 | 27 22 20 27 28 73 68 6f | 'README|'" '(sho|
|00001510| 75 6c 64 20 68 61 76 65 | 20 62 65 65 6e 20 34 31 |uld have| been 41|
|00001520| 35 39 20 63 68 61 72 61 | 63 74 65 72 73 29 27 0a |59 chara|cters)'.|
|00001530| 66 69 0a 66 69 0a 65 63 | 68 6f 20 73 68 61 72 3a |fi.fi.ec|ho shar:|
|00001540| 20 22 65 78 74 72 61 63 | 74 69 6e 67 20 27 4d 61 | "extrac|ting 'Ma|
|00001550| 6b 65 66 69 6c 65 27 22 | 20 27 28 31 30 34 32 20 |kefile'"| '(1042 |
|00001560| 63 68 61 72 61 63 74 65 | 72 73 29 27 0a 69 66 20 |characte|rs)'.if |
|00001570| 74 65 73 74 20 2d 66 20 | 27 4d 61 6b 65 66 69 6c |test -f |'Makefil|
|00001580| 65 27 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |e'.then.|.echo sh|
|00001590| 61 72 3a 20 22 77 69 6c | 6c 20 6e 6f 74 20 6f 76 |ar: "wil|l not ov|
|000015a0| 65 72 2d 77 72 69 74 65 | 20 65 78 69 73 74 69 6e |er-write| existin|
|000015b0| 67 20 66 69 6c 65 20 27 | 4d 61 6b 65 66 69 6c 65 |g file '|Makefile|
|000015c0| 27 22 0a 65 6c 73 65 0a | 63 61 74 20 3c 3c 20 5c |'".else.|cat << \|
|000015d0| 53 48 41 52 5f 45 4f 46 | 20 3e 20 27 4d 61 6b 65 |SHAR_EOF| > 'Make|
|000015e0| 66 69 6c 65 27 0a 23 43 | 46 4c 41 47 53 20 3d 20 |file'.#C|FLAGS = |
|000015f0| 2d 67 0a 23 4c 49 42 53 | 20 3d 20 2d 6c 67 0a 23 |-g.#LIBS| = -lg.#|
|00001600| 0a 23 20 49 66 20 79 6f | 75 20 77 69 73 68 20 61 |.# If yo|u wish a|
|00001610| 20 53 45 43 55 52 45 20 | 76 65 72 73 69 6f 6e 20 | SECURE |version |
|00001620| 28 6e 6f 20 73 75 70 65 | 72 2d 75 73 65 72 20 73 |(no supe|r-user s|
|00001630| 65 72 76 65 72 20 70 72 | 6f 63 65 73 73 65 73 29 |erver pr|ocesses)|
|00001640| 2c 0a 23 20 64 65 66 69 | 6e 65 20 53 45 43 55 52 |,.# defi|ne SECUR|
|00001650| 45 2e 20 54 68 69 73 20 | 77 69 6c 6c 20 70 72 65 |E. This |will pre|
|00001660| 76 65 6e 74 20 72 6f 6f | 74 20 66 72 6f 6d 20 75 |vent roo|t from u|
|00001670| 73 69 6e 67 20 27 63 6f | 6e 6e 65 63 74 27 20 6f |sing 'co|nnect' o|
|00001680| 72 20 27 72 63 70 27 2e | 0a 23 0a 23 20 43 46 4c |r 'rcp'.|.#.# CFL|
|00001690| 41 47 53 20 3d 20 2d 4f | 20 2d 44 53 45 43 55 52 |AGS = -O| -DSECUR|
|000016a0| 45 0a 0a 53 45 52 56 45 | 52 20 3d 20 73 65 72 76 |E..SERVE|R = serv|
|000016b0| 65 72 2e 6f 20 65 74 68 | 2e 6f 20 69 70 61 64 64 |er.o eth|.o ipadd|
|000016c0| 72 2e 6f 20 74 61 6c 6b | 2e 6f 20 73 75 62 2e 6f |r.o talk|.o sub.o|
|000016d0| 20 66 69 6c 65 2e 6f 20 | 66 74 70 2e 6f 0a 43 4f | file.o |ftp.o.CO|
|000016e0| 4e 4e 45 43 54 20 3d 20 | 63 6f 6e 6e 65 63 74 2e |NNECT = |connect.|
|000016f0| 6f 20 65 74 68 2e 6f 20 | 74 65 72 6d 69 6e 61 74 |o eth.o |terminat|
|00001700| 65 2e 6f 20 69 70 61 64 | 64 72 2e 6f 0a 4d 59 4e |e.o ipad|dr.o.MYN|
|00001710| 4f 44 45 20 3d 20 6d 79 | 6e 6f 64 65 2e 6f 20 69 |ODE = my|node.o i|
|00001720| 70 61 64 64 72 2e 6f 0a | 52 43 50 20 3d 20 72 63 |paddr.o.|RCP = rc|
|00001730| 70 2e 6f 20 73 75 62 2e | 6f 20 69 70 61 64 64 72 |p.o sub.|o ipaddr|
|00001740| 2e 6f 20 65 74 68 2e 6f | 20 66 74 70 2e 6f 0a 0a |.o eth.o| ftp.o..|
|00001750| 44 4f 43 53 20 3d 20 52 | 45 41 44 4d 45 20 4d 61 |DOCS = R|EADME Ma|
|00001760| 6b 65 66 69 6c 65 20 63 | 6f 6e 6e 65 63 74 2e 31 |kefile c|onnect.1|
|00001770| 20 72 63 70 2e 31 0a 0a | 53 4f 55 52 43 45 53 20 | rcp.1..|SOURCES |
|00001780| 3d 20 73 65 72 76 65 72 | 2e 63 20 63 6f 6e 6e 65 |= server|.c conne|
|00001790| 63 74 2e 63 20 72 63 70 | 2e 63 20 65 74 68 2e 63 |ct.c rcp|.c eth.c|
|000017a0| 20 69 70 61 64 64 72 2e | 63 20 74 61 6c 6b 2e 63 | ipaddr.|c talk.c|
|000017b0| 20 5c 0a 09 73 75 62 2e | 63 20 66 69 6c 65 2e 63 | \..sub.|c file.c|
|000017c0| 20 74 65 72 6d 69 6e 61 | 74 65 2e 63 20 6d 79 6e | termina|te.c myn|
|000017d0| 6f 64 65 2e 63 20 66 74 | 70 2e 63 20 6e 69 2e 68 |ode.c ft|p.c ni.h|
|000017e0| 20 66 74 70 2e 68 0a 0a | 61 6c 6c 3a 20 73 65 72 | ftp.h..|all: ser|
|000017f0| 76 65 72 20 63 6f 6e 6e | 65 63 74 20 6d 79 6e 6f |ver conn|ect myno|
|00001800| 64 65 20 72 63 70 0a 0a | 6c 69 6e 74 3a 20 0a 09 |de rcp..|lint: ..|
|00001810| 6c 69 6e 74 20 24 7b 53 | 45 52 56 45 52 3a 2e 6f |lint ${S|ERVER:.o|
|00001820| 3d 2e 63 7d 0a 09 6c 69 | 6e 74 20 24 7b 43 4f 4e |=.c}..li|nt ${CON|
|00001830| 4e 45 43 54 3a 2e 6f 3d | 2e 63 7d 0a 09 6c 69 6e |NECT:.o=|.c}..lin|
|00001840| 74 20 24 7b 52 43 50 3a | 2e 6f 3d 2e 63 7d 0a 0a |t ${RCP:|.o=.c}..|
|00001850| 24 7b 53 45 52 56 45 52 | 7d 20 24 7b 43 4f 4e 4e |${SERVER|} ${CONN|
|00001860| 45 43 54 7d 20 24 7b 52 | 43 50 7d 20 3a 20 6e 69 |ECT} ${R|CP} : ni|
|00001870| 2e 68 0a 0a 72 63 70 2e | 6f 20 66 74 70 2e 6f 20 |.h..rcp.|o ftp.o |
|00001880| 66 69 6c 65 2e 6f 20 3a | 20 66 74 70 2e 68 0a 0a |file.o :| ftp.h..|
|00001890| 73 65 72 76 65 72 3a 20 | 24 7b 53 45 52 56 45 52 |server: |${SERVER|
|000018a0| 7d 0a 09 63 63 20 2d 6f | 20 73 65 72 76 65 72 20 |}..cc -o| server |
|000018b0| 24 7b 53 45 52 56 45 52 | 7d 20 24 7b 4c 49 42 53 |${SERVER|} ${LIBS|
|000018c0| 7d 0a 09 0a 63 6f 6e 6e | 65 63 74 3a 20 24 7b 43 |}...conn|ect: ${C|
|000018d0| 4f 4e 4e 45 43 54 7d 0a | 09 63 63 20 2d 6f 20 63 |ONNECT}.|.cc -o c|
|000018e0| 6f 6e 6e 65 63 74 20 24 | 7b 43 4f 4e 4e 45 43 54 |onnect $|{CONNECT|
|000018f0| 7d 20 24 7b 4c 49 42 53 | 7d 0a 09 0a 72 63 70 3a |} ${LIBS|}...rcp:|
|00001900| 20 24 7b 52 43 50 7d 0a | 09 63 63 20 2d 6f 20 72 | ${RCP}.|.cc -o r|
|00001910| 63 70 20 24 7b 52 43 50 | 7d 20 24 7b 4c 49 42 53 |cp ${RCP|} ${LIBS|
|00001920| 7d 0a 0a 6d 79 6e 6f 64 | 65 3a 20 24 7b 4d 59 4e |}..mynod|e: ${MYN|
|00001930| 4f 44 45 7d 0a 09 63 63 | 20 2d 6f 20 6d 79 6e 6f |ODE}..cc| -o myno|
|00001940| 64 65 20 24 7b 4d 59 4e | 4f 44 45 7d 20 24 7b 4c |de ${MYN|ODE} ${L|
|00001950| 49 42 53 7d 0a 0a 73 68 | 61 72 3a 0a 09 73 68 61 |IBS}..sh|ar:..sha|
|00001960| 72 20 2d 63 76 20 24 7b | 44 4f 43 53 7d 20 24 7b |r -cv ${|DOCS} ${|
|00001970| 53 4f 55 52 43 45 53 7d | 20 3e 20 63 6f 6e 6e 65 |SOURCES}| > conne|
|00001980| 63 74 2e 73 68 61 72 0a | 0a 69 6e 73 74 61 6c 6c |ct.shar.|.install|
|00001990| 3a 0a 09 69 66 20 5b 20 | 2d 66 20 2f 75 73 72 2f |:..if [ |-f /usr/|
|000019a0| 6c 69 62 2f 73 65 72 76 | 65 72 20 5d 20 3b 20 74 |lib/serv|er ] ; t|
|000019b0| 68 65 6e 20 5c 0a 09 09 | 6d 76 20 2f 75 73 72 2f |hen \...|mv /usr/|
|000019c0| 6c 69 62 2f 73 65 72 76 | 65 72 20 2f 75 73 72 2f |lib/serv|er /usr/|
|000019d0| 6c 69 62 2f 73 65 72 76 | 65 72 2e 6f 6c 64 20 3b |lib/serv|er.old ;|
|000019e0| 20 66 69 0a 09 63 70 20 | 73 65 72 76 65 72 20 2f | fi..cp |server /|
|000019f0| 75 73 72 2f 6c 69 62 0a | 53 48 41 52 5f 45 4f 46 |usr/lib.|SHAR_EOF|
|00001a00| 0a 69 66 20 74 65 73 74 | 20 31 30 34 32 20 2d 6e |.if test| 1042 -n|
|00001a10| 65 20 22 60 77 63 20 2d | 63 20 3c 20 27 4d 61 6b |e "`wc -|c < 'Mak|
|00001a20| 65 66 69 6c 65 27 60 22 | 0a 74 68 65 6e 0a 09 65 |efile'`"|.then..e|
|00001a30| 63 68 6f 20 73 68 61 72 | 3a 20 22 65 72 72 6f 72 |cho shar|: "error|
|00001a40| 20 74 72 61 6e 73 6d 69 | 74 74 69 6e 67 20 27 4d | transmi|tting 'M|
|00001a50| 61 6b 65 66 69 6c 65 27 | 22 20 27 28 73 68 6f 75 |akefile'|" '(shou|
|00001a60| 6c 64 20 68 61 76 65 20 | 62 65 65 6e 20 31 30 34 |ld have |been 104|
|00001a70| 32 20 63 68 61 72 61 63 | 74 65 72 73 29 27 0a 66 |2 charac|ters)'.f|
|00001a80| 69 0a 66 69 0a 65 63 68 | 6f 20 73 68 61 72 3a 20 |i.fi.ech|o shar: |
|00001a90| 22 65 78 74 72 61 63 74 | 69 6e 67 20 27 63 6f 6e |"extract|ing 'con|
|00001aa0| 6e 65 63 74 2e 31 27 22 | 20 27 28 33 35 34 37 20 |nect.1'"| '(3547 |
|00001ab0| 63 68 61 72 61 63 74 65 | 72 73 29 27 0a 69 66 20 |characte|rs)'.if |
|00001ac0| 74 65 73 74 20 2d 66 20 | 27 63 6f 6e 6e 65 63 74 |test -f |'connect|
|00001ad0| 2e 31 27 0a 74 68 65 6e | 0a 09 65 63 68 6f 20 73 |.1'.then|..echo s|
|00001ae0| 68 61 72 3a 20 22 77 69 | 6c 6c 20 6e 6f 74 20 6f |har: "wi|ll not o|
|00001af0| 76 65 72 2d 77 72 69 74 | 65 20 65 78 69 73 74 69 |ver-writ|e existi|
|00001b00| 6e 67 20 66 69 6c 65 20 | 27 63 6f 6e 6e 65 63 74 |ng file |'connect|
|00001b10| 2e 31 27 22 0a 65 6c 73 | 65 0a 63 61 74 20 3c 3c |.1'".els|e.cat <<|
|00001b20| 20 5c 53 48 41 52 5f 45 | 4f 46 20 3e 20 27 63 6f | \SHAR_E|OF > 'co|
|00001b30| 6e 6e 65 63 74 2e 31 27 | 0a 2e 54 48 20 43 4f 4e |nnect.1'|..TH CON|
|00001b40| 4e 45 43 54 20 31 20 6c | 6f 63 61 6c 0a 2e 53 48 |NECT 1 l|ocal..SH|
|00001b50| 20 4e 41 4d 45 0a 63 6f | 6e 6e 65 63 74 0a 2e 53 | NAME.co|nnect..S|
|00001b60| 48 20 53 59 4e 4f 50 53 | 49 53 0a 2e 42 20 22 63 |H SYNOPS|IS..B "c|
|00001b70| 6f 6e 6e 65 63 74 20 5b | 2d 6c 5d 20 72 65 6d 6f |onnect [|-l] remo|
|00001b80| 74 65 5f 68 6f 73 74 22 | 0a 2e 50 50 0a 2e 53 48 |te_host"|..PP..SH|
|00001b90| 20 44 45 53 43 52 49 50 | 54 49 4f 4e 0a 2e 49 20 | DESCRIP|TION..I |
|00001ba0| 63 6f 6e 6e 65 63 74 0a | 61 6c 6c 6f 77 73 20 79 |connect.|allows y|
|00001bb0| 6f 75 20 74 6f 20 63 6f | 6e 6e 65 63 74 20 74 6f |ou to co|nnect to|
|00001bc0| 20 61 20 72 65 6d 6f 74 | 65 20 68 6f 73 74 20 63 | a remot|e host c|
|00001bd0| 6f 6e 6e 65 63 74 65 64 | 20 76 69 61 20 33 42 4e |onnected| via 3BN|
|00001be0| 45 54 2c 20 61 6e 64 20 | 74 6f 20 73 74 61 72 74 |ET, and |to start|
|00001bf0| 20 61 0a 72 65 6d 6f 74 | 65 20 73 68 65 6c 6c 20 | a.remot|e shell |
|00001c00| 6f 6e 20 74 68 61 74 20 | 6d 61 63 68 69 6e 65 2e |on that |machine.|
|00001c10| 20 54 68 65 20 73 68 65 | 6c 6c 20 73 74 61 72 74 | The she|ll start|
|00001c20| 65 64 20 69 73 20 74 68 | 65 20 6f 6e 65 20 73 70 |ed is th|e one sp|
|00001c30| 65 63 69 66 69 65 64 20 | 62 79 20 0a 79 6f 75 72 |ecified |by .your|
|00001c40| 20 53 48 45 4c 4c 20 76 | 61 72 69 61 62 6c 65 2c | SHELL v|ariable,|
|00001c50| 20 6f 72 20 22 2f 62 69 | 6e 2f 73 68 22 20 69 66 | or "/bi|n/sh" if|
|00001c60| 20 74 68 69 73 20 69 73 | 20 6e 6f 74 20 73 65 74 | this is| not set|
|00001c70| 2e 0a 2e 50 50 0a 49 6e | 69 74 69 61 6c 6c 79 2c |...PP.In|itially,|
|00001c80| 20 61 6c 6c 20 74 68 65 | 20 65 63 68 6f 69 6e 67 | all the| echoing|
|00001c90| 20 69 73 20 64 6f 6e 65 | 20 62 79 20 74 68 65 20 | is done| by the |
|00001ca0| 6c 6f 63 61 6c 20 6d 61 | 63 68 69 6e 65 2c 20 61 |local ma|chine, a|
|00001cb0| 6e 64 20 69 6e 70 75 74 | 20 69 73 20 0a 74 72 61 |nd input| is .tra|
|00001cc0| 6e 73 6d 69 74 74 65 64 | 20 6c 69 6e 65 20 62 79 |nsmitted| line by|
|00001cd0| 20 6c 69 6e 65 20 28 63 | 6f 6f 6b 65 64 20 6d 6f | line (c|ooked mo|
|00001ce0| 64 65 29 2e 20 49 66 20 | 79 6f 75 20 77 69 73 68 |de). If |you wish|
|00001cf0| 20 74 68 65 20 72 65 6d | 6f 74 65 20 6d 61 63 68 | the rem|ote mach|
|00001d00| 69 6e 65 20 74 6f 0a 64 | 6f 20 74 68 65 20 65 63 |ine to.d|o the ec|
|00001d10| 68 6f 69 6e 67 20 28 65 | 2e 67 2e 20 79 6f 75 27 |hoing (e|.g. you'|
|00001d20| 72 65 20 72 75 6e 6e 69 | 6e 67 20 61 20 73 63 72 |re runni|ng a scr|
|00001d30| 65 65 6e 20 65 64 69 74 | 6f 72 20 74 68 65 72 65 |een edit|or there|
|00001d40| 29 2c 20 79 6f 75 20 6d | 75 73 74 20 70 75 74 0a |), you m|ust put.|
|00001d50| 79 6f 75 72 20 74 65 72 | 6d 69 6e 61 6c 20 69 6e |your ter|minal in|
|00001d60| 20 72 61 77 20 6d 6f 64 | 65 2c 20 62 79 20 73 65 | raw mod|e, by se|
|00001d70| 6e 64 69 6e 67 20 61 20 | 51 55 49 54 20 73 69 67 |nding a |QUIT sig|
|00001d80| 6e 61 6c 2e 0a 2e 50 50 | 0a 49 6e 20 72 61 77 20 |nal...PP|.In raw |
|00001d90| 6d 6f 64 65 2c 20 65 61 | 63 68 20 63 68 61 72 61 |mode, ea|ch chara|
|00001da0| 63 74 65 72 20 69 73 20 | 73 65 6e 64 20 61 73 20 |cter is |send as |
|00001db0| 73 6f 6f 6e 20 61 73 20 | 69 74 20 69 73 20 74 79 |soon as |it is ty|
|00001dc0| 70 65 64 2c 20 61 6e 64 | 20 6e 6f 20 65 63 68 6f |ped, and| no echo|
|00001dd0| 69 6e 67 0a 69 73 20 70 | 65 72 66 6f 72 6d 65 64 |ing.is p|erformed|
|00001de0| 20 62 79 20 74 68 65 20 | 6c 6f 63 61 6c 20 6d 61 | by the |local ma|
|00001df0| 63 68 69 6e 65 2e 20 41 | 20 66 75 72 74 68 65 72 |chine. A| further|
|00001e00| 20 51 55 49 54 20 73 69 | 67 6e 61 6c 20 77 69 6c | QUIT si|gnal wil|
|00001e10| 6c 20 72 65 76 65 72 74 | 20 74 6f 0a 63 6f 6f 6b |l revert| to.cook|
|00001e20| 65 64 20 6d 6f 64 65 20 | 61 67 61 69 6e 20 28 69 |ed mode |again (i|
|00001e30| 2e 65 2e 20 51 55 49 54 | 20 63 61 6e 20 62 65 20 |.e. QUIT| can be |
|00001e40| 75 73 65 64 20 74 6f 20 | 74 6f 67 67 6c 65 20 62 |used to |toggle b|
|00001e50| 65 74 77 65 65 6e 20 72 | 61 77 20 61 6e 64 20 63 |etween r|aw and c|
|00001e60| 6f 6f 6b 65 64 20 6d 6f | 64 65 73 29 0a 2e 50 50 |ooked mo|des)..PP|
|00001e70| 0a 54 68 65 20 63 6f 6e | 6e 65 63 74 69 6f 6e 20 |.The con|nection |
|00001e80| 63 61 6e 20 62 65 20 63 | 6c 6f 73 65 64 20 62 79 |can be c|losed by|
|00001e90| 20 74 79 70 69 6e 67 20 | 45 4f 54 20 69 6e 20 63 | typing |EOT in c|
|00001ea0| 6f 6f 6b 65 64 20 6d 6f | 64 65 2e 0a 2e 50 50 0a |ooked mo|de...PP.|
|00001eb0| 2e 53 48 20 22 4c 4f 47 | 49 4e 20 4f 50 54 49 4f |.SH "LOG|IN OPTIO|
|00001ec0| 4e 22 0a 2e 50 50 0a 49 | 66 20 74 68 65 20 5c 66 |N"..PP.I|f the \f|
|00001ed0| 42 2d 6c 5c 66 52 20 6f | 70 74 69 6f 6e 20 69 73 |B-l\fR o|ption is|
|00001ee0| 20 73 70 65 63 69 66 69 | 65 64 2c 20 61 6e 64 20 | specifi|ed, and |
|00001ef0| 69 66 20 50 43 2d 49 4e | 54 45 52 46 41 43 45 20 |if PC-IN|TERFACE |
|00001f00| 69 73 20 69 6e 73 74 61 | 6c 6c 65 64 20 6f 6e 20 |is insta|lled on |
|00001f10| 74 68 65 0a 72 65 6d 6f | 74 65 20 68 6f 73 74 2c |the.remo|te host,|
|00001f20| 20 74 68 65 6e 20 79 6f | 75 20 77 69 6c 6c 20 62 | then yo|u will b|
|00001f30| 65 20 63 6f 6e 6e 65 63 | 74 65 64 20 74 6f 20 6f |e connec|ted to o|
|00001f40| 6e 65 20 6f 66 20 74 68 | 65 20 70 73 65 75 64 6f |ne of th|e pseudo|
|00001f50| 2d 74 74 79 73 20 73 75 | 70 70 6f 72 74 65 64 0a |-ttys su|pported.|
|00001f60| 62 79 20 64 72 69 76 65 | 72 2e 0a 2e 50 50 0a 54 |by drive|r...PP.T|
|00001f70| 68 69 73 20 6f 70 74 69 | 6f 6e 20 67 69 76 65 73 |his opti|on gives|
|00001f80| 20 79 6f 75 20 61 20 72 | 65 6d 6f 74 65 20 63 6f | you a r|emote co|
|00001f90| 6e 6e 65 63 74 69 6f 6e | 20 77 68 69 63 68 20 6c |nnection| which l|
|00001fa0| 6f 6f 6b 73 20 6d 6f 72 | 65 20 6c 69 6b 65 20 61 |ooks mor|e like a|
|00001fb0| 20 64 69 72 65 63 74 0a | 74 74 79 20 6c 69 6e 6b | direct.|tty link|
|00001fc0| 2c 20 61 6e 64 20 61 75 | 74 6f 6d 61 74 69 63 61 |, and au|tomatica|
|00001fd0| 6c 6c 79 20 70 75 74 73 | 20 79 6f 75 20 69 6e 20 |lly puts| you in |
|00001fe0| 27 72 61 77 27 20 6d 6f | 64 65 2e 20 0a 2e 50 50 |'raw' mo|de. ..PP|
|00001ff0| 0a 4f 6e 20 74 68 65 20 | 6f 74 68 65 72 20 68 61 |.On the |other ha|
|00002000| 6e 64 2c 20 79 6f 75 20 | 68 61 76 65 20 74 6f 20 |nd, you |have to |
|00002010| 67 6f 20 74 68 72 6f 75 | 67 68 20 61 6c 6c 20 74 |go throu|gh all t|
|00002020| 68 65 20 62 6f 74 68 65 | 72 20 6f 66 20 6c 6f 67 |he bothe|r of log|
|00002030| 67 69 6e 67 20 6f 6e 2c | 0a 77 68 69 63 68 20 74 |ging on,|.which t|
|00002040| 61 6b 65 73 20 6d 6f 72 | 65 20 74 69 6d 65 2e 0a |akes mor|e time..|
|00002050| 2e 50 50 0a 55 73 69 6e | 67 20 74 68 65 20 5c 66 |.PP.Usin|g the \f|
|00002060| 42 2d 69 5c 66 52 20 6f | 70 74 69 6f 6e 20 5c 66 |B-i\fR o|ption \f|
|00002070| 42 6f 6e 6c 79 5c 66 52 | 2c 20 74 68 65 20 63 6f |Bonly\fR|, the co|
|00002080| 6e 6e 65 63 74 69 6f 6e | 20 69 73 20 63 6c 6f 73 |nnection| is clos|
|00002090| 65 64 20 62 79 20 61 20 | 51 55 49 54 0a 73 69 67 |ed by a |QUIT.sig|
|000020a0| 6e 61 6c 2e 0a 2e 53 48 | 20 53 45 43 55 52 49 54 |nal...SH| SECURIT|
|000020b0| 59 0a 54 68 65 20 72 65 | 6d 6f 74 65 20 73 65 72 |Y.The re|mote ser|
|000020c0| 76 65 72 20 77 69 6c 6c | 20 6f 6e 6c 79 20 61 63 |ver will| only ac|
|000020d0| 63 65 70 74 20 61 20 72 | 65 71 75 65 73 74 20 74 |cept a r|equest t|
|000020e0| 6f 20 73 74 61 72 74 20 | 61 20 73 68 65 6c 6c 20 |o start |a shell |
|000020f0| 69 66 20 79 6f 75 72 20 | 6c 6f 67 69 6e 0a 6e 61 |if your |login.na|
|00002100| 6d 65 20 69 73 20 6b 6e | 6f 77 6e 20 6f 6e 20 74 |me is kn|own on t|
|00002110| 68 65 20 72 65 6d 6f 74 | 65 20 6d 61 63 68 69 6e |he remot|e machin|
|00002120| 65 2c 20 61 6e 64 20 79 | 6f 75 72 20 72 65 6d 6f |e, and y|our remo|
|00002130| 74 65 20 75 69 64 20 6d | 61 74 63 68 65 73 20 79 |te uid m|atches y|
|00002140| 6f 75 72 20 6c 6f 63 61 | 6c 20 75 69 64 2e 0a 2e |our loca|l uid...|
|00002150| 50 50 0a 54 68 65 20 75 | 69 64 20 75 73 65 64 20 |PP.The u|id used |
|00002160| 74 6f 20 73 74 61 72 74 | 20 74 68 65 20 72 65 6d |to start| the rem|
|00002170| 6f 74 65 20 70 72 6f 63 | 65 73 73 20 69 73 20 79 |ote proc|ess is y|
|00002180| 6f 75 72 20 5c 66 42 72 | 65 61 6c 5c 66 52 20 75 |our \fBr|eal\fR u|
|00002190| 69 64 2c 20 6e 6f 74 20 | 79 6f 75 72 0a 65 66 66 |id, not |your.eff|
|000021a0| 65 63 74 69 76 65 20 75 | 69 64 2c 20 73 6f 20 74 |ective u|id, so t|
|000021b0| 68 61 74 20 65 76 65 6e | 20 69 66 20 79 6f 75 27 |hat even| if you'|
|000021c0| 72 65 20 72 75 6e 6e 69 | 6e 67 20 73 75 28 31 29 |re runni|ng su(1)|
|000021d0| 2c 20 79 6f 75 72 20 72 | 65 6d 6f 74 65 20 70 72 |, your r|emote pr|
|000021e0| 6f 63 65 73 73 0a 77 69 | 6c 6c 20 6e 6f 74 20 62 |ocess.wi|ll not b|
|000021f0| 65 20 72 6f 6f 74 2e 0a | 2e 50 50 0a 54 68 65 20 |e root..|.PP.The |
|00002200| 6f 6e 6c 79 20 77 61 79 | 20 79 6f 75 20 63 61 6e |only way| you can|
|00002210| 20 6c 6f 67 69 6e 20 74 | 6f 20 61 20 72 65 6d 6f | login t|o a remo|
|00002220| 74 65 20 6d 61 63 68 69 | 6e 65 20 61 73 20 72 6f |te machi|ne as ro|
|00002230| 6f 74 2c 20 69 73 20 74 | 6f 20 6c 6f 67 69 6e 20 |ot, is t|o login |
|00002240| 74 6f 20 79 6f 75 72 0a | 6c 6f 63 61 6c 20 6d 61 |to your.|local ma|
|00002250| 63 68 69 6e 65 20 61 73 | 20 72 6f 6f 74 20 28 6f |chine as| root (o|
|00002260| 6e 20 74 68 65 20 63 6f | 6e 73 6f 6c 65 29 2c 20 |n the co|nsole), |
|00002270| 61 6e 64 20 5c 66 49 63 | 6f 6e 6e 65 63 74 5c 66 |and \fIc|onnect\f|
|00002280| 52 20 66 72 6f 6d 20 74 | 68 65 72 65 2e 0a 2e 50 |R from t|here...P|
|00002290| 50 0a 57 68 65 6e 20 74 | 68 65 20 72 65 6d 6f 74 |P.When t|he remot|
|000022a0| 65 20 70 72 6f 63 65 73 | 73 20 69 74 20 73 74 61 |e proces|s it sta|
|000022b0| 72 74 65 64 2c 20 69 74 | 20 77 69 6c 6c 20 68 61 |rted, it| will ha|
|000022c0| 76 65 20 79 6f 75 72 20 | 75 69 64 2c 20 74 68 65 |ve your |uid, the|
|000022d0| 20 67 69 64 20 61 73 73 | 6f 73 63 69 61 74 65 64 | gid ass|osciated|
|000022e0| 0a 77 69 74 68 20 74 68 | 65 20 5c 66 42 72 65 6d |.with th|e \fBrem|
|000022f0| 6f 74 65 5c 66 52 20 75 | 69 64 2c 20 61 6e 64 20 |ote\fR u|id, and |
|00002300| 77 69 6c 6c 20 62 65 20 | 6c 6f 63 61 74 65 64 20 |will be |located |
|00002310| 69 6e 20 79 6f 75 72 20 | 72 65 6d 6f 74 65 20 68 |in your |remote h|
|00002320| 6f 6d 65 20 64 69 72 65 | 63 74 6f 72 79 2e 0a 2e |ome dire|ctory...|
|00002330| 53 48 20 22 48 4f 53 54 | 20 4d 41 50 50 49 4e 47 |SH "HOST| MAPPING|
|00002340| 22 0a 54 68 65 20 6d 61 | 70 70 69 6e 67 20 62 65 |".The ma|pping be|
|00002350| 74 77 65 65 6e 20 68 6f | 73 74 20 6e 61 6d 65 73 |tween ho|st names|
|00002360| 20 61 6e 64 20 65 74 68 | 65 72 6e 65 74 20 61 64 | and eth|ernet ad|
|00002370| 64 72 65 73 73 65 73 20 | 69 73 20 64 65 66 69 6e |dresses |is defin|
|00002380| 65 64 20 69 6e 20 74 68 | 65 0a 66 69 6c 65 20 27 |ed in th|e.file '|
|00002390| 2f 75 73 72 2f 6c 69 62 | 2f 65 74 68 65 72 6e 65 |/usr/lib|/etherne|
|000023a0| 74 2e 61 64 64 72 27 2e | 0a 2e 50 50 0a 54 68 65 |t.addr'.|..PP.The|
|000023b0| 20 66 6f 72 6d 61 74 20 | 6f 66 20 74 68 65 20 66 | format |of the f|
|000023c0| 69 6c 65 20 69 73 3a 0a | 2e 50 50 0a 09 09 3c 68 |ile is:.|.PP...<h|
|000023d0| 6f 73 74 6e 61 6d 65 3e | 20 3c 49 44 3e 0a 2e 50 |ostname>| <ID>..P|
|000023e0| 50 0a 65 2e 67 2e 0a 2e | 50 50 0a 09 09 6f 6c 69 |P.e.g...|PP...oli|
|000023f0| 76 65 09 34 35 0a 09 09 | 6f 73 63 61 72 09 66 32 |ve.45...|oscar.f2|
|00002400| 0a 2e 50 50 0a 41 73 20 | 73 68 69 70 70 65 64 2c |..PP.As |shipped,|
|00002410| 20 74 68 65 20 70 61 63 | 6b 61 67 65 20 65 78 70 | the pac|kage exp|
|00002420| 65 63 74 73 20 65 61 63 | 68 20 68 6f 73 74 20 74 |ects eac|h host t|
|00002430| 6f 20 68 61 76 65 20 61 | 20 70 68 79 73 69 63 61 |o have a| physica|
|00002440| 6c 20 65 74 68 65 72 6e | 65 74 0a 61 64 64 72 65 |l ethern|et.addre|
|00002450| 73 73 20 77 68 69 63 68 | 20 69 73 20 75 6e 69 71 |ss which| is uniq|
|00002460| 75 65 20 5c 66 42 69 6e | 20 74 68 65 20 6c 61 73 |ue \fBin| the las|
|00002470| 74 20 28 6c 73 62 29 20 | 62 79 74 65 5c 66 52 2e |t (lsb) |byte\fR.|
|00002480| 0a 2e 50 50 0a 54 68 65 | 20 61 64 64 72 65 73 73 |..PP.The| address|
|00002490| 65 73 20 77 68 69 63 68 | 20 61 72 65 20 75 73 65 |es which| are use|
|000024a0| 64 20 61 72 65 3a 0a 2e | 50 50 0a 09 09 58 58 2e |d are:..|PP...XX.|
|000024b0| 59 59 2e 59 59 2e 30 30 | 2e 30 30 2e 48 48 09 53 |YY.YY.00|.00.HH.S|
|000024c0| 65 72 76 65 72 0a 09 09 | 58 58 2e 59 59 2e 59 59 |erver...|XX.YY.YY|
|000024d0| 2e 50 49 44 2e 50 49 44 | 2e 48 48 09 43 6c 69 65 |.PID.PID|.HH.Clie|
|000024e0| 6e 74 2f 52 65 6d 6f 74 | 65 20 50 72 6f 63 65 73 |nt/Remot|e Proces|
|000024f0| 73 2e 0a 2e 50 50 0a 54 | 68 65 20 76 61 6c 75 65 |s...PP.T|he value|
|00002500| 73 20 6f 66 20 58 58 20 | 61 6e 64 20 59 59 20 61 |s of XX |and YY a|
|00002510| 72 65 20 74 6f 74 61 6c | 6c 79 20 61 72 62 69 74 |re total|ly arbit|
|00002520| 72 61 72 79 2c 20 61 6e | 64 20 79 6f 75 20 63 61 |rary, an|d you ca|
|00002530| 6e 20 63 68 61 6e 67 65 | 20 74 68 65 6d 20 69 66 |n change| them if|
|00002540| 0a 79 6f 75 20 77 69 73 | 68 2e 20 54 68 65 20 76 |.you wis|h. The v|
|00002550| 61 6c 75 65 20 6f 66 20 | 48 48 20 6d 75 73 74 20 |alue of |HH must |
|00002560| 62 65 20 64 69 66 66 65 | 72 65 6e 74 20 66 6f 72 |be diffe|rent for|
|00002570| 20 65 61 63 68 20 68 6f | 73 74 2c 20 61 6e 64 20 | each ho|st, and |
|00002580| 69 73 20 74 61 6b 65 6e | 20 66 72 6f 6d 0a 74 68 |is taken| from.th|
|00002590| 65 20 4c 53 42 20 6f 66 | 20 74 68 65 20 68 6f 73 |e LSB of| the hos|
|000025a0| 74 20 70 68 79 73 69 63 | 61 6c 20 65 74 68 65 72 |t physic|al ether|
|000025b0| 6e 65 74 20 61 64 64 72 | 65 73 73 2e 20 49 66 20 |net addr|ess. If |
|000025c0| 74 68 69 73 20 64 6f 65 | 73 20 6e 6f 74 20 70 72 |this doe|s not pr|
|000025d0| 6f 64 75 63 65 0a 61 20 | 75 6e 69 71 75 65 20 76 |oduce.a |unique v|
|000025e0| 61 6c 75 65 20 66 6f 72 | 20 65 61 63 68 20 73 65 |alue for| each se|
|000025f0| 72 76 65 72 2c 20 74 68 | 65 6e 20 79 6f 75 20 63 |rver, th|en you c|
|00002600| 61 6e 20 63 68 6f 6f 73 | 65 20 74 6f 20 74 61 6b |an choos|e to tak|
|00002610| 65 20 69 74 20 66 72 6f | 6d 20 61 6e 79 20 6f 74 |e it fro|m any ot|
|00002620| 68 65 72 0a 62 79 74 65 | 20 6f 66 20 74 68 65 20 |her.byte| of the |
|00002630| 70 68 79 73 69 63 61 6c | 20 61 64 64 72 65 73 73 |physical| address|
|00002640| 2c 20 62 79 20 72 65 64 | 65 66 69 6e 69 6e 67 20 |, by red|efining |
|00002650| 4c 53 42 20 28 6e 69 2e | 68 29 20 74 6f 20 70 69 |LSB (ni.|h) to pi|
|00002660| 63 6b 20 61 6e 79 20 6f | 74 68 65 72 20 62 79 74 |ck any o|ther byt|
|00002670| 65 2e 0a 2e 53 48 20 45 | 58 41 4d 50 4c 45 53 0a |e...SH E|XAMPLES.|
|00002680| 2e 50 50 0a 63 6f 6e 6e | 65 63 74 20 2d 6c 20 6f |.PP.conn|ect -l o|
|00002690| 6c 69 76 65 0a 2e 50 50 | 0a 43 6f 6e 6e 65 63 74 |live..PP|.Connect|
|000026a0| 20 74 6f 20 61 20 50 43 | 2d 49 4e 54 45 52 46 41 | to a PC|-INTERFA|
|000026b0| 43 45 20 70 73 65 75 64 | 6f 2d 74 74 79 20 6f 6e |CE pseud|o-tty on|
|000026c0| 20 68 6f 73 74 20 27 6f | 6c 69 76 65 27 2e 0a 2e | host 'o|live'...|
|000026d0| 50 50 0a 63 6f 6e 6e 65 | 63 74 20 6f 73 63 61 72 |PP.conne|ct oscar|
|000026e0| 0a 2e 50 50 0a 43 6f 6e | 6e 65 63 74 20 74 6f 20 |..PP.Con|nect to |
|000026f0| 61 20 72 65 6d 6f 74 65 | 20 73 68 65 6c 6c 20 6f |a remote| shell o|
|00002700| 6e 20 68 6f 73 74 20 27 | 6f 73 63 61 72 27 0a 2e |n host '|oscar'..|
|00002710| 50 50 0a 2e 53 48 20 46 | 49 4c 45 53 0a 2f 64 65 |PP..SH F|ILES./de|
|00002720| 76 2f 6e 69 09 09 09 09 | 45 74 68 65 72 6e 65 74 |v/ni....|Ethernet|
|00002730| 20 69 6e 74 65 72 66 61 | 63 65 2e 0a 2e 50 50 0a | interfa|ce...PP.|
|00002740| 2f 64 65 76 2f 70 74 74 | 79 3f 3f 09 09 09 50 43 |/dev/ptt|y??...PC|
|00002750| 2d 49 4e 54 45 52 46 41 | 43 45 20 70 73 65 75 64 |-INTERFA|CE pseud|
|00002760| 6f 2d 74 74 79 73 0a 2e | 50 50 0a 2f 75 73 72 2f |o-ttys..|PP./usr/|
|00002770| 6c 69 62 2f 65 74 68 65 | 72 6e 65 74 2e 61 64 64 |lib/ethe|rnet.add|
|00002780| 09 09 4c 69 73 74 20 6f | 66 20 68 6f 73 74 73 2e |..List o|f hosts.|
|00002790| 0a 2e 50 50 0a 2e 53 48 | 20 53 45 45 20 41 4c 53 |..PP..SH| SEE ALS|
|000027a0| 4f 0a 2e 53 48 20 42 55 | 47 53 0a 59 6f 75 20 63 |O..SH BU|GS.You c|
|000027b0| 61 6e 27 74 20 73 65 6e | 64 20 51 55 49 54 20 73 |an't sen|d QUIT s|
|000027c0| 69 67 6e 61 6c 73 20 74 | 6f 20 72 65 6d 6f 74 65 |ignals t|o remote|
|000027d0| 20 70 72 6f 63 65 73 73 | 65 73 2c 20 27 63 6f 73 | process|es, 'cos|
|000027e0| 20 51 55 49 54 20 64 6f | 65 73 20 76 61 72 69 6f | QUIT do|es vario|
|000027f0| 75 73 20 74 68 69 6e 67 | 73 0a 74 6f 20 74 68 65 |us thing|s.to the|
|00002800| 20 63 6f 6e 6e 65 63 74 | 69 6f 6e 2e 0a 2e 50 50 | connect|ion...PP|
|00002810| 0a 54 68 65 20 76 61 6c | 75 65 73 20 6f 66 20 58 |.The val|ues of X|
|00002820| 58 20 61 6e 64 20 59 59 | 20 6d 61 79 20 63 6f 6e |X and YY| may con|
|00002830| 66 6c 69 63 74 20 77 69 | 74 68 20 6f 74 68 65 72 |flict wi|th other|
|00002840| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 73 2e 0a 2e | applica|tions...|
|00002850| 50 50 0a 54 68 65 72 65 | 27 73 20 6e 6f 20 67 75 |PP.There|'s no gu|
|00002860| 61 72 61 6e 74 65 65 20 | 74 68 61 74 20 79 6f 75 |arantee |that you|
|00002870| 20 63 61 6e 20 67 65 74 | 20 61 20 75 6e 69 71 75 | can get| a uniqu|
|00002880| 65 20 68 6f 73 74 20 49 | 44 20 75 73 69 6e 67 20 |e host I|D using |
|00002890| 6f 6e 6c 79 20 6f 6e 65 | 20 62 79 74 65 0a 66 72 |only one| byte.fr|
|000028a0| 6f 6d 20 74 68 65 20 70 | 68 79 73 69 63 61 6c 20 |om the p|hysical |
|000028b0| 6e 6f 64 65 20 61 64 64 | 72 65 73 73 2e 0a 2e 50 |node add|ress...P|
|000028c0| 50 0a 5c 66 49 63 6f 6e | 6e 65 63 74 20 3c 68 6f |P.\fIcon|nect <ho|
|000028d0| 73 74 3e 5c 66 52 20 67 | 65 74 73 20 79 6f 75 20 |st>\fR g|ets you |
|000028e0| 61 20 73 68 65 6c 6c 20 | 77 68 69 63 68 20 69 73 |a shell |which is|
|000028f0| 6e 27 74 20 63 6f 6e 6e | 65 63 74 65 64 20 74 6f |n't conn|ected to|
|00002900| 20 61 20 72 65 61 6c 20 | 74 74 79 0a 64 65 76 69 | a real |tty.devi|
|00002910| 63 65 2e 0a 53 48 41 52 | 5f 45 4f 46 0a 69 66 20 |ce..SHAR|_EOF.if |
|00002920| 74 65 73 74 20 33 35 34 | 37 20 2d 6e 65 20 22 60 |test 354|7 -ne "`|
|00002930| 77 63 20 2d 63 20 3c 20 | 27 63 6f 6e 6e 65 63 74 |wc -c < |'connect|
|00002940| 2e 31 27 60 22 0a 74 68 | 65 6e 0a 09 65 63 68 6f |.1'`".th|en..echo|
|00002950| 20 73 68 61 72 3a 20 22 | 65 72 72 6f 72 20 74 72 | shar: "|error tr|
|00002960| 61 6e 73 6d 69 74 74 69 | 6e 67 20 27 63 6f 6e 6e |ansmitti|ng 'conn|
|00002970| 65 63 74 2e 31 27 22 20 | 27 28 73 68 6f 75 6c 64 |ect.1'" |'(should|
|00002980| 20 68 61 76 65 20 62 65 | 65 6e 20 33 35 34 37 20 | have be|en 3547 |
|00002990| 63 68 61 72 61 63 74 65 | 72 73 29 27 0a 66 69 0a |characte|rs)'.fi.|
|000029a0| 66 69 0a 65 63 68 6f 20 | 73 68 61 72 3a 20 22 65 |fi.echo |shar: "e|
|000029b0| 78 74 72 61 63 74 69 6e | 67 20 27 72 63 70 2e 31 |xtractin|g 'rcp.1|
|000029c0| 27 22 20 27 28 32 31 37 | 36 20 63 68 61 72 61 63 |'" '(217|6 charac|
|000029d0| 74 65 72 73 29 27 0a 69 | 66 20 74 65 73 74 20 2d |ters)'.i|f test -|
|000029e0| 66 20 27 72 63 70 2e 31 | 27 0a 74 68 65 6e 0a 09 |f 'rcp.1|'.then..|
|000029f0| 65 63 68 6f 20 73 68 61 | 72 3a 20 22 77 69 6c 6c |echo sha|r: "will|
|00002a00| 20 6e 6f 74 20 6f 76 65 | 72 2d 77 72 69 74 65 20 | not ove|r-write |
|00002a10| 65 78 69 73 74 69 6e 67 | 20 66 69 6c 65 20 27 72 |existing| file 'r|
|00002a20| 63 70 2e 31 27 22 0a 65 | 6c 73 65 0a 63 61 74 20 |cp.1'".e|lse.cat |
|00002a30| 3c 3c 20 5c 53 48 41 52 | 5f 45 4f 46 20 3e 20 27 |<< \SHAR|_EOF > '|
|00002a40| 72 63 70 2e 31 27 0a 2e | 54 48 20 52 43 50 20 31 |rcp.1'..|TH RCP 1|
|00002a50| 20 6c 6f 63 61 6c 0a 2e | 53 48 20 53 59 4e 4f 50 | local..|SH SYNOP|
|00002a60| 53 49 53 0a 2e 42 20 22 | 72 63 70 20 5b 2d 64 5d |SIS..B "|rcp [-d]|
|00002a70| 20 73 6f 75 72 63 65 20 | 5b 73 6f 75 72 63 65 20 | source |[source |
|00002a80| 2e 2e 2e 5d 20 64 65 73 | 74 22 0a 2e 53 48 20 44 |...] des|t"..SH D|
|00002a90| 45 53 43 52 49 50 54 49 | 4f 4e 0a 5c 66 49 72 63 |ESCRIPTI|ON.\fIrc|
|00002aa0| 70 5c 66 52 20 61 6c 6c | 6f 77 73 20 66 69 6c 65 |p\fR all|ows file|
|00002ab0| 73 20 74 6f 20 62 65 20 | 74 72 61 6e 73 66 65 72 |s to be |transfer|
|00002ac0| 72 65 64 20 74 6f 20 6f | 72 20 66 72 6f 6d 20 72 |red to o|r from r|
|00002ad0| 65 6d 6f 74 65 20 6d 61 | 63 68 69 6e 65 73 2c 0a |emote ma|chines,.|
|00002ae0| 75 73 69 6e 67 20 74 68 | 65 20 65 74 68 65 72 6e |using th|e ethern|
|00002af0| 65 74 20 63 6f 6e 6e 65 | 63 74 69 6f 6e 20 62 65 |et conne|ction be|
|00002b00| 74 77 65 65 6e 20 4f 6c | 69 76 65 74 74 69 20 33 |tween Ol|ivetti 3|
|00002b10| 42 32 27 73 20 73 75 70 | 70 6f 72 74 69 6e 67 20 |B2's sup|porting |
|00002b20| 33 42 4e 45 54 2e 0a 49 | 74 20 64 6f 65 73 20 5c |3BNET..I|t does \|
|00002b30| 66 42 4e 4f 54 5c 66 52 | 20 75 73 65 20 74 68 65 |fBNOT\fR| use the|
|00002b40| 20 5c 66 49 6e 69 73 65 | 6e 64 5c 66 42 20 6e 65 | \fInise|nd\fB ne|
|00002b50| 74 77 6f 72 6b 20 69 6e | 74 65 72 66 61 63 65 2c |twork in|terface,|
|00002b60| 20 77 68 69 63 68 20 68 | 61 73 20 0a 70 72 6f 76 | which h|as .prov|
|00002b70| 65 64 20 74 6f 20 62 65 | 20 76 65 72 79 20 75 6e |ed to be| very un|
|00002b80| 72 65 6c 69 61 62 6c 65 | 2c 20 62 75 74 20 75 73 |reliable|, but us|
|00002b90| 65 73 20 74 68 65 20 70 | 61 63 6b 65 74 20 74 72 |es the p|acket tr|
|00002ba0| 61 6e 73 70 6f 72 74 20 | 69 6e 74 65 72 66 61 63 |ansport |interfac|
|00002bb0| 65 0a 64 69 72 65 63 74 | 6c 79 2e 0a 2e 50 50 0a |e.direct|ly...PP.|
|00002bc0| 41 6e 79 20 6f 66 20 74 | 68 65 20 66 69 6c 65 20 |Any of t|he file |
|00002bd0| 6e 61 6d 65 73 20 73 70 | 65 63 69 66 69 65 64 20 |names sp|ecified |
|00002be0| 6d 61 79 20 62 65 20 70 | 72 65 66 69 78 65 64 20 |may be p|refixed |
|00002bf0| 77 69 74 68 20 61 20 5c | 66 42 73 79 73 74 65 6d |with a \|fBsystem|
|00002c00| 20 6e 61 6d 65 5c 66 52 | 2c 0a 6d 65 61 6e 69 6e | name\fR|,.meanin|
|00002c10| 67 20 74 68 61 74 20 74 | 68 65 20 66 69 6c 65 20 |g that t|he file |
|00002c20| 73 68 6f 75 6c 64 20 62 | 65 20 74 72 61 6e 73 66 |should b|e transf|
|00002c30| 65 72 72 65 64 20 74 6f | 20 6f 72 20 66 72 6f 6d |erred to| or from|
|00002c40| 20 74 68 65 20 72 65 6d | 6f 74 65 20 6d 61 63 68 | the rem|ote mach|
|00002c50| 69 6e 65 0a 73 70 65 63 | 69 66 69 65 64 2e 20 54 |ine.spec|ified. T|
|00002c60| 68 65 20 73 79 73 74 65 | 6d 20 6e 61 6d 65 20 69 |he syste|m name i|
|00002c70| 73 20 73 65 70 61 72 61 | 74 65 64 20 66 72 6f 6d |s separa|ted from|
|00002c80| 20 74 68 65 20 66 69 6c | 65 20 6e 61 6d 65 20 62 | the fil|e name b|
|00002c90| 79 20 65 69 74 68 65 72 | 0a 61 20 27 21 27 20 6f |y either|.a '!' o|
|00002ca0| 72 20 61 20 27 3a 27 20 | 63 68 61 72 61 63 74 65 |r a ':' |characte|
|00002cb0| 72 2e 0a 2e 50 50 0a 4f | 6e 6c 79 20 6f 6e 65 20 |r...PP.O|nly one |
|00002cc0| 72 65 6d 6f 74 65 20 73 | 79 73 74 65 6d 20 6d 61 |remote s|ystem ma|
|00002cd0| 79 20 62 65 20 73 70 65 | 63 69 66 69 65 64 20 66 |y be spe|cified f|
|00002ce0| 6f 72 20 65 61 63 68 20 | 5c 66 49 72 63 70 5c 66 |or each |\fIrcp\f|
|00002cf0| 52 20 63 6f 6d 6d 61 6e | 64 2c 20 0a 61 6e 64 20 |R comman|d, .and |
|00002d00| 61 6c 6c 20 74 68 65 20 | 73 6f 75 72 63 65 20 66 |all the |source f|
|00002d10| 69 6c 65 73 20 6d 75 73 | 74 20 6c 69 76 65 20 6f |iles mus|t live o|
|00002d20| 6e 20 74 68 65 20 73 61 | 6d 65 20 73 79 73 74 65 |n the sa|me syste|
|00002d30| 6d 2e 20 49 74 20 69 73 | 20 6e 6f 74 20 70 6f 73 |m. It is| not pos|
|00002d40| 73 69 62 6c 65 0a 74 6f | 20 6d 6f 76 65 20 66 69 |sible.to| move fi|
|00002d50| 6c 65 73 20 66 72 6f 6d | 20 6f 6e 65 20 70 6c 61 |les from| one pla|
|00002d60| 63 65 20 74 6f 20 61 6e | 6f 74 68 65 72 20 6f 6e |ce to an|other on|
|00002d70| 20 61 20 72 65 6d 6f 74 | 65 20 6d 61 63 68 69 6e | a remot|e machin|
|00002d80| 65 20 2d 20 74 68 65 79 | 0a 6d 75 73 74 20 74 72 |e - they|.must tr|
|00002d90| 61 6e 73 66 65 72 20 61 | 63 72 6f 73 73 20 74 68 |ansfer a|cross th|
|00002da0| 65 20 65 74 68 65 72 6e | 65 74 20 63 6f 6e 6e 65 |e ethern|et conne|
|00002db0| 63 74 69 6f 6e 2e 20 54 | 68 69 73 20 69 73 20 61 |ction. T|his is a|
|00002dc0| 20 72 65 73 74 72 69 63 | 74 69 6f 6e 20 0a 69 6d | restric|tion .im|
|00002dd0| 70 6f 73 65 64 20 62 79 | 20 74 68 65 20 70 72 6f |posed by| the pro|
|00002de0| 74 6f 63 6f 6c 2e 0a 2e | 53 48 20 46 4c 41 47 53 |tocol...|SH FLAGS|
|00002df0| 0a 2e 50 50 0a 2e 54 50 | 0a 2e 42 20 2d 64 0a 54 |..PP..TP|..B -d.T|
|00002e00| 75 72 6e 20 64 65 62 75 | 67 67 69 6e 67 20 6f 75 |urn debu|gging ou|
|00002e10| 74 70 75 74 20 6f 6e 20 | 64 75 72 69 6e 67 20 74 |tput on |during t|
|00002e20| 68 65 20 66 69 6c 65 20 | 74 72 61 6e 73 66 65 72 |he file |transfer|
|00002e30| 20 70 72 6f 63 65 64 75 | 72 65 2e 20 55 73 65 66 | procedu|re. Usef|
|00002e40| 75 6c 20 6f 6e 6c 79 0a | 69 66 20 79 6f 75 20 6b |ul only.|if you k|
|00002e50| 6e 6f 77 20 77 68 61 74 | 20 74 68 65 20 66 74 70 |now what| the ftp|
|00002e60| 20 70 72 6f 74 6f 63 6f | 6c 20 69 73 20 73 75 70 | protoco|l is sup|
|00002e70| 70 6f 73 65 64 20 74 6f | 20 62 65 20 64 6f 69 6e |posed to| be doin|
|00002e80| 67 2e 0a 2e 50 50 0a 2e | 53 48 20 45 58 41 4d 50 |g...PP..|SH EXAMP|
|00002e90| 4c 45 53 0a 2e 50 50 0a | 72 63 70 20 6f 73 63 61 |LES..PP.|rcp osca|
|00002ea0| 72 21 2f 75 73 72 2f 64 | 61 76 65 2f 66 69 6c 65 |r!/usr/d|ave/file|
|00002eb0| 2e 63 20 2f 75 73 72 2f | 74 6d 70 0a 2e 50 50 0a |.c /usr/|tmp..PP.|
|00002ec0| 43 6f 70 69 65 73 20 74 | 68 65 20 66 69 6c 65 20 |Copies t|he file |
|00002ed0| 5c 66 42 2f 75 73 72 2f | 64 61 76 65 2f 66 69 6c |\fB/usr/|dave/fil|
|00002ee0| 65 2e 63 5c 66 52 20 66 | 72 6f 6d 20 74 68 65 20 |e.c\fR f|rom the |
|00002ef0| 73 79 73 74 65 6d 20 5c | 66 42 6f 73 63 61 72 5c |system \|fBoscar\|
|00002f00| 66 52 20 74 6f 20 74 68 | 65 0a 64 65 73 74 69 6e |fR to th|e.destin|
|00002f10| 61 74 69 6f 6e 20 5c 66 | 42 2f 75 73 72 2f 74 6d |ation \f|B/usr/tm|
|00002f20| 70 5c 66 52 20 6f 6e 20 | 74 68 65 20 6c 6f 63 61 |p\fR on |the loca|
|00002f30| 6c 20 73 79 73 74 65 6d | 2e 0a 2e 50 50 0a 72 63 |l system|...PP.rc|
|00002f40| 70 20 2f 75 73 72 2f 64 | 61 76 65 2f 73 72 63 2f |p /usr/d|ave/src/|
|00002f50| 72 63 70 2e 63 20 6d 79 | 70 72 6f 67 20 6f 6c 69 |rcp.c my|prog oli|
|00002f60| 76 65 3a 2f 75 73 72 2f | 64 61 76 65 2f 70 75 62 |ve:/usr/|dave/pub|
|00002f70| 6c 69 63 0a 2e 50 50 0a | 43 6f 70 69 65 73 20 74 |lic..PP.|Copies t|
|00002f80| 68 65 20 6c 6f 63 61 6c | 20 66 69 6c 65 73 20 5c |he local| files \|
|00002f90| 66 42 2f 75 73 72 2f 64 | 61 76 65 2f 73 72 63 2f |fB/usr/d|ave/src/|
|00002fa0| 72 63 70 2e 63 5c 66 52 | 20 61 6e 64 0a 5c 66 42 |rcp.c\fR| and.\fB|
|00002fb0| 6d 79 70 72 6f 67 5c 66 | 52 2c 20 74 6f 20 74 68 |myprog\f|R, to th|
|00002fc0| 65 20 64 65 73 74 69 6e | 61 74 69 6f 6e 20 5c 66 |e destin|ation \f|
|00002fd0| 42 2f 75 73 72 2f 64 61 | 76 65 2f 70 75 62 6c 69 |B/usr/da|ve/publi|
|00002fe0| 63 5c 66 52 20 6f 6e 20 | 74 68 65 0a 73 79 73 74 |c\fR on |the.syst|
|00002ff0| 65 6d 20 5c 66 42 6f 6c | 69 76 65 5c 66 52 2e 0a |em \fBol|ive\fR..|
|00003000| 2e 53 48 20 22 53 45 45 | 20 41 4c 53 4f 22 0a 75 |.SH "SEE| ALSO".u|
|00003010| 75 63 70 28 31 29 2c 20 | 63 70 28 31 29 2c 20 6e |ucp(1), |cp(1), n|
|00003020| 69 73 65 6e 64 28 31 29 | 0a 2e 53 48 20 44 49 41 |isend(1)|..SH DIA|
|00003030| 47 4e 4f 53 54 49 43 53 | 0a 4e 6f 72 6d 61 6c 20 |GNOSTICS|.Normal |
|00003040| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 20 61 62 6f 75 |informat|ion abou|
|00003050| 74 20 66 69 6c 65 73 20 | 77 68 69 63 68 20 63 61 |t files |which ca|
|00003060| 6e 27 74 20 62 65 20 72 | 65 61 64 20 6f 72 20 77 |n't be r|ead or w|
|00003070| 72 69 74 74 65 6e 3b 20 | 74 68 69 73 0a 69 6e 66 |ritten; |this.inf|
|00003080| 6f 72 6d 61 74 69 6f 6e | 20 6d 61 79 20 63 6f 6d |ormation| may com|
|00003090| 65 20 66 72 6f 6d 20 65 | 69 74 68 65 72 20 68 6f |e from e|ither ho|
|000030a0| 73 74 2e 0a 2e 50 50 0a | 49 6e 20 74 68 65 20 65 |st...PP.|In the e|
|000030b0| 76 65 6e 74 20 6f 66 20 | 61 20 70 72 6f 74 6f 63 |vent of |a protoc|
|000030c0| 6f 6c 20 66 61 69 6c 75 | 72 65 2c 20 74 68 65 20 |ol failu|re, the |
|000030d0| 72 65 6d 6f 74 65 20 73 | 65 72 76 65 72 20 6d 61 |remote s|erver ma|
|000030e0| 79 20 74 65 72 6d 69 6e | 61 74 65 0a 5c 66 49 72 |y termin|ate.\fIr|
|000030f0| 63 70 5c 66 52 2e 20 54 | 68 65 72 65 20 73 68 6f |cp\fR. T|here sho|
|00003100| 75 6c 64 20 62 65 20 61 | 20 64 69 61 67 6e 6f 73 |uld be a| diagnos|
|00003110| 74 69 63 20 6d 65 73 73 | 61 67 65 20 2d 20 63 6f |tic mess|age - co|
|00003120| 6e 73 75 6c 74 20 79 6f | 75 72 20 67 75 72 75 2e |nsult yo|ur guru.|
|00003130| 0a 2e 53 48 20 42 55 47 | 53 0a 59 6f 75 20 63 61 |..SH BUG|S.You ca|
|00003140| 6e 27 74 20 74 61 6c 6b | 20 74 6f 20 6d 6f 72 65 |n't talk| to more|
|00003150| 20 74 68 61 6e 20 6f 6e | 65 20 72 65 6d 6f 74 65 | than on|e remote|
|00003160| 20 68 6f 73 74 20 61 74 | 20 61 20 74 69 6d 65 3a | host at| a time:|
|00003170| 20 74 68 69 6e 67 73 20 | 6c 69 6b 65 0a 2e 50 50 | things |like..PP|
|00003180| 0a 72 63 70 20 61 3a 66 | 69 6c 65 31 20 62 3a 66 |.rcp a:f|ile1 b:f|
|00003190| 69 6c 65 32 20 63 3a 64 | 65 73 74 0a 2e 50 50 0a |ile2 c:d|est..PP.|
|000031a0| 61 72 65 20 5c 66 42 4e | 4f 54 5c 66 52 20 61 6c |are \fBN|OT\fR al|
|000031b0| 6c 6f 77 65 64 2e 0a 2e | 50 50 0a 59 6f 75 20 63 |lowed...|PP.You c|
|000031c0| 61 6e 27 74 20 6d 6f 76 | 65 20 74 68 69 6e 67 73 |an't mov|e things|
|000031d0| 20 61 72 6f 75 6e 64 20 | 6f 6e 20 74 68 65 20 72 | around |on the r|
|000031e0| 65 6d 6f 74 65 20 68 6f | 73 74 20 2d 20 79 6f 75 |emote ho|st - you|
|000031f0| 20 63 61 6e 20 6f 6e 6c | 79 20 63 6f 70 79 0a 66 | can onl|y copy.f|
|00003200| 72 6f 6d 20 6f 6e 65 20 | 68 6f 73 74 20 74 6f 20 |rom one |host to |
|00003210| 61 6e 6f 74 68 65 72 2e | 0a 2e 50 50 0a 54 68 65 |another.|..PP.The|
|00003220| 20 66 69 6c 65 20 74 72 | 61 6e 73 66 65 72 20 70 | file tr|ansfer p|
|00003230| 72 6f 74 6f 63 6f 6c 20 | 69 73 20 61 20 68 6f 6d |rotocol |is a hom|
|00003240| 65 2d 67 72 6f 77 6e 20 | 76 61 72 69 65 74 79 2c |e-grown |variety,|
|00003250| 20 61 6e 64 20 69 73 20 | 6e 6f 74 20 67 6f 69 6e | and is |not goin|
|00003260| 67 0a 74 6f 20 62 65 20 | 61 6e 79 20 73 6f 72 74 |g.to be |any sort|
|00003270| 20 6f 66 20 73 74 61 6e | 64 61 72 64 2e 20 49 74 | of stan|dard. It|
|00003280| 20 77 6f 75 6c 64 20 62 | 65 20 6e 69 63 65 20 69 | would b|e nice i|
|00003290| 66 20 69 74 20 75 73 65 | 64 20 54 43 50 2f 49 50 |f it use|d TCP/IP|
|000032a0| 2c 20 6f 72 0a 73 6f 6d | 65 20 6f 74 68 65 72 20 |, or.som|e other |
|000032b0| 77 65 6c 6c 2d 64 65 66 | 69 6e 65 64 20 70 72 6f |well-def|ined pro|
|000032c0| 74 6f 63 6f 6c 2e 0a 53 | 48 41 52 5f 45 4f 46 0a |tocol..S|HAR_EOF.|
|000032d0| 69 66 20 74 65 73 74 20 | 32 31 37 36 20 2d 6e 65 |if test |2176 -ne|
|000032e0| 20 22 60 77 63 20 2d 63 | 20 3c 20 27 72 63 70 2e | "`wc -c| < 'rcp.|
|000032f0| 31 27 60 22 0a 74 68 65 | 6e 0a 09 65 63 68 6f 20 |1'`".the|n..echo |
|00003300| 73 68 61 72 3a 20 22 65 | 72 72 6f 72 20 74 72 61 |shar: "e|rror tra|
|00003310| 6e 73 6d 69 74 74 69 6e | 67 20 27 72 63 70 2e 31 |nsmittin|g 'rcp.1|
|00003320| 27 22 20 27 28 73 68 6f | 75 6c 64 20 68 61 76 65 |'" '(sho|uld have|
|00003330| 20 62 65 65 6e 20 32 31 | 37 36 20 63 68 61 72 61 | been 21|76 chara|
|00003340| 63 74 65 72 73 29 27 0a | 66 69 0a 66 69 0a 65 63 |cters)'.|fi.fi.ec|
|00003350| 68 6f 20 73 68 61 72 3a | 20 22 65 78 74 72 61 63 |ho shar:| "extrac|
|00003360| 74 69 6e 67 20 27 73 65 | 72 76 65 72 2e 63 27 22 |ting 'se|rver.c'"|
|00003370| 20 27 28 36 31 38 38 20 | 63 68 61 72 61 63 74 65 | '(6188 |characte|
|00003380| 72 73 29 27 0a 69 66 20 | 74 65 73 74 20 2d 66 20 |rs)'.if |test -f |
|00003390| 27 73 65 72 76 65 72 2e | 63 27 0a 74 68 65 6e 0a |'server.|c'.then.|
|000033a0| 09 65 63 68 6f 20 73 68 | 61 72 3a 20 22 77 69 6c |.echo sh|ar: "wil|
|000033b0| 6c 20 6e 6f 74 20 6f 76 | 65 72 2d 77 72 69 74 65 |l not ov|er-write|
|000033c0| 20 65 78 69 73 74 69 6e | 67 20 66 69 6c 65 20 27 | existin|g file '|
|000033d0| 73 65 72 76 65 72 2e 63 | 27 22 0a 65 6c 73 65 0a |server.c|'".else.|
|000033e0| 63 61 74 20 3c 3c 20 5c | 53 48 41 52 5f 45 4f 46 |cat << \|SHAR_EOF|
|000033f0| 20 3e 20 27 73 65 72 76 | 65 72 2e 63 27 0a 2f 2a | > 'serv|er.c'./*|
|00003400| 0a 20 2a 20 43 6f 70 79 | 72 69 67 68 74 20 28 43 |. * Copy|right (C|
|00003410| 29 20 31 39 38 38 20 44 | 61 76 65 20 53 65 74 74 |) 1988 D|ave Sett|
|00003420| 6c 65 2e 20 41 6c 6c 20 | 72 69 67 68 74 73 20 72 |le. All |rights r|
|00003430| 65 73 65 72 76 65 64 2e | 0a 20 2a 20 50 65 72 6d |eserved.|. * Perm|
|00003440| 69 73 73 69 6f 6e 20 69 | 73 20 67 72 61 6e 74 65 |ission i|s grante|
|00003450| 64 20 74 6f 20 75 73 65 | 2c 20 63 6f 70 79 20 61 |d to use|, copy a|
|00003460| 6e 64 20 6d 6f 64 69 66 | 79 20 74 68 69 73 20 73 |nd modif|y this s|
|00003470| 6f 66 74 77 61 72 65 2c | 20 70 72 6f 76 69 64 69 |oftware,| providi|
|00003480| 6e 67 0a 20 2a 20 74 68 | 61 74 20 69 74 20 69 73 |ng. * th|at it is|
|00003490| 20 6e 6f 74 20 73 6f 6c | 64 20 66 6f 72 20 70 72 | not sol|d for pr|
|000034a0| 6f 66 69 74 2c 20 61 6e | 64 20 74 68 61 74 20 74 |ofit, an|d that t|
|000034b0| 68 69 73 20 63 6f 70 79 | 72 69 67 68 74 20 6e 6f |his copy|right no|
|000034c0| 74 69 63 65 20 69 73 20 | 72 65 74 61 69 6e 65 64 |tice is |retained|
|000034d0| 0a 20 2a 20 69 6e 20 61 | 6e 79 20 63 6f 70 69 65 |. * in a|ny copie|
|000034e0| 73 20 6f 66 20 74 68 65 | 20 73 6f 75 72 63 65 2e |s of the| source.|
|000034f0| 0a 20 2a 2f 0a 2f 2a 0a | 20 2a 20 73 65 72 76 65 |. */./*.| * serve|
|00003500| 72 3a 20 65 74 68 65 72 | 6e 65 74 20 73 65 72 76 |r: ether|net serv|
|00003510| 65 72 2e 20 41 63 63 65 | 70 74 73 20 72 65 71 75 |er. Acce|pts requ|
|00003520| 65 73 74 73 2c 20 61 6e | 64 20 73 70 61 77 6e 73 |ests, an|d spawns|
|00003530| 20 70 72 6f 63 65 73 73 | 65 73 20 74 6f 0a 20 2a | process|es to. *|
|00003540| 20 73 65 72 76 65 20 72 | 65 6d 6f 74 65 20 63 6c | serve r|emote cl|
|00003550| 69 65 6e 74 73 2e 0a 20 | 2a 2f 0a 20 0a 23 69 6e |ients.. |*/. .#in|
|00003560| 63 6c 75 64 65 20 3c 73 | 79 73 2f 6e 69 2e 68 3e |clude <s|ys/ni.h>|
|00003570| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 73 74 64 69 6f |.#includ|e <stdio|
|00003580| 2e 68 3e 0a 23 69 6e 63 | 6c 75 64 65 20 3c 73 79 |.h>.#inc|lude <sy|
|00003590| 73 2f 73 69 67 6e 61 6c | 2e 68 3e 0a 23 69 6e 63 |s/signal|.h>.#inc|
|000035a0| 6c 75 64 65 20 3c 73 79 | 73 2f 65 72 72 6e 6f 2e |lude <sy|s/errno.|
|000035b0| 68 3e 0a 65 78 74 65 72 | 6e 20 69 6e 74 20 65 72 |h>.exter|n int er|
|000035c0| 72 6e 6f 3b 0a 23 69 6e | 63 6c 75 64 65 20 3c 70 |rno;.#in|clude <p|
|000035d0| 77 64 2e 68 3e 0a 0a 73 | 74 72 75 63 74 20 70 61 |wd.h>..s|truct pa|
|000035e0| 73 73 77 64 20 2a 67 65 | 74 70 77 6e 61 6d 28 29 |sswd *ge|tpwnam()|
|000035f0| 3b 0a 63 68 61 72 20 2a | 73 74 72 72 63 68 72 28 |;.char *|strrchr(|
|00003600| 29 3b 0a 0a 23 64 65 66 | 69 6e 65 20 4d 41 49 4e |);..#def|ine MAIN|
|00003610| 0a 23 69 6e 63 6c 75 64 | 65 20 22 6e 69 2e 68 22 |.#includ|e "ni.h"|
|00003620| 0a 0a 69 6e 74 20 69 6e | 70 75 74 5b 32 5d 2c 20 |..int in|put[2], |
|00003630| 6f 75 74 70 75 74 5b 32 | 5d 3b 09 09 2f 2a 20 70 |output[2|];../* p|
|00003640| 69 70 65 73 20 66 6f 72 | 20 73 68 65 6c 6c 20 2a |ipes for| shell *|
|00003650| 2f 0a 63 68 61 72 20 63 | 6d 64 5b 31 32 38 5d 2c |/.char c|md[128],|
|00003660| 20 70 72 6f 67 72 61 6d | 5b 33 32 5d 3b 0a 69 6e | program|[32];.in|
|00003670| 74 20 72 65 61 64 65 72 | 2c 20 73 68 3b 09 09 09 |t reader|, sh;...|
|00003680| 09 2f 2a 20 70 69 64 20 | 6f 66 20 63 68 69 6c 64 |./* pid |of child|
|00003690| 20 72 65 61 64 65 72 20 | 70 72 6f 63 65 73 73 20 | reader |process |
|000036a0| 2a 2f 0a 0a 23 64 65 66 | 69 6e 65 20 4c 4f 47 20 |*/..#def|ine LOG |
|000036b0| 20 22 2f 75 73 72 2f 6c | 69 62 2f 73 65 72 76 65 | "/usr/l|ib/serve|
|000036c0| 72 2e 6c 6f 67 22 0a 0a | 23 64 65 66 69 6e 65 20 |r.log"..|#define |
|000036d0| 47 49 47 41 42 59 54 45 | 09 32 2a 31 30 32 34 2a |GIGABYTE|.2*1024*|
|000036e0| 31 30 32 34 09 2f 2a 20 | 6e 75 6d 62 65 72 20 6f |1024./* |number o|
|000036f0| 66 20 62 6c 6f 63 6b 73 | 20 69 6e 20 31 20 47 42 |f blocks| in 1 GB|
|00003700| 79 74 65 20 2a 2f 0a 0a | 2f 2a 0a 20 2a 20 65 6e |yte */..|/*. * en|
|00003710| 64 70 72 6f 63 3a 20 63 | 61 6c 6c 65 64 20 77 68 |dproc: c|alled wh|
|00003720| 65 6e 20 74 68 65 20 73 | 68 65 6c 6c 20 68 61 73 |en the s|hell has|
|00003730| 20 64 69 65 64 20 28 76 | 69 61 20 53 49 47 50 49 | died (v|ia SIGPI|
|00003740| 50 45 29 20 62 79 20 74 | 68 65 20 77 72 69 74 65 |PE) by t|he write|
|00003750| 72 20 70 72 6f 63 65 73 | 73 0a 20 2a 2f 0a 65 6e |r proces|s. */.en|
|00003760| 64 70 72 6f 63 28 29 7b | 0a 09 73 74 72 75 63 74 |dproc(){|..struct|
|00003770| 20 72 65 71 75 65 73 74 | 20 72 65 71 3b 0a 09 73 | request| req;..s|
|00003780| 6b 69 6c 6c 28 72 65 61 | 64 65 72 2c 20 53 49 47 |kill(rea|der, SIG|
|00003790| 54 45 52 4d 29 3b 0a 09 | 73 70 72 69 6e 74 66 28 |TERM);..|sprintf(|
|000037a0| 72 65 71 2e 72 5f 64 61 | 74 61 2c 20 22 79 6f 75 |req.r_da|ta, "you|
|000037b0| 72 20 73 68 65 6c 6c 20 | 64 69 65 64 22 29 3b 0a |r shell |died");.|
|000037c0| 09 73 65 6e 64 28 26 72 | 65 71 2c 20 73 74 72 6c |.send(&r|eq, strl|
|000037d0| 65 6e 28 72 65 71 2e 72 | 5f 64 61 74 61 29 2c 20 |en(req.r|_data), |
|000037e0| 54 45 52 4d 49 4e 41 54 | 45 2c 20 63 6c 69 65 6e |TERMINAT|E, clien|
|000037f0| 74 29 3b 0a 09 65 78 69 | 74 28 30 29 3b 0a 7d 0a |t);..exi|t(0);.}.|
|00003800| 2f 2a 0a 20 2a 20 43 61 | 6c 6c 65 64 20 77 68 65 |/*. * Ca|lled whe|
|00003810| 6e 20 77 65 20 67 65 74 | 20 61 20 54 45 52 4d 49 |n we get| a TERMI|
|00003820| 4e 41 54 45 20 70 61 63 | 6b 65 74 20 66 72 6f 6d |NATE pac|ket from|
|00003830| 20 74 68 65 20 63 6c 69 | 65 6e 74 2e 0a 20 2a 2f | the cli|ent.. */|
|00003840| 0a 73 69 67 74 65 72 6d | 28 29 7b 09 0a 09 73 6b |.sigterm|(){...sk|
|00003850| 69 6c 6c 28 72 65 61 64 | 65 72 2c 20 53 49 47 54 |ill(read|er, SIGT|
|00003860| 45 52 4d 29 3b 0a 09 73 | 6b 69 6c 6c 28 73 68 2c |ERM);..s|kill(sh,|
|00003870| 20 53 49 47 48 55 50 29 | 3b 0a 09 73 6c 65 65 70 | SIGHUP)|;..sleep|
|00003880| 28 31 29 3b 0a 09 73 6b | 69 6c 6c 28 73 68 2c 20 |(1);..sk|ill(sh, |
|00003890| 53 49 47 4b 49 4c 4c 29 | 3b 0a 09 65 78 69 74 28 |SIGKILL)|;..exit(|
|000038a0| 30 29 3b 0a 7d 0a 0a 6d | 61 69 6e 28 29 0a 7b 0a |0);.}..m|ain().{.|
|000038b0| 09 69 6e 74 20 69 6e 3b | 0a 09 73 69 67 6e 61 6c |.int in;|..signal|
|000038c0| 28 53 49 47 48 55 50 2c | 20 53 49 47 5f 49 47 4e |(SIGHUP,| SIG_IGN|
|000038d0| 29 3b 0a 09 73 69 67 6e | 61 6c 28 53 49 47 49 4e |);..sign|al(SIGIN|
|000038e0| 54 2c 20 53 49 47 5f 49 | 47 4e 29 3b 0a 09 73 69 |T, SIG_I|GN);..si|
|000038f0| 67 6e 61 6c 28 53 49 47 | 51 55 49 54 2c 20 53 49 |gnal(SIG|QUIT, SI|
|00003900| 47 5f 49 47 4e 29 3b 0a | 09 73 69 67 6e 61 6c 28 |G_IGN);.|.signal(|
|00003910| 53 49 47 54 45 52 4d 2c | 20 73 69 67 74 65 72 6d |SIGTERM,| sigterm|
|00003920| 29 3b 0a 09 75 6c 69 6d | 69 74 28 32 2c 20 28 6c |);..ulim|it(2, (l|
|00003930| 6f 6e 67 29 20 47 49 47 | 41 42 59 54 45 29 3b 0a |ong) GIG|ABYTE);.|
|00003940| 2f 2a 0a 20 2a 20 54 68 | 69 73 20 70 72 6f 63 65 |/*. * Th|is proce|
|00003950| 73 73 20 72 75 6e 73 20 | 66 72 6f 6d 20 22 69 6e |ss runs |from "in|
|00003960| 69 74 22 20 2d 20 69 74 | 20 64 6f 65 73 6e 27 74 |it" - it| doesn't|
|00003970| 20 68 61 76 65 20 41 4e | 59 20 66 69 6c 65 20 64 | have AN|Y file d|
|00003980| 65 73 63 72 69 70 74 6f | 72 73 20 6f 70 65 6e 0a |escripto|rs open.|
|00003990| 20 2a 20 43 68 65 63 6b | 20 74 68 69 73 2c 20 61 | * Check| this, a|
|000039a0| 6e 64 20 69 66 20 6e 65 | 63 65 73 73 61 72 79 2c |nd if ne|cessary,|
|000039b0| 20 63 72 65 61 74 65 20 | 73 6f 6d 65 20 64 75 6d | create |some dum|
|000039c0| 6d 79 20 66 64 27 73 2e | 0a 20 2a 2f 0a 20 09 69 |my fd's.|. */. .i|
|000039d0| 66 28 69 6e 20 3d 20 6f | 70 65 6e 28 22 2f 64 65 |f(in = o|pen("/de|
|000039e0| 76 2f 6e 75 6c 6c 22 2c | 20 30 29 20 3d 3d 20 30 |v/null",| 0) == 0|
|000039f0| 29 20 7b 0a 20 09 09 6f | 70 65 6e 28 22 2f 64 65 |) {. ..o|pen("/de|
|00003a00| 76 2f 6e 75 6c 6c 22 2c | 20 31 29 3b 0a 20 09 09 |v/null",| 1);. ..|
|00003a10| 6f 70 65 6e 28 22 2f 64 | 65 76 2f 6e 75 6c 6c 22 |open("/d|ev/null"|
|00003a20| 2c 20 31 29 3b 0a 20 09 | 7d 0a 20 09 65 6c 73 65 |, 1);. .|}. .else|
|00003a30| 20 63 6c 6f 73 65 28 69 | 6e 29 3b 0a 09 66 72 65 | close(i|n);..fre|
|00003a40| 6f 70 65 6e 28 4c 4f 47 | 2c 20 22 61 2b 22 2c 20 |open(LOG|, "a+", |
|00003a50| 73 74 64 65 72 72 29 3b | 0a 09 69 66 28 63 6f 6e |stderr);|..if(con|
|00003a60| 66 69 67 75 72 65 28 73 | 65 72 76 65 72 2c 20 32 |figure(s|erver, 2|
|00003a70| 2c 20 30 29 20 3d 3d 20 | 2d 31 29 20 65 78 69 74 |, 0) == |-1) exit|
|00003a80| 28 31 29 3b 0a 20 09 61 | 63 63 65 70 74 28 29 3b |(1);. .a|ccept();|
|00003a90| 0a 20 09 72 65 74 75 72 | 6e 28 30 29 3b 0a 7d 0a |. .retur|n(0);.}.|
|00003aa0| 61 63 63 65 70 74 28 29 | 7b 0a 09 73 74 72 75 63 |accept()|{..struc|
|00003ab0| 74 20 72 65 71 75 65 73 | 74 20 72 65 71 75 65 73 |t reques|t reques|
|00003ac0| 74 3b 0a 20 09 72 65 63 | 76 28 26 72 65 71 75 65 |t;. .rec|v(&reque|
|00003ad0| 73 74 29 3b 0a 2f 2a 0a | 20 2a 20 46 6f 72 6b 20 |st);./*.| * Fork |
|00003ae0| 6f 66 66 20 63 68 69 6c | 64 20 74 6f 20 64 65 61 |off chil|d to dea|
|00003af0| 6c 20 77 69 74 68 20 74 | 68 65 20 72 65 71 75 65 |l with t|he reque|
|00003b00| 73 74 2e 20 57 65 20 64 | 69 65 2c 20 61 6e 64 20 |st. We d|ie, and |
|00003b10| 61 72 65 20 72 65 73 70 | 61 77 6e 65 64 20 62 79 |are resp|awned by|
|00003b20| 0a 20 2a 20 69 6e 69 74 | 2e 0a 20 2a 2f 0a 20 09 |. * init|.. */. .|
|00003b30| 69 66 28 66 6f 72 6b 28 | 29 20 3d 3d 20 30 29 20 |if(fork(|) == 0) |
|00003b40| 65 78 69 74 28 73 65 72 | 76 65 28 26 72 65 71 75 |exit(ser|ve(&requ|
|00003b50| 65 73 74 29 29 3b 0a 2f | 2a 0a 20 2a 20 70 61 72 |est));./|*. * par|
|00003b60| 65 6e 74 20 2d 20 65 78 | 69 74 2e 0a 20 2a 2f 0a |ent - ex|it.. */.|
|00003b70| 20 09 72 65 74 75 72 6e | 28 30 29 3b 0a 7d 0a 2f | .return|(0);.}./|
|00003b80| 2a 0a 20 2a 20 73 65 72 | 76 65 3a 20 73 65 74 20 |*. * ser|ve: set |
|00003b90| 75 70 20 61 20 73 68 65 | 6c 6c 20 66 6f 72 20 74 |up a she|ll for t|
|00003ba0| 68 65 20 72 65 6d 6f 74 | 65 20 70 72 6f 63 65 73 |he remot|e proces|
|00003bb0| 73 2c 20 61 6e 64 20 70 | 61 73 73 20 64 61 74 61 |s, and p|ass data|
|00003bc0| 2e 0a 20 2a 2f 0a 23 64 | 65 66 69 6e 65 20 52 44 |.. */.#d|efine RD|
|00003bd0| 20 30 0a 23 64 65 66 69 | 6e 65 20 57 54 20 31 0a | 0.#defi|ne WT 1.|
|00003be0| 73 65 72 76 65 28 72 29 | 0a 72 65 67 69 73 74 65 |serve(r)|.registe|
|00003bf0| 72 20 73 74 72 75 63 74 | 20 72 65 71 75 65 73 74 |r struct| request|
|00003c00| 20 2a 72 3b 0a 7b 0a 09 | 69 6e 74 20 70 69 64 20 | *r;.{..|int pid |
|00003c10| 3d 20 67 65 74 70 69 64 | 28 29 2c 20 77 72 69 74 |= getpid|(), writ|
|00003c20| 65 72 2c 20 6e 2c 20 75 | 69 64 2c 20 6f 6b 3b 0a |er, n, u|id, ok;.|
|00003c30| 09 69 6e 74 20 6f 6c 64 | 6e 65 74 3b 0a 09 63 68 |.int old|net;..ch|
|00003c40| 61 72 20 75 73 65 72 5b | 33 32 5d 3b 0a 09 73 74 |ar user[|32];..st|
|00003c50| 72 75 63 74 20 70 61 73 | 73 77 64 20 2a 70 77 3b |ruct pas|swd *pw;|
|00003c60| 0a 09 63 68 61 72 20 68 | 6f 6d 65 5b 33 32 5d 2c |..char h|ome[32],|
|00003c70| 20 70 61 74 68 5b 31 32 | 38 5d 2c 20 73 68 65 6c | path[12|8], shel|
|00003c80| 6c 5b 31 36 5d 2c 20 6d | 61 69 6c 5b 36 34 5d 2c |l[16], m|ail[64],|
|00003c90| 20 74 65 72 6d 5b 33 32 | 5d 2c 20 6c 6f 67 6e 61 | term[32|], logna|
|00003ca0| 6d 65 5b 36 34 5d 3b 0a | 2f 2a 0a 20 2a 20 47 65 |me[64];.|/*. * Ge|
|00003cb0| 74 20 74 68 65 20 75 73 | 65 72 20 69 6e 66 6f 20 |t the us|er info |
|00003cc0| 66 72 6f 6d 20 74 68 65 | 20 72 65 71 75 65 73 74 |from the| request|
|00003cd0| 20 68 65 61 64 65 72 2c | 20 61 6e 64 20 73 65 74 | header,| and set|
|00003ce0| 20 6f 75 72 20 70 61 72 | 61 6d 65 74 65 72 73 0a | our par|ameters.|
|00003cf0| 20 2a 2f 09 0a 09 6e 20 | 3d 20 73 73 63 61 6e 66 | */...n |= sscanf|
|00003d00| 28 72 2d 3e 72 5f 64 61 | 74 61 2c 20 22 25 64 20 |(r->r_da|ta, "%d |
|00003d10| 25 73 20 25 73 22 2c 20 | 26 75 69 64 2c 20 75 73 |%s %s", |&uid, us|
|00003d20| 65 72 2c 20 74 65 72 6d | 29 3b 0a 09 6d 65 6d 63 |er, term|);..memc|
|00003d30| 70 79 28 63 6c 69 65 6e | 74 2c 20 72 2d 3e 72 5f |py(clien|t, r->r_|
|00003d40| 70 6f 72 74 2e 73 72 63 | 61 64 64 72 2c 20 45 54 |port.src|addr, ET|
|00003d50| 48 45 52 53 49 5a 45 29 | 3b 0a 09 70 77 20 3d 20 |HERSIZE)|;..pw = |
|00003d60| 67 65 74 70 77 6e 61 6d | 28 75 73 65 72 29 3b 0a |getpwnam|(user);.|
|00003d70| 09 69 66 28 70 77 20 3d | 3d 20 4e 55 4c 4c 29 20 |.if(pw =|= NULL) |
|00003d80| 7b 0a 09 09 6e 20 3d 20 | 73 70 72 69 6e 74 66 28 |{...n = |sprintf(|
|00003d90| 72 2d 3e 72 5f 64 61 74 | 61 2c 20 22 55 73 65 72 |r->r_dat|a, "User|
|00003da0| 20 27 25 73 27 20 6e 6f | 74 20 6b 6e 6f 77 6e 20 | '%s' no|t known |
|00003db0| 68 65 72 65 22 2c 20 75 | 73 65 72 29 3b 0a 09 09 |here", u|ser);...|
|00003dc0| 73 65 6e 64 28 72 2c 20 | 6e 2c 20 54 45 52 4d 49 |send(r, |n, TERMI|
|00003dd0| 4e 41 54 45 2c 20 63 6c | 69 65 6e 74 29 3b 0a 09 |NATE, cl|ient);..|
|00003de0| 09 65 78 69 74 28 30 29 | 3b 0a 09 7d 0a 09 69 66 |.exit(0)|;..}..if|
|00003df0| 28 70 77 2d 3e 70 77 5f | 75 69 64 20 21 3d 20 75 |(pw->pw_|uid != u|
|00003e00| 69 64 29 20 7b 0a 09 09 | 6e 20 3d 20 73 70 72 69 |id) {...|n = spri|
|00003e10| 6e 74 66 28 72 2d 3e 72 | 5f 64 61 74 61 2c 20 22 |ntf(r->r|_data, "|
|00003e20| 55 73 65 72 20 27 25 73 | 27 20 61 6e 64 20 75 69 |User '%s|' and ui|
|00003e30| 64 20 27 25 64 27 20 64 | 6f 6e 27 74 20 6d 61 74 |d '%d' d|on't mat|
|00003e40| 63 68 22 2c 0a 09 09 09 | 75 73 65 72 2c 20 75 69 |ch",....|user, ui|
|00003e50| 64 29 3b 0a 09 09 73 65 | 6e 64 28 72 2c 20 6e 2c |d);...se|nd(r, n,|
|00003e60| 20 54 45 52 4d 49 4e 41 | 54 45 2c 20 63 6c 69 65 | TERMINA|TE, clie|
|00003e70| 6e 74 29 3b 0a 09 09 65 | 78 69 74 28 30 29 3b 0a |nt);...e|xit(0);.|
|00003e80| 09 7d 0a 23 69 66 64 65 | 66 20 53 45 43 55 52 45 |.}.#ifde|f SECURE|
|00003e90| 0a 09 69 66 28 75 69 64 | 20 3d 3d 20 30 29 20 7b |..if(uid| == 0) {|
|00003ea0| 0a 09 09 6e 20 3d 20 73 | 70 72 69 6e 74 66 28 72 |...n = s|printf(r|
|00003eb0| 2d 3e 72 5f 64 61 74 61 | 2c 20 22 53 65 63 75 72 |->r_data|, "Secur|
|00003ec0| 65 20 73 65 72 76 65 72 | 3a 20 72 6f 6f 74 20 61 |e server|: root a|
|00003ed0| 63 63 65 73 73 20 6e 6f | 74 20 61 6c 6c 6f 77 65 |ccess no|t allowe|
|00003ee0| 64 22 29 3b 0a 09 09 73 | 65 6e 64 28 72 2c 20 6e |d");...s|end(r, n|
|00003ef0| 2c 20 54 45 52 4d 49 4e | 41 54 45 2c 20 63 6c 69 |, TERMIN|ATE, cli|
|00003f00| 65 6e 74 29 3b 0a 09 09 | 65 78 69 74 28 30 29 3b |ent);...|exit(0);|
|00003f10| 0a 09 7d 0a 23 65 6e 64 | 69 66 0a 09 73 65 74 70 |..}.#end|if..setp|
|00003f20| 67 72 70 28 29 3b 09 09 | 09 2f 2a 20 53 65 74 20 |grp();..|./* Set |
|00003f30| 75 70 20 61 20 70 72 6f | 63 65 73 73 20 67 72 6f |up a pro|cess gro|
|00003f40| 75 70 20 2a 2f 0a 09 73 | 65 74 67 69 64 28 70 77 |up */..s|etgid(pw|
|00003f50| 2d 3e 70 77 5f 67 69 64 | 29 3b 0a 09 73 65 74 75 |->pw_gid|);..setu|
|00003f60| 69 64 28 70 77 2d 3e 70 | 77 5f 75 69 64 29 3b 0a |id(pw->p|w_uid);.|
|00003f70| 09 73 70 72 69 6e 74 66 | 28 6d 61 69 6c 2c 20 22 |.sprintf|(mail, "|
|00003f80| 4d 41 49 4c 3d 2f 75 73 | 72 2f 6d 61 69 6c 2f 25 |MAIL=/us|r/mail/%|
|00003f90| 73 22 2c 20 75 73 65 72 | 29 3b 0a 09 73 70 72 69 |s", user|);..spri|
|00003fa0| 6e 74 66 28 70 61 74 68 | 2c 20 22 50 41 54 48 3d |ntf(path|, "PATH=|
|00003fb0| 3a 2f 75 73 72 2f 75 63 | 62 3a 2f 62 69 6e 3a 2f |:/usr/uc|b:/bin:/|
|00003fc0| 75 73 72 2f 62 69 6e 22 | 29 3b 0a 09 73 70 72 69 |usr/bin"|);..spri|
|00003fd0| 6e 74 66 28 6c 6f 67 6e | 61 6d 65 2c 20 22 4c 4f |ntf(logn|ame, "LO|
|00003fe0| 47 4e 41 4d 45 3d 25 73 | 22 2c 20 75 73 65 72 29 |GNAME=%s|", user)|
|00003ff0| 3b 0a 09 73 70 72 69 6e | 74 66 28 73 68 65 6c 6c |;..sprin|tf(shell|
|00004000| 2c 20 22 53 48 45 4c 4c | 3d 25 73 22 2c 20 70 77 |, "SHELL|=%s", pw|
|00004010| 2d 3e 70 77 5f 73 68 65 | 6c 6c 29 3b 0a 09 73 70 |->pw_she|ll);..sp|
|00004020| 72 69 6e 74 66 28 68 6f | 6d 65 2c 20 22 48 4f 4d |rintf(ho|me, "HOM|
|00004030| 45 3d 25 73 22 2c 20 70 | 77 2d 3e 70 77 5f 64 69 |E=%s", p|w->pw_di|
|00004040| 72 29 3b 0a 09 70 75 74 | 65 6e 76 28 68 6f 6d 65 |r);..put|env(home|
|00004050| 29 3b 20 70 75 74 65 6e | 76 28 70 61 74 68 29 3b |); puten|v(path);|
|00004060| 20 70 75 74 65 6e 76 28 | 73 68 65 6c 6c 29 3b 20 | putenv(|shell); |
|00004070| 0a 09 70 75 74 65 6e 76 | 28 6d 61 69 6c 29 3b 20 |..putenv|(mail); |
|00004080| 70 75 74 65 6e 76 28 6c | 6f 67 6e 61 6d 65 29 3b |putenv(l|ogname);|
|00004090| 0a 09 70 75 74 65 6e 76 | 28 74 65 72 6d 29 3b 0a |..putenv|(term);.|
|000040a0| 09 63 68 64 69 72 28 70 | 77 2d 3e 70 77 5f 64 69 |.chdir(p|w->pw_di|
|000040b0| 72 29 3b 0a 69 66 28 64 | 65 62 75 67 29 20 7b 0a |r);.if(d|ebug) {.|
|000040c0| 09 66 70 72 69 6e 74 66 | 28 73 74 64 65 72 72 2c |.fprintf|(stderr,|
|000040d0| 20 22 53 65 72 76 65 72 | 20 72 65 71 75 65 73 74 | "Server| request|
|000040e0| 20 66 72 6f 6d 20 25 73 | 5c 6e 22 2c 20 67 65 74 | from %s|\n", get|
|000040f0| 65 6e 76 28 22 4c 4f 47 | 4e 41 4d 45 22 29 29 3b |env("LOG|NAME"));|
|00004100| 0a 7d 0a 09 73 65 72 76 | 65 72 5b 50 49 44 4d 53 |.}..serv|er[PIDMS|
|00004110| 42 5d 20 3d 20 28 70 69 | 64 20 3e 3e 20 38 29 20 |B] = (pi|d >> 8) |
|00004120| 26 20 30 78 66 66 3b 0a | 09 73 65 72 76 65 72 5b |& 0xff;.|.server[|
|00004130| 50 49 44 4c 53 42 5d 20 | 3d 20 70 69 64 20 26 20 |PIDLSB] |= pid & |
|00004140| 30 78 66 66 3b 0a 09 6f | 6c 64 6e 65 74 20 3d 20 |0xff;..o|ldnet = |
|00004150| 65 74 68 65 72 6e 65 74 | 3b 09 09 09 2f 2a 20 73 |ethernet|;.../* s|
|00004160| 61 76 65 20 6f 6c 64 20 | 70 6f 72 74 20 66 6f 72 |ave old |port for|
|00004170| 20 61 20 62 69 74 20 2a | 2f 0a 09 69 66 28 63 6f | a bit *|/..if(co|
|00004180| 6e 66 69 67 75 72 65 28 | 73 65 72 76 65 72 2c 20 |nfigure(|server, |
|00004190| 33 2c 20 67 65 74 70 69 | 64 28 29 29 20 3d 3d 20 |3, getpi|d()) == |
|000041a0| 2d 31 29 20 7b 09 2f 2a | 20 57 65 20 61 72 65 20 |-1) {./*| We are |
|000041b0| 74 68 69 73 20 61 64 64 | 72 65 73 73 20 2a 2f 0a |this add|ress */.|
|000041c0| 09 09 65 74 68 65 72 6e | 65 74 20 3d 20 6f 6c 64 |..ethern|et = old|
|000041d0| 6e 65 74 3b 09 09 2f 2a | 20 55 73 65 20 6f 6c 64 |net;../*| Use old|
|000041e0| 20 70 6f 72 74 20 2a 2f | 0a 09 09 73 70 72 69 6e | port */|...sprin|
|000041f0| 74 66 28 72 2d 3e 72 5f | 64 61 74 61 2c 20 22 43 |tf(r->r_|data, "C|
|00004200| 61 6e 27 74 20 61 6c 6c | 6f 63 61 74 65 20 70 6f |an't all|ocate po|
|00004210| 72 74 22 29 3b 0a 09 09 | 73 65 6e 64 28 72 2c 20 |rt");...|send(r, |
|00004220| 73 74 72 6c 65 6e 28 72 | 2d 3e 72 5f 64 61 74 61 |strlen(r|->r_data|
|00004230| 29 2c 20 54 45 52 4d 49 | 4e 41 54 45 2c 20 63 6c |), TERMI|NATE, cl|
|00004240| 69 65 6e 74 29 3b 0a 09 | 09 65 78 69 74 28 31 29 |ient);..|.exit(1)|
|00004250| 3b 0a 09 7d 0a 09 63 6c | 6f 73 65 28 6f 6c 64 6e |;..}..cl|ose(oldn|
|00004260| 65 74 29 3b 09 09 09 09 | 2f 2a 20 4f 4b 20 2d 20 |et);....|/* OK - |
|00004270| 75 73 65 20 74 68 65 20 | 6e 65 77 20 70 6f 72 74 |use the |new port|
|00004280| 20 2a 2f 0a 2f 2a 0a 20 | 2a 20 49 6e 66 6f 72 6d | */./*. |* Inform|
|00004290| 20 74 68 65 20 63 6c 69 | 65 6e 74 20 6f 66 20 6f | the cli|ent of o|
|000042a0| 75 72 20 6e 65 77 20 61 | 64 64 72 65 73 73 0a 20 |ur new a|ddress. |
|000042b0| 2a 2f 0a 09 6d 65 6d 63 | 70 79 28 72 2d 3e 72 5f |*/..memc|py(r->r_|
|000042c0| 64 61 74 61 2c 20 6d 79 | 6e 6f 64 65 2c 20 45 54 |data, my|node, ET|
|000042d0| 48 45 52 53 49 5a 45 29 | 3b 0a 09 73 65 6e 64 28 |HERSIZE)|;..send(|
|000042e0| 72 2c 20 45 54 48 45 52 | 53 49 5a 45 2c 20 41 43 |r, ETHER|SIZE, AC|
|000042f0| 43 45 50 54 2c 20 63 6c | 69 65 6e 74 29 3b 0a 2f |CEPT, cl|ient);./|
|00004300| 2a 0a 20 2a 20 47 65 74 | 20 74 68 65 20 63 6f 6d |*. * Get| the com|
|00004310| 6d 61 6e 64 20 77 68 69 | 63 68 20 74 68 65 20 63 |mand whi|ch the c|
|00004320| 6c 69 65 6e 74 20 77 69 | 73 68 65 73 20 75 73 20 |lient wi|shes us |
|00004330| 74 6f 20 65 78 65 63 75 | 74 65 0a 20 2a 2f 0a 20 |to execu|te. */. |
|00004340| 09 72 65 63 76 28 72 29 | 3b 0a 20 09 6d 65 6d 63 |.recv(r)|;. .memc|
|00004350| 70 79 28 63 6d 64 2c 20 | 72 2d 3e 72 5f 64 61 74 |py(cmd, |r->r_dat|
|00004360| 61 2c 20 72 2d 3e 72 5f | 73 69 7a 65 29 3b 0a 2f |a, r->r_|size);./|
|00004370| 2a 0a 20 2a 20 53 70 65 | 63 69 61 6c 20 63 61 73 |*. * Spe|cial cas|
|00004380| 65 73 3a 20 0a 20 2a 09 | 22 6c 6f 67 69 6e 22 20 |es: . *.|"login" |
|00004390| 2d 20 75 73 65 72 20 77 | 61 6e 74 73 20 61 20 72 |- user w|ants a r|
|000043a0| 65 61 6c 20 6c 6f 67 69 | 6e 20 2d 20 75 73 65 20 |eal logi|n - use |
|000043b0| 74 68 65 20 50 43 2d 49 | 6e 74 65 72 66 61 63 65 |the PC-I|nterface|
|000043c0| 20 70 74 74 79 73 0a 20 | 2a 09 22 66 69 6c 65 73 | pttys. |*."files|
|000043d0| 65 72 76 65 72 22 20 2d | 20 75 73 65 72 20 77 61 |erver" -| user wa|
|000043e0| 6e 74 73 20 74 6f 20 74 | 72 61 6e 73 66 65 72 20 |nts to t|ransfer |
|000043f0| 66 69 6c 65 73 2e 0a 20 | 2a 2f 0a 20 09 69 66 28 |files.. |*/. .if(|
|00004400| 21 73 74 72 63 6d 70 28 | 63 6d 64 2c 20 22 6c 6f |!strcmp(|cmd, "lo|
|00004410| 67 69 6e 22 29 29 20 72 | 65 74 75 72 6e 28 64 6f |gin")) r|eturn(do|
|00004420| 6c 6f 67 69 6e 28 72 29 | 29 3b 0a 20 09 69 66 28 |login(r)|);. .if(|
|00004430| 21 73 74 72 63 6d 70 28 | 63 6d 64 2c 20 22 66 69 |!strcmp(|cmd, "fi|
|00004440| 6c 65 73 65 72 76 65 72 | 22 29 29 20 72 65 74 75 |leserver|")) retu|
|00004450| 72 6e 28 66 69 6c 65 73 | 65 72 76 65 72 28 72 29 |rn(files|erver(r)|
|00004460| 29 3b 0a 2f 2a 0a 20 2a | 20 4e 6f 77 20 73 74 61 |);./*. *| Now sta|
|00004470| 72 74 20 6f 66 66 20 74 | 68 65 20 63 68 69 6c 64 |rt off t|he child|
|00004480| 20 70 72 6f 63 65 73 73 | 2c 20 61 6e 64 20 63 6f | process|, and co|
|00004490| 6c 6c 65 63 74 20 69 74 | 27 73 20 6f 75 74 70 75 |llect it|'s outpu|
|000044a0| 74 0a 20 2a 2f 0a 20 09 | 70 69 70 65 28 69 6e 70 |t. */. .|pipe(inp|
|000044b0| 75 74 29 3b 0a 20 09 70 | 69 70 65 28 6f 75 74 70 |ut);. .p|ipe(outp|
|000044c0| 75 74 29 3b 0a 20 09 69 | 66 28 73 68 20 3d 20 66 |ut);. .i|f(sh = f|
|000044d0| 6f 72 6b 28 29 29 20 7b | 0a 20 09 09 63 6c 6f 73 |ork()) {|. ..clos|
|000044e0| 65 28 69 6e 70 75 74 5b | 57 54 5d 29 3b 0a 20 09 |e(input[|WT]);. .|
|000044f0| 09 63 6c 6f 73 65 28 6f | 75 74 70 75 74 5b 52 44 |.close(o|utput[RD|
|00004500| 5d 29 3b 0a 20 09 09 77 | 72 69 74 65 72 20 3d 20 |]);. ..w|riter = |
|00004510| 67 65 74 70 69 64 28 29 | 3b 0a 20 09 09 69 66 28 |getpid()|;. ..if(|
|00004520| 72 65 61 64 65 72 20 3d | 20 66 6f 72 6b 28 29 29 |reader =| fork())|
|00004530| 20 7b 0a 09 20 09 09 6f | 6b 20 3d 20 31 3b 0a 09 | {.. ..o|k = 1;..|
|00004540| 20 09 09 73 69 67 6e 61 | 6c 28 53 49 47 50 49 50 | ..signa|l(SIGPIP|
|00004550| 45 2c 20 65 6e 64 70 72 | 6f 63 29 3b 0a 09 20 09 |E, endpr|oc);.. .|
|00004560| 09 77 68 69 6c 65 28 6f | 6b 29 20 7b 0a 09 20 09 |.while(o|k) {.. .|
|00004570| 09 09 72 65 63 76 28 72 | 29 3b 0a 69 66 28 64 65 |..recv(r|);.if(de|
|00004580| 62 75 67 29 20 7b 0a 09 | 20 09 09 09 66 70 72 69 |bug) {..| ...fpri|
|00004590| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 22 73 65 72 |ntf(stde|rr, "ser|
|000045a0| 76 65 72 3a 20 67 6f 74 | 20 5b 25 73 5d 20 66 72 |ver: got| [%s] fr|
|000045b0| 6f 6d 20 25 73 5c 6e 22 | 2c 0a 09 20 09 09 09 09 |om %s\n"|,.. ....|
|000045c0| 72 2d 3e 72 5f 64 61 74 | 61 2c 20 69 70 61 64 64 |r->r_dat|a, ipadd|
|000045d0| 72 28 72 2d 3e 72 5f 70 | 6f 72 74 2e 73 72 63 61 |r(r->r_p|ort.srca|
|000045e0| 64 64 72 29 29 3b 0a 7d | 0a 09 09 09 09 6f 6b 20 |ddr));.}|.....ok |
|000045f0| 3d 20 70 61 73 73 6f 6e | 28 72 2c 20 6f 75 74 70 |= passon|(r, outp|
|00004600| 75 74 5b 57 54 5d 29 3b | 0a 09 20 09 09 7d 0a 09 |ut[WT]);|.. ..}..|
|00004610| 09 09 73 69 67 74 65 72 | 6d 28 29 3b 0a 09 20 09 |..sigter|m();.. .|
|00004620| 7d 0a 09 20 09 65 6c 73 | 65 20 7b 0a 09 20 09 09 |}.. .els|e {.. ..|
|00004630| 73 69 67 6e 61 6c 28 53 | 49 47 54 45 52 4d 2c 20 |signal(S|IGTERM, |
|00004640| 53 49 47 5f 44 46 4c 29 | 3b 0a 20 09 09 09 77 68 |SIG_DFL)|;. ...wh|
|00004650| 69 6c 65 28 28 6e 20 3d | 20 72 65 61 64 28 69 6e |ile((n =| read(in|
|00004660| 70 75 74 5b 52 44 5d 2c | 20 72 2d 3e 72 5f 64 61 |put[RD],| r->r_da|
|00004670| 74 61 2c 20 73 69 7a 65 | 6f 66 20 72 2d 3e 72 5f |ta, size|of r->r_|
|00004680| 64 61 74 61 29 29 20 21 | 3d 20 2d 31 29 20 7b 0a |data)) !|= -1) {.|
|00004690| 20 09 09 09 09 73 65 6e | 64 28 72 2c 20 6e 2c 20 | ....sen|d(r, n, |
|000046a0| 44 41 54 41 2c 20 63 6c | 69 65 6e 74 29 3b 0a 69 |DATA, cl|ient);.i|
|000046b0| 66 28 64 65 62 75 67 29 | 20 7b 0a 20 09 09 09 09 |f(debug)| {. ....|
|000046c0| 66 70 72 69 6e 74 66 28 | 73 74 64 65 72 72 2c 20 |fprintf(|stderr, |
|000046d0| 22 73 65 72 76 65 72 3a | 20 25 73 20 73 65 6e 74 |"server:| %s sent|
|000046e0| 20 74 6f 20 25 73 5c 6e | 22 2c 0a 20 09 09 09 09 | to %s\n|",. ....|
|000046f0| 09 72 2d 3e 72 5f 64 61 | 74 61 2c 20 69 70 61 64 |.r->r_da|ta, ipad|
|00004700| 64 72 28 63 6c 69 65 6e | 74 29 29 3b 0a 7d 0a 20 |dr(clien|t));.}. |
|00004710| 09 09 09 7d 0a 20 09 09 | 09 73 70 72 69 6e 74 66 |...}. ..|.sprintf|
|00004720| 28 72 2d 3e 72 5f 64 61 | 74 61 2c 20 22 68 61 6e |(r->r_da|ta, "han|
|00004730| 67 75 70 5c 6e 22 29 3b | 0a 20 09 09 09 73 65 6e |gup\n");|. ...sen|
|00004740| 64 28 72 2c 20 73 74 72 | 6c 65 6e 28 72 2d 3e 72 |d(r, str|len(r->r|
|00004750| 5f 64 61 74 61 29 2c 20 | 54 45 52 4d 49 4e 41 54 |_data), |TERMINAT|
|00004760| 45 2c 20 63 6c 69 65 6e | 74 29 3b 0a 20 09 09 09 |E, clien|t);. ...|
|00004770| 73 6b 69 6c 6c 28 77 72 | 69 74 65 72 2c 20 53 49 |skill(wr|iter, SI|
|00004780| 47 4b 49 4c 4c 29 3b 0a | 09 20 09 09 65 78 69 74 |GKILL);.|. ..exit|
|00004790| 28 30 29 3b 0a 09 20 09 | 7d 0a 20 09 7d 0a 20 09 |(0);.. .|}. .}. .|
|000047a0| 65 6c 73 65 20 64 6f 65 | 78 65 63 28 72 29 3b 09 |else doe|xec(r);.|
|000047b0| 09 2f 2a 20 65 78 65 63 | 20 74 68 65 20 63 68 69 |./* exec| the chi|
|000047c0| 6c 64 20 73 68 65 6c 6c | 20 2a 2f 0a 7d 09 0a 2f |ld shell| */.}../|
|000047d0| 2a 0a 20 2a 20 64 6f 65 | 78 65 63 3a 20 70 65 72 |*. * doe|xec: per|
|000047e0| 66 6f 72 6d 20 65 78 65 | 63 20 6f 66 20 72 65 71 |form exe|c of req|
|000047f0| 75 65 73 74 65 64 20 70 | 72 6f 63 65 64 75 72 65 |uested p|rocedure|
|00004800| 0a 20 2a 2f 0a 64 6f 65 | 78 65 63 28 72 29 0a 73 |. */.doe|xec(r).s|
|00004810| 74 72 75 63 74 20 72 65 | 71 75 65 73 74 20 2a 72 |truct re|quest *r|
|00004820| 3b 0a 7b 0a 09 63 68 61 | 72 20 2a 61 72 67 76 5b |;.{..cha|r *argv[|
|00004830| 36 5d 3b 0a 09 73 70 6c | 69 74 28 63 6d 64 2c 20 |6];..spl|it(cmd, |
|00004840| 61 72 67 76 29 3b 0a 20 | 09 63 6c 6f 73 65 28 30 |argv);. |.close(0|
|00004850| 29 3b 20 63 6c 6f 73 65 | 28 31 29 3b 20 63 6c 6f |); close|(1); clo|
|00004860| 73 65 28 32 29 3b 0a 2f | 2a 0a 20 2a 20 44 75 70 |se(2);./|*. * Dup|
|00004870| 6c 69 63 61 74 65 20 52 | 45 41 44 20 73 69 64 65 |licate R|EAD side|
|00004880| 20 6f 66 20 6f 75 74 70 | 75 74 20 61 73 20 73 74 | of outp|ut as st|
|00004890| 64 69 6e 0a 20 2a 2f 0a | 20 09 69 66 28 64 75 70 |din. */.| .if(dup|
|000048a0| 28 6f 75 74 70 75 74 5b | 52 44 5d 29 20 21 3d 20 |(output[|RD]) != |
|000048b0| 30 29 20 70 65 72 72 6f | 72 28 22 64 75 70 28 69 |0) perro|r("dup(i|
|000048c0| 6e 70 75 74 29 20 21 3d | 20 30 22 29 3b 0a 2f 2a |nput) !=| 0");./*|
|000048d0| 0a 20 2a 20 44 75 70 6c | 69 63 61 74 65 20 57 52 |. * Dupl|icate WR|
|000048e0| 49 54 45 20 73 69 64 65 | 20 6f 66 20 69 6e 70 75 |ITE side| of inpu|
|000048f0| 74 20 61 73 20 20 73 74 | 64 6f 75 74 20 26 20 73 |t as st|dout & s|
|00004900| 74 64 65 72 72 0a 20 2a | 2f 0a 20 09 69 66 28 64 |tderr. *|/. .if(d|
|00004910| 75 70 28 69 6e 70 75 74 | 5b 57 54 5d 29 20 21 3d |up(input|[WT]) !=|
|00004920| 20 31 29 20 70 65 72 72 | 6f 72 28 22 64 75 70 28 | 1) perr|or("dup(|
|00004930| 6f 75 74 70 75 74 29 20 | 21 3d 20 31 22 29 3b 0a |output) |!= 1");.|
|00004940| 20 09 69 66 28 64 75 70 | 28 69 6e 70 75 74 5b 57 | .if(dup|(input[W|
|00004950| 54 5d 29 20 21 3d 20 32 | 29 20 70 65 72 72 6f 72 |T]) != 2|) perror|
|00004960| 28 22 64 75 70 28 6f 75 | 74 70 75 74 29 20 21 3d |("dup(ou|tput) !=|
|00004970| 20 32 22 29 3b 0a 2f 2a | 0a 20 2a 20 63 6c 6f 73 | 2");./*|. * clos|
|00004980| 65 20 61 6c 6c 20 74 68 | 65 20 70 61 72 65 6e 74 |e all th|e parent|
|00004990| 27 73 20 70 69 70 65 73 | 20 2d 20 74 68 65 79 27 |'s pipes| - they'|
|000049a0| 72 65 20 64 75 70 6c 69 | 63 61 74 65 64 0a 20 2a |re dupli|cated. *|
|000049b0| 2f 0a 09 63 6c 6f 73 65 | 28 69 6e 70 75 74 5b 30 |/..close|(input[0|
|000049c0| 5d 29 3b 20 63 6c 6f 73 | 65 28 69 6e 70 75 74 5b |]); clos|e(input[|
|000049d0| 31 5d 29 3b 0a 09 63 6c | 6f 73 65 28 6f 75 74 70 |1]);..cl|ose(outp|
|000049e0| 75 74 5b 30 5d 29 3b 20 | 63 6c 6f 73 65 28 6f 75 |ut[0]); |close(ou|
|000049f0| 74 70 75 74 5b 31 5d 29 | 3b 0a 09 63 6c 6f 73 65 |tput[1])|;..close|
|00004a00| 28 65 74 68 65 72 6e 65 | 74 29 3b 0a 09 73 69 67 |(etherne|t);..sig|
|00004a10| 6e 61 6c 28 53 49 47 49 | 4e 54 2c 20 53 49 47 5f |nal(SIGI|NT, SIG_|
|00004a20| 44 46 4c 29 3b 0a 09 73 | 69 67 6e 61 6c 28 53 49 |DFL);..s|ignal(SI|
|00004a30| 47 51 55 49 54 2c 20 53 | 49 47 5f 44 46 4c 29 3b |GQUIT, S|IG_DFL);|
|00004a40| 0a 09 65 78 65 63 76 70 | 28 70 72 6f 67 72 61 6d |..execvp|(program|
|00004a50| 2c 20 61 72 67 76 29 3b | 0a 09 73 70 72 69 6e 74 |, argv);|..sprint|
|00004a60| 66 28 72 2d 3e 72 5f 64 | 61 74 61 2c 20 22 43 61 |f(r->r_d|ata, "Ca|
|00004a70| 6e 6e 6f 74 20 65 78 65 | 63 20 25 73 5c 6e 22 2c |nnot exe|c %s\n",|
|00004a80| 20 63 6d 64 29 3b 0a 09 | 73 65 6e 64 28 72 2c 20 | cmd);..|send(r, |
|00004a90| 73 74 72 6c 65 6e 28 72 | 2d 3e 72 5f 64 61 74 61 |strlen(r|->r_data|
|00004aa0| 29 2c 20 44 41 54 41 2c | 20 63 6c 69 65 6e 74 29 |), DATA,| client)|
|00004ab0| 3b 0a 09 65 78 69 74 28 | 31 29 3b 0a 7d 0a 73 70 |;..exit(|1);.}.sp|
|00004ac0| 6c 69 74 28 70 2c 20 61 | 72 67 76 29 0a 72 65 67 |lit(p, a|rgv).reg|
|00004ad0| 69 73 74 65 72 20 63 68 | 61 72 20 2a 70 3b 0a 63 |ister ch|ar *p;.c|
|00004ae0| 68 61 72 20 2a 2a 61 72 | 67 76 3b 0a 7b 09 0a 09 |har **ar|gv;.{...|
|00004af0| 69 6e 74 20 6e 20 3d 20 | 31 3b 0a 09 63 68 61 72 |int n = |1;..char|
|00004b00| 20 2a 66 3b 0a 09 73 74 | 61 74 69 63 20 63 68 61 | *f;..st|atic cha|
|00004b10| 72 20 6e 61 6d 65 5b 31 | 36 5d 3b 0a 09 61 72 67 |r name[1|6];..arg|
|00004b20| 76 5b 30 5d 20 3d 20 70 | 3b 0a 09 77 68 69 6c 65 |v[0] = p|;..while|
|00004b30| 28 2a 70 29 20 7b 0a 09 | 09 69 66 28 2a 70 20 3d |(*p) {..|.if(*p =|
|00004b40| 3d 20 27 20 27 29 20 7b | 0a 09 09 09 2a 70 2b 2b |= ' ') {|....*p++|
|00004b50| 20 3d 20 27 5c 30 27 3b | 0a 09 09 09 77 68 69 6c | = '\0';|....whil|
|00004b60| 65 28 2a 70 20 3d 3d 20 | 27 20 27 29 20 70 2b 2b |e(*p == |' ') p++|
|00004b70| 3b 0a 09 09 09 61 72 67 | 76 5b 6e 2b 2b 5d 20 3d |;....arg|v[n++] =|
|00004b80| 20 70 3b 0a 09 09 7d 0a | 09 09 65 6c 73 65 20 70 | p;...}.|..else p|
|00004b90| 2b 2b 3b 0a 09 7d 0a 09 | 73 74 72 63 70 79 28 70 |++;..}..|strcpy(p|
|00004ba0| 72 6f 67 72 61 6d 2c 20 | 61 72 67 76 5b 30 5d 29 |rogram, |argv[0])|
|00004bb0| 3b 0a 09 69 66 28 66 20 | 3d 20 73 74 72 72 63 68 |;..if(f |= strrch|
|00004bc0| 72 28 61 72 67 76 5b 30 | 5d 2c 20 27 2f 27 29 29 |r(argv[0|], '/'))|
|00004bd0| 20 66 2b 2b 3b 0a 09 65 | 6c 73 65 20 66 20 3d 20 | f++;..e|lse f = |
|00004be0| 61 72 67 76 5b 30 5d 3b | 0a 09 73 70 72 69 6e 74 |argv[0];|..sprint|
|00004bf0| 66 28 6e 61 6d 65 2c 20 | 22 2d 25 73 22 2c 20 66 |f(name, |"-%s", f|
|00004c00| 29 3b 0a 09 61 72 67 76 | 5b 30 5d 20 3d 20 6e 61 |);..argv|[0] = na|
|00004c10| 6d 65 3b 0a 09 61 72 67 | 76 5b 6e 2b 2b 5d 20 3d |me;..arg|v[n++] =|
|00004c20| 20 4e 55 4c 4c 3b 0a 7d | 0a 0a 53 48 41 52 5f 45 | NULL;.}|..SHAR_E|
|00004c30| 4f 46 0a 69 66 20 74 65 | 73 74 20 36 31 38 38 20 |OF.if te|st 6188 |
|00004c40| 2d 6e 65 20 22 60 77 63 | 20 2d 63 20 3c 20 27 73 |-ne "`wc| -c < 's|
|00004c50| 65 72 76 65 72 2e 63 27 | 60 22 0a 74 68 65 6e 0a |erver.c'|`".then.|
|00004c60| 09 65 63 68 6f 20 73 68 | 61 72 3a 20 22 65 72 72 |.echo sh|ar: "err|
|00004c70| 6f 72 20 74 72 61 6e 73 | 6d 69 74 74 69 6e 67 20 |or trans|mitting |
|00004c80| 27 73 65 72 76 65 72 2e | 63 27 22 20 27 28 73 68 |'server.|c'" '(sh|
|00004c90| 6f 75 6c 64 20 68 61 76 | 65 20 62 65 65 6e 20 36 |ould hav|e been 6|
|00004ca0| 31 38 38 20 63 68 61 72 | 61 63 74 65 72 73 29 27 |188 char|acters)'|
|00004cb0| 0a 66 69 0a 66 69 0a 65 | 63 68 6f 20 73 68 61 72 |.fi.fi.e|cho shar|
|00004cc0| 3a 20 22 65 78 74 72 61 | 63 74 69 6e 67 20 27 63 |: "extra|cting 'c|
|00004cd0| 6f 6e 6e 65 63 74 2e 63 | 27 22 20 27 28 36 32 30 |onnect.c|'" '(620|
|00004ce0| 34 20 63 68 61 72 61 63 | 74 65 72 73 29 27 0a 69 |4 charac|ters)'.i|
|00004cf0| 66 20 74 65 73 74 20 2d | 66 20 27 63 6f 6e 6e 65 |f test -|f 'conne|
|00004d00| 63 74 2e 63 27 0a 74 68 | 65 6e 0a 09 65 63 68 6f |ct.c'.th|en..echo|
|00004d10| 20 73 68 61 72 3a 20 22 | 77 69 6c 6c 20 6e 6f 74 | shar: "|will not|
|00004d20| 20 6f 76 65 72 2d 77 72 | 69 74 65 20 65 78 69 73 | over-wr|ite exis|
|00004d30| 74 69 6e 67 20 66 69 6c | 65 20 27 63 6f 6e 6e 65 |ting fil|e 'conne|
|00004d40| 63 74 2e 63 27 22 0a 65 | 6c 73 65 0a 63 61 74 20 |ct.c'".e|lse.cat |
|00004d50| 3c 3c 20 5c 53 48 41 52 | 5f 45 4f 46 20 3e 20 27 |<< \SHAR|_EOF > '|
|00004d60| 63 6f 6e 6e 65 63 74 2e | 63 27 0a 2f 2a 0a 20 2a |connect.|c'./*. *|
|00004d70| 20 43 6f 70 79 72 69 67 | 68 74 20 28 43 29 20 31 | Copyrig|ht (C) 1|
|00004d80| 39 38 38 20 44 61 76 65 | 20 53 65 74 74 6c 65 2e |988 Dave| Settle.|
|00004d90| 20 41 6c 6c 20 72 69 67 | 68 74 73 20 72 65 73 65 | All rig|hts rese|
|00004da0| 72 76 65 64 2e 0a 20 2a | 20 50 65 72 6d 69 73 73 |rved.. *| Permiss|
|00004db0| 69 6f 6e 20 69 73 20 67 | 72 61 6e 74 65 64 20 74 |ion is g|ranted t|
|00004dc0| 6f 20 75 73 65 2c 20 63 | 6f 70 79 20 61 6e 64 20 |o use, c|opy and |
|00004dd0| 6d 6f 64 69 66 79 20 74 | 68 69 73 20 73 6f 66 74 |modify t|his soft|
|00004de0| 77 61 72 65 2c 20 70 72 | 6f 76 69 64 69 6e 67 0a |ware, pr|oviding.|
|00004df0| 20 2a 20 74 68 61 74 20 | 69 74 20 69 73 20 6e 6f | * that |it is no|
|00004e00| 74 20 73 6f 6c 64 20 66 | 6f 72 20 70 72 6f 66 69 |t sold f|or profi|
|00004e10| 74 2c 20 61 6e 64 20 74 | 68 61 74 20 74 68 69 73 |t, and t|hat this|
|00004e20| 20 63 6f 70 79 72 69 67 | 68 74 20 6e 6f 74 69 63 | copyrig|ht notic|
|00004e30| 65 20 69 73 20 72 65 74 | 61 69 6e 65 64 0a 20 2a |e is ret|ained. *|
|00004e40| 20 69 6e 20 61 6e 79 20 | 63 6f 70 69 65 73 20 6f | in any |copies o|
|00004e50| 66 20 74 68 65 20 73 6f | 75 72 63 65 2e 0a 20 2a |f the so|urce.. *|
|00004e60| 2f 0a 2f 2a 0a 20 2a 20 | 63 6f 6e 6e 65 63 74 2e |/./*. * |connect.|
|00004e70| 63 3a 20 63 6f 6e 6e 65 | 63 74 20 74 74 79 20 74 |c: conne|ct tty t|
|00004e80| 6f 20 72 65 6d 6f 74 65 | 20 68 6f 73 74 2e 0a 20 |o remote| host.. |
|00004e90| 2a 2f 0a 0a 23 69 6e 63 | 6c 75 64 65 20 3c 73 79 |*/..#inc|lude <sy|
|00004ea0| 73 2f 74 79 70 65 73 2e | 68 3e 20 0a 23 69 6e 63 |s/types.|h> .#inc|
|00004eb0| 6c 75 64 65 20 3c 73 79 | 73 2f 73 69 67 6e 61 6c |lude <sy|s/signal|
|00004ec0| 2e 68 3e 0a 23 69 6e 63 | 6c 75 64 65 20 3c 73 79 |.h>.#inc|lude <sy|
|00004ed0| 73 2f 65 72 72 6e 6f 2e | 68 3e 0a 23 69 6e 63 6c |s/errno.|h>.#incl|
|00004ee0| 75 64 65 20 3c 73 79 73 | 2f 75 74 73 6e 61 6d 65 |ude <sys|/utsname|
|00004ef0| 2e 68 3e 0a 23 69 6e 63 | 6c 75 64 65 20 3c 74 65 |.h>.#inc|lude <te|
|00004f00| 72 6d 69 6f 2e 68 3e 0a | 23 69 6e 63 6c 75 64 65 |rmio.h>.|#include|
|00004f10| 20 3c 70 77 64 2e 68 3e | 0a 0a 73 74 72 75 63 74 | <pwd.h>|..struct|
|00004f20| 20 70 61 73 73 77 64 20 | 2a 67 65 74 70 77 75 69 | passwd |*getpwui|
|00004f30| 64 28 29 2c 20 2a 67 65 | 74 70 77 6e 61 6d 28 29 |d(), *ge|tpwnam()|
|00004f40| 3b 0a 63 68 61 72 20 2a | 67 65 74 6c 6f 67 69 6e |;.char *|getlogin|
|00004f50| 28 29 3b 0a 69 6e 74 20 | 28 2a 73 69 67 6e 61 6c |();.int |(*signal|
|00004f60| 28 29 29 28 29 3b 0a 0a | 65 78 74 65 72 6e 20 69 |())();..|extern i|
|00004f70| 6e 74 20 65 72 72 6e 6f | 3b 0a 23 69 6e 63 6c 75 |nt errno|;.#inclu|
|00004f80| 64 65 20 3c 73 74 64 69 | 6f 2e 68 3e 0a 0a 23 64 |de <stdi|o.h>..#d|
|00004f90| 65 66 69 6e 65 20 4d 41 | 49 4e 0a 23 69 6e 63 6c |efine MA|IN.#incl|
|00004fa0| 75 64 65 20 22 6e 69 2e | 68 22 0a 0a 63 68 61 72 |ude "ni.|h"..char|
|00004fb0| 20 72 65 6d 6f 74 65 73 | 68 65 6c 6c 5b 5d 20 3d | remotes|hell[] =|
|00004fc0| 20 7b 30 2c 30 2c 30 2c | 30 2c 30 2c 30 7d 3b 0a | {0,0,0,|0,0,0};.|
|00004fd0| 0a 73 74 72 75 63 74 20 | 72 65 71 75 65 73 74 20 |.struct |request |
|00004fe0| 72 65 71 75 65 73 74 3b | 0a 0a 69 6e 74 20 72 65 |request;|..int re|
|00004ff0| 61 64 65 72 2c 20 77 72 | 69 74 65 72 3b 09 09 09 |ader, wr|iter;...|
|00005000| 2f 2a 20 50 72 6f 63 65 | 73 73 65 73 20 2a 2f 0a |/* Proce|sses */.|
|00005010| 0a 69 6e 74 20 6c 6f 67 | 69 6e 20 3d 20 30 3b 09 |.int log|in = 0;.|
|00005020| 09 09 09 2f 2a 20 41 72 | 65 20 77 65 20 64 6f 69 |.../* Ar|e we doi|
|00005030| 6e 67 20 61 20 6c 6f 67 | 69 6e 3f 20 2a 2f 0a 0a |ng a log|in? */..|
|00005040| 23 64 65 66 69 6e 65 20 | 43 4f 4f 4b 45 44 20 30 |#define |COOKED 0|
|00005050| 0a 23 64 65 66 69 6e 65 | 20 52 41 57 20 31 0a 73 |.#define| RAW 1.s|
|00005060| 74 72 75 63 74 20 74 65 | 72 6d 69 6f 20 72 61 77 |truct te|rmio raw|
|00005070| 2c 20 63 6f 6f 6b 65 64 | 3b 09 09 2f 2a 20 54 6f |, cooked|;../* To|
|00005080| 20 61 6c 6c 6f 77 20 73 | 63 72 65 65 6e 20 6d 6f | allow s|creen mo|
|00005090| 64 65 20 63 68 61 6e 67 | 65 73 20 2a 2f 0a 69 6e |de chang|es */.in|
|000050a0| 74 20 73 63 72 65 65 6e | 6d 6f 64 65 20 3d 20 43 |t screen|mode = C|
|000050b0| 4f 4f 4b 45 44 2c 20 74 | 6f 67 67 6c 65 28 29 2c |OOKED, t|oggle(),|
|000050c0| 20 74 72 61 70 28 29 3b | 0a 0a 77 61 6b 65 75 70 | trap();|..wakeup|
|000050d0| 28 29 7b 0a 09 73 69 67 | 6e 61 6c 28 53 49 47 41 |(){..sig|nal(SIGA|
|000050e0| 4c 52 4d 2c 20 77 61 6b | 65 75 70 29 3b 0a 7d 0a |LRM, wak|eup);.}.|
|000050f0| 2f 2a 0a 20 2a 20 47 6f | 74 20 61 20 73 69 67 6e |/*. * Go|t a sign|
|00005100| 61 6c 20 2d 20 64 69 65 | 2e 20 57 72 69 74 65 72 |al - die|. Writer|
|00005110| 20 69 73 20 63 68 69 6c | 64 20 70 72 6f 63 65 73 | is chil|d proces|
|00005120| 73 20 68 65 72 65 2e 0a | 20 2a 2f 0a 64 69 65 28 |s here..| */.die(|
|00005130| 73 69 67 29 7b 0a 09 69 | 66 28 73 69 67 29 20 70 |sig){..i|f(sig) p|
|00005140| 72 69 6e 74 66 28 22 43 | 6f 6e 6e 65 63 74 69 6f |rintf("C|onnectio|
|00005150| 6e 20 63 6c 6f 73 65 64 | 2e 5c 72 5c 6e 22 29 3b |n closed|.\r\n");|
|00005160| 0a 09 69 66 28 28 67 65 | 74 70 69 64 28 29 20 3d |..if((ge|tpid() =|
|00005170| 3d 20 77 72 69 74 65 72 | 29 20 26 26 20 72 65 61 |= writer|) && rea|
|00005180| 64 65 72 29 20 6b 69 6c | 6c 28 72 65 61 64 65 72 |der) kil|l(reader|
|00005190| 2c 20 53 49 47 54 45 52 | 4d 29 3b 0a 09 65 6c 73 |, SIGTER|M);..els|
|000051a0| 65 20 69 66 28 77 72 69 | 74 65 72 29 20 74 65 72 |e if(wri|ter) ter|
|000051b0| 6d 69 6e 61 74 65 28 77 | 72 69 74 65 72 29 3b 0a |minate(w|riter);.|
|000051c0| 09 73 65 6e 64 28 26 72 | 65 71 75 65 73 74 2c 20 |.send(&r|equest, |
|000051d0| 30 2c 20 54 45 52 4d 49 | 4e 41 54 45 2c 20 73 65 |0, TERMI|NATE, se|
|000051e0| 72 76 65 72 29 3b 0a 09 | 69 66 28 63 6f 6f 6b 65 |rver);..|if(cooke|
|000051f0| 64 2e 63 5f 6f 66 6c 61 | 67 29 20 69 6f 63 74 6c |d.c_ofla|g) ioctl|
|00005200| 28 66 69 6c 65 6e 6f 28 | 73 74 64 6f 75 74 29 2c |(fileno(|stdout),|
|00005210| 20 54 43 53 45 54 41 2c | 20 26 63 6f 6f 6b 65 64 | TCSETA,| &cooked|
|00005220| 29 3b 0a 09 65 78 69 74 | 28 30 29 3b 0a 7d 0a 0a |);..exit|(0);.}..|
|00005230| 73 65 6e 64 73 69 67 28 | 73 69 67 29 0a 7b 0a 09 |sendsig(|sig).{..|
|00005240| 73 74 72 75 63 74 20 72 | 65 71 75 65 73 74 20 72 |struct r|equest r|
|00005250| 65 71 75 65 73 74 3b 0a | 09 73 69 67 6e 61 6c 28 |equest;.|.signal(|
|00005260| 73 69 67 2c 20 73 65 6e | 64 73 69 67 29 3b 0a 09 |sig, sen|dsig);..|
|00005270| 69 66 28 73 69 67 20 3d | 3d 20 53 49 47 49 4e 54 |if(sig =|= SIGINT|
|00005280| 29 20 73 65 6e 64 28 26 | 72 65 71 75 65 73 74 2c |) send(&|request,|
|00005290| 20 30 2c 20 52 4d 54 53 | 49 47 49 4e 54 2c 20 73 | 0, RMTS|IGINT, s|
|000052a0| 65 72 76 65 72 29 3b 0a | 09 69 66 28 73 69 67 20 |erver);.|.if(sig |
|000052b0| 3d 3d 20 53 49 47 51 55 | 49 54 29 20 73 65 6e 64 |== SIGQU|IT) send|
|000052c0| 28 26 72 65 71 75 65 73 | 74 2c 20 30 2c 20 52 4d |(&reques|t, 0, RM|
|000052d0| 54 53 49 47 51 55 49 54 | 2c 20 73 65 72 76 65 72 |TSIGQUIT|, server|
|000052e0| 29 3b 0a 7d 0a 09 0a 0a | 6d 61 69 6e 28 61 72 67 |);.}....|main(arg|
|000052f0| 63 2c 20 61 72 67 76 29 | 0a 63 68 61 72 20 2a 2a |c, argv)|.char **|
|00005300| 61 72 67 76 3b 0a 0a 7b | 0a 09 73 74 72 75 63 74 |argv;..{|..struct|
|00005310| 20 75 74 73 6e 61 6d 65 | 20 75 74 73 3b 0a 09 72 | utsname| uts;..r|
|00005320| 65 67 69 73 74 65 72 20 | 63 68 61 72 20 2a 73 79 |egister |char *sy|
|00005330| 73 20 3d 20 61 72 67 76 | 5b 61 72 67 63 20 2d 20 |s = argv|[argc - |
|00005340| 31 5d 3b 0a 09 69 6e 74 | 20 69 3b 0a 09 69 66 28 |1];..int| i;..if(|
|00005350| 61 72 67 63 20 3c 20 32 | 29 20 7b 0a 09 09 70 72 |argc < 2|) {...pr|
|00005360| 69 6e 74 66 28 22 75 73 | 61 67 65 3a 20 25 73 20 |intf("us|age: %s |
|00005370| 68 6f 73 74 6e 61 6d 65 | 5c 6e 22 2c 20 61 72 67 |hostname|\n", arg|
|00005380| 76 5b 30 5d 29 3b 0a 09 | 09 65 78 69 74 28 31 29 |v[0]);..|.exit(1)|
|00005390| 3b 0a 09 7d 0a 09 75 6e | 61 6d 65 28 26 75 74 73 |;..}..un|ame(&uts|
|000053a0| 29 3b 0a 09 66 6f 72 28 | 69 3d 31 3b 69 3c 61 72 |);..for(|i=1;i<ar|
|000053b0| 67 63 3b 69 2b 2b 29 20 | 69 66 28 2a 61 72 67 76 |gc;i++) |if(*argv|
|000053c0| 5b 69 5d 20 3d 3d 20 27 | 2d 27 29 20 73 77 69 74 |[i] == '|-') swit|
|000053d0| 63 68 28 61 72 67 76 5b | 69 5d 5b 31 5d 29 20 7b |ch(argv[|i][1]) {|
|000053e0| 0a 09 63 61 73 65 20 27 | 6c 27 3a 0a 09 09 6c 6f |..case '|l':...lo|
|000053f0| 67 69 6e 20 3d 20 31 3b | 0a 09 09 62 72 65 61 6b |gin = 1;|...break|
|00005400| 3b 0a 09 63 61 73 65 20 | 27 64 27 3a 0a 09 09 64 |;..case |'d':...d|
|00005410| 65 62 75 67 20 3d 20 31 | 3b 0a 09 09 62 72 65 61 |ebug = 1|;...brea|
|00005420| 6b 3b 0a 09 7d 0a 09 73 | 69 67 6e 61 6c 28 53 49 |k;..}..s|ignal(SI|
|00005430| 47 41 4c 52 4d 2c 20 77 | 61 6b 65 75 70 29 3b 0a |GALRM, w|akeup);.|
|00005440| 09 73 69 67 6e 61 6c 28 | 53 49 47 54 45 52 4d 2c |.signal(|SIGTERM,|
|00005450| 20 53 49 47 5f 49 47 4e | 29 3b 0a 09 69 66 28 63 | SIG_IGN|);..if(c|
|00005460| 6f 6e 66 69 67 75 72 65 | 28 63 6c 69 65 6e 74 2c |onfigure|(client,|
|00005470| 20 33 2c 20 67 65 74 70 | 69 64 28 29 29 20 3d 3d | 3, getp|id()) ==|
|00005480| 20 2d 31 29 20 65 78 69 | 74 28 31 29 3b 0a 09 69 | -1) exi|t(1);..i|
|00005490| 66 28 28 69 20 3d 20 68 | 6f 73 74 61 64 64 72 28 |f((i = h|ostaddr(|
|000054a0| 61 72 67 76 5b 61 72 67 | 63 20 2d 20 31 5d 29 29 |argv[arg|c - 1]))|
|000054b0| 20 3d 3d 20 2d 31 29 20 | 7b 0a 09 09 70 72 69 6e | == -1) |{...prin|
|000054c0| 74 66 28 22 48 6f 73 74 | 20 27 25 73 27 20 6e 6f |tf("Host| '%s' no|
|000054d0| 74 20 6b 6e 6f 77 6e 5c | 6e 22 2c 20 61 72 67 76 |t known\|n", argv|
|000054e0| 5b 61 72 67 63 20 2d 20 | 31 5d 29 3b 0a 09 09 65 |[argc - |1]);...e|
|000054f0| 78 69 74 28 31 29 3b 0a | 09 7d 0a 09 65 6c 73 65 |xit(1);.|.}..else|
|00005500| 20 73 65 72 76 65 72 5b | 4e 4f 44 45 5d 20 3d 20 | server[|NODE] = |
|00005510| 69 3b 0a 09 63 6f 6e 6e | 65 63 74 28 73 65 72 76 |i;..conn|ect(serv|
|00005520| 65 72 2c 20 73 79 73 29 | 3b 0a 09 72 65 74 75 72 |er, sys)|;..retur|
|00005530| 6e 28 30 29 3b 0a 7d 0a | 2f 2a 0a 20 2a 20 63 6f |n(0);.}.|/*. * co|
|00005540| 6e 6e 65 63 74 28 61 64 | 64 72 29 3a 20 73 65 74 |nnect(ad|dr): set|
|00005550| 20 75 70 20 63 6f 6e 6e | 65 63 74 69 6f 6e 20 74 | up conn|ection t|
|00005560| 6f 20 65 74 68 65 72 6e | 65 74 20 61 64 64 72 65 |o ethern|et addre|
|00005570| 73 73 20 27 61 64 64 72 | 27 20 28 73 79 73 74 65 |ss 'addr|' (syste|
|00005580| 6d 20 27 73 79 73 27 29 | 0a 20 2a 2f 0a 63 6f 6e |m 'sys')|. */.con|
|00005590| 6e 65 63 74 28 61 64 64 | 72 2c 20 73 79 73 29 0a |nect(add|r, sys).|
|000055a0| 63 68 61 72 20 2a 61 64 | 64 72 2c 20 2a 73 79 73 |char *ad|dr, *sys|
|000055b0| 3b 0a 7b 0a 09 72 65 67 | 69 73 74 65 72 20 73 74 |;.{..reg|ister st|
|000055c0| 72 75 63 74 20 72 65 71 | 75 65 73 74 20 2a 72 20 |ruct req|uest *r |
|000055d0| 3d 20 26 72 65 71 75 65 | 73 74 3b 0a 09 63 68 61 |= &reque|st;..cha|
|000055e0| 72 20 2a 73 68 65 6c 6c | 2c 20 2a 75 73 65 72 3b |r *shell|, *user;|
|000055f0| 0a 09 69 6e 74 20 6e 3b | 0a 09 73 74 72 75 63 74 |..int n;|..struct|
|00005600| 20 70 61 73 73 77 64 20 | 2a 70 77 3b 0a 2f 2a 0a | passwd |*pw;./*.|
|00005610| 20 2a 20 73 65 6e 64 20 | 6f 66 66 20 6f 75 72 20 | * send |off our |
|00005620| 6c 6f 67 69 6e 20 6e 61 | 6d 65 20 61 6e 64 20 75 |login na|me and u|
|00005630| 69 64 20 74 6f 20 72 65 | 6d 6f 74 65 20 68 6f 73 |id to re|mote hos|
|00005640| 74 2e 0a 20 2a 20 61 6c | 73 6f 20 73 65 6e 64 20 |t.. * al|so send |
|00005650| 74 69 6d 65 7a 6f 6e 65 | 2e 0a 20 2a 2f 0a 20 09 |timezone|.. */. .|
|00005660| 69 66 28 28 75 73 65 72 | 20 3d 20 67 65 74 6c 6f |if((user| = getlo|
|00005670| 67 69 6e 28 29 29 20 3d | 3d 20 4e 55 4c 4c 29 20 |gin()) =|= NULL) |
|00005680| 0a 20 09 09 70 77 20 3d | 20 67 65 74 70 77 75 69 |. ..pw =| getpwui|
|00005690| 64 28 67 65 74 75 69 64 | 28 29 29 3b 0a 20 09 65 |d(getuid|());. .e|
|000056a0| 6c 73 65 0a 20 09 09 70 | 77 20 3d 20 67 65 74 70 |lse. ..p|w = getp|
|000056b0| 77 6e 61 6d 28 75 73 65 | 72 29 3b 0a 20 09 69 66 |wnam(use|r);. .if|
|000056c0| 28 70 77 20 3d 3d 20 4e | 55 4c 4c 29 20 7b 0a 20 |(pw == N|ULL) {. |
|000056d0| 09 09 70 72 69 6e 74 66 | 28 22 43 61 6e 27 74 20 |..printf|("Can't |
|000056e0| 64 65 74 65 72 6d 69 6e | 65 20 79 6f 75 72 20 75 |determin|e your u|
|000056f0| 73 65 72 20 6e 61 6d 65 | 21 5c 6e 22 29 3b 0a 20 |ser name|!\n");. |
|00005700| 09 09 65 78 69 74 28 31 | 29 3b 0a 20 09 7d 0a 20 |..exit(1|);. .}. |
|00005710| 09 69 66 28 2a 70 77 2d | 3e 70 77 5f 6e 61 6d 65 |.if(*pw-|>pw_name|
|00005720| 20 3d 3d 20 30 29 20 7b | 0a 20 09 09 70 72 69 6e | == 0) {|. ..prin|
|00005730| 74 66 28 22 59 6f 75 72 | 20 75 73 65 72 20 6e 61 |tf("Your| user na|
|00005740| 6d 65 20 69 73 20 4e 55 | 4c 4c 21 20 59 6f 75 20 |me is NU|LL! You |
|00005750| 73 65 65 6d 20 74 6f 20 | 62 65 20 25 73 5c 6e 22 |seem to |be %s\n"|
|00005760| 2c 0a 20 09 09 09 75 73 | 65 72 20 3f 20 75 73 65 |,. ...us|er ? use|
|00005770| 72 20 3a 20 22 75 6e 6b | 6e 6f 77 6e 22 29 3b 0a |r : "unk|nown");.|
|00005780| 20 09 09 65 78 69 74 28 | 31 29 3b 0a 20 09 7d 0a | ..exit(|1);. .}.|
|00005790| 09 70 72 69 6e 74 66 28 | 22 54 72 79 69 6e 67 20 |.printf(|"Trying |
|000057a0| 74 6f 20 63 6f 6e 6e 65 | 63 74 20 74 6f 20 25 73 |to conne|ct to %s|
|000057b0| 20 2e 2e 2e 20 22 2c 20 | 69 70 61 64 64 72 28 61 | ... ", |ipaddr(a|
|000057c0| 64 64 72 29 29 3b 0a 20 | 09 66 66 6c 75 73 68 28 |ddr));. |.fflush(|
|000057d0| 73 74 64 6f 75 74 29 3b | 0a 09 73 70 72 69 6e 74 |stdout);|..sprint|
|000057e0| 66 28 72 2d 3e 72 5f 64 | 61 74 61 2c 20 22 25 64 |f(r->r_d|ata, "%d|
|000057f0| 20 25 73 20 54 45 52 4d | 3d 25 73 22 2c 20 0a 09 | %s TERM|=%s", ..|
|00005800| 09 70 77 2d 3e 70 77 5f | 75 69 64 2c 20 70 77 2d |.pw->pw_|uid, pw-|
|00005810| 3e 70 77 5f 6e 61 6d 65 | 2c 20 67 65 74 65 6e 76 |>pw_name|, getenv|
|00005820| 28 22 54 45 52 4d 22 29 | 29 3b 0a 09 6e 20 3d 20 |("TERM")|);..n = |
|00005830| 73 74 72 6c 65 6e 28 72 | 2d 3e 72 5f 64 61 74 61 |strlen(r|->r_data|
|00005840| 29 3b 0a 09 73 65 6e 64 | 28 72 2c 20 6e 2c 20 52 |);..send|(r, n, R|
|00005850| 45 51 55 45 53 54 2c 20 | 61 64 64 72 29 3b 0a 09 |EQUEST, |addr);..|
|00005860| 72 65 63 76 28 72 29 3b | 0a 20 09 69 66 28 72 2d |recv(r);|. .if(r-|
|00005870| 3e 72 5f 74 79 70 65 20 | 3d 3d 20 54 45 52 4d 49 |>r_type |== TERMI|
|00005880| 4e 41 54 45 29 20 7b 0a | 20 09 09 70 72 69 6e 74 |NATE) {.| ..print|
|00005890| 66 28 22 72 65 6a 65 63 | 74 65 64 21 5c 6e 25 73 |f("rejec|ted!\n%s|
|000058a0| 3a 20 25 73 5c 6e 22 2c | 20 73 79 73 2c 20 72 2d |: %s\n",| sys, r-|
|000058b0| 3e 72 5f 64 61 74 61 29 | 3b 0a 20 09 09 65 78 69 |>r_data)|;. ..exi|
|000058c0| 74 28 30 29 3b 0a 20 09 | 7d 0a 09 6d 65 6d 63 70 |t(0);. .|}..memcp|
|000058d0| 79 28 73 65 72 76 65 72 | 2c 20 72 2d 3e 72 5f 70 |y(server|, r->r_p|
|000058e0| 6f 72 74 2e 73 72 63 61 | 64 64 72 2c 20 45 54 48 |ort.srca|ddr, ETH|
|000058f0| 45 52 53 49 5a 45 29 3b | 0a 2f 2a 0a 20 2a 20 74 |ERSIZE);|./*. * t|
|00005900| 72 61 70 20 73 69 67 6e | 61 6c 73 20 66 72 6f 6d |rap sign|als from|
|00005910| 20 68 65 72 65 20 6f 6e | 2c 20 73 6f 20 74 68 61 | here on|, so tha|
|00005920| 74 20 77 65 20 63 61 6e | 20 74 65 72 6d 69 6e 61 |t we can| termina|
|00005930| 74 65 20 74 68 65 20 72 | 65 6d 6f 74 65 20 73 69 |te the r|emote si|
|00005940| 64 65 2e 0a 20 2a 2f 0a | 09 73 69 67 6e 61 6c 28 |de.. */.|.signal(|
|00005950| 53 49 47 51 55 49 54 2c | 20 74 6f 67 67 6c 65 29 |SIGQUIT,| toggle)|
|00005960| 3b 0a 09 73 69 67 6e 61 | 6c 28 53 49 47 49 4e 54 |;..signa|l(SIGINT|
|00005970| 2c 20 73 65 6e 64 73 69 | 67 29 3b 0a 09 73 69 67 |, sendsi|g);..sig|
|00005980| 6e 61 6c 28 53 49 47 48 | 55 50 2c 20 64 69 65 29 |nal(SIGH|UP, die)|
|00005990| 3b 0a 09 70 72 69 6e 74 | 66 28 22 4f 4b 5c 6e 53 |;..print|f("OK\nS|
|000059a0| 74 61 72 74 69 6e 67 20 | 72 65 6d 6f 74 65 20 25 |tarting |remote %|
|000059b0| 73 20 2e 2e 2e 20 22 2c | 20 6c 6f 67 69 6e 20 3f |s ... ",| login ?|
|000059c0| 20 22 6c 6f 67 69 6e 22 | 20 3a 20 22 73 68 65 6c | "login"| : "shel|
|000059d0| 6c 22 29 3b 0a 09 66 66 | 6c 75 73 68 28 73 74 64 |l");..ff|lush(std|
|000059e0| 6f 75 74 29 3b 0a 09 69 | 66 28 6c 6f 67 69 6e 29 |out);..i|f(login)|
|000059f0| 20 6e 20 3d 20 73 70 72 | 69 6e 74 66 28 72 2d 3e | n = spr|intf(r->|
|00005a00| 72 5f 64 61 74 61 2c 20 | 22 6c 6f 67 69 6e 22 29 |r_data, |"login")|
|00005a10| 3b 0a 20 09 65 6c 73 65 | 20 7b 0a 20 09 09 73 68 |;. .else| {. ..sh|
|00005a20| 65 6c 6c 20 3d 20 67 65 | 74 65 6e 76 28 22 53 48 |ell = ge|tenv("SH|
|00005a30| 45 4c 4c 22 29 3b 0a 09 | 20 09 69 66 28 73 68 65 |ELL");..| .if(she|
|00005a40| 6c 6c 20 3d 3d 20 30 29 | 20 73 68 65 6c 6c 20 3d |ll == 0)| shell =|
|00005a50| 20 22 2f 62 69 6e 2f 73 | 68 22 3b 0a 09 20 09 6e | "/bin/s|h";.. .n|
|00005a60| 20 3d 20 73 70 72 69 6e | 74 66 28 72 2d 3e 72 5f | = sprin|tf(r->r_|
|00005a70| 64 61 74 61 2c 20 22 25 | 73 20 2d 69 22 2c 20 73 |data, "%|s -i", s|
|00005a80| 68 65 6c 6c 29 3b 0a 09 | 7d 0a 20 09 73 65 6e 64 |hell);..|}. .send|
|00005a90| 28 72 2c 20 6e 2c 20 52 | 45 51 55 45 53 54 2c 20 |(r, n, R|EQUEST, |
|00005aa0| 73 65 72 76 65 72 29 3b | 0a 20 09 72 65 63 76 28 |server);|. .recv(|
|00005ab0| 72 29 3b 0a 20 09 69 66 | 28 72 2d 3e 72 5f 74 79 |r);. .if|(r->r_ty|
|00005ac0| 70 65 20 3d 3d 20 54 45 | 52 4d 49 4e 41 54 45 29 |pe == TE|RMINATE)|
|00005ad0| 20 7b 0a 20 09 09 70 72 | 69 6e 74 66 28 22 72 65 | {. ..pr|intf("re|
|00005ae0| 6a 65 63 74 65 64 21 5c | 6e 25 73 3a 20 25 73 5c |jected!\|n%s: %s\|
|00005af0| 6e 22 2c 20 73 79 73 2c | 20 72 2d 3e 72 5f 64 61 |n", sys,| r->r_da|
|00005b00| 74 61 29 3b 0a 20 09 09 | 65 78 69 74 28 30 29 3b |ta);. ..|exit(0);|
|00005b10| 0a 20 09 7d 0a 20 09 70 | 72 69 6e 74 66 28 22 4f |. .}. .p|rintf("O|
|00005b20| 4b 5c 6e 43 6f 6e 6e 65 | 63 74 69 6f 6e 20 63 6f |K\nConne|ction co|
|00005b30| 6d 70 6c 65 74 65 20 2e | 2e 2e 20 73 65 72 76 65 |mplete .|.. serve|
|00005b40| 72 20 69 73 20 25 73 5c | 6e 22 2c 20 69 70 61 64 |r is %s\|n", ipad|
|00005b50| 64 72 28 73 65 72 76 65 | 72 29 29 3b 0a 2f 2a 0a |dr(serve|r));./*.|
|00005b60| 20 2a 20 53 65 74 20 75 | 70 20 74 68 65 20 74 65 | * Set u|p the te|
|00005b70| 72 6d 69 6f 20 73 74 72 | 75 63 74 75 72 65 73 20 |rmio str|uctures |
|00005b80| 6e 65 65 64 65 64 20 66 | 6f 72 20 6d 6f 64 65 20 |needed f|or mode |
|00005b90| 73 77 61 70 70 69 6e 67 | 0a 20 2a 2f 0a 20 09 69 |swapping|. */. .i|
|00005ba0| 6f 63 74 6c 28 66 69 6c | 65 6e 6f 28 73 74 64 69 |octl(fil|eno(stdi|
|00005bb0| 6e 29 2c 20 54 43 47 45 | 54 41 2c 20 26 63 6f 6f |n), TCGE|TA, &coo|
|00005bc0| 6b 65 64 29 3b 0a 20 09 | 69 6f 63 74 6c 28 66 69 |ked);. .|ioctl(fi|
|00005bd0| 6c 65 6e 6f 28 73 74 64 | 69 6e 29 2c 20 54 43 47 |leno(std|in), TCG|
|00005be0| 45 54 41 2c 20 26 72 61 | 77 29 3b 0a 20 09 72 61 |ETA, &ra|w);. .ra|
|00005bf0| 77 2e 63 5f 6f 66 6c 61 | 67 20 26 3d 20 7e 4f 50 |w.c_ofla|g &= ~OP|
|00005c00| 4f 53 54 3b 0a 20 09 72 | 61 77 2e 63 5f 63 63 5b |OST;. .r|aw.c_cc[|
|00005c10| 56 4d 49 4e 5d 20 3d 20 | 31 3b 0a 20 09 72 61 77 |VMIN] = |1;. .raw|
|00005c20| 2e 63 5f 63 63 5b 56 54 | 49 4d 45 5d 20 3d 20 30 |.c_cc[VT|IME] = 0|
|00005c30| 3b 0a 20 09 72 61 77 2e | 63 5f 69 66 6c 61 67 20 |;. .raw.|c_iflag |
|00005c40| 3d 20 30 3b 0a 20 09 72 | 61 77 2e 63 5f 6c 66 6c |= 0;. .r|aw.c_lfl|
|00005c50| 61 67 20 26 3d 20 7e 28 | 49 43 41 4e 4f 4e 20 7c |ag &= ~(|ICANON ||
|00005c60| 20 45 43 48 4f 20 7c 20 | 45 43 48 4f 45 20 7c 20 | ECHO | |ECHOE | |
|00005c70| 45 43 48 4f 4b 20 7c 20 | 45 43 48 4f 4e 4c 29 3b |ECHOK | |ECHONL);|
|00005c80| 0a 20 09 73 63 72 65 65 | 6e 6d 6f 64 65 20 3d 20 |. .scree|nmode = |
|00005c90| 43 4f 4f 4b 45 44 3b 0a | 2f 2a 0a 20 2a 20 66 6f |COOKED;.|/*. * fo|
|00005ca0| 72 6b 20 66 6f 72 20 72 | 65 61 64 65 72 20 61 6e |rk for r|eader an|
|00005cb0| 64 20 77 72 69 74 65 72 | 20 70 72 6f 63 65 73 73 |d writer| process|
|00005cc0| 65 73 2e 0a 20 2a 2f 0a | 09 72 65 61 64 65 72 20 |es.. */.|.reader |
|00005cd0| 3d 20 67 65 74 70 69 64 | 28 29 3b 0a 20 09 69 66 |= getpid|();. .if|
|00005ce0| 28 77 72 69 74 65 72 20 | 3d 20 66 6f 72 6b 28 29 |(writer |= fork()|
|00005cf0| 29 20 7b 0a 2f 2a 0a 20 | 2a 20 49 66 20 77 65 20 |) {./*. |* If we |
|00005d00| 61 72 65 20 73 74 61 72 | 74 69 6e 67 20 61 20 72 |are star|ting a r|
|00005d10| 65 6d 6f 74 65 20 6c 6f | 67 69 6e 20 76 69 61 20 |emote lo|gin via |
|00005d20| 61 20 70 74 74 79 2c 20 | 74 68 65 6e 20 74 68 65 |a ptty, |then the|
|00005d30| 20 72 65 6d 6f 74 65 20 | 68 6f 73 74 20 77 69 6c | remote |host wil|
|00005d40| 6c 0a 20 2a 20 65 63 68 | 6f 2c 20 73 6f 20 73 65 |l. * ech|o, so se|
|00005d50| 74 20 74 6f 20 72 61 77 | 20 6d 6f 64 65 2e 20 53 |t to raw| mode. S|
|00005d60| 49 47 51 55 49 54 20 77 | 69 6c 6c 20 63 6c 6f 73 |IGQUIT w|ill clos|
|00005d70| 65 20 74 68 65 20 63 6f | 6e 6e 65 63 74 69 6f 6e |e the co|nnection|
|00005d80| 2e 0a 20 2a 2f 0a 20 09 | 09 69 66 28 6c 6f 67 69 |.. */. .|.if(logi|
|00005d90| 6e 29 20 7b 0a 20 09 09 | 09 73 63 72 65 65 6e 6d |n) {. ..|.screenm|
|00005da0| 6f 64 65 20 3d 20 52 41 | 57 3b 0a 09 09 09 69 6f |ode = RA|W;....io|
|00005db0| 63 74 6c 28 66 69 6c 65 | 6e 6f 28 73 74 64 69 6e |ctl(file|no(stdin|
|00005dc0| 29 2c 20 54 43 53 45 54 | 41 2c 20 26 72 61 77 29 |), TCSET|A, &raw)|
|00005dd0| 3b 0a 09 09 09 73 69 67 | 6e 61 6c 28 53 49 47 51 |;....sig|nal(SIGQ|
|00005de0| 55 49 54 2c 20 64 69 65 | 29 3b 0a 09 09 09 73 69 |UIT, die|);....si|
|00005df0| 67 6e 61 6c 28 53 49 47 | 49 4e 54 2c 20 74 72 61 |gnal(SIG|INT, tra|
|00005e00| 70 29 3b 0a 09 09 7d 0a | 09 09 65 6c 73 65 20 7b |p);...}.|..else {|
|00005e10| 0a 2f 2a 0a 20 2a 20 53 | 65 6e 64 20 74 68 65 20 |./*. * S|end the |
|00005e20| 72 65 6d 6f 74 65 20 73 | 68 65 6c 6c 20 61 6e 20 |remote s|hell an |
|00005e30| 69 6e 69 74 69 61 6c 20 | 6e 65 77 6c 69 6e 65 2c |initial |newline,|
|00005e40| 20 73 6f 20 74 68 61 74 | 20 74 68 65 20 75 73 65 | so that| the use|
|00005e50| 72 20 73 65 65 73 20 61 | 20 70 72 6f 6d 70 74 2e |r sees a| prompt.|
|00005e60| 0a 20 2a 2f 0a 09 09 09 | 72 2d 3e 72 5f 64 61 74 |. */....|r->r_dat|
|00005e70| 61 5b 30 5d 20 3d 20 27 | 5c 6e 27 3b 0a 09 09 09 |a[0] = '|\n';....|
|00005e80| 73 65 6e 64 28 72 2c 20 | 31 2c 20 44 41 54 41 2c |send(r, |1, DATA,|
|00005e90| 20 73 65 72 76 65 72 29 | 3b 0a 09 09 7d 0a 20 09 | server)|;...}. .|
|00005ea0| 09 77 68 69 6c 65 28 6e | 20 3d 20 72 65 61 64 28 |.while(n| = read(|
|00005eb0| 66 69 6c 65 6e 6f 28 73 | 74 64 69 6e 29 2c 20 72 |fileno(s|tdin), r|
|00005ec0| 2d 3e 72 5f 64 61 74 61 | 2c 20 73 69 7a 65 6f 66 |->r_data|, sizeof|
|00005ed0| 20 72 2d 3e 72 5f 64 61 | 74 61 29 29 20 7b 0a 20 | r->r_da|ta)) {. |
|00005ee0| 09 09 09 69 66 28 6e 20 | 3d 3d 20 2d 31 29 20 7b |...if(n |== -1) {|
|00005ef0| 0a 20 09 09 09 09 69 66 | 28 65 72 72 6e 6f 20 3d |. ....if|(errno =|
|00005f00| 3d 20 45 49 4e 54 52 29 | 20 63 6f 6e 74 69 6e 75 |= EINTR)| continu|
|00005f10| 65 3b 0a 20 09 09 09 09 | 65 6c 73 65 20 62 72 65 |e;. ....|else bre|
|00005f20| 61 6b 3b 0a 20 09 09 09 | 7d 0a 69 66 28 64 65 62 |ak;. ...|}.if(deb|
|00005f30| 75 67 29 20 7b 0a 09 09 | 09 70 72 69 6e 74 66 28 |ug) {...|.printf(|
|00005f40| 22 63 6c 69 65 6e 74 3a | 20 73 65 6e 74 20 5b 22 |"client:| sent ["|
|00005f50| 29 3b 0a 09 09 09 77 72 | 69 74 65 28 66 69 6c 65 |);....wr|ite(file|
|00005f60| 6e 6f 28 73 74 64 6f 75 | 74 29 2c 20 72 2d 3e 72 |no(stdou|t), r->r|
|00005f70| 5f 64 61 74 61 2c 20 6e | 29 3b 0a 09 09 09 70 72 |_data, n|);....pr|
|00005f80| 69 6e 74 66 28 22 5d 20 | 74 6f 20 25 73 5c 6e 22 |intf("] |to %s\n"|
|00005f90| 2c 20 69 70 61 64 64 72 | 28 73 65 72 76 65 72 29 |, ipaddr|(server)|
|00005fa0| 29 3b 0a 7d 0a 20 09 09 | 09 73 65 6e 64 28 72 2c |);.}. ..|.send(r,|
|00005fb0| 20 6e 2c 20 44 41 54 41 | 2c 20 73 65 72 76 65 72 | n, DATA|, server|
|00005fc0| 29 3b 0a 20 09 09 7d 0a | 20 09 09 73 65 6e 64 28 |);. ..}.| ..send(|
|00005fd0| 72 2c 20 30 2c 20 54 45 | 52 4d 49 4e 41 54 45 2c |r, 0, TE|RMINATE,|
|00005fe0| 20 73 65 72 76 65 72 29 | 3b 0a 20 09 09 74 65 72 | server)|;. ..ter|
|00005ff0| 6d 69 6e 61 74 65 28 77 | 72 69 74 65 72 29 3b 0a |minate(w|riter);.|
|00006000| 20 09 09 69 6f 63 74 6c | 28 66 69 6c 65 6e 6f 28 | ..ioctl|(fileno(|
|00006010| 73 74 64 6f 75 74 29 2c | 20 54 43 53 45 54 41 2c |stdout),| TCSETA,|
|00006020| 20 26 63 6f 6f 6b 65 64 | 29 3b 0a 20 09 09 65 78 | &cooked|);. ..ex|
|00006030| 69 74 28 30 29 3b 0a 20 | 09 7d 0a 09 65 6c 73 65 |it(0);. |.}..else|
|00006040| 20 7b 0a 20 09 09 73 69 | 67 6e 61 6c 28 53 49 47 | {. ..si|gnal(SIG|
|00006050| 49 4e 54 2c 20 53 49 47 | 5f 49 47 4e 29 3b 0a 20 |INT, SIG|_IGN);. |
|00006060| 09 09 73 69 67 6e 61 6c | 28 53 49 47 51 55 49 54 |..signal|(SIGQUIT|
|00006070| 2c 20 53 49 47 5f 49 47 | 4e 29 3b 0a 20 09 09 77 |, SIG_IG|N);. ..w|
|00006080| 68 69 6c 65 28 31 29 20 | 7b 0a 09 09 09 72 65 63 |hile(1) |{....rec|
|00006090| 76 28 72 29 3b 0a 69 66 | 28 64 65 62 75 67 29 20 |v(r);.if|(debug) |
|000060a0| 7b 0a 20 09 09 09 70 72 | 69 6e 74 66 28 22 63 6c |{. ...pr|intf("cl|
|000060b0| 69 65 6e 74 3a 20 67 6f | 74 20 5b 22 29 3b 0a 09 |ient: go|t [");..|
|000060c0| 09 09 77 72 69 74 65 28 | 66 69 6c 65 6e 6f 28 73 |..write(|fileno(s|
|000060d0| 74 64 6f 75 74 29 2c 20 | 72 2d 3e 72 5f 64 61 74 |tdout), |r->r_dat|
|000060e0| 61 2c 20 72 2d 3e 72 5f | 73 69 7a 65 29 3b 0a 20 |a, r->r_|size);. |
|000060f0| 09 09 09 70 72 69 6e 74 | 66 28 22 5d 20 66 72 6f |...print|f("] fro|
|00006100| 6d 20 25 73 5c 6e 22 2c | 20 69 70 61 64 64 72 28 |m %s\n",| ipaddr(|
|00006110| 72 2d 3e 72 5f 70 6f 72 | 74 2e 73 72 63 61 64 64 |r->r_por|t.srcadd|
|00006120| 72 29 29 3b 0a 7d 0a 09 | 20 09 09 69 66 28 72 2d |r));.}..| ..if(r-|
|00006130| 3e 72 5f 74 79 70 65 20 | 3d 3d 20 54 45 52 4d 49 |>r_type |== TERMI|
|00006140| 4e 41 54 45 29 20 7b 0a | 20 09 09 09 09 70 72 69 |NATE) {.| ....pri|
|00006150| 6e 74 66 28 22 4c 6f 73 | 74 20 72 65 6d 6f 74 65 |ntf("Los|t remote|
|00006160| 20 63 6f 6e 6e 65 63 74 | 69 6f 6e 20 5b 22 29 3b | connect|ion [");|
|00006170| 0a 20 09 09 09 09 66 66 | 6c 75 73 68 28 73 74 64 |. ....ff|lush(std|
|00006180| 6f 75 74 29 3b 0a 20 09 | 09 09 09 77 72 69 74 65 |out);. .|...write|
|00006190| 28 66 69 6c 65 6e 6f 28 | 73 74 64 6f 75 74 29 2c |(fileno(|stdout),|
|000061a0| 20 72 2d 3e 72 5f 64 61 | 74 61 2c 20 72 2d 3e 72 | r->r_da|ta, r->r|
|000061b0| 5f 73 69 7a 65 29 3b 0a | 20 09 09 09 09 70 72 69 |_size);.| ....pri|
|000061c0| 6e 74 66 28 22 5d 5c 6e | 22 29 3b 0a 09 09 09 09 |ntf("]\n|");.....|
|000061d0| 6b 69 6c 6c 28 72 65 61 | 64 65 72 2c 20 53 49 47 |kill(rea|der, SIG|
|000061e0| 54 45 52 4d 29 3b 0a 09 | 09 09 09 69 6f 63 74 6c |TERM);..|...ioctl|
|000061f0| 28 66 69 6c 65 6e 6f 28 | 73 74 64 6f 75 74 29 2c |(fileno(|stdout),|
|00006200| 20 54 43 53 45 54 41 2c | 20 26 63 6f 6f 6b 65 64 | TCSETA,| &cooked|
|00006210| 29 3b 0a 20 09 09 09 09 | 65 78 69 74 28 30 29 3b |);. ....|exit(0);|
|00006220| 0a 09 20 09 09 7d 0a 20 | 09 09 09 77 72 69 74 65 |.. ..}. |...write|
|00006230| 28 66 69 6c 65 6e 6f 28 | 73 74 64 6f 75 74 29 2c |(fileno(|stdout),|
|00006240| 20 72 2d 3e 72 5f 64 61 | 74 61 2c 20 72 2d 3e 72 | r->r_da|ta, r->r|
|00006250| 5f 73 69 7a 65 29 3b 0a | 20 09 09 7d 0a 20 09 7d |_size);.| ..}. .}|
|00006260| 0a 7d 0a 2f 2a 0a 20 2a | 20 74 6f 67 67 6c 65 3a |.}./*. *| toggle:|
|00006270| 20 63 68 61 6e 67 65 20 | 73 63 72 65 65 6e 20 6d | change |screen m|
|00006280| 6f 64 65 20 66 72 6f 6d | 20 52 41 57 20 3c 2d 3e |ode from| RAW <->|
|00006290| 20 43 4f 4f 4b 45 44 0a | 20 2a 2f 0a 74 6f 67 67 | COOKED.| */.togg|
|000062a0| 6c 65 28 73 69 67 29 7b | 0a 09 73 74 61 74 69 63 |le(sig){|..static|
|000062b0| 20 69 6e 74 20 28 2a 68 | 61 6e 64 6c 65 72 29 28 | int (*h|andler)(|
|000062c0| 29 3b 0a 09 73 69 67 6e | 61 6c 28 73 69 67 2c 20 |);..sign|al(sig, |
|000062d0| 74 6f 67 67 6c 65 29 3b | 0a 09 73 77 69 74 63 68 |toggle);|..switch|
|000062e0| 28 73 63 72 65 65 6e 6d | 6f 64 65 29 20 7b 0a 09 |(screenm|ode) {..|
|000062f0| 63 61 73 65 20 43 4f 4f | 4b 45 44 3a 0a 09 09 68 |case COO|KED:...h|
|00006300| 61 6e 64 6c 65 72 20 3d | 20 73 69 67 6e 61 6c 28 |andler =| signal(|
|00006310| 53 49 47 49 4e 54 2c 20 | 74 72 61 70 29 3b 0a 09 |SIGINT, |trap);..|
|00006320| 09 69 6f 63 74 6c 28 66 | 69 6c 65 6e 6f 28 73 74 |.ioctl(f|ileno(st|
|00006330| 64 69 6e 29 2c 20 54 43 | 53 45 54 41 2c 20 26 72 |din), TC|SETA, &r|
|00006340| 61 77 29 3b 0a 09 09 70 | 75 74 63 68 61 72 28 30 |aw);...p|utchar(0|
|00006350| 37 29 3b 09 09 2f 2a 20 | 62 65 65 70 20 2a 2f 0a |7);../* |beep */.|
|00006360| 09 09 66 66 6c 75 73 68 | 28 73 74 64 6f 75 74 29 |..fflush|(stdout)|
|00006370| 3b 0a 09 09 73 63 72 65 | 65 6e 6d 6f 64 65 20 3d |;...scre|enmode =|
|00006380| 20 52 41 57 3b 0a 09 09 | 62 72 65 61 6b 3b 0a 09 | RAW;...|break;..|
|00006390| 63 61 73 65 20 52 41 57 | 3a 0a 09 09 69 66 28 68 |case RAW|:...if(h|
|000063a0| 61 6e 64 6c 65 72 29 20 | 73 69 67 6e 61 6c 28 53 |andler) |signal(S|
|000063b0| 49 47 49 4e 54 2c 20 68 | 61 6e 64 6c 65 72 29 3b |IGINT, h|andler);|
|000063c0| 0a 09 09 69 6f 63 74 6c | 28 66 69 6c 65 6e 6f 28 |...ioctl|(fileno(|
|000063d0| 73 74 64 69 6e 29 2c 20 | 54 43 53 45 54 41 2c 20 |stdin), |TCSETA, |
|000063e0| 26 63 6f 6f 6b 65 64 29 | 3b 0a 09 09 70 72 69 6e |&cooked)|;...prin|
|000063f0| 74 66 28 22 5b 63 6f 6f | 6b 65 64 5d 22 29 3b 0a |tf("[coo|ked]");.|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.