source: main/trunk/greenstone2/common-src/cgi-bin/metadata-server.pl@ 27295

Last change on this file since 27295 was 27295, checked in by ak19, 11 years ago

This commit contains bugfixes for authentication within metadata-server.pl and related perl code, and is committed separately before changes in gsajaxapi.js start to make use of it. Another important change is that for adding user comments, a user need not be in the collection's group, so checking the group shouldn't be performed. The bugfixes are to get the authentication to work and are in addition to an earlier commit that corrected the name of the authentication_enable variable in baseaction.pm. The bugfixes are: users.gdb instead of users.db, metadata-server.pl needs to call gsdlCGI's encrypt_password otherwise the password check will fail because it won't match with what's in the db. Also, the calls to authenticate_user had to be through the self variable, since its a method not a function and failed to work correctly otherwise.

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/usr/bin/perl -w
2##!C:\\Perl\\bin\\perl -w
3# If not explicitly associating .pl filename ending with Perl in the
4# web server's configuration file, then need to specify the full path of
5# Perl above
6
7use strict;
8
9BEGIN {
10 # Line to stop annoying child DOS CMD windows from appearing
11 Win32::SetChildShowWindow(0)
12 if defined &Win32::SetChildShowWindow;
13
14}
15
16# Set this to 1 to work around IIS 6 craziness
17my $iis6_mode = 0;
18
19
20# IIS 6: for some reason, IIS runs this script with the working
21# directory set to the Greenstone directory rather than the cgi-bin
22# directory, causing lots of stuff to fail
23if ($iis6_mode)
24{
25 # Change into cgi-bin\<OS> directory
26 chdir("cgi-bin");
27 if(defined $ENV{'GSDLARCH'}) {
28 chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
29 } else {
30 chdir($ENV{'GSDLOS'});
31 }
32}
33
34
35# We use require and an eval here (instead of "use") to catch any
36# errors loading the module (for IIS)
37eval('require "./gsdlCGI.pm"');
38if ($@)
39{
40 print STDOUT "Content-type:text/plain\n\n";
41 print STDOUT "ERROR: $@\n";
42 exit 0;
43}
44
45
46sub main
47{
48 my $gsdl_cgi = new gsdlCGI();
49
50
51 # Load the Greenstone modules that we need to use
52 $gsdl_cgi->setup_gsdl();
53
54 my $gsdlhome = $ENV{'GSDLHOME'};
55 $gsdl_cgi->checked_chdir($gsdlhome);
56
57 # Encrypt the password
58 $gsdl_cgi->encrypt_password();
59
60 require cgiactions::metadataaction;
61
62
63 # Useful debug statement for seeing what packages have been included
64#### printf("%-45s%-s\n",$_,$INC{$_}) foreach (sort keys %INC);
65
66
67 $gsdl_cgi->parse_cgi_args();
68
69 # We don't want the gsdlCGI module to return errors and warnings in XML
70 $gsdl_cgi->{'xml'} = 0;
71
72 my $action = new metadataaction($gsdl_cgi,$iis6_mode);
73
74 $action->do_action();
75
76
77}
78
79
80
81&main();
Note: See TracBrowser for help on using the repository browser.