Artifact
71345b55e7702cb96d884afff94cf89fa32e56b87caf2498eb4ce97f698e2a9b:
0000: 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 74 #!/usr/bin/env t
0010: 63 6c 73 68 0a 0a 73 65 74 20 61 75 74 6f 5f 70 clsh..set auto_p
0020: 61 74 68 20 5b 6c 69 6e 73 65 72 74 20 24 61 75 ath [linsert $au
0030: 74 6f 5f 70 61 74 68 20 30 20 5b 66 69 6c 65 20 to_path 0 [file
0040: 6e 6f 72 6d 61 6c 69 7a 65 20 5b 66 69 6c 65 20 normalize [file
0050: 6a 6f 69 6e 20 5b 66 69 6c 65 20 64 69 72 6e 61 join [file dirna
0060: 6d 65 20 5b 69 6e 66 6f 20 73 63 72 69 70 74 5d me [info script]
0070: 5d 20 2e 2e 5d 5d 5d 0a 70 61 63 6b 61 67 65 20 ] ..]]].package
0080: 72 65 71 75 69 72 65 20 74 6c 73 0a 0a 70 72 6f require tls..pro
0090: 63 20 63 72 65 61 64 61 62 6c 65 20 7b 73 7d 20 c creadable {s}
00a0: 7b 0a 20 20 20 20 70 75 74 73 20 22 4c 49 4e 45 {. puts "LINE
00b0: 3d 5b 67 65 74 73 20 24 73 5d 22 0a 20 20 20 20 =[gets $s]".
00c0: 61 66 74 65 72 20 32 30 30 30 0a 20 20 20 20 66 after 2000. f
00d0: 69 6c 65 20 64 65 6c 65 74 65 20 2d 66 6f 72 63 ile delete -forc
00e0: 65 20 24 3a 3a 6b 65 79 66 69 6c 65 0a 20 20 20 e $::keyfile.
00f0: 20 66 69 6c 65 20 64 65 6c 65 74 65 20 2d 66 6f file delete -fo
0100: 72 63 65 20 24 3a 3a 63 65 72 74 66 69 6c 65 0a rce $::certfile.
0110: 20 20 20 20 65 78 69 74 0a 7d 0a 0a 70 72 6f 63 exit.}..proc
0120: 20 6d 79 73 65 72 76 20 7b 73 20 61 72 67 73 7d myserv {s args}
0130: 20 7b 0a 20 20 20 20 66 69 6c 65 65 76 65 6e 74 {. fileevent
0140: 20 24 73 20 72 65 61 64 61 62 6c 65 20 5b 6c 69 $s readable [li
0150: 73 74 20 63 72 65 61 64 61 62 6c 65 20 24 73 5d st creadable $s]
0160: 0a 7d 0a 0a 63 6c 6f 73 65 20 5b 66 69 6c 65 20 .}..close [file
0170: 74 65 6d 70 66 69 6c 65 20 6b 65 79 66 69 6c 65 tempfile keyfile
0180: 20 6b 65 79 66 69 6c 65 5d 0a 63 6c 6f 73 65 20 keyfile].close
0190: 5b 66 69 6c 65 20 74 65 6d 70 66 69 6c 65 20 63 [file tempfile c
01a0: 65 72 74 66 69 6c 65 20 63 65 72 74 66 69 6c 65 ertfile certfile
01b0: 5d 0a 0a 74 6c 73 3a 3a 6d 69 73 63 20 72 65 71 ]..tls::misc req
01c0: 20 31 30 32 34 20 24 6b 65 79 66 69 6c 65 20 24 1024 $keyfile $
01d0: 63 65 72 74 66 69 6c 65 20 5b 6c 69 73 74 20 43 certfile [list C
01e0: 20 43 43 43 20 53 54 20 53 54 54 54 20 4c 20 4c CCC ST STTT L L
01f0: 4c 4c 4c 20 4f 20 4f 4f 4f 4f 20 4f 55 20 4f 55 LLL O OOOO OU OU
0200: 55 55 55 20 43 4e 20 43 4e 4e 4e 4e 20 45 6d 61 UUU CN CNNNN Ema
0210: 69 6c 20 73 6f 6d 65 40 65 6d 61 69 6c 2e 63 6f il some@email.co
0220: 6d 20 64 61 79 73 20 37 33 30 20 73 65 72 69 61 m days 730 seria
0230: 6c 20 31 32 5d 0a 0a 74 6c 73 3a 3a 73 6f 63 6b l 12]..tls::sock
0240: 65 74 20 2d 72 65 71 75 69 72 65 20 30 20 2d 6b et -require 0 -k
0250: 65 79 66 69 6c 65 20 24 6b 65 79 66 69 6c 65 20 eyfile $keyfile
0260: 2d 63 65 72 74 66 69 6c 65 20 24 63 65 72 74 66 -certfile $certf
0270: 69 6c 65 20 2d 73 65 72 76 65 72 20 6d 79 73 65 ile -server myse
0280: 72 76 20 31 32 33 30 30 0a 0a 70 75 74 73 20 22 rv 12300..puts "
0290: 4e 6f 77 20 72 75 6e 20 6b 65 79 74 65 73 74 32 Now run keytest2
02a0: 2e 74 63 6c 22 0a 76 77 61 69 74 20 66 6f 72 65 .tcl".vwait fore
02b0: 76 65 72 0a 0a ver..