Merge branch 'master' of git://git.xonotic.org/xonotic/xonotic

This commit is contained in:
Rudolf Polzer 2010-12-15 12:38:08 +01:00
commit 97fe16d7d3
7 changed files with 269 additions and 25 deletions

43
all
View File

@ -1437,13 +1437,7 @@ case "$cmd" in
release-prepare)
#"$SELF" each git clean -fxd
case "$RELEASETYPE" in
beta)
msg "Building a BETA"
;;
release)
msg "Building a RELEASE"
;;
*)
'')
$ECHO >&2 -n "$ESC[2J$ESC[H"
msg ""
msg ""
@ -1485,6 +1479,12 @@ case "$cmd" in
# (YYYYMMDD)
exit 1
;;
release)
msg "Building a FINISHED RELEASE"
;;
*)
msg "Building a $RELEASETYPE"
;;
esac
verbose rm -rf Xonotic Xonotic*.zip
verbose mkdir -p Xonotic
@ -1652,15 +1652,7 @@ case "$cmd" in
verbose "$SELF" update-maps
;;
release-qc)
case "$RELEASETYPE" in
beta)
verbose make -C Xonotic/source FTEQCC="../../../fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 clean all
# back out of: source/qcsrc/server
;;
release)
verbose make -C Xonotic/source FTEQCC="../../../fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 FTEQCCFLAGS_WATERMARK= clean all
;;
esac
verbose make -C Xonotic/source FTEQCC="../../../fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 clean all
verbose rm -f Xonotic/source/*/fteqcc.log
;;
release-buildpk3-transform-raw)
@ -1741,8 +1733,10 @@ case "$cmd" in
patch=$(($gv - $major * 10000 - $minor * 100))
versionstr="$major.$minor.$patch"
case "$RELEASETYPE" in
beta)
versionstr="$versionstr""beta"
release)
;;
*)
versionstr="$versionstr$RELEASETYPE"
;;
esac
verbose sed -i "
@ -1750,6 +1744,13 @@ case "$cmd" in
s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
" defaultXonotic.cfg
case "$RELEASETYPE" in
release)
echo "" >> defaultXonotic.cfg
echo "// nicer menu" >> defaultXonotic.cfg
echo "set menu_watermark \"\"" >> defaultXonotic.cfg
;;
esac
(
verbose cd gfx/menu/luminos
verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
@ -1847,12 +1848,6 @@ case "$cmd" in
Xonotic/data/xonotic-$stamp-data-low.pk3 \
Xonotic/data/xonotic-$stamp-maps-low.pk3 \
Xonotic/data/xonotic-$stamp-music-low.pk3
# verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
# verbose mkzip0 Xonotic-$stamp-high.zip \
# Xonotic/data/xonotic-$stamp-data-raw.pk3 \
# Xonotic/data/xonotic-$stamp-maps-raw.pk3 \
# Xonotic/data/xonotic-$stamp-music.pk3 \
# Xonotic/data/xonotic-$stamp-nexcompat.pk3
verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-lowdds.zip
verbose mkzip0 Xonotic-$stamp-lowdds.zip \
Xonotic/data/xonotic-$stamp-data-lowdds.pk3 \

View File

@ -0,0 +1,15 @@
Options +ExecCGI
DirectoryIndex response.d0ir
<Files response.d0ir>
SetHandler cgi-script
</Files>
# allow,deny: accept = A && !D
# deny,allow: accept = !(D && !A) == A || !D
<Files *.d0s*>
Order allow,deny
deny from all
</Files>
<Files config.pl>
Order allow,deny
deny from all
</Files>

View File

@ -0,0 +1,20 @@
%ca = (
0 =>
{
name => "Xonotic official",
check => sub
{
my ($inc) = @_;
return 0 if ($inc >= 0) && check_dnsbl([qr/.*:.*:.*/], [], ['torexit.dan.me.uk', 'aspews.ext.sorbs.net']);
return 0 if ($inc >= 0) && check_banlist('http://rm.endoftheinternet.org/~xonotic/bans/?action=list&servers=*');
return 0 if check_sql('dbi:mysql:dbname=xonotic_ca', 'xonotic_ca', '************', 'ip', $inc);
1;
}
},
15 =>
{
name => "Xonotic testing",
check => sub { 1; }
}
);
$default_ca = 15;

