On Wed, Nov 01, 2006 at 04:43:01PM +0200, Vladimir Vladimirov wrote:
> Hi everyone
> I've installing policyd-weight on Mac OS X 10.4 and discovered
> problem. Here is debug:
> policyd-weight version: 0.1.14 beta, CacheVer: 3
> System: Darwin pagraphics 8.8.0 Darwin Kernel Version 8.8.0: Fri Sep  8 
> 17:18:57
> PDT 2006; root:xnu-792.12.6.obj~1/RELEASE_PPC Power Macintosh powerpc
> Perl version: 5.008006
> Net::DNS version: 0.59
> config: default settings
> 
> debug: using port 12526
> debug: USER:  spamd
> debug: GROUP: postfix
> debug: issuing user:  root
> debug: issuing group: root
> 08:46:57 debug: startup: using default settings
> 08:46:57 warning: err: setruid() not implemented at ./policyd-weight line 
> 2342.
> 
> I've found solution here:
> http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/9beeaa638ba83213/dba793905626ca75%23dba793905626ca75
> 
> And have made a dirty hack to make script working - see below (also attached)
> 871,873c871,878
> <         $( = $gname;          if($!) { die "($<)($>) set GID to
> $gname: $!";  }
> <
> <         $) = "$gname $gname"; if($!) { die "set EGID to $gname: $!"; }

Unfortunately that is not portable either, also, this does not empty the groups
you are in.

Please try following:

perl -wle '
($(,$)) = (80, "80 80"); die $! if $!; 
($<,$>) = (80, 80); die $! if $!;
print "ruid: $<\neuid: $>\nrgid: $(\negid: $)\n" '

This must output following:

ruid: 80
euid: 80
rgid: 80 80
egid: 80 80


I do NOT expect that to be portable, after all, set*id - regardless which 
approach one uses, is non portable, even using "use POSIX" is non portable.
However, I'll first use the above version, check for errors and then use the
current approach. If nothing works, then the OS/perl on that plattform is
highly broken.



The patch your provided may work on Mac, but outputs here:

linux redhat 7.1, kernel 2.4.25, perl 5.6:
root# perl -wle '
$(=$) = 80; die $! if $!;
$<=$> = 80; die $! if $!;
print "ruid: $<\neuid: $>\nrgid: $(\negid: $)\n" '
ruid: 80
euid: 80
rgid: 80 10 6 4 3 2 1 0
egid: 80 10 6 4 3 2 1 0
         ^^^^^^^^^^^^^^ Danger!

FreeBSD 6.1, perl 5.8.8:

root# perl -wle '
quote> $(=$) = 80; die $! if $!;
quote> $<=$> = 80; die $! if $!;
quote> print "ruid: $<\neuid: $>\nrgid: $(\negid: $)\n" '
Operation not permitted at -e line 3.

No comment.



-- 
    Robert Felber (PGP: 896CF30B)
    Munich, Germany

____________________________________________________________
Policyd-weight Mailinglist - http://www.policyd-weight.org/

Reply via email to