[nexuiz-commits] r6357 - trunk/server/rcon2irc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Mar 30 03:38:21 EDT 2009


Author: div0
Date: 2009-03-30 03:38:20 -0400 (Mon, 30 Mar 2009)
New Revision: 6357

Modified:
   trunk/server/rcon2irc/rbiserver.pl
   trunk/server/rcon2irc/rcon2irc-example.conf
   trunk/server/rcon2irc/rcon2irc.pl
Log:
new qnet auth


Modified: trunk/server/rcon2irc/rbiserver.pl
===================================================================
--- trunk/server/rcon2irc/rbiserver.pl	2009-03-29 23:25:46 UTC (rev 6356)
+++ trunk/server/rcon2irc/rbiserver.pl	2009-03-30 07:38:20 UTC (rev 6357)
@@ -98,6 +98,10 @@
 			next if $l[9] < time() - 60; # too old
 			print "Cleaning up demos: protecting $_\n";
 			chmod 0444, $_;
+			open my $fh, ">", "$_.nick";
+			printf $fh "%s\n", color_dp2none($store{"playernickraw_byid_$id"});
+			close $fh;
+			chmod 0444, "$_.nick";
 		}
 	}
 	else

Modified: trunk/server/rcon2irc/rcon2irc-example.conf
===================================================================
--- trunk/server/rcon2irc/rcon2irc-example.conf	2009-03-29 23:25:46 UTC (rev 6356)
+++ trunk/server/rcon2irc/rcon2irc-example.conf	2009-03-30 07:38:20 UTC (rev 6357)
@@ -31,6 +31,7 @@
 #dp_status_delay = 30
 #irc_reconnect_delay = 300
 #irc_admin_timeout = 3600
+#irc_admin_quote_re =
 #irc_local = 141.2.16.23
 #irc_ping_delay = 120
 #irc_nickserv_identify = PRIVMSG NickServ :IDENTIFY %2$s

Modified: trunk/server/rcon2irc/rcon2irc.pl
===================================================================
--- trunk/server/rcon2irc/rcon2irc.pl	2009-03-29 23:25:46 UTC (rev 6356)
+++ trunk/server/rcon2irc/rcon2irc.pl	2009-03-30 07:38:20 UTC (rev 6357)
@@ -305,7 +305,7 @@
 		(length($local) ? (LocalAddr => $local) : ()),
 		PeerAddr => $remote,
 		PeerPort => $defaultport
-	) or die "socket $proto/$local/$remote: $!";
+	) or die "socket $proto/$local/$remote/$defaultport: $!";
 	$sock->blocking(0);
 	my $you = {
 		# Mortal fool! Release me from this wretched tomb! I must be set free
@@ -621,7 +621,8 @@
 use strict;
 use warnings;
 use IO::Select;
-use Digest::MD5;
+use Digest::SHA;
+use Digest::HMAC;
 use Time::HiRes qw/time/;
 
 our @handlers = (); # list of [channel, expression, sub to handle result]
@@ -660,6 +661,7 @@
 
 	irc_admin_password => "",
 	irc_admin_timeout => 3600,
+	irc_admin_quote_re => "",
 
 	irc_reconnect_delay => 300,
 
@@ -940,9 +942,13 @@
 	{
 		if(defined $store{irc_quakenet_challenge})
 		{
-			if($store{irc_quakenet_challenge} =~ /^MD5 (.*)/)
+			if($store{irc_quakenet_challenge} =~ /^([0-9a-f]*)\b.*\bHMAC-SHA-256\b/)
 			{
-				out irc => 1, "$config{irc_quakenet_challengeauth} $config{irc_quakenet_authname} " . Digest::MD5::md5_hex("$config{irc_quakenet_password} $1");
+				my $challenge = $1;
+				my $hash1 = Digest::SHA::sha256_hex(substr $config{irc_quakenet_password}, 0, 10);
+				my $key = Digest::SHA::sha256_hex("@{[lc $config{irc_quakenet_authname}]}:$hash1");
+				my $digest = Digest::HMAC::hmac_hex($challenge, $key, \&Digest::SHA::sha256);
+				out irc => 1, "$config{irc_quakenet_challengeauth} $config{irc_quakenet_authname} $digest HMAC-SHA-256";
 			}
 		}
 		else
@@ -1165,6 +1171,21 @@
 			return 0;
 		}
 
+		if($command =~ /^quote (.*)$/)
+		{
+			my ($cmd) = ($1);
+			if($cmd =~ /^(??{$config{irc_admin_quote_re}})$/si)
+			{
+				out irc => 0, $cmd;
+				out irc => 0, "PRIVMSG $nick :executed your command";
+			}
+			else
+			{
+				out irc => 0, "PRIVMSG $nick :permission denied";
+			}
+			return 0;
+		}
+
 		out irc => 0, "PRIVMSG $nick :unknown command (supported: status [substring], kick # id reason, kickban # id bantime mask reason, bans, unban banid)";
 
 		return -1;
@@ -1271,6 +1292,7 @@
 	# chat: Nexuiz server -> IRC channel, nick set
 	[ dp => q{:join:(\d+):(\d+):([^:]*):(.*)} => sub {
 		my ($id, $slot, $ip, $nick) = @_;
+		$store{"playernickraw_byid_$id"} = $nick;
 		$nick = color_dp2irc $nick;
 		$store{"playernick_byid_$id"} = $nick;
 		$store{"playerip_byid_$id"} = $ip;
@@ -1282,6 +1304,7 @@
 	# chat: Nexuiz server -> IRC channel, nick change/set
 	[ dp => q{:name:(\d+):(.*)} => sub {
 		my ($id, $nick) = @_;
+		$store{"playernickraw_byid_$id"} = $nick;
 		$nick = color_dp2irc $nick;
 		my $oldnick = $store{"playernick_byid_$id"};
 		out irc => 0, "PRIVMSG $config{irc_channel} :* $oldnick\017 is now known as $nick";



More information about the nexuiz-commits mailing list