head	1.7;
access;
symbols
	RELEASE_7_2_0:1.6
	RELEASE_7_1_0:1.6
	RELEASE_6_4_0:1.6
	RELEASE_5_EOL:1.6
	RELEASE_7_0_0:1.6
	RELEASE_6_3_0:1.6
	PRE_XORG_7:1.6
	RELEASE_4_EOL:1.6
	RELEASE_6_2_0:1.6
	RELEASE_6_1_0:1.6
	RELEASE_5_5_0:1.6
	RELEASE_6_0_0:1.6
	RELEASE_5_4_0:1.6
	RELEASE_4_11_0:1.6
	RELEASE_5_3_0:1.6
	RELEASE_4_10_0:1.6
	RELEASE_5_2_1:1.6
	RELEASE_5_2_0:1.6
	RELEASE_4_9_0:1.6
	RELEASE_5_1_0:1.6
	RELEASE_4_8_0:1.6
	RELEASE_5_0_0:1.6
	RELEASE_4_7_0:1.6
	RELEASE_4_6_2:1.6
	RELEASE_4_6_1:1.6
	RELEASE_4_6_0:1.6
	RELEASE_5_0_DP1:1.6
	RELEASE_4_5_0:1.6
	RELEASE_4_4_0:1.6
	RELEASE_4_3_0:1.6
	RELEASE_4_2_0:1.6
	RELEASE_4_1_1:1.6
	RELEASE_4_1_0:1.6
	RELEASE_3_5_0:1.6
	RELEASE_4_0_0:1.5
	RELEASE_3_4_0:1.5
	RELEASE_3_3_0:1.4
	RELEASE_3_2_0:1.4
	RELEASE_3_1_0:1.4
	RELEASE_2_2_8:1.4;
locks; strict;
comment	@# @;


1.7
date	2009.07.08.02.35.36;	author pgollucci;	state dead;
branches;
next	1.6;

1.6
date	2000.05.06.01.55.06;	author ache;	state Exp;
branches;
next	1.5;

1.5
date	99.11.17.14.24.02;	author ache;	state Exp;
branches;
next	1.4;

1.4
date	98.11.03.18.44.04;	author ache;	state Exp;
branches;
next	1.3;

1.3
date	98.11.03.10.34.42;	author ache;	state Exp;
branches;
next	1.2;

1.2
date	98.11.03.07.11.28;	author ache;	state Exp;
branches;
next	1.1;

1.1
date	98.11.02.20.04.29;	author ache;	state Exp;
branches;
next	;


desc
@@


1.7
log
@- patch file shuffle for my sanity
@
text
@--- cgi-bin/webglimpse.orig	Mon Jul 27 22:59:49 1998
+++ cgi-bin/webglimpse	Sat May  6 02:24:03 2000
@@@@ -39,6 +39,9 @@@@
 # **** **** **** ****    CONFIGURABLE VARIABLES     **** **** **** ****
 # We need some of these to find our libraries, so wrap them in a BEGIN block
 
