ULX

Author Topic: ULX: Permanent Bans not saving [Solved]  (Read 19922 times)

0 Members and 1 Guest are viewing this topic.

Offline Ceka

  • Newbie
  • *
  • Posts: 8
  • Karma: 1
ULX: Permanent Bans not saving [Solved]
« on: April 07, 2011, 11:33:40 AM »
So; this is my problem.I have a DarkRP Server (runed by ServerFFS; Wont give full address due to advertisement charges against me :o!) and Permanent Bans Do not save upon restart.
Heres my story:
we did a test for this issue:
Did a Permanent ban
Did a Temporary Ban
and restarted; Temporary ban Saved nicely, but there is no Permanent ban. I have discovered the (steam)id of the person I banned is located in Source Bans;Before restarting, a Ban is Displayed in the menu, after restart it is gone.

I know DarkRP has issues with ULX; i had earlier issues with ULX and DarkRP, that the ranking system wasnt saving people into the ulx rank list; tho when placed in users.txt, it does save.;
Ok back on the main issue:

I have exec banned_users.cfg and exec banned_ips.cfg (or whatever it is) in my server.cfg

Any Ideas?

Side Question(i'd like an answer here too :o!): What is the name of that addon that displays gameplay time. E.g. How many hours you have on the server?

Sorry if this issue has been posted already, I googled my issue and it didnt display me anything. Thank you for all answers,

~Ceka
« Last Edit: April 11, 2011, 06:23:00 AM by Ceka »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX: Permanent Bans not saving
« Reply #1 on: April 07, 2011, 02:26:27 PM »
What version of ULX? What version of ULib? (Version, and are they SVN?)
Did you get both from ulyssesmod.net? Are they SVN? If not, we can't really guarantee the old release version will work with all new stuff.
Our SVN should.

If not using SVN of both, see this from the past few years.
RE Ban crash - make sure the bans.txt file on your server in <gmod>/data/ulib/bans.txt isn't corrupted with lots of slashes "//" in one name/entry, or that it isn't more than a few Kb in size (most grow to 64mb in size when corrupt)
3.4 has known bug when banning players with slashes in name.
Quick fix is to rename bans.txt ... this will remove all temporary bans and ban reasons for all bans, but your permanently banned players will still remain banned (again, just won't have reason or who did them)


When you perma ban someone, does the steamid get stored in your banned_users.cfg, before a restart.

You mention source bans...the mod?
What version of DarkRP?
Rule it out by starting a test session in Sandbox mode?

Try removing all but ULib, ULX, make sure your server has write access to your gmod/data/ULib and ULX folders.
Make sure your server has write access to your gmod/settings/banned_users.cfg file.
Start up a server with only ULib, ULX, and of course with Sandbox (You've taken DarkRP and SourceMod out of the picture).
Ban a test account. Check the banned file. If the ban is there, start adding back other mods one item at a time.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Ceka

  • Newbie
  • *
  • Posts: 8
  • Karma: 1
Re: ULX: Permanent Bans not saving
« Reply #2 on: April 08, 2011, 02:27:03 AM »
I am not using Source Mod; Tho im working right now on removing everything else and checking what youve told me. Thank you for the support.
I will do a edit of this post as soon as i am done

OK. I done some Tests.
I removed everything that could possibly interfere with ULX.
My data/ULib/bans.txt :

Code: [Select]

"STEAM_0:1:29860700\r"
{
"unban" 0
}
"STEAM_0:1:20923768\r"
{
"unban" 0
}
"STEAM_0:1:29034189\r"
{
"unban" 0
}
"STEAM_0:1:35508674\r"
{
"unban" 0
}
"STEAM_0:0:34892702\r"
{
"unban" 0
}
"STEAM_0:0:9875067\r"
{
"unban" 0
}

Well; Still in the XGUI menu; That is ULX Menu the Ban doesnt appear. I did two tests. a ulx banid test and a normal !ban (without DarkRP, of course) none of them saved; the normal ban nor the banid didnt save (or load; no idea) none of the steamids over there are showing in ULX's Menu;


Il do a edit when i try temp bans again!
Reminder: This happens when i do a restart; maybe something stops it from loading/saving ?
« Last Edit: April 09, 2011, 12:52:00 AM by Ceka »

Offline Ceka

  • Newbie
  • *
  • Posts: 8
  • Karma: 1
Re: ULX: Permanent Bans not saving
« Reply #3 on: April 09, 2011, 01:00:51 AM »
Ok my tests are completly done. Still the same issue as i had without DarkRP ( never had Source Bans ) Temp bans save/load in XGUI's menu, and permas dont ( Please dont ask me if i checked show permas; Of course i did)

EDIT: Sorry xD i didnt do a edit i accidently made a new post -_-

Offline edk141

  • Newbie
  • *
  • Posts: 23
  • Karma: 5
Re: ULX: Permanent Bans not saving
« Reply #4 on: April 09, 2011, 01:20:13 AM »
Are those escaped carriage returns at the end of all the Steam IDs? you could try removing them

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: ULX: Permanent Bans not saving
« Reply #5 on: April 09, 2011, 08:48:15 AM »
Yeah, those \r at the end of each steamID is probably causing the problem. We've heard this bug happen before, but we have no idea how to replicate it. Do you remember at all how you or your admins created each of these bans? Were some of those temporary bans? And which addons were you running on any server where this error occured?

Hopefully we'll be able to get some useful information  ;)
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline edk141

  • Newbie
  • *
  • Posts: 23
  • Karma: 5
Re: ULX: Permanent Bans not saving
« Reply #6 on: April 09, 2011, 11:47:23 AM »
Looking through ULX and ULib it looks like the steam ID gets taken direct from a Player object and passed to makeKeyValues, which doesn't have any \r's in the source code, then escaped by Lua's string.format.

Maybe silly, but I would be interested to see the output of these commands (basically to find out if anything's hooking Player.SteamID and what sort of string it's making)
Code: [Select]
lua_run PrintTable( debug.getinfo( FindMetaTable( "Player" ).SteamID ) )
lua_run for k, v in next, player.GetAll() do print( v:Nick(), string.format( "%q", v:SteamID() ) ) end

Offline Ceka

  • Newbie
  • *
  • Posts: 8
  • Karma: 1
Re: ULX: Permanent Bans not saving
« Reply #7 on: April 10, 2011, 06:40:56 AM »
Ok guys; sorry for the late replies. Quotes Section:

Yeah, those \r at the end of each steamID is probably causing the problem. We've heard this bug happen before, but we have no idea how to replicate it. Do you remember at all how you or your admins created each of these bans? Were some of those temporary bans? And which addons were you running on any server where this error occured?

Hopefully we'll be able to get some useful information  ;)

Im running no addon connected with ULX; I used to have evolve; I didnt remove the parts written by evolve (data/EV_Logs,e.t.c.) So i could Use the old bans; and Search throught the logs for...Checking reports that might have been old.
Im running atm nothing that could interfere with ULX; if thats what your asking!


What version of ULX? What version of ULib? (Version, and are they SVN?)
Did you get both from ulyssesmod.net? Are they SVN? If not, we can't really guarantee the old release version will work with all new stuff.
Our SVN should.

If not using SVN of both, see this from the past few years.

When you perma ban someone, does the steamid get stored in your banned_users.cfg, before a restart.

You mention source bans...the mod?
What version of DarkRP?
Rule it out by starting a test session in Sandbox mode?

Try removing all but ULib, ULX, make sure your server has write access to your gmod/data/ULib and ULX folders.
Make sure your server has write access to your gmod/settings/banned_users.cfg file.
Start up a server with only ULib, ULX, and of course with Sandbox (You've taken DarkRP and SourceMod out of the picture).
Ban a test account. Check the banned file. If the ban is there, start adding back other mods one item at a time.


Both are SVN. I allways use most up to date versions. It would make no sentce to use the Buggy version; and then complain for a bug. I think i allready quoted this but didnt mention this.



Looking through ULX and ULib it looks like the steam ID gets taken direct from a Player object and passed to makeKeyValues, which doesn't have any \r's in the source code, then escaped by Lua's string.format.

Maybe silly, but I would be interested to see the output of these commands (basically to find out if anything's hooking Player.SteamID and what sort of string it's making)
Code: [Select]
lua_run PrintTable( debug.getinfo( FindMetaTable( "Player" ).SteamID ) )
lua_run for k, v in next, player.GetAll() do print( v:Nick(), string.format( "%q", v:SteamID() ) ) end

(SILENT) You ran rcon command: lua_run PrintTable( debug.getinfo( FindMetaTable( Player ).SteamID ) )
(SILENT) You ran rcon command: lua_run for k, v in next, player.GetAll() do print( v:Nick(), string.format( %q , v:SteamID() ) ) end
(SILENT) You ran rcon command: lua_run for k, v in next, player.GetAll() do print( v:Nick(), string.format(%q,v:SteamID()))) end


I banned all the users every way. With their names and steamid. Same result.
BTW: they are still banned, but not trought ULX, but thru using the default ban commands (no admin system) so they are added in "banid blblalal" but not ULX's menu.

Code: [Select]
(SILENT) You ran rcon command: lua_run PrintTable( debug.getinfo( FindMetaTable( Player ).SteamID ) )
(SILENT) You ran rcon command: lua_run for k, v in next, player.GetAll() do print( v:Nick(), string.format( %q , v:SteamID() ) ) end
(SILENT) You ran rcon command: lua_run for k, v in next, player.GetAll() do print( v:Nick(), string.format(%q,v:SteamID()))) end
Nothing happend.

Results from the commands:

Thanks for the Replies.

Offline Ceka

  • Newbie
  • *
  • Posts: 8
  • Karma: 1
Re: ULX: Permanent Bans not saving
« Reply #8 on: April 10, 2011, 06:49:37 AM »
Sorry for double posting but i think i Discovered something; my old post is too long so ima make a new one

Before restart:

"=Steamid not showed due to privacy="   
{
   "time"   1302442616
   "unban"   0
   "name"   "Zer0Cheese"
   "admin"   "Killing Torcher =AIGC=(=same reason=)"
   "reason"   "goodbye"
}

It didnt contain any \r

a guy i banned for glitching;

After:


"CensoredSteamid\r"   
{
   "unban"   0
}

Notice it contaisn a \r.

Now i censored the steamids due to the bans containing names!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX: Permanent Bans not saving
« Reply #9 on: April 10, 2011, 09:51:59 AM »
Code: [Select]
(SILENT) You ran rcon command: lua_run PrintTable( debug.getinfo( FindMetaTable( Player ).SteamID ) )
(SILENT) You ran rcon command: lua_run for k, v in next, player.GetAll() do print( v:Nick(), string.format( %q , v:SteamID() ) ) end
(SILENT) You ran rcon command: lua_run for k, v in next, player.GetAll() do print( v:Nick(), string.format(%q,v:SteamID()))) end
Nothing happend.

Output would be shown or need to be run on server console.
Have access to see it?
If not, can you enable your server console logging and get the output during those?
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline edk141

  • Newbie
  • *
  • Posts: 23
  • Karma: 5
Re: ULX: Permanent Bans not saving
« Reply #10 on: April 10, 2011, 11:13:58 AM »
For good privacy you need to hide every steam ID and name, at least partially. Community pages and steam ID's can be found pretty easily if you have the name, and a Steam ID is a unique link to a community profile ID

You may need to run the commands through HLSW, the ingame console can't handle quotes and lua_run is blocked by game.ConsoleCommand. Stick -condebug in your server's command line if you can't see the console. If you can't do that either, I can make you a lua file to stick on the server that gets the info and either writes it to a file or prints it to your console.

The restart makes me think though that it might be something to do with ULib trying to parse the files. What is the file like when the server's stopped? (ie before ULib has to read the data from the files). I'm eyeing parseKeyValues suspiciously now.
« Last Edit: April 10, 2011, 11:16:01 AM by edk141 »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX: Permanent Bans not saving
« Reply #11 on: April 10, 2011, 11:39:46 AM »
I'm eyeing parseKeyValues suspiciously now.

Be sure to let us know if you find anything. We love getting our code reviewed by other programmers. :D
Experiencing God's grace one day at a time.

Offline edk141

  • Newbie
  • *
  • Posts: 23
  • Karma: 5
Re: ULX: Permanent Bans not saving
« Reply #12 on: April 10, 2011, 03:25:41 PM »
Only someone who experiences the bug can verify this. Make sure you read the bit at the bottom

All the code here is in ULib.refreshBans(), in ulib/server/player.lua.

Unrelated I know, but first of all, this is a beauty:
Code: [Select]
> if err then
print( "Bans file was not formatted correctly. Attempting to fix and backing up original" )
> if err then
print( "Error while reading bans file was: " .. err )
end
print( "Original file was backed up to " .. ULib.backupFile( ULib.BANS_FILE ) )
ULib.bans = {}
end

Okay, to business...

I suspect that the \r stems from this bit of code:
Code: [Select]
default_bans = string.gsub( default_bans, "banid %d+ ", "" )
* default_bans = string.Explode( "\n", default_bans )
local ban_set = {}
for _, v in pairs( default_bans ) do
if v ~= "" then
ban_set[ v ] = true
if not ULib.bans[ v ] then
ULib.bans[ v ] = { unban = 0 }
end
end
end
In the line I marked *, ULib splits by \n only, but analysis of banned_user.cfg (read: opening it in Windows notepad) confirms it uses the Windows line ending convention (\r\n). I would guess that something attempts to convert line endings going in, but doesn't always manage. If I'm right, the bug can be fixed by replacing "\r" with "" before the call to string.Explode().

The problem is worsened by this test. I don't know, but I guess it's to make sure ULib doesn't keep players banned if they're removed from the file (to allow unbans that don't go through ULib/ULX to work). If the ban is permanent, it makes sure it was set in banned_user.cfg:
Code: [Select]
elseif math.floor( v.unban ) == 0 then -- We floor it because GM10 has floating point errors that might make it be 0.1e-20 or something dumb.
if not ban_set[ k ] then
ULib.bans[ k ] = nil
end
ban_set was filled in the previous block of code with all the keys found in banned_user.cfg. However, the entry in banned_user didn't match because it had the \r on the end. So ULib.refreshBans() thinks the player must have been unbanned, and deletes the entry from its own table.

The key with the \r appended will remain, since it was set by banned_user, and ULib will write it to its own ban list (complete with the \r). But it won't be a valid Steam ID, so stuff might filter it out, and it will lose the reason, admin and anything else.

I haven't been able to duplicate this because I whatever is happening to make Ceka's server behave strangely doesn't happen to mine. This is just my theory - although having said that, artificially appending \r to each string in the for loop does cause the right symptoms.

Edit: Just noticed this
Side Question(i'd like an answer here too :o!): What is the name of that addon that displays gameplay time. E.g. How many hours you have on the server?
Utime?
« Last Edit: April 10, 2011, 03:29:42 PM by edk141 »

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given