http://bugzilla.spamassassin.org/show_bug.cgi?id=3586





------- Additional Comments From [EMAIL PROTECTED]  2004-07-13 13:03 -------
Subject: Re:  perl setuid fails, breaking spamd in FreeBSD, MacOS X

On Tue, Jul 13, 2004 at 11:44:53AM -0700, [EMAIL PROTECTED] wrote:
> perl -e 'sub p {print "RUID: $<, EUID: $>\n";} p; $< = 1000; $> = 1000; p;'
> 
> doesn't work on FreeBSD?  that's whta that spfd thread suggests... if that at
> least works on FreeBSD, we can throw in a kludge for that, fixing half of the
> problem OSes ;) It may work where "$>=1000; $<=1000;" doesn't, because of the
> ordering.

Well, "perl -e 'sub p {print "RUID: $<, EUID: $>\n";} p; $<=1000; p;'"
fails on OS X (already in the ticket), but seems to work on FreeBSD:

 RUID: 0, EUID: 0
 RUID: 1000, EUID: 0

The issue here, of course, is that we seteuid() in spamd, then later on
the helper app stuff tries the setuid().  Wait a minute, is this something
stupid where perl checks EUID == 0 for setuid instead of using RUID?

A-ha!  It is!

$ perl5.00503 -e 'sub p {print "RUID: $<, EUID: $>\n";} p; $>=1000; p; $<=1000; 
p; $>=0; $<=1000; $>=1000;
p;'
RUID: 0, EUID: 0
RUID: 0, EUID: 1000
RUID: 0, EUID: 1000
RUID: 1000, EUID: 1000

ARG!   Ok, so the simple solution, it seems, is:

$>=$<;
$<=$newuid;
$>=$newuid;
if ($<!=$>) { ... }





------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to