home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / Other / Coherent / DemonArchives / sources32 / network / tcpipFIX03.tar < prev   
Tape Archive  |  1995-02-11  |  120.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Tape Archive (archive/tar).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Tape Archive (archive/tar) magic Supported
100% file POSIX tar archive (GNU) default
99% file POSIX tar archive (GNU), file ./fix03/README, mode 100644 , uid 0 , gid 0 , size 4653 , seconds 5616056061, user root, group root default
98% file data default
62% TrID TAR - Tape ARchive (GNU) default
37% TrID TAR - Tape ARchive (file) default
100% siegfried x-fmt/265 Tape Archive Format default
100% lsar Tar default
100% gt2 TAR Archiv gefunden (Auflistung ist deaktiviert) default
100% disktype GNU tar archive default
100% detectItEasy Archive: tar default
100% binwalkID POSIX tar archive (GNU), owner user name: "README" default
100% xdgMime application/x-tar default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 2e 2f 66 69 78 30 33 2f | 52 45 41 44 4d 45 00 00 |./fix03/|README..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000060| 00 00 00 00 31 30 30 36 | 34 34 20 00 20 20 20 20 |....1006|44 . |
|00000070| 20 30 20 00 20 20 20 20 | 20 30 20 00 20 20 20 20 | 0 . | 0 . |
|00000080| 20 20 20 34 36 35 33 20 | 20 35 36 31 36 30 35 36 | 4653 | 5616056|
|00000090| 30 36 31 20 20 31 31 31 | 32 30 00 20 30 00 00 00 |061 111|20. 0...|
|000000a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000100| 00 75 73 74 61 72 20 20 | 00 72 6f 6f 74 00 00 00 |.ustar |.root...|
|00000110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000120| 00 00 00 00 00 00 00 00 | 00 72 6f 6f 74 00 00 00 |........|.root...|
|00000130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000200| 66 69 6c 65 6e 61 6d 65 | 09 3a 20 52 45 41 44 4d |filename|.: READM|
|00000210| 45 0a 70 75 72 70 6f 73 | 65 09 09 3a 20 64 65 73 |E.purpos|e..: des|
|00000220| 63 72 69 62 65 20 66 69 | 78 30 33 20 6b 69 74 0a |cribe fi|x03 kit.|
|00000230| 64 61 74 65 09 09 3a 20 | 4a 75 6c 79 20 32 38 2c |date..: |July 28,|
|00000240| 20 31 39 39 34 0a 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | 1994.--|--------|
|00000250| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000260| 2d 2d 2d 2d 2d 2d 0a 0a | 54 68 69 73 20 6b 69 74 |------..|This kit|
|00000270| 20 69 73 20 65 6e 74 69 | 74 6c 65 64 20 66 69 78 | is enti|tled fix|
|00000280| 30 33 20 61 6e 64 20 63 | 6f 6e 74 61 69 6e 73 20 |03 and c|ontains |
|00000290| 61 6c 6c 20 6f 66 20 74 | 68 65 20 66 69 78 65 73 |all of t|he fixes|
|000002a0| 20 74 68 61 74 0a 49 20 | 68 61 76 65 20 69 6d 70 | that.I |have imp|
|000002b0| 6c 65 6d 65 6e 74 65 64 | 20 74 6f 20 43 6f 68 75 |lemented| to Cohu|
|000002c0| 6c 69 70 20 73 69 6e 63 | 65 20 69 74 73 20 72 65 |lip sinc|e its re|
|000002d0| 6c 65 61 73 65 2e 0a 0a | 2d 2d 2d 2d 2d 2d 2d 2d |lease...|--------|
|000002e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000002f0| 2d 2d 2d 2d 2d 2d 2d 2d | 0a 0a 0a 45 52 52 41 54 |--------|...ERRAT|
|00000300| 41 3a 20 0a 54 68 65 20 | 52 45 41 44 4d 45 20 66 |A: .The |README f|
|00000310| 69 6c 65 20 66 6f 72 20 | 63 6f 68 75 6c 69 70 20 |ile for |cohulip |
|00000320| 73 70 65 61 6b 73 20 6f | 66 20 75 73 69 6e 67 20 |speaks o|f using |
|00000330| 74 65 6c 75 6e 69 78 0a | 66 6f 72 20 72 65 6d 6f |telunix.|for remo|
|00000340| 74 65 20 6c 6f 67 69 6e | 20 73 65 72 76 69 63 65 |te login| service|
|00000350| 73 20 61 6e 64 20 73 74 | 61 74 65 73 20 74 68 61 |s and st|ates tha|
|00000360| 74 20 74 65 72 6d 69 6e | 61 6c 20 63 6f 6e 74 72 |t termin|al contr|
|00000370| 6f 6c 0a 73 68 6f 75 6c | 64 20 62 65 20 73 65 74 |ol.shoul|d be set|
|00000380| 20 77 69 74 68 3a 0a 09 | 73 74 74 79 20 2d 69 63 | with:..|stty -ic|
|00000390| 61 6e 6f 6e 20 2d 65 63 | 68 6f 20 6d 69 6e 31 0a |anon -ec|ho min1.|
|000003a0| 0a 54 68 69 73 20 73 65 | 74 74 69 6e 67 20 68 6f |.This se|tting ho|
|000003b0| 75 6c 64 20 62 65 3a 0a | 09 73 74 74 79 20 2d 69 |uld be:.|.stty -i|
|000003c0| 63 61 6e 6f 6e 20 2d 65 | 63 68 6f 20 6d 69 6e 20 |canon -e|cho min |
|000003d0| 31 20 0a 0a 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |1 ..----|--------|
|000003e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000003f0| 2d 2d 2d 2d 0a 0a 4e 45 | 57 3a 0a 73 6c 69 70 2e |----..NE|W:.slip.|
|00000400| 63 20 68 61 73 20 62 65 | 65 6e 20 66 69 78 65 64 |c has be|en fixed|
|00000410| 20 74 6f 20 6f 76 65 72 | 63 6f 6d 65 20 22 68 75 | to over|come "hu|
|00000420| 6e 67 22 20 73 6c 69 70 | 20 73 65 73 73 69 6f 6e |ng" slip| session|
|00000430| 73 2e 20 73 79 73 35 5f | 69 6f 2e 63 0a 68 61 73 |s. sys5_|io.c.has|
|00000440| 20 62 65 65 6e 20 66 69 | 78 65 64 20 74 6f 20 61 | been fi|xed to a|
|00000450| 6c 6c 6f 77 20 72 75 6e | 6e 69 6e 67 20 6e 65 74 |llow run|ning net|
|00000460| 20 66 72 6f 6d 20 61 20 | 74 65 72 6d 69 6e 61 6c | from a |terminal|
|00000470| 2e 20 54 68 65 20 66 74 | 70 0a 66 69 6c 65 73 20 |. The ft|p.files |
|00000480| 68 61 76 65 20 62 65 65 | 6e 20 66 69 78 65 64 20 |have bee|n fixed |
|00000490| 74 6f 20 61 64 64 20 61 | 20 70 72 6f 6d 70 74 2c |to add a| prompt,|
|000004a0| 20 61 20 68 61 73 68 20 | 66 75 6e 63 74 69 6f 6e | a hash |function|
|000004b0| 2c 20 61 20 62 65 6c 6c | 0a 66 75 6e 63 74 69 6f |, a bell|.functio|
|000004c0| 6e 20 61 6e 64 20 61 6e | 20 69 6e 2d 73 65 73 73 |n and an| in-sess|
|000004d0| 69 6f 6e 20 68 65 6c 70 | 20 66 75 6e 63 74 69 6f |ion help| functio|
|000004e0| 6e 2e 20 41 20 66 69 6c | 65 20 73 65 61 72 63 68 |n. A fil|e search|
|000004f0| 69 6e 67 0a 61 6c 67 6f | 72 69 74 68 6d 20 69 73 |ing.algo|rithm is|
|00000500| 20 66 69 78 65 64 20 74 | 6f 20 61 6c 6c 6f 77 20 | fixed t|o allow |
|00000510| 66 69 6e 67 65 72 20 61 | 6e 64 20 73 6d 70 74 20 |finger a|nd smpt |
|00000520| 74 6f 20 6f 70 65 72 61 | 74 65 20 63 6f 72 72 65 |to opera|te corre|
|00000530| 63 74 6c 79 2e 0a 49 74 | 20 61 6c 73 6f 20 66 69 |ctly..It| also fi|
|00000540| 78 65 73 20 61 20 70 72 | 6f 62 6c 65 6d 20 74 68 |xes a pr|oblem th|
|00000550| 61 74 20 63 61 6e 20 6f | 63 63 75 72 20 77 68 65 |at can o|ccur whe|
|00000560| 6e 20 72 75 6e 6e 69 6e | 67 20 6e 65 74 20 61 73 |n runnin|g net as|
|00000570| 0a 2f 75 73 72 2f 62 69 | 6e 2f 6e 65 74 20 77 69 |./usr/bi|n/net wi|
|00000580| 74 68 20 61 20 66 75 6c | 6c 20 70 61 74 68 2e 20 |th a ful|l path. |
|00000590| 54 68 65 20 6b 65 79 62 | 6f 61 72 64 20 77 6f 75 |The keyb|oard wou|
|000005a0| 6c 64 20 6e 6f 74 20 72 | 65 73 70 6f 6e 64 2c 0a |ld not r|espond,.|
|000005b0| 62 75 74 20 6e 6f 77 20 | 69 74 20 64 6f 65 73 20 |but now |it does |
|000005c0| 77 69 74 68 20 74 68 65 | 20 6e 65 77 20 6d 61 69 |with the| new mai|
|000005d0| 6e 2e 63 2e 0a 0a 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |n.c...--|--------|
|000005e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000005f0| 2d 2d 2d 2d 2d 0a 49 4e | 53 54 52 55 43 54 49 4f |-----.IN|STRUCTIO|
|00000600| 4e 53 3a 0a 0a 31 2e 20 | 20 76 65 72 69 66 79 20 |NS:..1. | verify |
|00000610| 74 68 65 20 6c 65 6e 67 | 74 68 20 61 6e 64 20 74 |the leng|th and t|
|00000620| 68 65 6e 20 63 6f 70 79 | 20 74 68 65 20 66 6f 6c |hen copy| the fol|
|00000630| 6c 6f 77 69 6e 67 20 66 | 69 6c 65 73 20 69 6e 74 |lowing f|iles int|
|00000640| 6f 20 0a 20 20 20 20 79 | 6f 75 72 20 63 6f 68 75 |o . y|our cohu|
|00000650| 6c 69 70 20 73 72 63 20 | 73 75 62 64 69 72 65 63 |lip src |subdirec|
|00000660| 74 6f 72 79 3a 0a 0a 09 | 66 69 6c 65 09 09 6c 65 |tory:...|file..le|
|00000670| 6e 67 74 68 09 09 73 75 | 6d 0a 09 2d 2d 2d 2d 2d |ngth..su|m..-----|
|00000680| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000690| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006a0| 2d 2d 2d 2d 0a 09 66 74 | 70 2e 63 09 09 20 38 33 |----..ft|p.c.. 83|
|000006b0| 31 38 09 09 32 32 35 38 | 33 20 31 37 0a 09 66 74 |18..2258|3 17..ft|
|000006c0| 70 2e 68 09 09 20 31 37 | 31 37 09 09 20 36 30 31 |p.h.. 17|17.. 601|
|000006d0| 36 20 20 34 0a 09 66 74 | 70 63 6c 69 2e 63 09 31 |6 4..ft|pcli.c.1|
|000006e0| 38 36 34 39 09 09 36 32 | 35 35 37 20 33 37 0a 09 |8649..62|557 37..|
|000006f0| 66 74 70 73 65 72 76 2e | 63 09 31 39 31 31 30 09 |ftpserv.|c.19110.|
|00000700| 09 34 33 35 36 36 20 33 | 39 0a 09 73 6c 69 70 2e |.43566 3|9..slip.|
|00000710| 63 09 09 31 31 36 32 36 | 09 09 34 38 37 33 30 20 |c..11626|..48730 |
|00000720| 32 33 0a 09 73 79 73 35 | 5f 69 6f 2e 63 09 31 31 |23..sys5|_io.c.11|
|00000730| 36 39 32 09 09 35 30 32 | 37 34 20 32 33 0a 09 6e |692..502|74 23..n|
|00000740| 64 69 72 2e 68 09 09 20 | 31 33 37 32 09 09 34 34 |dir.h.. |1372..44|
|00000750| 35 32 34 20 20 33 0a 09 | 73 79 73 35 75 6e 69 78 |524 3..|sys5unix|
|00000760| 2e 63 09 20 37 31 31 37 | 09 09 31 33 39 37 38 20 |.c. 7117|..13978 |
|00000770| 31 34 0a 09 6d 61 69 6e | 2e 63 09 09 33 30 33 34 |14..main|.c..3034|
|00000780| 36 09 09 31 30 39 37 31 | 20 36 30 0a 09 2d 2d 2d |6..10971| 60..---|
|00000790| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007b0| 2d 2d 2d 2d 2d 2d 0a 0a | 32 2e 20 54 68 65 6e 20 |------..|2. Then |
|000007c0| 63 64 20 74 6f 20 74 68 | 65 20 63 6f 68 75 6c 69 |cd to th|e cohuli|
|000007d0| 70 20 73 72 63 20 73 75 | 62 64 69 72 65 63 74 6f |p src su|bdirecto|
|000007e0| 72 79 20 61 6e 64 20 72 | 75 6e 20 74 68 65 20 63 |ry and r|un the c|
|000007f0| 6f 6d 6d 61 6e 64 3a 0a | 09 6d 61 6b 65 0a 0a 33 |ommand:.|.make..3|
|00000800| 2e 20 54 68 65 20 6e 65 | 77 20 62 69 6e 61 72 79 |. The ne|w binary|
|00000810| 20 66 6f 72 20 22 6e 65 | 74 22 20 77 69 6c 6c 20 | for "ne|t" will |
|00000820| 62 65 20 63 72 65 61 74 | 65 64 20 69 6e 20 74 68 |be creat|ed in th|
|00000830| 65 20 73 72 63 20 73 75 | 62 64 69 72 65 63 74 6f |e src su|bdirecto|
|00000840| 72 79 2e 0a 20 20 20 54 | 65 73 74 20 69 74 20 62 |ry.. T|est it b|
|00000850| 79 20 72 75 6e 6e 69 6e | 67 3a 0a 09 2e 2f 6e 65 |y runnin|g:.../ne|
|00000860| 74 20 3c 73 74 61 72 74 | 75 70 66 69 6c 65 3e 0a |t <start|upfile>.|
|00000870| 20 20 20 77 68 65 72 65 | 20 3c 73 74 61 72 74 75 | where| <startu|
|00000880| 70 66 69 6c 65 3e 20 69 | 73 20 74 68 65 20 6e 61 |pfile> i|s the na|
|00000890| 6d 65 20 6f 66 20 79 6f | 75 72 20 75 73 75 61 6c |me of yo|ur usual|
|000008a0| 20 73 74 61 72 74 75 70 | 20 66 69 6c 65 2e 0a 0a | startup| file...|
|000008b0| 20 20 20 54 72 79 20 6f | 75 74 20 74 68 65 20 66 | Try o|ut the f|
|000008c0| 74 70 20 63 6c 69 65 6e | 74 2e 20 49 74 20 6e 6f |tp clien|t. It no|
|000008d0| 77 20 68 61 73 20 61 20 | 70 72 6f 6d 70 74 2e 20 |w has a |prompt. |
|000008e0| 41 20 62 65 6c 6c 20 6f | 70 74 69 6f 6e 0a 20 20 |A bell o|ption. |
|000008f0| 20 74 6f 20 62 65 65 70 | 20 79 6f 75 20 77 68 65 | to beep| you whe|
|00000900| 6e 20 61 20 66 69 6c 65 | 20 74 72 61 6e 73 66 65 |n a file| transfe|
|00000910| 72 20 69 73 20 63 6f 6d | 70 6c 65 74 65 64 20 69 |r is com|pleted i|
|00000920| 73 20 74 6f 67 67 6c 65 | 64 20 6f 66 66 0a 20 20 |s toggle|d off. |
|00000930| 20 61 6e 64 20 6f 6e 20 | 62 79 20 74 68 65 20 66 | and on |by the f|
|00000940| 74 70 3e 20 63 6f 6d 6d | 61 6e 64 20 22 62 65 6c |tp> comm|and "bel|
|00000950| 6c 22 2e 20 41 20 68 61 | 73 68 20 6f 70 74 69 6f |l". A ha|sh optio|
|00000960| 6e 20 74 68 61 74 20 77 | 69 6c 6c 20 0a 20 20 20 |n that w|ill . |
|00000970| 70 72 69 6e 74 20 61 20 | 27 23 27 20 66 6f 72 20 |print a |'#' for |
|00000980| 65 61 63 68 20 6b 69 6c | 6f 62 79 74 65 20 74 72 |each kil|obyte tr|
|00000990| 61 6e 73 66 65 72 65 64 | 20 69 73 20 74 6f 67 67 |ansfered| is togg|
|000009a0| 6c 65 64 20 77 69 74 68 | 20 74 68 65 0a 20 20 20 |led with| the. |
|000009b0| 66 74 70 3e 20 68 61 73 | 68 20 63 6f 6d 6d 61 6e |ftp> has|h comman|
|000009c0| 64 2e 20 41 20 6c 69 73 | 74 20 6f 66 20 66 74 70 |d. A lis|t of ftp|
|000009d0| 20 6f 70 74 69 6f 6e 73 | 20 69 73 20 61 76 61 69 | options| is avai|
|000009e0| 6c 61 62 6c 65 20 61 74 | 20 74 68 65 0a 20 20 20 |lable at| the. |
|000009f0| 66 74 70 3e 20 63 6f 6d | 6d 61 6e 64 20 6c 69 6e |ftp> com|mand lin|
|00000a00| 65 20 62 79 20 65 6e 74 | 65 72 69 6e 67 20 65 69 |e by ent|ering ei|
|00000a10| 74 68 65 72 20 22 3f 22 | 20 6f 72 20 22 68 65 6c |ther "?"| or "hel|
|00000a20| 70 22 2e 20 28 63 6f 6d | 6d 61 6e 64 0a 20 20 20 |p". (com|mand. |
|00000a30| 6c 69 73 74 65 64 20 68 | 65 72 65 20 73 68 6f 75 |listed h|ere shou|
|00000a40| 6c 64 20 62 65 20 65 6e | 74 65 72 65 64 20 77 69 |ld be en|tered wi|
|00000a50| 74 68 20 71 75 6f 74 65 | 20 6d 61 72 6b 73 29 2e |th quote| marks).|
|00000a60| 20 0a 0a 20 20 20 49 66 | 20 79 6f 75 20 68 61 76 | .. If| you hav|
|00000a70| 65 20 74 68 65 20 66 61 | 63 69 6c 69 74 65 73 20 |e the fa|cilites |
|00000a80| 66 6f 72 20 64 6f 69 6e | 67 20 73 6f 2c 20 72 75 |for doin|g so, ru|
|00000a90| 6e 20 6e 65 74 20 66 72 | 6f 6d 20 61 0a 20 20 20 |n net fr|om a. |
|00000aa0| 74 65 72 6d 69 6e 61 6c | 20 6c 6f 67 67 65 64 20 |terminal| logged |
|00000ab0| 69 6e 20 6f 6e 20 61 20 | 73 65 72 69 61 6c 20 70 |in on a |serial p|
|00000ac0| 6f 72 74 2c 20 61 6e 64 | 20 74 72 79 20 72 75 6e |ort, and| try run|
|00000ad0| 6e 69 6e 67 20 6e 65 74 | 0a 20 20 20 66 72 6f 6d |ning net|. from|
|00000ae0| 20 77 69 74 68 69 6e 20 | 61 6e 20 78 74 65 72 6d | within |an xterm|
|00000af0| 2e 20 0a 0a 34 2e 20 49 | 66 20 79 6f 75 20 61 72 |. ..4. I|f you ar|
|00000b00| 65 20 73 61 74 69 73 66 | 69 65 64 20 77 69 74 68 |e satisf|ied with|
|00000b10| 20 74 68 65 20 6e 65 77 | 20 62 69 6e 61 72 79 2c | the new| binary,|
|00000b20| 20 63 6f 70 79 20 2e 2f | 6e 65 74 20 74 6f 0a 20 | copy ./|net to. |
|00000b30| 20 20 2f 75 73 72 2f 62 | 69 6e 2e 20 49 66 20 79 | /usr/b|in. If y|
|00000b40| 6f 75 20 65 6e 63 6f 75 | 6e 74 65 72 20 64 69 66 |ou encou|nter dif|
|00000b50| 66 69 63 75 6c 74 69 65 | 73 2c 20 79 6f 75 20 63 |ficultie|s, you c|
|00000b60| 61 6e 20 65 6d 61 69 6c | 0a 20 20 20 6d 65 20 61 |an email|. me a|
|00000b70| 74 20 72 77 40 72 77 73 | 79 73 2e 77 69 6d 73 65 |t rw@rws|ys.wimse|
|00000b80| 79 2e 62 63 2e 63 61 20 | 0a 0a 2d 2d 2d 2d 2d 2d |y.bc.ca |..------|
|00000b90| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000ba0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 0a 00 00 00 00 00 |--------|--......|
|00000bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c00| 2e 2f 66 69 78 30 33 2f | 66 74 70 2e 63 00 00 00 |./fix03/|ftp.c...|
|00000c10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c60| 00 00 00 00 31 30 30 36 | 34 34 20 00 20 20 20 20 |....1006|44 . |
|00000c70| 20 30 20 00 20 20 20 20 | 20 30 20 00 20 20 20 20 | 0 . | 0 . |
|00000c80| 20 20 32 30 31 37 36 20 | 20 35 36 31 35 33 31 33 | 20176 | 5615313|
|00000c90| 37 34 36 20 20 31 31 32 | 32 30 00 20 30 00 00 00 |746 112|20. 0...|
|00000ca0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d00| 00 75 73 74 61 72 20 20 | 00 72 6f 6f 74 00 00 00 |.ustar |.root...|
|00000d10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d20| 00 00 00 00 00 00 00 00 | 00 72 6f 6f 74 00 00 00 |........|.root...|
|00000d30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000da0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e00| 2f 2a 20 53 74 75 66 66 | 20 63 6f 6d 6d 6f 6e 20 |/* Stuff| common |
|00000e10| 74 6f 20 62 6f 74 68 20 | 74 68 65 20 46 54 50 20 |to both |the FTP |
|00000e20| 73 65 72 76 65 72 20 61 | 6e 64 20 63 6c 69 65 6e |server a|nd clien|
|00000e30| 74 20 2a 2f 0a 23 69 6e | 63 6c 75 64 65 20 3c 73 |t */.#in|clude <s|
|00000e40| 74 64 69 6f 2e 68 3e 0a | 23 69 6e 63 6c 75 64 65 |tdio.h>.|#include|
|00000e50| 20 22 63 6f 6e 66 69 67 | 2e 68 22 0a 23 69 6e 63 | "config|.h".#inc|
|00000e60| 6c 75 64 65 20 22 67 6c | 6f 62 61 6c 2e 68 22 0a |lude "gl|obal.h".|
|00000e70| 23 69 6e 63 6c 75 64 65 | 20 22 6d 62 75 66 2e 68 |#include| "mbuf.h|
|00000e80| 22 0a 23 69 6e 63 6c 75 | 64 65 20 22 6e 65 74 75 |".#inclu|de "netu|
|00000e90| 73 65 72 2e 68 22 0a 23 | 69 6e 63 6c 75 64 65 20 |ser.h".#|include |
|00000ea0| 22 74 69 6d 65 72 2e 68 | 22 0a 23 69 6e 63 6c 75 |"timer.h|".#inclu|
|00000eb0| 64 65 20 22 74 63 70 2e | 68 22 0a 23 69 6e 63 6c |de "tcp.|h".#incl|
|00000ec0| 75 64 65 20 22 66 74 70 | 2e 68 22 0a 23 69 6e 63 |ude "ftp|.h".#inc|
|00000ed0| 6c 75 64 65 20 22 74 65 | 6c 6e 65 74 2e 68 22 0a |lude "te|lnet.h".|
|00000ee0| 23 69 6e 63 6c 75 64 65 | 20 22 69 66 61 63 65 2e |#include| "iface.|
|00000ef0| 68 22 0a 23 69 6e 63 6c | 75 64 65 20 22 66 69 6e |h".#incl|ude "fin|
|00000f00| 67 65 72 2e 68 22 0a 23 | 69 6e 63 6c 75 64 65 20 |ger.h".#|include |
|00000f10| 22 73 65 73 73 69 6f 6e | 2e 68 22 0a 0a 23 69 6e |"session|.h"..#in|
|00000f20| 63 6c 75 64 65 20 3c 73 | 79 73 2f 74 79 70 65 73 |clude <s|ys/types|
|00000f30| 2e 68 3e 0a 23 69 6e 63 | 6c 75 64 65 20 3c 73 79 |.h>.#inc|lude <sy|
|00000f40| 73 2f 73 74 61 74 2e 68 | 3e 0a 0a 23 69 66 6e 64 |s/stat.h|>..#ifnd|
|00000f50| 65 66 20 43 4f 48 34 32 | 0a 23 69 6e 63 6c 75 64 |ef COH42|.#includ|
|00000f60| 65 20 3c 73 79 73 2f 69 | 6e 6f 64 65 2e 68 3e 0a |e <sys/i|node.h>.|
|00000f70| 23 65 6e 64 69 66 0a 0a | 0a 0a 23 69 66 6e 64 65 |#endif..|..#ifnde|
|00000f80| 66 20 54 52 55 45 09 2f | 2a 20 6b 32 38 20 2a 2f |f TRUE./|* k28 */|
|00000f90| 0a 23 64 65 66 69 6e 65 | 20 54 52 55 45 20 31 0a |.#define| TRUE 1.|
|00000fa0| 23 64 65 66 69 6e 65 20 | 46 41 4c 53 45 20 30 0a |#define |FALSE 0.|
|00000fb0| 23 65 6e 64 69 66 0a 0a | 76 6f 69 64 20 66 72 65 |#endif..|void fre|
|00000fc0| 65 28 29 3b 0a 0a 2f 2a | 20 46 54 50 20 44 61 74 |e();../*| FTP Dat|
|00000fd0| 61 20 63 68 61 6e 6e 65 | 6c 20 52 65 63 65 69 76 |a channe|l Receiv|
|00000fe0| 65 20 75 70 63 61 6c 6c | 20 68 61 6e 64 6c 65 72 |e upcall| handler|
|00000ff0| 20 2a 2f 0a 76 6f 69 64 | 0a 66 74 70 64 72 28 74 | */.void|.ftpdr(t|
|00001000| 63 62 2c 63 6e 74 29 0a | 73 74 72 75 63 74 20 74 |cb,cnt).|struct t|
|00001010| 63 62 20 2a 74 63 62 3b | 0a 69 6e 74 31 36 20 63 |cb *tcb;|.int16 c|
|00001020| 6e 74 3b 0a 7b 0a 09 72 | 65 67 69 73 74 65 72 20 |nt;.{..r|egister |
|00001030| 73 74 72 75 63 74 20 66 | 74 70 20 2a 66 74 70 3b |struct f|tp *ftp;|
|00001040| 0a 09 73 74 72 75 63 74 | 20 6d 62 75 66 20 2a 62 |..struct| mbuf *b|
|00001050| 70 3b 0a 09 69 6e 74 20 | 77 72 3b 0a 09 77 72 20 |p;..int |wr;..wr |
|00001060| 3d 20 30 3b 20 0a 23 69 | 66 64 65 66 20 43 4f 48 |= 0; .#i|fdef COH|
|00001070| 50 52 4f 46 0a 70 72 6f | 66 69 6c 65 28 5f 5f 4c |PROF.pro|file(__L|
|00001080| 49 4e 45 5f 5f 2c 5f 5f | 46 49 4c 45 5f 5f 29 3b |INE__,__|FILE__);|
|00001090| 0a 23 65 6e 64 69 66 0a | 09 66 74 70 20 3d 20 28 |.#endif.|.ftp = (|
|000010a0| 73 74 72 75 63 74 20 66 | 74 70 20 2a 29 74 63 62 |struct f|tp *)tcb|
|000010b0| 2d 3e 75 73 65 72 3b 0a | 09 69 66 28 66 74 70 2d |->user;.|.if(ftp-|
|000010c0| 3e 73 74 61 74 65 20 21 | 3d 20 52 45 43 45 49 56 |>state !|= RECEIV|
|000010d0| 49 4e 47 5f 53 54 41 54 | 45 29 7b 0a 09 09 63 6c |ING_STAT|E){...cl|
|000010e0| 6f 73 65 5f 74 63 70 28 | 74 63 62 29 3b 0a 09 09 |ose_tcp(|tcb);...|
|000010f0| 72 65 74 75 72 6e 3b 0a | 09 7d 0a 09 2f 2a 20 54 |return;.|.}../* T|
|00001100| 68 69 73 20 77 69 6c 6c | 20 6c 69 6b 65 6c 79 20 |his will| likely |
|00001110| 61 6c 73 6f 20 67 65 6e | 65 72 61 74 65 20 61 6e |also gen|erate an|
|00001120| 20 41 43 4b 20 77 69 74 | 68 20 77 69 6e 64 6f 77 | ACK wit|h window|
|00001130| 20 72 6f 74 61 74 69 6f | 6e 20 2a 2f 0a 09 72 65 | rotatio|n */..re|
|00001140| 63 76 5f 74 63 70 28 74 | 63 62 2c 26 62 70 2c 63 |cv_tcp(t|cb,&bp,c|
|00001150| 6e 74 29 3b 0a 0a 0a 09 | 2f 2a 20 52 4c 57 20 2d |nt);....|/* RLW -|
|00001160| 20 74 68 69 73 20 6e 65 | 77 20 73 74 72 61 74 65 | this ne|w strate|
|00001170| 67 79 20 66 6f 72 20 61 | 73 63 69 69 20 63 6f 6e |gy for a|scii con|
|00001180| 76 65 72 73 69 6f 6e 20 | 69 6e 76 6f 6c 76 65 73 |version |involves|
|00001190| 0a 09 20 2a 20 67 65 74 | 74 69 6e 67 20 61 20 6d |.. * get|ting a m|
|000011a0| 61 6c 6c 6f 63 27 64 20 | 62 75 66 66 65 72 2c 20 |alloc'd |buffer, |
|000011b0| 61 6e 64 20 63 6f 70 79 | 69 6e 67 20 62 79 74 65 |and copy|ing byte|
|000011c0| 20 62 79 0a 09 20 2a 20 | 62 79 74 65 2c 20 73 6b | by.. * |byte, sk|
|000011d0| 69 70 70 69 6e 67 20 61 | 6e 79 20 27 5c 72 27 20 |ipping a|ny '\r' |
|000011e0| 63 68 61 72 73 2e 20 54 | 68 65 6e 20 77 72 69 74 |chars. T|hen writ|
|000011f0| 69 6e 67 20 6f 75 74 0a | 09 20 2a 20 74 68 65 20 |ing out.|. * the |
|00001200| 62 75 66 66 65 72 20 69 | 6e 20 61 20 73 69 6e 67 |buffer i|n a sing|
|00001210| 6c 65 20 73 68 6f 74 2e | 20 54 68 65 20 70 72 65 |le shot.| The pre|
|00001220| 76 69 6f 75 73 20 6d 65 | 74 68 6f 64 0a 09 20 2a |vious me|thod.. *|
|00001230| 20 70 75 6c 6c 65 64 20 | 75 70 20 61 20 62 79 74 | pulled |up a byt|
|00001240| 65 2c 20 63 68 65 63 6b | 65 64 20 69 74 2c 20 74 |e, check|ed it, t|
|00001250| 68 65 6e 20 77 72 6f 74 | 65 20 74 68 65 20 62 79 |hen wrot|e the by|
|00001260| 74 65 0a 09 20 2a 20 61 | 6e 64 20 72 65 70 65 61 |te.. * a|nd repea|
|00001270| 74 65 64 2e 20 54 68 65 | 20 70 72 6f 66 69 6c 69 |ted. The| profili|
|00001280| 6e 67 20 72 65 76 65 61 | 6c 65 64 20 74 68 61 74 |ng revea|led that|
|00001290| 20 61 6e 20 66 74 70 0a | 09 20 2a 20 77 61 73 20 | an ftp.|. * was |
|000012a0| 73 70 65 6e 64 69 6e 67 | 20 38 33 25 20 6f 66 20 |spending| 83% of |
|000012b0| 69 74 73 20 74 69 6d 65 | 20 69 6e 20 74 68 69 73 |its time| in this|
|000012c0| 20 61 6c 67 6f 72 69 74 | 68 6d 2e 0a 09 20 2a 0a | algorit|hm... *.|
|000012d0| 09 20 2a 2f 0a 09 69 66 | 28 66 74 70 2d 3e 74 79 |. */..if|(ftp->ty|
|000012e0| 70 65 20 3d 3d 20 41 53 | 43 49 49 5f 54 59 50 45 |pe == AS|CII_TYPE|
|000012f0| 29 20 7b 0a 09 09 09 63 | 68 61 72 20 2a 77 62 75 |) {....c|har *wbu|
|00001300| 66 2c 20 09 2f 2a 20 62 | 61 73 65 20 6f 66 20 6d |f, ./* b|ase of m|
|00001310| 61 6c 6c 6f 63 27 64 20 | 62 75 66 66 65 72 20 2a |alloc'd |buffer *|
|00001320| 2f 0a 09 09 09 20 20 20 | 20 20 2a 69 6e 62 75 66 |/.... | *inbuf|
|00001330| 2c 0a 09 09 09 20 20 20 | 20 20 2a 64 70 74 72 2c |,.... | *dptr,|
|00001340| 20 09 2f 2a 20 64 65 73 | 74 69 6e 61 74 69 6f 6e | ./* des|tination|
|00001350| 20 2d 20 63 75 72 72 65 | 6e 74 20 70 6f 73 20 69 | - curre|nt pos i|
|00001360| 6e 20 77 62 75 66 20 2a | 2f 0a 09 09 09 20 20 20 |n wbuf *|/.... |
|00001370| 20 20 2a 73 70 74 72 3b | 20 09 2f 2a 20 73 6f 75 | *sptr;| ./* sou|
|00001380| 72 63 65 20 69 6e 20 62 | 70 2d 3e 64 61 74 61 20 |rce in b|p->data |
|00001390| 2a 2f 0a 09 09 09 69 6e | 74 20 77 72 2c 20 69 2c |*/....in|t wr, i,|
|000013a0| 20 6e 65 77 63 6e 74 3b | 20 09 2f 2a 20 62 79 74 | newcnt;| ./* byt|
|000013b0| 65 20 63 6f 75 6e 74 65 | 72 73 20 2a 2f 0a 0a 09 |e counte|rs */...|
|000013c0| 09 09 69 66 28 63 6e 74 | 20 21 3d 20 30 20 29 0a |..if(cnt| != 0 ).|
|000013d0| 09 09 09 09 7b 0a 09 09 | 09 09 69 66 28 20 28 77 |....{...|..if( (w|
|000013e0| 62 75 66 3d 6d 61 6c 6c | 6f 63 28 20 63 6e 74 20 |buf=mall|oc( cnt |
|000013f0| 29 29 20 3d 3d 20 4e 55 | 4c 4c 20 29 0a 09 09 09 |)) == NU|LL )....|
|00001400| 09 09 7b 0a 09 09 09 09 | 09 62 70 20 3d 20 66 72 |..{.....|.bp = fr|
|00001410| 65 65 5f 6d 62 75 66 28 | 62 70 29 3b 0a 09 09 09 |ee_mbuf(|bp);....|
|00001420| 09 09 72 65 74 75 72 6e | 3b 0a 09 09 09 09 09 7d |..return|;......}|
|00001430| 0a 0a 09 09 09 09 69 66 | 28 20 28 69 6e 62 75 66 |......if|( (inbuf|
|00001440| 3d 6d 61 6c 6c 6f 63 28 | 20 63 6e 74 20 29 29 20 |=malloc(| cnt )) |
|00001450| 3d 3d 20 4e 55 4c 4c 20 | 29 0a 09 09 09 09 09 7b |== NULL |)......{|
|00001460| 0a 09 09 09 09 09 66 72 | 65 65 28 20 77 62 75 66 |......fr|ee( wbuf|
|00001470| 20 29 3b 0a 09 09 09 09 | 09 62 70 20 3d 20 66 72 | );.....|.bp = fr|
|00001480| 65 65 5f 6d 62 75 66 28 | 62 70 29 3b 0a 09 09 09 |ee_mbuf(|bp);....|
|00001490| 09 09 72 65 74 75 72 6e | 3b 0a 09 09 09 09 09 7d |..return|;......}|
|000014a0| 0a 0a 09 09 09 09 7d 0a | 09 09 09 65 6c 73 65 0a |......}.|...else.|
|000014b0| 09 09 09 09 7b 20 2f 2a | 20 6e 6f 20 64 61 74 61 |....{ /*| no data|
|000014c0| 20 74 6f 20 64 6f 20 2a | 2f 0a 09 09 09 09 62 70 | to do *|/.....bp|
|000014d0| 20 3d 20 66 72 65 65 5f | 6d 62 75 66 28 62 70 29 | = free_|mbuf(bp)|
|000014e0| 3b 0a 09 09 09 09 72 65 | 74 75 72 6e 3b 0a 09 09 |;.....re|turn;...|
|000014f0| 09 09 7d 0a 0a 09 09 09 | 69 66 28 70 75 6c 6c 75 |..}.....|if(pullu|
|00001500| 70 28 26 62 70 2c 69 6e | 62 75 66 2c 63 6e 74 29 |p(&bp,in|buf,cnt)|
|00001510| 20 21 3d 20 63 6e 74 29 | 0a 09 09 09 09 7b 0a 0a | != cnt)|.....{..|
|00001520| 09 09 09 09 62 70 20 3d | 20 66 72 65 65 5f 6d 62 |....bp =| free_mb|
|00001530| 75 66 28 62 70 29 3b 0a | 09 09 09 09 66 72 65 65 |uf(bp);.|....free|
|00001540| 28 69 6e 62 75 66 29 3b | 0a 09 09 09 09 66 72 65 |(inbuf);|.....fre|
|00001550| 65 28 77 62 75 66 29 3b | 0a 09 09 09 09 72 65 74 |e(wbuf);|.....ret|
|00001560| 75 72 6e 3b 0a 09 09 09 | 09 7d 0a 09 09 09 09 2f |urn;....|.}...../|
|00001570| 2a 20 73 63 61 6e 20 74 | 68 65 20 73 6f 75 72 63 |* scan t|he sourc|
|00001580| 65 2c 20 61 6e 64 20 63 | 6f 70 79 20 65 61 63 68 |e, and c|opy each|
|00001590| 20 63 68 61 72 20 74 68 | 61 74 0a 09 09 09 09 20 | char th|at..... |
|000015a0| 2a 20 69 73 20 6e 6f 74 | 20 27 5c 72 27 20 74 6f |* is not| '\r' to|
|000015b0| 20 74 68 65 20 64 65 73 | 74 69 6e 61 74 69 6f 6e | the des|tination|
|000015c0| 20 62 75 66 66 65 72 2e | 2e 0a 09 09 09 09 20 2a | buffer.|...... *|
|000015d0| 20 6b 65 65 70 69 6e 67 | 20 74 72 61 63 6b 20 6f | keeping| track o|
|000015e0| 66 20 6e 75 6d 62 65 72 | 20 6f 66 20 63 68 61 72 |f number| of char|
|000015f0| 73 20 73 6f 20 77 65 0a | 09 09 09 09 20 2a 20 64 |s so we.|.... * d|
|00001600| 6f 6e 27 74 20 70 61 67 | 65 20 66 61 75 6c 74 20 |on't pag|e fault |
|00001610| 61 6e 64 20 73 6f 20 77 | 65 20 63 61 6e 20 6d 61 |and so w|e can ma|
|00001620| 6b 65 0a 09 09 09 09 20 | 2a 20 77 72 69 74 65 20 |ke..... |* write |
|00001630| 6f 66 20 74 68 65 20 63 | 6f 72 72 65 63 74 20 6c |of the c|orrect l|
|00001640| 65 6e 67 74 68 2e 20 52 | 4c 57 0a 09 09 09 09 20 |ength. R|LW..... |
|00001650| 2a 2f 0a 09 09 09 66 6f | 72 28 20 69 20 3d 20 30 |*/....fo|r( i = 0|
|00001660| 2c 20 73 70 74 72 20 3d | 20 69 6e 62 75 66 2c 20 |, sptr =| inbuf, |
|00001670| 64 70 74 72 20 3d 20 77 | 62 75 66 2c 20 6e 65 77 |dptr = w|buf, new|
|00001680| 63 6e 74 20 3d 20 30 3b | 0a 09 09 09 20 20 20 20 |cnt = 0;|.... |
|00001690| 20 69 20 3c 20 63 6e 74 | 3b 20 69 2b 2b 2c 20 73 | i < cnt|; i++, s|
|000016a0| 70 74 72 2b 2b 2c 20 64 | 70 74 72 2b 2b 2c 20 6e |ptr++, d|ptr++, n|
|000016b0| 65 77 63 6e 74 2b 2b 20 | 29 0a 09 09 09 09 7b 0a |ewcnt++ |).....{.|
|000016c0| 09 09 09 09 09 2f 2a 20 | 73 6b 69 70 20 61 6e 79 |...../* |skip any|
|000016d0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 27 5c 72 27 0a | number |of '\r'.|
|000016e0| 09 09 09 09 09 20 2a 20 | 2d 20 74 68 65 72 65 20 |..... * |- there |
|000016f0| 5f 6d 61 79 5f 20 62 65 | 20 74 69 6d 65 73 20 77 |_may_ be| times w|
|00001700| 68 65 6e 20 74 68 69 73 | 0a 09 09 09 09 09 20 2a |hen this|...... *|
|00001710| 20 69 73 20 6e 6f 74 20 | 74 68 65 20 64 65 73 69 | is not |the desi|
|00001720| 72 65 64 20 62 65 68 61 | 76 69 6f 72 2e 0a 09 09 |red beha|vior....|
|00001730| 09 09 09 20 2a 2f 0a 09 | 09 09 09 77 68 69 6c 65 |... */..|...while|
|00001740| 28 20 2a 73 70 74 72 20 | 3d 3d 20 27 5c 72 27 20 |( *sptr |== '\r' |
|00001750| 26 26 20 69 20 3c 20 63 | 6e 74 20 29 20 0a 09 09 |&& i < c|nt ) ...|
|00001760| 09 09 09 7b 73 70 74 72 | 2b 2b 3b 20 69 2b 2b 3b |...{sptr|++; i++;|
|00001770| 7d 0a 0a 09 09 09 09 09 | 2f 2a 20 6d 6f 76 65 20 |}.......|/* move |
|00001780| 6e 6f 6e 2d 63 61 72 2e | 20 72 65 74 20 63 68 61 |non-car.| ret cha|
|00001790| 72 73 20 2a 2f 0a 09 09 | 09 09 2a 64 70 74 72 20 |rs */...|..*dptr |
|000017a0| 3d 20 2a 73 70 74 72 3b | 0a 09 09 09 09 7d 0a 0a |= *sptr;|.....}..|
|000017b0| 09 09 09 09 2f 2a 20 77 | 72 69 74 65 20 69 74 20 |..../* w|rite it |
|000017c0| 6f 75 74 20 74 6f 20 64 | 69 73 6b 20 2a 2f 0a 09 |out to d|isk */..|
|000017d0| 09 09 77 72 20 3d 20 66 | 77 72 69 74 65 28 77 62 |..wr = f|write(wb|
|000017e0| 75 66 2c 31 2c 6e 65 77 | 63 6e 74 2c 66 74 70 2d |uf,1,new|cnt,ftp-|
|000017f0| 3e 66 70 29 3b 0a 0a 09 | 09 09 69 66 28 20 66 74 |>fp);...|..if( ft|
|00001800| 70 2d 3e 68 61 73 68 62 | 65 6c 6c 20 26 20 46 54 |p->hashb|ell & FT|
|00001810| 50 48 41 53 48 20 29 20 | 7b 0a 09 09 09 09 69 6e |PHASH ) |{.....in|
|00001820| 74 20 76 61 6c 2c 20 69 | 3b 0a 09 09 09 09 66 74 |t val, i|;.....ft|
|00001830| 70 2d 3e 64 61 74 61 62 | 79 74 65 73 20 2b 3d 20 |p->datab|ytes += |
|00001840| 77 72 3b 0a 09 09 09 09 | 76 61 6c 20 3d 20 28 66 |wr;.....|val = (f|
|00001850| 74 70 2d 3e 64 61 74 61 | 62 79 74 65 73 20 3e 3e |tp->data|bytes >>|
|00001860| 20 31 30 20 29 20 2d 20 | 66 74 70 2d 3e 6c 61 73 | 10 ) - |ftp->las|
|00001870| 74 68 61 73 68 3b 0a 09 | 09 09 09 66 74 70 2d 3e |thash;..|...ftp->|
|00001880| 6c 61 73 74 68 61 73 68 | 20 3d 20 28 66 74 70 2d |lasthash| = (ftp-|
|00001890| 3e 64 61 74 61 62 79 74 | 65 73 20 3e 3e 20 31 30 |>databyt|es >> 10|
|000018a0| 20 29 3b 0a 09 09 09 09 | 66 6f 72 28 20 69 20 3d | );.....|for( i =|
|000018b0| 20 30 3b 20 69 20 3c 20 | 76 61 6c 3b 20 69 2b 2b | 0; i < |val; i++|
|000018c0| 29 20 70 72 69 6e 74 66 | 28 20 22 23 22 20 29 3b |) printf|( "#" );|
|000018d0| 0a 09 09 09 09 66 66 6c | 75 73 68 28 73 74 64 6f |.....ffl|ush(stdo|
|000018e0| 75 74 29 3b 0a 09 09 09 | 7d 0a 09 09 09 09 2f 2a |ut);....|}...../*|
|000018f0| 20 66 72 65 65 20 72 65 | 73 6f 75 72 63 65 73 20 | free re|sources |
|00001900| 2a 2f 0a 09 09 09 62 70 | 20 3d 20 66 72 65 65 5f |*/....bp| = free_|
|00001910| 6d 62 75 66 28 62 70 29 | 3b 0a 09 09 09 66 72 65 |mbuf(bp)|;....fre|
|00001920| 65 28 77 62 75 66 29 3b | 0a 09 09 09 66 72 65 65 |e(wbuf);|....free|
|00001930| 28 69 6e 62 75 66 29 3b | 0a 09 09 09 09 2f 2a 20 |(inbuf);|...../* |
|00001940| 64 6f 6e 65 20 2a 2f 0a | 09 09 09 72 65 74 75 72 |done */.|...retur|
|00001950| 6e 3b 0a 09 09 09 7d 20 | 2f 2a 20 66 74 70 2d 3e |n;....} |/* ftp->|
|00001960| 74 79 70 65 20 3d 20 41 | 53 43 49 49 20 2a 2f 0a |type = A|SCII */.|
|00001970| 23 69 66 64 65 66 20 44 | 45 41 44 0a 09 09 2f 2a |#ifdef D|EAD.../*|
|00001980| 20 74 68 65 20 6f 6c 64 | 20 61 73 63 69 69 20 63 | the old| ascii c|
|00001990| 6f 6e 76 65 72 73 69 6f | 6e 20 61 6c 67 6f 72 69 |onversio|n algori|
|000019a0| 74 68 6d 20 2a 2f 0a 09 | 09 77 68 69 6c 65 28 70 |thm */..|.while(p|
|000019b0| 75 6c 6c 75 70 28 26 62 | 70 2c 26 63 2c 31 29 20 |ullup(&b|p,&c,1) |
|000019c0| 3d 3d 20 31 29 7b 0a 0a | 0a 0a 09 09 09 69 66 28 |== 1){..|.....if(|
|000019d0| 63 20 21 3d 20 27 5c 72 | 27 29 0a 0a 09 09 09 09 |c != '\r|')......|
|000019e0| 70 75 74 63 28 63 2c 66 | 74 70 2d 3e 66 70 29 3b |putc(c,f|tp->fp);|
|000019f0| 0a 09 09 7d 0a 09 09 72 | 65 74 75 72 6e 3b 0a 09 |...}...r|eturn;..|
|00001a00| 7d 0a 0a 23 65 6e 64 69 | 66 20 2f 2a 20 44 45 41 |}..#endi|f /* DEA|
|00001a10| 44 20 2a 2f 0a 0a 0a 09 | 77 68 69 6c 65 28 62 70 |D */....|while(bp|
|00001a20| 20 21 3d 20 4e 55 4c 4c | 42 55 46 29 7b 0a 09 09 | != NULL|BUF){...|
|00001a30| 69 66 28 62 70 2d 3e 63 | 6e 74 20 21 3d 20 30 29 |if(bp->c|nt != 0)|
|00001a40| 0a 09 09 09 77 72 20 3d | 20 66 77 72 69 74 65 28 |....wr =| fwrite(|
|00001a50| 62 70 2d 3e 64 61 74 61 | 2c 31 2c 28 75 6e 73 69 |bp->data|,1,(unsi|
|00001a60| 67 6e 65 64 29 62 70 2d | 3e 63 6e 74 2c 66 74 70 |gned)bp-|>cnt,ftp|
|00001a70| 2d 3e 66 70 29 3b 0a 09 | 09 09 69 66 28 20 66 74 |->fp);..|..if( ft|
|00001a80| 70 2d 3e 68 61 73 68 62 | 65 6c 6c 20 26 20 46 54 |p->hashb|ell & FT|
|00001a90| 50 48 41 53 48 20 29 20 | 7b 0a 09 09 09 09 69 6e |PHASH ) |{.....in|
|00001aa0| 74 20 76 61 6c 2c 20 69 | 3b 0a 09 09 09 09 66 74 |t val, i|;.....ft|
|00001ab0| 70 2d 3e 64 61 74 61 62 | 79 74 65 73 20 2b 3d 20 |p->datab|ytes += |
|00001ac0| 77 72 3b 0a 09 09 09 09 | 76 61 6c 20 3d 20 28 66 |wr;.....|val = (f|
|00001ad0| 74 70 2d 3e 64 61 74 61 | 62 79 74 65 73 20 3e 3e |tp->data|bytes >>|
|00001ae0| 20 31 30 20 29 20 2d 20 | 66 74 70 2d 3e 6c 61 73 | 10 ) - |ftp->las|
|00001af0| 74 68 61 73 68 3b 0a 09 | 09 09 09 66 74 70 2d 3e |thash;..|...ftp->|
|00001b00| 6c 61 73 74 68 61 73 68 | 20 3d 20 28 66 74 70 2d |lasthash| = (ftp-|
|00001b10| 3e 64 61 74 61 62 79 74 | 65 73 20 3e 3e 20 31 30 |>databyt|es >> 10|
|00001b20| 20 29 3b 0a 09 09 09 09 | 66 6f 72 28 20 69 20 3d | );.....|for( i =|
|00001b30| 20 30 3b 20 69 20 3c 20 | 76 61 6c 3b 20 69 2b 2b | 0; i < |val; i++|
|00001b40| 29 20 70 72 69 6e 74 66 | 28 20 22 23 22 20 29 3b |) printf|( "#" );|
|00001b50| 0a 09 09 09 09 66 66 6c | 75 73 68 28 73 74 64 6f |.....ffl|ush(stdo|
|00001b60| 75 74 29 3b 0a 09 09 09 | 7d 0a 09 09 62 70 20 3d |ut);....|}...bp =|
|00001b70| 20 66 72 65 65 5f 6d 62 | 75 66 28 62 70 29 3b 0a | free_mb|uf(bp);.|
|00001b80| 09 7d 0a 0a 20 09 69 66 | 28 66 74 70 2d 3e 66 70 |.}.. .if|(ftp->fp|
|00001b90| 20 21 3d 20 73 74 64 6f | 75 74 20 26 26 20 66 65 | != stdo|ut && fe|
|00001ba0| 72 72 6f 72 28 66 74 70 | 2d 3e 66 70 29 29 7b 20 |rror(ftp|->fp)){ |
|00001bb0| 2f 2a 20 77 72 69 74 65 | 20 65 72 72 6f 72 20 28 |/* write| error (|
|00001bc0| 64 73 6b 20 66 75 6c 6c | 3f 29 20 2a 2f 0a 20 09 |dsk full|?) */. .|
|00001bd0| 09 66 63 6c 6f 73 65 28 | 66 74 70 2d 3e 66 70 29 |.fclose(|ftp->fp)|
|00001be0| 3b 0a 20 09 09 66 74 70 | 2d 3e 66 70 20 3d 20 4e |;. ..ftp|->fp = N|
|00001bf0| 55 4c 4c 46 49 4c 45 3b | 0a 20 09 09 63 6c 6f 73 |ULLFILE;|. ..clos|
|00001c00| 65 5f 73 65 6c 66 28 74 | 63 62 2c 52 45 53 45 54 |e_self(t|cb,RESET|
|00001c10| 29 3b 0a 20 09 7d 0a 7d | 0a 2f 2a 20 46 54 50 20 |);. .}.}|./* FTP |
|00001c20| 44 61 74 61 20 63 68 61 | 6e 6e 65 6c 20 54 72 61 |Data cha|nnel Tra|
|00001c30| 6e 73 6d 69 74 20 75 70 | 63 61 6c 6c 20 68 61 6e |nsmit up|call han|
|00001c40| 64 6c 65 72 20 2a 2f 0a | 76 6f 69 64 0a 66 74 70 |dler */.|void.ftp|
|00001c50| 64 74 28 74 63 62 2c 63 | 6e 74 29 0a 73 74 72 75 |dt(tcb,c|nt).stru|
|00001c60| 63 74 20 74 63 62 20 2a | 74 63 62 3b 0a 69 6e 74 |ct tcb *|tcb;.int|
|00001c70| 31 36 20 63 6e 74 3b 0a | 7b 0a 09 73 74 72 75 63 |16 cnt;.|{..struc|
|00001c80| 74 20 66 74 70 20 2a 66 | 74 70 3b 0a 09 73 74 72 |t ftp *f|tp;..str|
|00001c90| 75 63 74 20 6d 62 75 66 | 20 2a 62 70 3b 0a 09 72 |uct mbuf| *bp;..r|
|00001ca0| 65 67 69 73 74 65 72 20 | 63 68 61 72 20 2a 63 70 |egister |char *cp|
|00001cb0| 3b 0a 09 72 65 67 69 73 | 74 65 72 20 69 6e 74 20 |;..regis|ter int |
|00001cc0| 63 3b 0a 23 69 66 64 65 | 66 09 53 59 53 35 0a 09 |c;.#ifde|f.SYS5..|
|00001cd0| 73 74 72 75 63 74 20 73 | 74 61 74 20 73 73 5f 62 |struct s|tat ss_b|
|00001ce0| 75 66 3b 0a 23 65 6e 64 | 69 66 0a 0a 0a 09 73 74 |uf;.#end|if....st|
|00001cf0| 61 74 69 63 20 69 6e 74 | 20 73 61 76 65 64 63 68 |atic int| savedch|
|00001d00| 20 3d 20 46 41 4c 53 45 | 3b 09 2f 2a 20 61 64 64 | = FALSE|;./* add|
|00001d10| 65 64 20 6b 32 38 20 2d | 20 74 68 69 73 20 6d 6f |ed k28 -| this mo|
|00001d20| 64 20 63 6f 73 74 73 20 | 38 30 20 62 79 74 65 73 |d costs |80 bytes|
|00001d30| 20 77 68 65 6e 0a 09 09 | 09 61 70 70 6c 69 65 64 | when...|.applied|
|00001d40| 20 74 6f 20 74 68 65 20 | 55 6e 69 78 20 76 65 72 | to the |Unix ver|
|00001d50| 73 69 6f 6e 20 2a 2f 0a | 0a 23 69 66 64 65 66 20 |sion */.|.#ifdef |
|00001d60| 43 4f 48 50 52 4f 46 0a | 70 72 6f 66 69 6c 65 28 |COHPROF.|profile(|
|00001d70| 5f 5f 4c 49 4e 45 5f 5f | 2c 5f 5f 46 49 4c 45 5f |__LINE__|,__FILE_|
|00001d80| 5f 29 3b 0a 23 65 6e 64 | 69 66 0a 0a 09 66 74 70 |_);.#end|if...ftp|
|00001d90| 20 3d 20 28 73 74 72 75 | 63 74 20 66 74 70 20 2a | = (stru|ct ftp *|
|00001da0| 29 74 63 62 2d 3e 75 73 | 65 72 3b 0a 09 69 66 28 |)tcb->us|er;..if(|
|00001db0| 66 74 70 2d 3e 73 74 61 | 74 65 20 21 3d 20 53 45 |ftp->sta|te != SE|
|00001dc0| 4e 44 49 4e 47 5f 53 54 | 41 54 45 29 7b 0a 09 09 |NDING_ST|ATE){...|
|00001dd0| 63 6c 6f 73 65 5f 74 63 | 70 28 74 63 62 29 3b 0a |close_tc|p(tcb);.|
|00001de0| 09 09 72 65 74 75 72 6e | 3b 0a 09 7d 0a 09 69 66 |..return|;..}..if|
|00001df0| 28 28 62 70 20 3d 20 61 | 6c 6c 6f 63 5f 6d 62 75 |((bp = a|lloc_mbu|
|00001e00| 66 28 63 6e 74 29 29 20 | 3d 3d 20 4e 55 4c 4c 42 |f(cnt)) |== NULLB|
|00001e10| 55 46 29 7b 0a 09 09 2f | 2a 20 48 61 72 64 20 74 |UF){.../|* Hard t|
|00001e20| 6f 20 6b 6e 6f 77 20 77 | 68 61 74 20 74 6f 20 64 |o know w|hat to d|
|00001e30| 6f 20 68 65 72 65 20 2d | 20 59 6f 75 20 62 65 74 |o here -| You bet|
|00001e40| 21 20 20 41 6e 64 20 74 | 68 69 73 20 63 6f 75 6c |! And t|his coul|
|00001e50| 64 20 62 65 20 61 20 72 | 65 61 6c 0a 09 09 20 2a |d be a r|eal... *|
|00001e60| 20 6d 65 6d 6f 72 79 20 | 6c 65 61 6b 20 69 66 20 | memory |leak if |
|00001e70| 6d 65 6d 6f 72 79 20 69 | 73 20 69 6e 20 79 65 6c |memory i|s in yel|
|00001e80| 6c 6f 77 20 7a 6f 6e 65 | 20 2d 20 4b 35 4a 42 20 |low zone| - K5JB |
|00001e90| 2a 2f 0a 09 09 72 65 74 | 75 72 6e 3b 0a 09 7d 0a |*/...ret|urn;..}.|
|00001ea0| 09 63 20 3d 20 30 3b 09 | 2f 2a 20 64 6f 75 62 6c |.c = 0;.|/* doubl|
|00001eb0| 65 20 64 75 74 79 20 61 | 73 20 63 68 61 72 61 63 |e duty a|s charac|
|00001ec0| 74 65 72 20 61 6e 64 20 | 66 6c 61 67 20 2a 2f 0a |ter and |flag */.|
|00001ed0| 09 69 66 28 66 74 70 2d | 3e 74 79 70 65 20 3d 3d |.if(ftp-|>type ==|
|00001ee0| 20 49 4d 41 47 45 5f 54 | 59 50 45 29 7b 0a 09 09 | IMAGE_T|YPE){...|
|00001ef0| 62 70 2d 3e 63 6e 74 20 | 3d 20 66 72 65 61 64 28 |bp->cnt |= fread(|
|00001f00| 62 70 2d 3e 64 61 74 61 | 2c 31 2c 63 6e 74 2c 66 |bp->data|,1,cnt,f|
|00001f10| 74 70 2d 3e 66 70 29 3b | 0a 09 09 09 69 66 28 20 |tp->fp);|....if( |
|00001f20| 66 74 70 2d 3e 68 61 73 | 68 62 65 6c 6c 20 26 20 |ftp->has|hbell & |
|00001f30| 46 54 50 48 41 53 48 20 | 29 20 7b 0a 09 09 09 09 |FTPHASH |) {.....|
|00001f40| 69 6e 74 20 76 61 6c 2c | 20 69 3b 0a 09 09 09 09 |int val,| i;.....|
|00001f50| 66 74 70 2d 3e 64 61 74 | 61 62 79 74 65 73 20 2b |ftp->dat|abytes +|
|00001f60| 3d 20 62 70 2d 3e 63 6e | 74 3b 0a 09 09 09 09 76 |= bp->cn|t;.....v|
|00001f70| 61 6c 20 3d 20 28 66 74 | 70 2d 3e 64 61 74 61 62 |al = (ft|p->datab|
|00001f80| 79 74 65 73 20 3e 3e 20 | 31 30 20 29 20 2d 20 66 |ytes >> |10 ) - f|
|00001f90| 74 70 2d 3e 6c 61 73 74 | 68 61 73 68 3b 0a 09 09 |tp->last|hash;...|
|00001fa0| 09 09 66 74 70 2d 3e 6c | 61 73 74 68 61 73 68 20 |..ftp->l|asthash |
|00001fb0| 3d 20 28 66 74 70 2d 3e | 64 61 74 61 62 79 74 65 |= (ftp->|databyte|
|00001fc0| 73 20 3e 3e 20 31 30 20 | 29 3b 0a 09 09 09 09 66 |s >> 10 |);.....f|
|00001fd0| 6f 72 28 20 69 20 3d 20 | 30 3b 20 69 20 3c 20 76 |or( i = |0; i < v|
|00001fe0| 61 6c 3b 20 69 2b 2b 29 | 20 70 72 69 6e 74 66 28 |al; i++)| printf(|
|00001ff0| 20 22 23 22 20 29 3b 0a | 09 09 09 09 66 66 6c 75 | "#" );.|....fflu|
|00002000| 73 68 28 73 74 64 6f 75 | 74 29 3b 0a 09 09 09 7d |sh(stdou|t);....}|
|00002010| 0a 09 09 69 66 28 62 70 | 2d 3e 63 6e 74 20 21 3d |...if(bp|->cnt !=|
|00002020| 20 63 6e 74 29 0a 09 09 | 09 63 20 3d 20 45 4f 46 | cnt)...|.c = EOF|
|00002030| 3b 09 2f 2a 20 66 6c 61 | 67 20 74 6f 20 67 65 74 |;./* fla|g to get|
|00002040| 20 6f 75 74 61 20 68 65 | 72 65 20 2a 2f 0a 09 7d | outa he|re */..}|
|00002050| 20 65 6c 73 65 20 7b 20 | 09 2f 2a 20 69 73 20 41 | else { |./* is A|
|00002060| 53 43 49 49 20 74 79 70 | 65 20 2a 2f 0a 09 09 63 |SCII typ|e */...c|
|00002070| 70 20 3d 20 62 70 2d 3e | 64 61 74 61 3b 0a 09 09 |p = bp->|data;...|
|00002080| 2f 2a 20 6c 69 66 74 65 | 64 20 74 68 69 73 20 6f |/* lifte|d this o|
|00002090| 75 74 20 72 6f 75 74 69 | 6e 65 20 49 20 77 72 6f |ut routi|ne I wro|
|000020a0| 74 65 20 66 6f 72 20 66 | 69 6e 67 65 72 20 73 6f |te for f|inger so|
|000020b0| 20 77 65 20 77 6f 75 6c | 64 6e 27 74 0a 09 09 20 | we woul|dn't... |
|000020c0| 2a 20 68 61 76 65 20 61 | 20 63 68 72 6f 6e 69 63 |* have a| chronic|
|000020d0| 20 71 75 65 75 65 20 6f | 66 20 28 77 69 6e 64 6f | queue o|f (windo|
|000020e0| 77 20 2d 20 31 29 2e 20 | 20 49 66 20 6e 65 63 65 |w - 1). | If nece|
|000020f0| 73 73 61 72 79 20 74 6f | 20 68 61 6e 64 6c 65 0a |ssary to| handle.|
|00002100| 09 09 20 2a 20 69 6c 6c | 20 66 6f 72 6d 65 64 20 |.. * ill| formed |
|00002110| 4d 53 2d 44 4f 53 20 74 | 65 78 74 20 66 69 6c 65 |MS-DOS t|ext file|
|00002120| 73 2c 20 6a 75 73 74 20 | 72 65 6d 6f 76 65 20 74 |s, just |remove t|
|00002130| 68 65 20 23 69 66 73 20 | 2d 2d 20 4b 35 4a 42 20 |he #ifs |-- K5JB |
|00002140| 6b 32 38 0a 09 09 20 2a | 2f 0a 0a 09 09 69 66 28 |k28... *|/....if(|
|00002150| 73 61 76 65 64 63 68 29 | 7b 09 2f 2a 20 75 6e 6c |savedch)|{./* unl|
|00002160| 69 6b 65 6c 79 20 63 61 | 73 65 20 2a 2f 0a 09 09 |ikely ca|se */...|
|00002170| 09 2a 63 70 2b 2b 20 3d | 20 27 5c 72 27 3b 0a 09 |.*cp++ =| '\r';..|
|00002180| 09 09 2a 63 70 2b 2b 20 | 3d 20 27 5c 6e 27 3b 0a |..*cp++ |= '\n';.|
|00002190| 09 09 09 62 70 2d 3e 63 | 6e 74 20 2b 3d 20 32 3b |...bp->c|nt += 2;|
|000021a0| 0a 09 09 09 63 6e 74 20 | 2d 3d 20 32 3b 0a 09 09 |....cnt |-= 2;...|
|000021b0| 09 73 61 76 65 64 63 68 | 20 3d 20 46 41 4c 53 45 |.savedch| = FALSE|
|000021c0| 3b 0a 09 09 7d 0a 0a 09 | 09 77 68 69 6c 65 28 63 |;...}...|.while(c|
|000021d0| 6e 74 20 3e 20 30 20 26 | 26 20 28 63 20 3d 20 67 |nt > 0 &|& (c = g|
|000021e0| 65 74 63 28 66 74 70 2d | 3e 66 70 29 29 20 21 3d |etc(ftp-|>fp)) !=|
|000021f0| 20 45 4f 46 29 7b 0a 09 | 09 09 69 66 28 20 66 74 | EOF){..|..if( ft|
|00002200| 70 2d 3e 68 61 73 68 62 | 65 6c 6c 20 26 20 46 54 |p->hashb|ell & FT|
|00002210| 50 48 41 53 48 20 29 20 | 7b 0a 09 09 09 09 69 6e |PHASH ) |{.....in|
|00002220| 74 20 76 61 6c 2c 20 69 | 3b 0a 09 09 09 09 66 74 |t val, i|;.....ft|
|00002230| 70 2d 3e 64 61 74 61 62 | 79 74 65 73 2b 2b 3b 0a |p->datab|ytes++;.|
|00002240| 09 09 09 09 76 61 6c 20 | 3d 20 28 66 74 70 2d 3e |....val |= (ftp->|
|00002250| 64 61 74 61 62 79 74 65 | 73 20 3e 3e 20 31 30 20 |databyte|s >> 10 |
|00002260| 29 20 2d 20 66 74 70 2d | 3e 6c 61 73 74 68 61 73 |) - ftp-|>lasthas|
|00002270| 68 3b 0a 09 09 09 09 66 | 74 70 2d 3e 6c 61 73 74 |h;.....f|tp->last|
|00002280| 68 61 73 68 20 3d 20 28 | 66 74 70 2d 3e 64 61 74 |hash = (|ftp->dat|
|00002290| 61 62 79 74 65 73 20 3e | 3e 20 31 30 20 29 3b 0a |abytes >|> 10 );.|
|000022a0| 09 09 09 09 66 6f 72 28 | 20 69 20 3d 20 30 3b 20 |....for(| i = 0; |
|000022b0| 69 20 3c 20 76 61 6c 3b | 20 69 2b 2b 29 20 70 72 |i < val;| i++) pr|
|000022c0| 69 6e 74 66 28 20 22 23 | 22 20 29 3b 0a 09 09 09 |intf( "#|" );....|
|000022d0| 09 66 66 6c 75 73 68 28 | 73 74 64 6f 75 74 29 3b |.fflush(|stdout);|
|000022e0| 0a 09 09 09 7d 0a 09 09 | 09 73 77 69 74 63 68 28 |....}...|.switch(|
|000022f0| 28 63 68 61 72 29 63 29 | 20 7b 0a 09 09 09 09 63 |(char)c)| {.....c|
|00002300| 61 73 65 20 27 5c 30 33 | 32 27 3a 09 2f 2a 20 4e |ase '\03|2':./* N|
|00002310| 4f 20 5e 5a 27 73 21 20 | 2d 20 74 68 65 79 20 63 |O ^Z's! |- they c|
|00002320| 6c 65 61 72 20 73 63 72 | 65 65 6e 73 20 2a 2f 0a |lear scr|eens */.|
|00002330| 09 09 09 09 09 62 72 65 | 61 6b 3b 0a 0a 0a 09 09 |.....bre|ak;.....|
|00002340| 09 09 63 61 73 65 20 27 | 5c 72 27 3a 09 2f 2a 20 |..case '|\r':./* |
|00002350| 55 6e 69 78 20 61 6e 64 | 20 74 68 65 20 6f 74 68 |Unix and| the oth|
|00002360| 65 72 73 20 75 73 65 20 | 5c 6e 20 61 73 20 2a 2f |ers use |\n as */|
|00002370| 0a 09 09 09 09 09 09 09 | 09 2f 2a 09 45 4f 4c 20 |........|./*.EOL |
|00002380| 63 68 61 72 61 63 74 65 | 72 20 2a 2f 0a 09 09 09 |characte|r */....|
|00002390| 09 09 62 72 65 61 6b 3b | 0a 09 09 09 09 63 61 73 |..break;|.....cas|
|000023a0| 65 20 27 5c 6e 27 3a 09 | 2f 2a 20 63 6f 6e 76 65 |e '\n':.|/* conve|
|000023b0| 72 74 20 4c 46 20 74 6f | 20 43 52 2f 4c 46 20 2a |rt LF to| CR/LF *|
|000023c0| 2f 0a 0a 09 09 09 09 09 | 69 66 28 63 6e 74 20 3d |/.......|if(cnt =|
|000023d0| 3d 20 31 29 7b 20 2f 2a | 20 75 6e 6c 69 6b 65 6c |= 1){ /*| unlikel|
|000023e0| 79 20 63 61 73 65 2c 20 | 6e 6f 20 72 6f 6f 6d 20 |y case, |no room |
|000023f0| 66 6f 72 20 32 20 63 68 | 61 72 73 20 2a 2f 0a 09 |for 2 ch|ars */..|
|00002400| 09 09 09 09 09 73 61 76 | 65 64 63 68 20 3d 20 54 |.....sav|edch = T|
|00002410| 52 55 45 3b 0a 09 09 09 | 09 09 09 63 6e 74 20 3d |RUE;....|...cnt =|
|00002420| 20 30 3b 09 2f 2a 20 6d | 61 6b 65 20 69 74 20 61 | 0;./* m|ake it a|
|00002430| 20 73 68 6f 72 74 20 6f | 6e 65 20 2d 20 64 72 6f | short o|ne - dro|
|00002440| 70 20 6f 75 74 20 2a 2f | 0a 09 09 09 09 09 09 62 |p out */|.......b|
|00002450| 72 65 61 6b 3b 0a 09 09 | 09 09 09 7d 0a 09 09 09 |reak;...|...}....|
|00002460| 09 09 2a 63 70 2b 2b 20 | 3d 20 27 5c 72 27 3b 0a |..*cp++ |= '\r';.|
|00002470| 09 09 09 09 09 62 70 2d | 3e 63 6e 74 2b 2b 3b 0a |.....bp-|>cnt++;.|
|00002480| 09 09 09 09 09 63 6e 74 | 2d 2d 3b 0a 09 09 09 09 |.....cnt|--;.....|
|00002490| 09 09 2f 2a 20 61 6e 64 | 20 66 61 6c 6c 20 74 68 |../* and| fall th|
|000024a0| 72 6f 75 67 68 20 2a 2f | 0a 0a 09 09 09 09 64 65 |rough */|......de|
|000024b0| 66 61 75 6c 74 3a 0a 09 | 09 09 09 09 2a 63 70 2b |fault:..|....*cp+|
|000024c0| 2b 20 3d 20 28 63 68 61 | 72 29 63 3b 0a 09 09 09 |+ = (cha|r)c;....|
|000024d0| 09 09 62 70 2d 3e 63 6e | 74 2b 2b 3b 0a 09 09 09 |..bp->cn|t++;....|
|000024e0| 09 09 63 6e 74 2d 2d 3b | 0a 09 09 09 09 09 62 72 |..cnt--;|......br|
|000024f0| 65 61 6b 3b 0a 09 09 09 | 7d 0a 09 09 7d 20 2f 2a |eak;....|}...} /*|
|00002500| 20 77 68 69 6c 65 20 21 | 66 65 6f 66 28 29 20 26 | while !|feof() &|
|00002510| 26 20 63 6e 74 20 21 3d | 20 30 20 2a 2f 0a 09 7d |& cnt !=| 0 */..}|
|00002520| 20 2f 2a 20 65 6c 73 65 | 20 6e 6f 74 20 69 6d 61 | /* else| not ima|
|00002530| 67 65 20 74 79 70 65 20 | 2a 2f 0a 09 69 66 28 62 |ge type |*/..if(b|
|00002540| 70 2d 3e 63 6e 74 20 21 | 3d 20 30 29 0a 09 09 73 |p->cnt !|= 0)...s|
|00002550| 65 6e 64 5f 74 63 70 28 | 74 63 62 2c 62 70 29 3b |end_tcp(|tcb,bp);|
|00002560| 0a 09 65 6c 73 65 0a 09 | 09 66 72 65 65 5f 70 28 |..else..|.free_p(|
|00002570| 62 70 29 3b 0a 09 69 66 | 28 63 20 3d 3d 20 45 4f |bp);..if|(c == EO|
|00002580| 46 29 7b 09 2f 2a 20 45 | 4f 46 20 73 65 65 6e 20 |F){./* E|OF seen |
|00002590| 69 6e 20 65 69 74 68 65 | 72 20 41 53 43 49 49 20 |in eithe|r ASCII |
|000025a0| 6f 72 20 49 4d 41 47 45 | 20 74 79 70 65 73 20 2a |or IMAGE| types *|
|000025b0| 2f 0a 23 69 66 64 65 66 | 09 55 4e 49 58 0a 23 69 |/.#ifdef|.UNIX.#i|
|000025c0| 66 64 65 66 09 53 59 53 | 35 0a 23 69 66 6e 64 65 |fdef.SYS|5.#ifnde|
|000025d0| 66 09 68 70 39 30 30 30 | 73 35 30 30 0a 2f 2a 20 |f.hp9000|s500./* |
|000025e0| 49 66 20 66 74 70 2d 3e | 66 70 20 70 6f 69 6e 74 |If ftp->|fp point|
|000025f0| 73 20 74 6f 20 61 6e 20 | 6f 70 65 6e 20 70 69 70 |s to an |open pip|
|00002600| 65 20 28 66 72 6f 6d 20 | 64 69 72 28 29 29 20 69 |e (from |dir()) i|
|00002610| 74 20 6d 75 73 74 20 62 | 65 20 63 6c 6f 73 65 64 |t must b|e closed|
|00002620| 20 77 69 74 68 20 2a 2f | 0a 2f 2a 20 70 63 6c 6f | with */|./* pclo|
|00002630| 73 65 28 29 2e 20 20 53 | 79 73 74 65 6d 20 56 20 |se(). S|ystem V |
|00002640| 66 73 74 61 74 28 29 20 | 63 61 6e 20 74 65 6c 6c |fstat() |can tell|
|00002650| 20 75 73 20 69 66 20 74 | 68 69 73 20 77 61 73 20 | us if t|his was |
|00002660| 61 20 70 69 70 65 20 6f | 72 20 6e 6f 74 2e 20 2a |a pipe o|r not. *|
|00002670| 2f 0a 09 09 69 66 20 28 | 66 73 74 61 74 28 66 69 |/...if (|fstat(fi|
|00002680| 6c 65 6e 6f 28 66 74 70 | 2d 3e 66 70 29 2c 20 26 |leno(ftp|->fp), &|
|00002690| 73 73 5f 62 75 66 29 20 | 3c 20 30 29 0a 09 09 09 |ss_buf) |< 0)....|
|000026a0| 70 65 72 72 6f 72 28 22 | 66 74 70 64 74 3a 20 66 |perror("|ftpdt: f|
|000026b0| 73 74 61 74 22 29 3b 0a | 23 69 66 64 65 66 20 43 |stat");.|#ifdef C|
|000026c0| 4f 48 33 38 36 0a 09 09 | 69 66 20 28 28 73 73 5f |OH386...|if ((ss_|
|000026d0| 62 75 66 2e 73 74 5f 6d | 6f 64 65 20 26 20 53 5f |buf.st_m|ode & S_|
|000026e0| 49 46 50 49 50 29 20 3d | 3d 20 53 5f 49 46 50 49 |IFPIP) =|= S_IFPI|
|000026f0| 50 29 0a 23 65 6c 73 65 | 0a 09 09 69 66 20 28 28 |P).#else|...if ((|
|00002700| 73 73 5f 62 75 66 2e 73 | 74 5f 6d 6f 64 65 20 26 |ss_buf.s|t_mode &|
|00002710| 20 49 46 49 46 4f 29 20 | 3d 3d 20 49 46 49 46 4f | IFIFO) |== IFIFO|
|00002720| 29 0a 23 65 6e 64 69 66 | 0a 09 09 09 70 63 6c 6f |).#endif|....pclo|
|00002730| 73 65 28 66 74 70 2d 3e | 66 70 29 3b 09 2f 2a 20 |se(ftp->|fp);./* |
|00002740| 63 6c 6f 73 65 20 70 69 | 70 65 20 66 72 6f 6d 20 |close pi|pe from |
|00002750| 64 69 72 20 2a 2f 0a 09 | 09 65 6c 73 65 0a 09 09 |dir */..|.else...|
|00002760| 09 66 63 6c 6f 73 65 28 | 66 74 70 2d 3e 66 70 29 |.fclose(|ftp->fp)|
|00002770| 3b 0a 23 65 6c 73 65 09 | 2f 2a 20 68 70 39 30 30 |;.#else.|/* hp900|
|00002780| 30 73 35 30 30 20 2a 2f | 0a 2f 2a 20 48 50 2d 55 |0s500 */|./* HP-U|
|00002790| 58 20 35 2e 32 31 20 6f | 6e 20 74 68 65 20 35 30 |X 5.21 o|n the 50|
|000027a0| 30 20 64 6f 65 73 6e 27 | 74 20 75 6e 64 65 72 73 |0 doesn'|t unders|
|000027b0| 74 61 6e 64 20 49 46 49 | 46 4f 2c 20 73 69 6e 63 |tand IFI|FO, sinc|
|000027c0| 65 20 77 65 20 70 72 6f | 62 61 62 6c 79 20 64 6f |e we pro|bably do|
|000027d0| 6e 27 74 20 2a 2e 0a 2f | 20 2a 20 63 61 72 65 20 |n't *../| * care |
|000027e0| 61 6e 79 77 61 79 2c 20 | 74 72 65 61 74 20 69 74 |anyway, |treat it|
|000027f0| 20 6c 69 6b 65 20 42 53 | 44 20 69 73 20 74 72 65 | like BS|D is tre|
|00002800| 61 74 65 64 2e 2e 2e 20 | 2a 2f 0a 09 09 69 66 20 |ated... |*/...if |
|00002810| 28 70 63 6c 6f 73 65 28 | 66 74 70 2d 3e 66 70 29 |(pclose(|ftp->fp)|
|00002820| 20 3c 20 30 29 0a 09 09 | 09 66 63 6c 6f 73 65 28 | < 0)...|.fclose(|
|00002830| 66 74 70 2d 3e 66 70 29 | 3b 0a 23 65 6e 64 69 66 |ftp->fp)|;.#endif|
|00002840| 09 2f 2a 20 68 70 39 30 | 30 30 73 35 30 30 20 2a |./* hp90|00s500 *|
|00002850| 2f 0a 23 65 6c 73 65 09 | 2f 2a 20 53 59 53 35 20 |/.#else.|/* SYS5 |
|00002860| 2a 2f 0a 2f 2a 20 42 65 | 72 6b 65 6c 65 79 20 55 |*/./* Be|rkeley U|
|00002870| 6e 69 78 20 63 61 6e 27 | 74 20 74 65 6c 6c 20 69 |nix can'|t tell i|
|00002880| 66 20 74 68 69 73 20 77 | 61 73 20 61 20 70 69 70 |f this w|as a pip|
|00002890| 65 20 6f 72 20 6e 6f 74 | 2e 20 20 54 72 79 20 61 |e or not|. Try a|
|000028a0| 20 70 63 6c 6f 73 65 28 | 29 20 2a 2f 0a 2f 2a 20 | pclose(|) */./* |
|000028b0| 66 69 72 73 74 2e 20 20 | 49 66 20 74 68 69 73 20 |first. |If this |
|000028c0| 66 61 69 6c 73 2c 20 69 | 74 20 6d 75 73 74 20 68 |fails, i|t must h|
|000028d0| 61 76 65 20 62 65 65 6e | 20 61 6e 20 6f 70 65 6e |ave been| an open|
|000028e0| 20 66 69 6c 65 2e 20 2a | 2f 0a 09 09 69 66 20 28 | file. *|/...if (|
|000028f0| 70 63 6c 6f 73 65 28 66 | 74 70 2d 3e 66 70 29 20 |pclose(f|tp->fp) |
|00002900| 3c 20 30 29 0a 09 09 09 | 66 63 6c 6f 73 65 28 66 |< 0)....|fclose(f|
|00002910| 74 70 2d 3e 66 70 29 3b | 0a 23 65 6e 64 69 66 09 |tp->fp);|.#endif.|
|00002920| 2f 2a 20 53 59 53 35 20 | 2a 2f 0a 23 65 6c 73 65 |/* SYS5 |*/.#else|
|00002930| 09 2f 2a 20 55 4e 49 58 | 20 2a 2f 0a 2f 2a 20 41 |./* UNIX| */./* A|
|00002940| 6e 79 74 68 69 6e 67 20 | 6f 74 68 65 72 20 74 68 |nything |other th|
|00002950| 61 6e 20 55 6e 69 78 20 | 2a 2f 0a 09 09 66 63 6c |an Unix |*/...fcl|
|00002960| 6f 73 65 28 66 74 70 2d | 3e 66 70 29 3b 0a 23 65 |ose(ftp-|>fp);.#e|
|00002970| 6e 64 69 66 09 2f 2a 20 | 55 4e 49 58 20 2a 2f 0a |ndif./* |UNIX */.|
|00002980| 09 09 66 74 70 2d 3e 66 | 70 20 3d 20 4e 55 4c 4c |..ftp->f|p = NULL|
|00002990| 46 49 4c 45 3b 0a 09 09 | 63 6c 6f 73 65 5f 74 63 |FILE;...|close_tc|
|000029a0| 70 28 74 63 62 29 3b 0a | 09 7d 09 2f 2a 20 69 66 |p(tcb);.|.}./* if|
|000029b0| 20 45 4f 46 20 2a 2f 0a | 7d 0a 2f 2a 20 41 6c 6c | EOF */.|}./* All|
|000029c0| 6f 63 61 74 65 20 61 6e | 20 46 54 50 20 63 6f 6e |ocate an| FTP con|
|000029d0| 74 72 6f 6c 20 62 6c 6f | 63 6b 20 2a 2f 0a 73 74 |trol blo|ck */.st|
|000029e0| 72 75 63 74 20 66 74 70 | 20 2a 0a 66 74 70 5f 63 |ruct ftp| *.ftp_c|
|000029f0| 72 65 61 74 65 28 62 75 | 66 73 69 7a 65 29 0a 75 |reate(bu|fsize).u|
|00002a00| 6e 73 69 67 6e 65 64 20 | 62 75 66 73 69 7a 65 3b |nsigned |bufsize;|
|00002a10| 0a 7b 0a 09 76 6f 69 64 | 20 66 74 70 5f 64 65 6c |.{..void| ftp_del|
|00002a20| 65 74 65 28 29 3b 0a 09 | 72 65 67 69 73 74 65 72 |ete();..|register|
|00002a30| 20 73 74 72 75 63 74 20 | 66 74 70 20 2a 66 74 70 | struct |ftp *ftp|
|00002a40| 3b 0a 0a 23 69 66 64 65 | 66 20 43 4f 48 50 52 4f |;..#ifde|f COHPRO|
|00002a50| 46 0a 70 72 6f 66 69 6c | 65 28 5f 5f 4c 49 4e 45 |F.profil|e(__LINE|
|00002a60| 5f 5f 2c 5f 5f 46 49 4c | 45 5f 5f 29 3b 0a 23 65 |__,__FIL|E__);.#e|
|00002a70| 6e 64 69 66 0a 09 69 66 | 28 28 66 74 70 20 3d 20 |ndif..if|((ftp = |
|00002a80| 28 73 74 72 75 63 74 20 | 66 74 70 20 2a 29 63 61 |(struct |ftp *)ca|
|00002a90| 6c 6c 6f 63 28 31 2c 73 | 69 7a 65 6f 66 20 28 73 |lloc(1,s|izeof (s|
|00002aa0| 74 72 75 63 74 20 66 74 | 70 29 29 29 20 3d 3d 20 |truct ft|p))) == |
|00002ab0| 4e 55 4c 4c 46 54 50 29 | 0a 09 09 72 65 74 75 72 |NULLFTP)|...retur|
|00002ac0| 6e 20 4e 55 4c 4c 46 54 | 50 3b 0a 09 69 66 28 62 |n NULLFT|P;..if(b|
|00002ad0| 75 66 73 69 7a 65 20 21 | 3d 20 30 20 26 26 20 28 |ufsize !|= 0 && (|
|00002ae0| 66 74 70 2d 3e 62 75 66 | 20 3d 20 6d 61 6c 6c 6f |ftp->buf| = mallo|
|00002af0| 63 28 62 75 66 73 69 7a | 65 29 29 20 3d 3d 20 4e |c(bufsiz|e)) == N|
|00002b00| 55 4c 4c 43 48 41 52 29 | 7b 0a 23 69 66 64 65 66 |ULLCHAR)|{.#ifdef|
|00002b10| 20 44 45 42 55 47 0a 09 | 09 70 72 69 6e 74 66 28 | DEBUG..|.printf(|
|00002b20| 22 63 61 6c 6c 65 64 20 | 62 79 20 66 74 70 5f 63 |"called |by ftp_c|
|00002b30| 72 65 61 74 65 5c 6e 22 | 29 3b 66 66 6c 75 73 68 |reate\n"|);fflush|
|00002b40| 28 73 74 64 6f 75 74 29 | 3b 0a 23 65 6e 64 69 66 |(stdout)|;.#endif|
|00002b50| 0a 09 09 66 74 70 5f 64 | 65 6c 65 74 65 28 66 74 |...ftp_d|elete(ft|
|00002b60| 70 29 3b 0a 23 69 66 64 | 65 66 20 44 45 42 55 47 |p);.#ifd|ef DEBUG|
|00002b70| 0a 09 09 70 72 69 6e 74 | 66 28 22 63 61 6c 6c 65 |...print|f("calle|
|00002b80| 64 20 62 79 20 66 74 70 | 5f 63 72 65 61 74 65 5c |d by ftp|_create\|
|00002b90| 6e 22 29 3b 66 66 6c 75 | 73 68 28 73 74 64 6f 75 |n");fflu|sh(stdou|
|00002ba0| 74 29 3b 0a 23 65 6e 64 | 69 66 0a 09 09 72 65 74 |t);.#end|if...ret|
|00002bb0| 75 72 6e 20 4e 55 4c 4c | 46 54 50 3b 0a 09 7d 0a |urn NULL|FTP;..}.|
|00002bc0| 09 66 74 70 2d 3e 73 74 | 61 74 65 20 3d 20 43 4f |.ftp->st|ate = CO|
|00002bd0| 4d 4d 41 4e 44 5f 53 54 | 41 54 45 3b 0a 09 66 74 |MMAND_ST|ATE;..ft|
|00002be0| 70 2d 3e 74 79 70 65 20 | 3d 20 41 53 43 49 49 5f |p->type |= ASCII_|
|00002bf0| 54 59 50 45 3b 09 2f 2a | 20 44 65 66 61 75 6c 74 |TYPE;./*| Default|
|00002c00| 20 74 72 61 6e 73 66 65 | 72 20 74 79 70 65 20 2a | transfe|r type *|
|00002c10| 2f 0a 09 72 65 74 75 72 | 6e 20 66 74 70 3b 0a 7d |/..retur|n ftp;.}|
|00002c20| 0a 2f 2a 20 46 72 65 65 | 20 72 65 73 6f 75 72 63 |./* Free| resourc|
|00002c30| 65 73 2c 20 64 65 6c 65 | 74 65 20 63 6f 6e 74 72 |es, dele|te contr|
|00002c40| 6f 6c 20 62 6c 6f 63 6b | 20 2a 2f 0a 76 6f 69 64 |ol block| */.void|
|00002c50| 0a 66 74 70 5f 64 65 6c | 65 74 65 28 66 74 70 29 |.ftp_del|ete(ftp)|
|00002c60| 0a 72 65 67 69 73 74 65 | 72 20 73 74 72 75 63 74 |.registe|r struct|
|00002c70| 20 66 74 70 20 2a 66 74 | 70 3b 0a 7b 0a 09 69 6e | ftp *ft|p;.{..in|
|00002c80| 74 20 69 3b 0a 09 76 6f | 69 64 20 66 72 65 65 73 |t i;..vo|id frees|
|00002c90| 65 73 73 69 6f 6e 28 29 | 3b 0a 23 69 66 64 65 66 |ession()|;.#ifdef|
|00002ca0| 20 43 4f 48 50 52 4f 46 | 0a 70 72 6f 66 69 6c 65 | COHPROF|.profile|
|00002cb0| 28 5f 5f 4c 49 4e 45 5f | 5f 2c 5f 5f 46 49 4c 45 |(__LINE_|_,__FILE|
|00002cc0| 5f 5f 29 3b 0a 23 65 6e | 64 69 66 0a 0a 09 69 66 |__);.#en|dif...if|
|00002cd0| 28 66 74 70 2d 3e 66 70 | 20 21 3d 20 4e 55 4c 4c |(ftp->fp| != NULL|
|00002ce0| 46 49 4c 45 20 26 26 20 | 66 74 70 2d 3e 66 70 20 |FILE && |ftp->fp |
|00002cf0| 21 3d 20 73 74 64 6f 75 | 74 29 0a 09 09 66 63 6c |!= stdou|t)...fcl|
|00002d00| 6f 73 65 28 66 74 70 2d | 3e 66 70 29 3b 0a 09 69 |ose(ftp-|>fp);..i|
|00002d10| 66 28 66 74 70 2d 3e 64 | 61 74 61 20 21 3d 20 4e |f(ftp->d|ata != N|
|00002d20| 55 4c 4c 54 43 42 29 0a | 09 09 64 65 6c 5f 74 63 |ULLTCB).|..del_tc|
|00002d30| 70 28 66 74 70 2d 3e 64 | 61 74 61 29 3b 0a 09 69 |p(ftp->d|ata);..i|
|00002d40| 66 28 66 74 70 2d 3e 75 | 73 65 72 6e 61 6d 65 20 |f(ftp->u|sername |
|00002d50| 21 3d 20 4e 55 4c 4c 43 | 48 41 52 29 0a 09 09 66 |!= NULLC|HAR)...f|
|00002d60| 72 65 65 28 66 74 70 2d | 3e 75 73 65 72 6e 61 6d |ree(ftp-|>usernam|
|00002d70| 65 29 3b 0a 20 20 20 20 | 20 20 20 20 66 6f 72 20 |e);. | for |
|00002d80| 28 69 20 3d 20 30 3b 20 | 69 20 3c 20 4d 41 58 50 |(i = 0; |i < MAXP|
|00002d90| 41 54 48 3b 20 69 2b 2b | 29 0a 09 20 20 69 66 28 |ATH; i++|).. if(|
|00002da0| 66 74 70 2d 3e 70 61 74 | 68 5b 69 5d 20 21 3d 20 |ftp->pat|h[i] != |
|00002db0| 4e 55 4c 4c 43 48 41 52 | 29 0a 09 20 20 20 20 66 |NULLCHAR|).. f|
|00002dc0| 72 65 65 28 66 74 70 2d | 3e 70 61 74 68 5b 69 5d |ree(ftp-|>path[i]|
|00002dd0| 29 3b 0a 09 69 66 28 66 | 74 70 2d 3e 62 75 66 20 |);..if(f|tp->buf |
|00002de0| 21 3d 20 4e 55 4c 4c 43 | 48 41 52 29 0a 09 09 66 |!= NULLC|HAR)...f|
|00002df0| 72 65 65 28 66 74 70 2d | 3e 62 75 66 29 3b 0a 09 |ree(ftp-|>buf);..|
|00002e00| 69 66 28 66 74 70 2d 3e | 63 64 20 21 3d 20 4e 55 |if(ftp->|cd != NU|
|00002e10| 4c 4c 43 48 41 52 29 0a | 09 09 66 72 65 65 28 66 |LLCHAR).|..free(f|
|00002e20| 74 70 2d 3e 63 64 29 3b | 0a 09 69 66 28 66 74 70 |tp->cd);|..if(ftp|
|00002e30| 2d 3e 73 65 73 73 69 6f | 6e 20 21 3d 20 4e 55 4c |->sessio|n != NUL|
|00002e40| 4c 53 45 53 53 49 4f 4e | 29 0a 09 09 66 72 65 65 |LSESSION|)...free|
|00002e50| 73 65 73 73 69 6f 6e 28 | 66 74 70 2d 3e 73 65 73 |session(|ftp->ses|
|00002e60| 73 69 6f 6e 29 3b 0a 09 | 66 72 65 65 28 28 63 68 |sion);..|free((ch|
|00002e70| 61 72 20 2a 29 66 74 70 | 29 3b 0a 7d 0a 0a 00 00 |ar *)ftp|);.}....|
|00002e80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ea0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002eb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ec0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ed0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ee0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ef0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ff0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003000| 2e 2f 66 69 78 30 33 2f | 66 74 70 2e 68 00 00 00 |./fix03/|ftp.h...|
|00003010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003060| 00 00 00 00 31 30 30 36 | 34 34 20 00 20 20 20 20 |....1006|44 . |
|00003070| 20 30 20 00 20 20 20 20 | 20 30 20 00 20 20 20 20 | 0 . | 0 . |
|00003080| 20 20 20 33 32 36 35 20 | 20 35 36 31 35 33 31 33 | 3265 | 5615313|
|00003090| 37 35 34 20 20 31 31 32 | 30 34 00 20 30 00 00 00 |754 112|04. 0...|
|000030a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000030b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000030c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000030d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000030e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000030f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003100| 00 75 73 74 61 72 20 20 | 00 72 6f 6f 74 00 00 00 |.ustar |.root...|
|00003110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003120| 00 00 00 00 00 00 00 00 | 00 72 6f 6f 74 00 00 00 |........|.root...|
|00003130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003200| 23 64 65 66 69 6e 65 20 | 43 54 4c 5a 09 32 36 09 |#define |CTLZ.26.|
|00003210| 09 2f 2a 20 45 4f 46 20 | 66 6f 72 20 43 50 2f 4d |./* EOF |for CP/M|
|00003220| 20 73 79 73 74 65 6d 73 | 20 2a 2f 0a 0a 65 78 74 | systems| */..ext|
|00003230| 65 72 6e 20 63 68 61 72 | 20 2a 75 73 65 72 66 69 |ern char| *userfi|
|00003240| 6c 65 3b 09 2f 2a 20 4c | 69 73 74 20 6f 66 20 75 |le;./* L|ist of u|
|00003250| 73 65 72 20 6e 61 6d 65 | 73 20 61 6e 64 20 70 65 |ser name|s and pe|
|00003260| 72 6d 69 73 73 69 6f 6e | 73 20 2a 2f 0a 0a 23 64 |rmission|s */..#d|
|00003270| 65 66 69 6e 65 20 4d 41 | 58 50 41 54 48 20 38 20 |efine MA|XPATH 8 |
|00003280| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2a | | /*|
|00003290| 20 4d 61 78 69 6d 75 6d | 20 6e 75 6d 62 65 72 20 | Maximum| number |
|000032a0| 6f 66 20 70 61 74 68 2f | 70 65 72 6d 69 73 73 69 |of path/|permissi|
|000032b0| 6f 6e 20 70 61 69 72 73 | 20 2a 2f 0a 0a 2f 2a 20 |on pairs| */../* |
|000032c0| 50 65 72 2d 73 65 73 73 | 69 6f 6e 20 63 6f 6e 74 |Per-sess|ion cont|
|000032d0| 72 6f 6c 20 62 6c 6f 63 | 6b 20 2a 2f 0a 73 74 72 |rol bloc|k */.str|
|000032e0| 75 63 74 20 66 74 70 20 | 7b 0a 09 73 74 72 75 63 |uct ftp |{..struc|
|000032f0| 74 20 66 74 70 20 2a 70 | 72 65 76 3b 09 2f 2a 20 |t ftp *p|rev;./* |
|00003300| 4c 69 6e 6b 65 64 20 6c | 69 73 74 20 70 6f 69 6e |Linked l|ist poin|
|00003310| 74 65 72 73 20 2a 2f 0a | 09 73 74 72 75 63 74 20 |ters */.|.struct |
|00003320| 66 74 70 20 2a 6e 65 78 | 74 3b 0a 09 73 74 72 75 |ftp *nex|t;..stru|
|00003330| 63 74 20 74 63 62 20 2a | 63 6f 6e 74 72 6f 6c 3b |ct tcb *|control;|
|00003340| 09 2f 2a 20 54 43 50 20 | 63 6f 6e 74 72 6f 6c 20 |./* TCP |control |
|00003350| 63 6f 6e 6e 65 63 74 69 | 6f 6e 20 2a 2f 0a 09 69 |connecti|on */..i|
|00003360| 6e 74 20 73 74 61 74 65 | 3b 0a 23 64 65 66 69 6e |nt state|;.#defin|
|00003370| 65 09 43 4f 4d 4d 41 4e | 44 5f 53 54 41 54 45 09 |e.COMMAN|D_STATE.|
|00003380| 30 09 2f 2a 20 41 77 61 | 69 74 69 6e 67 20 75 73 |0./* Awa|iting us|
|00003390| 65 72 20 63 6f 6d 6d 61 | 6e 64 20 2a 2f 0a 23 64 |er comma|nd */.#d|
|000033a0| 65 66 69 6e 65 09 53 45 | 4e 44 49 4e 47 5f 53 54 |efine.SE|NDING_ST|
|000033b0| 41 54 45 09 31 09 2f 2a | 20 53 65 6e 64 69 6e 67 |ATE.1./*| Sending|
|000033c0| 20 64 61 74 61 20 74 6f | 20 75 73 65 72 20 2a 2f | data to| user */|
|000033d0| 0a 23 64 65 66 69 6e 65 | 09 52 45 43 45 49 56 49 |.#define|.RECEIVI|
|000033e0| 4e 47 5f 53 54 41 54 45 | 09 32 09 2f 2a 20 53 74 |NG_STATE|.2./* St|
|000033f0| 6f 72 69 6e 67 20 64 61 | 74 61 20 66 72 6f 6d 20 |oring da|ta from |
|00003400| 75 73 65 72 20 2a 2f 0a | 23 64 65 66 69 6e 65 20 |user */.|#define |
|00003410| 53 54 41 52 54 55 50 5f | 53 54 41 54 45 09 33 09 |STARTUP_|STATE.3.|
|00003420| 2f 2a 20 53 74 61 72 74 | 69 6e 67 20 75 70 20 61 |/* Start|ing up a|
|00003430| 75 74 6f 6c 6f 67 69 6e | 20 2a 2f 0a 23 64 65 66 |utologin| */.#def|
|00003440| 69 6e 65 20 55 53 45 52 | 5f 53 54 41 54 45 09 34 |ine USER|_STATE.4|
|00003450| 09 2f 2a 20 57 61 69 74 | 69 6e 67 20 66 6f 72 20 |./* Wait|ing for |
|00003460| 74 68 65 20 75 73 65 72 | 20 6e 61 6d 65 20 2a 2f |the user| name */|
|00003470| 0a 23 64 65 66 69 6e 65 | 20 50 41 53 53 5f 53 54 |.#define| PASS_ST|
|00003480| 41 54 45 09 35 09 2f 2a | 20 57 61 69 74 69 6e 67 |ATE.5./*| Waiting|
|00003490| 20 66 6f 72 20 74 68 65 | 20 70 61 73 73 77 6f 72 | for the| passwor|
|000034a0| 64 20 2a 2f 0a 0a 09 69 | 6e 74 20 74 79 70 65 3b |d */...i|nt type;|
|000034b0| 09 09 2f 2a 20 54 72 61 | 6e 73 66 65 72 20 74 79 |../* Tra|nsfer ty|
|000034c0| 70 65 20 2a 2f 0a 23 64 | 65 66 69 6e 65 09 49 4d |pe */.#d|efine.IM|
|000034d0| 41 47 45 5f 54 59 50 45 | 09 30 0a 23 64 65 66 69 |AGE_TYPE|.0.#defi|
|000034e0| 6e 65 09 41 53 43 49 49 | 5f 54 59 50 45 09 31 0a |ne.ASCII|_TYPE.1.|
|000034f0| 0a 09 46 49 4c 45 20 2a | 66 70 3b 09 09 2f 2a 20 |..FILE *|fp;../* |
|00003500| 46 69 6c 65 20 64 65 73 | 63 72 69 70 74 6f 72 20 |File des|criptor |
|00003510| 62 65 69 6e 67 20 74 72 | 61 6e 73 66 65 72 72 65 |being tr|ansferre|
|00003520| 64 20 2a 2f 0a 09 73 74 | 72 75 63 74 20 73 6f 63 |d */..st|ruct soc|
|00003530| 6b 65 74 20 70 6f 72 74 | 3b 09 2f 2a 20 52 65 6d |ket port|;./* Rem|
|00003540| 6f 74 65 20 70 6f 72 74 | 20 66 6f 72 20 64 61 74 |ote port| for dat|
|00003550| 61 20 63 6f 6e 6e 65 63 | 74 69 6f 6e 20 2a 2f 0a |a connec|tion */.|
|00003560| 09 73 74 72 75 63 74 20 | 74 63 62 20 2a 64 61 74 |.struct |tcb *dat|
|00003570| 61 3b 09 2f 2a 20 44 61 | 74 61 20 63 6f 6e 6e 65 |a;./* Da|ta conne|
|00003580| 63 74 69 6f 6e 20 2a 2f | 0a 0a 09 2f 2a 20 54 68 |ction */|.../* Th|
|00003590| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 61 72 65 20 |e follow|ing are |
|000035a0| 75 73 65 64 20 6f 6e 6c | 79 20 62 79 20 74 68 65 |used onl|y by the|
|000035b0| 20 73 65 72 76 65 72 20 | 2a 2f 0a 09 63 68 61 72 | server |*/..char|
|000035c0| 20 2a 75 73 65 72 6e 61 | 6d 65 3b 09 09 2f 2a 20 | *userna|me;../* |
|000035d0| 41 72 67 20 74 6f 20 55 | 53 45 52 20 63 6f 6d 6d |Arg to U|SER comm|
|000035e0| 61 6e 64 20 2a 2f 0a 09 | 63 68 61 72 20 2a 70 61 |and */..|char *pa|
|000035f0| 74 68 5b 4d 41 58 50 41 | 54 48 5d 3b 09 2f 2a 20 |th[MAXPA|TH];./* |
|00003600| 41 6c 6c 6f 77 61 62 6c | 65 20 70 61 74 68 20 70 |Allowabl|e path p|
|00003610| 72 65 66 69 78 20 2a 2f | 0a 09 63 68 61 72 20 70 |refix */|..char p|
|00003620| 65 72 6d 73 5b 4d 41 58 | 50 41 54 48 5d 3b 09 2f |erms[MAX|PATH];./|
|00003630| 2a 20 50 65 72 6d 69 73 | 73 69 6f 6e 20 66 6c 61 |* Permis|sion fla|
|00003640| 67 20 62 69 74 73 20 2a | 2f 0a 23 64 65 66 69 6e |g bits *|/.#defin|
|00003650| 65 09 46 54 50 5f 52 45 | 41 44 09 31 09 2f 2a 20 |e.FTP_RE|AD.1./* |
|00003660| 52 65 61 64 20 66 69 6c | 65 73 20 2a 2f 0a 23 64 |Read fil|es */.#d|
|00003670| 65 66 69 6e 65 09 46 54 | 50 5f 43 52 45 41 54 45 |efine.FT|P_CREATE|
|00003680| 09 32 09 2f 2a 20 43 72 | 65 61 74 65 20 6e 65 77 |.2./* Cr|eate new|
|00003690| 20 66 69 6c 65 73 20 2a | 2f 0a 23 64 65 66 69 6e | files *|/.#defin|
|000036a0| 65 09 46 54 50 5f 57 52 | 49 54 45 09 34 09 2f 2a |e.FTP_WR|ITE.4./*|
|000036b0| 20 4f 76 65 72 77 72 69 | 74 65 20 6f 72 20 64 65 | Overwri|te or de|
|000036c0| 6c 65 74 65 20 65 78 69 | 73 74 69 6e 67 20 66 69 |lete exi|sting fi|
|000036d0| 6c 65 73 20 2a 2f 0a 0a | 09 63 68 61 72 20 2a 62 |les */..|.char *b|
|000036e0| 75 66 3b 09 09 2f 2a 20 | 49 6e 70 75 74 20 63 6f |uf;../* |Input co|
|000036f0| 6d 6d 61 6e 64 20 62 75 | 66 66 65 72 20 2a 2f 0a |mmand bu|ffer */.|
|00003700| 09 69 6e 74 20 63 6e 74 | 3b 09 09 2f 2a 20 4c 65 |.int cnt|;../* Le|
|00003710| 6e 67 74 68 20 6f 66 20 | 69 6e 70 75 74 20 62 75 |ngth of |input bu|
|00003720| 66 66 65 72 20 2a 2f 0a | 09 69 6e 74 20 68 61 73 |ffer */.|.int has|
|00003730| 68 62 65 6c 6c 3b 09 09 | 2f 2a 20 66 6c 61 67 73 |hbell;..|/* flags|
|00003740| 20 66 6f 72 20 68 61 73 | 68 20 6d 61 72 6b 20 61 | for has|h mark a|
|00003750| 6e 64 20 62 65 6c 6c 20 | 2a 2f 0a 23 64 65 66 69 |nd bell |*/.#defi|
|00003760| 6e 65 20 46 54 50 48 41 | 53 48 20 31 0a 23 64 65 |ne FTPHA|SH 1.#de|
|00003770| 66 69 6e 65 20 46 54 50 | 42 45 4c 4c 20 32 0a 09 |fine FTP|BELL 2..|
|00003780| 69 6e 74 20 64 61 74 61 | 62 79 74 65 73 3b 09 09 |int data|bytes;..|
|00003790| 2f 2a 20 6e 75 6d 62 65 | 72 20 64 61 74 61 62 79 |/* numbe|r databy|
|000037a0| 74 65 73 20 69 6e 20 74 | 72 61 6e 73 66 65 72 20 |tes in t|ransfer |
|000037b0| 2a 2f 0a 09 69 6e 74 20 | 6c 61 73 74 68 61 73 68 |*/..int |lasthash|
|000037c0| 3b 09 09 2f 2a 20 6e 75 | 6d 62 65 72 20 6f 66 20 |;../* nu|mber of |
|000037d0| 62 79 74 65 73 20 6c 61 | 73 74 20 74 69 6d 65 20 |bytes la|st time |
|000037e0| 6f 66 20 68 61 73 68 20 | 70 72 69 6e 74 20 2a 2f |of hash |print */|
|000037f0| 0a 09 69 6e 74 20 73 74 | 61 72 74 74 69 6d 65 3b |..int st|arttime;|
|00003800| 09 09 2f 2a 20 74 69 6d | 65 20 78 66 65 72 20 74 |../* tim|e xfer t|
|00003810| 63 62 20 69 73 20 63 72 | 65 61 74 65 64 20 2a 2f |cb is cr|eated */|
|00003820| 0a 09 63 68 61 72 20 2a | 63 64 3b 09 09 2f 2a 20 |..char *|cd;../* |
|00003830| 43 75 72 72 65 6e 74 20 | 64 69 72 65 63 74 6f 72 |Current |director|
|00003840| 79 20 6e 61 6d 65 20 2a | 2f 0a 0a 09 2f 2a 20 41 |y name *|/.../* A|
|00003850| 6e 64 20 74 68 69 73 20 | 69 73 20 75 73 65 64 20 |nd this |is used |
|00003860| 6f 6e 6c 79 20 62 79 20 | 74 68 65 20 63 6c 69 65 |only by |the clie|
|00003870| 6e 74 20 2a 2f 0a 09 73 | 74 72 75 63 74 20 73 65 |nt */..s|truct se|
|00003880| 73 73 69 6f 6e 20 2a 73 | 65 73 73 69 6f 6e 3b 0a |ssion *s|ession;.|
|00003890| 7d 3b 0a 0a 23 64 65 66 | 69 6e 65 09 4e 55 4c 4c |};..#def|ine.NULL|
|000038a0| 46 54 50 09 28 73 74 72 | 75 63 74 20 66 74 70 20 |FTP.(str|uct ftp |
|000038b0| 2a 29 30 0a 0a 00 00 00 | 00 00 00 00 00 00 00 00 |*)0.....|........|
|000038c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003900| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003920| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a00| 2e 2f 66 69 78 30 33 2f | 66 74 70 63 6c 69 2e 63 |./fix03/|ftpcli.c|
|00003a10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a60| 00 00 00 00 31 30 30 36 | 34 34 20 00 20 20 20 20 |....1006|44 . |
|00003a70| 20 30 20 00 20 20 20 20 | 20 30 20 00 20 20 20 20 | 0 . | 0 . |
|00003a80| 20 20 34 34 33 33 31 20 | 20 35 36 31 35 33 31 33 | 44331 | 5615313|
|00003a90| 37 36 36 20 20 31 31 37 | 31 31 00 20 30 00 00 00 |766 117|11. 0...|
|00003aa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ab0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003af0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b00| 00 75 73 74 61 72 20 20 | 00 72 6f 6f 74 00 00 00 |.ustar |.root...|
|00003b10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b20| 00 00 00 00 00 00 00 00 | 00 72 6f 6f 74 00 00 00 |........|.root...|
|00003b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003c00| 2f 2a 20 61 64 64 65 64 | 20 22 64 65 6c 65 22 20 |/* added| "dele" |
|00003c10| 66 6f 72 20 66 69 6c 65 | 20 64 65 6c 65 74 69 6f |for file| deletio|
|00003c20| 6e 2e 20 20 49 74 20 77 | 61 73 20 61 6c 72 65 61 |n. It w|as alrea|
|00003c30| 64 79 20 61 76 61 69 6c | 61 62 6c 65 20 69 6e 0a |dy avail|able in.|
|00003c40| 66 72 70 73 65 72 76 2e | 63 2c 20 70 65 72 66 6f |frpserv.|c, perfo|
|00003c50| 72 6d 65 64 20 67 65 6e | 65 72 61 6c 20 63 6c 65 |rmed gen|eral cle|
|00003c60| 61 6e 75 70 2c 20 61 64 | 64 65 64 20 6c 6f 6f 70 |anup, ad|ded loop|
|00003c70| 20 69 6e 20 6c 6f 67 69 | 6e 20 70 72 6f 63 65 73 | in logi|n proces|
|00003c80| 73 2c 20 74 68 65 6e 0a | 61 64 64 65 64 20 68 65 |s, then.|added he|
|00003c90| 6c 70 20 74 6f 20 65 73 | 63 61 70 65 20 66 72 6f |lp to es|cape fro|
|00003ca0| 6d 20 61 20 70 72 6f 62 | 6c 65 6d 20 6c 6f 67 69 |m a prob|lem logi|
|00003cb0| 6e 2e 20 39 2f 32 2f 39 | 31 20 2d 20 4b 35 4a 42 |n. 9/2/9|1 - K5JB|
|00003cc0| 20 2a 2f 0a 2f 2a 20 46 | 54 50 20 63 6c 69 65 6e | */./* F|TP clien|
|00003cd0| 74 20 28 69 6e 74 65 72 | 61 63 74 69 76 65 20 75 |t (inter|active u|
|00003ce0| 73 65 72 29 20 63 6f 64 | 65 20 2a 2f 0a 23 64 65 |ser) cod|e */.#de|
|00003cf0| 66 69 6e 65 20 4c 49 4e | 45 4c 45 4e 20 31 32 38 |fine LIN|ELEN 128|
|00003d00| 20 20 20 20 20 2f 2a 20 | 4c 65 6e 67 74 68 20 6f | /* |Length o|
|00003d10| 66 20 63 6f 6d 6d 61 6e | 64 20 62 75 66 66 65 72 |f comman|d buffer|
|00003d20| 20 2a 2f 0a 23 69 6e 63 | 6c 75 64 65 20 3c 73 74 | */.#inc|lude <st|
|00003d30| 64 69 6f 2e 68 3e 0a 23 | 69 6e 63 6c 75 64 65 20 |dio.h>.#|include |
|00003d40| 3c 73 74 72 69 6e 67 2e | 68 3e 0a 23 69 6e 63 6c |<string.|h>.#incl|
|00003d50| 75 64 65 20 22 63 6f 6e | 66 69 67 2e 68 22 0a 23 |ude "con|fig.h".#|
|00003d60| 69 6e 63 6c 75 64 65 20 | 22 67 6c 6f 62 61 6c 2e |include |"global.|
|00003d70| 68 22 0a 23 69 6e 63 6c | 75 64 65 20 22 6d 62 75 |h".#incl|ude "mbu|
|00003d80| 66 2e 68 22 0a 23 69 6e | 63 6c 75 64 65 20 22 6e |f.h".#in|clude "n|
|00003d90| 65 74 75 73 65 72 2e 68 | 22 0a 23 69 6e 63 6c 75 |etuser.h|".#inclu|
|00003da0| 64 65 20 22 69 63 6d 70 | 2e 68 22 0a 23 69 6e 63 |de "icmp|.h".#inc|
|00003db0| 6c 75 64 65 20 22 74 69 | 6d 65 72 2e 68 22 0a 23 |lude "ti|mer.h".#|
|00003dc0| 69 6e 63 6c 75 64 65 20 | 22 74 63 70 2e 68 22 0a |include |"tcp.h".|
|00003dd0| 23 69 6e 63 6c 75 64 65 | 20 22 66 74 70 2e 68 22 |#include| "ftp.h"|
|00003de0| 0a 23 69 6e 63 6c 75 64 | 65 20 22 73 65 73 73 69 |.#includ|e "sessi|
|00003df0| 6f 6e 2e 68 22 0a 23 69 | 6e 63 6c 75 64 65 20 22 |on.h".#i|nclude "|
|00003e00| 63 6d 64 70 61 72 73 65 | 2e 68 22 0a 23 69 6e 63 |cmdparse|.h".#inc|
|00003e10| 6c 75 64 65 20 22 74 65 | 6c 6e 65 74 2e 68 22 0a |lude "te|lnet.h".|
|00003e20| 23 69 6e 63 6c 75 64 65 | 20 22 69 66 61 63 65 2e |#include| "iface.|
|00003e30| 68 22 0a 0a 23 69 6e 63 | 6c 75 64 65 20 22 66 69 |h"..#inc|lude "fi|
|00003e40| 6e 67 65 72 2e 68 22 0a | 0a 0a 0a 65 78 74 65 72 |nger.h".|...exter|
|00003e50| 6e 20 73 74 72 75 63 74 | 20 73 65 73 73 69 6f 6e |n struct| session|
|00003e60| 20 2a 63 75 72 72 65 6e | 74 3b 0a 65 78 74 65 72 | *curren|t;.exter|
|00003e70| 6e 20 63 68 61 72 20 6e | 6f 73 70 61 63 65 5b 5d |n char n|ospace[]|
|00003e80| 3b 0a 65 78 74 65 72 6e | 20 63 68 61 72 20 62 61 |;.extern| char ba|
|00003e90| 64 68 6f 73 74 5b 5d 3b | 0a 63 68 61 72 20 6e 6f |dhost[];|.char no|
|00003ea0| 74 73 65 73 73 5b 5d 20 | 3d 20 22 4e 6f 74 20 61 |tsess[] |= "Not a|
|00003eb0| 6e 20 46 54 50 20 73 65 | 73 73 69 6f 6e 21 5c 6e |n FTP se|ssion!\n|
|00003ec0| 22 3b 0a 63 68 61 72 20 | 63 61 6e 74 77 72 69 74 |";.char |cantwrit|
|00003ed0| 65 5b 5d 20 3d 20 22 43 | 61 6e 27 74 20 77 72 69 |e[] = "C|an't wri|
|00003ee0| 74 65 20 25 73 5c 6e 22 | 3b 0a 63 68 61 72 20 63 |te %s\n"|;.char c|
|00003ef0| 61 6e 74 72 65 61 64 5b | 5d 20 3d 20 22 43 61 6e |antread[|] = "Can|
|00003f00| 27 74 20 72 65 61 64 20 | 25 73 5c 6e 22 3b 0a 63 |'t read |%s\n";.c|
|00003f10| 68 61 72 20 68 65 6c 70 | 65 73 63 5b 5d 20 3d 20 |har help|esc[] = |
|00003f20| 22 28 45 73 63 61 70 65 | 20 74 68 69 73 20 77 69 |"(Escape| this wi|
|00003f30| 74 68 20 5c 22 63 6c 6f | 73 65 5c 22 20 66 72 6f |th \"clo|se\" fro|
|00003f40| 6d 20 63 6f 6d 6d 61 6e | 64 20 6d 6f 64 65 2e 29 |m comman|d mode.)|
|00003f50| 5c 6e 22 3b 0a 63 68 61 | 72 20 66 74 70 70 72 6f |\n";.cha|r ftppro|
|00003f60| 6d 70 74 5b 5d 20 3d 20 | 22 66 74 70 3e 20 22 3b |mpt[] = |"ftp> ";|
|00003f70| 0a 69 6e 74 20 64 6f 6e | 6f 74 68 69 6e 67 28 29 |.int don|othing()|
|00003f80| 2c 64 6f 66 74 70 63 64 | 28 29 2c 64 6f 6c 69 73 |,doftpcd|(),dolis|
|00003f90| 74 28 29 2c 64 6f 67 65 | 74 28 29 2c 64 6f 6c 73 |t(),doge|t(),dols|
|00003fa0| 28 29 2c 64 6f 70 75 74 | 28 29 2c 64 6f 74 79 70 |(),doput|(),dotyp|
|00003fb0| 65 28 29 2c 64 6f 61 62 | 6f 72 74 28 29 2c 0a 20 |e(),doab|ort(),. |
|00003fc0| 20 20 20 20 20 20 20 64 | 6f 6d 6b 64 69 72 28 29 | d|omkdir()|
|00003fd0| 2c 64 6f 72 6d 64 69 72 | 28 29 2c 64 6f 64 65 6c |,dormdir|(),dodel|
|00003fe0| 65 28 29 2c 20 64 6f 68 | 61 73 68 28 29 2c 20 64 |e(), doh|ash(), d|
|00003ff0| 6f 62 65 6c 6c 28 29 2c | 20 64 6f 66 74 70 68 65 |obell(),| doftphe|
|00004000| 6c 70 28 29 3b 0a 0a 73 | 74 72 75 63 74 20 63 6d |lp();..s|truct cm|
|00004010| 64 73 20 66 74 70 61 62 | 6f 72 74 5b 5d 20 3d 20 |ds ftpab|ort[] = |
|00004020| 7b 0a 7b 09 22 22 2c 20 | 20 20 20 20 20 20 64 6f |{.{."", | do|
|00004030| 6e 6f 74 68 69 6e 67 2c | 20 30 2c 20 4e 55 4c 4c |nothing,| 0, NULL|
|00004040| 43 48 41 52 2c 20 20 20 | 4e 55 4c 4c 43 48 41 52 |CHAR, |NULLCHAR|
|00004050| 20 7d 2c 0a 7b 09 22 61 | 62 6f 72 74 22 2c 20 20 | },.{."a|bort", |
|00004060| 64 6f 61 62 6f 72 74 2c | 20 20 20 30 2c 20 4e 55 |doabort,| 0, NU|
|00004070| 4c 4c 43 48 41 52 2c 20 | 20 20 4e 55 4c 4c 43 48 |LLCHAR, | NULLCH|
|00004080| 41 52 20 7d 2c 0a 7b 09 | 4e 55 4c 4c 43 48 41 52 |AR },.{.|NULLCHAR|
|00004090| 2c 20 4e 55 4c 4c 46 50 | 2c 20 20 20 20 30 2c 20 |, NULLFP|, 0, |
|000040a0| 22 4f 6e 6c 79 20 76 61 | 6c 69 64 20 63 6f 6d 6d |"Only va|lid comm|
|000040b0| 61 6e 64 20 69 73 20 5c | 22 61 62 6f 72 74 5c 22 |and is \|"abort\"|
|000040c0| 22 2c 20 4e 55 4c 4c 43 | 48 41 52 20 7d 0a 7d 3b |", NULLC|HAR }.};|
|000040d0| 0a 0a 73 74 72 75 63 74 | 20 63 6d 64 73 20 66 74 |..struct| cmds ft|
|000040e0| 70 63 6d 64 73 5b 5d 20 | 3d 20 7b 0a 7b 09 22 22 |pcmds[] |= {.{.""|
|000040f0| 2c 20 20 20 20 20 20 20 | 20 20 64 6f 6e 6f 74 68 |, | donoth|
|00004100| 69 6e 67 2c 20 20 30 2c | 20 4e 55 4c 4c 43 48 41 |ing, 0,| NULLCHA|
|00004110| 52 2c 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |R, | |
|00004120| 20 4e 55 4c 4c 43 48 41 | 52 20 7d 2c 0a 7b 09 22 | NULLCHA|R },.{."|
|00004130| 3f 22 2c 20 20 20 20 20 | 20 20 20 64 6f 66 74 70 |?", | doftp|
|00004140| 68 65 6c 70 2c 20 20 30 | 2c 20 4e 55 4c 4c 43 48 |help, 0|, NULLCH|
|00004150| 41 52 2c 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |AR, | |
|00004160| 20 20 4e 55 4c 4c 43 48 | 41 52 20 7d 2c 0a 7b 09 | NULLCH|AR },.{.|
|00004170| 22 62 65 6c 6c 22 2c 20 | 20 20 20 20 64 6f 62 65 |"bell", | dobe|
|00004180| 6c 6c 2c 20 20 20 20 20 | 30 2c 20 4e 55 4c 4c 43 |ll, |0, NULLC|
|00004190| 48 41 52 2c 20 20 20 20 | 20 20 20 20 20 20 20 20 |HAR, | |
|000041a0| 20 20 20 4e 55 4c 4c 43 | 48 41 52 20 7d 2c 0a 7b | NULLC|HAR },.{|
|000041b0| 09 22 63 64 22 2c 20 20 | 20 20 20 20 20 64 6f 66 |."cd", | dof|
|000041c0| 74 70 63 64 2c 20 20 20 | 20 32 2c 20 22 63 64 20 |tpcd, | 2, "cd |
|000041d0| 3c 64 69 72 65 63 74 6f | 72 79 3e 22 2c 20 20 20 |<directo|ry>", |
|000041e0| 20 20 20 20 4e 55 4c 4c | 43 48 41 52 20 7d 2c 0a | NULL|CHAR },.|
|000041f0| 7b 09 22 64 69 72 22 2c | 20 20 20 20 20 20 64 6f |{."dir",| do|
|00004200| 6c 69 73 74 2c 20 20 20 | 20 20 30 2c 20 4e 55 4c |list, | 0, NUL|
|00004210| 4c 43 48 41 52 2c 20 20 | 20 20 20 20 20 20 20 20 |LCHAR, | |
|00004220| 20 20 20 20 20 4e 55 4c | 4c 43 48 41 52 20 7d 2c | NUL|LCHAR },|
|00004230| 0a 7b 09 22 67 65 74 22 | 2c 20 20 20 20 20 20 64 |.{."get"|, d|
|00004240| 6f 67 65 74 2c 20 20 20 | 20 20 20 32 2c 20 22 67 |oget, | 2, "g|
|00004250| 65 74 20 72 65 6d 6f 74 | 65 66 69 6c 65 20 3c 6c |et remot|efile <l|
|00004260| 6f 63 61 6c 66 69 6c 65 | 3e 22 2c 20 20 20 4e 55 |ocalfile|>", NU|
|00004270| 4c 4c 43 48 41 52 20 7d | 2c 0a 7b 09 22 68 61 73 |LLCHAR }|,.{."has|
|00004280| 68 22 2c 20 20 20 20 20 | 64 6f 68 61 73 68 2c 20 |h", |dohash, |
|00004290| 20 20 20 20 30 2c 20 4e | 55 4c 4c 43 48 41 52 2c | 0, N|ULLCHAR,|
|000042a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 4e | | N|
|000042b0| 55 4c 4c 43 48 41 52 20 | 7d 2c 0a 7b 09 22 68 65 |ULLCHAR |},.{."he|
|000042c0| 6c 70 22 2c 20 20 20 20 | 20 64 6f 66 74 70 68 65 |lp", | doftphe|
|000042d0| 6c 70 2c 20 20 30 2c 20 | 4e 55 4c 4c 43 48 41 52 |lp, 0, |NULLCHAR|
|000042e0| 2c 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |, | |
|000042f0| 4e 55 4c 4c 43 48 41 52 | 20 7d 2c 0a 7b 09 22 6c |NULLCHAR| },.{."l|
|00004300| 73 22 2c 20 20 20 20 20 | 20 20 64 6f 6c 73 2c 20 |s", | dols, |
|00004310| 20 20 20 20 20 20 30 2c | 20 4e 55 4c 4c 43 48 41 | 0,| NULLCHA|
|00004320| 52 2c 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |R, | |
|00004330| 20 4e 55 4c 4c 43 48 41 | 52 20 7d 2c 0a 7b 09 22 | NULLCHA|R },.{."|
|00004340| 6c 69 73 74 22 2c 20 20 | 20 20 20 64 6f 6c 69 73 |list", | dolis|
|00004350| 74 2c 20 20 20 20 20 30 | 2c 20 4e 55 4c 4c 43 48 |t, 0|, NULLCH|
|00004360| 41 52 2c 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |AR, | |
|00004370| 20 20 4e 55 4c 4c 43 48 | 41 52 20 7d 2c 0a 7b 09 | NULLCH|AR },.{.|
|00004380| 22 6d 6b 64 69 72 22 2c | 20 20 20 20 64 6f 6d 6b |"mkdir",| domk|
|00004390| 64 69 72 2c 20 20 20 20 | 32 2c 20 22 6d 6b 64 69 |dir, |2, "mkdi|
|000043a0| 72 20 3c 64 69 72 65 63 | 74 6f 72 79 3e 22 2c 20 |r <direc|tory>", |
|000043b0| 20 20 20 4e 55 4c 4c 43 | 48 41 52 20 7d 2c 0a 7b | NULLC|HAR },.{|
|000043c0| 09 22 6e 6c 73 74 22 2c | 20 20 20 20 20 64 6f 6c |."nlst",| dol|
|000043d0| 73 2c 20 20 20 20 20 20 | 20 30 2c 20 4e 55 4c 4c |s, | 0, NULL|
|000043e0| 43 48 41 52 2c 20 20 20 | 20 20 20 20 20 20 20 20 |CHAR, | |
|000043f0| 20 20 20 20 4e 55 4c 4c | 43 48 41 52 20 7d 2c 0a | NULL|CHAR },.|
|00004400| 7b 09 22 72 6d 64 69 72 | 22 2c 20 20 20 20 64 6f |{."rmdir|", do|
|00004410| 72 6d 64 69 72 2c 20 20 | 20 20 32 2c 20 22 72 6d |rmdir, | 2, "rm|
|00004420| 64 69 72 20 3c 64 69 72 | 65 63 74 6f 72 79 3e 22 |dir <dir|ectory>"|
|00004430| 2c 20 20 20 20 4e 55 4c | 4c 43 48 41 52 20 7d 2c |, NUL|LCHAR },|
|00004440| 0a 7b 09 22 70 75 74 22 | 2c 20 20 20 20 20 20 64 |.{."put"|, d|
|00004450| 6f 70 75 74 2c 20 20 20 | 20 20 20 32 2c 20 22 70 |oput, | 2, "p|
|00004460| 75 74 20 6c 6f 63 61 6c | 66 69 6c 65 20 3c 72 65 |ut local|file <re|
|00004470| 6d 6f 74 65 66 69 6c 65 | 3e 22 2c 20 20 20 4e 55 |motefile|>", NU|
|00004480| 4c 4c 43 48 41 52 20 7d | 2c 0a 7b 09 22 74 79 70 |LLCHAR }|,.{."typ|
|00004490| 65 22 2c 20 20 20 20 20 | 64 6f 74 79 70 65 2c 20 |e", |dotype, |
|000044a0| 20 20 20 20 30 2c 20 4e | 55 4c 4c 43 48 41 52 2c | 0, N|ULLCHAR,|
|000044b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 4e | | N|
|000044c0| 55 4c 4c 43 48 41 52 20 | 7d 2c 0a 7b 09 22 64 65 |ULLCHAR |},.{."de|
|000044d0| 6c 65 22 2c 20 20 20 20 | 20 64 6f 64 65 6c 65 2c |le", | dodele,|
|000044e0| 20 20 20 20 20 32 2c 20 | 22 64 65 6c 65 74 65 20 | 2, |"delete |
|000044f0| 72 65 6d 6f 74 65 66 69 | 6c 65 22 2c 20 20 20 20 |remotefi|le", |
|00004500| 4e 55 4c 4c 43 48 41 52 | 20 7d 2c 0a 7b 09 4e 55 |NULLCHAR| },.{.NU|
|00004510| 4c 4c 43 48 41 52 2c 20 | 20 20 4e 55 4c 4c 46 50 |LLCHAR, | NULLFP|
|00004520| 2c 09 30 2c 09 09 4e 55 | 4c 4c 43 48 41 52 2c 09 |,.0,..NU|LLCHAR,.|
|00004530| 4e 55 4c 4c 43 48 41 52 | 20 7d 0a 7d 3b 0a 0a 69 |NULLCHAR| }.};..i|
|00004540| 6e 74 0a 64 6f 66 74 70 | 68 65 6c 70 28 29 0a 7b |nt.doftp|help().{|
|00004550| 0a 09 70 72 69 6e 74 66 | 28 20 22 66 74 70 20 63 |..printf|( "ftp c|
|00004560| 6f 6d 6d 61 6e 64 73 3a | 20 5c 6e 22 20 29 3b 0a |ommands:| \n" );.|
|00004570| 09 70 72 69 6e 74 66 28 | 20 22 5c 74 3f 5c 74 5c |.printf(| "\t?\t\|
|00004580| 74 62 65 6c 6c 5c 74 5c | 74 63 64 5c 74 5c 74 64 |tbell\t\|tcd\t\td|
|00004590| 65 6c 65 5c 6e 22 20 29 | 3b 0a 09 70 72 69 6e 74 |ele\n" )|;..print|
|000045a0| 66 28 20 22 5c 74 64 69 | 72 5c 74 5c 74 67 65 74 |f( "\tdi|r\t\tget|
|000045b0| 5c 74 5c 74 68 61 73 68 | 5c 74 5c 74 68 65 6c 70 |\t\thash|\t\thelp|
|000045c0| 5c 6e 22 29 3b 0a 09 70 | 72 69 6e 74 66 28 20 22 |\n");..p|rintf( "|
|000045d0| 5c 74 6c 73 5c 74 5c 74 | 6c 69 73 74 5c 74 5c 74 |\tls\t\t|list\t\t|
|000045e0| 6d 6b 64 69 72 5c 74 5c | 74 6e 6c 73 74 5c 6e 22 |mkdir\t\|tnlst\n"|
|000045f0| 29 3b 0a 09 70 72 69 6e | 74 66 28 20 22 5c 74 72 |);..prin|tf( "\tr|
|00004600| 6d 64 69 72 5c 74 5c 74 | 70 75 74 5c 74 5c 74 74 |mdir\t\t|put\t\tt|
|00004610| 79 70 65 5c 6e 5c 6e 22 | 29 3b 0a 09 70 72 69 6e |ype\n\n"|);..prin|
|00004620| 74 66 28 20 22 5c 22 61 | 62 6f 72 74 5c 22 20 77 |tf( "\"a|bort\" w|
|00004630| 69 6c 6c 20 61 62 6f 72 | 74 20 61 6e 20 69 6e 2d |ill abor|t an in-|
|00004640| 70 72 6f 67 72 65 73 73 | 20 66 69 6c 65 20 74 72 |progress| file tr|
|00004650| 61 6e 73 66 65 72 2e 5c | 6e 22 20 29 3b 0a 09 70 |ansfer.\|n" );..p|
|00004660| 72 69 6e 74 66 28 20 22 | 72 65 6d 6f 74 65 20 73 |rintf( "|remote s|
|00004670| 65 72 76 65 72 73 20 75 | 73 75 61 6c 6c 79 20 61 |ervers u|sually a|
|00004680| 63 63 65 70 74 20 5c 22 | 71 75 69 74 5c 22 20 74 |ccept \"|quit\" t|
|00004690| 6f 20 65 6e 64 20 63 6f | 6e 6e 65 63 74 69 6f 6e |o end co|nnection|
|000046a0| 2e 5c 6e 22 29 3b 20 0a | 09 70 72 69 6e 74 66 28 |.\n"); .|.printf(|
|000046b0| 20 22 79 6f 75 72 20 65 | 73 63 61 70 65 20 63 68 | "your e|scape ch|
|000046c0| 61 72 20 77 69 6c 6c 20 | 61 6c 6c 6f 77 20 72 65 |ar will |allow re|
|000046d0| 74 75 72 6e 20 74 6f 20 | 6e 65 74 3e 20 70 72 6f |turn to |net> pro|
|000046e0| 6d 70 74 2e 5c 6e 5c 6e | 22 20 29 3b 0a 09 72 65 |mpt.\n\n|" );..re|
|000046f0| 74 75 72 6e 28 30 29 3b | 0a 7d 0a 0a 69 6e 74 0a |turn(0);|.}..int.|
|00004700| 64 6f 68 61 73 68 28 29 | 0a 7b 0a 20 09 69 66 28 |dohash()|.{. .if(|
|00004710| 63 75 72 72 65 6e 74 2d | 3e 63 62 2e 66 74 70 2d |current-|>cb.ftp-|
|00004720| 3e 68 61 73 68 62 65 6c | 6c 20 26 20 46 54 50 48 |>hashbel|l & FTPH|
|00004730| 41 53 48 29 20 7b 0a 20 | 09 09 63 75 72 72 65 6e |ASH) {. |..curren|
|00004740| 74 2d 3e 63 62 2e 66 74 | 70 2d 3e 68 61 73 68 62 |t->cb.ft|p->hashb|
|00004750| 65 6c 6c 20 26 3d 20 7e | 46 54 50 48 41 53 48 3b |ell &= ~|FTPHASH;|
|00004760| 20 0a 09 09 70 72 69 6e | 74 66 28 20 22 48 41 53 | ...prin|tf( "HAS|
|00004770| 48 20 4d 41 52 4b 20 28 | 23 29 20 6f 6e 20 31 6b |H MARK (|#) on 1k|
|00004780| 20 62 6f 75 6e 64 61 72 | 69 65 73 20 69 73 20 4f | boundar|ies is O|
|00004790| 46 46 5c 6e 22 29 3b 20 | 0a 09 7d 20 65 6c 73 65 |FF\n"); |..} else|
|000047a0| 20 7b 09 0a 20 09 09 63 | 75 72 72 65 6e 74 2d 3e | {.. ..c|urrent->|
|000047b0| 63 62 2e 66 74 70 2d 3e | 68 61 73 68 62 65 6c 6c |cb.ftp->|hashbell|
|000047c0| 20 7c 3d 20 20 46 54 50 | 48 41 53 48 3b 0a 09 09 | |= FTP|HASH;...|
|000047d0| 70 72 69 6e 74 66 28 20 | 22 48 41 53 48 20 4d 41 |printf( |"HASH MA|
|000047e0| 52 4b 20 28 23 29 20 6f | 6e 20 31 6b 20 62 6f 75 |RK (#) o|n 1k bou|
|000047f0| 6e 64 61 72 69 65 73 20 | 69 73 20 4f 4e 5c 6e 22 |ndaries |is ON\n"|
|00004800| 29 3b 20 0a 09 7d 0a 09 | 72 65 74 75 72 6e 28 30 |); ..}..|return(0|
|00004810| 29 3b 0a 7d 0a 0a 69 6e | 74 0a 64 6f 62 65 6c 6c |);.}..in|t.dobell|
|00004820| 28 29 0a 7b 0a 20 09 69 | 66 28 63 75 72 72 65 6e |().{. .i|f(curren|
|00004830| 74 2d 3e 63 62 2e 66 74 | 70 2d 3e 68 61 73 68 62 |t->cb.ft|p->hashb|
|00004840| 65 6c 6c 20 26 20 46 54 | 50 42 45 4c 4c 29 20 7b |ell & FT|PBELL) {|
|00004850| 0a 20 09 09 63 75 72 72 | 65 6e 74 2d 3e 63 62 2e |. ..curr|ent->cb.|
|00004860| 66 74 70 2d 3e 68 61 73 | 68 62 65 6c 6c 20 26 3d |ftp->has|hbell &=|
|00004870| 20 7e 46 54 50 42 45 4c | 4c 3b 20 0a 09 09 70 72 | ~FTPBEL|L; ...pr|
|00004880| 69 6e 74 66 28 20 22 42 | 45 45 50 20 61 74 20 65 |intf( "B|EEP at e|
|00004890| 6e 64 20 6f 66 20 74 72 | 61 6e 73 66 65 72 20 69 |nd of tr|ansfer i|
|000048a0| 73 20 4f 46 46 5c 6e 22 | 29 3b 20 0a 09 7d 20 65 |s OFF\n"|); ..} e|
|000048b0| 6c 73 65 20 7b 09 0a 20 | 09 09 63 75 72 72 65 6e |lse {.. |..curren|
|000048c0| 74 2d 3e 63 62 2e 66 74 | 70 2d 3e 68 61 73 68 62 |t->cb.ft|p->hashb|
|000048d0| 65 6c 6c 20 7c 3d 20 20 | 46 54 50 42 45 4c 4c 3b |ell |= |FTPBELL;|
|000048e0| 0a 09 09 70 72 69 6e 74 | 66 28 20 22 42 45 45 50 |...print|f( "BEEP|
|000048f0| 20 61 74 20 65 6e 64 20 | 6f 66 20 74 72 61 6e 66 | at end |of tranf|
|00004900| 65 72 20 69 73 20 4f 4e | 5c 6e 22 29 3b 20 0a 09 |er is ON|\n"); ..|
|00004910| 7d 0a 09 72 65 74 75 72 | 6e 28 30 29 3b 0a 7d 0a |}..retur|n(0);.}.|
|00004920| 0a 0a 2f 2a 20 53 65 6e | 64 20 61 20 6d 65 73 73 |../* Sen|d a mess|
|00004930| 61 67 65 20 6f 6e 20 74 | 68 65 20 63 6f 6e 74 72 |age on t|he contr|
|00004940| 6f 6c 20 63 68 61 6e 6e | 65 6c 20 2a 2f 0a 2f 2a |ol chann|el */./*|
|00004950| 56 41 52 41 52 47 53 2a | 2f 0a 73 74 61 74 69 63 |VARARGS*|/.static|
|00004960| 20 69 6e 74 0a 73 6e 64 | 66 74 70 6d 73 67 28 66 | int.snd|ftpmsg(f|
|00004970| 74 70 2c 66 6d 74 2c 61 | 72 67 29 0a 73 74 72 75 |tp,fmt,a|rg).stru|
|00004980| 63 74 20 66 74 70 20 2a | 66 74 70 3b 0a 63 68 61 |ct ftp *|ftp;.cha|
|00004990| 72 20 2a 66 6d 74 3b 0a | 63 68 61 72 20 2a 61 72 |r *fmt;.|char *ar|
|000049a0| 67 3b 0a 7b 0a 09 73 74 | 72 75 63 74 20 6d 62 75 |g;.{..st|ruct mbu|
|000049b0| 66 20 2a 62 70 3b 0a 09 | 69 6e 74 31 36 20 6c 65 |f *bp;..|int16 le|
|000049c0| 6e 3b 0a 0a 23 69 66 64 | 65 66 20 43 4f 48 50 52 |n;..#ifd|ef COHPR|
|000049d0| 4f 46 0a 70 72 6f 66 69 | 6c 65 28 5f 5f 4c 49 4e |OF.profi|le(__LIN|
|000049e0| 45 5f 5f 2c 5f 5f 46 49 | 4c 45 5f 5f 29 3b 0a 23 |E__,__FI|LE__);.#|
|000049f0| 65 6e 64 69 66 0a 09 6c | 65 6e 20 3d 20 73 74 72 |endif..l|en = str|
|00004a00| 6c 65 6e 28 66 6d 74 29 | 20 2b 20 73 74 72 6c 65 |len(fmt)| + strle|
|00004a10| 6e 28 61 72 67 29 20 2b | 20 31 30 3b 20 20 20 2f |n(arg) +| 10; /|
|00004a20| 2a 20 66 75 64 67 65 20 | 66 61 63 74 6f 72 20 2a |* fudge |factor *|
|00004a30| 2f 0a 09 69 66 28 28 62 | 70 20 3d 20 61 6c 6c 6f |/..if((b|p = allo|
|00004a40| 63 5f 6d 62 75 66 28 6c | 65 6e 29 29 20 3d 3d 20 |c_mbuf(l|en)) == |
|00004a50| 4e 55 4c 4c 42 55 46 29 | 7b 0a 09 09 70 72 69 6e |NULLBUF)|{...prin|
|00004a60| 74 66 28 6e 6f 73 70 61 | 63 65 29 3b 0a 09 09 72 |tf(nospa|ce);...r|
|00004a70| 65 74 75 72 6e 20 31 3b | 0a 09 7d 0a 09 73 70 72 |eturn 1;|..}..spr|
|00004a80| 69 6e 74 66 28 62 70 2d | 3e 64 61 74 61 2c 66 6d |intf(bp-|>data,fm|
|00004a90| 74 2c 61 72 67 29 3b 0a | 09 62 70 2d 3e 63 6e 74 |t,arg);.|.bp->cnt|
|00004aa0| 20 3d 20 73 74 72 6c 65 | 6e 28 62 70 2d 3e 64 61 | = strle|n(bp->da|
|00004ab0| 74 61 29 3b 0a 09 73 65 | 6e 64 5f 74 63 70 28 66 |ta);..se|nd_tcp(f|
|00004ac0| 74 70 2d 3e 63 6f 6e 74 | 72 6f 6c 2c 62 70 29 3b |tp->cont|rol,bp);|
|00004ad0| 0a 09 72 65 74 75 72 6e | 20 30 3b 0a 7d 0a 0a 0a |..return| 0;.}...|
|00004ae0| 2f 2a 20 50 61 72 73 65 | 20 75 73 65 72 20 46 54 |/* Parse| user FT|
|00004af0| 50 20 63 6f 6d 6d 61 6e | 64 73 20 2a 2f 0a 73 74 |P comman|ds */.st|
|00004b00| 61 74 69 63 20 69 6e 74 | 0a 66 74 70 70 61 72 73 |atic int|.ftppars|
|00004b10| 65 28 6c 69 6e 65 2c 6c | 65 6e 29 0a 63 68 61 72 |e(line,l|en).char|
|00004b20| 20 2a 6c 69 6e 65 3b 0a | 69 6e 74 31 36 20 6c 65 | *line;.|int16 le|
|00004b30| 6e 3b 0a 7b 0a 09 73 74 | 72 75 63 74 20 6d 62 75 |n;.{..st|ruct mbu|
|00004b40| 66 20 2a 62 70 3b 0a 09 | 69 6e 74 20 63 6d 64 70 |f *bp;..|int cmdp|
|00004b50| 61 72 73 65 28 29 3b 0a | 0a 23 69 66 64 65 66 20 |arse();.|.#ifdef |
|00004b60| 43 4f 48 50 52 4f 46 0a | 70 72 6f 66 69 6c 65 28 |COHPROF.|profile(|
|00004b70| 5f 5f 4c 49 4e 45 5f 5f | 2c 5f 5f 46 49 4c 45 5f |__LINE__|,__FILE_|
|00004b80| 5f 29 3b 0a 23 65 6e 64 | 69 66 0a 09 6c 69 6e 65 |_);.#end|if..line|
|00004b90| 5b 6c 65 6e 5d 20 3d 20 | 27 5c 30 27 3b 09 2f 2a |[len] = |'\0';./*|
|00004ba0| 20 6f 6f 70 73 2c 20 77 | 61 73 20 6c 65 66 74 20 | oops, w|as left |
|00004bb0| 6f 75 74 20 69 6e 20 63 | 6f 75 70 6c 65 20 6f 66 |out in c|ouple of|
|00004bc0| 20 70 6c 61 63 65 73 2e | 20 53 65 65 6d 73 20 61 | places.| Seems a|
|00004bd0| 6c 6c 0a 09 09 09 09 09 | 09 09 09 72 6f 75 74 69 |ll......|...routi|
|00004be0| 6e 65 73 20 6e 65 65 64 | 20 74 68 69 73 2c 20 6f |nes need| this, o|
|00004bf0| 72 20 77 6f 6e 27 74 20 | 68 75 72 74 20 2d 20 4b |r won't |hurt - K|
|00004c00| 35 4a 42 20 2a 2f 0a 0a | 09 73 77 69 74 63 68 28 |5JB */..|.switch(|
|00004c10| 63 75 72 72 65 6e 74 2d | 3e 63 62 2e 66 74 70 2d |current-|>cb.ftp-|
|00004c20| 3e 73 74 61 74 65 29 7b | 0a 09 09 63 61 73 65 20 |>state){|...case |
|00004c30| 52 45 43 45 49 56 49 4e | 47 5f 53 54 41 54 45 3a |RECEIVIN|G_STATE:|
|00004c40| 0a 09 09 63 61 73 65 20 | 53 45 4e 44 49 4e 47 5f |...case |SENDING_|
|00004c50| 53 54 41 54 45 3a 0a 09 | 09 09 2f 2a 20 54 68 65 |STATE:..|../* The|
|00004c60| 20 6f 6e 6c 79 20 63 6f | 6d 6d 61 6e 64 20 61 6c | only co|mmand al|
|00004c70| 6c 6f 77 65 64 20 69 6e | 20 64 61 74 61 20 74 72 |lowed in| data tr|
|00004c80| 61 6e 73 66 65 72 20 73 | 74 61 74 65 20 69 73 20 |ansfer s|tate is |
|00004c90| 41 42 4f 52 54 20 2a 2f | 0a 09 09 09 69 66 28 63 |ABORT */|....if(c|
|00004ca0| 6d 64 70 61 72 73 65 28 | 66 74 70 61 62 6f 72 74 |mdparse(|ftpabort|
|00004cb0| 2c 6c 69 6e 65 29 20 3d | 3d 20 2d 31 29 7b 0a 09 |,line) =|= -1){..|
|00004cc0| 09 09 09 70 72 69 6e 74 | 66 28 22 54 72 61 6e 73 |...print|f("Trans|
|00004cd0| 66 65 72 20 69 6e 20 70 | 72 6f 67 72 65 73 73 3b |fer in p|rogress;|
|00004ce0| 20 6f 6e 6c 79 20 41 42 | 4f 52 54 20 69 73 20 61 | only AB|ORT is a|
|00004cf0| 63 63 65 70 74 61 62 6c | 65 5c 6e 22 29 3b 0a 09 |cceptabl|e\n");..|
|00004d00| 09 09 7d 0a 09 09 09 66 | 66 6c 75 73 68 28 73 74 |..}....f|flush(st|
|00004d10| 64 6f 75 74 29 3b 0a 09 | 09 09 62 72 65 61 6b 3b |dout);..|..break;|
|00004d20| 0a 09 09 63 61 73 65 20 | 43 4f 4d 4d 41 4e 44 5f |...case |COMMAND_|
|00004d30| 53 54 41 54 45 3a 0a 09 | 09 09 2f 2a 20 53 61 76 |STATE:..|../* Sav|
|00004d40| 65 20 69 74 20 6e 6f 77 | 20 62 65 63 61 75 73 65 |e it now| because|
|00004d50| 20 63 6d 64 70 61 72 73 | 65 20 6d 6f 64 69 66 69 | cmdpars|e modifi|
|00004d60| 65 73 20 74 68 65 20 6f | 72 69 67 69 6e 61 6c 20 |es the o|riginal |
|00004d70| 2a 2f 0a 09 09 09 62 70 | 20 3d 20 71 64 61 74 61 |*/....bp| = qdata|
|00004d80| 28 6c 69 6e 65 2c 6c 65 | 6e 29 3b 0a 0a 09 09 09 |(line,le|n);.....|
|00004d90| 69 66 28 63 6d 64 70 61 | 72 73 65 28 66 74 70 63 |if(cmdpa|rse(ftpc|
|00004da0| 6d 64 73 2c 6c 69 6e 65 | 29 20 3d 3d 20 2d 31 29 |mds,line|) == -1)|
|00004db0| 7b 0a 09 09 09 09 2f 2a | 20 53 65 6e 64 20 69 74 |{...../*| Send it|
|00004dc0| 20 64 69 72 65 63 74 20 | 2a 2f 0a 09 09 09 09 69 | direct |*/.....i|
|00004dd0| 66 28 62 70 20 21 3d 20 | 4e 55 4c 4c 42 55 46 29 |f(bp != |NULLBUF)|
|00004de0| 0a 09 09 09 09 09 73 65 | 6e 64 5f 74 63 70 28 63 |......se|nd_tcp(c|
|00004df0| 75 72 72 65 6e 74 2d 3e | 63 62 2e 66 74 70 2d 3e |urrent->|cb.ftp->|
|00004e00| 63 6f 6e 74 72 6f 6c 2c | 62 70 29 3b 0a 09 09 09 |control,|bp);....|
|00004e10| 09 65 6c 73 65 0a 09 09 | 09 09 09 70 72 69 6e 74 |.else...|...print|
|00004e20| 66 28 6e 6f 73 70 61 63 | 65 29 3b 0a 09 09 09 7d |f(nospac|e);....}|
|00004e30| 20 65 6c 73 65 20 7b 0a | 09 09 09 09 66 72 65 65 | else {.|....free|
|00004e40| 5f 70 28 62 70 29 3b 0a | 09 09 09 7d 0a 09 09 09 |_p(bp);.|...}....|
|00004e50| 70 72 69 6e 74 66 28 20 | 66 74 70 70 72 6f 6d 70 |printf( |ftppromp|
|00004e60| 74 20 29 3b 0a 09 09 09 | 66 66 6c 75 73 68 28 73 |t );....|fflush(s|
|00004e70| 74 64 6f 75 74 29 3b 0a | 09 09 09 62 72 65 61 6b |tdout);.|...break|
|00004e80| 3b 0a 09 09 63 61 73 65 | 20 53 54 41 52 54 55 50 |;...case| STARTUP|
|00004e90| 5f 53 54 41 54 45 3a 20 | 20 20 20 20 20 20 20 20 |_STATE: | |
|00004ea0| 20 20 20 20 2f 2a 20 53 | 74 61 72 74 69 6e 67 20 | /* S|tarting |
|00004eb0| 75 70 20 61 75 74 6f 6c | 6f 67 69 6e 20 2a 2f 0a |up autol|ogin */.|
|00004ec0| 09 09 09 70 72 69 6e 74 | 66 28 22 25 73 4e 6f 74 |...print|f("%sNot|
|00004ed0| 20 63 6f 6e 6e 65 63 74 | 65 64 20 79 65 74 2c 20 | connect|ed yet, |
|00004ee0| 69 67 6e 6f 72 69 6e 67 | 3a 20 25 73 22 2c 68 65 |ignoring|: %s",he|
|00004ef0| 6c 70 65 73 63 2c 6c 69 | 6e 65 29 3b 0a 09 09 09 |lpesc,li|ne);....|
|00004f00| 66 66 6c 75 73 68 28 73 | 74 64 6f 75 74 29 3b 0a |fflush(s|tdout);.|
|00004f10| 09 09 09 62 72 65 61 6b | 3b 0a 09 09 63 61 73 65 |...break|;...case|
|00004f20| 20 55 53 45 52 5f 53 54 | 41 54 45 3a 20 20 20 20 | USER_ST|ATE: |
|00004f30| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2a 20 47 | | /* G|
|00004f40| 6f 74 20 74 68 65 20 75 | 73 65 72 20 6e 61 6d 65 |ot the u|ser name|
|00004f50| 20 2a 2f 0a 09 09 09 70 | 72 69 6e 74 66 28 66 74 | */....p|rintf(ft|
|00004f60| 70 70 72 6f 6d 70 74 29 | 3b 20 0a 09 09 09 72 65 |pprompt)|; ....re|
|00004f70| 74 75 72 6e 20 73 6e 64 | 66 74 70 6d 73 67 28 63 |turn snd|ftpmsg(c|
|00004f80| 75 72 72 65 6e 74 2d 3e | 63 62 2e 66 74 70 2c 22 |urrent->|cb.ftp,"|
|00004f90| 55 53 45 52 20 25 73 22 | 2c 6c 69 6e 65 29 3b 0a |USER %s"|,line);.|
|00004fa0| 09 09 63 61 73 65 20 50 | 41 53 53 5f 53 54 41 54 |..case P|ASS_STAT|
|00004fb0| 45 3a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |E: | |
|00004fc0| 20 20 2f 2a 20 47 6f 74 | 20 74 68 65 20 70 61 73 | /* Got| the pas|
|00004fd0| 73 77 6f 72 64 20 2a 2f | 0a 09 09 09 70 72 69 6e |sword */|....prin|
|00004fe0| 74 66 28 66 74 70 70 72 | 6f 6d 70 74 29 3b 0a 09 |tf(ftppr|ompt);..|
|00004ff0| 09 09 72 65 74 75 72 6e | 20 73 6e 64 66 74 70 6d |..return| sndftpm|
|00005000| 73 67 28 63 75 72 72 65 | 6e 74 2d 3e 63 62 2e 66 |sg(curre|nt->cb.f|
|00005010| 74 70 2c 22 50 41 53 53 | 20 25 73 22 2c 6c 69 6e |tp,"PASS| %s",lin|
|00005020| 65 29 3b 0a 09 7d 0a 09 | 72 65 74 75 72 6e 28 30 |e);..}..|return(0|
|00005030| 29 3b 09 2f 2a 20 73 61 | 74 69 73 66 79 20 74 68 |);./* sa|tisfy th|
|00005040| 65 20 63 6f 6d 70 69 6c | 65 72 20 2a 2f 0a 7d 0a |e compil|er */.}.|
|00005050| 0a 2f 2a 20 48 61 6e 64 | 6c 65 20 74 6f 70 2d 6c |./* Hand|le top-l|
|00005060| 65 76 65 6c 20 46 54 50 | 20 63 6f 6d 6d 61 6e 64 |evel FTP| command|
|00005070| 20 2a 2f 0a 69 6e 74 0a | 64 6f 66 74 70 28 61 72 | */.int.|doftp(ar|
|00005080| 67 63 2c 61 72 67 76 29 | 0a 69 6e 74 20 61 72 67 |gc,argv)|.int arg|
|00005090| 63 3b 0a 63 68 61 72 20 | 2a 61 72 67 76 5b 5d 3b |c;.char |*argv[];|
|000050a0| 0a 7b 0a 09 69 6e 74 33 | 32 20 72 65 73 6f 6c 76 |.{..int3|2 resolv|
|000050b0| 65 28 29 3b 0a 09 69 6e | 74 20 61 74 6f 69 28 29 |e();..in|t atoi()|
|000050c0| 2c 67 6f 28 29 3b 0a 09 | 63 68 61 72 20 2a 69 6e |,go();..|char *in|
|000050d0| 65 74 5f 6e 74 6f 61 28 | 29 3b 0a 09 76 6f 69 64 |et_ntoa(|);..void|
|000050e0| 20 66 74 70 63 63 72 28 | 29 2c 66 74 70 63 63 73 | ftpccr(|),ftpccs|
|000050f0| 28 29 2c 63 6f 6f 6b 65 | 64 28 29 3b 0a 09 73 74 |(),cooke|d();..st|
|00005100| 72 75 63 74 20 73 65 73 | 73 69 6f 6e 20 2a 73 3b |ruct ses|sion *s;|
|00005110| 0a 09 73 74 72 75 63 74 | 20 66 74 70 20 2a 66 74 |..struct| ftp *ft|
|00005120| 70 2c 2a 66 74 70 5f 63 | 72 65 61 74 65 28 29 3b |p,*ftp_c|reate();|
|00005130| 0a 09 73 74 72 75 63 74 | 20 74 63 62 20 2a 74 63 |..struct| tcb *tc|
|00005140| 62 3b 0a 09 73 74 72 75 | 63 74 20 73 6f 63 6b 65 |b;..stru|ct socke|
|00005150| 74 20 6c 73 6f 63 6b 65 | 74 2c 66 73 6f 63 6b 65 |t lsocke|t,fsocke|
|00005160| 74 3b 0a 0a 23 69 66 64 | 65 66 20 43 4f 48 50 52 |t;..#ifd|ef COHPR|
|00005170| 4f 46 0a 70 72 6f 66 69 | 6c 65 28 5f 5f 4c 49 4e |OF.profi|le(__LIN|
|00005180| 45 5f 5f 2c 5f 5f 46 49 | 4c 45 5f 5f 29 3b 0a 23 |E__,__FI|LE__);.#|
|00005190| 65 6e 64 69 66 0a 09 6c | 73 6f 63 6b 65 74 2e 61 |endif..l|socket.a|
|000051a0| 64 64 72 65 73 73 20 3d | 20 69 70 5f 61 64 64 72 |ddress =| ip_addr|
|000051b0| 3b 0a 09 6c 73 6f 63 6b | 65 74 2e 70 6f 72 74 20 |;..lsock|et.port |
|000051c0| 3d 20 6c 70 6f 72 74 2b | 2b 3b 0a 09 69 66 28 28 |= lport+|+;..if((|
|000051d0| 66 73 6f 63 6b 65 74 2e | 61 64 64 72 65 73 73 20 |fsocket.|address |
|000051e0| 3d 20 72 65 73 6f 6c 76 | 65 28 61 72 67 76 5b 31 |= resolv|e(argv[1|
|000051f0| 5d 29 29 20 3d 3d 20 30 | 29 7b 0a 09 09 70 72 69 |])) == 0|){...pri|
|00005200| 6e 74 66 28 62 61 64 68 | 6f 73 74 2c 61 72 67 76 |ntf(badh|ost,argv|
|00005210| 5b 31 5d 29 3b 0a 09 09 | 72 65 74 75 72 6e 20 31 |[1]);...|return 1|
|00005220| 3b 0a 09 7d 0a 09 69 66 | 28 61 72 67 63 20 3c 20 |;..}..if|(argc < |
|00005230| 33 29 0a 09 09 66 73 6f | 63 6b 65 74 2e 70 6f 72 |3)...fso|cket.por|
|00005240| 74 20 3d 20 46 54 50 5f | 50 4f 52 54 3b 0a 09 65 |t = FTP_|PORT;..e|
|00005250| 6c 73 65 0a 09 09 66 73 | 6f 63 6b 65 74 2e 70 6f |lse...fs|ocket.po|
|00005260| 72 74 20 3d 20 61 74 6f | 69 28 61 72 67 76 5b 32 |rt = ato|i(argv[2|
|00005270| 5d 29 3b 0a 0a 09 2f 2a | 20 41 6c 6c 6f 63 61 74 |]);.../*| Allocat|
|00005280| 65 20 61 20 73 65 73 73 | 69 6f 6e 20 63 6f 6e 74 |e a sess|ion cont|
|00005290| 72 6f 6c 20 62 6c 6f 63 | 6b 20 2a 2f 0a 09 69 66 |rol bloc|k */..if|
|000052a0| 28 28 73 20 3d 20 6e 65 | 77 73 65 73 73 69 6f 6e |((s = ne|wsession|
|000052b0| 28 29 29 20 3d 3d 20 4e | 55 4c 4c 53 45 53 53 49 |()) == N|ULLSESSI|
|000052c0| 4f 4e 29 7b 0a 09 09 70 | 72 69 6e 74 66 28 22 54 |ON){...p|rintf("T|
|000052d0| 6f 6f 20 6d 61 6e 79 20 | 73 65 73 73 69 6f 6e 73 |oo many |sessions|
|000052e0| 5c 6e 22 29 3b 0a 09 09 | 72 65 74 75 72 6e 20 31 |\n");...|return 1|
|000052f0| 3b 0a 09 7d 0a 09 63 75 | 72 72 65 6e 74 20 3d 20 |;..}..cu|rrent = |
|00005300| 73 3b 0a 09 69 66 28 28 | 73 2d 3e 6e 61 6d 65 20 |s;..if((|s->name |
|00005310| 3d 20 6d 61 6c 6c 6f 63 | 28 28 75 6e 73 69 67 6e |= malloc|((unsign|
|00005320| 65 64 29 73 74 72 6c 65 | 6e 28 61 72 67 76 5b 31 |ed)strle|n(argv[1|
|00005330| 5d 29 2b 31 29 29 20 21 | 3d 20 4e 55 4c 4c 43 48 |])+1)) !|= NULLCH|
|00005340| 41 52 29 0a 09 09 73 74 | 72 63 70 79 28 73 2d 3e |AR)...st|rcpy(s->|
|00005350| 6e 61 6d 65 2c 61 72 67 | 76 5b 31 5d 29 3b 0a 09 |name,arg|v[1]);..|
|00005360| 73 2d 3e 74 79 70 65 20 | 3d 20 46 54 50 3b 0a 09 |s->type |= FTP;..|
|00005370| 73 2d 3e 70 61 72 73 65 | 20 3d 20 66 74 70 70 61 |s->parse| = ftppa|
|00005380| 72 73 65 3b 0a 0a 09 2f | 2a 20 41 6c 6c 6f 63 61 |rse;.../|* Alloca|
|00005390| 74 65 20 61 6e 20 46 54 | 50 20 63 6f 6e 74 72 6f |te an FT|P contro|
|000053a0| 6c 20 62 6c 6f 63 6b 20 | 2a 2f 0a 09 69 66 28 28 |l block |*/..if((|
|000053b0| 66 74 70 20 3d 20 66 74 | 70 5f 63 72 65 61 74 65 |ftp = ft|p_create|
|000053c0| 28 4c 49 4e 45 4c 45 4e | 29 29 20 3d 3d 20 4e 55 |(LINELEN|)) == NU|
|000053d0| 4c 4c 46 54 50 29 7b 0a | 09 09 73 2d 3e 74 79 70 |LLFTP){.|..s->typ|
|000053e0| 65 20 3d 20 46 52 45 45 | 3b 0a 09 09 70 72 69 6e |e = FREE|;...prin|
|000053f0| 74 66 28 6e 6f 73 70 61 | 63 65 29 3b 0a 09 09 72 |tf(nospa|ce);...r|
|00005400| 65 74 75 72 6e 20 31 3b | 0a 09 7d 0a 09 66 74 70 |eturn 1;|..}..ftp|
|00005410| 2d 3e 68 61 73 68 62 65 | 6c 6c 20 3d 20 30 3b 0a |->hashbe|ll = 0;.|
|00005420| 09 66 74 70 2d 3e 73 74 | 61 74 65 20 3d 20 53 54 |.ftp->st|ate = ST|
|00005430| 41 52 54 55 50 5f 53 54 | 41 54 45 3b 0a 09 63 6f |ARTUP_ST|ATE;..co|
|00005440| 6f 6b 65 64 28 29 3b 09 | 2f 2a 20 74 72 79 20 74 |oked();.|/* try t|
|00005450| 68 69 73 20 68 65 72 65 | 20 69 6e 73 74 65 61 64 |his here| instead|
|00005460| 20 6f 66 20 77 68 65 72 | 65 20 69 74 20 77 61 73 | of wher|e it was|
|00005470| 20 2a 2f 0a 09 73 2d 3e | 63 62 2e 66 74 70 20 3d | */..s->|cb.ftp =|
|00005480| 20 66 74 70 3b 20 20 20 | 20 20 20 20 20 2f 2a 20 | ftp; | /* |
|00005490| 44 6f 77 6e 77 61 72 64 | 20 6c 69 6e 6b 20 2a 2f |Downward| link */|
|000054a0| 0a 09 66 74 70 2d 3e 73 | 65 73 73 69 6f 6e 20 3d |..ftp->s|ession =|
|000054b0| 20 73 3b 20 20 20 20 20 | 20 20 2f 2a 20 55 70 77 | s; | /* Upw|
|000054c0| 61 72 64 20 6c 69 6e 6b | 20 2a 2f 0a 0a 09 2f 2a |ard link| */.../*|
|000054d0| 20 4e 6f 77 20 6f 70 65 | 6e 20 74 68 65 20 63 6f | Now ope|n the co|
|000054e0| 6e 74 72 6f 6c 20 63 6f | 6e 6e 65 63 74 69 6f 6e |ntrol co|nnection|
|000054f0| 20 2a 2f 0a 09 74 63 62 | 20 3d 20 6f 70 65 6e 5f | */..tcb| = open_|
|00005500| 74 63 70 28 26 6c 73 6f | 63 6b 65 74 2c 26 66 73 |tcp(&lso|cket,&fs|
|00005510| 6f 63 6b 65 74 2c 54 43 | 50 5f 41 43 54 49 56 45 |ocket,TC|P_ACTIVE|
|00005520| 2c 0a 09 09 09 30 2c 66 | 74 70 63 63 72 2c 4e 55 |,....0,f|tpccr,NU|
|00005530| 4c 4c 56 46 50 2c 66 74 | 70 63 63 73 2c 30 2c 28 |LLVFP,ft|pccs,0,(|
|00005540| 69 6e 74 20 2a 29 66 74 | 70 29 3b 0a 09 66 74 70 |int *)ft|p);..ftp|
|00005550| 2d 3e 63 6f 6e 74 72 6f | 6c 20 3d 20 74 63 62 3b |->contro|l = tcb;|
|00005560| 0a 09 67 6f 28 29 3b 0a | 09 72 65 74 75 72 6e 20 |..go();.|.return |
|00005570| 30 3b 0a 7d 0a 0a 2f 2a | 20 48 61 6e 64 6c 65 20 |0;.}../*| Handle |
|00005580| 6e 75 6c 6c 20 6c 69 6e | 65 20 74 6f 20 61 76 6f |null lin|e to avo|
|00005590| 69 64 20 74 72 61 70 70 | 69 6e 67 20 6f 6e 20 66 |id trapp|ing on f|
|000055a0| 69 72 73 74 20 63 6f 6d | 6d 61 6e 64 20 69 6e 20 |irst com|mand in |
|000055b0| 74 61 62 6c 65 20 2a 2f | 0a 69 6e 74 0a 64 6f 6e |table */|.int.don|
|000055c0| 6f 74 68 69 6e 67 28 29 | 0a 0a 0a 7b 0a 23 69 66 |othing()|...{.#if|
|000055d0| 64 65 66 20 43 4f 48 50 | 52 4f 46 0a 70 72 6f 66 |def COHP|ROF.prof|
|000055e0| 69 6c 65 28 5f 5f 4c 49 | 4e 45 5f 5f 2c 5f 5f 46 |ile(__LI|NE__,__F|
|000055f0| 49 4c 45 5f 5f 29 3b 0a | 23 65 6e 64 69 66 0a 0a |ILE__);.|#endif..|
|00005600| 09 72 65 74 75 72 6e 28 | 30 29 3b 0a 7d 0a 2f 2a |.return(|0);.}./*|
|00005610| 20 54 72 61 6e 73 6c 61 | 74 65 20 27 63 64 27 20 | Transla|te 'cd' |
|00005620| 74 6f 20 27 63 77 64 27 | 20 66 6f 72 20 63 6f 6e |to 'cwd'| for con|
|00005630| 76 65 6e 69 65 6e 63 65 | 20 2a 2f 0a 69 6e 74 0a |venience| */.int.|
|00005640| 64 6f 66 74 70 63 64 28 | 61 72 67 63 2c 61 72 67 |doftpcd(|argc,arg|
|00005650| 76 29 0a 69 6e 74 20 61 | 72 67 63 3b 0a 63 68 61 |v).int a|rgc;.cha|
|00005660| 72 20 2a 61 72 67 76 5b | 5d 3b 0a 7b 0a 09 72 65 |r *argv[|];.{..re|
|00005670| 67 69 73 74 65 72 20 73 | 74 72 75 63 74 20 66 74 |gister s|truct ft|
|00005680| 70 20 2a 66 74 70 3b 0a | 09 61 72 67 63 3d 61 72 |p *ftp;.|.argc=ar|
|00005690| 67 63 3b 0a 23 69 66 64 | 65 66 20 43 4f 48 50 52 |gc;.#ifd|ef COHPR|
|000056a0| 4f 46 0a 70 72 6f 66 69 | 6c 65 28 5f 5f 4c 49 4e |OF.profi|le(__LIN|
|000056b0| 45 5f 5f 2c 5f 5f 46 49 | 4c 45 5f 5f 29 3b 0a 23 |E__,__FI|LE__);.#|
|000056c0| 65 6e 64 69 66 0a 09 66 | 74 70 20 3d 20 63 75 72 |endif..f|tp = cur|
|000056d0| 72 65 6e 74 2d 3e 63 62 | 2e 66 74 70 3b 0a 09 72 |rent->cb|.ftp;..r|
|000056e0| 65 74 75 72 6e 20 73 6e | 64 66 74 70 6d 73 67 28 |eturn sn|dftpmsg(|
|000056f0| 66 74 70 2c 22 43 57 44 | 20 25 73 5c 72 5c 6e 22 |ftp,"CWD| %s\r\n"|
|00005700| 2c 61 72 67 76 5b 31 5d | 29 3b 0a 7d 0a 2f 2a 20 |,argv[1]|);.}./* |
|00005710| 54 72 61 6e 73 6c 61 74 | 65 20 27 6d 6b 64 69 72 |Translat|e 'mkdir|
|00005720| 27 20 74 6f 20 27 78 6d | 6b 64 27 20 66 6f 72 20 |' to 'xm|kd' for |
|00005730| 63 6f 6e 76 65 6e 69 65 | 6e 63 65 20 2a 2f 0a 69 |convenie|nce */.i|
|00005740| 6e 74 0a 64 6f 6d 6b 64 | 69 72 28 61 72 67 63 2c |nt.domkd|ir(argc,|
|00005750| 61 72 67 76 29 0a 69 6e | 74 20 61 72 67 63 3b 0a |argv).in|t argc;.|
|00005760| 63 68 61 72 20 2a 61 72 | 67 76 5b 5d 3b 0a 7b 0a |char *ar|gv[];.{.|
|00005770| 09 72 65 67 69 73 74 65 | 72 20 73 74 72 75 63 74 |.registe|r struct|
|00005780| 20 66 74 70 20 2a 66 74 | 70 3b 0a 09 61 72 67 63 | ftp *ft|p;..argc|
|00005790| 3d 61 72 67 63 3b 0a 23 | 69 66 64 65 66 20 43 4f |=argc;.#|ifdef CO|
|000057a0| 48 50 52 4f 46 0a 70 72 | 6f 66 69 6c 65 28 5f 5f |HPROF.pr|ofile(__|
|000057b0| 4c 49 4e 45 5f 5f 2c 5f | 5f 46 49 4c 45 5f 5f 29 |LINE__,_|_FILE__)|
|000057c0| 3b 0a 23 65 6e 64 69 66 | 0a 09 66 74 70 20 3d 20 |;.#endif|..ftp = |
|000057d0| 63 75 72 72 65 6e 74 2d | 3e 63 62 2e 66 74 70 3b |current-|>cb.ftp;|
|000057e0| 0a 09 72 65 74 75 72 6e | 20 73 6e 64 66 74 70 6d |..return| sndftpm|
|000057f0| 73 67 28 66 74 70 2c 22 | 58 4d 4b 44 20 25 73 5c |sg(ftp,"|XMKD %s\|
|00005800| 72 5c 6e 22 2c 61 72 67 | 76 5b 31 5d 29 3b 0a 7d |r\n",arg|v[1]);.}|
|00005810| 0a 2f 2a 20 54 72 61 6e | 73 6c 61 74 65 20 27 72 |./* Tran|slate 'r|
|00005820| 6d 64 69 72 27 20 74 6f | 20 27 78 72 6d 64 27 20 |mdir' to| 'xrmd' |
|00005830| 66 6f 72 20 63 6f 6e 76 | 65 6e 69 65 6e 63 65 20 |for conv|enience |
|00005840| 2a 2f 0a 69 6e 74 0a 64 | 6f 72 6d 64 69 72 28 61 |*/.int.d|ormdir(a|
|00005850| 72 67 63 2c 61 72 67 76 | 29 0a 69 6e 74 20 61 72 |rgc,argv|).int ar|
|00005860| 67 63 3b 0a 63 68 61 72 | 20 2a 61 72 67 76 5b 5d |gc;.char| *argv[]|
|00005870| 3b 0a 7b 0a 09 72 65 67 | 69 73 74 65 72 20 73 74 |;.{..reg|ister st|
|00005880| 72 75 63 74 20 66 74 70 | 20 2a 66 74 70 3b 0a 09 |ruct ftp| *ftp;..|
|00005890| 61 72 67 63 3d 61 72 67 | 63 3b 0a 23 69 66 64 65 |argc=arg|c;.#ifde|
|000058a0| 66 20 43 4f 48 50 52 4f | 46 0a 70 72 6f 66 69 6c |f COHPRO|F.profil|
|000058b0| 65 28 5f 5f 4c 49 4e 45 | 5f 5f 2c 5f 5f 46 49 4c |e(__LINE|__,__FIL|
|000058c0| 45 5f 5f 29 3b 0a 23 65 | 6e 64 69 66 0a 09 66 74 |E__);.#e|ndif..ft|
|000058d0| 70 20 3d 20 63 75 72 72 | 65 6e 74 2d 3e 63 62 2e |p = curr|ent->cb.|
|000058e0| 66 74 70 3b 0a 09 72 65 | 74 75 72 6e 20 73 6e 64 |ftp;..re|turn snd|
|000058f0| 66 74 70 6d 73 67 28 66 | 74 70 2c 22 58 52 4d 44 |ftpmsg(f|tp,"XRMD|
|00005900| 20 25 73 5c 72 5c 6e 22 | 2c 61 72 67 76 5b 31 5d | %s\r\n"|,argv[1]|
|00005910| 29 3b 0a 7d 0a 2f 2a 20 | 64 65 6c 65 74 65 20 66 |);.}./* |delete f|
|00005920| 69 6c 65 2c 20 6d 69 73 | 73 69 6e 67 20 66 6f 72 |ile, mis|sing for|
|00005930| 20 73 6f 6d 65 20 72 65 | 61 73 6f 6e 20 2d 20 4b | some re|ason - K|
|00005940| 35 4a 42 20 2a 2f 0a 69 | 6e 74 0a 64 6f 64 65 6c |5JB */.i|nt.dodel|
|00005950| 65 28 61 72 67 63 2c 61 | 72 67 76 29 0a 69 6e 74 |e(argc,a|rgv).int|
|00005960| 20 61 72 67 63 3b 0a 63 | 68 61 72 20 2a 61 72 67 | argc;.c|har *arg|
|00005970| 76 5b 5d 3b 0a 7b 0a 09 | 72 65 67 69 73 74 65 72 |v[];.{..|register|
|00005980| 20 73 74 72 75 63 74 20 | 66 74 70 20 2a 66 74 70 | struct |ftp *ftp|
|00005990| 3b 0a 09 61 72 67 63 3d | 61 72 67 63 3b 0a 23 69 |;..argc=|argc;.#i|
|000059a0| 66 64 65 66 20 43 4f 48 | 50 52 4f 46 0a 70 72 6f |fdef COH|PROF.pro|
|000059b0| 66 69 6c 65 28 5f 5f 4c | 49 4e 45 5f 5f 2c 5f 5f |file(__L|INE__,__|
|000059c0| 46 49 4c 45 5f 5f 29 3b | 0a 23 65 6e 64 69 66 0a |FILE__);|.#endif.|
|000059d0| 09 66 74 70 20 3d 20 63 | 75 72 72 65 6e 74 2d 3e |.ftp = c|urrent->|
|000059e0| 63 62 2e 66 74 70 3b 0a | 09 72 65 74 75 72 6e 20 |cb.ftp;.|.return |
|000059f0| 73 6e 64 66 74 70 6d 73 | 67 28 66 74 70 2c 22 44 |sndftpms|g(ftp,"D|
|00005a00| 45 4c 45 20 25 73 5c 72 | 5c 6e 22 2c 61 72 67 76 |ELE %s\r|\n",argv|
|00005a10| 5b 31 5d 29 3b 0a 7d 0a | 2f 2a 20 48 61 6e 64 6c |[1]);.}.|/* Handl|
|00005a20| 65 20 22 74 79 70 65 22 | 20 63 6f 6d 6d 61 6e 64 |e "type"| command|
|00005a30| 20 66 72 6f 6d 20 75 73 | 65 72 20 2a 2f 0a 69 6e | from us|er */.in|
|00005a40| 74 0a 64 6f 74 79 70 65 | 28 61 72 67 63 2c 61 72 |t.dotype|(argc,ar|
|00005a50| 67 76 29 0a 69 6e 74 20 | 61 72 67 63 3b 0a 63 68 |gv).int |argc;.ch|
|00005a60| 61 72 20 2a 61 72 67 76 | 5b 5d 3b 0a 7b 0a 09 72 |ar *argv|[];.{..r|
|00005a70| 65 67 69 73 74 65 72 20 | 73 74 72 75 63 74 20 66 |egister |struct f|
|00005a80| 74 70 20 2a 66 74 70 3b | 0a 0a 23 69 66 64 65 66 |tp *ftp;|..#ifdef|
|00005a90| 20 43 4f 48 50 52 4f 46 | 0a 70 72 6f 66 69 6c 65 | COHPROF|.profile|
|00005aa0| 28 5f 5f 4c 49 4e 45 5f | 5f 2c 5f 5f 46 49 4c 45 |(__LINE_|_,__FILE|
|00005ab0| 5f 5f 29 3b 0a 23 65 6e | 64 69 66 0a 09 66 74 70 |__);.#en|dif..ftp|
|00005ac0| 20 3d 20 63 75 72 72 65 | 6e 74 2d 3e 63 62 2e 66 | = curre|nt->cb.f|
|00005ad0| 74 70 3b 0a 09 69 66 28 | 61 72 67 63 20 3c 20 32 |tp;..if(|argc < 2|
|00005ae0| 29 7b 0a 09 09 73 77 69 | 74 63 68 28 66 74 70 2d |){...swi|tch(ftp-|
|00005af0| 3e 74 79 70 65 29 7b 0a | 09 09 09 63 61 73 65 20 |>type){.|...case |
|00005b00| 49 4d 41 47 45 5f 54 59 | 50 45 3a 0a 09 09 09 09 |IMAGE_TY|PE:.....|
|00005b10| 70 72 69 6e 74 66 28 22 | 49 6d 61 67 65 5c 6e 25 |printf("|Image\n%|
|00005b20| 73 22 2c 66 74 70 70 72 | 6f 6d 70 74 29 3b 0a 09 |s",ftppr|ompt);..|
|00005b30| 09 09 09 62 72 65 61 6b | 3b 0a 09 09 09 63 61 73 |...break|;....cas|
|00005b40| 65 20 41 53 43 49 49 5f | 54 59 50 45 3a 0a 09 09 |e ASCII_|TYPE:...|
|00005b50| 09 09 70 72 69 6e 74 66 | 28 22 41 73 63 69 69 5c |..printf|("Ascii\|
|00005b60| 6e 25 73 22 2c 66 74 70 | 70 72 6f 6d 70 74 29 3b |n%s",ftp|prompt);|
|00005b70| 0a 09 09 09 09 62 72 65 | 61 6b 3b 0a 09 09 09 7d |.....bre|ak;....}|
|00005b80| 0a 09 09 72 65 74 75 72 | 6e 20 30 3b 0a 09 7d 0a |...retur|n 0;..}.|
|00005b90| 09 73 77 69 74 63 68 28 | 2a 61 72 67 76 5b 31 5d |.switch(|*argv[1]|
|00005ba0| 29 7b 0a 09 09 63 61 73 | 65 20 27 69 27 3a 0a 09 |){...cas|e 'i':..|
|00005bb0| 09 63 61 73 65 20 27 62 | 27 3a 0a 09 09 09 66 74 |.case 'b|':....ft|
|00005bc0| 70 2d 3e 74 79 70 65 20 | 3d 20 49 4d 41 47 45 5f |p->type |= IMAGE_|
|00005bd0| 54 59 50 45 3b 0a 09 09 | 09 73 6e 64 66 74 70 6d |TYPE;...|.sndftpm|
|00005be0| 73 67 28 66 74 70 2c 22 | 54 59 50 45 20 49 5c 72 |sg(ftp,"|TYPE I\r|
|00005bf0| 5c 6e 22 29 3b 0a 09 09 | 09 62 72 65 61 6b 3b 0a |\n");...|.break;.|
|00005c00| 09 09 63 61 73 65 20 27 | 61 27 3a 0a 09 09 09 66 |..case '|a':....f|
|00005c10| 74 70 2d 3e 74 79 70 65 | 20 3d 20 41 53 43 49 49 |tp->type| = ASCII|
|00005c20| 5f 54 59 50 45 3b 0a 09 | 09 09 73 6e 64 66 74 70 |_TYPE;..|..sndftp|
|00005c30| 6d 73 67 28 66 74 70 2c | 22 54 59 50 45 20 41 5c |msg(ftp,|"TYPE A\|
|00005c40| 72 5c 6e 22 29 3b 0a 09 | 09 09 62 72 65 61 6b 3b |r\n");..|..break;|
|00005c50| 0a 09 09 63 61 73 65 20 | 27 6c 27 3a 0a 09 09 09 |...case |'l':....|
|00005c60| 66 74 70 2d 3e 74 79 70 | 65 20 3d 20 49 4d 41 47 |ftp->typ|e = IMAG|
|00005c70| 45 5f 54 59 50 45 3b 0a | 09 09 09 73 6e 64 66 74 |E_TYPE;.|...sndft|
|00005c80| 70 6d 73 67 28 66 74 70 | 2c 22 54 59 50 45 20 4c |pmsg(ftp|,"TYPE L|
|00005c90| 20 25 73 5c 72 5c 6e 22 | 2c 61 72 67 76 5b 32 5d | %s\r\n"|,argv[2]|
|00005ca0| 29 3b 0a 09 09 09 62 72 | 65 61 6b 3b 0a 09 09 64 |);....br|eak;...d|
|00005cb0| 65 66 61 75 6c 74 3a 0a | 09 09 09 70 72 69 6e 74 |efault:.|...print|
|00005cc0| 66 28 22 49 6e 76 61 6c | 69 64 20 74 79 70 65 20 |f("Inval|id type |
|00005cd0| 25 73 5c 6e 25 73 22 2c | 61 72 67 76 5b 31 5d 2c |%s\n%s",|argv[1],|
|00005ce0| 20 66 74 70 70 72 6f 6d | 70 74 29 3b 0a 09 09 09 | ftpprom|pt);....|
|00005cf0| 72 65 74 75 72 6e 20 31 | 3b 0a 09 7d 0a 09 72 65 |return 1|;..}..re|
|00005d00| 74 75 72 6e 20 30 3b 0a | 7d 0a 0a 2f 2a 20 63 72 |turn 0;.|}../* cr|
|00005d10| 65 61 74 65 20 64 61 74 | 61 20 70 6f 72 74 2c 20 |eate dat|a port, |
|00005d20| 61 6e 64 20 73 65 6e 64 | 20 50 4f 52 54 20 6d 65 |and send| PORT me|
|00005d30| 73 73 61 67 65 20 2a 2f | 0a 73 74 61 74 69 63 20 |ssage */|.static |
|00005d40| 76 6f 69 64 0a 66 74 70 | 73 65 74 75 70 28 66 74 |void.ftp|setup(ft|
|00005d50| 70 2c 72 65 63 76 2c 73 | 65 6e 64 2c 73 74 61 74 |p,recv,s|end,stat|
|00005d60| 65 29 0a 73 74 72 75 63 | 74 20 66 74 70 20 2a 66 |e).struc|t ftp *f|
|00005d70| 74 70 3b 0a 76 6f 69 64 | 20 28 2a 73 65 6e 64 29 |tp;.void| (*send)|
|00005d80| 28 29 3b 0a 76 6f 69 64 | 20 28 2a 72 65 63 76 29 |();.void| (*recv)|
|00005d90| 28 29 3b 0a 76 6f 69 64 | 20 28 2a 73 74 61 74 65 |();.void| (*state|
|00005da0| 29 28 29 3b 0a 7b 0a 09 | 73 74 72 75 63 74 20 73 |)();.{..|struct s|
|00005db0| 6f 63 6b 65 74 20 6c 73 | 6f 63 6b 65 74 3b 0a 09 |ocket ls|ocket;..|
|00005dc0| 73 74 72 75 63 74 20 6d | 62 75 66 20 2a 62 70 3b |struct m|buf *bp;|
|00005dd0| 0a 09 69 6e 74 20 74 69 | 6d 65 28 29 3b 0a 23 69 |..int ti|me();.#i|
|00005de0| 66 64 65 66 20 43 4f 48 | 50 52 4f 46 0a 70 72 6f |fdef COH|PROF.pro|
|00005df0| 66 69 6c 65 28 5f 5f 4c | 49 4e 45 5f 5f 2c 5f 5f |file(__L|INE__,__|
|00005e00| 46 49 4c 45 5f 5f 29 3b | 0a 23 65 6e 64 69 66 0a |FILE__);|.#endif.|
|00005e10| 09 6c 73 6f 63 6b 65 74 | 2e 61 64 64 72 65 73 73 |.lsocket|.address|
|00005e20| 20 3d 20 69 70 5f 61 64 | 64 72 3b 0a 09 6c 73 6f | = ip_ad|dr;..lso|
|00005e30| 63 6b 65 74 2e 70 6f 72 | 74 20 3d 20 6c 70 6f 72 |cket.por|t = lpor|
|00005e40| 74 2b 2b 3b 0a 0a 09 2f | 2a 20 43 6f 6d 70 6f 73 |t++;.../|* Compos|
|00005e50| 65 20 61 6e 64 20 73 65 | 6e 64 20 50 4f 52 54 20 |e and se|nd PORT |
|00005e60| 61 2c 61 2c 61 2c 61 2c | 70 2c 70 20 6d 65 73 73 |a,a,a,a,|p,p mess|
|00005e70| 61 67 65 20 2a 2f 0a 0a | 09 69 66 28 28 62 70 20 |age */..|.if((bp |
|00005e80| 3d 20 61 6c 6c 6f 63 5f | 6d 62 75 66 28 33 35 29 |= alloc_|mbuf(35)|
|00005e90| 29 20 3d 3d 20 4e 55 4c | 4c 42 55 46 29 7b 20 20 |) == NUL|LBUF){ |
|00005ea0| 20 2f 2a 20 35 20 6d 6f | 72 65 20 74 68 61 6e 20 | /* 5 mo|re than |
|00005eb0| 77 6f 72 73 74 20 63 61 | 73 65 20 2a 2f 0a 09 09 |worst ca|se */...|
|00005ec0| 70 72 69 6e 74 66 28 6e | 6f 73 70 61 63 65 29 3b |printf(n|ospace);|
|00005ed0| 0a 09 09 72 65 74 75 72 | 6e 3b 0a 09 7d 0a 09 2f |...retur|n;..}../|
|00005ee0| 2a 20 49 20 6b 6e 6f 77 | 2c 20 74 68 69 73 20 6c |* I know|, this l|
|00005ef0| 6f 6f 6b 73 20 67 72 6f | 73 73 2c 20 62 75 74 20 |ooks gro|ss, but |
|00005f00| 69 74 20 77 6f 72 6b 73 | 21 20 2a 2f 0a 09 73 70 |it works|! */..sp|
|00005f10| 72 69 6e 74 66 28 62 70 | 2d 3e 64 61 74 61 2c 22 |rintf(bp|->data,"|
|00005f20| 50 4f 52 54 20 25 75 2c | 25 75 2c 25 75 2c 25 75 |PORT %u,|%u,%u,%u|
|00005f30| 2c 25 75 2c 25 75 5c 72 | 5c 6e 22 2c 0a 09 09 68 |,%u,%u\r|\n",...h|
|00005f40| 69 62 79 74 65 28 68 69 | 77 6f 72 64 28 6c 73 6f |ibyte(hi|word(lso|
|00005f50| 63 6b 65 74 2e 61 64 64 | 72 65 73 73 29 29 2c 0a |cket.add|ress)),.|
|00005f60| 09 09 6c 6f 62 79 74 65 | 28 68 69 77 6f 72 64 28 |..lobyte|(hiword(|
|00005f70| 6c 73 6f 63 6b 65 74 2e | 61 64 64 72 65 73 73 29 |lsocket.|address)|
|00005f80| 29 2c 0a 09 09 68 69 62 | 79 74 65 28 6c 6f 77 6f |),...hib|yte(lowo|
|00005f90| 72 64 28 6c 73 6f 63 6b | 65 74 2e 61 64 64 72 65 |rd(lsock|et.addre|
|00005fa0| 73 73 29 29 2c 0a 09 09 | 6c 6f 62 79 74 65 28 6c |ss)),...|lobyte(l|
|00005fb0| 6f 77 6f 72 64 28 6c 73 | 6f 63 6b 65 74 2e 61 64 |oword(ls|ocket.ad|
|00005fc0| 64 72 65 73 73 29 29 2c | 0a 09 09 68 69 62 79 74 |dress)),|...hibyt|
|00005fd0| 65 28 6c 73 6f 63 6b 65 | 74 2e 70 6f 72 74 29 2c |e(lsocke|t.port),|
|00005fe0| 0a 09 09 6c 6f 62 79 74 | 65 28 6c 73 6f 63 6b 65 |...lobyt|e(lsocke|
|00005ff0| 74 2e 70 6f 72 74 29 29 | 3b 0a 09 62 70 2d 3e 63 |t.port))|;..bp->c|
|00006000| 6e 74 20 3d 20 73 74 72 | 6c 65 6e 28 62 70 2d 3e |nt = str|len(bp->|
|00006010| 64 61 74 61 29 3b 0a 09 | 73 65 6e 64 5f 74 63 70 |data);..|send_tcp|
|00006020| 28 66 74 70 2d 3e 63 6f | 6e 74 72 6f 6c 2c 62 70 |(ftp->co|ntrol,bp|
|00006030| 29 3b 0a 0a 09 66 74 70 | 2d 3e 64 61 74 61 62 79 |);...ftp|->databy|
|00006040| 74 65 73 20 3d 20 30 3b | 0a 09 66 74 70 2d 3e 6c |tes = 0;|..ftp->l|
|00006050| 61 73 74 68 61 73 68 20 | 3d 20 30 3b 0a 09 66 74 |asthash |= 0;..ft|
|00006060| 70 2d 3e 73 74 61 72 74 | 74 69 6d 65 20 3d 20 74 |p->start|time = t|
|00006070| 69 6d 65 28 4e 55 4c 4c | 29 3b 0a 0a 09 2f 2a 20 |ime(NULL|);.../* |
|00006080| 50 6f 73 74 20 61 20 6c | 69 73 74 65 6e 20 6f 6e |Post a l|isten on|
|00006090| 20 74 68 65 20 64 61 74 | 61 20 63 6f 6e 6e 65 63 | the dat|a connec|
|000060a0| 74 69 6f 6e 20 2a 2f 0a | 09 66 74 70 2d 3e 64 61 |tion */.|.ftp->da|
|000060b0| 74 61 20 3d 20 6f 70 65 | 6e 5f 74 63 70 28 26 6c |ta = ope|n_tcp(&l|
|000060c0| 73 6f 63 6b 65 74 2c 4e | 55 4c 4c 53 4f 43 4b 2c |socket,N|ULLSOCK,|
|000060d0| 54 43 50 5f 50 41 53 53 | 49 56 45 2c 30 2c 0a 09 |TCP_PASS|IVE,0,..|
|000060e0| 09 72 65 63 76 2c 73 65 | 6e 64 2c 73 74 61 74 65 |.recv,se|nd,state|
|000060f0| 2c 30 2c 28 69 6e 74 20 | 2a 29 66 74 70 29 3b 0a |,0,(int |*)ftp);.|
|00006100| 7d 0a 0a 2f 2a 20 46 54 | 50 20 43 6c 69 65 6e 74 |}../* FT|P Client|
|00006110| 20 44 61 74 61 20 63 68 | 61 6e 6e 65 6c 20 53 74 | Data ch|annel St|
|00006120| 61 74 65 20 63 68 61 6e | 67 65 20 75 70 63 61 6c |ate chan|ge upcal|
|00006130| 6c 20 68 61 6e 64 6c 65 | 72 20 2a 2f 0a 73 74 61 |l handle|r */.sta|
|00006140| 74 69 63 20 76 6f 69 64 | 0a 66 74 70 63 64 73 28 |tic void|.ftpcds(|
|00006150| 74 63 62 2c 6f 6c 64 2c | 6e 65 77 29 0a 73 74 72 |tcb,old,|new).str|
|00006160| 75 63 74 20 74 63 62 20 | 2a 74 63 62 3b 0a 63 68 |uct tcb |*tcb;.ch|
|00006170| 61 72 20 6f 6c 64 2c 6e | 65 77 3b 0a 7b 0a 09 73 |ar old,n|ew;.{..s|
|00006180| 74 72 75 63 74 20 66 74 | 70 20 2a 66 74 70 3b 0a |truct ft|p *ftp;.|
|00006190| 09 69 6e 74 20 74 69 6d | 65 28 29 3b 0a 09 6f 6c |.int tim|e();..ol|
|000061a0| 64 3d 6f 6c 64 3b 0a 23 | 69 66 64 65 66 20 43 4f |d=old;.#|ifdef CO|
|000061b0| 48 50 52 4f 46 0a 70 72 | 6f 66 69 6c 65 28 5f 5f |HPROF.pr|ofile(__|
|000061c0| 4c 49 4e 45 5f 5f 2c 5f | 5f 46 49 4c 45 5f 5f 29 |LINE__,_|_FILE__)|
|000061d0| 3b 0a 23 65 6e 64 69 66 | 0a 09 69 66 28 28 66 74 |;.#endif|..if((ft|
|000061e0| 70 20 3d 20 28 73 74 72 | 75 63 74 20 66 74 70 20 |p = (str|uct ftp |
|000061f0| 2a 29 74 63 62 2d 3e 75 | 73 65 72 29 20 3d 3d 20 |*)tcb->u|ser) == |
|00006200| 4e 55 4c 4c 46 54 50 29 | 7b 0a 09 09 2f 2a 20 55 |NULLFTP)|{.../* U|
|00006210| 6e 6b 6e 6f 77 6e 20 63 | 6f 6e 6e 65 63 74 69 6f |nknown c|onnectio|
|00006220| 6e 2c 20 6b 69 6c 6c 20 | 69 74 20 2a 2f 0a 09 09 |n, kill |it */...|
|00006230| 63 6c 6f 73 65 5f 74 63 | 70 28 74 63 62 29 3b 0a |close_tc|p(tcb);.|
|00006240| 09 09 72 65 74 75 72 6e | 3b 0a 09 7d 0a 09 73 77 |..return|;..}..sw|
|00006250| 69 74 63 68 28 6e 65 77 | 29 7b 0a 09 09 63 61 73 |itch(new|){...cas|
|00006260| 65 20 46 49 4e 57 41 49 | 54 32 3a 0a 09 09 63 61 |e FINWAI|T2:...ca|
|00006270| 73 65 20 54 49 4d 45 5f | 57 41 49 54 3a 0a 09 09 |se TIME_|WAIT:...|
|00006280| 09 69 66 28 66 74 70 2d | 3e 73 74 61 74 65 20 3d |.if(ftp-|>state =|
|00006290| 3d 20 53 45 4e 44 49 4e | 47 5f 53 54 41 54 45 29 |= SENDIN|G_STATE)|
|000062a0| 7b 0a 09 09 09 09 2f 2a | 20 57 65 27 76 65 20 72 |{...../*| We've r|
|000062b0| 65 63 65 69 76 65 64 20 | 61 6e 20 61 63 6b 20 6f |eceived |an ack o|
|000062c0| 66 20 6f 75 72 20 46 49 | 4e 2c 20 73 6f 0a 09 09 |f our FI|N, so...|
|000062d0| 09 09 20 2a 20 72 65 74 | 75 72 6e 20 74 6f 20 63 |.. * ret|urn to c|
|000062e0| 6f 6d 6d 61 6e 64 20 6d | 6f 64 65 0a 09 09 09 09 |ommand m|ode.....|
|000062f0| 20 2a 2f 0a 09 09 09 09 | 66 74 70 2d 3e 73 74 61 | */.....|ftp->sta|
|00006300| 74 65 20 3d 20 43 4f 4d | 4d 41 4e 44 5f 53 54 41 |te = COM|MAND_STA|
|00006310| 54 45 3b 0a 09 09 09 09 | 69 66 28 63 75 72 72 65 |TE;.....|if(curre|
|00006320| 6e 74 20 21 3d 20 4e 55 | 4c 4c 53 45 53 53 49 4f |nt != NU|LLSESSIO|
|00006330| 4e 20 26 26 20 63 75 72 | 72 65 6e 74 2d 3e 63 62 |N && cur|rent->cb|
|00006340| 2e 66 74 70 20 3d 3d 20 | 66 74 70 29 7b 0a 09 09 |.ftp == |ftp){...|
|00006350| 09 09 09 70 72 69 6e 74 | 66 28 22 50 75 74 20 63 |...print|f("Put c|
|00006360| 6f 6d 70 6c 65 74 65 2c | 20 25 6c 75 20 62 79 74 |omplete,| %lu byt|
|00006370| 65 73 20 73 65 6e 74 20 | 69 6e 20 25 64 20 73 65 |es sent |in %d se|
|00006380| 63 73 5c 6e 22 2c 0a 09 | 09 09 09 09 09 74 63 62 |cs\n",..|.....tcb|
|00006390| 2d 3e 73 6e 64 2e 75 6e | 61 20 2d 20 74 63 62 2d |->snd.un|a - tcb-|
|000063a0| 3e 69 73 73 20 2d 20 32 | 2c 20 28 74 69 6d 65 28 |>iss - 2|, (time(|
|000063b0| 4e 55 4c 4c 29 29 20 2d | 20 66 74 70 2d 3e 73 74 |NULL)) -| ftp->st|
|000063c0| 61 72 74 74 69 6d 65 20 | 29 3b 0a 09 09 09 09 09 |arttime |);......|
|000063d0| 69 66 28 20 66 74 70 2d | 3e 68 61 73 68 62 65 6c |if( ftp-|>hashbel|
|000063e0| 6c 20 26 20 46 54 50 42 | 45 4c 4c 20 29 20 70 72 |l & FTPB|ELL ) pr|
|000063f0| 69 6e 74 66 28 20 22 5c | 61 22 20 29 3b 0a 09 09 |intf( "\|a" );...|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.