/usr/lib/python3/dist-packages/SRS/Reversible.py is in python3-srs 1.0.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # $Log$
# Revision 1.1.1.1 2005/06/03 04:13:18 customdesigned
# Initial import
#
# Revision 1.1.1.1 2004/03/19 05:23:13 stuart
# Import to CVS
#
#
# AUTHOR
# Shevek
# CPAN ID: SHEVEK
# cpan@anarres.org
# http://www.anarres.org/projects/
#
# Translated to Python by stuart@bmsi.com
# http://bmsi.com/python/milter.html
#
# Portions Copyright (c) 2004 Shevek. All rights reserved.
# Portions Copyright (c) 2004 Business Management Systems. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the same terms as Python itself.
import SRS
from .Shortcut import Shortcut
class Reversible(Shortcut):
"""A fully reversible Sender Rewriting Scheme
See SRS for details of the standard SRS subclass interface.
This module provides the methods compile() and parse(). It operates
without store."""
def compile(self,sendhost,senduser,srshost=None):
timestamp = self.timestamp_create()
# This has to be done in compile, because we might need access
# to it for storing in a database.
hash = self.hash_create(timestamp.encode(),sendhost.encode(),senduser.encode())
if sendhost == srshost:
sendhost = ''
# Note that there are 4 fields here and that sendhost may
# not contain a + sign. Therefore, we do not need to escape
# + signs anywhere in order to reverse this transformation.
return SRS.SRS0TAG + self.separator + \
SRS.SRSSEP.join((hash.decode(),timestamp,sendhost,senduser))
|