File: test.pipe

package info (click to toggle)
libapache2-mod-authnz-external 3.2.4-2%2Bsqueeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 220 kB
  • ctags: 53
  • sloc: ansic: 592; perl: 130; makefile: 53
file content (40 lines) | stat: -rwxr-xr-x 988 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/perl

# Test authenticator using pipe method.  Logins will be accepted if the
# login and the password are identical, and will be rejected otherwise.
#
# This authenticator does copious logging by writing all sorts of stuff to
# STDERR.  A production authenticator would not normally do this, and it
# *especially* would not write the plain text password out to the log file.

# Get the name of this program
$prog= join ' ',$0,@ARGV;

# Get the user name
$user= <STDIN>;
chomp $user;

# Get the password name
$pass= <STDIN>;
chomp $pass;

# Print them to the error_log file
print STDERR "$prog: user='$user' pass='$pass'\n";

# Dump the environment to the error_log file
foreach $env (keys(%ENV))
{
	print STDERR "$prog: $env=$ENV{$env}\n";
}

# Accept the login if the user name matchs the password
if ($user eq $pass)
{
	print STDERR "$prog: login matches password - Accepted\n";
	exit 0;
}
else
{
	print STDERR "$prog: login doesn't match password - Rejected\n";
	exit 1;
}