Changeset 1281

Show
Ignore:
Timestamp:
24/08/07 09:09:32 (4 years ago)
Author:
jo
Message:

Added detection of setr* at build time. The OSes without these functions will work anyway.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Makefile

    r1205 r1281  
    245245                    -e 's|@@GOODSH@@|$(GOODSH)|g'                       \ 
    246246                    -e 's|@@BASH@@|$(BASH)|g'                           \ 
     247                    -e 's|@@HASSETR@@|$(HASSETR)|g'                     \ 
    247248                    $$file > build/$$destname;                          \ 
    248249        done 
  • trunk/Makefile.config-dist

    r1194 r1281  
    100100CHMOD      = chmod 
    101101CHGRP      = chgrp 
     102 
     103# Check whether setruid functionality can be used 
     104HASSETR = $(shell perl -e 'use Config; my @vars=("d_setruid", "d_setreuid", "d_setresuid"); foreach my $$var (@vars) { if ($$Config{$$var} eq "define") { print "1\n"; exit 0; } } print "0\n"; exit 0;' ) 
     105 
  • trunk/Makefile.config-maint

    r1194 r1281  
    9494CHMOD      = chmod 
    9595CHGRP      = chgrp 
     96 
     97# Check whether setruid functionality can be used 
     98HASSETR = $(shell perl -e 'use Config; my @vars=("d_setruid", "d_setreuid", "d_setresuid"); foreach my $$var (@vars) { if ($$Config{$$var} eq "define") { print "1\n"; exit 0; } } print "0\n"; exit 0;' ) 
  • trunk/node/munin-node.in

    r1198 r1281  
    2828use Getopt::Long; 
    2929use Net::Server::Fork; # any personality will do 
     30 
     31# Variable is set at build, with values detected by the makefiles 
     32my $HAS_SETR = @@HASSETR@@; 
    3033 
    3134my $tls; 
     
    459462#               net_write ("# Want to run as euid/egid $u/$g\n") if $DEBUG; 
    460463 
    461                 $( = $g    unless $g == 0; 
     464                if ($HAS_SETR) 
     465                { 
     466                        $( = $g    unless $g == 0; 
     467                        $< = $u    unless $u == 0; 
     468                } 
    462469                $) = $gs   unless $g == 0; 
    463                 $< = $u    unless $u == 0; 
    464470                $> = $u    unless $u == 0; 
    465471 
  • trunk/node/munin-run.in

    r1198 r1281  
    2424use vars qw(@ISA); 
    2525use Getopt::Long; 
     26 
     27# Variable is set at build, with values detected by the makefiles 
     28my $HAS_SETR = @@HASSETR@@; 
    2629 
    2730# "Clean" environment to disable taint-checking on the environment. We _know_ 
     
    355358                print "# Want to run as euid/egid $u/$g\n" if $DEBUG; 
    356359 
    357                 $( = $g    unless $g == 0; 
     360                if ($HAS_SETR) 
     361                { 
     362                        $( = $g    unless $g == 0; 
     363                        $< = $u    unless $u == 0; 
     364                } 
    358365                $) = $gs   unless $g == 0; 
    359                 $< = $u    unless $u == 0; 
    360366                $> = $u    unless $u == 0; 
    361367