<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="index" title="Text File" newcontext="true">
<p>
Received: with ECARTIS (v1.0.0; list gopher);
 Sat, 30 Jun 2007 09:37:58 -0500 (CDT)
Received: from static-71-170-11-156.dllstx.dsl-w.verizon.net ([71.170.11.156]
 helo=turquoise.pongonova.net)
	by glockenspiel.complete.org with esmtp
	(Exim 4.63)
	id 1I4e5E-0000Qj-BC
	for gopher@complete.org; Sat, 30 Jun 2007 09:37:57 -0500
Received: by turquoise.pongonova.net (Postfix, from userid 1000)
	id 297C4674; Sat, 30 Jun 2007 08:40:16 -0500 (CDT)
Date: Sat, 30 Jun 2007 08:40:15 -0500
From: brian@pongonova.net
To: gopher@complete.org
Subject: [gopher] Re: Bucktooth questions
Message-ID: &lt;20070630134015.GA6348@pongonova.net&gt;
References: &lt;20070630062739.GB5388@pongonova.net&gt;
 &lt;200706301409.l5UE9ZBY015354@floodgap.com&gt;
Mime-Version: 1.0
Content-type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: &lt;200706301409.l5UE9ZBY015354@floodgap.com&gt;
User-Agent: Mutt/1.5.5.1i
X-Spam-Status: No (score 0.6): AWL=0.000, NO_REAL_NAME=0.55
X-Virus-Scanned: by Exiscan on glockenspiel.complete.org at Sat,
 30 Jun 2007 09:37:57 -0500
Content-Transfer-Encoding: 8bit
X-archive-position: 1633
X-ecartis-version: Ecartis v1.0.0
Sender: gopher-bounce@complete.org
Errors-to: gopher-bounce@complete.org
X-original-sender: brian@pongonova.net
Precedence: bulk
Reply-to: gopher@complete.org
List-help: &lt;mailto:ecartis@complete.org?Subject=help&gt;
List-unsubscribe: &lt;mailto:gopher-request@complete.org?Subject=unsubscribe&gt;
List-software: Ecartis version 1.0.0
List-Id: Gopher &lt;gopher.complete.org&gt;
X-List-ID: Gopher &lt;gopher.complete.org&gt;
List-subscribe: &lt;mailto:gopher-request@complete.org?Subject=subscribe&gt;
List-owner: &lt;mailto:jgoerzen@complete.org&gt;
List-post: &lt;mailto:gopher@complete.org&gt;
List-archive: &lt;http://www.complete.org/mailinglists/archives/&gt;
X-list: gopher
</p>
<p>On Sat, Jun 30, 2007 at 07:09:35AM -0700, Cameron Kaiser wrote:
&gt; &gt; Well, finally got around to setting up Bucktooth.  Right now I&#x27;m
&gt; &gt; testing on an iBook, but will end up running everything on a Linux
&gt; &gt; box.  I&#x27;m running under xinetd as user &quot;www&quot;.  I had to make the
&gt; &gt; following mods to buckd to get things to work under setgid:
</p>
<p>Cameron--
</p>
<p>It&#x27;s not your code (but forcing it to run under taint mode might be a
good idea).  It&#x27;s just Perl saying &quot;Hey, in case you didn&#x27;t realize
it, I&#x27;m running this in taint mode, even though you didn&#x27;t specify -T,
and you&#x27;ll have to live with it.&quot;  Living with &quot;it&quot; means doing things
like untaininting $ENV{PATH} (even if it&#x27;s not used -- a requirement
when calling exec(), because an exec&#x27;d() process would have access to
whatever is in $ENV{PATH}).
</p>
<p>Let&#x27;s see...perl version is 5.8.1.
</p>
<p>Here are a couple of error messages:
</p>
<p>* No -s allowed while running setgid.
* Insecure dependency in exec while running setgid at /usr/local/bin/buckd line 2 79, &lt;STDIN&gt; line 1.
* Insecure $ENV{PATH} while running setgid at /usr/local/bin/buckd line 277, &lt;STD IN&gt; line 1.
</p>
<p>Here were the changes to get things working:
</p>
<p>--- buckd.orig  Sat Jun 30 09:27:18 2007
+++ buckd   Sat Jun 30 09:25:27 2007
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -s
+#!/usr/bin/perl
</p>
<p> #####################################################################
 # Bucktooth 0.2.1 (c)1999, 2001-2006 Cameron Kaiser                 #
@@ -65,6 +65,18 @@
        exit;
    }
    ($request, $dinfo) = split(/\?/, $orq, 2);
+   if ($dinfo =~ /^([ -\@\w.]+)$/) {
+       $dinfo = $1;
+   } elsif($dinfo) {
+       &amp;log(&quot;Bad data in \$dinfo: &#x27;$dinfo&#x27;&quot;);
+       exit;
+   }
+   if ($request =~ /^([\/-\@\w.]+)$/) {
+       $request = $1;
+   } elsif($request) {
+       &amp;log(&quot;Bad data in \$request: &#x27;$request&#x27;&quot;);
+       exit;
+   }
</p>
<p>    $request =~ s/%([a-fA-F0-9]{2})/pack(&quot;H2&quot;, $1)/eg;
    # $request must be absolute ...
@@ -258,6 +270,7 @@
    $ENV{&#x27;SERVER_PORT&#x27;} = $MYPORT;
    $ENV{&#x27;SELECTOR&#x27;} = $orq;
    $ENV{&#x27;GPLUS&#x27;} = $gplus;
+   $ENV{&#x27;PATH&#x27;} =  $DIR;
    &amp;fixgplus;
    &amp;log(&quot;\&quot;$orq\&quot; ${gplus}[200 \&quot;$locator\&quot; \&quot;$dinfo\&quot; executed]&quot;);
    $ENV{&#x27;REQUEST&#x27;} = $request;
</p>
<p></p>
</card>
</wml>
