* src/proto-p10.c: Bug fix for SF Bug #2547157 (topic ident bug).
-2009-01-29 Alex Schumann <rubin@afternet.org>
-
- * src/hash.c: Added a function to check if a user pointer
- points to a user that actually exists.
-
- * src/dict-splay.c: added a dict function to check if data exists
- in a dict list.
-
- * src/opserv.c: added safety checks on nick and auth callbacks to
- ensure the user still exists (and wasn't removed by a previous
- callback)
-
- * src/mod-track.c: added safety checks on nick and auth callbacks
- to ensure the user still exists
-
2009-01-27 Alex Schumann <rubin@afternet.org>
* src/modpython.py: Comment out debug printing
return NULL;
}
-/* We seem to find ourselves in a situation where callbacks sometimes contain
- * data pointers to users who have been killed and deleted by previously hooked
- * callbacks. This function provides a way to check for that before using
- * what will be unallocated memory pointed to by an old pointer. */
-unsigned int
-dict_validptr(dict_t dict, void *data)
-{
- dict_iterator_t it;
- for (it=dict_first(dict); it; it=iter_next(it)) {
- if(iter_data(it) == data)
- return true;
- }
- return false;
-}
-
-
/*
* This function finds a node and pulls it to the top of the tree.
* This helps balance the tree and auto-cache things you search for.
void dict_set_free_keys(dict_t dict, free_f free_keys);
void dict_set_free_data(dict_t dict, free_f free_data);
unsigned int dict_size(dict_t dict);
-unsigned int dict_validptr(dict_t dict, void *data);
/* if present!=NULL, then *present=1 iff node was found (if node is
* not found, return value is NULL, which may be a valid datum) */
void* dict_find(dict_t dict, const char *key, int *present);
free(old_nick);
}
-/* go through all clients and look for one with this userNode pointer.
- * if we can find it, return true. Otherwise, the user got killed or
- * something and the pointer is not valid anymore */
-unsigned int
-IsUserP(struct userNode *user)
-{
- return dict_validptr(clients, user);
-}
-
struct userNode *
GetUserH(const char *nick)
{
track_nick_change(struct userNode *user, const char *old_nick) {
if (!track_cfg.enabled) return;
- if(!IsUserP(user))
- return 0;
if(check_track_user(old_nick)) {
del_track_user(old_nick);
add_track_user(user);
static int
track_new_user(struct userNode *user) {
- if(!IsUserP(user))
- return 0;
if (!track_cfg.enabled) return 0;
if (user->uplink->burst && !track_cfg.show_bursts) return 0;
if (check_track_new(track_cfg) && check_track_user(user->nick))
static void
track_auth(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle)) {
- if(!IsUserP(user))
- return;
if (!track_cfg.enabled) return;
if (user->uplink->burst && !track_cfg.show_bursts) return;
if (user->handle_info && (check_track_auth(track_cfg) && check_track_user(user->nick))) {
struct gag_entry *gag;
char addr[IRC_NTOP_MAX_SIZE];
- if(!IsUserP(user))
- return 0; /* bail if this user ptr doesnt still exist in users */
-
/* Check to see if we should ignore them entirely. */
if (IsLocal(user) || IsService(user))
return 0;
static void
opserv_alert_check_account(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle))
{
- if(!IsUserP(user))
- return; /* bail if this user ptr doesnt still exist in users */
dict_foreach(opserv_account_based_alerts, alert_check_user, user);
}
{
struct gag_entry *gag;
- if(!IsUserP(user))
- return; /* bail if this user ptr doesnt still exist in users */
+ dict_foreach(opserv_nick_based_alerts, alert_check_user, user);
- dict_foreach(opserv_nick_based_alerts, alert_check_user, user);
/* Gag them if appropriate (and only if). */
user->modes &= ~FLAGS_GAGGED;
for (gag = gagList; gag; gag = gag->next) {
{
const char *type;
- if(!IsUserP(user))
- return; /* bail if this user ptr doesnt still exist in users */
-
if (!opserv_conf.staff_auth_channel
|| user->uplink->burst
|| !user->handle_info)