| Lines 38-45
          use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug $ldap $cas $cas
      
      
        Link Here | 
        
          | 38 | BEGIN { | 38 | BEGIN { | 
        
          | 39 |     sub psgi_env { any { /^psgi\./ } keys %ENV } | 39 |     sub psgi_env { any { /^psgi\./ } keys %ENV } | 
        
          | 40 |     sub safe_exit { | 40 |     sub safe_exit { | 
          
            
              | 41 | 	if ( psgi_env ) { die 'psgi:exit' } | 41 |     if ( psgi_env ) { die 'psgi:exit' } | 
            
              | 42 | 	else { exit } | 42 |     else { exit } | 
        
          | 43 |     } | 43 |     } | 
        
          | 44 |     $VERSION     = 3.07.00.049;   # set version for version checking | 44 |     $VERSION     = 3.07.00.049;   # set version for version checking | 
        
          | 45 |  | 45 |  | 
  
    | Lines 53-60
          BEGIN {
      
      
        Link Here | 
        
          | 53 |     $caslogout   = C4::Context->preference('casLogout'); | 53 |     $caslogout   = C4::Context->preference('casLogout'); | 
        
          | 54 |     require C4::Auth_with_cas;             # no import | 54 |     require C4::Auth_with_cas;             # no import | 
        
          | 55 |     if ($ldap) { | 55 |     if ($ldap) { | 
          
            
              | 56 | 	require C4::Auth_with_ldap; | 56 |     require C4::Auth_with_ldap; | 
            
              | 57 | 	import C4::Auth_with_ldap qw(checkpw_ldap); | 57 |     import C4::Auth_with_ldap qw(checkpw_ldap); | 
        
          | 58 |     } | 58 |     } | 
        
          | 59 |     if ($cas) { | 59 |     if ($cas) { | 
        
          | 60 |         import  C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url); | 60 |         import  C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url); | 
  
    | Lines 234-267
          sub get_template_and_user {
      
      
        Link Here | 
        
          | 234 |                 } | 234 |                 } | 
        
          | 235 |             } | 235 |             } | 
        
          | 236 |         } | 236 |         } | 
          
            
              | 237 | 		# Logged-in opac search history | 237 |         # Logged-in opac search history | 
            
              | 238 | 		# If the requested template is an opac one and opac search history is enabled | 238 |         # If the requested template is an opac one and opac search history is enabled | 
            
              | 239 | 		if ($in->{type} eq 'opac' && C4::Context->preference('EnableOpacSearchHistory')) { | 239 |         if ($in->{type} eq 'opac' && C4::Context->preference('EnableOpacSearchHistory')) { | 
            
              | 240 | 			my $dbh = C4::Context->dbh; | 240 |             my $dbh = C4::Context->dbh; | 
            
              | 241 | 			my $query = "SELECT COUNT(*) FROM search_history WHERE userid=?"; | 241 |             my $query = "SELECT COUNT(*) FROM search_history WHERE userid=?"; | 
            
              | 242 | 			my $sth = $dbh->prepare($query); | 242 |             my $sth = $dbh->prepare($query); | 
            
              | 243 | 			$sth->execute($borrowernumber); | 243 |             $sth->execute($borrowernumber); | 
            
              | 244 | 			 | 244 |  | 
            
              | 245 | 			# If at least one search has already been performed | 245 |             # If at least one search has already been performed | 
            
              | 246 | 			if ($sth->fetchrow_array > 0) {  | 246 |             if ($sth->fetchrow_array > 0) { | 
            
              | 247 | 			# We show the link in opac | 247 |             # We show the link in opac | 
            
              | 248 | 			$template->param(ShowOpacRecentSearchLink => 1); | 248 |             $template->param(ShowOpacRecentSearchLink => 1); | 
            
              | 249 | 			} | 249 |             } | 
            
              | 250 |  | 250 |  | 
            
              | 251 | 			# And if there's a cookie with searches performed when the user was not logged in,  | 251 |             # And if there's a cookie with searches performed when the user was not logged in, | 
            
              | 252 | 			# we add them to the logged-in search history | 252 |             # we add them to the logged-in search history | 
            
              | 253 | 			my $searchcookie = $in->{'query'}->cookie('KohaOpacRecentSearches'); | 253 |             my $searchcookie = $in->{'query'}->cookie('KohaOpacRecentSearches'); | 
            
              | 254 | 			if ($searchcookie){ | 254 |             if ($searchcookie){ | 
            
              | 255 | 				$searchcookie = uri_unescape($searchcookie); | 255 |                 $searchcookie = uri_unescape($searchcookie); | 
            
              | 256 | 			        my @recentSearches = @{thaw($searchcookie) || []}; | 256 |                     my @recentSearches = @{thaw($searchcookie) || []}; | 
            
              | 257 | 				if (@recentSearches) { | 257 |                 if (@recentSearches) { | 
            
              | 258 | 					my $sth = $dbh->prepare($SEARCH_HISTORY_INSERT_SQL); | 258 |                     my $sth = $dbh->prepare($SEARCH_HISTORY_INSERT_SQL); | 
            
              | 259 | 					$sth->execute( $borrowernumber, | 259 |                     $sth->execute( $borrowernumber, | 
            
              | 260 | 						       $in->{'query'}->cookie("CGISESSID"), | 260 |                                $in->{'query'}->cookie("CGISESSID"), | 
            
              | 261 | 						       $_->{'query_desc'}, | 261 |                                $_->{'query_desc'}, | 
            
              | 262 | 						       $_->{'query_cgi'}, | 262 |                                $_->{'query_cgi'}, | 
            
              | 263 | 						       $_->{'total'}, | 263 |                                $_->{'total'}, | 
            
              | 264 | 						       $_->{'time'}, | 264 |                                $_->{'time'}, | 
        
          | 265 |                             ) foreach @recentSearches; | 265 |                             ) foreach @recentSearches; | 
        
          | 266 |  | 266 |  | 
        
          | 267 |                     # And then, delete the cookie's content | 267 |                     # And then, delete the cookie's content | 
  
    | Lines 271-304
          sub get_template_and_user {
      
      
        Link Here | 
        
          | 271 |                                                 -HttpOnly => 1, | 271 |                                                 -HttpOnly => 1, | 
        
          | 272 |                                                 -expires => '' | 272 |                                                 -expires => '' | 
        
          | 273 |                                              ); | 273 |                                              ); | 
          
            
              | 274 | 					$cookie = [$cookie, $newsearchcookie]; | 274 |                     $cookie = [$cookie, $newsearchcookie]; | 
            
              | 275 | 				} | 275 |                 } | 
            
              | 276 | 			} | 276 |             } | 
            
              | 277 | 		} | 277 |         } | 
        
          | 278 |     } | 278 |     } | 
          
            
              | 279 | 	else {	# if this is an anonymous session, setup to display public lists... | 279 |     else {    # if this is an anonymous session, setup to display public lists... | 
        
          | 280 |  | 280 |  | 
        
          | 281 |         $template->param( sessionID        => $sessionID ); | 281 |         $template->param( sessionID        => $sessionID ); | 
        
          | 282 |          | 282 |          | 
        
          | 283 |         my ($total, $pubshelves) = C4::VirtualShelves::GetSomeShelfNames(undef, 'MASTHEAD'); | 283 |         my ($total, $pubshelves) = C4::VirtualShelves::GetSomeShelfNames(undef, 'MASTHEAD'); | 
          
            
              | 284 | 	$template->param( | 284 |     $template->param( | 
            
              | 285 | 	    pubshelves     => $total->{pubtotal}, | 285 |         pubshelves     => $total->{pubtotal}, | 
            
              | 286 | 	    pubshelvesloop => $pubshelves, | 286 |         pubshelvesloop => $pubshelves, | 
            
              | 287 | 	); | 287 |     ); | 
        
          | 288 |     } | 288 |     } | 
          
            
              | 289 |  	# Anonymous opac search history | 289 |      # Anonymous opac search history | 
            
              | 290 |  	# If opac search history is enabled and at least one search has already been performed | 290 |      # If opac search history is enabled and at least one search has already been performed | 
            
              | 291 |  	if (C4::Context->preference('EnableOpacSearchHistory')) { | 291 |      if (C4::Context->preference('EnableOpacSearchHistory')) { | 
            
              | 292 | 		my $searchcookie = $in->{'query'}->cookie('KohaOpacRecentSearches'); | 292 |         my $searchcookie = $in->{'query'}->cookie('KohaOpacRecentSearches'); | 
            
              | 293 | 		if ($searchcookie){ | 293 |         if ($searchcookie){ | 
            
              | 294 | 			$searchcookie = uri_unescape($searchcookie); | 294 |             $searchcookie = uri_unescape($searchcookie); | 
            
              | 295 | 		        my @recentSearches = @{thaw($searchcookie) || []}; | 295 |                 my @recentSearches = @{thaw($searchcookie) || []}; | 
            
              | 296 |  	    # We show the link in opac | 296 |          # We show the link in opac | 
            
              | 297 | 			if (@recentSearches) { | 297 |             if (@recentSearches) { | 
            
              | 298 | 				$template->param(ShowOpacRecentSearchLink => 1); | 298 |                 $template->param(ShowOpacRecentSearchLink => 1); | 
            
              | 299 | 			} | 299 |             } | 
            
              | 300 | 	    } | 300 |         } | 
            
              | 301 |  	} | 301 |      } | 
        
          | 302 |  | 302 |  | 
        
          | 303 |     if(C4::Context->preference('dateformat')){ | 303 |     if(C4::Context->preference('dateformat')){ | 
        
          | 304 |         $template->param( dateformat => C4::Context->preference('dateformat') ); | 304 |         $template->param( dateformat => C4::Context->preference('dateformat') ); | 
  
    | Lines 559-566
          sub _version_check {
      
      
        Link Here | 
        
          | 559 |     my $version; | 559 |     my $version; | 
        
          | 560 |     # If Version syspref is unavailable, it means Koha is beeing installed, | 560 |     # If Version syspref is unavailable, it means Koha is beeing installed, | 
        
          | 561 |     # and so we must redirect to OPAC maintenance page or to the WebInstaller | 561 |     # and so we must redirect to OPAC maintenance page or to the WebInstaller | 
          
            
              | 562 | 	# also, if OpacMaintenance is ON, OPAC should redirect to maintenance | 562 |     # also, if OpacMaintenance is ON, OPAC should redirect to maintenance | 
            
              | 563 | 	if (C4::Context->preference('OpacMaintenance') && $type eq 'opac') { | 563 |     if (C4::Context->preference('OpacMaintenance') && $type eq 'opac') { | 
        
          | 564 |         warn "OPAC Install required, redirecting to maintenance"; | 564 |         warn "OPAC Install required, redirecting to maintenance"; | 
        
          | 565 |         print $query->redirect("/cgi-bin/koha/maintenance.pl"); | 565 |         print $query->redirect("/cgi-bin/koha/maintenance.pl"); | 
        
          | 566 |         safe_exit; | 566 |         safe_exit; | 
  
    | Lines 615-621
          sub _timeout_syspref {
      
      
        Link Here | 
        
          | 615 |  | 615 |  | 
        
          | 616 | sub checkauth { | 616 | sub checkauth { | 
        
          | 617 |     my $query = shift; | 617 |     my $query = shift; | 
          
            
              | 618 | 	$debug and warn "Checking Auth"; | 618 |     $debug and warn "Checking Auth"; | 
        
          | 619 |     # $authnotrequired will be set for scripts which will run without authentication | 619 |     # $authnotrequired will be set for scripts which will run without authentication | 
        
          | 620 |     my $authnotrequired = shift; | 620 |     my $authnotrequired = shift; | 
        
          | 621 |     my $flagsrequired   = shift; | 621 |     my $flagsrequired   = shift; | 
  
    | Lines 680-688
          sub checkauth {
      
      
        Link Here | 
        
          | 680 |             $session->flush;       | 680 |             $session->flush;       | 
        
          | 681 |             $session->delete(); | 681 |             $session->delete(); | 
        
          | 682 |             C4::Context->_unset_userenv($sessionID); | 682 |             C4::Context->_unset_userenv($sessionID); | 
          
            
              | 683 | 			$sessionID = undef; | 683 |             $sessionID = undef; | 
            
              | 684 | 			$userid = undef; | 684 |             $userid = undef; | 
            
              | 685 | 		} | 685 |         } | 
        
          | 686 |         elsif ($logout) { | 686 |         elsif ($logout) { | 
        
          | 687 |             # voluntary logout the user | 687 |             # voluntary logout the user | 
        
          | 688 |             $session->flush; | 688 |             $session->flush; | 
  
    | Lines 692-700
          sub checkauth {
      
      
        Link Here | 
        
          | 692 |             $sessionID = undef; | 692 |             $sessionID = undef; | 
        
          | 693 |             $userid    = undef; | 693 |             $userid    = undef; | 
        
          | 694 |  | 694 |  | 
          
            
              | 695 | 	    if ($cas and $caslogout) { | 695 |         if ($cas and $caslogout) { | 
            
              | 696 | 		logout_cas($query); | 696 |         logout_cas($query); | 
            
              | 697 | 	    } | 697 |         } | 
        
          | 698 |         } | 698 |         } | 
        
          | 699 |         elsif ( $lasttime < time() - $timeout ) { | 699 |         elsif ( $lasttime < time() - $timeout ) { | 
        
          | 700 |             # timed logout | 700 |             # timed logout | 
  
    | Lines 744-750
          sub checkauth {
      
      
        Link Here | 
        
          | 744 |             -value    => $session->id, | 744 |             -value    => $session->id, | 
        
          | 745 |             -HttpOnly => 1 | 745 |             -HttpOnly => 1 | 
        
          | 746 |         ); | 746 |         ); | 
          
            
              | 747 | 	$userid = $query->param('userid'); | 747 |     $userid = $query->param('userid'); | 
        
          | 748 |         if (   ( $cas && $query->param('ticket') ) | 748 |         if (   ( $cas && $query->param('ticket') ) | 
        
          | 749 |             || $userid | 749 |             || $userid | 
        
          | 750 |             || ( my $pki_field = C4::Context->preference('AllowPKIAuth') ) ne | 750 |             || ( my $pki_field = C4::Context->preference('AllowPKIAuth') ) ne | 
  
    | Lines 815-836
          sub checkauth {
      
      
        Link Here | 
        
          | 815 |                 $return = $value ? 1 : 0; | 815 |                 $return = $value ? 1 : 0; | 
        
          | 816 |                 $userid = $value; | 816 |                 $userid = $value; | 
        
          | 817 |  | 817 |  | 
          
            
              | 818 | 	} | 818 |     } | 
        
          | 819 |             else { | 819 |             else { | 
        
          | 820 |                 my $retuserid; | 820 |                 my $retuserid; | 
        
          | 821 |                 ( $return, $cardnumber, $retuserid ) = | 821 |                 ( $return, $cardnumber, $retuserid ) = | 
        
          | 822 |                   checkpw( $dbh, $userid, $password, $query ); | 822 |                   checkpw( $dbh, $userid, $password, $query ); | 
        
          | 823 |                 $userid = $retuserid if ( $retuserid ne '' ); | 823 |                 $userid = $retuserid if ( $retuserid ne '' ); | 
        
          | 824 |         } | 824 |         } | 
          
            
              | 825 | 	    if ($return) { | 825 |         if ($return) { | 
        
          | 826 |                #_session_log(sprintf "%20s from %16s logged in  at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); | 826 |                #_session_log(sprintf "%20s from %16s logged in  at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); | 
          
            
              | 827 |             	if ( $flags = haspermission(  $userid, $flagsrequired ) ) { | 827 |                 if ( $flags = haspermission(  $userid, $flagsrequired ) ) { | 
            
              | 828 | 					$loggedin = 1; | 828 |                     $loggedin = 1; | 
            
              | 829 |             	} | 829 |                 } | 
            
              | 830 |            		else { | 830 |                    else { | 
            
              | 831 |                 	$info{'nopermission'} = 1; | 831 |                     $info{'nopermission'} = 1; | 
            
              | 832 |                 	C4::Context->_unset_userenv($sessionID); | 832 |                     C4::Context->_unset_userenv($sessionID); | 
            
              | 833 |             	} | 833 |                 } | 
        
          | 834 |                 my ($borrowernumber, $firstname, $surname, $userflags, | 834 |                 my ($borrowernumber, $firstname, $surname, $userflags, | 
        
          | 835 |                     $branchcode, $branchname, $branchprinter, $emailaddress); | 835 |                     $branchcode, $branchname, $branchprinter, $emailaddress); | 
        
          | 836 |  | 836 |  | 
  
    | Lines 935-958
          sub checkauth {
      
      
        Link Here | 
        
          | 935 |                 ); | 935 |                 ); | 
        
          | 936 |  | 936 |  | 
        
          | 937 |             } | 937 |             } | 
          
            
              | 938 |         	else { | 938 |             else { | 
            
              | 939 |             	if ($userid) { | 939 |                 if ($userid) { | 
            
              | 940 |                 	$info{'invalid_username_or_password'} = 1; | 940 |                     $info{'invalid_username_or_password'} = 1; | 
            
              | 941 |                 	C4::Context->_unset_userenv($sessionID); | 941 |                     C4::Context->_unset_userenv($sessionID); | 
            
              | 942 |             	} | 942 |                 } | 
            
              | 943 | 			} | 943 |             } | 
            
              | 944 |         }	# END if ( $userid    = $query->param('userid') ) | 944 |         }    # END if ( $userid    = $query->param('userid') ) | 
            
              | 945 | 		elsif ($type eq "opac") { | 945 |         elsif ($type eq "opac") { | 
        
          | 946 |             # if we are here this is an anonymous session; add public lists to it and a few other items... | 946 |             # if we are here this is an anonymous session; add public lists to it and a few other items... | 
        
          | 947 |             # anonymous sessions are created only for the OPAC | 947 |             # anonymous sessions are created only for the OPAC | 
          
            
              | 948 | 			$debug and warn "Initiating an anonymous session..."; | 948 |             $debug and warn "Initiating an anonymous session..."; | 
            
              | 949 |  | 949 |  | 
            
              | 950 | 			# setting a couple of other session vars... | 950 |             # setting a couple of other session vars... | 
            
              | 951 | 			$session->param('ip',$session->remote_addr()); | 951 |             $session->param('ip',$session->remote_addr()); | 
            
              | 952 | 			$session->param('lasttime',time()); | 952 |             $session->param('lasttime',time()); | 
            
              | 953 | 			$session->param('sessiontype','anon'); | 953 |             $session->param('sessiontype','anon'); | 
            
              | 954 | 		} | 954 |         } | 
            
              | 955 |     }	# END unless ($userid) | 955 |     }    # END unless ($userid) | 
        
          | 956 |     my $insecure = C4::Context->boolean_preference('insecure'); | 956 |     my $insecure = C4::Context->boolean_preference('insecure'); | 
        
          | 957 |  | 957 |  | 
        
          | 958 |     # finished authentification, now respond | 958 |     # finished authentification, now respond | 
  
    | Lines 1032-1055
          sub checkauth {
      
      
        Link Here | 
        
          | 1032 |  | 1032 |  | 
        
          | 1033 |     if ($cas) { | 1033 |     if ($cas) { | 
        
          | 1034 |  | 1034 |  | 
          
            
              | 1035 | 	# Is authentication against multiple CAS servers enabled? | 1035 |     # Is authentication against multiple CAS servers enabled? | 
        
          | 1036 |         if (C4::Auth_with_cas::multipleAuth && !$casparam) { | 1036 |         if (C4::Auth_with_cas::multipleAuth && !$casparam) { | 
          
            
              | 1037 | 	    my $casservers = C4::Auth_with_cas::getMultipleAuth();		     | 1037 |         my $casservers = C4::Auth_with_cas::getMultipleAuth(); | 
            
              | 1038 | 	    my @tmplservers; | 1038 |         my @tmplservers; | 
            
              | 1039 | 	    foreach my $key (keys %$casservers) { | 1039 |         foreach my $key (keys %$casservers) { | 
            
              | 1040 | 		push @tmplservers, {name => $key, value => login_cas_url($query, $key) . "?cas=$key" }; | 1040 |         push @tmplservers, {name => $key, value => login_cas_url($query, $key) . "?cas=$key" }; | 
            
              | 1041 | 	    } | 1041 |         } | 
            
              | 1042 | 	    #warn Data::Dumper::Dumper(\@tmplservers); | 1042 |         #warn Data::Dumper::Dumper(\@tmplservers); | 
            
              | 1043 | 	    $template->param( | 1043 |         $template->param( | 
            
              | 1044 | 		casServersLoop => \@tmplservers | 1044 |         casServersLoop => \@tmplservers | 
            
              | 1045 | 	    ); | 1045 |         ); | 
            
              | 1046 | 	} else { | 1046 |     } else { | 
        
          | 1047 |         $template->param( | 1047 |         $template->param( | 
        
          | 1048 |             casServerUrl    => login_cas_url($query), | 1048 |             casServerUrl    => login_cas_url($query), | 
          
            
              | 1049 | 	    ); | 1049 |         ); | 
            
              | 1050 | 	} | 1050 |     } | 
        
          | 1051 |  | 1051 |  | 
          
            
              | 1052 | 	$template->param( | 1052 |     $template->param( | 
        
          | 1053 |             invalidCasLogin => $info{'invalidCasLogin'} | 1053 |             invalidCasLogin => $info{'invalidCasLogin'} | 
        
          | 1054 |         ); | 1054 |         ); | 
        
          | 1055 |     } | 1055 |     } | 
  
    | Lines 1194-1216
          sub check_api_auth {
      
      
        Link Here | 
        
          | 1194 |         # new login | 1194 |         # new login | 
        
          | 1195 |         my $userid = $query->param('userid'); | 1195 |         my $userid = $query->param('userid'); | 
        
          | 1196 |         my $password = $query->param('password'); | 1196 |         my $password = $query->param('password'); | 
          
            
              | 1197 |        	my ($return, $cardnumber); | 1197 |            my ($return, $cardnumber); | 
            
              | 1198 |  | 1198 |  | 
            
              | 1199 | 	# Proxy CAS auth | 1199 |     # Proxy CAS auth | 
            
              | 1200 | 	if ($cas && $query->param('PT')) { | 1200 |     if ($cas && $query->param('PT')) { | 
            
              | 1201 | 	    my $retuserid; | 1201 |         my $retuserid; | 
            
              | 1202 | 	    $debug and print STDERR "## check_api_auth - checking CAS\n"; | 1202 |         $debug and print STDERR "## check_api_auth - checking CAS\n"; | 
            
              | 1203 | 	    # In case of a CAS authentication, we use the ticket instead of the password | 1203 |         # In case of a CAS authentication, we use the ticket instead of the password | 
            
              | 1204 | 	    my $PT = $query->param('PT'); | 1204 |         my $PT = $query->param('PT'); | 
            
              | 1205 | 	    ($return,$cardnumber,$userid) = check_api_auth_cas($dbh, $PT, $query);    # EXTERNAL AUTH | 1205 |         ($return,$cardnumber,$userid) = check_api_auth_cas($dbh, $PT, $query);    # EXTERNAL AUTH | 
            
              | 1206 | 	} else { | 1206 |     } else { | 
            
              | 1207 | 	    # User / password auth | 1207 |         # User / password auth | 
            
              | 1208 | 	    unless ($userid and $password) { | 1208 |         unless ($userid and $password) { | 
            
              | 1209 | 		# caller did something wrong, fail the authenticateion | 1209 |         # caller did something wrong, fail the authenticateion | 
            
              | 1210 | 		return ("failed", undef, undef); | 1210 |         return ("failed", undef, undef); | 
            
              | 1211 | 	    } | 1211 |         } | 
            
              | 1212 | 	    ( $return, $cardnumber ) = checkpw( $dbh, $userid, $password, $query ); | 1212 |         ( $return, $cardnumber ) = checkpw( $dbh, $userid, $password, $query ); | 
            
              | 1213 | 	} | 1213 |     } | 
        
          | 1214 |  | 1214 |  | 
        
          | 1215 |         if ($return and haspermission(  $userid, $flagsrequired)) { | 1215 |         if ($return and haspermission(  $userid, $flagsrequired)) { | 
        
          | 1216 |             my $session = get_session(""); | 1216 |             my $session = get_session(""); | 
  
    | Lines 1453-1459
          sub get_session {
      
      
        Link Here | 
        
          | 1453 |         $session = new CGI::Session("driver:PostgreSQL;serializer:yaml;id:md5", $sessionID, {Handle=>$dbh}); | 1453 |         $session = new CGI::Session("driver:PostgreSQL;serializer:yaml;id:md5", $sessionID, {Handle=>$dbh}); | 
        
          | 1454 |     } | 1454 |     } | 
        
          | 1455 |     elsif ($storage_method eq 'memcached' && C4::Context->ismemcached){ | 1455 |     elsif ($storage_method eq 'memcached' && C4::Context->ismemcached){ | 
          
            
              | 1456 | 	$session = new CGI::Session("driver:memcached;serializer:yaml;id:md5", $sessionID, { Memcached => C4::Context->memcached } ); | 1456 |     $session = new CGI::Session("driver:memcached;serializer:yaml;id:md5", $sessionID, { Memcached => C4::Context->memcached } ); | 
        
          | 1457 |     } | 1457 |     } | 
        
          | 1458 |     else { | 1458 |     else { | 
        
          | 1459 |         # catch all defaults to tmp should work on all systems | 1459 |         # catch all defaults to tmp should work on all systems | 
  
    | Lines 1473-1483
          sub checkpw {
      
      
        Link Here | 
        
          | 1473 |  | 1473 |  | 
        
          | 1474 |     if ($cas && $query && $query->param('ticket')) { | 1474 |     if ($cas && $query && $query->param('ticket')) { | 
        
          | 1475 |         $debug and print STDERR "## checkpw - checking CAS\n"; | 1475 |         $debug and print STDERR "## checkpw - checking CAS\n"; | 
          
            
              | 1476 | 	# In case of a CAS authentication, we use the ticket instead of the password | 1476 |     # In case of a CAS authentication, we use the ticket instead of the password | 
            
              | 1477 | 	my $ticket = $query->param('ticket'); | 1477 |     my $ticket = $query->param('ticket'); | 
        
          | 1478 |         my ($retval,$retcard,$retuserid) = checkpw_cas($dbh, $ticket, $query);    # EXTERNAL AUTH | 1478 |         my ($retval,$retcard,$retuserid) = checkpw_cas($dbh, $ticket, $query);    # EXTERNAL AUTH | 
        
          | 1479 |         ($retval) and return ($retval,$retcard,$retuserid); | 1479 |         ($retval) and return ($retval,$retcard,$retuserid); | 
          
            
              | 1480 | 	return 0; | 1480 |     return 0; | 
        
          | 1481 |     } | 1481 |     } | 
        
          | 1482 |  | 1482 |  | 
        
          | 1483 |     # INTERNAL AUTH | 1483 |     # INTERNAL AUTH |