head	1.13;
access;
symbols
	TIGRIS_1_1_0RC2:1.2.6.5
	TIGRIS_1_1_0RC1:1.2.6.5
	TIGRIS_1_1:1.2.6.5.0.2
	TIGRIS_1_0_8:1.2.6.5
	TIGRIS_1_0_8RC3:1.2.6.5
	TIGRIS_1_0_8RC2:1.2.6.5
	TIGRIS_1_0_8RC1:1.2.6.5
	TIGRIS_1_0_7:1.2.6.5
	TIGRIS_1_0_7RC3:1.2.6.5
	TIGRIS_1_0_7RC2:1.2.6.5
	TIGRIS_1_0_7RC1:1.2.6.5
	TIGRIS_1_0_6:1.2.6.5
	TIGRIS_1_0_6RC5:1.2.6.5
	TIGRIS_1_0_6RC4:1.2.6.5
	TIGRIS_1_0_6RC3:1.2.6.5
	TIGRIS_1_0_6RC2:1.2.6.5
	TIGRIS_1_0_6RC1:1.2.6.5
	TIGRIS_1_0_5:1.2.6.4
	TIGRIS_1_0_5RC6:1.2.6.4
	TIGRIS_1_0_5RC5:1.2.6.4
	TIGRIS_1_0_5RC4:1.2.6.4
	TIGRIS_1_0_5RC3:1.2.6.4
	TIGRIS_1_0_5RC2:1.2.6.4
	TIGRIS_1_0_5RC1:1.2.6.4
	TIGRIS_1_0_4:1.2.6.4
	TIGRIS_1_0_3:1.2.6.2
	TIGRIS_1_0_2:1.2.6.2
	TIGRIS_1_0_1:1.2.6.1
	TIGRIS_1_0:1.2.0.6
	TIGRIS_1_0_0:1.2
	TIGRIS_1_0_0_RC1:1.2.0.2
	dlr:1.1.1
	HELM_PEER_PORT_BRANCH:1.1.1.1;
locks; strict;
comment	@# @;


1.13
date	2001.08.15.19.28.01;	author ms;	state Exp;
branches;
next	1.12;

1.12
date	2001.08.15.18.53.55;	author ms;	state Exp;
branches;
next	1.11;

1.11
date	2001.05.31.19.16.28;	author elicia;	state Exp;
branches;
next	1.10;

1.10
date	2001.05.23.00.32.07;	author dlr;	state Exp;
branches;
next	1.9;

1.9
date	2001.05.23.00.16.41;	author dlr;	state Exp;
branches;
next	1.8;

1.8
date	2001.05.02.20.09.29;	author ms;	state Exp;
branches;
next	1.7;

1.7
date	2001.04.30.17.43.13;	author ms;	state Exp;
branches;
next	1.6;

1.6
date	2001.04.19.02.10.57;	author dlr;	state Exp;
branches;
next	1.5;

1.5
date	2001.04.14.01.20.00;	author elicia;	state Exp;
branches;
next	1.4;

1.4
date	2001.04.13.23.03.15;	author ms;	state Exp;
branches;
next	1.3;

1.3
date	2001.04.13.22.57.09;	author ms;	state Exp;
branches;
next	1.2;

1.2
date	2001.02.21.03.02.31;	author edk;	state Exp;
branches
	1.2.6.1;
next	1.1;

1.1
date	2001.02.15.20.46.39;	author ms;	state dead;
branches
	1.1.1.1
	1.1.2.1;
next	;

1.1.1.1
date	2001.02.21.00.35.48;	author dlr;	state Exp;
branches;
next	;

1.1.2.1
date	2001.02.15.20.46.39;	author ms;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2001.02.16.23.46.17;	author ms;	state Exp;
branches;
next	;

1.2.6.1
date	2001.04.17.10.40.25;	author jrobbins;	state Exp;
branches;
next	1.2.6.2;

1.2.6.2
date	2001.04.23.19.09.34;	author jrobbins;	state Exp;
branches;
next	1.2.6.3;

1.2.6.3
date	2001.05.01.00.44.40;	author ms;	state Exp;
branches;
next	1.2.6.4;

1.2.6.4
date	2001.05.02.20.07.48;	author ms;	state Exp;
branches;
next	1.2.6.5;

1.2.6.5
date	2001.06.04.03.53.41;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.13
log
@dlr tells me this isnt needed since the fileserv system has been changed to one file per directory
@
text
@#!/usr/bin/perl -w

# Program to write htaccess file for a given project.  Designed to be called 
# via Java, so exit return codes are simple int's.
# This script takes a URL made up by Project.writeHtaccessFile and uses CGI.pm
# to decode the parameters.

use strict;
use Fcntl ':flock'; 
use CGI;
use CGI::Carp qw(fatalsToBrowser);

if (@@ARGV != 2)
{
    exit("writeHtaccessFile requires two arguments, file name and URL");
}

my ($filename, $url) = @@ARGV;
(my $query_string = $url) =~ s,^([^?]+)\?,,;
my $uri = $1;

