#include "msg.h"
#include "parse.h"
#include "modules.h"
+#include "logger.h"
+#include "supported.h"
static int mo_etrace(struct Client *, struct Client *, int, const char **);
static int me_etrace(struct Client *, struct Client *, int, const char **);
{mg_ignore, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_masktrace, 2}}
};
+static int
+_modinit(void)
+{
+ add_isupport("ETRACE", isupport_string, "");
+
+ return 0;
+}
+
+static void
+_moddeinit(void)
+{
+ delete_isupport("ETRACE");
+}
+
mapi_clist_av1 etrace_clist[] = { &etrace_msgtab, &chantrace_msgtab, &masktrace_msgtab, NULL };
-DECLARE_MODULE_AV1(etrace, NULL, NULL, etrace_clist, NULL, NULL, "$Revision: 3161 $");
+DECLARE_MODULE_AV1(etrace, _modinit, _moddeinit, etrace_clist, NULL, NULL, "$Revision: 3161 $");
static void do_etrace(struct Client *source_p, int ipv4, int ipv6);
static void do_etrace_full(struct Client *source_p);
/*
* m_etrace
- * parv[0] = sender prefix
* parv[1] = options [or target]
* parv[2] = [target]
*/
if((target_p = find_person(parv[1])) && MyClient(target_p))
do_single_etrace(source_p, target_p);
- sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE),
+ sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE),
target_p ? target_p->name : parv[1]);
return 0;
#endif
sendto_one(source_p, form_str(RPL_ETRACE),
- me.name, source_p->name,
- IsOper(target_p) ? "Oper" : "User",
+ me.name, source_p->name,
+ IsOper(target_p) ? "Oper" : "User",
get_client_class(target_p),
target_p->name, target_p->username, target_p->host,
show_ip(source_p, target_p) ? target_p->sockhost : "255.255.255.255",
*/
if(!show_ip(source_p, target_p))
sendto_one(source_p, form_str(RPL_ETRACEFULL),
- me.name, source_p->name,
+ me.name, source_p->name,
IsOper(target_p) ? "Oper" : "User",
get_client_class(target_p),
- target_p->name, target_p->username, target_p->host,
+ target_p->name, target_p->username, target_p->host,
"255.255.255.255", "<hidden> <hidden>", target_p->info);
else
sendto_one(source_p, form_str(RPL_ETRACEFULL),
- me.name, source_p->name,
+ me.name, source_p->name,
IsOper(target_p) ? "Oper" : "User",
get_client_class(target_p),
- target_p->name, target_p->username,
+ target_p->name, target_p->username,
target_p->host, target_p->sockhost,
target_p->localClient->fullcaps, target_p->info);
}
sockhost = target_p->sockhost;
sendto_one(source_p, form_str(RPL_ETRACE),
- me.name, source_p->name,
+ me.name, source_p->name,
IsOper(target_p) ? "Oper" : "User",
/* class field -- pretend its server.. */
target_p->servptr->name,
{
struct Client *target_p;
rb_dlink_node *ptr;
- const char *sockhost;
- char *mangle_gecos = NULL;
-
- if(gecos != NULL)
- {
- if(strstr(gecos, "\\s"))
- {
- char *tmp = LOCAL_COPY(gecos);
- char *orig = tmp;
- char *new = tmp;
- while(*orig)
- {
- if(*orig == '\\' && *(orig + 1) != '\0')
- {
- if(*(orig + 1) == 's')
- {
- *new++ = ' ';
- orig += 2;
- }
- /* otherwise skip that and the escaped
- * character after it, so we dont mistake
- * \\s as \s --fl
- */
- else
- {
- *new++ = *orig++;
- *new++ = *orig++;
- }
- }
- else
- *new++ = *orig++;
- }
-
- *new = '\0';
- mangle_gecos = LOCAL_COPY(tmp);
- }
- else
- mangle_gecos = LOCAL_COPY(gecos);
- }
+ const char *sockhost;
RB_DLINK_FOREACH(ptr, list->head)
{
target_p = ptr->data;
if(!IsPerson(target_p))
continue;
-
+
if(EmptyString(target_p->sockhost))
sockhost = empty_sockhost;
else if(!show_ip(source_p, target_p))
if(name != NULL && !match(name, target_p->name))
continue;
- if(mangle_gecos != NULL && !match_esc(mangle_gecos, target_p->info))
+ if(gecos != NULL && !match_esc(gecos, target_p->info))
continue;
-
+
sendto_one(source_p, form_str(RPL_ETRACE),
- me.name, source_p->name,
+ me.name, source_p->name,
IsOper(target_p) ? "Oper" : "User",
/* class field -- pretend its server.. */
target_p->servptr->name,
}
static int
-mo_masktrace(struct Client *client_p, struct Client *source_p, int parc,
+mo_masktrace(struct Client *client_p, struct Client *source_p, int parc,
const char *parv[])
{
char *name, *username, *hostname, *gecos;
const char *mask;
int operspy = 0;
- mask = parv[1];
- name = LOCAL_COPY(parv[1]);
+ mask = parv[1];
+ name = LOCAL_COPY(parv[1]);
collapse(name);
if(IsOperSpy(source_p) && parv[1][0] == '!')
name++;
mask++;
operspy = 1;
- }
-
+ }
+
if(parc > 2 && !EmptyString(parv[2]))
{
gecos = LOCAL_COPY(parv[2]);
collapse_esc(gecos);
} else
gecos = NULL;
-
+
if((hostname = strchr(name, '@')) == NULL)
{
}
*hostname++ = '\0';
-
+
if((username = strchr(name, '!')) == NULL)
{
username = name;
sendto_one_notice(source_p, ":Invalid parameters");
return 0;
}
-
+
if(operspy) {
if (!ConfigFileEntry.operspy_dont_care_user_info)
{
if(!EmptyString(gecos)) {
rb_strlcat(buf, " ", sizeof(buf));
rb_strlcat(buf, gecos, sizeof(buf));
- }
+ }
- report_operspy(source_p, "MASKTRACE", buf);
+ report_operspy(source_p, "MASKTRACE", buf);
}
- match_masktrace(source_p, &global_client_list, username, hostname, name, gecos);
+ match_masktrace(source_p, &global_client_list, username, hostname, name, gecos);
} else
match_masktrace(source_p, &lclient_list, username, hostname, name, gecos);
- sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name);
+ sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name);
return 0;
}