adding to data files in bz

NOTE: this is an informal bug post place ONLY. Real bugs should be posted on GitHub
Post Reply
User avatar
sid6.7
Private First Class
Private First Class
Posts: 614
Joined: Mon Oct 06, 2003 9:58 pm
Location: West USA
Contact:

adding to data files in bz

Post by sid6.7 »

this is about the banlist file
over at skymoco we have to
manually add a cheat or tk'r
to the banfile if we dont our
banlist resets to none when
we reset the server...

whenever we /ban xx.xx.xx.xx
shouldnt that be editing the banfile?
adding or subtracting from the file
or am i mis-understanding the
command...

this seems to work for password
files fine etc...but not the banfile

talk about a noob question from an old admin LOL
User avatar
Lan
Private First Class
Private First Class
Posts: 296
Joined: Sun Jun 13, 2004 1:21 am
Contact:

Post by Lan »

It should indeed, if you set up a banfile for BZFS and you told BZFS the correct file name. This is the first time I've heard a problem like this.

It most likely does write to the banfile as you use /ban, but the server reset kills it. It shouldn't do that either, but that is what I have a hunch is erasing the file.
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Post by blast »

Not sure if this is the case, but could running multiple servers with the same banfile case problems? Like, the first one locks the file, and the second can't change/open it? I know with the user databases you sometimes have to /reload it when running multiple servers.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
toaster
Private First Class
Private First Class
Posts: 457
Joined: Sat Feb 21, 2004 4:44 pm

Post by toaster »

blast,

You might want to get on viper.pimpi.org and talk to Manu. He was having the same problem and I think he fixed it recently. It did have something to do with permissions, and there are more than one server in that domain, too.
-toaster
"So there I was, all alone, facing all of the enemy. I started driving in circles, until I had them surrounded, and then I escaped in the confusion."
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Post by blast »

Just looked over the code quick, and it seems that adding a ban writes a new ban file. However, let's say that Server A and Server B both load a blank ban file. Server A bans someone, and it gets written to the file. Server B will not see this ban, so when they ban someone, it will write out their ban list. Server A's ban will no longer be in the ban file. Reloading the ban file just before adding a new ban fixed this. You can either do a /reload, or modify the handleBanCmd(...) in commands.cxx as follows, assuming 1.10.6 codebase.

Before:

Code: Select all

  if( argv.size() < 2 ){
    strcpy(reply, "Syntax: /ban <ip> [duration] [reason]");
    sendMessage(ServerPlayer, t, reply, true);
    strcpy(reply, "        Please keep in mind that reason is displayed to the user.");
    sendMessage(ServerPlayer, t, reply, true);
  }
  else {
    int durationInt = 0;
    std::string ip = argv[1];
    std::string reason;
After:

Code: Select all

  if( argv.size() < 2 ){
    strcpy(reply, "Syntax: /ban <ip> [duration] [reason]");
    sendMessage(ServerPlayer, t, reply, true);
    strcpy(reply, "        Please keep in mind that reason is displayed to the user.");
    sendMessage(ServerPlayer, t, reply, true);
  }
  else {
    // reload the banlist
    clOptions->acl.load();

    int durationInt = 0;
    std::string ip = argv[1];
    std::string reason;
Something like this may very well have been implemented in an existing patch, or in CVS. Of course, it would also be nice to update the banlist on a regular basis, like every 5 or 10 minutes.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

CVS dosn't reload the banlist. and actualy it's goten a bit more complex, becasue the banlist is more then a local file now. So there are bans from multiple sources. We'd have to flush the local bans, reload them and then save. If you just reload, you flush out the bans from the master banlist as well as the local bans.

It is something we should do tho. Probably just make it part of the save function itslelf, as there is no reason to ever NOT do it.
ImageJeffM
Post Reply