OSSP CVS Repository

ossp - Check-in [3046]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3046
Date: 2002-Dec-23 15:08:38 (local)
2002-Dec-23 14:08:38 (UTC)
User:rse
Branch:
Comment: 1. Added "Setenv <variable <value>" configuration command to "Environment" configuration section which allows one to set environment variables like PATH, etc. This especially allows now non-absolute paths on "Program" configuration commands.

2. Fixed indentation on "Content files" report part.

Tickets:
Inspections:
Files:
ossp-pkg/shiela/ChangeLog      1.32 -> 1.33     11 inserted, 0 deleted
ossp-pkg/shiela/shiela.pl      1.45 -> 1.46     24 inserted, 13 deleted
ossp-pkg/shiela/shiela.pod      1.18 -> 1.19     9 inserted, 0 deleted

ossp-pkg/shiela/ChangeLog 1.32 -> 1.33

--- ChangeLog    2002/12/23 12:13:27     1.32
+++ ChangeLog    2002/12/23 14:08:38     1.33
@@ -9,6 +9,17 @@
 
   ChangeLog
 
+  Changes between 1.0.3 and 1.0.4 (23-Dec-2002 to 23-Dec-2002):
+
+   *) Added "Setenv <variable <value>" configuration command to
+      "Environment" configuration section which allows one to set
+      environment variables like PATH, etc. This especially allows now
+      non-absolute paths on "Program" configuration commands.
+      [Ralf S. Engelschall]
+
+   *) Fixed indentation on "Content files" report part.
+      [Ralf S. Engelschall]
+
   Changes between 1.0.2 and 1.0.3 (23-Dec-2002 to 23-Dec-2002):
 
    *) CVS since 1.11.2 allows verifymsg-hooked scripts to actually


ossp-pkg/shiela/shiela.pl 1.45 -> 1.46

--- shiela.pl    2002/12/23 13:10:56     1.45
+++ shiela.pl    2002/12/23 14:08:38     1.46
@@ -54,6 +54,7 @@
 $|++;
 umask(002);
 delete $ENV{TZ};
+$ENV{PATH} = "/bin:/usr/bin:/sbin:/usr/sbin";
 
 #   Generic program error handler
 $SIG{__DIE__} = sub {
@@ -98,7 +99,7 @@
     $rv = &hook_loginfo($PA, $RT, $CF);
 }
 else {
-    die "unknown hook (use --hook option)";
+    die "unknown processing stage (use --hook option)";
 }
 exit($rv);
 
@@ -163,11 +164,16 @@
     }
     $RT->{usergroups} = join(',', @G);
 
+    #   optionally set environment variables (like PATH)
+    foreach my $var (keys(%{$CF->{Environment}->{Setenv}})) {
+        $ENV{PATH} = $CF->{Environment}->{Setenv}->{$var};
+    }
+
     #   determine various program paths
     sub find_program {
         my ($name) = @_;
         my ($prog) = '';
-        foreach my $dir (split(/:/, "$ENV{PATH}:/bin:/usr/bin:/sbin:/usr/sbin")) {
+        foreach my $dir (split(/:/, $ENV{PATH})) {
             if (-x "$dir/$name") {
                 $prog = "$dir/$name";
                 last;
@@ -393,7 +399,8 @@
             'Report' => {}
         },
         'Environment' => {
-            'Program' => {}
+            'Program' => {},
+            'Setenv'  => {}
         }
     };
     my $cf = &parse_config($t, \&parse_config_callback, $CF);
@@ -452,6 +459,9 @@
         elsif ($action eq 'CMD' and $cf->[0] eq 'Program') {
             $CF->{Environment}->{Program}->{$cf->[1]} = $cf->[2];
         }
+        elsif ($action eq 'CMD' and $cf->[0] eq 'Setenv') {
+            $CF->{Environment}->{Setenv}->{$cf->[1]} = $cf->[2];
+        }
         return $cf;
     }
     return $CF;
@@ -2148,10 +2158,10 @@
                 my $branch;
                 foreach $branch (sort(keys(%{$list}))) {
                     if ($branch eq 'HEAD') {
-                        $O .= $prefix."$header:\n";
+                        $O .= sprintf("%s%s\n", $prefix, "$header:");
                     }
                     else {
-                        $O .= $prefix.sprintf("%-25s %s\n", "$header:", "(Branch: $branch)");
+                        $O .= sprintf("%s%-25s %s\n", $prefix, "$header:", "(Branch: $branch)");
                     }
                     $O .= &format_branch($prefix, $header, $branch, $list->{$branch});
                 }
@@ -2173,27 +2183,28 @@
                 my $first = 1;
                 my $col = 0;
                 foreach $file (sort(@{$list})) {
-                    if ($col+length($file)+1 > 78) {
+                    if (($col + 1 + length($file)) > 78) {
                         $O .= "\n";
                         $col = 0;
                     }
                     if ($col == 0) {
                         if ($first) {
-                            if (length($dir) > 25) {
-                                $O .= $prefix.sprintf("%s\n$prefix%-25s", "  $dir", "");
+                            if ((2+length($dir)) > 25) {
+                                $O .= sprintf("%s%s\n", $prefix, "  " . $dir);
+                                $O .= sprintf("%s%-25s", $prefix, "");
                             }
                             else {
-                                $O .= $prefix.sprintf("%-25s", "  $dir");
+                                $O .= sprintf("%s%-25s", $prefix, "  " . $dir);
                             }
                             $first = 0;
                         }
                         else {
-                            $O .= $prefix.sprintf("%-25s", "");
+                            $O .= sprintf("%s%-25s", $prefix, "");
                         }
-                        $col += length($prefix)+25;
+                        $col += length($prefix) + 25;
                     }
-                    $O .= " $file";
-                    $col += length($file)+1;
+                    $O .= " " . $file;
+                    $col += 1 + length($file);
                 }
                 $O .= "\n" if ($O !~ m|\n$|s);
                 return $O;


ossp-pkg/shiela/shiela.pod 1.18 -> 1.19

--- shiela.pod   2002/12/23 13:10:56     1.18
+++ shiela.pod   2002/12/23 14:08:38     1.19
@@ -88,6 +88,7 @@
 structure:
 
  Environment {
+     [Setenv <variable> <value>; [...]]
      [Program sendmail <path>;]
      [Program cvs <path>;]
      [Program diff <path>;]
@@ -99,6 +100,13 @@
 
 =over 4
 
+=item B<Setenv E<lt>variableE<gt> E<lt>valueE<gt>;>
+
+This sets (and overrides) a environment variable with a particular
+value. A common use is to set the environment variable C<PATH>, so the
+path arguments on B<Program> configuration lines can be non-absolute
+paths.
+
 =item B<Program sendmail E<lt>pathE<gt>;>
 
 This overrides the path to the F<sendmail> executable. Per default
@@ -408,6 +416,7 @@
 
  #   override the run-time environment
  Environment {
+     Setenv  PATH     /bin:/usr/bin:/sbin:/usr/sbin;
      Program sendmail /e/foo/sw/bin/sendmail;
      Program cvs      /e/foo/sw/bin/cvs;
      Program diff     /e/foo/sw/bin/diff;

CVSTrac 2.0.1