about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-04-30 09:24:32 +0000
committerEric Wong <e@80x24.org>2021-04-30 19:59:43 +0000
commit77ce8b2a15495f7144e806e0747cb13e2ab7fe27 (patch)
tree2bbf0265c2dae5b3017716bc16f431cf013d9091 /lib
parent2021754b745eba39ef83ff11d504c0257f0f8c11 (diff)
downloadpublic-inbox-77ce8b2a15495f7144e806e0747cb13e2ab7fe27.tar.gz
LD_PRELOAD sent by a client can't affect lei-daemon.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/Config.pm1
-rw-r--r--lib/PublicInbox/LeiCurl.pm2
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 016f50ec..3f0f5a01 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -12,6 +12,7 @@ use strict;
 use v5.10.1;
 use PublicInbox::Inbox;
 use PublicInbox::Spawn qw(popen_rd);
+our $LD_PRELOAD = $ENV{LD_PRELOAD}; # only valid at startup
 
 sub _array ($) { ref($_[0]) eq 'ARRAY' ? $_[0] : [ $_[0] ] }
 
diff --git a/lib/PublicInbox/LeiCurl.pm b/lib/PublicInbox/LeiCurl.pm
index 69c64cdf..ce57e796 100644
--- a/lib/PublicInbox/LeiCurl.pm
+++ b/lib/PublicInbox/LeiCurl.pm
@@ -55,7 +55,7 @@ sub torsocks { # useful for "git clone" and "git fetch", too
         $opt->{torsocks} = 'false' if $opt->{'no-torsocks'};
         my $torsocks = $opt->{torsocks} //= 'auto';
         if ($torsocks eq 'auto' && substr($uri->host, -6) eq '.onion' &&
-                        (($lei->{env}->{LD_PRELOAD}//'') !~ /torsocks/)) {
+                ($PublicInbox::Config::LD_PRELOAD//'') !~ m!/libtorsocks\b!) {
                 # "auto" continues anyways if torsocks is missing;
                 # a proxy may be specified via CLI, curlrc,
                 # environment variable, or even firewall rule