• Print

Author Topic: Bans issue  (Read 28 times)

0 Members and 1 Guest are viewing this topic.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Bans issue
« on: July 25, 2010, 03:10:14 pm »
Alright, got another user with ban issues, attached is his bans.txt

First thing I did was cleared my bans.txt and banned_users.cfg files, then added his bans.txt file. Upon restarting (no errors in console), There were only 3 bans visible in XGUI (also in ULib.bans). It also overwrote the bans.txt file in the data folder, so all of the other bans were lost upon joining.

Next, I replaced the original bans.txt file, and then modified the name on this entry:
Code: [Select]
"STEAM_0:1:29692925"   
{
   "time"   1279159912
   "unban"   1279163512
   "admin"   "[UMLF] Wickerman(STEAM_0:1:20140348)"
   "name"   "{EVIL} \"The Toker\""
   "reason"   "rdm"
}
.. to:
Code: [Select]
   "name"   "{EVIL} The Toker" .. and proceeded to restart. Only ~115 of 123 bans found in ULib.bans, and I got a bunch of timer errors:
Code: [Select]
addons\ulib\lua\ulib\server\player.lua:343: attempt to perform arithmetic on field 'unban' (a nil value)
I'll update this when/if I find more errors... Anybody see anything iffy?
« Last Edit: July 25, 2010, 03:19:19 pm by Stickly Man! »
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Bans issue
« Reply #1 on: July 25, 2010, 05:14:40 pm »
I've never actually looked at the bans code much, since it was provided by spbogie way back when. As far as I can tell, it's doing exactly what it was programmed to do... it shuffles all responsibility for permabans off to the engine. The three bans that are left aren't permabans. This is annoying though since it removes the reasons for banning and such. Should we change this?
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Bans issue
« Reply #2 on: July 25, 2010, 08:07:08 pm »
I definitely recommend looking into ban code.
We've seen corruption for too long now.
It still aggravates me that Garry allows \\ as a comment in lua, but allows it in names too. His own player:Name() code will throw errors on a name \\JamminR\\ if passed to a script.

Sorry
* JamminR is in a bad mood, tired and cranky.

"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Bans issue
« Reply #3 on: July 25, 2010, 08:34:29 pm »
Whoa, this got split into a new topic. Was wondering where the posts went..

Yeah.. I couldn't figure out what was going on.. I tried removing some of the bans that weren't permabans (I think there are some bans in there that showed up but were expired)

There's definitely something strange going on there that we need to figure out  :-\
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline spbogie

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 456
  • Karma: 41
Re: Bans issue
« Reply #4 on: August 01, 2010, 12:16:49 pm »
Wow, it's been a LONG time since I've looked at any of this code, but since Meg had to go and blame me for it I figured I should take a look ;)

The bans are actually handled by use of the built-in ban system (banid, writeid) because, at least when I was working on it, they would trigger well before Lua had a chance to in the player join sequence. However the default system only stores permanent bans, so temp bans were all lost any time the server restarted (and I believe even between map loads at one point...) I believe one of the other requirements we set was that you should still be able to unban someone with the default server commands.

So as part of ULib's initialization it first reads in the ULib specific ban file to ULib.bans. Then it reads the default bans file and adds any that aren't in the ULib bans file to ULib.bans with only the steamid and unban time filled in. We then loop over everything in ULib.bans, if the unban time is greater than the current time then we have a temporary ban and we call banid with the time remaining, else if the unban time is 0 then we have a permanent ban and we check and remove it from the ULib file only if it's not in the default bans file, else we have an expired temporary ban and we remove it from the file.

So with this system, to keep all the permanent bans you need to keep BOTH the ulib bans.txt file AND the banned_users.cfg file. As for why we are removing permanent bans that aren't in the default file, I believe it was actually Megiddo who complained to me about permanent bans being recreated after removing them from the default file, though as I said that was a long time so I can't be 100% sure.

As for the issue of invalid characters in names and such, the KeyValues parsing code is ALL Megiddo :P
I have not failed. I've just found 10,000 ways that won't work. - Thomas A. Edison
I reject your reality and substitute my own. - Adam Savage

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Bans issue
« Reply #5 on: August 01, 2010, 01:26:06 pm »
Heh, yah, sorry. Was playing around with it last night and realized that the bans were being removed because I didn't have them in the default file. I couldn't remember why it had that behavior at the time but it makes sense now. This would even let a user delete banned_users.cfg to clear all the permabans.

Good to see you around here again though, spbogie! :)

I still can't find any errors with that user's setup though. He provided both files and it works perfectly on my machine. Unicode and what-have-you is all read in properly.
« Last Edit: August 01, 2010, 01:32:01 pm by Megiddo »
Experiencing God's grace one day at a time.

  • Print