undef (%ENV);
@@ARGV = @@ARGV[1..$#ARGV + 1];

$ENV{QUERY_STRING} = $query_string;
$ENV{SCRIPT_URI}   = $uri;

my $r = new CGI();
open HTACCESS, ">$filename" or die("Error writing htaccess file, problem[$!]");
flock(HTACCESS, LOCK_EX);
for my $key ($r->param())
{
    if ($key =~ /^https?:/) { next; }
    my $value = $r->param($key);
    my $filename = $key;
    # Backslash escape double quotes to prevent .htaccess syntax issues.
    $filename =~ s/"/\\"/g; 

print HTACCESS << "OUT";
<Files "$filename">
    AuthName          MDAAuth
    AuthType          Basic
    require           valid-user
    MDARealmMask      $value
    MDAAuthLoginURL   $uri
    MDAAuthTimeoutURL $uri?msg=Authorization+timed+out
    MDAAuthTimeoutMin 1
</Files>

OUT
}

close HTACCESS;
flock(HTACCESS, LOCK_UN);
@


1.12
log
@dont overwrite the projects uploads everytime, just add the new file entry
@
text
@d29 1
a29 1
open HTACCESS, ">>$filename" or die("Error writing htaccess file, problem[$!]");
@


1.11
log
@Dropped $type parameter from URL arguments.
@
text
@d29 1
a29 1
open HTACCESS, ">$filename" or die("Error writing htaccess file, problem[$!]");
@


1.10
log
@Added backslash escape of double quotes in file names (because we're
enclosing the file names in double quotes).
@
text
@d3 3
a5 3
# program to write htaccess file for a given project. designed to be called 
# via java so exit return codes are simple int's.
# this script takes a url made up by Project.writeHtaccessFile and uses CGI.pm
d35 1
a35 2
    $key =~ m/([^-]+)-(.*)/;
    my ($type, $filename) = ($1, $2);
d46 1
a46 1
    MDAAuthTimeoutURL $uri?msg=$type+authorization+timed+out
@


1.9
log
@Rolled back last change by ms as part of the solution for IZ #3588.
Files will be written to the file system with the same name that they
were uploaded with so that downloaded copies will share the same name.
@
text
@d37 2
@


1.8
log
@url encode spaces in filenames
@
text
@d37 1
a37 2
    #uri encode filenames
    $filename =~ s/\s/%20/g; 
@


1.7
log
@fix to allow - in filenames
@
text
@d37 2
a38 1

@


1.6
log
@* Added badly needed whitespace to increase readability.

* Don't barf on HTTPS.

* Shifted text printed to .htaccess file to be left adjusted and
unquoted randomly quoted values that needn't be quoted.
@
text
@d35 2
a36 1
    my ($type, $filename) = split(/-/, $key);
@


1.5
log
@ms fixed it so that it would write to the .htaccess file for file uploads
Submitted by:	ms
@
text
@d13 3
a15 2
if (@@ARGV != 2){
    exit ("writeHtaccessFile requires two arguments, Filename and Url");
d19 1
a19 1
(my $query_string = $url) =~s,^([^?]+)\?,,;
d23 1
a23 1
@@ARGV=@@ARGV[1..$#ARGV+1];
d33 1
a33 1
    if ($key =~/^http:/) { next }
d35 2
a36 1
    my ($type, $filename)=split /-/, $key;
d38 9
a46 9
       <Files "$filename">  
            AuthName MDAAuth
            AuthType Basic
            require valid-user
            MDARealmMask $value
            MDAAuthLoginURL $uri
            MDAAuthTimeoutURL "$uri?msg=$type+authorization+timed+out."
            MDAAuthTimeoutMin 1
       </Files>
a48 1

@


1.4
log
@printing to the file, dont know how this was broken
@
text
@d14 1
a14 1
    exit ("1writeHtaccessFile requires two arguments, Filename and Url");
a17 1

a29 1

a34 1
    my $timeoutURL = $uri . "?msg=";
a35 1

@


1.3
log
@better error checking
@
text
@d38 1
a38 1
print << "OUT";
@


1.2
log
@adding files from the branch to the head
@
text
@d29 1
a29 1
open HTACCESS, ">$filename" or exit("1$!");
@


1.2.6.1
log
@buddied MDA .htaccess changes from head to branch
@
text
@d14 1
a14 1
    exit ("writeHtaccessFile requires two arguments, Filename and Url");
d18 1
a21 1

d29 1
a29 1
open HTACCESS, ">$filename" or die("Error writing htaccess file, problem[$!]");
d31 1
d37 3
a39 1
print HTACCESS << "OUT";
@


1.2.6.2
log
@buddying dlr changes from head to branch
@
text
@d13 2
a14 4

if (@@ARGV != 2)
{
    exit("writeHtaccessFile requires two arguments, file name and URL");
d18 1
a18 1
(my $query_string = $url) =~ s,^([^?]+)\?,,;
d23 1
a23 1
@@ARGV = @@ARGV[1..$#ARGV + 1];
d33 1
a33 1
    if ($key =~ /^https?:/) { next; }
d35 11
a45 1
    my ($type, $filename) = split(/-/, $key);
a46 10
print HTACCESS << "OUT";
<Files "$filename">
    AuthName          MDAAuth
    AuthType          Basic
    require           valid-user
    MDARealmMask      $value
    MDAAuthLoginURL   $uri
    MDAAuthTimeoutURL $uri?msg=$type+authorization+timed+out
    MDAAuthTimeoutMin 1
</Files>
d48 1
@


1.2.6.3
log
@putting fix into branch for - in filenames
@
text
@d13 1
d23 1
d37 1
a37 2
    $key =~ m/([^-]+)-(.*)/;
    my ($type, $filename) = ($1, $2);
a48 1

@


1.2.6.4
log
@url encode spaces in filenames
@
text
@d37 1
a37 2
    #uri encode filenames
    $filename =~ s/\s/%20/g; 
@


1.2.6.5
log
@Backported fix for .htaccess security issue (IZ #3588).
@
text
@d3 3
a5 3
# Program to write htaccess file for a given project.  Designed to be called  
# via Java, so exit return codes are simple int's. 
# This script takes a URL made up by Project.writeHtaccessFile and uses CGI.pm
d37 2
a38 3
    # Backslash escape double quotes to prevent .htaccess syntax issues. 
    $filename =~ s/"/\\"/g;  

@


1.1
log
@file writeHtaccessFile was initially added on branch HELM_PEER_PORT_BRANCH.
@
text
@d1 55
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@a0 55
#!/usr/bin/perl -w

# program to write htaccess file for a given project. designed to be called 
# via java so exit return codes are simple int's.
# this script takes a url made up by Project.writeHtaccessFile and uses CGI.pm
# to decode the parameters.

use strict;
use Fcntl ':flock'; 
use CGI;
use CGI::Carp qw(fatalsToBrowser);

if (@@ARGV != 2){
    exit ("1writeHtaccessFile requires two arguments, Filename and Url");
}

my ($filename, $url) = @@ARGV;

(my $query_string = $url) =~s,^([^?]+)\?,,;
my $uri = $1;

undef (%ENV);
@@ARGV=@@ARGV[1..$#ARGV+1];

$ENV{QUERY_STRING} = $query_string;
$ENV{SCRIPT_URI}   = $uri;

my $r = new CGI();
open HTACCESS, ">$filename" or exit("1$!");
flock(HTACCESS, LOCK_EX);

for my $key ($r->param())
{
    if ($key =~/^http:/) { next }
    my $value = $r->param($key);
    my ($type, $filename)=split /-/, $key;
    my $timeoutURL = $uri . "?msg=";
print << "OUT";

       <Files "$filename">  
            AuthName MDAAuth
            AuthType Basic
            require valid-user
            MDARealmMask $value
            MDAAuthLoginURL $uri
            MDAAuthTimeoutURL "$uri?msg=$type+authorization+timed+out."
            MDAAuthTimeoutMin 1
       </Files>

OUT

}

close HTACCESS;
flock(HTACCESS, LOCK_UN);
@


1.1.2.1
log
@Perl program to be called from Project.writeHtaccesFile() .
Purpose of doing system flock on htaccess file for project downloads
and documents, while writing the file.
@
text
@a0 58
#!/usr/bin/perl -w

# program to write htaccess file for a given project. designed to be called 
# via java so exit return codes are simple int's.
# this script takes a url made up by Project.writeHtaccessFile and uses CGI.pm
# to decode the parameters.

use strict;
use Fcntl ':flock'; 
use CGI;
use CGI::Carp qw(fatalsToBrowser);
open STDERR , ">> /home/ms/tmp.log" or die $!;

if (@@ARGV != 2){
    print STDERR "Requires two arguments, \n\tFilenamt\n\tUri\n";
    exit 1;
}

my ($filename, $url) = @@ARGV;

(my $query_string = $url) =~s,^([^?]+)\?,,;
my $uri = $1;

undef (%ENV);
@@ARGV=@@ARGV[1..$#ARGV+1];

$ENV{QUERY_STRING} = $query_string;
$ENV{SCRIPT_URI}   = $uri;

my $r = new CGI();
open HTACCESS, ">$filename" or die $!;
flock(HTACCESS, LOCK_EX);

for my $key ($r->param())
{
  if ($key =~/^http:/) { next }
print "KEY-$key\n";
    my $value = $r->param($key);
    my ($type, $filename)=split /-/, $key;
    my $timeoutURL = $uri . "?msg=";
print << "OUT";
p
       <Files "$filename">  
            AuthName MDAAuth
            AuthType Basic
            require valid-user
            MDARealmMask $value
            MDAAuthLoginURL $uri
            MDAAuthTimeoutURL "$uri?msg=$type+authorization+timed+out."
            MDAAuthTimeoutMin 1
       </Files>

OUT

}

close HTACCESS;
flock(HTACCESS, LOCK_UN);
@


1.1.2.2
log
@Some changes to data parsing and log reporting
@
text
@d12 1
d15 2
a16 1
    exit ("1writeHtaccessFile requires two arguments, Filename and Url");
d31 1
a31 1
open HTACCESS, ">$filename" or exit("1$!");
d36 2
a37 1
    if ($key =~/^http:/) { next }
d42 1
a42 1

@


