Hex Artifact Content

Artifact 8c36976f30cee56940f7f628bc599f25d67a4761a12735ccb2f33a9d9a92adfb:


0000: 23 21 2f 62 69 6e 2f 73 68 0a 23 20 54 68 65 20  #!/bin/sh.# The 
0010: 6e 65 78 74 20 6c 69 6e 65 20 69 73 20 65 78 65  next line is exe
0020: 63 75 74 65 64 20 62 79 20 2f 62 69 6e 2f 73 68  cuted by /bin/sh
0030: 2c 20 62 75 74 20 6e 6f 74 20 74 63 6c 20 5c 0a  , but not tcl \.
0040: 65 78 65 63 20 74 63 6c 73 68 20 22 24 30 22 20  exec tclsh "$0" 
0050: 24 7b 31 2b 22 24 40 22 7d 0a 0a 73 65 74 20 61  ${1+"$@"}..set a
0060: 75 74 6f 5f 70 61 74 68 20 5b 6c 69 6e 73 65 72  uto_path [linser
0070: 74 20 24 61 75 74 6f 5f 70 61 74 68 20 30 20 5b  t $auto_path 0 [
0080: 66 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a 65 20 5b  file normalize [
0090: 66 69 6c 65 20 6a 6f 69 6e 20 5b 66 69 6c 65 20  file join [file 
00a0: 64 69 72 6e 61 6d 65 20 5b 69 6e 66 6f 20 73 63  dirname [info sc
00b0: 72 69 70 74 5d 5d 20 2e 2e 5d 5d 5d 0a 70 61 63  ript]] ..]]].pac
00c0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 74 6c 73  kage require tls
00d0: 0a 0a 70 72 6f 63 20 63 72 65 61 64 61 62 6c 65  ..proc creadable
00e0: 20 7b 73 7d 20 7b 0a 20 20 20 20 70 75 74 73 20   {s} {.    puts 
00f0: 22 4c 49 4e 45 3d 5b 67 65 74 73 20 24 73 5d 22  "LINE=[gets $s]"
0100: 0a 20 20 20 20 61 66 74 65 72 20 32 30 30 30 0a  .    after 2000.
0110: 20 20 20 20 66 69 6c 65 20 64 65 6c 65 74 65 20      file delete 
0120: 2d 66 6f 72 63 65 20 24 3a 3a 6b 65 79 66 69 6c  -force $::keyfil
0130: 65 0a 20 20 20 20 66 69 6c 65 20 64 65 6c 65 74  e.    file delet
0140: 65 20 2d 66 6f 72 63 65 20 24 3a 3a 63 65 72 74  e -force $::cert
0150: 66 69 6c 65 0a 20 20 20 20 65 78 69 74 0a 7d 0a  file.    exit.}.
0160: 0a 70 72 6f 63 20 6d 79 73 65 72 76 20 7b 73 20  .proc myserv {s 
0170: 61 72 67 73 7d 20 7b 0a 20 20 20 20 66 69 6c 65  args} {.    file
0180: 65 76 65 6e 74 20 24 73 20 72 65 61 64 61 62 6c  event $s readabl
0190: 65 20 5b 6c 69 73 74 20 63 72 65 61 64 61 62 6c  e [list creadabl
01a0: 65 20 24 73 5d 0a 7d 0a 0a 63 6c 6f 73 65 20 5b  e $s].}..close [
01b0: 66 69 6c 65 20 74 65 6d 70 66 69 6c 65 20 6b 65  file tempfile ke
01c0: 79 66 69 6c 65 20 6b 65 79 66 69 6c 65 5d 0a 63  yfile keyfile].c
01d0: 6c 6f 73 65 20 5b 66 69 6c 65 20 74 65 6d 70 66  lose [file tempf
01e0: 69 6c 65 20 63 65 72 74 66 69 6c 65 20 63 65 72  ile certfile cer
01f0: 74 66 69 6c 65 5d 0a 0a 74 6c 73 3a 3a 6d 69 73  tfile]..tls::mis
0200: 63 20 72 65 71 20 31 30 32 34 20 24 6b 65 79 66  c req 1024 $keyf
0210: 69 6c 65 20 24 63 65 72 74 66 69 6c 65 20 5b 6c  ile $certfile [l
0220: 69 73 74 20 43 20 43 43 43 20 53 54 20 53 54 54  ist C CCC ST STT
0230: 54 20 4c 20 4c 4c 4c 4c 20 4f 20 4f 4f 4f 4f 20  T L LLLL O OOOO 
0240: 4f 55 20 4f 55 55 55 55 20 43 4e 20 43 4e 4e 4e  OU OUUUU CN CNNN
0250: 4e 20 45 6d 61 69 6c 20 73 6f 6d 65 40 65 6d 61  N Email some@ema
0260: 69 6c 2e 63 6f 6d 20 64 61 79 73 20 37 33 30 20  il.com days 730 
0270: 73 65 72 69 61 6c 20 31 32 5d 0a 0a 74 6c 73 3a  serial 12]..tls:
0280: 3a 73 6f 63 6b 65 74 20 2d 6b 65 79 66 69 6c 65  :socket -keyfile
0290: 20 24 6b 65 79 66 69 6c 65 20 2d 63 65 72 74 66   $keyfile -certf
02a0: 69 6c 65 20 24 63 65 72 74 66 69 6c 65 20 2d 73  ile $certfile -s
02b0: 65 72 76 65 72 20 6d 79 73 65 72 76 20 31 32 33  erver myserv 123
02c0: 30 30 0a 0a 70 75 74 73 20 22 4e 6f 77 20 72 75  00..puts "Now ru
02d0: 6e 20 6b 65 79 74 65 73 74 32 2e 74 63 6c 22 0a  n keytest2.tcl".
02e0: 76 77 61 69 74 20 66 6f 72 65 76 65 72 0a 0a     vwait forever..