[nexuiz-commits] r6564 - in branches/nexuiz-2.0: . data data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Apr 22 11:50:14 EDT 2009
Author: div0
Date: 2009-04-22 11:50:13 -0400 (Wed, 22 Apr 2009)
New Revision: 6564
Modified:
branches/nexuiz-2.0/.patchsets
branches/nexuiz-2.0/data/defaultNexuiz.cfg
branches/nexuiz-2.0/data/qcsrc/server/ipban.qc
branches/nexuiz-2.0/data/qcsrc/server/vote.qc
Log:
r6560 | div0 | 2009-04-22 17:31:58 +0200 (Wed, 22 Apr 2009) | 2 lines
fix vote parsing: if chmap is allowed, gotomap should be too, and vice versa
r6561 | div0 | 2009-04-22 17:46:50 +0200 (Wed, 22 Apr 2009) | 2 lines
hopefully fix IP ban list reading
r6562 | div0 | 2009-04-22 17:47:26 +0200 (Wed, 22 Apr 2009) | 2 lines
remove warnings
r6563 | div0 | 2009-04-22 17:48:03 +0200 (Wed, 22 Apr 2009) | 2 lines
fix voting really now
Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets 2009-04-22 15:48:03 UTC (rev 6563)
+++ branches/nexuiz-2.0/.patchsets 2009-04-22 15:50:13 UTC (rev 6564)
@@ -1,2 +1,2 @@
master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-6536,6541-6549,6552-6558
+revisions_applied = 1-6536,6541-6549,6552-6563
Modified: branches/nexuiz-2.0/data/defaultNexuiz.cfg
===================================================================
--- branches/nexuiz-2.0/data/defaultNexuiz.cfg 2009-04-22 15:48:03 UTC (rev 6563)
+++ branches/nexuiz-2.0/data/defaultNexuiz.cfg 2009-04-22 15:50:13 UTC (rev 6564)
@@ -897,21 +897,23 @@
alias vhelp "cmd vote help"
alias vstatus "cmd vote status"
alias vcall "cmd vote call $*"
- alias vmap "vcall gotomap $1"
alias vstop "cmd vote stop"
alias vmaster "cmd vote master"
alias vlogin "cmd vote login $*"
alias vdo "cmd vote do $*"
- alias vdomap "vdo gotomap $1"
alias vyes "cmd vote yes"
alias vno "cmd vote no"
alias vdontcare "cmd vote dontcare"
alias vabstain "cmd vote abstain"
+alias vmap "vcall gotomap $1"
alias vkick "vcall kick $1"
alias vkickban "vcall kickban $1"
alias vend "vcall endmatch"
-alias vmap "vcall chmap $1"
+alias vdomap "vdo gotomap $1"
+alias vdokick "vdo kick $*"
+alias vdokickban "vdo kickban $*"
+alias vdoend "vdo endmatch"
alias lsmaps "cmd lsmaps" // lists all maps on server (for vmap, suggestmap)
bind F1 vyes
Modified: branches/nexuiz-2.0/data/qcsrc/server/ipban.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/ipban.qc 2009-04-22 15:48:03 UTC (rev 6563)
+++ branches/nexuiz-2.0/data/qcsrc/server/ipban.qc 2009-04-22 15:50:13 UTC (rev 6564)
@@ -309,14 +309,30 @@
float Ban_GetClientIP(entity client)
{
- float n;
- n = tokenizebyseparator(client.netaddress, ".");
- if(n != 4)
+ // we can't use tokenizing here, as this is called during ban list parsing
+ float i1, i2, i3, i4;
+ string s;
+
+ s = client.netaddress;
+
+ i1 = strstrofs(s, ".", 0);
+ if(i1 < 0)
return FALSE;
- ban_ip1 = strcat1(argv(0));
- ban_ip2 = strcat(ban_ip1, ".", argv(1));
- ban_ip3 = strcat(ban_ip2, ".", argv(2));
- ban_ip4 = strcat(ban_ip3, ".", argv(3));
+ i2 = strstrofs(s, ".", i1 + 1);
+ if(i2 < 0)
+ return FALSE;
+ i3 = strstrofs(s, ".", i2 + 1);
+ if(i3 < 0)
+ return FALSE;
+ i4 = strstrofs(s, ".", i3 + 1);
+ if(i4 >= 0)
+ return FALSE;
+
+ ban_ip1 = substring(s, 0, i1);
+ ban_ip2 = substring(s, 0, i2);
+ ban_ip3 = substring(s, 0, i3);
+ ban_ip4 = strcat1(s);
+
return TRUE;
}
Modified: branches/nexuiz-2.0/data/qcsrc/server/vote.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/vote.qc 2009-04-22 15:48:03 UTC (rev 6563)
+++ branches/nexuiz-2.0/data/qcsrc/server/vote.qc 2009-04-22 15:50:13 UTC (rev 6564)
@@ -99,9 +99,7 @@
vote_argc = tokenize_sane(vote);
if(!VoteAllowed(argv(0), cmd))
- {
return FALSE;
- }
// VoteAllowed tokenizes!
vote_argc = tokenize_sane(vote);
@@ -415,28 +413,38 @@
return substring(all, argv_start_index(2), argv_end_index(-1) - argv_start_index(2));
}
+float VoteCommandInList(string votecommand, string list)
+{
+ string l;
+ l = strcat(" ", list, " ");
+
+ if(strstrofs(l, strcat(" ", votecommand, " "), 0) >= 0)
+ return TRUE;
+
+ // if gotomap is allowed, chmap is too, and vice versa
+ if(votecommand == "gotomap")
+ if(strstrofs(l, " chmap ", 0) >= 0)
+ return TRUE;
+ if(votecommand == "chmap")
+ if(strstrofs(l, " gotomap ", 0) >= 0)
+ return TRUE;
+
+ return FALSE;
+}
+
float VoteAllowed(string votecommand, string cmd) {
- local float index;
+ if(VoteCommandInList(votecommand, cvar_string("sv_vote_commands")))
+ return TRUE;
- tokenize_sane(cvar_string("sv_vote_commands"));
- index = 0;
- while(argv(index) != "") {
- if(votecommand == argv(index)) {
+ if(cmd == "vdo")
+ {
+ if(VoteCommandInList(votecommand, cvar_string("sv_vote_master_commands")))
return TRUE;
- }
- ++index;
}
-
- if(cmd == "vdo")
- tokenize_sane(cvar_string("sv_vote_master_commands"));
else
- tokenize_sane(cvar_string("sv_vote_only_commands"));
- index = 0;
- while(argv(index) != "") {
- if(votecommand == argv(index)) {
+ {
+ if(VoteCommandInList(votecommand, cvar_string("sv_vote_only_commands")))
return TRUE;
- }
- ++index;
}
return FALSE;
More information about the nexuiz-commits
mailing list