Skip to content

Commit 5d18c50

Browse files
committed
pykeepass: Update to 4.0.7.post1
We also update the patch with commit actually merged as part of libkeepass/pykeepass#388.
1 parent a2d0db9 commit 5d18c50

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,54 @@
1-
From fca73313b77d2c8ea32db8b21858745500c334ec Mon Sep 17 00:00:00 2001
2-
From: Jan-Michael Brummer <jan[email protected]>
3-
Date: Tue, 26 Mar 2024 10:27:48 +0100
4-
Subject: [PATCH] Fix composite key computation for BytesIO
1+
From c67b8cfdd51d60b8ef479bfbdf064f54fe593ae8 Mon Sep 17 00:00:00 2001
2+
From: Jan-Michael Brummer <jan[email protected]>
3+
Date: Tue, 9 Apr 2024 21:58:09 +0200
4+
Subject: [PATCH] Fix composite key computation for BytesIO (#388)
55

66
In case a keyfile as BytesIO has been read before, the
77
next read will be empty. We need to ensure that we
88
are reading the data from the beginning.
99

1010
Add seek to start to fix it.
11+
12+
Co-authored-by: Jan-Michael Brummer <[email protected]>
1113
---
12-
pykeepass/kdbx_parsing/common.py | 9 ++++++++-
13-
1 file changed, 8 insertions(+), 1 deletion(-)
14+
pykeepass/kdbx_parsing/common.py | 6 ++++--
15+
1 file changed, 4 insertions(+), 2 deletions(-)
1416

1517
diff --git a/pykeepass/kdbx_parsing/common.py b/pykeepass/kdbx_parsing/common.py
16-
index 3973f61..1865bb4 100644
18+
index 3973f61..94eb58b 100644
1719
--- a/pykeepass/kdbx_parsing/common.py
1820
+++ b/pykeepass/kdbx_parsing/common.py
19-
@@ -13,6 +13,7 @@ import unicodedata
21+
@@ -9,11 +9,11 @@ from lxml import etree
22+
from copy import deepcopy
23+
import base64
24+
from binascii import Error as BinasciiError
25+
+import io
26+
import unicodedata
2027
import zlib
2128
import re
2229
import codecs
23-
+import io
24-
from io import BytesIO
30+
-from io import BytesIO
2531
from collections import OrderedDict
2632
import logging
27-
@@ -116,7 +117,13 @@ def compute_key_composite(password=None, keyfile=None):
28-
password_composite = b''
33+
34+
@@ -117,6 +117,8 @@ def compute_key_composite(password=None, keyfile=None):
2935
# hash the keyfile
3036
if keyfile:
31-
- if hasattr(keyfile, "read"):
32-
+ if (
33-
+ isinstance(keyfile, io.BufferedIOBase)
34-
+ or isinstance(keyfile, io.TextIOBase)
35-
+ or isinstance(keyfile, io.RawIOBase)
36-
+ ):
37-
+ if keyfile.seekable():
37+
if hasattr(keyfile, "read"):
38+
+ if hasattr(keyfile, "seekable") and keyfile.seekable():
3839
+ keyfile.seek(0)
3940
keyfile_bytes = keyfile.read()
4041
else:
4142
with open(keyfile, 'rb') as f:
43+
@@ -183,7 +185,7 @@ class XML(Adapter):
44+
45+
def _decode(self, data, con, path):
46+
parser = etree.XMLParser(remove_blank_text=True)
47+
- return etree.parse(BytesIO(data), parser)
48+
+ return etree.parse(io.BytesIO(data), parser)
49+
50+
def _encode(self, tree, con, path):
51+
return etree.tostring(tree)
4252
--
4353
2.44.0
4454

python3-pykeepass.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"sources": [
88
{
99
"type": "archive",
10-
"url": "https://files.pythonhosted.org/packages/e1/ca/2da205bb1baa9f86b9cc36145ab5435fbc50ee3cc136e4a90356dbbdc3d2/pykeepass-4.0.7.tar.gz",
11-
"sha256": "56ce2a1d22c204c838e6501796e0acce8ba9f50ade821111aaa1458f9d1a775e"
10+
"url": "https://files.pythonhosted.org/packages/c5/3a/dc4c067aa600e7fdb38a4981ce40768fc75c6b6b708f305ec7c94c767f72/pykeepass-4.0.7.post1.tar.gz",
11+
"sha256": "04090d79cf121686b51c4c84d5bc6a62cd47b8337f8c0158caa9e845df803131"
1212
},
1313
{
1414
"type": "patch",

0 commit comments

Comments
 (0)