You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
137 lines
3.4 KiB
137 lines
3.4 KiB
#!/usr/bin/perl
|
|
#
|
|
# $Id: twrinstall.pl,v 1.3 2004/01/29 07:57:04 jeffo Exp $
|
|
#
|
|
# Source File: twrinstall.pl
|
|
|
|
require 'sitecfg.pl';
|
|
require 'testlib.pl';
|
|
require 'syscall.ph';
|
|
|
|
&app_initialize;
|
|
&LanguageSupportInit();
|
|
if (&verify_license()) {
|
|
&lockout_download();
|
|
&prepare_config();
|
|
&zip_site();
|
|
&send_response_file();
|
|
} else {
|
|
print "Content-Type: text/html\n\n";
|
|
print "<HTML>
|
|
<BODY>
|
|
You license information is not yet registered<BR>
|
|
or you have entered an incorrect Administrator ID or password.<BR>
|
|
Please call Acts Corporation at 1-800-950-2287 to verify your license.
|
|
</BODY>
|
|
</HTML>
|
|
";
|
|
}
|
|
|
|
sub prepare_config {
|
|
$mainidx = join($pathsep, $pubroot, "Install", "html", "index.html");
|
|
$trash = join($pathsep, $pubroot, "Install", "cgi-bin", "sitecfg.pl");
|
|
open (TMPCFG, "<$trash");
|
|
@lines = <TMPCFG>;
|
|
close TMPCFG;
|
|
if ($FORM{'os'} eq 'NT' ) {
|
|
$cosnt = 1;
|
|
} else {
|
|
$cosnt = 0;
|
|
}
|
|
open (TMPCFG, ">$trash");
|
|
foreach $line (@lines) {
|
|
if ($line =~ /\$osnt = (.*)/ ) {
|
|
if ($cosnt) {
|
|
$line = "\$osnt = 1\;\n";
|
|
} else {
|
|
$line = "\$osnt = 0\;\n";
|
|
}
|
|
} elsif ($line =~ /\$pathsep = (.*)/ ) {
|
|
if ($cosnt) {
|
|
$line = "\$pathsep = \"\\\\\"\;\n";
|
|
$FORM{'docroot'} =~ s/\\/\\\\/g;
|
|
} else {
|
|
$line = "\$pathsep = \"/\"\;\n";
|
|
}
|
|
} elsif ($line =~ /\$hostip = (.*)/ ) {
|
|
$line = "\$hostip = \"http://$FORM{'hostip'}\"\;\n";
|
|
} elsif ($line =~ /\$docroot = (.*)/ ) {
|
|
$line = "\$docroot = \"$FORM{'docroot'}\"\;\n";
|
|
} elsif ($line =~ /\$licensenumber = (.*)/ ) {
|
|
$clicno = crypt($licno,$FORM{'uid'});
|
|
$line = "\$licensenumber = \"$clicno\"\;\n";
|
|
}
|
|
print TMPCFG $line;
|
|
}
|
|
close TMPCFG;
|
|
open (TMPCFG, ">$trash");
|
|
foreach $line (@lines) {
|
|
if ($line =~ /\$hostip = (.*)/ ) {
|
|
$line =~ s/64.224.96.108/$FORM{'hostip'}/g;
|
|
}
|
|
print TMPCFG $line;
|
|
}
|
|
close TMPCFG;
|
|
}
|
|
|
|
sub zip_site {
|
|
$tarzipfile = join($pathsep, $pubroot, "Install");
|
|
$chdirok = chdir $tarzipfile;
|
|
if ($chdirok == 1) {
|
|
$tarzipfile = join($pathsep, $pubroot, "Install", "testmgr.tgz");
|
|
$!=0;
|
|
@margs = ("/bin/tar -cklpsvz archive cgi-bin html secure_html index.htm > $tarzipfile");
|
|
$retval = system @margs[0];
|
|
open (TMPOUT, "<$tarzipfile");
|
|
binmode(TMPOUT);
|
|
$fsize = (stat(TMPOUT))[7];
|
|
read(TMPOUT, $img, $fsize);
|
|
close TMPOUT;
|
|
@margs = ("/bin/mv $tarzipfile $tarzipfile.$FORM{'uid'}");
|
|
$retval = system @margs[0];
|
|
$mmbody = "Installation download by $FORM{'uid'} for $FORM{'os'}\r\n";
|
|
for (keys %FORM) { $mmbody = join('', $mmbody, "$_ : $FORM{$_}\r\n");}
|
|
&send_mail($mmautontfyfrom,$mmautontfyto,"Install Download", $mmbody);
|
|
}
|
|
}
|
|
|
|
sub send_response_file {
|
|
print "Content-Type: application/exe\n\n";
|
|
print $img;
|
|
}
|
|
|
|
sub lockout_download {
|
|
$timestmp = &format_date_time("mm-dd-yyyy", 0, 0);
|
|
$keyflds = "$FORM{'uid'}\&$FORM{'pwd'}\&";
|
|
$licfile = join($pathsep, $dataroot, "licenses.dat");
|
|
@licrecs = get_data("licenses.dat");
|
|
open (TMPLIC, ">$licfile");
|
|
foreach $licrec (@licrecs) {
|
|
if ($licrec =~ /$keyflds(.*)/ ) {
|
|
$licrec =~ s/00-00-0000/$timestmp/g;
|
|
}
|
|
print TMPLIC $licrec;
|
|
}
|
|
close TMPLIC;
|
|
}
|
|
|
|
sub verify_license {
|
|
@licrecs = get_data("licenses.dat");
|
|
for (1 .. $#licrecs) {
|
|
$licrec = $licrecs[$_];
|
|
chop $licrec;
|
|
@flds = split(/&/, $licrec);
|
|
if ($FORM{'uid'} eq $flds[0] && $FORM{'pwd'} eq $flds[1]) {
|
|
$licno = $flds[4];
|
|
$licno =~ s/-//g;
|
|
if (crypt($licno,$FORM{'uid'}) eq $FORM{'regkey'}) {
|
|
if ($flds[5] eq '00-00-0000') {
|
|
if ($flds[7] eq 'P' || $flds[7] eq 'S') {
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|