- Timestamp:
- Feb 17, 2011, 1:20:36 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r1197 r1198 2961 2961 print PBOUT "Defaults:root !requiretty\n"; 2962 2962 # Keep proxy configuration while using sudo 2963 print PBOUT "Defaults:$pbac->{$ENV{'PBPROJ'}} env_keep += \\\"http_proxy ftp_proxy\\\"\n";2963 print PBOUT "Defaults:$pbac->{$ENV{'PBPROJ'}} env_keep += \\\"http_proxy ftp_proxy\\\"\n"; 2964 2964 EOF 2965 2965 # Try to restrict security to what is really needed 2966 2966 if ($vtype =~ /^vm/) { 2967 2967 my $hpath = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-halt")); 2968 my @sudocmds = pb_get_sudocmds($pbos,$ntpline, $hpath);2968 my @sudocmds = pb_get_sudocmds($pbos,$ntpline,"sudo $hpath"); 2969 2969 print SCRIPT << "EOF"; 2970 2970 # This is needed in order to be able on VM to halt the machine from the $pbac->{$ENV{'PBPROJ'}} account at least … … 3766 3766 3767 3767 my $pbos = shift; 3768 my @lines = shift;3769 3768 my %sudocmds; 3770 3769 3771 foreach my $c (split(/;/,$pbos->{'update'}),split(/;/,$pbos->{'install'}),@lines) { 3772 next if ($c !~ /^sudo/); 3773 # remove sudo 3774 $c =~ s/^sudo\s+//; 3775 # remove leading spaces 3776 $c =~ s/^\s+//; 3777 # remove ending spaces 3778 $c =~ s/\s+$//; 3770 pb_log(2,"pb_get_sudocmds entering with lines:".Dumper(@_)."\n"); 3771 foreach my $c (split(/;/,$pbos->{'update'}),split(/;/,$pbos->{'install'}),@_) { 3772 pb_log(2,"pb_get_sudocmds analyses $c\n"); 3773 next if ($c !~ /^\s*sudo/); 3774 # remove sudo and leading spaces 3775 $c =~ s/^\s*sudo\s+//; 3779 3776 # keep only the command, not the params 3780 3777 $c =~ s/([^\s]+)\s.*$/$1/; 3781 3778 $sudocmds{$c} = ""; 3782 3779 } 3783 pb_log(2,"pb_get_sud comds returns ".Dumper(%sudocmds)."\n");3780 pb_log(2,"pb_get_sudocmds returns ".Dumper(keys %sudocmds)."\n"); 3784 3781 return(keys %sudocmds); 3785 3782 }
Note:
See TracChangeset
for help on using the changeset viewer.