Overview
Comment: | Add support for cross-checking the package script language against the current language when processing requests from the 'package unknown' handler. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ece3bff7e2ffc194a015366ca93b4a2f |
User & Date: | mistachkin on 2016-08-17 02:16:56 |
Other Links: | manifest | tags |
Context
2016-08-17
| ||
02:27 | Adjust comments. check-in: 607e185516 user: mistachkin tags: trunk | |
02:16 | Add support for cross-checking the package script language against the current language when processing requests from the 'package unknown' handler. check-in: ece3bff7e2 user: mistachkin tags: trunk | |
01:36 | Minor revisions to coding style. check-in: 2048f9a7cd user: mistachkin tags: trunk | |
Changes
Modified client/pkgr.eagle from [d592229ee6] to [7467b52bc0].
︙ | ︙ | |||
250 251 252 253 254 255 256 | # # NOTE: The code must be the literal string "OK" for the package lookup # request to be considered successful. # return [expr {$code eq "OK"}] } | | > > | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | # # NOTE: The code must be the literal string "OK" for the package lookup # request to be considered successful. # return [expr {$code eq "OK"}] } proc extractAndVerifyLookupMetadata { result varName caller } { variable strictUnknownLanguage # # NOTE: Grab the language for the package script. It must be an empty # string, "Tcl", or "Eagle". If it is an empty string, "Eagle" # will be assumed. # set language [getDictionaryValue $result Language] |
︙ | ︙ | |||
283 284 285 286 287 288 289 290 291 292 293 294 295 296 | # this client. In that case, just raise an error. # set certificate [getDictionaryValue $result Certificate] if {[string length $certificate] == 0} then { error "missing script certificate" } # # NOTE: If the caller wants the package metadata, use the array variable # name they specified. # if {[string length $varName] > 0} then { upvar 1 $varName metadata | > > > > > > > > > > > > > > > > > > > > > | 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 | # this client. In that case, just raise an error. # set certificate [getDictionaryValue $result Certificate] if {[string length $certificate] == 0} then { error "missing script certificate" } # # NOTE: Are we being called from the [package unknown] handler # in "strict" mode? # if {$strictUnknownLanguage && $caller eq "handler"} then { # # NOTE: If so, the package script must be targeted at the this # language; otherwise, there is no way that the package # will actually be provided to this language. # if {[isEagle]} then { if {$language ne "Eagle"} then { error "repository package is not for Eagle" } } else { if {$language ne "Tcl"} then { error "repository package is not for Tcl" } } } # # NOTE: If the caller wants the package metadata, use the array variable # name they specified. # if {[string length $varName] > 0} then { upvar 1 $varName metadata |
︙ | ︙ | |||
739 740 741 742 743 744 745 | # Eagle does not add a version argument when one is not supplied to # the [package require] sub-command itself. # proc packageUnknownHandler { package {version ""} } { # # NOTE: First, run our [package unknown] handler. # | | | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | # Eagle does not add a version argument when one is not supplied to # the [package require] sub-command itself. # proc packageUnknownHandler { package {version ""} } { # # NOTE: First, run our [package unknown] handler. # if {[catch {main $package $version handler} error(1)] == 0} then { # # NOTE: The repository [package unknown] handler succeeded, run the # saved [package unknown] handler. # if {[catch { runSavedPackageUnknownHandler $package $version } error(2)] == 0} then { |
︙ | ︙ | |||
855 856 857 858 859 860 861 | # downloaded package scripts. # variable pgpCommand; # DEFAULT: gpg2 --verify {${fileName}} if {![info exists pgpCommand]} then { set pgpCommand {gpg2 --verify {${fileName}}} } | | | > > > > > > > > > > | | 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 | # downloaded package scripts. # variable pgpCommand; # DEFAULT: gpg2 --verify {${fileName}} if {![info exists pgpCommand]} then { set pgpCommand {gpg2 --verify {${fileName}}} } # # NOTE: Verify that the package script matches the current language # when called from the [package unknown] handler? # variable strictUnknownLanguage; # DEFAULT: true if {![info exists strictUnknownLanguage]} then { set strictUnknownLanguage true } } proc main { package version caller } { # # NOTE: Issue the lookup request to the remote package repository. # set data [getLookupData \ [getLookupApiKey] $package [getLookupVersion $version]] # |
︙ | ︙ | |||
900 901 902 903 904 905 906 | } } # # NOTE: Process the lookup data into the pieces of metadata that we # need to load the requested package. # | | | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | } } # # NOTE: Process the lookup data into the pieces of metadata that we # need to load the requested package. # extractAndVerifyLookupMetadata $result metadata $caller # # NOTE: Attempt to load the requested package using the metadata # extracted in the previous step. # processLookupMetadata metadata } |
︙ | ︙ |
Modified client/pkgr.eagle.harpy from [be0ab1da26] to [4d8ccd6fd7].
︙ | ︙ | |||
17 18 19 20 21 22 23 | THE ASSOCIATED SOFTWARE MAY NOT WORK PROPERLY IF THIS FILE IS ALTERED. --> <Certificate xmlns="https://eagle.to/2011/harpy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Protocol>None</Protocol> <Vendor>Mistachkin Systems</Vendor> | | | | | | | | | | | | | | | | | | | | | | 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 | THE ASSOCIATED SOFTWARE MAY NOT WORK PROPERLY IF THIS FILE IS ALTERED. --> <Certificate xmlns="https://eagle.to/2011/harpy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Protocol>None</Protocol> <Vendor>Mistachkin Systems</Vendor> <Id>c264eab7-8a66-498a-9cbf-d1bc078e075c</Id> <HashAlgorithm>SHA512</HashAlgorithm> <EntityType>Script</EntityType> <TimeStamp>2016-08-17T02:10:26.4997578Z</TimeStamp> <Duration>-1.00:00:00</Duration> <Key>0x2c322765603b5278</Key> <Signature> UMrsDb3SQIF8pYU1f9Da5okCuUVDk0WRw6y6mRyVnWw86Ng1+F//DRZNhrbJbP6gaXFfhE5GcXwX kn8/IHWNeiKvGd8v2pS0DkidpvJlJT5uT8CjQWnB5lhSmNM5NEv6r/0/VdsDptYlX6tkiy9w5rwn PP9CfqUlf9hVNEGS/WAq4tLp8trXseQHg1orVQxdKTrWpCg35flcvhTRZ+v8I29uBqbInJz+7Ob8 XICK6fOZD/tkLzUqmd4+5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