Binary file not shown.

View File

@ -0,0 +1,211 @@
#!/usr/bin/perl
use strict;
use CGI;
use LWP::Simple;
use MIME::Base64;
use File::Temp;
use DBI;
my $cgi = CGI->new();
sub error($)
{
my ($err) = @_;
print "Content-type: text/plain\n\nd0er $err";
exit 0;
}
sub check_dnsbl($$@)
{
my ($goodpatterns, $badpatterns, $list) = @_;
my $name = $ENV{REMOTE_HOST} . ".";
my $addr = $ENV{REMOTE_ADDR};
# check goodpatterns
for(@$goodpatterns)
{
return 0
if $name =~ /^(??{$_})$/ || $addr =~ /^(??{$_})$/;
}
# check badpatterns
for(@$badpatterns)
{
return -1
if $name =~ /^(??{$_})$/ || $addr =~ /^(??{$_})$/;
}
# is he tor?
my $h = gethostbyname $addr;
return -1
if not defined $h;
my $blprefix = join '.', reverse unpack 'C4', $h;
my $i = 0;
for(@$list)
{
++$i;
my $hn = "$blprefix.$_.";
my $h2 = gethostbyname $hn;
next
if not defined $h2;
return -1;
}
return 0;
}
# create table ip ( id INT AUTO_INCREMENT PRIMARY KEY, ip VARCHAR(64), t DATETIME, error BOOLEAN, INDEX(ip), INDEX(t), INDEX(error) );
our $__CACHED_DBH__;
sub check_sql($$$$$)
{
my ($dsn, $u, $p, $tbl, $inc) = @_;
my $ip = $ENV{REMOTE_ADDR};
my $DBH = ($__CACHED_DBH__ ? $__CACHED_DBH__ : ($__CACHED_DBH__ = DBI->connect($dsn, $u, $p, { RaiseError => 1, AutoCommit => 0 })))
or die "DBI/DBD: $!";
$DBH->do("set character set utf8");
$DBH->do("set names utf8");
if($inc < 0)
{
$DBH->do("update $tbl set error=true where ip=?", undef, $ip);
$DBH->commit();
$DBH->disconnect();
return 0;
}
elsif($inc == 0)
{
my $status = $DBH->selectrow_arrayref("select count(*) from $tbl where ip=? and error=false and t>date_sub(now(), interval 7 day)", undef, $ip)
or die "DBI/DBD: $!";
$DBH->disconnect();
return $status->[0] ? -1 : 0;
}
else
{
my $status = $DBH->selectall_arrayref("select error, t>date_sub(now(), interval 7 day) from $tbl where ip=?", undef, $ip)
or die "DBI/DBD: $!";
if(@$status)
{
if($status->[0][0] || !$status->[0][1]) # error, or after interval
{
$DBH->do("update $tbl set error=false, t=now() where ip=?", undef, $ip);
$DBH->commit();
$DBH->disconnect();
return 0;
}
else # too soon
{
$DBH->disconnect();
return -1;
}
}
else
{
$DBH->do("insert into $tbl(ip, error, t) values(?, false, now())", undef, $ip);
$DBH->commit();
$DBH->disconnect();
return 0;
}
}
}
sub check_banlist($)
{
my ($s) = @_;
my $ip = $ENV{REMOTE_ADDR};
my @s = split /\n/, get $s;
for(0..@s/4-1)
{
my $i = $s[4*$_];
return 1 if "$ip." =~ /^\Q$i\E\./;
}
return 0;
}
our %ca = ();
our $default_ca = 0;
do 'config.pl';
if((my $key = $cgi->param('key')))
{
local $| = 1;
undef local $/;
my $ca = $cgi->param('ca');
$ca = $default_ca if not defined $ca;
error "Invalid CA" if not defined $ca{$ca};
error "Not allowed" if not $ca{$ca}->{check}->(1);
my $tempfh = undef;
eval
{
$tempfh = File::Temp->new();
binmode $tempfh;
my $fh = $cgi->upload('key');
if($fh)
{
binmode $fh;
print $tempfh $_ for <$fh>;
}
else
{
$key =~ s/ /+/g;
$key = decode_base64($key);
print $tempfh $key;
}
seek $tempfh, 0, 0;
$ENV{REQUESTFILE} = $tempfh->filename;
$ENV{RESPONSEFILE} = $tempfh->filename;
$ENV{SECRET} = "key_$ca.d0sk";
open my $errfh, '-|', './crypto-keygen-standalone -P "$SECRET" -j "$REQUESTFILE" -o "$RESPONSEFILE" 2>&1'
or die "cannot start crypto-keygen-standalone";
my $err = <$errfh>;
close $errfh
or die "xonotic-keygen failed: $err";
1;
}
or do
{
$ca{$ca}->{check}->(-1);
die "$@";
};
print "Content-type: application/octet-stream\n\n";
binmode STDOUT;
print for <$tempfh>;
}
else
{
print <<EOF;
Content-type: text/html
<!doctype html>
<html>
<head>
<title>Xonotic keygen</title>
</head>
<body>
<h1>Xonotic keygen</h1>
<form action="response.d0ir" method="post" enctype="multipart/form-data">
To generate and sign a key IN GAME, follow these steps on the console:
<ol>
<li>crypto_keygen $default_ca http://rm.endoftheinternet.org/~xonotic/keygen/?ca=$default_ca&amp;key=</li>
</ol>
To generate and sign a key MANUALLY, follow these steps on a UNIX command line:
<ol>
<li>./xonotic-keygen -p key_$default_ca.d0pk -o key_$default_ca.d0si</li>
<li>./xonotic-keygen -p key_$default_ca.d0pk -I key_$default_ca.d0si -o request.d0iq -O camouflage.d0ic
<li>Upload the request.d0iq file: <input type="file" name="key"><input type="submit"></li>
<li>Save the response.d0ir file you are getting</li>
<li>./xonotic-keygen -p key_$default_ca.d0pk -I key_$default_ca.d0si -c camouflage.d0ic -J response.d0ir -o key_$default_ca.d0si</li>
<li>Delete request.d0iq, camouflage.d0ic, response.d0ir</li>
</ol>
Your key_$default_ca.d0si key is now signed.
<hr>
To use another CA, please enter its number here before using this page:
<input type="text" name="ca" value="$default_ca" size="2">
</body>
</html>
EOF
}

