X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/68876ea24b3d1782d404a39989ad855b328e5304..b6c85cc60b04bc75697a47a5a019e17d8dd47a47:/modules/m_resv.c diff --git a/modules/m_resv.c b/modules/m_resv.c index 7ad97e6..3cbf4a8 100644 --- a/modules/m_resv.c +++ b/modules/m_resv.c @@ -36,8 +36,7 @@ #include "s_conf.h" #include "s_newconf.h" #include "hash.h" -#include "s_log.h" -#include "sprintf_irc.h" +#include "logger.h" static int mo_resv(struct Client *, struct Client *, int, const char **); static int ms_resv(struct Client *, struct Client *, int, const char **); @@ -71,7 +70,6 @@ static int remove_resv_from_file(struct Client *source_p, const char *name); /* * mo_resv() - * parv[0] = sender prefix * parv[1] = channel/nick to forbid * parv[2] = reason */ @@ -141,7 +139,6 @@ mo_resv(struct Client *client_p, struct Client *source_p, int parc, const char * } /* ms_resv() - * parv[0] = sender prefix * parv[1] = target server * parv[2] = channel/nick to forbid * parv[3] = reason @@ -150,8 +147,8 @@ static int ms_resv(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - /* parv[0] parv[1] parv[2] parv[3] - * oper target server resv reason + /* source_p parv[1] parv[2] parv[3] + * oper target server resv reason */ propagate_resv(source_p, parv[1], 0, parv[2], parv[3]); @@ -214,6 +211,13 @@ parse_resv(struct Client *source_p, const char *name, return; } + if(strchr(name, ',')) + { + sendto_one_notice(source_p, + ":Invalid character ',' in channel RESV"); + return; + } + if(strchr(reason, '"')) { sendto_one_notice(source_p, @@ -224,9 +228,9 @@ parse_resv(struct Client *source_p, const char *name, aconf = make_conf(); aconf->status = CONF_RESV_CHANNEL; aconf->port = 0; - aconf->info.name = rb_strdup(name); + aconf->name = rb_strdup(name); aconf->passwd = rb_strdup(reason); - add_to_resv_hash(aconf->info.name, aconf); + add_to_resv_hash(aconf->name, aconf); if(temp_time > 0) { @@ -243,7 +247,7 @@ parse_resv(struct Client *source_p, const char *name, temp_time / 60, name); } else - write_confitem(RESV_TYPE, source_p, NULL, aconf->info.name, + write_confitem(RESV_TYPE, source_p, NULL, aconf->name, aconf->passwd, NULL, NULL, 0); } else if(clean_resv_nick(name)) @@ -282,7 +286,7 @@ parse_resv(struct Client *source_p, const char *name, aconf = make_conf(); aconf->status = CONF_RESV_NICK; aconf->port = 0; - aconf->info.name = rb_strdup(name); + aconf->name = rb_strdup(name); aconf->passwd = rb_strdup(reason); rb_dlinkAddAlloc(aconf, &resv_conf_list); @@ -301,7 +305,7 @@ parse_resv(struct Client *source_p, const char *name, temp_time / 60, name); } else - write_confitem(RESV_TYPE, source_p, NULL, aconf->info.name, + write_confitem(RESV_TYPE, source_p, NULL, aconf->name, aconf->passwd, NULL, NULL, 0); } else @@ -371,7 +375,6 @@ cluster_resv(struct Client *source_p, int temp_time, const char *name, /* * mo_unresv() - * parv[0] = sender prefix * parv[1] = channel/nick to unforbid */ static int @@ -408,15 +411,14 @@ mo_unresv(struct Client *client_p, struct Client *source_p, int parc, const char } /* ms_unresv() - * parv[0] = sender prefix * parv[1] = target server * parv[2] = resv to remove */ static int ms_unresv(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - /* parv[0] parv[1] parv[2] - * oper target server resv to remove + /* source_p parv[1] parv[2] + * oper target server resv to remove */ propagate_generic(source_p, "UNRESV", parv[1], CAP_CLUSTER, "%s", parv[2]); @@ -490,7 +492,7 @@ remove_resv(struct Client *source_p, const char *name) { aconf = ptr->data; - if(irccmp(aconf->info.name, name)) + if(irccmp(aconf->name, name)) aconf = NULL; else break; @@ -577,7 +579,7 @@ remove_resv_from_file(struct Client *source_p, const char *name) break; } - strlcpy(buff, buf, sizeof(buff)); + rb_strlcpy(buff, buf, sizeof(buff)); if((p = strchr(buff, '\n')) != NULL) *p = '\0';