mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-10 11:00:22 +00:00
Moved shared errors out to new module.
This commit is contained in:
parent
1ed42f97c1
commit
873fed5a28
8
ugly_hacks/santiago/errors.py
Normal file
8
ugly_hacks/santiago/errors.py
Normal file
@ -0,0 +1,8 @@
|
||||
class SignatureError(Exception):
|
||||
pass
|
||||
|
||||
class InvalidSignatureError(SignatureError):
|
||||
pass
|
||||
|
||||
class UnwillingHostError(SignatureError):
|
||||
pass
|
||||
@ -77,9 +77,10 @@ locations::
|
||||
|
||||
import cfg
|
||||
from collections import defaultdict as DefaultDict
|
||||
from errors import InvalidSignatureError, UnwillingHostError
|
||||
import gnupg
|
||||
import logging
|
||||
from pgpprocessor import PgpUnwrapper
|
||||
from pgpprocessor import Unwrapper
|
||||
import re
|
||||
import sys
|
||||
|
||||
@ -302,9 +303,12 @@ class SimpleSantiago(object):
|
||||
def unpack_request(self, kwargs):
|
||||
"""Decrypt and verify the request.
|
||||
|
||||
Raise an (unhandled) error if there're any inconsistencies in the
|
||||
Raise an (unhandled?) error if there're any inconsistencies in the
|
||||
message.
|
||||
|
||||
I realize the following is a bit complicated, but this is the only way
|
||||
we've yet found to avoid bug (####, in Tor).
|
||||
|
||||
The message is wrapped in up to three ways:
|
||||
|
||||
1. The outermost signature: This layer is applied to the message by the
|
||||
@ -332,7 +336,7 @@ class SimpleSantiago(object):
|
||||
in that case, it must be ignored.
|
||||
|
||||
"""
|
||||
request = PgpUnwrapper(str(kwargs["request"]), gpg=self.gpg)
|
||||
request = Unwrapper(str(kwargs["request"]), gpg=self.gpg)
|
||||
|
||||
proxied_request = self.verify_sender(request.next())
|
||||
encrypted_body = dict(self.verify_client(request.next()))
|
||||
@ -548,15 +552,6 @@ class SantiagoSender(SantiagoConnector):
|
||||
raise Exception(
|
||||
"santiago.SantiagoSender.outgoing_request not implemented.")
|
||||
|
||||
class SignatureError(Exception):
|
||||
pass
|
||||
|
||||
class InvalidSignatureError(SignatureError):
|
||||
pass
|
||||
|
||||
class UnwillingHostError(SignatureError):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# FIXME: convert this to the withsqlite setup.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user