View File

@ -1,6 +1,7 @@
handle SIGHUP nostop print pass
handle SIGINT nostop print pass
handle SIGCONT nostop print pass
handle SIGSTOP nostop print pass
handle SIGTSTP nostop print pass
handle SIGTRAP nostop print nopass
run

View File

@ -113,6 +113,7 @@
/////////////////////////////////////////////////////////////////////
// "Obvious" mutators that are allowed on a "pure" server
//g_minstagib 0 // set to 1 for MinstaGib
g_weapon_stay 0 // set to 1, 2 or 3 for different weapon-stay modes (1 = traditional, 2 = no ammo but allow throwing, 3 = ghost weapon stay)
/////////////////////////////////////////////////////////////////////
@ -120,7 +121,8 @@
// enable some mutators you'd like
//g_cloaked 0 // set to 1 for transparent hard to see players
//g_grappling_hook 0 // set to 1 to enable the hook
//g_grappling_hook 0 // set to 1 to enable the hook (allowed on "pure" server in MinstaGib)
//g_jetpack 0 // set to 1 to enable the jetpack (allowed on "pure" server in MinstaGib)
//g_laserguided_missile 0 // set to 1 for laser guided missiles in the RL
//g_midair 0 // set to 1 to make only midair damage count
//g_vampire 0 // set to 1 to give players the damage they cause as health