Commit ef9bec3c authored by Lucas Carvalho's avatar Lucas Carvalho

Sorry, _MARKER is not overkill, so it have to be added again.

Well, _MARKER is used to backward compatibility and to raise an error
which if the networkcache server is not consistenty.

Without _MARKER there is not way to make these conditions.
parent 8cc8112f
......@@ -24,6 +24,9 @@ import urlparse
import M2Crypto
_MARKER = ([], [''], None, '')
class NetworkcacheClient(object):
'''
NetworkcacheClient is a wrapper for httplib.
......@@ -172,11 +175,14 @@ class NetworkcacheClient(object):
# Filtering...
data_list = json.loads(data)
if len(data_list) > 1 and self.signature_certificate_file_list in _MARKER:
if len(data_list) > 1 and not \
(self.signature_certificate_file_list in _MARKER or \
self.signature_certificate_url_list in _MARKER):
raise DirectoryNotFound('Too many entries for a given directory. ' \
'Directory: %s. Entries: %s.' % (directory_key, str(data_list)))
if self.signature_certificate_file_list not in _MARKER:
if self.signature_certificate_file_list not in _MARKER or \
self.signature_certificate_url_list not in _MARKER:
method = self._verifySignatureInCertificateList
data_list = filter(lambda x: method(x[1]), data_list)
if len(data_list) > 1:
......@@ -194,7 +200,7 @@ class NetworkcacheClient(object):
"""
Return the signature based on certification file.
"""
if self.signature_private_key_file is None:
if self.signature_private_key_file in _MARKER:
return ''
SignEVP = M2Crypto.EVP.load_key(self.signature_private_key_file)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment