|
@@ -60,6 +60,7 @@ $user_roles = Hash[
|
|
]
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
$qw_list = Array.new
|
|
$qw_list = Array.new
|
|
$qw_list = [
|
|
$qw_list = [
|
|
"89.149.194.72:27700",
|
|
"89.149.194.72:27700",
|
|
@@ -536,22 +537,24 @@ class GameServers
|
|
end
|
|
end
|
|
|
|
|
|
# we still haven't found a cool dns
|
|
# we still haven't found a cool dns
|
|
- if (my_cooldns == iphost) && (not current[:reverse_dns].empty?)
|
|
|
|
-
|
|
|
|
- rdns = current[:reverse_dns]
|
|
|
|
-
|
|
|
|
- # if the resulting dns name...
|
|
|
|
- # .. is too long, use ip-address instead.
|
|
|
|
- # .. has too many dots, use ip-address instead.
|
|
|
|
- # .. has too many numbers, use ip-address instead.
|
|
|
|
- if rdns.length > 21 || rdns.split(".").size > 3 || rdns.scan(/\d/).size > 3
|
|
|
|
- put_log "cutting down host_name: #{rdns}, because:"
|
|
|
|
- put_log "length: #{rdns.length}"
|
|
|
|
- put_log "chunks count: #{rdns.split(".").size}"
|
|
|
|
- put_log "num count: #{rdns.scan(/\d/).size}"
|
|
|
|
- else
|
|
|
|
- my_cooldns = rdns
|
|
|
|
- end # of Resolv.getname
|
|
|
|
|
|
+ unless current[:reverse_dns].to_s.empty?
|
|
|
|
+ if my_cooldns == iphost
|
|
|
|
+
|
|
|
|
+ rdns = current[:reverse_dns]
|
|
|
|
+
|
|
|
|
+ # if the resulting dns name...
|
|
|
|
+ # .. is too long, use ip-address instead.
|
|
|
|
+ # .. has too many dots, use ip-address instead.
|
|
|
|
+ # .. has too many numbers, use ip-address instead.
|
|
|
|
+ if rdns.length > 21 || rdns.split(".").size > 3 || rdns.scan(/\d/).size > 3
|
|
|
|
+ put_log "cutting down host_name: #{rdns}, because:"
|
|
|
|
+ put_log "length: #{rdns.length}"
|
|
|
|
+ put_log "chunks count: #{rdns.split(".").size}"
|
|
|
|
+ put_log "num count: #{rdns.scan(/\d/).size}"
|
|
|
|
+ else
|
|
|
|
+ my_cooldns = rdns
|
|
|
|
+ end # of Resolv.getname
|
|
|
|
+ end
|
|
end
|
|
end
|
|
|
|
|
|
put_log "COOOOOOOOOOOOLDNS: #{my_cooldns}"
|
|
put_log "COOOOOOOOOOOOLDNS: #{my_cooldns}"
|
|
@@ -562,7 +565,11 @@ class GameServers
|
|
|
|
|
|
def find_reverse_dname(iphost)
|
|
def find_reverse_dname(iphost)
|
|
put_log "find_reverse_dname drin"
|
|
put_log "find_reverse_dname drin"
|
|
- Resolv.getname(iphost)
|
|
|
|
|
|
+ dname = Resolv.getname(iphost)
|
|
|
|
+ ip_of_dname = Resolv.getaddress(dname)
|
|
|
|
+ if ip_of_dname == iphost
|
|
|
|
+ return dname
|
|
|
|
+ end
|
|
rescue
|
|
rescue
|
|
iphost
|
|
iphost
|
|
end
|
|
end
|
|
@@ -705,6 +712,7 @@ module CentralProtocolHandler
|
|
end
|
|
end
|
|
if @@connected_clients.find { |c| c.username == username }
|
|
if @@connected_clients.find { |c| c.username == username }
|
|
connection = @@connected_clients.find { |c| c.username == username }
|
|
connection = @@connected_clients.find { |c| c.username == username }
|
|
|
|
+ put_log("to #{username}: #{input}")
|
|
sometime = "#{Time.now.utc.strftime("%Y-%m-%d %H:%M:%S %z")}"
|
|
sometime = "#{Time.now.utc.strftime("%Y-%m-%d %H:%M:%S %z")}"
|
|
line = "#{sometime}: #{input}\n"
|
|
line = "#{sometime}: #{input}\n"
|
|
connection.send_data line
|
|
connection.send_data line
|
|
@@ -742,8 +750,8 @@ module CentralProtocolHandler
|
|
# what happens with what input?!
|
|
# what happens with what input?!
|
|
def inputting(input)
|
|
def inputting(input)
|
|
|
|
|
|
- put_log("to #{@username}: SYS You typed: #{input}")
|
|
|
|
- write_user("SYS You typed: #{input}")
|
|
|
|
|
|
+ put_log("SYS #{@username} typed: #{input}")
|
|
|
|
+ #write_user("SYS You typed: #{input}")
|
|
|
|
|
|
if input =~ /^([A-Z_]+)/
|
|
if input =~ /^([A-Z_]+)/
|
|
cmd = $1
|
|
cmd = $1
|
|
@@ -913,8 +921,11 @@ module CentralProtocolHandler
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
- else # of if allowed command
|
|
|
|
- write_user("SYS Command #{input} not allowed, your commands are: #{my_cmds.join(", ")}.")
|
|
|
|
|
|
+ else # of if allowed command
|
|
|
|
+ if input.length > 15
|
|
|
|
+ input = input.slice(0,14) + ".."
|
|
|
|
+ end
|
|
|
|
+ write_user("SYS Command '#{input}' not allowed, your commands are: #{my_cmds.join(", ")}.")
|
|
end # of if allowed command
|
|
end # of if allowed command
|
|
|
|
|
|
end # of inputting!
|
|
end # of inputting!
|