+use POSIX qw(locale_h);
+use locale;
+
 BEGIN{
 
 $WEBGLIMPSE_HOME = "/usr/local/webglimpse";
@@@@ -117,16 +120,21 @@@@
 # Added optional module to support result caching
 $QS_cache = '';
 
+$charset = '';
+$put_header = 0;
+
 # **** **** **** **** Done settings **** **** **** ****
 
-BEGIN {
+sub http_header {
+
+return if ($put_header);
+$put_header = 1;
+
 # make the output as we can
 $| = 1;
 
 # might as well start the message now	
-print "Content-type: text/html\n\n";
-
-print "<!-- TESTING -->\n";
+print "Content-type: text/html$charset\n\n";
 
 }
 
@@@@ -187,10 +195,12 @@@@
 
 
 $indexdir = $path_info;
+$indexdir =~ s|\0||g;
 
 # Check that indexdir has no single quote characters; it will be used on a command line
 $indexdir =~ s/[\']//g;
 
+$indexdir =~ s/\\/\\\\/g;
 
 # Added check for ".." as per CERT 11/7/97 --GB
 if ($indexdir =~ /\.\./) {
@@@@ -216,10 +226,20 @@@@
 $nhhops = 0;
 $traverse_type = 0;
 $urlpath = '';
+$vhost = '';
+$usemaxmem = '';
+$locale = '';
 @@urllist = ();
 
 ($title, $urlpath, $traverse_type, $explicit_only, $numhops,
- $nhhops, $local_limit, $remote_limit, $addboxes, @@urllist) = ReadConfig($indexdir);
+ $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset, @@urllist) = ReadConfig($indexdir);
+
+$ENV{LC_CTYPE}=$locale if ($locale ne '');
+setlocale(LC_CTYPE, "");
+
+$charset = "; charset=$charset" if ($charset ne '');
+
+&http_header;
 
 # Ensure that Glimpse is available on this machine
 -x $GLIMPSE_LOC || &err_noglimpse($GLIMPSE_LOC) ;
@@@@ -232,6 +252,9 @@@@
 
 $QS_query =~ s|\+| |g;
 $QS_query =~ s|%(\w\w)|sprintf("%c", hex($1))|ge;
+$QS_query =~ s|\0||g;
+$QS_query =~ s|^\-+||;
+$QS_query =~ s|\\|\\\\|g;
 $pquery = $QS_query;
 $QS_query =~ s|\'|\'\"\'\"\'|g;
 
@@@@ -247,8 +270,11 @@@@
 $OPT_age = '';
 $OPT_age = "-Y $QS_age" if $QS_age =~ /^[0-9]+$/;
 # print "OPT_age = $OPT_age<br>\n";
+$QS_filter =~ s/\0//g;
+$QS_filter =~ s/\\/\\\\/g;
 $QS_filter =~ s/\./\\./g;
 $QS_filter =~ s/\'//g;
+$QS_filter =~ s/^\-+//;
 $OPT_filter = '';
 $OPT_filter="-F '$QS_filter'"	if $QS_filter;
 
@@@@ -382,7 +408,7 @@@@
 	# Security note: using $indexdir on the command line could be dangerous if a directory really exists whose name contains shell control characters. 10/17/97 --GB
 	#$cmd = "$GLIMPSE_LOC -j -z -y $OPT_file $OPT_linenums $OPT_age $OPT_case $OPT_whole $OPT_errors -H . " . Added -U -W --> bgopal oct/6/96
 	$cmd = "$GLIMPSE_LOC -U -W -j -z -y $OPT_file $OPT_linenums $OPT_age $OPT_case $OPT_whole $OPT_errors -H $indexdir " .
-	 "$OPT_filter '$QS_query' 2>&1 |";
+	 "$OPT_filter '$QS_query' |";
 
 	# Fool perl -T into accepting $cmd for execution.  (as per Peter Bigot) --GB 10/17/97
 	# We assume that we have sufficiently checked the parameters to be safe at this point.  
@@@@ -399,7 +425,7 @@@@
 	# print "<br>now (after init): $hour:$min:$sec<br>\n";
 	
 
-	# print "<!-- Glimpse command: $cmd -->\n";
+	print "<!-- Glimpse command: $cmd -->\n";
 	# Save pid of the pipe command so we can do cleanup later.
 	if (!($gpid = open(GOUT, $cmd ))) {
 	   &err_noglimpse($cmd);
@@@@ -409,7 +435,7 @@@@
 
 	# check the return code
 	$rc = $? >> 8;
-	if($rc!=0){
+	if($rc>1){
 	   # it's an error!
 	   &err_badglimpse(@@glines);
 	}	
@@@@ -510,12 +536,12 @@@@
 		$charcount = 0;
 		if ($fcount>=$maxfiles) {
 
-			print $mOutput->limitMaxFiles($maxfiles);
+			$mOutput->limitMaxFiles($maxfiles);
 
 			$file = "";
-# Keep the real # of lines retrieved!  The "at least" message can be in the output module.
-#			$fcount = "at least $fcount";
-#			$lcount = "at least $lcount";
+
+			$fcount++;
+
 			last line;
 		}
 		print $mOutput->{end_file_marker} if ( $prevfile ne "" );
@@@@ -620,9 +646,9 @@@@
 
 # If we jumped out because of max files, we already printed the necessary ending codes
 # otherwise, do it now.
-($fcount < $maxfiles) && print $mOutput->makeEndHits($file);
+($fcount <= $maxfiles) && print $mOutput->makeEndHits($file);
 
-if (($fcount >= $maxfiles) && $USE_CACHE && $mCache && $HAVE_CUSTOM_OUTPUT) {
+if (($fcount > $maxfiles) && $USE_CACHE && $mCache && $HAVE_CUSTOM_OUTPUT) {
 	print $mOutput->makeNextHits($indexdir, $cachefile, $QS_query, $maxfiles, $maxlines, $maxchars);
 }
 
@@@@ -667,7 +693,7 @@@@
 sub err_noneighborhood {
 
 	local($_) = @@_;
-
+	&http_header;
 	# neighborhood does not exist
 	print <<EOM;
 <hr>
@@@@ -683,6 +709,7 @@@@
 
 ##########################################################################
 sub err_noquery {
+   &http_header;
    #	The script was called without a query. 
    #	Provide an ISINDEX type response for browsers
    #	without form support.
@@@@ -732,6 +759,7 @@@@
 ##########################################################################
 sub err_noglimpse {
 local($_) = @@_;
+   &http_header;
    #
    # Glimpse was not found
    # Report a useful message
@@@@ -756,6 +784,7 @@@@
 ##########################################################################
 sub err_badglimpse {
    my(@@glines) = @@_;
+   &http_header;
    #
    # Glimpse had an error
    # Report a useful message
@@@@ -786,6 +815,7 @@@@
 ##########################################################################
 sub err_noindex {
 	local ($indexdir) = @@_;
+	&http_header;
 # Glimpse index was not found
 # Give recommendations for indexing
 	print "<TITLE>Glimpse Index not found</TITLE>\n";
@@@@ -801,6 +831,7 @@@@
 }
 ##########################################################################
 sub err_insecurepath {
+	&http_header;
 # Path user requested contains ".." characters
 	print "<TITLE>Path not accepted</TITLE>\n";
 	print "</HEAD>\n";
@@@@ -814,6 +845,7 @@@@
 
 ##########################################################################
 sub err_conf {
+	&http_header;
 # Glimpse archive Configuration File was not found
 	print "<TITLE>Glimpse Archive Configuration File not found</TITLE>\n";
 	print "</HEAD>\n";
@@@@ -827,6 +859,7 @@@@
 
 ##########################################################################
 sub err_badquery {
+	&http_header;
 	print "<TITLE>Query is too broad</TITLE>\n";
 	print "</HEAD>\n";
 	print "<BODY>\n";
@@@@ -840,6 +873,7 @@@@
 
 ##########################################################################
 sub err_locked {
+	&http_header;
 	print "<TITLE>Indexing in progress</TITLE>\n";
 	print "</HEAD>\n";
 	print "<BODY>\n";
@


1.6
log
@MASTER_SITE gone, switch to new one
Update WWW
Update for new glimpse
@
text
@@


1.5
log
@CGI security fixes
@
text
@d2 1
a2 1
+++ cgi-bin/webglimpse	Wed Nov 17 16:51:58 1999
d105 18
@


1.4
log
@narrow localization to LC_CTYPE only
@
text
@d2 1
a2 1
+++ cgi-bin/webglimpse	Tue Nov  3 13:15:40 1998
d39 14
a52 1
@@@@ -216,10 +224,20 @@@@
d74 32
a105 1
@@@@ -510,7 +528,7 @@@@
d113 22
a134 2
 # Keep the real # of lines retrieved!  The "at least" message can be in the output module.
@@@@ -667,7 +685,7 @@@@
d143 1
a143 1
@@@@ -683,6 +701,7 @@@@
d151 1
a151 1
@@@@ -732,6 +751,7 @@@@
d159 1
a159 1
@@@@ -756,6 +776,7 @@@@
d167 1
a167 1
@@@@ -786,6 +807,7 @@@@
d175 1
a175 1
@@@@ -801,6 +823,7 @@@@
d183 1
a183 1
@@@@ -814,6 +837,7 @@@@
d191 1
a191 1
@@@@ -827,6 +851,7 @@@@
d199 1
a199 1
@@@@ -840,6 +865,7 @@@@
@


1.3
log
@fix html output
@
text
@d52 1
a52 1
+$ENV{LANG}=$locale if ($locale ne '');
@


1.2
log
@minor tweaks
@
text
@d2 1
a2 1
+++ cgi-bin/webglimpse	Tue Nov  3 09:20:24 1998
d61 9
@


1.1
log
@Localize it
@
text
@d2 1
a2 1
+++ cgi-bin/webglimpse	Mon Nov  2 15:06:45 1998
d13 1
a13 1
@@@@ -117,14 +120,21 @@@@
d33 2
d37 1
a37 1
 print "<!-- TESTING -->\n";
d39 1
a39 1
@@@@ -216,10 +226,20 @@@@
d61 1
a61 1
@@@@ -667,7 +687,7 @@@@
d70 1
a70 1
@@@@ -683,6 +703,7 @@@@
d78 1
a78 1
@@@@ -732,6 +753,7 @@@@
d86 1
a86 1
@@@@ -756,6 +778,7 @@@@
d94 1
a94 1
@@@@ -786,6 +809,7 @@@@
d102 1
a102 1
@@@@ -801,6 +825,7 @@@@
d110 1
a110 1
@@@@ -814,6 +839,7 @@@@
d118 1
a118 1
@@@@ -827,6 +853,7 @@@@
d126 1
a126 1
@@@@ -840,6 +867,7 @@@@
@

