From 9d6890eac7e380f01ee0177fd9b3a73ac3716b8a Mon Sep 17 00:00:00 2001 From: Marcel Waldvogel Date: Tue, 22 Feb 2022 17:15:05 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Hotfix=20for=20workaround?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 12 ++++++- tests/50-mailtest.py | 71 +++++++++++++++++++------------------ zeitgitter/__init__.py | 3 +- zeitgitter/commit.py | 2 +- zeitgitter/config.py | 2 +- zeitgitter/mail.py | 4 +-- zeitgitter/server.py | 2 +- zeitgitter/stamper.py | 13 ++++--- zeitgitter/version.py | 4 +-- zeitgitter/web/contact.html | 6 ++-- zeitgitter/web/index.html | 2 +- zeitgitter/web/privacy.html | 40 +++++++++++++-------- zeitgitter/web/tos.html | 70 ++++++++++++++++++++---------------- 13 files changed, 133 insertions(+), 98 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9860a2..3d56a15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/). -# 1.1.4 - 2022-02-20 +# 1.1.5 - 2022-02-23 + +## Added + +## Fixed + +- Hotfix: Bug in workaround from 1.1.4 + +## Changed + +# 1.1.4 - 2022-02-22 ## Added diff --git a/tests/50-mailtest.py b/tests/50-mailtest.py index 9c80441..86a3a56 100755 --- a/tests/50-mailtest.py +++ b/tests/50-mailtest.py @@ -2,7 +2,7 @@ # # zeitgitterd — Independent GIT Timestamping, HTTPS server # -# Copyright (C) 2019-2021 Marcel Waldvogel +# Copyright (C) 2019-2022 Marcel Waldvogel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published @@ -20,6 +20,9 @@ # Test mail sending +import zeitgitter.mail +import zeitgitter.stamper +import zeitgitter.config from datetime import datetime, timezone import os from pathlib import Path @@ -31,27 +34,24 @@ import sys sys.path.append('.') -import zeitgitter.config -import zeitgitter.stamper -import zeitgitter.mail def mailtest(): - tmpdir = tempfile.TemporaryDirectory() - zeitgitter.config.get_args(args=[ - '-c', 'tests/mailtest.conf', - '--debug', '2', - '--gnupg-home', - str(Path(os.path.dirname(os.path.realpath(__file__)), - 'gnupg')), - '--keyid', '353DFEC512FA47C7', - '--own-url', 'https://hagrid.snakeoil', - '--contact', '?', - '--owner', '?', - '--country', '?', - '--max-parallel-timeout', '1', - '--repository', tmpdir.name, - ]) - zeitgitter.mail.send('''Stamper is a service provided free of charge to Internet users. + tmpdir = tempfile.TemporaryDirectory() + zeitgitter.config.get_args(args=[ + '-c', 'tests/mailtest.conf', + '--debug', '2', + '--gnupg-home', + str(Path(os.path.dirname(os.path.realpath(__file__)), + 'gnupg')), + '--keyid', '353DFEC512FA47C7', + '--own-url', 'https://hagrid.snakeoil', + '--contact', '?', + '--owner', '?', + '--country', '?', + '--max-parallel-timeout', '1', + '--repository', tmpdir.name, + ]) + zeitgitter.mail.send('''Stamper is a service provided free of charge to Internet users. You are very welcome to use Stamper, but you may only do so if you have first read our Terms of use, which exclude liability on @@ -102,9 +102,9 @@ def mailtest(): -----END PGP SIGNATURE----- ''') - p = Path(zeitgitter.config.arg.repository, 'hashes.log') - with open(p, 'w') as f: - f.write('''40324f75a41642f1abf9cf9305f46aa6bfa567e2 + p = Path(zeitgitter.config.arg.repository, 'hashes.log') + with open(p, 'w') as f: + f.write('''40324f75a41642f1abf9cf9305f46aa6bfa567e2 73abac26438e48d2af7476f564b97a7baba14645 3f4f63f7dde84822b24e348fd16d50b0aec93fb9 4cd7b8798a6e4c0a9c76ade2b6041b8e1a779458 @@ -113,18 +113,19 @@ def mailtest(): 303cc43ce91547a89daea16c7a695d9896585f17 fa94ffe675454658bd11219693d60844b995a74d ''') - ftime = datetime(year=2019, month=3, day=11, - hour=16, minute=55, second=0, - tzinfo=timezone.utc).timestamp() - os.utime(p, times=(ftime, ftime)) - subprocess.run(['git', 'init'], - cwd=zeitgitter.config.arg.repository).check_returncode() - subprocess.run(['git', 'add', 'hashes.log'], - cwd=zeitgitter.config.arg.repository).check_returncode() - subprocess.run(['git', 'commit', '-m', "First commit"], - cwd=zeitgitter.config.arg.repository).check_returncode() - repo = git.Repository(zeitgitter.config.arg.repository) - zeitgitter.mail.wait_for_receive(repo, repo.head, p) + ftime = datetime(year=2019, month=3, day=11, + hour=16, minute=55, second=0, + tzinfo=timezone.utc).timestamp() + os.utime(p, times=(ftime, ftime)) + subprocess.run(['git', 'init'], + cwd=zeitgitter.config.arg.repository).check_returncode() + subprocess.run(['git', 'add', 'hashes.log'], + cwd=zeitgitter.config.arg.repository).check_returncode() + subprocess.run(['git', 'commit', '-m', "First commit"], + cwd=zeitgitter.config.arg.repository).check_returncode() + repo = git.Repository(zeitgitter.config.arg.repository) + zeitgitter.mail.wait_for_receive(repo, repo.head, p) + if os.path.isfile('tests/mailtest.conf'): mailtest() diff --git a/zeitgitter/__init__.py b/zeitgitter/__init__.py index 5d953db..a939ce8 100644 --- a/zeitgitter/__init__.py +++ b/zeitgitter/__init__.py @@ -2,7 +2,7 @@ # # zeitgitterd — Independent GIT Timestamping, HTTPS server # -# Copyright (C) 2019-2021 Marcel Waldvogel +# Copyright (C) 2019-2022 Marcel Waldvogel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published @@ -20,5 +20,6 @@ import os + def moddir(to=''): return os.path.join(__path__[0], to) diff --git a/zeitgitter/commit.py b/zeitgitter/commit.py index 62ee86c..b169c9b 100644 --- a/zeitgitter/commit.py +++ b/zeitgitter/commit.py @@ -2,7 +2,7 @@ # # zeitgitterd — Independent GIT Timestamping, HTTPS server # -# Copyright (C) 2019-2021 Marcel Waldvogel +# Copyright (C) 2019-2022 Marcel Waldvogel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published diff --git a/zeitgitter/config.py b/zeitgitter/config.py index 89a1a92..a5e3db4 100644 --- a/zeitgitter/config.py +++ b/zeitgitter/config.py @@ -2,7 +2,7 @@ # # zeitgitter — Independent GIT Timestamping, HTTPS server # -# Copyright (C) 2019-2021 Marcel Waldvogel +# Copyright (C) 2019-2022 Marcel Waldvogel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published diff --git a/zeitgitter/mail.py b/zeitgitter/mail.py index 148e2ba..5e68d07 100644 --- a/zeitgitter/mail.py +++ b/zeitgitter/mail.py @@ -2,7 +2,7 @@ # # zeitgitterd — Independent GIT Timestamping, HTTPS server # -# Copyright (C) 2019-2021 Marcel Waldvogel +# Copyright (C) 2019-2022 Marcel Waldvogel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published @@ -308,7 +308,7 @@ def check_for_stamper_mail(imap, stat, logfile): f"#bodies+1={len(contents)}, #msgids={len(remaining_msgids)}") for m in contents: if m != b')': - if len(msgid) == 0: + if len(remaining_msgids) == 0: logging.error( f"More bodies returned ({len(contents)}) than requested ({len(mseq.split(b','))})") msgid = "99999999999" diff --git a/zeitgitter/server.py b/zeitgitter/server.py index 3444a39..e40b16c 100644 --- a/zeitgitter/server.py +++ b/zeitgitter/server.py @@ -2,7 +2,7 @@ # # zeitgitterd — Independent GIT Timestamping, HTTPS server # -# Copyright (C) 2019-2021 Marcel Waldvogel +# Copyright (C) 2019-2022 Marcel Waldvogel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published diff --git a/zeitgitter/stamper.py b/zeitgitter/stamper.py index e17f0d2..f3a0c72 100644 --- a/zeitgitter/stamper.py +++ b/zeitgitter/stamper.py @@ -2,7 +2,7 @@ # # zeitgitterd — Independent GIT Timestamping, HTTPS server # -# Copyright (C) 2019-2021 Marcel Waldvogel +# Copyright (C) 2019-2022 Marcel Waldvogel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published @@ -133,7 +133,8 @@ def gpg(self): Create one, if less than `number-of-gpg-agents` are available.""" with self.gpg_serialize: if len(self.gpgs) < self.max_threads: - home = Path('%s-%d' % (zeitgitter.config.arg.gnupg_home, len(self.gpgs))) + home = Path('%s-%d' % + (zeitgitter.config.arg.gnupg_home, len(self.gpgs))) # Create copy if needed; to trick an additional gpg-agent # being started for the same directory if home.exists(): @@ -152,7 +153,8 @@ def gpg(self): home, ignore=shutil.ignore_patterns("S.*", "*~")) nextgpg = gnupg.GPG(gnupghome=home.as_posix()) self.gpgs.append(nextgpg) - logging.debug("Returning new %r (gnupghome=%s)" % (nextgpg, nextgpg.gnupghome)) + logging.debug("Returning new %r (gnupghome=%s)" % + (nextgpg, nextgpg.gnupghome)) return nextgpg else: # Rotate list left and return element wrapped around (if the list @@ -160,7 +162,8 @@ def gpg(self): nextgpg = self.gpgs[0] self.gpgs = self.gpgs[1:] self.gpgs.append(nextgpg) - logging.debug("Returning old %r (gnupghome=%s)" % (nextgpg, nextgpg.gnupghome)) + logging.debug("Returning old %r (gnupghome=%s)" % + (nextgpg, nextgpg.gnupghome)) return nextgpg def sig_time(self): @@ -227,7 +230,7 @@ def stamp_tag(self, commit, tagname): :watch: %s tag timestamp """ % (commit, tagname, self.fullid, now, - self.url) + self.url) sig = self.limited_sign(now, commit, tagobj) if sig == None: diff --git a/zeitgitter/version.py b/zeitgitter/version.py index 16a5c62..9783e7a 100644 --- a/zeitgitter/version.py +++ b/zeitgitter/version.py @@ -2,7 +2,7 @@ # # zeitgitterd — Independent GIT Timestamping, HTTPS server # -# Copyright (C) 2019-2021 Marcel Waldvogel +# Copyright (C) 2019-2022 Marcel Waldvogel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published @@ -18,4 +18,4 @@ # along with this program. If not, see . # -VERSION = '1.1.4' +VERSION = '1.1.5' diff --git a/zeitgitter/web/contact.html b/zeitgitter/web/contact.html index bb328ee..a894b27 100644 --- a/zeitgitter/web/contact.html +++ b/zeitgitter/web/contact.html @@ -8,7 +8,7 @@