Changeset 26206
- Timestamp:
- 2012-09-18T18:10:37+12:00 (12 years ago)
- Location:
- main/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r24905 r26206 372 372 isLocalLibrary = LocalLibraryServer.start(gsdl_path, local_library_path); 373 373 } 374 else {374 else if (!isGsdlRemote) { // local GS3, start the local tomcat 375 375 GS3ServerThread thread = new GS3ServerThread(gsdl3_src_path, "restart"); 376 376 thread.start(); -
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?) -
main/trunk/greenstone2/perllib/util.pm
r26017 r26206 1017 1017 return $OID; 1018 1018 } 1019 1019 1020 sub envvar_prepend { 1020 1021 my ($var,$val) = @_; 1022 1023 # 64 bit linux can't handle ";" as path separator, so make sure to set this to the right one for the OS 1024 my $pathsep = (defined $ENV{'GSDLOS'} && $ENV{'GSDLOS'} !~ m/windows/) ? ":" : ";"; 1021 1025 1022 1026 # do not prepend any value/path that's already in the environment variable … … 1027 1031 } 1028 1032 elsif($ENV{$var} !~ m/$escaped_val/) { 1029 $ENV{$var} = "$val ;".$ENV{$var};1033 $ENV{$var} = "$val".$pathsep.$ENV{$var}; 1030 1034 } 1031 1035 } … … 1033 1037 sub envvar_append { 1034 1038 my ($var,$val) = @_; 1039 1040 # 64 bit linux can't handle ";" as path separator, so make sure to set this to the right one for the OS 1041 my $pathsep = (defined $ENV{'GSDLOS'} && $ENV{'GSDLOS'} !~ m/windows/) ? ":" : ";"; 1035 1042 1036 1043 # do not append any value/path that's already in the environment variable 1037 1044 1038 1045 my $escaped_val = &filename_to_regex($val); # escape any backslashes and brackets for upcoming regex 1039 1046 if (!defined($ENV{$var})) { … … 1041 1048 } 1042 1049 elsif($ENV{$var} !~ m/$escaped_val/) { 1043 $ENV{$var} .= ";$val";1050 $ENV{$var} = $ENV{$var}.$pathsep."$val"; 1044 1051 } 1045 1052 } -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/Authentication.java
r25852 r26206 1037 1037 return collect_list_node; 1038 1038 } 1039 1040 // main() method - calls hashPassword() on any String argument, printing this to stdout 1041 // This main() is invoked by gliserver.pl perl code to encrypt passwords identically to Java code. 1042 public static void main(String[] args) { 1043 if(args.length < 1) { 1044 System.err.println("Usage: Authentication <string to encrypt>"); 1045 System.exit(-1); 1046 } 1047 // just hash the first argument 1048 String hash = Authentication.hashPassword(args[0]); 1049 System.out.println(hash); 1050 } 1039 1051 }
Note:
See TracChangeset
for help on using the changeset viewer.