Make +p expiry more robust
This commit is contained in:
parent
9ace21a74d
commit
1332a0ef97
|
@ -281,6 +281,8 @@ struct LocalUser
|
|||
struct ev_entry *event; /* used for associated events */
|
||||
|
||||
struct PrivilegeSet *privset; /* privset... */
|
||||
|
||||
struct rb_event_t *override_timeout_event;
|
||||
};
|
||||
|
||||
struct PreClient
|
||||
|
|
|
@ -232,6 +232,12 @@ free_local_client(struct Client *client_p)
|
|||
}
|
||||
|
||||
rb_free(client_p->localClient->auth_user);
|
||||
|
||||
if(client_p->localClient->override_timeout_event)
|
||||
{
|
||||
rb_event_delete(client_p->localClient->override_timeout_event);
|
||||
}
|
||||
|
||||
rb_free(client_p->localClient->challenge);
|
||||
rb_free(client_p->localClient->fullcaps);
|
||||
rb_free(client_p->localClient->opername);
|
||||
|
|
15
src/s_user.c
15
src/s_user.c
|
@ -910,6 +910,7 @@ expire_umode_p(void *data)
|
|||
{
|
||||
struct Client *source_p = data;
|
||||
char *parv[4] = {source_p->name, source_p->name, "-p", NULL};
|
||||
source_p->localClient->override_timeout_event = NULL;
|
||||
user_mode(source_p, source_p, 3, parv);
|
||||
}
|
||||
|
||||
|
@ -987,9 +988,17 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
sendto_one_numeric(source_p, RPL_SNOMASK, form_str(RPL_SNOMASK),
|
||||
construct_snobuf(source_p->snomask));
|
||||
|
||||
/* If we're setting +p, expire it */
|
||||
if(ConfigFileEntry.expire_override_time && (source_p->umodes & ~setflags) & UMODE_OVERRIDE)
|
||||
rb_event_addonce("expire_override", expire_umode_p, source_p, ConfigFileEntry.expire_override_time);
|
||||
/* If we're setting +p, expire it, but only from local clients */
|
||||
if(ConfigFileEntry.expire_override_time && MyClient(source_p) && (source_p->umodes & ~setflags) & UMODE_OVERRIDE)
|
||||
{
|
||||
source_p->localClient->override_timeout_event =
|
||||
rb_event_addonce("expire_override", expire_umode_p, source_p, ConfigFileEntry.expire_override_time);
|
||||
}
|
||||
else if(MyClient(source_p) && source_p->localClient->override_timeout_event && (setflags & ~source_p->umodes) & UMODE_OVERRIDE)
|
||||
{
|
||||
rb_event_delete(source_p->localClient->override_timeout_event);
|
||||
source_p->localClient->override_timeout_event = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue