Control: forwarded -1 https://github.com/letoams/hash-slinger/issues/45
Control: tags -1 +patch
I submitted this patch upstream to fix this issue:
https://github.com/letoams/hash-slinger/pull/46
Attached as well.
--
Antoine Beaupré
torproject.org system administration
>From e3bec6e2a6b1bda7c52b4c585474fd7cc23ab643 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Charaoui?=
Date: Wed, 4 Oct 2023 22:05:26 -0400
Subject: [PATCH] fix generic TLSA record generation
It seems like the calculation for the TLSA record never really worked,
as we're doing float division here on the `len()` field. In our case,
that field returned `35.0` which is not valid in our environment.
Doing an integer division gives the correct result in most cases, I
believe.
Closes: #45
---
tlsa | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tlsa b/tlsa
index cea7230..ec97150 100755
--- a/tlsa
+++ b/tlsa
@@ -513,7 +513,7 @@ class TLSARecord:
def getRecord(self, generic=False):
"""Returns the RR string of this TLSARecord, either in rfc (default) or generic format"""
if generic:
- return '%s IN TYPE52 \# %s %s%s%s%s' % (self.name, (len(self.cert)/2)+3 , self._toHex(self.usage), self._toHex(self.selector), self._toHex(self.mtype), self.cert)
+ return '%s IN TYPE52 \# %s %s%s%s%s' % (self.name, (len(self.cert)//2)+3 , self._toHex(self.usage), self._toHex(self.selector), self._toHex(self.mtype), self.cert)
return '%s IN TLSA %s %s %s %s' % (self.name, self.usage, self.selector, self.mtype, self.cert)
def _toHex(self, val):
--
2.39.2