chiark / gitweb /
wip
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 11 Jan 2013 16:33:53 +0000 (16:33 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 11 Jan 2013 16:33:53 +0000 (16:33 +0000)
cgi-auth-flexible.pm
test.cgi

index f3f1599..00b766a 100644 (file)
@@ -522,8 +522,8 @@ sub _check_divert_core ($) {
             return ({ Kind => 'SMALLPAGE-NOCOOKIE',
                       Message => "You do not seem to have cookies enabled.  ".
                           "You must enable cookies as we use them for login.",
-                          CookieSecret => $r->_fresh_secret(),
-                          Params => $r->_chain_params() })
+                      CookieSecret => $r->_fresh_secret(),
+                      Params => $r->chain_params() })
         }
         if (!$cookt || $cookt eq 'n' || $cookh ne $parmh) {
             $r->_db_revoke($cookh);
@@ -538,13 +538,13 @@ sub _check_divert_core ($) {
             return ({ Kind => 'LOGIN-BAD',
                       Message => "Incorrect username/password.",
                       CookieSecret => $cooks,
-                      Params => $r->_chain_params() })
+                      Params => $r->chain_params() })
         }
        $r->_db_record_login_ok($parmh,$username);
        return ({ Kind => 'REDIRECT-LOGGEDIN',
                  Message => "Logging in...",
                  CookieSecret => $cooks,
-                 Params => $r->_chain_params() });
+                 Params => $r->chain_params() });
     }
     if ($cookt eq 't') {
        $cookt = '';
@@ -564,7 +564,7 @@ sub _check_divert_core ($) {
            return ({ Kind => 'LOGIN-INCOMINGLINK',
                      Message => "You need to log in.",
                      CookieSecret => $news,
-                     Params => $r->_chain_params() });
+                     Params => $r->chain_params() });
        } else {
            $r->_db_revoke($parmh);
            return ({ Kind => 'LOGIN-FRESH',
@@ -597,7 +597,7 @@ sub _check_divert_core ($) {
     return undef;
 }
 
-sub _chain_params ($) {
+sub chain_params ($) {
     my ($r) = @_;
     my %p = %{ $r->_ch('get_params') };
     foreach my $pncn (keys %{ $r->{S} }) {
index 289ac71..0715861 100755 (executable)
--- a/test.cgi
+++ b/test.cgi
@@ -43,18 +43,22 @@ Set-Cookie: $cookie
 <pre>
 END
 
-my %vars = $q->Vars();
-delete $vars{caf_assochash};
+my $newurl = $authreq->url_with_query_params($authreq->chain_params());
+my $newurl_esc = escapeHTML($newurl);
 
 my $txt = Data::Dumper->Dump([$authreq->get_username(), $authreq->mutate_ok(),
-                              $q->path_info(), \%vars],
-                             [qw(username mutate_ok path params)]);
+                              $q->path_info(),
+                              $authreq->chain_params(),
+                              scalar $q->Vars()],
+                             [qw(username mutate_ok path
+                                 authreq->chain_params() cgi->params())]);
 foreach my $l (split /\n/, $txt) {
     print escapeHTML($l),"\n";
 }
 
 print <<END;
 </pre>
+<a href="$newurl_esc">$newurl_esc</a>
 <form method="POST" action="$url">
 $hiddenhtml
 <input type="submit" name="test_cgi_sponges" value="Make sponges">