[Tails-dev] [PATCH onion-grater] Write 250 OK in the same sy…

Nachricht löschen

Nachricht beantworten
Autor: наб
Datum:  
To: tails-dev
Betreff: [Tails-dev] [PATCH onion-grater] Write 250 OK in the same syscall as its \r\n
Two .write() calls means this decoded to sendto("250 OK"); sendto("\r\n"),
and the same happened to all the other responses

We don't have writev here but we can just expand line, which works perfectly

Downstream: https://github.com/Whonix/onion-grater/pull/14
---
config/chroot_local-includes/usr/local/lib/onion-grater | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config/chroot_local-includes/usr/local/lib/onion-grater b/config/chroot_local-includes/usr/local/lib/onion-grater
index 7b57d23..0165aea 100755
--- a/config/chroot_local-includes/usr/local/lib/onion-grater
+++ b/config/chroot_local-includes/usr/local/lib/onion-grater
@@ -313,9 +313,9 @@ class FilteredControlPortProxySession:
         if line.isspace():
             return
         self.debug_log_send(line)
-        self.wfile.write(bytes(line, 'ascii'))
         if not raw:
-            self.wfile.write(bytes("\r\n", 'ascii'))
+            line += "\r\n"
+        self.wfile.write(bytes(line, 'ascii'))
         self.wfile.flush()


     def get_rule(self, cmd, arg_str):
-- 
2.39.5