View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003694 | unreal | module api | public | 2008-05-14 09:15 | 2008-08-08 09:39 |
| Reporter | Veovis | Assigned To | |||
| Priority | normal | Severity | crash | Reproducibility | always |
| Status | closed | Resolution | no change required | ||
| Product Version | 3.2.7 | ||||
| Summary | 0003694: Can't use do_cmd(&me, &me, "MODE"...), it crashes. | ||||
| Description | When a module call the function do_cmd to apply a channel mode for a user (+vhoaq), the server crash. This is because in channel.c, the functions is_chan_op, has_voice, is_halfop, is_chanowner, is_, is_skochanop, is_chanprot considers &me as a client, not as a server. Actually, modules have to apply this channel modes themselves to avoid this bug. | ||||
| Steps To Reproduce | I've created a module to put owner on empty chans (rather than modified the core). So it's look like that (it's a HOOKTYPE_LOCAL_JOIN) static void hook_owner(aClient *cptr, aClient *sptr, aChannel *chptr, char *parv[]) { char *xparv[] = { NULL, NULL, NULL, NULL, NULL }; if (!chptr || chptr->users > 1) return; xparv[0] = me.name; xparv[1] = chptr->chname; xparv[2] = "+q"; xparv[3] = sptr->name; do_cmd(&me, &me, "MODE", 4, xparv); } | ||||
| Additional Information | This append when calling do_cmd(&me, &me, ...) with one of this channel mode : +vhoaq. | ||||
| Attached Files | channel.c.do_cmd.patch (1,643 bytes) | ||||
| 3rd party modules | |||||
|
|
You shouldn't be executing do_cmd with &me as the client. do_cmd is really meant to issue commands on behalf of a real thing (user, server), not ourselves (&me). It can in fact call exit_client and free everything (aka: killing ourselves) which would be.. fun.. for &me (though there might be protection against that somrewhere, still... not good). So, thanks for the patch, but I'm afraid I'm going to keep things as-is to discourage this use. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2008-05-14 09:15 | Veovis | New Issue | |
| 2008-05-14 09:15 | Veovis | File Added: channel.c.do_cmd.patch | |
| 2008-08-08 09:39 | syzop | QA | => Not touched yet by developer |
| 2008-08-08 09:39 | syzop | U4: Need for upstream patch | => No need for upstream InspIRCd patch |
| 2008-08-08 09:39 | syzop | Status | new => closed |
| 2008-08-08 09:39 | syzop | Note Added: 0015346 | |
| 2008-08-08 09:39 | syzop | Resolution | open => no change required |
| 2017-01-06 15:48 | syzop | Category | module => module api |