/[pdpsoft]/nl.nikhef.ndpf.tools/sgmshell/sgmshell.cin
ViewVC logotype

Diff of /nl.nikhef.ndpf.tools/sgmshell/sgmshell.cin

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 23 by davidg, Wed Aug 27 08:50:40 2008 UTC revision 24 by davidg, Wed Aug 27 08:56:23 2008 UTC
# Line 4  use strict; Line 4  use strict;
4  use File::Temp qw/ :mktemp /;  use File::Temp qw/ :mktemp /;
5    
6  my $verbose=0;  my $verbose=0;
7    my ($logf,$logfname);
8    
9  my ($logf,$logfname) = mkstemp( "/var/tmp/sgmshell.$$.XXXXX" );  $verbose and do {
10      ($logf,$logfname) = mkstemp( "/var/tmp/sgmshell.$$.XXXXX" );
11    };
12    
13  my $logmsg = "starting sgmshell uid $< on ".(scalar gmtime)." with @ARGV\n";  my $logmsg = "starting sgmshell uid $< on ".(scalar gmtime)." with @ARGV\n";
14    
15  $verbose and print $logf $logmsg;  $verbose and print $logf $logmsg;
16  system("logger -p daemon.notice -t sgmshell \'$logmsg\'");  system("logger -p daemon.notice -t sgmshell[$$] \'$logmsg\'");
17    
18  $ARGV[0] eq "-c" or do {  ( (! defined $ARGV[0] ) or $ARGV[0] ne "-c" ) and do {
19    print $logf "Terminating due to invalid invocation (argv0 is not -c)\n";    $verbose and print $logf "Terminating due to invalid invocation (argv0 is not -c)\n";
20      system("logger -p daemon.notice -t sgmshell[$$] \'interactive login without -c banned\'");
21    die "Invalid invocation\n";    die "Invalid invocation\n";
22  };  };
23  shift @ARGV;  shift @ARGV;
# Line 27  foreach ( $command ) { Line 32  foreach ( $command ) {
32    };    };
33  }  }
34  $permitted or do {  $permitted or do {
35    print $logf "denied command $command (".$ARGV[$#ARGV].")\n";    $verbose and print $logf "denied command $command (".$ARGV[$#ARGV].")\n";
36      system("logger -p daemon.notice -t sgmshell[$$] \'denied command: $command\'");
37    die "Invalid invocation\n";    die "Invalid invocation\n";
38  };  };
39    

Legend:
Removed from v.23  
changed lines
  Added in v.24

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28