On 2018-01-20, clematis <clema...@insiberia.net> wrote:
> Hello,
> 'usewithtor' (torsocks) works fine with ftp and ssh but it will core
> with lynx. 
> running: usewithtor lynx
> will start lynx, resolve openbsd.org but core when trying to make the
> http connection.
> In /var/log/messages I get: /bsd: lynx[26197]: pledge "getpw", syscall 33
>
> And running gdb lynx then core lynx.core: 
> ---
> Reading symbols from /usr/libexec/ld.so...done.                               
>                                                                               
>                                        
> Loaded symbols for /usr/libexec/ld.so                                         
>                                                                               
>                                        
> #0  access () at -:3                                                          
>                                                                               
>                                        
> 3       -: No such file or directory.                                         
>                                                                               
>                                        
>         in -                                                                  
>                                                                               
>                                        
> Current language:  auto; currently asm
> ---
>
> same result using 'torsocks' directly and not 'usewithtor' or trying
> lynx http://openbsd.org
>
>
> Config: OpenBSD current + lynx-2.8.9pl16 + torsocks-1.2p4
>
> Any idea on how to torify lynx?
>
> Thanks,

What happens if you just replace the getpwuid functions in torsocks
with NULL? They don't seem terribly useful for sending to a local tor
proxy, they're more relevant for communicating with a standard socks
server with authentication (and even then you can pass the username via
a config file or environment variable).. Does that make it work or does
it then fail on something else?

Otherwise torsocks could wrap the pledge() function to weaken the pledge.
It's easy to do but far less appealing.

Index: src/socks.c
--- src/socks.c.orig
+++ src/socks.c
@@ -281,7 +281,7 @@ static int send_socksv4a_request(struct connreq *conn,
     struct sockreq *thisreq;
     int endOfUser;
     /* Determine the current username */
-    user = getpwuid(getuid());
+    user = NULL;
 
     thisreq = (struct sockreq *) conn->buffer;
     endOfUser=sizeof(struct sockreq) +
@@ -324,7 +324,7 @@ static int send_socksv4_request(struct connreq *conn)
     struct sockreq *thisreq;
 
     /* Determine the current username */
-    user = getpwuid(getuid());
+    user = NULL;
 
     thisreq = (struct sockreq *) conn->buffer;
 
@@ -493,7 +493,7 @@ static int read_socksv5_method(struct connreq *conn)
         show_msg(MSGDEBUG, "SOCKS V5 server chose username/password 
authentication\n");
 
         /* Determine the current *nix username */
-        nixuser = getpwuid(getuid());
+        nixuser = NULL;
 
         if (((uname = conn->path->defuser) == NULL) &&
           ((uname = getenv("TORSOCKS_USERNAME")) == NULL) &&

Reply via email to