How to block a client in custom module?

These are old archives. They are kept for historic purposes only.
Post Reply
RDXdev
Posts: 4
Joined: Thu Sep 25, 2008 3:24 pm

How to block a client in custom module?

Post by RDXdev »

Hi,

In my module in some cases I have to block connected clients.
How could I do it with "kline"-command?
Is it possible to send this command with

Code: Select all

sendto_one(sptr, ":noticebot kline +user@host <time in sec> <message>");
where aClient *sptr?

Or should I do it in other way.

How to get user@host information from aClient *sptr structure?

Thank you for help!
katsklaw
Posts: 1124
Joined: Sun Apr 18, 2004 5:06 pm
Contact:

Re: How to block a client in custom module?

Post by katsklaw »

What is the point is having an ircd module that has server access use/create a bot to perform client level commands?
RDXdev
Posts: 4
Joined: Thu Sep 25, 2008 3:24 pm

Re: How to block a client in custom module?

Post by RDXdev »

There is an extended definition of flooding which can't be checked with usual UnrealIRCd filters.
My module do this extended flood checks. When the flood detected I would like to block the clients which are flooding.
How could I do it?
My idea was to use "kline".
RDXdev
Posts: 4
Joined: Thu Sep 25, 2008 3:24 pm

Re: How to block a client in custom module?

Post by RDXdev »

Nobody knows?
Syzop
UnrealIRCd head coder
Posts: 2112
Joined: Sat Mar 06, 2004 8:57 pm
Location: .nl
Contact:

Re: How to block a client in custom module?

Post by Syzop »

Since the modules API is indeed highly underdocumented, you are best off with checking existing modules, how they do it.
Like, have a look at my nopost module, or AntiMoon, or AntiRandom, etc...
RDXdev
Posts: 4
Joined: Thu Sep 25, 2008 3:24 pm

Re: How to block a client in custom module?

Post by RDXdev »

Syzop wrote:Since the modules API is indeed highly underdocumented, you are best off with checking existing modules, how they do it.
Like, have a look at my nopost module, or AntiMoon, or AntiRandom, etc...
Thank you, it was helpful.
By now I have another problem. I'm using the function place_host_ban() in function banflood_filter_msg() called in HOOKTYPE_USERMSG and HOOKTYPE_CHANMSG. And after the function banflood_filter_msg() returns the ircd-server crashes. Without place_host_ban() it works fine but didn't do what it expected to do :(.

In comment to place_host_ban() is written: "(you should NOT read from 'sptr' after you got FLUSH_BUFFER!!!)". In my case there is other module(s) which use HOOKTYPE_USERMSG and HOOKTYPE_CHANMSG and I can't prevent them from reading from 'sptr' (at least I don't know how to do it).

What am I doing wrong?
Is there another solution how to ban a user in this case?

Thank you for answers!
Syzop
UnrealIRCd head coder
Posts: 2112
Joined: Sat Mar 06, 2004 8:57 pm
Location: .nl
Contact:

Re: How to block a client in custom module?

Post by Syzop »

You're right, the current hook API does not allow you to do this. It does not allow you to signal the fact that you've killed the client.

Perhaps you could use: dead_link(sptr, "reason here")

That would kill the client. It would not add a *LINE. Though, you can do that yourself if you duck into place_host_ban() routine and copy relevant parts.. like all up to and including calling the m_tkl() layer, but leaving out the find_tkline_match() stuff.

Good luck.
Post Reply