Services/Unbound - choose a delimiter (|) and translate empty values to empty strings. should fix https://github.com/opnsense/core/issues/6456

Although I couldn't reproduce the exact same issue, if some values are empty ('') and some are null (None), weird things might happen. This commit makes sure there is a field delimiter, which logically shouldn't exist in the datastream itself and prevent null values being presented as "None".
This commit is contained in:
Ad Schellevis 2023-03-30 15:13:24 +02:00
parent a0c8016b2f
commit 0a6a3a7715
2 changed files with 2 additions and 2 deletions

View File

@ -136,7 +136,7 @@ class DNSReader:
if r == '':
return False
q = tuple(r.strip("\n").split())
q = tuple(r.strip("\n").split('|'))
self.buffer.append(q)
self.update_clients.add(q[2])

View File

@ -222,7 +222,7 @@ class Logger:
try:
while len(self._pipe_buffer) > 0:
l = self._pipe_buffer.popleft()
res = "{} {} {} {} {} {} {} {} {} {} {} {} {}\n".format(*l)
res = "{}|{}|{}|{}|{}|{}|{}|{}|{}|{}|{}|{}|{}\n".format(*['' if x is None else x for x in l])
os.write(self._pipe_fd, res.encode())
except (BrokenPipeError, BlockingIOError) as e:
if e.__class__.__name__ == 'BrokenPipeError':