package Myproxy::Dump; use strict; use warnings; use CGI::Cookie (); use Apache2::Log (); use Apache2::RequestRec (); use APR::Table (); use Apache2::Const -compile => qw(OK); use constant X509_USER_PROXY => "X509_USER_PROXY"; sub handler { my $GLOBUS_LOCATION = "/usr/local/globus-4.0"; my $MYPROXY_SERVER = "click.ncsa.uiuc.edu"; # my $MYPROXY_EXTRA_PARAMS = "-p 7513"; my $MYPROXY_EXTRA_PARAMS = ""; my $r = shift; # ($package, $r) = $_; $r->content_type('text/html'); my %cookies = CGI::Cookie->fetch($r); my $cookies = %cookies; print qq( Protection!

Logged in via Pubcookie

logout

); #

logout clearlogin (via LocationMatch)

#

[doesn't work] logout (via .htaccess)

#

[doesn't work] logout redirect (via LocationMatch)

#

placebo

my $user = $r->user(); print("

User: $user

\n"); my $x509; if (defined(%ENV)) { $x509 = $ENV{X509_USER_PROXY}; } print("

" . X509_USER_PROXY . ": $x509

\n"); print("

Cookies:

\n"); if ($cookies ne '') { print("\n"); print("\n"); foreach (keys %cookies) { my $cookie = $cookies{$_}; my $name = $cookie->name(); my $value = $cookie->value(); my $path = $cookie->path(); print("\n" ." \n" ." \n" ." \n" ."\n"); if ($name eq 'pubcookie_g') { print('\n"); } } print("
NamePathContents
$name$path$value
' . "

Found Granting Cookie

\n"); if ($user ne '') { my $myproxy_command = "| $GLOBUS_LOCATION/bin/myproxy-logon" . " -s $MYPROXY_SERVER -l $user --stdin_pass" . " " . $MYPROXY_EXTRA_PARAMS . " >> /var/log/myproxy_out" . " 2>> /var/log/myproxy_err"; # print("

Issuing myproxy command: $myproxy_command

\n"); # my $opened = open(myproxy_handle, $myproxy_command); # if ($opened) { # # replace %20 with +, %2F with /, and %3D with = # $Value =~ s/ /\+/g; # $value =~ s/\%20/\+/g; # $value =~ s/\%2F/\//g; # $value =~ s/\%3D/=/g; # print myproxy_handle "$value\n"; # print("

Sent password

\n"); # print("
$value

\n"); # my $closed_success = close(myproxy_handle); # print("

Closed ($closed_success)? " # . ($closed_success ? "yes" : "no") . "

\n"); # my $myproxy_exit = $?; # retval stored in $? by close() # print("

Exit value = $myproxy_exit

\n"); # } else { # print("

Unable to run myproxy-logon: $!

\n"); # } } else { print("

No username found

\n"); } print("
\n"); } else { print("

No cookies found.

\n"); } print("

Environment:

\n"); if (%ENV ne '') { print("\n"); foreach (keys %ENV) { my $key = $_; my $value = $ENV{$key}; print("\n "); } print("
$key$value
\n"); } # my $conn = $r->connection; # print("Connection = $conn\n"); print("

Subprocess Env:

\n"); print("\n"); $r->subprocess_env->do(sub { print("\n "); }); print("
$_[0]$_[1]
\n"); print("

Headers:

\n"); print("\n"); $r->headers_in->do(sub { print("\n "); }); print("
$_[0]$_[1]
\n"); print qq( ); return Apache2::Const::OK; } 1;