Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Minor revisions |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | 97565675272e5ddd05a1e7f233941803f4294b5b |
User & Date: | kevin 2019-10-14 02:48:02 |
Context
2019-10-16
| ||
06:15 | Fix breaking dylibs check-in: 418c1f4264 user: kevin tags: trunk | |
2019-10-14
| ||
02:48 | Minor revisions check-in: 9756567527 user: kevin tags: trunk | |
2019-08-25
| ||
02:26 | Fix URL processing check-in: 1dd379503a user: kevin tags: trunk | |
Changes
Added Manpower User Help.docx.
cannot compute difference between binary files
Changes to libs/manpower/manpower-main.tcl.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 ... 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 ... 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 |
#set up menu menu .mb #apple menu menu .mb.apple .mb.apple add command -label "About Manpower" -command tkAboutDialog .mb.apple add command -label "License" -command regproc::getReg .mb.apple add command -label "Check for Updates" -command "softwareupdate::checkVersion $appname::name $appname::version" .mb.apple add separator .mb add cascade -label "Manpower" -menu .mb.apple #man page menu menu .mb.man ................................................................................ after 50 .middle.left.tree selection set All set mynode All set searchterm {} set manitem {} after 500 regproc::readLic $appname::name $appname::version } proc changeImagesDark {} { foreach item [image names] { if {[image type $item] eq "bitmap"} { ................................................................................ } else { event generate . <<LightAqua>> } } #handle program shutdown via command-q proc ::tk::mac::Quit {} { exit } #command for services menu proc ::tk::mac::PerformService {} { global manitem |
< < < < | |
120 121 122 123 124 125 126 127 128 129 130 131 132 133 ... 947 948 949 950 951 952 953 954 955 956 957 958 959 960 ... 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 |
#set up menu menu .mb #apple menu menu .mb.apple .mb.apple add command -label "About Manpower" -command tkAboutDialog .mb.apple add command -label "Check for Updates" -command "softwareupdate::checkVersion $appname::name $appname::version" .mb.apple add separator .mb add cascade -label "Manpower" -menu .mb.apple #man page menu menu .mb.man ................................................................................ after 50 .middle.left.tree selection set All set mynode All set searchterm {} set manitem {} } proc changeImagesDark {} { foreach item [image names] { if {[image type $item] eq "bitmap"} { ................................................................................ } else { event generate . <<LightAqua>> } } #handle program shutdown via command-q proc ::tk::mac::Quit {} { regproc::makePitch } #command for services menu proc ::tk::mac::PerformService {} { global manitem |
Changes to libs/manpower/manpower.tcl.
1 2 3 |
package provide manpower 6.6
source [file join [file dirname [info script]] manpower-main.tcl]
|
| |
1 2 3 |
package provide manpower 7.0
source [file join [file dirname [info script]] manpower-main.tcl]
|
Changes to libs/manpower/pkgIndex.tcl.
1 2 3 |
package ifneeded manpower 6.6 [list source [file join $dir manpower.tcl]]
|
| |
1 2 3 |
package ifneeded manpower 7.0 [list source [file join $dir manpower.tcl]]
|
Changes to libs/regproc/pkgIndex.tcl.
4 5 6 7 8 9 10 11 |
# by a "package unknown" script. It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands. When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.
package ifneeded regproc 1.5 [list source [file join $dir regproc.tcl]]
|
| |
4 5 6 7 8 9 10 11 |
# by a "package unknown" script. It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands. When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.
package ifneeded regproc 1.6 [list source [file join $dir regproc.tcl]]
|
Changes to libs/regproc/regproc.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 .. 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 ... 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 |
#regproc.tcl routines to register serial numbers #Copyright 2015 WordTech Communications LLC #MIT license package provide regproc 1.5 package require http package require xplat image create bitmap _unlock -data { #define xbm_security_closed_32_width 32 #define xbm_security_closed_32_height 32 ................................................................................ variable library [file dirname [info script]] } variable datadir variable expired set expired 0 #set the 30-day clock for application/version proc setClock {} { variable datadir variable appname variable appversion variable appstore puts "datadir is $datadir" set launchTime [clock seconds] set saveTime [open $datadir/$appname$appversion.dat w] puts $saveTime $launchTime close $saveTime } #read the time set proc readClock {} { variable datadir variable appstatus variable expstatus variable appname variable appversion variable appstore variable expired set curTime [clock seconds] set oldTime [read [open $datadir/$appname$appversion.dat r]] set expDate [clock scan "30 days" -base $oldTime] if {$curTime < $expDate } { set expired 0 regproc::makePitch } else { set expired 1 regproc::expiredPitch } } #check to see if a time has been set proc checkClock {} { variable datadir variable appname variable appversion variable appstore variable expired if {[file exists $datadir/.$appname$appversion.rc]} { catch "file rename $datadir/.$appname$appversion.rc $datadir/$appname$appversion.dat" regproc::readClock return } if {![file exists $datadir/$appname$appversion.dat]} { regproc::setClock regproc::readClock } else { regproc::readClock } } #dialog before demo has expired proc makePitch {} { variable version variable appname variable appstore variable licensetitle set licensetitle "Purchase $appname" toplevel .purchase regproc::makeModal .purchase wm title .purchase $licensetitle wm resizable .purchase 0 0 wm withdraw .purchase wm transient .purchase . wm protocol .purchase WM_DELETE_WINDOW {} ttk::frame .purchase.top -padding 10 pack .purchase.top -side top -fill both -expand yes ttk::label .purchase.top.label -text "You are currently using a demo of $appname. This version will give you the chance to try \n$appname free of charge for 30 days. Would you like to buy $appname now?" -image _unlock -compound left -anchor n pack .purchase.top.label -side top -fill x -expand yes ttk::frame .purchase.bottom -padding 5 pack .purchase.bottom -side bottom -fill both -expand yes ttk::frame .purchase.bottom.upper pack .purchase.bottom.upper -side top -fill both -expand no ttk::frame .purchase.bottom.lower -padding 5 pack .purchase.bottom.lower -side bottom -fill both -expand no ttk::button .purchase.bottom.lower.install -text "Purchase" -default active -command "xplat::launch http://www.codebykevin.com/$appname.html; regproc::getReg; destroy .purchase" ttk::button .purchase.bottom.lower.cancel -text "Cancel" -command " destroy .purchase; raise ." pack .purchase.bottom.lower.install .purchase.bottom.lower.cancel -side right -fill both -expand no ::tk::PlaceWindow .purchase widget . wm deiconify .purchase focus .purchase.bottom.lower.install ................................................................................ after idle [list after 0 wm attributes .purchase -notify 1] bind all <FocusIn> [list wm attributes . -notify 0] } } #dialog after demo has expired proc expiredPitch {} { variable version variable appname variable appstore variable expired variable licensetitle set licensetitle "Purchase $appname" toplevel .expired regproc::makeModal .expired wm title .expired $licensetitle wm resizable .expired 0 0 wm withdraw .expired wm transient .expired . wm protocol .expired WM_DELETE_WINDOW {} ttk::frame .expired.top -padding 10 pack .expired.top -side top -fill both -expand yes ttk::label .expired.top.label -text "This demo of $appname is now expired. Would you like to buy $appname now?" -image _unlock -compound left -anchor n pack .expired.top.label -side top -fill x -expand yes ttk::frame .expired.bottom -padding 5 pack .expired.bottom -side bottom -fill both -expand yes ttk::frame .expired.bottom.upper pack .expired.bottom.upper -side top -fill both -expand no ttk::frame .expired.bottom.lower -padding 5 pack .expired.bottom.lower -side bottom -fill both -expand no ttk::button .expired.bottom.lower.install -text "Purchase" -default active -command "xplat::launch http://www.codebykevin.com/$appname.html; regproc::getReg; destroy .expired" ttk::button .expired.bottom.lower.cancel -text "Cancel" -command " destroy .expired; exit" pack .expired.bottom.lower.install .expired.bottom.lower.cancel -side right -fill both -expand no ::tk::PlaceWindow .expired widget . wm deiconify .expired focus .expired.bottom.lower.install if {[tk windowingsystem] eq "aqua"} { after idle [list after 0 wm attributes .expired -notify 1] bind all <FocusIn> [list wm attributes . -notify 0] } } #check for license, validate if found, set demo pitch if not found proc readLic {application version} { variable serial variable datadir variable appname variable appversion variable appstore set appname $application set appversion $version set datadir [xplat::appconfig $appname] if {[file exists $datadir/.lic] } { file rename $datadir/.lic $datadir/lic.dat } if {[file exists $datadir/lic.dat]} { set licnum [open $datadir/lic.dat r] set serial [read $licnum] close $licnum return } else { set serial "Demo" regproc::checkClock } } #write license to file proc setLic {} { variable serial variable serialbase variable datadir variable appname variable regwindow variable appstore variable expired if {$serial == ""} { tk_messageBox -icon warning -title "Incorrect Serial Number" -message "Incorrect Serial Number" -detail "Incorrect serial number. The application will exit now." -parent .number exit } set count 20000 for {set i 1} {$i < $count} {incr i 1} { lappend serialbase [string toupper $appname]-[expr $i * 5]-[expr $i/11]-[expr $i - 1]-[string toupper [string trim [string range $appname 0 1]]] } set output [lsearch -inline $serialbase $serial] puts $serial puts $output if {$output >= 0} { cd $datadir set lic [open $datadir/lic.dat w] puts $lic "$serial" close $lic grab release .number tk_messageBox -icon info -title "Thank You" -message "Thank You" -detail "Thank you for registering $appname." -parent .number destroy .number #display window that was hidden catch {wm deiconify .} } else { if {$expired == 1} { grab release .number tk_messageBox -icon warning -title "Incorrect Serial Number" -message "Incorrect Serial Number" -detail "Incorrect serial number. The application will exit now." -parent .number exit } grab release .number tk_messageBox -icon warning -title "Incorrect Serial Number" -message "Incorrect Serial Number" -detail "Incorrect serial number. Please try again." -parent .number regproc::getReg } } #generate license numbers proc genList {application} { variable appname variable regwindow variable appstore set appname $application set count 20000 for {set i 1} {$i < $count} {incr i 1} { lappend serialbase [string toupper $appname]-[expr $i * 5]-[expr $i/11]-[expr $i - 1]-[string toupper [string trim [string range $appname 0 1]]] } if [file exists $::env(HOME)/[list $appname]-list] { file delete $::env(HOME)/[list $appname]-list } foreach item $serialbase { split $item\n set keylist [open $::env(HOME)/[list $appname]-list a] puts $keylist $item close $keylist } } #dialog to input registration number from demo prompt proc getReg {} { variable serial variable regwindow variable appstore variable expired variable appname variable licensetitle set licensetitle "License" catch {destroy .number} toplevel .number wm title .number $licensetitle regproc::makeModal .number wm resizable .number 0 0 wm withdraw .number wm transient .number . wm protocol .number WM_DELETE_WINDOW {} ttk::frame .number.top -padding 10 pack .number.top -side top -fill both -expand yes ttk::label .number.top.label -text "Please enter your serial number for $appname\nin the field below:" -image _check -compound left -anchor n -padding 10 pack .number.top.label -side top -fill both -expand yes ttk::entry .number.top.entry -textvariable [namespace current]::serial pack .number.top.entry -side bottom -fill both -expand yes ttk::frame .number.bottom -padding 5 pack .number.bottom -side bottom -fill both -expand yes ttk::frame .number.bottom.upper pack .number.bottom.upper -side top -fill both -expand no ttk::frame .number.bottom.lower -padding 5 pack .number.bottom.lower -side bottom -fill both -expand no bind .number <Return> {grab release .number; regproc::setLic; raise .} ttk::button .number.bottom.lower.install -text "Register" -default active -command {grab release .number; regproc::setLic; raise .} ttk::button .number.bottom.lower.cancel -text "Cancel" -command "grab release .number; regproc::exitIfExpired; destroy .number; raise ." pack .number.bottom.lower.install .number.bottom.lower.cancel -side right -fill both -expand no ::tk::PlaceWindow .number widget . wm deiconify .number focus .number.bottom.lower.install if {[tk windowingsystem] eq "aqua"} { after idle [list after 0 wm attributes .number -notify 1] bind all <FocusIn> [list wm attributes . -notify 0] } } proc exitIfExpired {} { variable expired if {$expired == 1} { exit } } proc makeModal {w} { variable licensetitle if {[tk windowingsystem] eq "aqua" } { destroy $w; toplevel $w; tk::unsupported::MacWindowStyle style $w modal; wm title $w $licensetitle } if {[tk windowingsystem] eq "win32"} { |
| < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > | | | | < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 .. 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ... 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
#regproc.tcl routines to register serial numbers #Copyright 2015 WordTech Communications LLC #MIT license package provide regproc 1.6 package require xplat image create bitmap _unlock -data { #define xbm_security_closed_32_width 32 #define xbm_security_closed_32_height 32 ................................................................................ variable library [file dirname [info script]] } variable datadir variable expired set expired 0 #dialog to request donation proc makePitch {} { variable version variable appname variable appstore variable licensetitle set licensetitle "Support Our Work" toplevel .purchase regproc::makeModal .purchase wm title .purchase $licensetitle wm resizable .purchase 0 0 wm withdraw .purchase wm transient .purchase . wm protocol .purchase WM_DELETE_WINDOW {} ttk::frame .purchase.top -padding 10 pack .purchase.top -side top -fill both -expand yes ttk::label .purchase.top.label -text "SUPPORT OUR WORK\n\nDeveloping free and open source software is not free.\nWould you support the development of this application\nwith a single or recurring donation?" -image _check -compound left -anchor n pack .purchase.top.label -side top -fill x -expand yes ttk::frame .purchase.bottom -padding 5 pack .purchase.bottom -side bottom -fill both -expand yes ttk::frame .purchase.bottom.upper pack .purchase.bottom.upper -side top -fill both -expand no ttk::frame .purchase.bottom.lower -padding 5 pack .purchase.bottom.lower -side bottom -fill both -expand no ttk::button .purchase.bottom.lower.install -text "Donate" -default active -command "xplat::launch https://liberapay.com/codebykevin/donate; exit" ttk::button .purchase.bottom.lower.cancel -text "Later" -command "exit" pack .purchase.bottom.lower.install .purchase.bottom.lower.cancel -side right -fill both -expand no ::tk::PlaceWindow .purchase widget . wm deiconify .purchase focus .purchase.bottom.lower.install ................................................................................ after idle [list after 0 wm attributes .purchase -notify 1] bind all <FocusIn> [list wm attributes . -notify 0] } } proc makeModal {w} { variable licensetitle if {[tk windowingsystem] eq "aqua" } { destroy $w; toplevel $w; tk::unsupported::MacWindowStyle style $w modal; wm title $w $licensetitle } if {[tk windowingsystem] eq "win32"} { |
Added libs/tcltls1.7.19/pkgIndex.tcl.
> > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
if {[package vsatisfies [package present Tcl] 8.5]} { package ifneeded tls 1.7.19 [list apply {{dir} { if {{shared} eq "static"} { load {} Tls } else { load [file join $dir tcltls.dylib] Tls } set tlsTclInitScript [file join $dir tls.tcl] if {[file exists $tlsTclInitScript]} { source $tlsTclInitScript } }} $dir] } elseif {[package vsatisfies [package present Tcl] 8.4]} { package ifneeded tls 1.7.19 [list load [file join $dir tcltls.dylib] Tls] } |
Added libs/tcltls1.7.19/tcltls.dylib.
cannot compute difference between binary files
Deleted libs/tls1.6.7/libtls1.6.7.dylib.
cannot compute difference between binary files
Deleted libs/tls1.6.7/pkgIndex.tcl.
1 |
package ifneeded tls 1.6.7 "[list source [file join $dir tls.tcl]] ; [list tls::initlib $dir libtls1.6.7.dylib]"
|
< |
Deleted libs/tls1.6.7/tls.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# # Copyright (C) 1997-2000 Matt Newman <matt@novadigm.com> # # $Header: /cvsroot/tls/tls/tls.tcl,v 1.14 2015/07/07 17:16:03 andreas_kupries Exp $ # namespace eval tls { variable logcmd tclLog variable debug 0 # Default flags passed to tls::import variable defaults {} # Maps UID to Server Socket variable srvmap variable srvuid 0 # Over-ride this if you are using a different socket command variable socketCmd if {![info exists socketCmd]} { set socketCmd [info command ::socket] } } proc tls::initlib {dir dll} { # Package index cd's into the package directory for loading. # Irrelevant to unixoids, but for Windows this enables the OS to find # the dependent DLL's in the CWD, where they may be. set cwd [pwd] catch {cd $dir} if {[string equal $::tcl_platform(platform) "windows"] && ![string equal [lindex [file system $dir] 0] "native"]} { # If it is a wrapped executable running on windows, the openssl # dlls must be copied out of the virtual filesystem to the disk # where Windows will find them when resolving the dependency in # the tls dll. We choose to make them siblings of the executable. package require starkit set dst [file nativename [file dirname $starkit::topdir]] foreach sdll [glob -nocomplain -directory $dir -tails *eay32.dll] { catch {file delete -force $dst/$sdll} catch {file copy -force $dir/$sdll $dst/$sdll} } } set res [catch {uplevel #0 [list load [file join [pwd] $dll]]} err] catch {cd $cwd} if {$res} { namespace eval [namespace parent] {namespace delete tls} return -code $res $err } rename tls::initlib {} } # # Backwards compatibility, also used to set the default # context options # proc tls::init {args} { variable defaults set defaults $args } # # Helper function - behaves exactly as the native socket command. # proc tls::socket {args} { variable socketCmd variable defaults set idx [lsearch $args -server] if {$idx != -1} { set server 1 set callback [lindex $args [expr {$idx+1}]] set args [lreplace $args $idx [expr {$idx+1}]] set usage "wrong # args: should be \"tls::socket -server command ?options? port\"" set options "-cadir, -cafile, -certfile, -cipher, -command, -dhparams, -keyfile, -myaddr, -password, -request, -require, -servername, -ssl2, -ssl3, -tls1, -tls1.1 or -tls1.2" } else { set server 0 set usage "wrong # args: should be \"tls::socket ?options? host port\"" set options "-async, -cadir, -cafile, -certfile, -cipher, -command, -dhparams, -keyfile, -myaddr, -myport, -password, -request, -require, -servername, -ssl2, -ssl3, -tls1, -tls1.1 or -tls1.2" } set argc [llength $args] set sopts {} set iopts [concat [list -server $server] $defaults] ;# Import options for {set idx 0} {$idx < $argc} {incr idx} { set arg [lindex $args $idx] switch -glob -- $server,$arg { 0,-async {lappend sopts $arg} 0,-myport - *,-type - *,-myaddr {lappend sopts $arg [lindex $args [incr idx]]} *,-cadir - *,-cafile - *,-certfile - *,-cipher - *,-command - *,-dhparams - *,-keyfile - *,-password - *,-request - *,-require - *,-servername - *,-ssl2 - *,-ssl3 - *,-tls1 - *,-tls1.1 - *,-tls1.2 {lappend iopts $arg [lindex $args [incr idx]]} -* {return -code error "bad option \"$arg\": must be one of $options"} default {break} } } if {$server} { if {($idx + 1) != $argc} { return -code error $usage } set uid [incr ::tls::srvuid] set port [lindex $args [expr {$argc-1}]] lappend sopts $port #set sopts [linsert $sopts 0 -server $callback] set sopts [linsert $sopts 0 -server [list tls::_accept $iopts $callback]] #set sopts [linsert $sopts 0 -server [list tls::_accept $uid $callback]] } else { if {($idx + 2) != $argc} { return -code error $usage } set host [lindex $args [expr {$argc-2}]] set port [lindex $args [expr {$argc-1}]] lappend sopts $host $port } # # Create TCP/IP socket # set chan [eval $socketCmd $sopts] if {!$server && [catch { # # Push SSL layer onto socket # eval [list tls::import] $chan $iopts } err]} { set info ${::errorInfo} catch {close $chan} return -code error -errorinfo $info $err } return $chan } # tls::_accept -- # # This is the actual accept that TLS sockets use, which then calls # the callback registered by tls::socket. # # Arguments: # iopts tls::import opts # callback server callback to invoke # chan socket channel to accept/deny # ipaddr calling IP address # port calling port # # Results: # Returns an error if the callback throws one. # proc tls::_accept { iopts callback chan ipaddr port } { log 2 [list tls::_accept $iopts $callback $chan $ipaddr $port] set chan [eval [list tls::import $chan] $iopts] lappend callback $chan $ipaddr $port if {[catch { uplevel #0 $callback } err]} { log 1 "tls::_accept error: ${::errorInfo}" close $chan error $err $::errorInfo $::errorCode } else { log 2 "tls::_accept - called \"$callback\" succeeded" } } # # Sample callback for hooking: - # # error # verify # info # proc tls::callback {option args} { variable debug #log 2 [concat $option $args] switch -- $option { "error" { foreach {chan msg} $args break log 0 "TLS/$chan: error: $msg" } "verify" { # poor man's lassign foreach {chan depth cert rc err} $args break array set c $cert if {$rc != "1"} { log 1 "TLS/$chan: verify/$depth: Bad Cert: $err (rc = $rc)" } else { log 2 "TLS/$chan: verify/$depth: $c(subject)" } if {$debug > 0} { return 1; # FORCE OK } else { return $rc } } "info" { # poor man's lassign foreach {chan major minor state msg} $args break if {$msg != ""} { append state ": $msg" } # For tracing upvar #0 tls::$chan cb set cb($major) $minor log 2 "TLS/$chan: $major/$minor: $state" } default { return -code error "bad option \"$option\":\ must be one of error, info, or verify" } } } proc tls::xhandshake {chan} { upvar #0 tls::$chan cb if {[info exists cb(handshake)] && \ $cb(handshake) == "done"} { return 1 } while {1} { vwait tls::${chan}(handshake) if {![info exists cb(handshake)]} { return 0 } if {$cb(handshake) == "done"} { return 1 } } } proc tls::password {} { log 0 "TLS/Password: did you forget to set your passwd!" # Return the worlds best kept secret password. return "secret" } proc tls::log {level msg} { variable debug variable logcmd if {$level > $debug || $logcmd == ""} { return } set cmd $logcmd lappend cmd $msg uplevel #0 $cmd } |
< < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |