#!/usr/bin/perl
#
## NAME: lcase.pl
## DESC: Converts the user name to lowercase. Then outputs the user and workspace from STDIN.
#
# Example entry in the broker config file:
#
# command: login
# {
# action = filter;
# execute = /home/user/scripts/broker/lcase.pl;
# }
#
# Program standard input (stdin) in the following format:
#
# command: user command
# clientProg: client program
# clientVersion: version of client program
# clientProtocol: level of client protocol
# apiLevel: level of api protocol
# workspace: name of client workspace
# user: name of requesting user
# clientIp: IP address of client
# proxyIp: IP address of proxy (if any)
# cwd: Client's working directory
# argCount: number of arguments to command
# Arg0: first argument (if any)
# Arg1: second argument (if any)
###############################################################
my %cmd_info = map { /(.*?):\s*(.*)/; ( $1, $2 ) } <STDIN>;
my $user = $cmd_info{user};
my $wksp = $cmd_info{workspace};
# If there is an upper case letter, convert the username to lowercase
if ($user =~ /[A-Z]/) {
$lcuser = lc $user;
}
my $passmsg = "\n\nUser was $user and now is $lcuser\n\nWorkspace is $wksp\n\n";
print "action: PASS\n"."message:\"$passmsg\"" and exit;
# eof