Changeset 26206 for main/trunk/greenstone2/common-src/cgi-bin
- Timestamp:
- 2012-09-18T18:10:37+12:00 (12 years ago)
- Location:
- main/trunk/greenstone2/common-src/cgi-bin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/common-src/cgi-bin/gliserver.pl
r25963 r26206 230 230 # Get the user account information from the usersDB database 231 231 my %users_db_data = (); 232 foreach my $users_db_entry (split(/-{70}/, $users_db_content)) { 233 if ($users_db_entry =~ m/\n?\[(.+)\]\n/) { 232 233 # a line dividing one user entry from another is made up of 70 hyphens for GS2 (37 hyphens for GS3) 234 my $horizontal_divider = ($gsdl_cgi->greenstone_version() == 2) ? q/-{70}/ : q/-{37}/; 235 foreach my $users_db_entry (split($horizontal_divider, $users_db_content)) { 236 if ($users_db_entry =~ m/\n?\[(.+)\]\n/ || $users_db_entry =~ m/\n?USERNAME = ([^\n]*)\n/) { # GS2 and GS3 formats 234 237 $users_db_data{$1} = $users_db_entry; 235 238 } … … 243 246 244 247 # Check password 245 my ($valid_user_password) = ($user_data =~ m/\<password\>(.*)/); 248 my $pwdLine = ($gsdl_cgi->greenstone_version() == 2) ? q/\<password\>(.*)/ : q/\n?PASSWORD = (.*)\n/; 249 my ($valid_user_password) = ($user_data =~ m/$pwdLine/); 246 250 if ($user_password ne $valid_user_password) { 247 251 $gsdl_cgi->generate_error("Authentication failed: incorrect password."); … … 249 253 250 254 # Check group 251 my ($user_groups) = ($user_data =~ m/\<groups\>(.*)/); 255 my $groupLine = ($gsdl_cgi->greenstone_version() == 2) ? q/\<groups\>(.*)/ : q/\n?GROUPS = (.*)\n/; 256 my ($user_groups) = ($user_data =~ m/$groupLine/); 252 257 253 258 if ($collection eq "") { -
main/trunk/greenstone2/common-src/cgi-bin/gsdlCGI.pm
r25078 r26206 517 517 } 518 518 $ENV{'GSDL3HOME'} = $gsdl3home; 519 } 520 519 } 521 520 522 521 my $gsdl_bin_script = &util::filename_cat($gsdlhome,"bin","script"); … … 751 750 } 752 751 752 # used with old GS3 authentication 753 753 sub rot13() 754 754 { … … 775 775 } 776 776 777 # used along with new GS3 authentication 778 sub hash_pwd() 779 { 780 my $self = shift @_; 781 my ($password)=@_; 782 783 my $gsdl3srchome = $ENV{'GSDL3SRCHOME'}; 784 785 my $java = get_java_path(); 786 my $java_gsdl3_classpath = &util::filename_cat($gsdl3srchome, "web", "WEB-INF", "lib", "gsdl3.jar"); 787 my $java_remaining_classpath = &util::filename_cat($gsdl3srchome, "web", "WEB-INF", "lib", "*"); # log4j etc 788 my $java_classpath; 789 my $gsdlos = $ENV{'GSDLOS'}; 790 if ($gsdlos !~ m/windows/){ 791 $java_classpath = $java_gsdl3_classpath . ":" . $java_remaining_classpath; 792 }else{ 793 $java_classpath = $java_gsdl3_classpath . ";" . $java_remaining_classpath; 794 } 795 796 my $java_command="\"$java\" -classpath \"$java_classpath\" org.greenstone.gsdl3.service.Authentication \"$password\""; # 2>&1"; 797 my $hashedpwd = `$java_command`; 798 799 return $hashedpwd; 800 } 801 777 802 sub encrypt_password 778 803 { … … 781 806 if (defined $self->param("pw")) { ## 782 807 if ($self->{'greenstone_version'} == 3) { # GS3 is in Java, so needs different encryption 783 $self->param('-name' => "pw", '-value' => $self->rot13($self->clean_param("pw"))); 808 #$self->param('-name' => "pw", '-value' => $self->rot13($self->clean_param("pw"))); ## when using old GS3 authentication 809 810 my $hashedPwd = $self->hash_pwd($self->clean_param("pw")); # for GS3's new Authentication 811 $self->param('-name' => "pw", '-value' => $hashedPwd); 784 812 } 785 813 else { # GS2 (and versions of GS other than 3?)
Note:
See TracChangeset
for help on using the changeset viewer.