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

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

Authentication at perl level for when setting user-added comments. 1. metadata-server.plnow encrypts the key, so that it can be checked against what's in the key db. 2. gdslCGI.pm now has an encrypt_key subroutine. 3. baseaction.pm's authentication_enabled is turned on and the authenticate_user() subroutine now follows recpt's userdb.cpp::check_key by first checking for a given key when no password is given, and if the key validates and isn't stale, then its timestamp in the key db is updated. The code for checking the group that the user belongs to (which had been commented out since user comments can be set by anyone with a GS account, they don't need to belong to a collection editing group) has been moved to a new function called check_group, with the line calling it commented out. 4. style.dm passes in un and ky cgi args to the gsapi object's constructor. 5. gsajaxapi.js's constructor takes the un and ky parameters and then uses these in the Get and Post methods when making calls to metadata-server.pl.

  • Property svn:executable set to *
File size: 1.8 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 and key
58 $gsdl_cgi->encrypt_password();
59 $gsdl_cgi->encrypt_key();
60
61 require cgiactions::metadataaction;
62
63
64 # Useful debug statement for seeing what packages have been included
65#### printf("%-45s%-s\n",$_,$INC{$_}) foreach (sort keys %INC);
66
67
68 $gsdl_cgi->parse_cgi_args();
69
70 # We don't want the gsdlCGI module to return errors and warnings in XML
71 $gsdl_cgi->{'xml'} = 0;
72
73 my $action = new metadataaction($gsdl_cgi,$iis6_mode);
74
75 $action->do_action();
76
77
78}
79
80
81
82&main();
Note: See TracBrowser for help on using the repository browser.