Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.libnetworkcache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
slapos.libnetworkcache
Commits
ba5d7f05
Commit
ba5d7f05
authored
Sep 04, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix regression where multiple certificates caused most of them to be ignored.
parent
b8b7d04f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
slapos/libnetworkcache.py
slapos/libnetworkcache.py
+7
-1
slapos/libnetworkcachetests.py
slapos/libnetworkcachetests.py
+36
-0
No files found.
slapos/libnetworkcache.py
View file @
ba5d7f05
...
@@ -110,7 +110,13 @@ class NetworkcacheClient(object):
...
@@ -110,7 +110,13 @@ class NetworkcacheClient(object):
self
.
signature_private_key_file
=
signature_private_key_file
self
.
signature_private_key_file
=
signature_private_key_file
if
type
(
signature_certificate_list
)
is
str
:
if
type
(
signature_certificate_list
)
is
str
:
self
.
signature_certificate_list
=
[
signature_certificate_list
]
# If signature_certificate_list is a string, parse it to a list of
# certificates
cert_marker
=
"-----BEGIN CERTIFICATE-----"
parsed_signature_certificate_list
=
[
cert_marker
+
'
\
n
'
+
q
.
strip
()
\
for
q
in
signature_certificate_list
.
split
(
cert_marker
)
\
if
q
.
strip
()]
self
.
signature_certificate_list
=
parsed_signature_certificate_list
else
:
else
:
self
.
signature_certificate_list
=
signature_certificate_list
self
.
signature_certificate_list
=
signature_certificate_list
...
...
slapos/libnetworkcachetests.py
View file @
ba5d7f05
...
@@ -269,6 +269,21 @@ MYZmKV7A3nFehN9A+REz+WU3I7fE6vQRh9jKeuxnQLRv0TdP9CEdPcYcs/EQpIDb
...
@@ -269,6 +269,21 @@ MYZmKV7A3nFehN9A+REz+WU3I7fE6vQRh9jKeuxnQLRv0TdP9CEdPcYcs/EQpIDb
-----END CERTIFICATE-----
-----END CERTIFICATE-----
"""
"""
alternate_certificate
=
""" -----BEGIN CERTIFICATE-----
MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE
CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5
MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl
ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF
AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw
boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX
Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA
ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX
mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC
q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g
QUUGLQ==
-----END CERTIFICATE-----
"""
ca_cert
=
"""-----BEGIN CERTIFICATE-----
ca_cert
=
"""-----BEGIN CERTIFICATE-----
MIID3zCCAsegAwIBAgIJAK6xwAnLgupDMA0GCSqGSIb3DQEBBQUAMIGFMQswCQYD
MIID3zCCAsegAwIBAgIJAK6xwAnLgupDMA0GCSqGSIb3DQEBBQUAMIGFMQswCQYD
VQQGEwJQTDENMAsGA1UECAwETGFrYTELMAkGA1UEBwwCVWwxEDAOBgNVBAoMB1Bh
VQQGEwJQTDENMAsGA1UECAwETGFrYTELMAkGA1UEBwwCVWwxEDAOBgNVBAoMB1Bh
...
@@ -436,6 +451,27 @@ class OnlineTest(OnlineMixin, unittest.TestCase):
...
@@ -436,6 +451,27 @@ class OnlineTest(OnlineMixin, unittest.TestCase):
result
=
signed_nc
.
select
(
key
)
result
=
signed_nc
.
select
(
key
)
self
.
assertEqual
(
result
.
read
(),
self
.
test_string
)
self
.
assertEqual
(
result
.
read
(),
self
.
test_string
)
def
test_select_signed_content_several_certificates
(
self
):
key
=
'somekey'
+
str
(
random
.
random
())
urlmd5
=
str
(
random
.
random
())
file_name
=
'my file'
test_data
=
tempfile
.
TemporaryFile
()
test_string
=
str
(
random
.
random
())
test_data
.
write
(
test_string
)
test_data
.
seek
(
0
)
key_file
=
tempfile
.
NamedTemporaryFile
()
key_file
.
write
(
self
.
key
)
key_file
.
flush
()
key_file
.
seek
(
0
)
signed_nc
=
slapos
.
libnetworkcache
.
NetworkcacheClient
(
self
.
shacache
,
self
.
shadir
,
key_file
.
name
,
[
self
.
alternate_certificate
,
self
.
certificate
])
signed_nc
.
upload
(
self
.
test_data
,
key
,
urlmd5
=
urlmd5
,
file_name
=
file_name
)
result
=
signed_nc
.
select
(
key
)
self
.
assertEqual
(
result
.
read
(),
self
.
test_string
)
def
test_select_signed_content_multiple
(
self
):
def
test_select_signed_content_multiple
(
self
):
key
=
'somekey'
+
str
(
random
.
random
())
key
=
'somekey'
+
str
(
random
.
random
())
urlmd5
=
str
(
random
.
random
())
urlmd5
=
str
(
random
.
random
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment