[nexuiz-commits] r8009 - in branches/nexuiz-2.0: . misc/tools server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Oct 2 06:44:56 EDT 2009


Author: div0
Date: 2009-10-02 06:44:56 -0400 (Fri, 02 Oct 2009)
New Revision: 8009

Modified:
   branches/nexuiz-2.0/.patchsets
   branches/nexuiz-2.0/misc/tools/makebuild.sh
   branches/nexuiz-2.0/server/rcon.pl
Log:
r8005 | div0 | 2009-10-02 04:20:54 -0400 (Fri, 02 Oct 2009) | 3 lines
rcon.pl: add a mode rcon_secure=2 using the more secure challenge-based mode.
NOTE: this mode will be bad for rcon2irc.
r8006 | div0 | 2009-10-02 05:28:04 -0400 (Fri, 02 Oct 2009) | 2 lines
make getchallenge timeout configurable
r8007 | div0 | 2009-10-02 06:35:24 -0400 (Fri, 02 Oct 2009) | 2 lines
build script update
r8008 | div0 | 2009-10-02 06:39:14 -0400 (Fri, 02 Oct 2009) | 2 lines
enable hotfix


Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets	2009-10-02 10:39:14 UTC (rev 8008)
+++ branches/nexuiz-2.0/.patchsets	2009-10-02 10:44:56 UTC (rev 8009)
@@ -1,2 +1,2 @@
 master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-7945,7948-7948,7951-7990,7993-8002
+revisions_applied = 1-7945,7948-7948,7951-7990,7993-8002,8005-8008

Modified: branches/nexuiz-2.0/misc/tools/makebuild.sh
===================================================================
--- branches/nexuiz-2.0/misc/tools/makebuild.sh	2009-10-02 10:39:14 UTC (rev 8008)
+++ branches/nexuiz-2.0/misc/tools/makebuild.sh	2009-10-02 10:44:56 UTC (rev 8009)
@@ -12,7 +12,7 @@
 # customizable specific stuff
 netradiant_release=1.5.0-svn389
 basepk3=$base/data20090403.pk3 # 2.5
-hotbasepk3= # hotfix
+hotbasepk3=$base=data20091001.pk3 # hotfix
 nexdir=$base/nexuiz
 havocdir=$base/nexuiz/havoc
 dpdir=$base/darkplaces
@@ -110,11 +110,10 @@
 
 build()
 {
+	buildon alientrap.org                         nexuiz              fteqcc.exe          /tmp/Darkplaces.build 'DP_MAKE_TARGET=mingw CC="/chroot/debian-etch/usr/bin/i586-mingw32msvc-gcc -g -DSUPPORTDIRECTX -I$HOME/dxheaders" WINDRES=/chroot/debian-etch/usr/bin/i586-mingw32msvc-windres SDL_CONFIG=$HOME/sdl-win32/SDL-1.2.13/bin/sdl-config' /chroot/debian-etch/usr/bin/i586-mingw32msvc-strip
 	buildon nexmacbuild                           nexuiz-osx          fteqcc-osx          /tmp/Darkplaces.build 'CC="gcc -g -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4"' strip
-#	buildon nexmacbuild                           nexuiz-osx          fteqcc-osx          /tmp/Darkplaces.build 'CC="gcc -g -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4"' strip
 	buildon eos.thruhere.net                      nexuiz-linux-686    fteqcc-linux-686    /tmp/Darkplaces.build 'CC="gcc -g" DP_MODPLUG_STATIC_LIBDIR=$HOME/modplug-i386/lib DP_LINK_TO_LIBJPEG=1 LDFLAGS_LIBJPEG="$HOME/jpeg7/lib/libjpeg.a" CFLAGS_LIBJPEG="-I$HOME/jpeg7/include"' strip
 	buildon alientrap.org                         nexuiz-linux-x86_64 fteqcc-linux-x86_64 /tmp/Darkplaces.build 'CC="gcc -g -Wl,--hash-style=sysv" DP_MODPLUG_STATIC_LIBDIR=/home/divverent/modplug-x86_64/lib DP_LINK_TO_LIBJPEG=1 LDFLAGS_LIBJPEG="$HOME/jpeg7/lib/libjpeg.a" CFLAGS_LIBJPEG="-I$HOME/jpeg7/include"' strip
-	buildon alientrap.org                         nexuiz              fteqcc.exe          /tmp/Darkplaces.build 'DP_MAKE_TARGET=mingw CC="/chroot/debian-etch/usr/bin/i586-mingw32msvc-gcc -g -DSUPPORTDIRECTX -I$HOME/dxheaders" WINDRES=/chroot/debian-etch/usr/bin/i586-mingw32msvc-windres SDL_CONFIG=$HOME/sdl-win32/SDL-1.2.13/bin/sdl-config' /chroot/debian-etch/usr/bin/i586-mingw32msvc-strip
 		mv "$tmpdir/nexuiz-osx-agl"     "$tmpdir/Nexuiz.app/Contents/MacOS/nexuiz-osx-agl-bin"
 		mv "$tmpdir/nexuiz-osx-sdl"     "$tmpdir/Nexuiz-SDL.app/Contents/MacOS/nexuiz-osx-sdl-bin"
 }

Modified: branches/nexuiz-2.0/server/rcon.pl
===================================================================
--- branches/nexuiz-2.0/server/rcon.pl	2009-10-02 10:39:14 UTC (rev 8008)
+++ branches/nexuiz-2.0/server/rcon.pl	2009-10-02 10:44:56 UTC (rev 8009)
@@ -386,12 +386,13 @@
 #   my $chan = new Channel::QW($connection, "password");
 sub new($$$)
 {
-	my ($class, $conn, $password, $secure) = @_;
+	my ($class, $conn, $password, $secure, $timeout) = @_;
 	my $you = {
 		connector => $conn,
 		password => $password,
 		recvbuf => "",
 		secure => $secure,
+		timeout => $timeout,
 	};
 	return
 		bless $you, 'Channel::QW';
@@ -407,8 +408,16 @@
 sub send($$$)
 {
 	my ($self, $line, $nothrottle) = @_;
-	if($self->{secure})
+	if($self->{secure} > 1)
 	{
+		$self->{connector}->send("\377\377\377\377getchallenge");
+		my $c = $self->recvchallenge();
+		return 0 if not defined $c;
+		my $key = Digest::HMAC::hmac("$c $line", $self->{password}, \&Digest::MD4::md4);
+		return $self->{connector}->send("\377\377\377\377srcon HMAC-MD4 CHALLENGE $key $c $line");
+	}
+	elsif($self->{secure})
+	{
 		my $t = sprintf "%ld.%06d", time(), int rand 1000000;
 		my $key = Digest::HMAC::hmac("$t $line", $self->{password}, \&Digest::MD4::md4);
 		return $self->{connector}->send("\377\377\377\377srcon HMAC-MD4 TIME $key $t $line");
@@ -429,6 +438,38 @@
 	return $data;
 }
 
+sub recvchallenge($)
+{
+	my ($self) = @_;
+
+	my $sel = IO::Select->new($self->fds());
+	my $endtime_max = Time::HiRes::time() + $self->{timeout};
+	my $endtime = $endtime_max;
+
+	while((my $dt = $endtime - Time::HiRes::time()) > 0)
+	{
+		if($sel->can_read($dt))
+		{
+			for(;;)
+			{
+				my $s = $self->{connector}->recv();
+				die "read error\n"
+					if not defined $s;
+				length $s
+					or last;
+				if($s =~ /^\377\377\377\377challenge (.*)$/s)
+				{
+					return $1;
+				}
+				next
+					if $s !~ /^\377\377\377\377n(.*)$/s;
+				$self->{recvbuf} .= $1;
+			}
+		}
+	}
+	return undef;
+}
+
 sub recv($)
 {
 	my ($self) = @_;
@@ -476,12 +517,13 @@
 	return $default;
 }
 
-my $server   = default '',    $ENV{rcon_address};
-my $password = default '',    $ENV{rcon_password};
-my $secure   = default '1',   $ENV{rcon_secure};
-my $timeout  = default '5',   $ENV{rcon_timeout};
-my $timeouti = default '0.2', $ENV{rcon_timeout_inter};
-my $colors   = default '0',   $ENV{rcon_colorcodes_raw};
+my $server   = default '',       $ENV{rcon_address};
+my $password = default '',       $ENV{rcon_password};
+my $secure   = default '1',      $ENV{rcon_secure};
+my $timeout  = default '5',      $ENV{rcon_timeout};
+my $timeouti = default '0.2',    $ENV{rcon_timeout_inter};
+my $timeoutc = default $timeout, $ENV{rcon_timeout_challenge};
+my $colors   = default '0',      $ENV{rcon_colorcodes_raw};
 
 if(!length $server)
 {
@@ -494,7 +536,7 @@
 }
 
 my $connection = Connection::Socket->new("udp", "", $server, 26000);
-my $rcon = Channel::QW->new($connection, $password, $secure);
+my $rcon = Channel::QW->new($connection, $password, $secure, $timeoutc);
 
 if(!$rcon->send($rcon->join_commands(@ARGV)))
 {



More information about the nexuiz-commits mailing list