BanByName

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

BanByName

Postby corwin » 09 Sep 2009, 15:52

Hi, I have written an ActionScript extension, which bans by name/ip.
When I try to ban by name, the user is kicked, but when try to login again he relogs without a problem. They are shown as banned into the admin tool. Same happens when try to ban from there - they are being kicked, but relog again freely.
This does not happen with ban by ip.
My questions is if is possible all that to happens because I am using custom login extension, and eventually how to check if user is banned, or get all currently banned users...
User avatar
Flappi282
Posts: 158
Joined: 20 May 2009, 17:51
Contact:

Postby Flappi282 » 09 Sep 2009, 18:26

Are you using this code to ban by name:

Code: Select all

      var object = _server.banUser("USERNAME", 5, "You have been banned by: "+user.getName(), _server.BAN_BY_NAME);
      var object = _server.banUser("USERNAME", 5, "You have been banned by: "+user.getName(), _server.BAN_BY_IP);
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 10 Sep 2009, 07:40

_server.banUser(userToBan, 5, "You are being banned in 5 seconds!", _server.BAN_BY_NAME);

userToBan is the user object.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 10 Sep 2009, 09:17

When I try to ban by name, the user is kicked, but when try to login again he relogs without a problem.

This might depend on how quickly the banishment is removed. You can configure this.
However if the User is banned (you can check from AdminTool) there's no way that they can re-enter with the same name. Maybe they use another one.
They are shown as banned into the admin tool. Same happens when try to ban from there - they are being kicked, but relog again freely.

Of course, kicking is another thing.
When you get kicked, you are simply disconnected, not banned, so you can re-enter.
Kicking simply serves as a method to remind the user to behave properly. Eventually the can get banned if they continue to spam. After that their login will denied.
Lapo
--
gotoAndPlay()
...addicted to flash games
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 10 Sep 2009, 09:33

No, I am not trying to kick the user from the admin tool, but to ban him.
When ban him even from the admin tool, he is shown at the banned list, but after the initial kick, he is able to login again, and he is even shown both in the banned users list and as logged in room.

The banishment removal time is as default - 1800 seconds (30 minutes) - when that period expires he is removed from the banned user list in the admin tool, but that does not concern me, as he is able to login even before that.

I am logging using the java canLogin method, and looks he is accepted into the server even if he is in the ban names list..
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 10 Sep 2009, 09:37

Are you sure the user is not using another "version" of his name?
For example LAPO is not the same name as Lapo in SFS.
Lapo

--

gotoAndPlay()

...addicted to flash games
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 10 Sep 2009, 09:44

Yes, I am absolutely sure.
I am just refreshing the page with the same username after being banned and for the test i am using everywhere lower case usernames with no special characters.


Here is my code with some noise around it:

Code: Select all

         if (md5(secretPhrase.toString()).equals(passedMd5)) {

            try {
               // Attempt to login the user in the system

               newUser = helper.canLogin(username, pass, chan, currentZone.getName());
               response.put("_cmd", "loginSuccess");
               trace("login success");
               Integer userId = newUser.getUserId();
               response.put("userId", userId.doubleValue());
               response.put("isModerator", moderator.equals("1") ? "1" : "");
               loginSuccess = true;
            } catch (LoginException le) {
               trace("login failed: " + nick + " Reason: " + le.getMessage());
               response.put("_cmd", "loginError");
               response.put("err", le.getMessage());
            }

         } else {
            trace("Md5 check not successful");
            // Send login response
         }
         sendResponse(response, -1, null, recipients);   

         // Send room list
         if (loginSuccess) {
            helper.sendRoomList(chan);
         }
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 10 Sep 2009, 10:25

Which server version do you use?
Lapo

--

gotoAndPlay()

...addicted to flash games
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 10 Sep 2009, 10:31

1.6.6
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 10 Sep 2009, 10:51

Currently I am trying to get the banned user list. I see there are classes BannedUser and BanUserTask, but can't see any documentation and getter anywhere. Is this intended?
Kirsten
Posts: 6
Joined: 09 Apr 2010, 06:32

Postby Kirsten » 29 Apr 2010, 07:08

I have the same problem...
Version 1.6.6 + patch 1.6.8...
I am banning by NAME, the banned user will be disconnected from chat. But when the user refresh the site he will always login (but his name is available on the ban-list)
marina
Posts: 14
Joined: 04 Nov 2008, 20:17

Postby marina » 15 Jul 2010, 15:31

Lapo, I wonder what will happen if a several consequent banUser commands with the same User will be called?
Will the first command be executed, and the subsequent ones ignored?
or
Will the banishment time be updated each time a next command is executed?

Also, I wanted to confirm if there is still a problem with ban by name? Does ban by IP work properly though?

Thanks!
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 15 Jul 2010, 17:27

Kirsten:
We tested under 1.6.8, using banning by name and everything works as expected. You should provide more details on how to exactly reproduce this issue.

marina
Yes the banishment time is updated.

Also, I wanted to confirm if there is still a problem with ban by name? Does ban by IP work properly though?

At least in 1.6.8 there is no known problem with any of the ban modes.
Lapo

--

gotoAndPlay()

...addicted to flash games
marina
Posts: 14
Joined: 04 Nov 2008, 20:17

Postby marina » 16 Jul 2010, 13:09

2Lapo: as always, thanks for your prompt reply!
mauro
Posts: 12
Joined: 16 Apr 2010, 06:53
Location: Italy - Ribera (AG)

Postby mauro » 14 Dec 2010, 14:58

I have the same problem with server version 1.6.9. I try to ban by name from client side with the follow code:

Code: Select all

param.put("id", player.getId());
param.put("msg", "");
param.put("mode", "0");
frame.getGestore().getSfs().sendXtMessage("$dmn", "ban", param);


I have a record in ban manager section of admin tool but user can login.
Then I try to ban by name directly from admin tool and I have the same result. If I ban by ip it works fine. Why?
Thanks.

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 59 guests