From 70410b3f33da61ae799f6ce71fd2c744d079c67d Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Thu, 12 Sep 2019 17:57:01 +0200 Subject: [PATCH] Remove unused variables (67 files done, will do rest another time). --- src/api-clicap.c | 2 - src/api-extban.c | 4 +- src/api-isupport.c | 2 +- src/api-moddata.c | 3 -- src/auth.c | 2 +- src/bsd.c | 71 ++++++++++++++----------------- src/channel.c | 3 +- src/conf.c | 51 +++++----------------- src/conf_preprocessor.c | 3 +- src/crashreport.c | 7 --- src/dbuf.c | 2 - src/dispatch.c | 1 - src/dns.c | 6 +-- src/extra.c | 5 +-- src/fdlist.c | 4 -- src/ircd.c | 4 -- src/list.c | 3 +- src/match.c | 6 +-- src/mempool.c | 3 +- src/modules/antirandom.c | 4 +- src/modules/blacklist.c | 7 ++- src/modules/cap.c | 1 - src/modules/channeldb.c | 6 +-- src/modules/charsys.c | 16 +++---- src/modules/close.c | 1 - src/modules/echo-message.c | 4 +- src/modules/help.c | 3 +- src/modules/hideserver.c | 4 +- src/modules/history_backend_mem.c | 2 - src/modules/join.c | 4 -- src/modules/jointhrottle.c | 14 ++---- src/modules/jumpserver.c | 4 +- src/modules/kill.c | 2 +- src/modules/labeled-response.c | 1 - src/modules/message-ids.c | 2 - src/modules/message.c | 6 +-- src/modules/mode.c | 9 +--- src/modules/names.c | 2 - src/modules/nick.c | 20 +++------ src/modules/part.c | 1 - src/modules/pass.c | 1 - src/modules/quit.c | 3 +- src/modules/reputation.c | 2 - src/modules/rmtkl.c | 3 -- src/modules/sapart.c | 1 - src/modules/server.c | 8 +--- src/modules/sjoin.c | 9 +--- src/modules/stats.c | 5 --- src/modules/tkl.c | 27 ++---------- src/modules/tkldb.c | 5 +-- src/modules/user.c | 11 +++-- src/modules/vhost.c | 4 +- src/modules/webirc.c | 6 +-- src/modules/webredir.c | 2 +- src/modules/websocket.c | 3 +- src/modules/who_old.c | 7 ++- src/modules/whois.c | 5 +-- src/modules/whox.c | 2 - src/operclass.c | 1 - src/packet.c | 2 - src/parse.c | 6 --- src/send.c | 16 +------ src/serv.c | 11 ++--- src/tls.c | 6 --- src/updconf.c | 11 ++--- src/url.c | 4 +- src/user.c | 1 - 67 files changed, 126 insertions(+), 331 deletions(-) diff --git a/src/api-clicap.c b/src/api-clicap.c index d74f097e2..c19f0d12b 100644 --- a/src/api-clicap.c +++ b/src/api-clicap.c @@ -202,8 +202,6 @@ ClientCapability *ClientCapabilityAdd(Module *module, ClientCapabilityInfo *clic void unload_clicap_commit(ClientCapability *clicap) { - long bit = clicap->cap; - /* This is an unusual operation, I think we should log it. */ ircd_log(LOG_ERROR, "Unloading client capability '%s'", clicap->name); sendto_realops("Unloading client capability '%s'", clicap->name); diff --git a/src/api-extban.c b/src/api-extban.c index d8fe67de0..a7e72697a 100644 --- a/src/api-extban.c +++ b/src/api-extban.c @@ -53,8 +53,7 @@ int i; Extban *ExtbanAdd(Module *module, ExtbanInfo req) { -int slot; -char tmpbuf[512]; + int slot; if (findmod_by_bantype(req.flag)) { @@ -94,7 +93,6 @@ char tmpbuf[512]; void ExtbanDel(Extban *eb) { -char tmpbuf[512]; /* Just zero it all away.. */ if (eb->owner) diff --git a/src/api-isupport.c b/src/api-isupport.c index e80a4604e..b005bb588 100644 --- a/src/api-isupport.c +++ b/src/api-isupport.c @@ -259,7 +259,7 @@ void make_isupportstrings(void) int i; #define ISUPPORTLEN BUFSIZE-HOSTLEN-NICKLEN-39 int bufsize = ISUPPORTLEN; - int tokcnt = 0, len = 0; + int tokcnt = 0; ISupport *isupport; char tmp[ISUPPORTLEN]; diff --git a/src/api-moddata.c b/src/api-moddata.c index 8f51790ab..3e235fe91 100644 --- a/src/api-moddata.c +++ b/src/api-moddata.c @@ -29,9 +29,6 @@ MODVAR ModData globalvar_moddata[MODDATA_MAX_GLOBALVAR]; ModDataInfo *ModDataAdd(Module *module, ModDataInfo req) { - short i = 0, j = 0; - int paraslot = -1; - char tmpbuf[512]; int slotav = 0; /* highest available slot */ ModDataInfo *m; int new_struct = 0; diff --git a/src/auth.c b/src/auth.c index 9887bed2f..8d4d33755 100644 --- a/src/auth.c +++ b/src/auth.c @@ -75,7 +75,7 @@ static int parsepass(char *str, char **salt, char **hash) */ int Auth_AutoDetectHashType(char *hash) { - static char buf[512], hashbuf[256]; + static char hashbuf[256]; char *saltstr, *hashstr; int bits; diff --git a/src/bsd.c b/src/bsd.c index 8e6c5ece3..ce8e09394 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -410,7 +410,6 @@ void close_listener(ConfigItem_listen *listener) void close_listeners(void) { - Client *cptr; ConfigItem_listen *aconf, *aconf_next; /* close all 'extra' listening ports we have */ @@ -652,12 +651,6 @@ void completed_connection(int fd, int revents, void *data) */ void close_connection(Client *cptr) { - ConfigItem_link *aconf; -#ifdef DO_REMAPPING - int i, j; - int empty = cptr->local->fd; -#endif - if (IsServer(cptr)) { ircstp->is_sv++; @@ -877,6 +870,30 @@ char *getpeerip(Client *acptr, int fd, int *port) } } +/** This checks set::max-unknown-connections-per-ip, + * which is an important safety feature. + */ +static int check_too_many_unknown_connections(Client *acptr) +{ + int cnt = 1; + Client *c; + + if (!find_tkl_exception(TKL_CONNECT_FLOOD, acptr)) + { + list_for_each_entry(c, &unknown_list, lclient_node) + { + if (!strcmp(acptr->ip,GetIP(c))) + { + cnt++; + if (cnt > iConf.max_unknown_connections_per_ip) + return 1; + } + } + } + + return 0; +} + /* * Creates a client which has just connected to us on the given fd. * The sockhost field is initialized with the ip# of the host. @@ -885,10 +902,7 @@ char *getpeerip(Client *acptr, int fd, int *port) */ Client *add_connection(ConfigItem_listen *listener, int fd) { - Client *acptr, *acptr2; - ConfigItem_ban *bconf; - TKL *tk; - int i, j; + Client *acptr; char *ip; int port = 0; @@ -931,28 +945,17 @@ refuse_client: SetLocalhost(acptr); } - j = 1; - - if (!find_tkl_exception(TKL_CONNECT_FLOOD, acptr)) + /* Check set::max-unknown-connections-per-ip */ + if (check_too_many_unknown_connections(acptr)) { - list_for_each_entry(acptr2, &unknown_list, lclient_node) - { - if (!strcmp(acptr->ip,GetIP(acptr2))) - { - j++; - if (j > iConf.max_unknown_connections_per_ip) - { - ircsnprintf(zlinebuf, sizeof(zlinebuf), - "ERROR :Closing Link: [%s] (Too many unknown connections from your IP)" - "\r\n", - acptr->ip); - (void)send(fd, zlinebuf, strlen(zlinebuf), 0); - goto refuse_client; - } - } - } + ircsnprintf(zlinebuf, sizeof(zlinebuf), + "ERROR :Closing Link: [%s] (Too many unknown connections from your IP)\r\n", + acptr->ip); + (void)send(fd, zlinebuf, strlen(zlinebuf), 0); + goto refuse_client; } + /* Check (G)Z-Lines and set::anti-flood::connect-flood */ if (check_banned(acptr, NO_EXIT_CLIENT) < 0) goto refuse_client; @@ -1066,8 +1069,6 @@ void proceed_normal_client_handshake(Client *acptr, struct hostent *he) static int parse_client_queued(Client *cptr) { int dolen = 0; - int allow_read; - int done; time_t now = TStime(); char buf[READBUFSIZE]; @@ -1321,7 +1322,6 @@ int is_valid_ip(char *str) int connect_server(ConfigItem_link *aconf, Client *by, struct hostent *hp) { Client *cptr; - char *s; #ifdef DEBUGMODE sendto_realops("connect_server() called with aconf %p, refcount: %d, TEMP: %s", @@ -1422,11 +1422,8 @@ int connect_server(ConfigItem_link *aconf, Client *by, struct hostent *hp) int connect_inet(ConfigItem_link *aconf, Client *cptr) { - int len; - struct hostent *hp; char *bindip; char buf[BUFSIZE]; - int n; if (!aconf->connect_ip) return 0; /* handled upstream or shouldn't happen */ @@ -1524,7 +1521,6 @@ void ident_failed(Client *cptr) */ void start_auth(Client *cptr) { - int len; char buf[BUFSIZE]; /* If ident checking is disabled or it's an outgoing connect, then no ident check */ @@ -1590,7 +1586,6 @@ void start_auth(Client *cptr) static void send_authports(int fd, int revents, void *data) { char authbuf[32]; - int ulen, tlen; Client *cptr = data; Debug((DEBUG_NOTICE, "write_authports(%p) fd %d authfd %d stat %d", diff --git a/src/channel.c b/src/channel.c index 307de822f..d711903e4 100644 --- a/src/channel.c +++ b/src/channel.c @@ -29,7 +29,7 @@ long sajoinmode = 0; Channel *channel = NULL; /* some buffers for rebuilding channel/nick lists with comma's */ -static char nickbuf[BUFSIZE], buf[BUFSIZE]; +static char buf[BUFSIZE]; MODVAR char modebuf[BUFSIZE], parabuf[BUFSIZE]; /** This describes the letters, modes and options for core channel modes. @@ -623,7 +623,6 @@ long get_mode_bitbychar(char m) void channel_modes(Client *cptr, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, Channel *chptr) { CoreChannelModeTable *tab = &corechannelmodetable[0]; - char bcbuf[1024]; int ismember; int i; diff --git a/src/conf.c b/src/conf.c index 561107c4f..fbeb57fc7 100644 --- a/src/conf.c +++ b/src/conf.c @@ -170,16 +170,6 @@ static NameValue _LogFlags[] = { { LOG_TKL, "tkl" }, }; -/* This MUST be alphabetized */ -static NameValue ExceptTklFlags[] = { - { 0, "all" }, - { TKL_GLOBAL|TKL_KILL, "gline" }, - { TKL_GLOBAL|TKL_NAME, "gqline" }, - { TKL_GLOBAL|TKL_ZAP, "gzline" }, - { TKL_NAME, "qline" }, - { TKL_GLOBAL|TKL_SHUN, "shun" } -}; - /* This MUST be alphabetized */ static NameValue _TLSFlags[] = { { TLSFLAG_FAILIFNOCERT, "fail-if-no-clientcert" }, @@ -843,11 +833,10 @@ static ConfigFile *config_parse(char *filename, char *confdata) ConfigEntry **lastce; ConfigEntry *cursection; ConfigFile *curcf; - ConfigFile *lastcf; int preprocessor_level = 0; ConditionalConfig *cc, *cc_list = NULL; - lastcf = curcf = MyMallocEx(sizeof(ConfigFile)); + curcf = MyMallocEx(sizeof(ConfigFile)); curcf->cf_filename = strdup(filename); lastce = &(curcf->cf_entries); curce = NULL; @@ -1595,7 +1584,6 @@ ConfigItem_log *ca = MyMallocEx(sizeof(ConfigItem_log)); */ void postconf_defaults(void) { - char tmpbuf[512]; TKL *tk; char *encoded; @@ -2160,7 +2148,6 @@ void config_rehash() OperStat *os_ptr; ListStruct *next, *next2; SpamExcept *spamex_ptr; - int i; USE_BAN_VERSION = 0; @@ -2174,7 +2161,6 @@ void config_rehash() for (oper_ptr = conf_oper; oper_ptr; oper_ptr = (ConfigItem_oper *)next) { - ConfigItem_mask *oper_mask; SWhois *s, *s_next; next = (ListStruct *)oper_ptr->next; safefree(oper_ptr->name); @@ -2281,7 +2267,6 @@ void config_rehash() } for (vhost_ptr = conf_vhost; vhost_ptr; vhost_ptr = (ConfigItem_vhost *) next) { - ConfigItem_mask *vhost_mask; SWhois *s, *s_next; next = (ListStruct *)vhost_ptr->next; @@ -3637,10 +3622,11 @@ OperClassACLEntry* _conf_parseACLEntry(ConfigEntry *ce) OperClassACL* _conf_parseACL(char* name, ConfigEntry *ce) { ConfigEntry *cep; - ConfigEntry *cepp; OperClassACL *acl = NULL; + acl = MyMallocEx(sizeof(OperClassACL)); acl->name = strdup(name); + for (cep = ce->ce_entries; cep; cep = cep->ce_next) { if (!strcmp(cep->ce_varname, "deny") || !strcmp(cep->ce_varname, "allow")) @@ -3708,7 +3694,6 @@ int _test_operclass(ConfigFile *conf, ConfigEntry *ce) { char has_permissions = 0, has_parent = 0; ConfigEntry *cep; - NameValue *ofp; int errors = 0; if (!ce->ce_vardata) @@ -3846,14 +3831,11 @@ int _conf_oper(ConfigFile *conf, ConfigEntry *ce) int _test_oper(ConfigFile *conf, ConfigEntry *ce) { - char has_class = 0, has_password = 0, has_swhois = 0, has_snomask = 0; + char has_class = 0, has_password = 0, has_snomask = 0; char has_modes = 0, has_require_modes = 0, has_mask = 0, has_maxlogins = 0; char has_operclass = 0, has_vhost = 0; - int oper_flags = 0; ConfigEntry *cep; - ConfigEntry *cepp; - NameValue *ofp; - int errors = 0; + int errors = 0; if (!ce->ce_vardata) { @@ -4422,12 +4404,8 @@ int _conf_ulines(ConfigFile *conf, ConfigEntry *ce) int _test_ulines(ConfigFile *conf, ConfigEntry *ce) { - ConfigEntry *cep; - int errors = 0; - /* No check needed */ - - return errors; + return 0; } int _conf_tld(ConfigFile *conf, ConfigEntry *ce) @@ -5557,7 +5535,6 @@ int _test_except(ConfigFile *conf, ConfigEntry *ce) int _conf_vhost(ConfigFile *conf, ConfigEntry *ce) { ConfigItem_vhost *vhost; - ConfigItem_mask *mask; ConfigEntry *cep, *cepp; vhost = MyMallocEx(sizeof(ConfigItem_vhost)); @@ -5614,7 +5591,7 @@ int _test_vhost(ConfigFile *conf, ConfigEntry *ce) { int errors = 0; ConfigEntry *cep; - char has_vhost = 0, has_login = 0, has_password = 0, has_swhois = 0, has_mask = 0; + char has_vhost = 0, has_login = 0, has_password = 0, has_mask = 0; for (cep = ce->ce_entries; cep; cep = cep->ce_next) { @@ -5706,8 +5683,6 @@ int _test_vhost(ConfigFile *conf, ConfigEntry *ce) } else if (!strcmp(cep->ce_varname, "from")) { - ConfigEntry *cepp; - config_error("%s:%i: vhost::from::userhost is now called oper::mask", cep->ce_fileptr->cf_filename, cep->ce_varlinenum); errors++; @@ -5761,7 +5736,7 @@ int _test_vhost(ConfigFile *conf, ConfigEntry *ce) int _test_sni(ConfigFile *conf, ConfigEntry *ce) { int errors = 0; - ConfigEntry *cep, *tlsconfig = NULL; + ConfigEntry *cep; if (!ce->ce_vardata) { @@ -6106,7 +6081,6 @@ int config_detect_duplicate(int *var, ConfigEntry *ce, int *errors) int _test_link(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp, *ceppp; - NameValue *ofp; int errors = 0; int has_incoming = 0, has_incoming_mask = 0, has_outgoing = 0; @@ -6593,8 +6567,7 @@ int _test_require(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; int errors = 0; Hook *h; - char type = 0; - char has_mask = 0, has_action = 0, has_reason = 0; + char has_mask = 0, has_reason = 0; if (!ce->ce_vardata) { @@ -7574,7 +7547,6 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) int _test_set(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp, *ceppp; - long templong; int tempi; int errors = 0; Hook *h; @@ -7626,7 +7598,7 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) cep->ce_fileptr->cf_filename, cep->ce_varlinenum, *p); errors++; } - templong = (long) set_usermode(cep->ce_vardata); + set_usermode(cep->ce_vardata); } else if (!strcmp(cep->ce_varname, "modes-on-join")) { char *c; @@ -7676,14 +7648,13 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) cep->ce_fileptr->cf_filename, cep->ce_varlinenum, *p); errors++; } - templong = (long) set_usermode(cep->ce_vardata); + set_usermode(cep->ce_vardata); } else if (!strcmp(cep->ce_varname, "snomask-on-oper")) { CheckNull(cep); CheckDuplicate(cep, snomask_on_oper, "snomask-on-oper"); } else if (!strcmp(cep->ce_varname, "level-on-join")) { - char *p; CheckNull(cep); CheckDuplicate(cep, level_on_join, "level-on-join"); if (!channellevel_to_int(cep->ce_vardata)) diff --git a/src/conf_preprocessor.c b/src/conf_preprocessor.c index 88312438b..b75d19c39 100644 --- a/src/conf_preprocessor.c +++ b/src/conf_preprocessor.c @@ -225,7 +225,7 @@ int evaluate_preprocessor_define(char *statement, char *filename, int linenumber int parse_preprocessor_item(char *start, char *end, char *filename, int linenumber, ConditionalConfig **cc) { char buf[512]; - int n, max; + int max; *cc = NULL; @@ -458,7 +458,6 @@ char *get_config_define(char *name) void preprocessor_replace_defines(char **item) { - NameValueList *e; static char buf[4096]; char varname[512]; const char *i, *varstart, *varend; diff --git a/src/crashreport.c b/src/crashreport.c index 9d44fdcf1..0e092cd87 100644 --- a/src/crashreport.c +++ b/src/crashreport.c @@ -223,10 +223,6 @@ int crash_report_backtrace(FILE *reportfd, char *coredump) fprintf(reportfd, "START OF BACKTRACE\n"); while((fgets(buf, sizeof(buf), fd))) { - char *file, *path; - char target[512]; - char **arr; - stripcrlf(buf); fprintf(reportfd, " %s\n", buf); } @@ -256,7 +252,6 @@ int crash_report_backtrace(FILE *reportfd, char *coredump) void crash_report_header(FILE *reportfd, char *coredump) { - char buf[512]; time_t t; fprintf(reportfd, "== UNREALIRCD CRASH REPORT ==\n" @@ -488,7 +483,6 @@ int running_interactive(void) int getfilesize(char *fname) { struct stat st; - int size; if (stat(fname, &st) != 0) return -1; @@ -501,7 +495,6 @@ int getfilesize(char *fname) SSL_CTX *crashreport_init_ssl(void) { SSL_CTX *ctx_client; - X509_VERIFY_PARAM *param = NULL; char buf[512]; SSL_load_error_strings(); diff --git a/src/dbuf.c b/src/dbuf.c index 76e161593..62cb40f45 100644 --- a/src/dbuf.c +++ b/src/dbuf.c @@ -95,8 +95,6 @@ void dbuf_put(dbuf *dyn, char *buf, size_t length) void dbuf_delete(dbuf *dyn, size_t length) { struct dbufbuf *block; - dbufbuf *d; - int chunk; assert(dyn->length >= length); if (length == 0) diff --git a/src/dispatch.c b/src/dispatch.c index 523b82495..eac359900 100644 --- a/src/dispatch.c +++ b/src/dispatch.c @@ -436,7 +436,6 @@ void fd_refresh(int fd) struct epoll_event ep_event; FDEntry *fde = &fd_table[fd]; unsigned int pflags = 0; - unsigned int i; int op = -1; if (epoll_fd == -1) diff --git a/src/dns.c b/src/dns.c index f1004004b..d82dd64de 100644 --- a/src/dns.c +++ b/src/dns.c @@ -122,7 +122,7 @@ static Event *unrealdns_timeout_hdl = NULL; void init_resolver(int firsttime) { struct ares_options options; - int n, v, k; + int n; int optmask; if (requests) @@ -202,7 +202,6 @@ void unrealdns_addreqtolist(DNSReq *r) struct hostent *unrealdns_doclient(Client *cptr) { DNSReq *r; - static struct hostent *he; char *cache_name; cache_name = unrealdns_findcache_ip(cptr->ip); @@ -312,7 +311,6 @@ void unrealdns_cb_nametoip_verify(void *arg, int status, int timeouts, struct ho char ipv6 = r->ipv6; int i; struct hostent *he2; - uint32_t ipv4_addr = 0; if (!acptr) goto bad; @@ -447,7 +445,7 @@ static uint64_t unrealdns_hash_ip(const char *ip) static void unrealdns_addtocache(char *name, char *ip) { unsigned int hashv; - DNSCache *c, *n; + DNSCache *c; dnsstats.cache_adds++; diff --git a/src/extra.c b/src/extra.c index 0ab880cd9..ab2ffe8cd 100644 --- a/src/extra.c +++ b/src/extra.c @@ -243,7 +243,7 @@ void ircd_log(int flags, FORMAT_STRING(const char *format), ...) ConfigItem_log *logs; char buf[2048], timebuf[128]; struct stat fstats; - int written = 0, write_failure = 0; + int written = 0; int n; /* Trap infinite recursions to avoid crash if log file is unavailable, @@ -324,7 +324,6 @@ void ircd_log(int flags, FORMAT_STRING(const char *format), ...) last_log_file_warning = TStime(); } } - write_failure = 1; continue; } } @@ -353,8 +352,6 @@ void ircd_log(int flags, FORMAT_STRING(const char *format), ...) last_log_file_warning = TStime(); } } - - write_failure = 1; } } } diff --git a/src/fdlist.c b/src/fdlist.c index d8c3549cd..1efe7cd95 100644 --- a/src/fdlist.c +++ b/src/fdlist.c @@ -59,7 +59,6 @@ int fd_open(int fd, const char *desc) int fd_fileopen(const char *path, unsigned int flags) { - FDEntry *fde; int fd; char comment[FD_DESC_SZ]; char pathbuf[BUFSIZE]; @@ -119,9 +118,6 @@ int fd_unmap(int fd) void fd_close(int fd) { - FDEntry *fde; - unsigned int befl; - if (!fd_unmap(fd)) return; diff --git a/src/ircd.c b/src/ircd.c index 6e7cedb07..86f413587 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -787,7 +787,6 @@ static void generate_cloakkeys() int keyNum; int keyLen; int charIndex; - int value; short has_upper; short has_lower; @@ -849,9 +848,6 @@ int InitUnrealIRCd(int argc, char *argv[]) #else uid_t uid, euid; gid_t gid, egid; - time_t delay = 0; - struct passwd *pw; - struct group *gr; #endif #ifdef HAVE_PSTAT union pstun pstats; diff --git a/src/list.c b/src/list.c index 945d0dda2..8dd9dbdfa 100644 --- a/src/list.c +++ b/src/list.c @@ -30,7 +30,7 @@ ID_Notes("2.24 4/20/94"); #ifdef DEBUGMODE static struct liststats { int inuse; -} cloc, crem, users, servs, links, classs, aconfs; +} cloc, crem, users, servs, links; #endif @@ -56,7 +56,6 @@ void initlists(void) memset(&users, 0, sizeof(users)); memset(&servs, 0, sizeof(servs)); memset(&links, 0, sizeof(links)); - memset(&classs, 0, sizeof(classs)); #endif INIT_LIST_HEAD(&client_list); diff --git a/src/match.c b/src/match.c index 4d76c9175..8a19a5dbe 100644 --- a/src/match.c +++ b/src/match.c @@ -744,8 +744,8 @@ char *stripbadwords(char *str, ConfigItem_badword *start_bw, int *blocked) */ char *badword_config_check_regex(char *str, int fastsupport, int check_broadness) { - int errorcode, errorbufsize, regex=0; - char *errtmp, *tmp; + int regex=0; + char *tmp; static char errorbuf[512]; if (fastsupport) @@ -790,7 +790,6 @@ int badword_config_process(ConfigItem_badword *ca, char *str) { char *tmp; short regex = 0; - int regflags = 0; int ast_l = 0, ast_r = 0; /* The fast badwords routine can do: "blah" "*blah" "blah*" and "*blah*", @@ -815,7 +814,6 @@ int badword_config_process(ConfigItem_badword *ca, char *str) int errorcode = 0; PCRE2_SIZE erroroffset = 0; int options = 0; - char buf2[512]; ca->type = BADW_TYPE_REGEX; safestrdup(ca->word, str); diff --git a/src/mempool.c b/src/mempool.c index 7272e6828..1ff04a7c0 100644 --- a/src/mempool.c +++ b/src/mempool.c @@ -571,8 +571,7 @@ mp_pool_clean(mp_pool_t *pool, int n_to_keep, int keep_recently_used) } /** Helper: Given a list of chunks, free all the chunks in the list. */ -static void -destroy_chunks(mp_chunk_t *chunk) +static void destroy_chunks(mp_chunk_t *chunk) { mp_chunk_t *next; diff --git a/src/modules/antirandom.c b/src/modules/antirandom.c index ae423f13b..e7eff93f3 100644 --- a/src/modules/antirandom.c +++ b/src/modules/antirandom.c @@ -868,8 +868,6 @@ static int internal_getscore(char *str) void strtolower_safe(char *dst, char *src, int size) { - int i; - if (!size) return; /* size of 0 is unworkable */ size--; /* for \0 */ @@ -929,7 +927,7 @@ static int get_spam_score(Client *sptr) void check_all_users(void) { Client *acptr; - int i, matches=0, score; + int matches=0, score; list_for_each_entry(acptr, &lclient_list, lclient_node) { diff --git a/src/modules/blacklist.c b/src/modules/blacklist.c index 434c5f298..0fa5e3ea4 100644 --- a/src/modules/blacklist.c +++ b/src/modules/blacklist.c @@ -244,7 +244,6 @@ int blacklist_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) int errors = 0; char has_reason = 0, has_ban_time = 0, has_action = 0; char has_dns_type = 0, has_dns_reply = 0, has_dns_name = 0; - DNSBLType blacklist_type = 0; if (type != CONFIG_MAIN) return 0; @@ -344,9 +343,9 @@ int blacklist_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) } has_dns_type = 1; if (!strcmp(cepp->ce_vardata, "record")) - blacklist_type = DNSBL_RECORD; + ; else if (!strcmp(cepp->ce_vardata, "bitmask")) - blacklist_type = DNSBL_BITMASK; + ; else { config_error("%s:%i: unknown blacklist::dns::type '%s', must be either 'record' or 'bitmask'", @@ -604,8 +603,8 @@ int blacklist_dns_request(Client *cptr, Blacklist *d) } else if (strchr(ip, ':')) { - int i, j; /* IPv6 */ + int i; BLUSER(cptr)->is_ipv6 = 1; if (sscanf(ip, "%x:%x:%x:%x:%x:%x:%x:%x", &e[0], &e[1], &e[2], &e[3], &e[4], &e[5], &e[6], &e[7]) != 8) diff --git a/src/modules/cap.c b/src/modules/cap.c index d9bd56bbb..3fb9870de 100644 --- a/src/modules/cap.c +++ b/src/modules/cap.c @@ -175,7 +175,6 @@ static void clicap_generate(Client *sptr, const char *subcmd, int flags) char *p; int buflen = 0; int curlen, mlen; - size_t i; mlen = snprintf(buf, BUFSIZE, ":%s CAP %s %s", me.name, BadPtr(sptr->name) ? "*" : sptr->name, subcmd); diff --git a/src/modules/channeldb.c b/src/modules/channeldb.c index 9e87331f6..0d4d842ed 100644 --- a/src/modules/channeldb.c +++ b/src/modules/channeldb.c @@ -41,7 +41,7 @@ ModuleHeader MOD_HEADER(channeldb) = { } \ } while(0) -// Forward declarations +/* Forward declarations */ void channeldb_moddata_free(ModData *md); void setcfg(void); void freecfg(void); @@ -53,8 +53,7 @@ int write_channel_entry(FILE *fd, const char *tmpfname, Channel *chptr); int read_channeldb(void); static void set_channel_mode(Channel *chptr, char *modes, char *parameters); -// Globals -static ModDataInfo *channeldb_md; +/* Global variables */ static uint32_t channeldb_version = CHANNELDB_VERSION; struct cfgstruct { char *database; @@ -192,7 +191,6 @@ int write_channeldb(void) { char tmpfname[512]; FILE *fd; - int index, index2; Channel *chptr; int cnt = 0; #ifdef BENCHMARK diff --git a/src/modules/charsys.c b/src/modules/charsys.c index 844632e2b..e87b2bd5d 100644 --- a/src/modules/charsys.c +++ b/src/modules/charsys.c @@ -376,8 +376,7 @@ static inline void ilang_swap(ILangList *one, ILangList *two) static void ilang_sort(void) { -ILangList *outer, *inner; -char *tmp; + ILangList *outer, *inner; /* Selection sort -- perhaps optimize to qsort/whatever if * possible? ;) @@ -394,7 +393,7 @@ char *tmp; void charsys_finish(void) { -ILangList *e, *e_next; + ILangList *e, *e_next; /* Sort alphabetically */ ilang_sort(); @@ -495,7 +494,7 @@ char *ch; static int isvalidmbyte(unsigned char c1, unsigned char c2) { -MBList *m; + MBList *m; for (m=mblist; m; m=m->next) { @@ -512,10 +511,9 @@ MBList *m; */ static int do_nick_name_multibyte(char *nick) { -int len; -char *ch; -MBList *m; -int firstmbchar = 0; + int len; + char *ch; + int firstmbchar = 0; if ((*nick == '-') || isdigit(*nick)) return 0; @@ -1124,8 +1122,10 @@ void charsys_add_language(char *name) /** This displays all the nick characters that are permitted */ char *charsys_displaychars(void) { +#if 0 MBList *m; unsigned char hibyte, lobyte; +#endif static char buf[512]; int n = 0; int i, j; diff --git a/src/modules/close.c b/src/modules/close.c index 70ff0ea73..469ffdc66 100644 --- a/src/modules/close.c +++ b/src/modules/close.c @@ -58,7 +58,6 @@ MOD_UNLOAD(close) CMD_FUNC(m_close) { Client *acptr, *acptr2; - int i; int closed = 0; if (!ValidatePermissionsForPath("server:close",sptr,NULL,NULL,NULL)) diff --git a/src/modules/echo-message.c b/src/modules/echo-message.c index 724519a95..de7b01f85 100644 --- a/src/modules/echo-message.c +++ b/src/modules/echo-message.c @@ -41,14 +41,12 @@ int em_usermsg(Client *sptr, Client *to, MessageTag *mtags, char *text, int noti MOD_INIT(echo_message) { ClientCapabilityInfo cap; - ClientCapability *c; - MessageTagHandlerInfo mtag; MARK_AS_OFFICIAL_MODULE(modinfo); memset(&cap, 0, sizeof(cap)); cap.name = "echo-message"; - c = ClientCapabilityAdd(modinfo->handle, &cap, &CAP_ECHO_MESSAGE); + ClientCapabilityAdd(modinfo->handle, &cap, &CAP_ECHO_MESSAGE); HookAdd(modinfo->handle, HOOKTYPE_CHANMSG, 0, em_chanmsg); HookAdd(modinfo->handle, HOOKTYPE_USERMSG, 0, em_usermsg); diff --git a/src/modules/help.c b/src/modules/help.c index b0b40ced0..96fa23517 100644 --- a/src/modules/help.c +++ b/src/modules/help.c @@ -132,8 +132,7 @@ int parse_help(Client *sptr, char *name, char *help) */ CMD_FUNC(m_help) { - char *helptopic, *s; - Link *tmpl; + char *helptopic; if (!MyUser(sptr)) return 0; /* never remote */ diff --git a/src/modules/hideserver.c b/src/modules/hideserver.c index ec5bdf347..d305131ac 100644 --- a/src/modules/hideserver.c +++ b/src/modules/hideserver.c @@ -113,8 +113,8 @@ MOD_UNLOAD(hideserver) static int cb_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) { - ConfigEntry *cep, *cepp; - int errors = 0; + ConfigEntry *cep; + int errors = 0; if (type == CONFIG_MAIN) { diff --git a/src/modules/history_backend_mem.c b/src/modules/history_backend_mem.c index aea5a676c..ac454f820 100644 --- a/src/modules/history_backend_mem.c +++ b/src/modules/history_backend_mem.c @@ -236,8 +236,6 @@ int can_receive_history(Client *acptr) void hbm_send_line(Client *acptr, HistoryLogLine *l, char *batchid) { - static char sendbuf[8192]; - if (can_receive_history(acptr)) { if (BadPtr(batchid)) diff --git a/src/modules/join.c b/src/modules/join.c index 75d736d4f..3e8010724 100644 --- a/src/modules/join.c +++ b/src/modules/join.c @@ -237,8 +237,6 @@ void _join_channel(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_ { MessageTag *mtags = NULL; /** Message tags to send to local users (sender is :user) */ MessageTag *mtags_sjoin = NULL; /* Message tags to send to remote servers for SJOIN (sender is :me.name) */ - Hook *h; - int i = 0; char *parv[] = { 0, 0 }; /* Same way as in SJOIN */ @@ -692,10 +690,8 @@ void _userhost_save_current(Client *sptr) void _userhost_changed(Client *sptr) { Membership *channels; - Channel *chptr; Member *lp; Client *acptr; - int i = 0; int impact = 0; char buf[512]; long CAP_EXTENDED_JOIN = ClientCapabilityBit("extended-join"); diff --git a/src/modules/jointhrottle.c b/src/modules/jointhrottle.c index d54e68628..db68b864c 100644 --- a/src/modules/jointhrottle.c +++ b/src/modules/jointhrottle.c @@ -180,8 +180,6 @@ static int isjthrottled(Client *cptr, Channel *chptr) static void jointhrottle_increase_usercounter(Client *cptr, Channel *chptr) { JoinFlood *e; - int num = cfg.num; - int t = cfg.t; if (!MyUser(cptr)) return; @@ -198,7 +196,7 @@ static void jointhrottle_increase_usercounter(Client *cptr, Channel *chptr) e->firstjoin = TStime(); e->numjoins = 1; } else - if ((TStime() - e->firstjoin) < t) /* still valid? */ + if ((TStime() - e->firstjoin) < cfg.t) /* still valid? */ { e->numjoins++; } else { @@ -257,9 +255,7 @@ JoinFlood *jointhrottle_addentry(Client *cptr, Channel *chptr) EVENT(jointhrottle_cleanup_structs) { Client *acptr; - Channel *chptr; JoinFlood *jf, *jf_next; - int t = cfg.t; list_for_each_entry(acptr, &lclient_list, lclient_node) { @@ -270,15 +266,11 @@ EVENT(jointhrottle_cleanup_structs) { jf_next = jf->next; - chptr = find_channel(jf->chname, NULL); - /* Now check if chptr is valid and if a flood still applies, if so we skip, - * in all other cases we free the (no longer useful) entry. - */ - if (jf->firstjoin + t > TStime()) + if (jf->firstjoin + cfg.t > TStime()) continue; /* still valid entry */ #ifdef DEBUGMODE ircd_log(LOG_ERROR, "jointhrottle_cleanup_structs(): freeing %s/%s (%ld[%ld], %d)", - acptr->name, jf->chname, jf->firstjoin, (long)(TStime() - jf->firstjoin), t); + acptr->name, jf->chname, jf->firstjoin, (long)(TStime() - jf->firstjoin), cfg.t); #endif if (moddata_client(acptr, jointhrottle_md).ptr == jf) { diff --git a/src/modules/jumpserver.c b/src/modules/jumpserver.c index f0629d8a5..d24f9fc32 100644 --- a/src/modules/jumpserver.c +++ b/src/modules/jumpserver.c @@ -80,7 +80,7 @@ static int do_jumpserver_exit_client(Client *sptr) static void redirect_all_clients(void) { - int i, count = 0; + int count = 0; Client *acptr, *saved; list_for_each_entry_safe(acptr, saved, &lclient_list, lclient_node) @@ -121,7 +121,7 @@ void jumpserver_free_jss(ModData *m) CMD_FUNC(m_jumpserver) { - char *serv, *sslserv=NULL, *reason, *p, *p2; + char *serv, *sslserv=NULL, *reason, *p; int all=0, port=6667, sslport=6697; char logbuf[512]; diff --git a/src/modules/kill.c b/src/modules/kill.c index 1115f589d..fca2174b0 100644 --- a/src/modules/kill.c +++ b/src/modules/kill.c @@ -68,7 +68,7 @@ CMD_FUNC(m_kill) char inpath[HOSTLEN * 2 + USERLEN + 5]; char *oinpath = get_client_name(cptr, FALSE); char *user, *path, *killer, *nick, *p, *s; - int chasing = 0, kcount = 0; + int kcount = 0; Hook *h; int ntargets = 0, n; int maxtargets = max_targets_for_command("KILL"); diff --git a/src/modules/labeled-response.c b/src/modules/labeled-response.c index d9af58bac..c9bb7a8a2 100644 --- a/src/modules/labeled-response.c +++ b/src/modules/labeled-response.c @@ -211,7 +211,6 @@ char *skip_tags(char *msg) int lr_packet(Client *from, Client *to, Client *intended_to, char **msg, int *len) { static char packet[8192]; - char buf[512]; if (currentcmd.client && !labeled_response_inhibit) { diff --git a/src/modules/message-ids.c b/src/modules/message-ids.c index 08399d78f..98fa4ed26 100644 --- a/src/modules/message-ids.c +++ b/src/modules/message-ids.c @@ -47,8 +47,6 @@ void mtag_add_or_inherit_msgid(Client *sender, MessageTag *recv_mtags, MessageTa MOD_INIT(message-ids) { - ClientCapabilityInfo cap; - ClientCapability *c; MessageTagHandlerInfo mtag; MARK_AS_OFFICIAL_MODULE(modinfo); diff --git a/src/modules/message.c b/src/modules/message.c index 10f3be872..91662026e 100644 --- a/src/modules/message.c +++ b/src/modules/message.c @@ -163,11 +163,9 @@ int ret; */ int m_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], int notice) { - Client *acptr, *srvptr; - char *s; + Client *acptr; Channel *chptr; - char *nick, *server, *p, *p2, *pc, *text, *errmsg, *newcmd; - int cansend = 0; + char *nick, *p, *p2, *pc, *text, *errmsg, *newcmd; int prefix = 0; char pfixchan[CHANNELLEN + 4]; int ret; diff --git a/src/modules/mode.c b/src/modules/mode.c index c34a6c53d..15327d52b 100644 --- a/src/modules/mode.c +++ b/src/modules/mode.c @@ -312,10 +312,8 @@ unsigned short modesleft = MAXMODEPARAMS * 2; /* be generous... */ */ static void mode_cutoff2(Client *sptr, Channel *chptr, int *parc_out, char *parv[]) { -int modes = 0; -char *s; -int len, i; -int parc = *parc_out; + int len, i; + int parc = *parc_out; if (parc-2 <= 3) return; /* Less than 3 mode parameters? Then we don't even have to check */ @@ -746,9 +744,6 @@ int do_mode_char(Channel *chptr, long modetype, char modechar, char *param, char tmpbuf[512], *tmpstr; char tc = ' '; /* */ int chasing = 0, x; - int xxi, xyi, xzi, hascolon; - char *xp; - int notsecure; Hook *h; if ((my_access & CHFL_HALFOP) && !is_xchanop(my_access) && !IsULine(cptr) && diff --git a/src/modules/names.c b/src/modules/names.c index 090cb0989..0eb827411 100644 --- a/src/modules/names.c +++ b/src/modules/names.c @@ -73,8 +73,6 @@ CMD_FUNC(m_names) Channel *chptr; Client *acptr; int member; - int i = 0; - Hook *h; Member *cm; int idx, flag = 1, spos; char *s, *para = parv[1]; diff --git a/src/modules/nick.c b/src/modules/nick.c index 119304e6f..0e378c104 100644 --- a/src/modules/nick.c +++ b/src/modules/nick.c @@ -88,7 +88,6 @@ void nick_collision(Client *cptr, char *newnick, char *newid, Client *new, Clien { char comment[512]; char *new_server, *existing_server; - char reintroduce_existing_user = 0; ircd_log(LOG_ERROR, "Nick collision: %s[%s]@%s (new) vs %s[%s]@%s (existing). Winner: %s. Type: %s", newnick, newid ? newid : "", cptr->name, @@ -265,11 +264,9 @@ CMD_FUNC(m_uid) int ishold; Client *acptr, *serv = NULL; Client *acptrs; - char nick[NICKLEN + 2], *s, descbuf[BUFSIZE]; - Membership *mp; + char nick[NICKLEN + 2]; long lastnick = 0l; - int differ = 1, update_watch = 1; - unsigned char removemoder = 1; + int differ = 1; if (parc < 13) { @@ -571,7 +568,7 @@ CMD_FUNC(m_nick) int ishold; Client *acptr, *serv = NULL; Client *acptrs; - char nick[NICKLEN + 2], *s, descbuf[BUFSIZE]; + char nick[NICKLEN + 2], descbuf[BUFSIZE]; Membership *mp; long lastnick = 0l; int differ = 1, update_watch = 1; @@ -1187,14 +1184,12 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char { ConfigItem_ban *bconf; char *tmpstr; - const char *id; char stripuser[USERLEN + 1], *u1 = stripuser, *u2, olduser[USERLEN + 1], userbad[USERLEN * 2 + 1], *ubad = userbad, noident = 0; int xx; ClientUser *user = sptr->user; Client *nsptr; int i; - char mo[256]; char *tkllayer[9] = { me.name, /*0 server.name */ "+", /*1 +|- */ @@ -1687,11 +1682,10 @@ int check_client(Client *cptr, char *username) * @returns Must return 0 if user is permitted. If the client should be rejected then * use return exit_client(...) */ -int AllowClient(Client *cptr, struct hostent *hp, char *sockhost, char *username) +int AllowClient(Client *cptr, struct hostent *hp, char *sockhost, char *username) { ConfigItem_allow *aconf; char *hname; - int i, ii = 0; static char uhost[HOSTLEN + USERLEN + 3]; static char fullname[HOSTLEN + 1]; @@ -1782,14 +1776,14 @@ int AllowClient(Client *cptr, struct hostent *hp, char *sockhost, char *username if (aconf->maxperip) { Client *acptr, *acptr2; + int cnt = 1; - ii = 1; list_for_each_entry_safe(acptr, acptr2, &lclient_list, lclient_node) { if (!strcmp(GetIP(acptr), GetIP(cptr))) { - ii++; - if (ii > aconf->maxperip) + cnt++; + if (cnt > aconf->maxperip) { /* Already got too many with that ip# */ return exit_client(cptr, cptr, &me, NULL, iConf.reject_message_too_many_connections); diff --git a/src/modules/part.c b/src/modules/part.c index 953886b92..bdddf6491 100644 --- a/src/modules/part.c +++ b/src/modules/part.c @@ -65,7 +65,6 @@ CMD_FUNC(m_part) char *commentx = (parc > 2 && parv[2]) ? parv[2] : NULL; char *comment; int n; - Hook *h; int ntargets = 0; int maxtargets = max_targets_for_command("PART"); diff --git a/src/modules/pass.c b/src/modules/pass.c index 8f1087083..bb892de50 100644 --- a/src/modules/pass.c +++ b/src/modules/pass.c @@ -69,7 +69,6 @@ MOD_UNLOAD(pass) int _check_banned(Client *cptr, int exitflags) { TKL *tk; - ConfigItem_ban *bconf; if ((tk = find_tkline_match_zap(cptr))) { diff --git a/src/modules/quit.c b/src/modules/quit.c index c76b9a6fd..63c84869c 100644 --- a/src/modules/quit.c +++ b/src/modules/quit.c @@ -69,7 +69,6 @@ CMD_FUNC(m_quit) { int n; Hook *tmphook; - Membership *lp, *lp_next; if (STATIC_QUIT) return exit_client(cptr, sptr, sptr, recv_mtags, STATIC_QUIT); @@ -91,7 +90,7 @@ CMD_FUNC(m_quit) if (iConf.part_instead_of_quit_on_comment_change && MyUser(sptr)) { - Membership *lp; + Membership *lp, *lp_next; char *newcomment; Channel *chptr; diff --git a/src/modules/reputation.c b/src/modules/reputation.c index f55b61ec5..98dbdc8aa 100644 --- a/src/modules/reputation.c +++ b/src/modules/reputation.c @@ -386,7 +386,6 @@ void save_db(void) { FILE *fd; char tmpfname[512]; - char buf[512], *p; int i; ReputationEntry *e; #ifdef BENCHMARK @@ -763,7 +762,6 @@ CMD_FUNC(reputation_server_cmd) ReputationEntry *e; char *ip; int score; - long since; int allow_reply; /* :server REPUTATION */ diff --git a/src/modules/rmtkl.c b/src/modules/rmtkl.c index 3163a43e0..f908b72ad 100644 --- a/src/modules/rmtkl.c +++ b/src/modules/rmtkl.c @@ -136,9 +136,6 @@ void rmtkl_check_options(char *param, int *skipperm, int *silent) { int rmtkl_tryremove(Client *sptr, Client *cptr, TKLType *tkltype, TKL *tkl, char *uhmask, char *commentmask, int skipperm, int silent) { - char *timeret; - char gmt[256]; - if (tkl->type != tkltype->type) return 0; diff --git a/src/modules/sapart.c b/src/modules/sapart.c index c628e8552..88b89a53e 100644 --- a/src/modules/sapart.c +++ b/src/modules/sapart.c @@ -63,7 +63,6 @@ MOD_UNLOAD(sapart) CMD_FUNC(m_sapart) { - MessageTag *mtags = NULL; Client *acptr; Channel *chptr; Membership *lp; diff --git a/src/modules/server.c b/src/modules/server.c index 7aa6f7391..c2cccf581 100644 --- a/src/modules/server.c +++ b/src/modules/server.c @@ -476,7 +476,6 @@ CMD_FUNC(m_server) /* char *password = NULL; */ char *ch = NULL; /* */ char descbuf[BUFSIZE]; - char *inpath = get_client_name(cptr, TRUE); int hop = 0; char info[REALLEN + 61]; ConfigItem_link *aconf = NULL; @@ -544,7 +543,6 @@ CMD_FUNC(m_server) */ if (IsUnknown(cptr) || IsHandshake(cptr)) { - char xerrmsg[256]; int ret; ret = verify_link(cptr, sptr, servername, &aconf); if (ret < 0) @@ -618,7 +616,7 @@ CMD_FUNC(m_server) CMD_FUNC(m_server_remote) { - Client *acptr, *ocptr, *bcptr; + Client *acptr, *ocptr; ConfigItem_link *aconf; ConfigItem_ban *bconf; int hop; @@ -893,7 +891,6 @@ int m_server_synch(Client *cptr, ConfigItem_link *aconf) { char *inpath = get_client_name(cptr, TRUE); Client *acptr; - char buf[BUFSIZE]; int incoming = IsUnknown(cptr) ? 1 : 0; ircd_log(LOG_SERVER, "SERVER %s", cptr->name); @@ -1067,8 +1064,6 @@ int m_server_synch(Client *cptr, ConfigItem_link *aconf) Channel *chptr; for (chptr = channel; chptr; chptr = chptr->nextch) { - ModDataInfo *mdi; - if (!SupportSJOIN(cptr)) send_channel_modes(cptr, chptr); else if (SupportSJOIN(cptr) && !SupportSJ3(cptr)) @@ -1512,7 +1507,6 @@ void send_channel_modes_sjoin3(Client *cptr, Channel *chptr) Member *members; Member *lp; Ban *ban; - char *name; short nomode, nopara; char tbuf[512]; /* work buffer, for temporary data */ char buf[1024]; /* send buffer */ diff --git a/src/modules/sjoin.c b/src/modules/sjoin.c index e0d8af844..425965c3c 100644 --- a/src/modules/sjoin.c +++ b/src/modules/sjoin.c @@ -140,7 +140,6 @@ CMD_FUNC(m_sjoin) unsigned short merge; /**< same timestamp: merge their & our modes */ char pvar[MAXMODEPARAMS][MODEBUFLEN + 3]; char cbuf[1024]; - char buf[1024]; char nick[1024]; /**< nick or ban/invex/exempt being processed */ char scratch_buf[1024]; /**< scratch buffer */ char prefix[16]; /**< prefix of nick for server to server traffic (eg: @) */ @@ -154,8 +153,8 @@ CMD_FUNC(m_sjoin) int pcount, i; Hook *h; time_t ts, oldts; - unsigned short b=0, c; - char *t, *bp, *tp, *p, *saved = NULL; + unsigned short b=0; + char *tp, *p, *saved = NULL; long modeflags; char queue_s=0, queue_c=0; /* oh this is soooooo ugly :p */ @@ -356,10 +355,7 @@ CMD_FUNC(m_sjoin) parabuf[0] = 0; modebuf[0] = '+'; modebuf[1] = '\0'; - t = parv[parc - 1]; b = 1; - c = 0; - bp = buf; strlcpy(cbuf, parv[parc-1], sizeof cbuf); sj3_parabuf[0] = '\0'; @@ -387,7 +383,6 @@ CMD_FUNC(m_sjoin) time_t setat = TStime(); /**< Set at timestamp */ int sjsby_info = 0; /**< Set to 1 if we receive SJSBY info to alter the above 2 vars */ - c = 0; modeflags = 0; i = 0; tp = s; diff --git a/src/modules/stats.c b/src/modules/stats.c index 4a18a4357..10d7bb2e0 100644 --- a/src/modules/stats.c +++ b/src/modules/stats.c @@ -556,7 +556,6 @@ static char *stats_port_helper(ConfigItem_listen *listener) int stats_port(Client *sptr, char *para) { - int i; ConfigItem_listen *listener; for (listener = conf_listen; listener != NULL; listener = listener->next) @@ -594,7 +593,6 @@ int stats_usage(Client *sptr, char *para) int stats_traffic(Client *sptr, char *para) { Client *acptr; - int i; struct stats *sp; struct stats tmp; time_t now = TStime(); @@ -950,8 +948,6 @@ int stats_denydcc(Client *sptr, char *para) int stats_kline(Client *sptr, char *para) { - ConfigItem_except *excepts; - tkl_stats(sptr, TKL_KILL, NULL); tkl_stats(sptr, TKL_ZAP, NULL); return 0; @@ -1230,7 +1226,6 @@ int stats_linkinfoint(Client *sptr, char *para, int all) int wilds = 0; int doall = 0; int showports = ValidatePermissionsForPath("server:info:stats",sptr,NULL,NULL,NULL); - int i; Client *acptr; /* * send info about connections which match, or all if the diff --git a/src/modules/tkl.c b/src/modules/tkl.c index 002c449b6..80337eadf 100644 --- a/src/modules/tkl.c +++ b/src/modules/tkl.c @@ -425,8 +425,7 @@ int tkl_config_run_spamfilter(ConfigFile *cf, ConfigEntry *ce, int type) { ConfigEntry *cep; ConfigEntry *cepp; - TKL *tk; - char *word = NULL, *reason = NULL; + char *word = NULL; time_t bantime = (SPAMFILTER_BAN_TIME ? SPAMFILTER_BAN_TIME : 86400); char *banreason = ""; int action = 0, target = 0; @@ -459,7 +458,7 @@ int tkl_config_run_spamfilter(ConfigFile *cf, ConfigEntry *ce, int type) } else if (!strcmp(cep->ce_varname, "reason")) { - reason = cep->ce_vardata; + banreason = cep->ce_vardata; } else if (!strcmp(cep->ce_varname, "ban-time")) { @@ -627,9 +626,6 @@ int tkl_config_run_ban(ConfigFile *cf, ConfigEntry *ce, int configtype) int tkl_config_test_except(ConfigFile *cf, ConfigEntry *ce, int configtype, int *errs) { ConfigEntry *cep, *cepp; - ConfigItem_except *ca; - Hook *h; - char *bantypes = NULL; int errors = 0; int has_mask = 0; @@ -768,9 +764,6 @@ void config_create_tkl_except(char *mask, char *bantypes) int tkl_config_run_except(ConfigFile *cf, ConfigEntry *ce, int configtype) { ConfigEntry *cep, *cepp; - ConfigItem_except *ca; - Hook *h; - char *default_bantypes = NULL; char bantypes[64]; /* We are only interested in except { } blocks */ @@ -1394,7 +1387,6 @@ CMD_FUNC(m_eline) { time_t secs = 0; int add = 1; - time_t i; Client *acptr = NULL; char *mask = NULL; char mo[1024], mo2[1024]; @@ -1412,7 +1404,6 @@ CMD_FUNC(m_eline) "-", /*9 reason */ NULL }; - struct tm *t; if (IsServer(sptr)) return 0; @@ -2261,7 +2252,7 @@ TKL *_tkl_add_nameban(int type, char *name, int hold, char *reason, char *set_by time_t expire_at, time_t set_at, int flags) { TKL *tkl; - int index, index2; + int index; if (!TKLIsNameBanType(type)) abort(); @@ -2544,7 +2535,6 @@ EVENT(tkl_check_expire) static int find_tkl_exception_matcher(Client *cptr, int ban_type, TKL *except_tkl) { char uhost[NICKLEN+HOSTLEN+1]; - Hook *hook; if (!TKLIsBanException(except_tkl)) return 0; @@ -2579,7 +2569,7 @@ static int find_tkl_exception_matcher(Client *cptr, int ban_type, TKL *except_tk */ int _find_tkl_exception(int ban_type, Client *cptr) { - TKL *tkl, *ret; + TKL *tkl; int index, index2; Hook *hook; @@ -2617,8 +2607,6 @@ int _find_tkl_exception(int ban_type, Client *cptr) int find_tkline_match_matcher(Client *cptr, int skip_soft, TKL *tkl) { char uhost[NICKLEN+HOSTLEN+1]; - ConfigItem_except *excepts; - Hook *hook; if (!TKLIsServerBan(tkl) || (tkl->type & TKL_SHUN)) return 0; @@ -2718,9 +2706,6 @@ int _find_tkline_match(Client *cptr, int skip_soft) int _find_shun(Client *cptr) { TKL *tkl; - ConfigItem_except *excepts; - int match_type = 0; - Hook *hook; if (IsServer(cptr) || IsMe(cptr)) return -1; @@ -2881,7 +2866,6 @@ TKL *_find_qline(Client *cptr, char *name, int *ishold) { TKL *tkl; int points = 0; - ConfigItem_except *excepts; *ishold = 0; if (IsServer(cptr) || IsMe(cptr)) @@ -2921,9 +2905,6 @@ TKL *_find_qline(Client *cptr, char *name, int *ishold) /** Helper function for find_tkline_match_zap() */ TKL *find_tkline_match_zap_matcher(Client *cptr, TKL *tkl) { - ConfigItem_except *excepts; - Hook *hook; - if (!(tkl->type & TKL_ZAP)) return NULL; diff --git a/src/modules/tkldb.c b/src/modules/tkldb.c index 569713139..5becf4901 100644 --- a/src/modules/tkldb.c +++ b/src/modules/tkldb.c @@ -77,7 +77,7 @@ ModuleHeader MOD_HEADER(tkldb) = { } \ } while(0) -// Forward declarations +/* Forward declarations */ void tkldb_moddata_free(ModData *md); void setcfg(void); void freecfg(void); @@ -88,8 +88,7 @@ int write_tkldb(void); int write_tkline(FILE *fd, const char *tmpfname, TKL *tkl); int read_tkldb(void); -// Globals -static ModDataInfo *tkldb_md; +/* Globals variables */ const uint32_t tkl_db_version = TKL_DB_VERSION; struct cfgstruct { char *database; diff --git a/src/modules/user.c b/src/modules/user.c index f4c146ac5..fb1c65c98 100644 --- a/src/modules/user.c +++ b/src/modules/user.c @@ -64,11 +64,14 @@ MOD_UNLOAD(user) */ CMD_FUNC(m_user) { -#define UFLAGS (UMODE_INVISIBLE|UMODE_WALLOP|UMODE_SERVNOTICE) - char *username, *host, *server, *realname, *umodex = NULL, *virthost = - NULL, *ip = NULL; + char *username; + char *host; + char *server; + char *realname; + char *umodex = NULL; + char *virthost = NULL; + char *ip = NULL; char *sstamp = NULL; - Client *acptr; if (IsServer(cptr) && !IsUnknown(sptr)) return 0; diff --git a/src/modules/vhost.c b/src/modules/vhost.c index 88e34c3c4..d15260dff 100644 --- a/src/modules/vhost.c +++ b/src/modules/vhost.c @@ -57,9 +57,7 @@ MOD_UNLOAD(vhost) CMD_FUNC(m_vhost) { ConfigItem_vhost *vhost; - char *login, *password, host[NICKLEN+USERLEN+HOSTLEN+6], host2[NICKLEN+USERLEN+HOSTLEN+6]; - int len, length; - int i; + char *login, *password; char olduser[USERLEN+1]; if (!MyUser(sptr)) diff --git a/src/modules/webirc.c b/src/modules/webirc.c index 2c330005d..276ae5fcc 100644 --- a/src/modules/webirc.c +++ b/src/modules/webirc.c @@ -141,7 +141,7 @@ void delete_webircblock(ConfigItem_webirc *e) int webirc_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) { - ConfigEntry *cep, *cepp; + ConfigEntry *cep; int errors = 0; char has_mask = 0; /* mandatory */ char has_password = 0; /* mandatory */ @@ -250,7 +250,6 @@ int webirc_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) int webirc_config_run(ConfigFile *cf, ConfigEntry *ce, int type) { ConfigEntry *cep; - ConfigEntry *cepp; ConfigItem_webirc *webirc = NULL; if (type != CONFIG_MAIN) @@ -341,8 +340,6 @@ ConfigItem_webirc *Find_webirc(Client *sptr, char *password, WEBIRCType type, ch int dowebirc(Client *cptr, char *ip, char *host, char *options) { char scratch[64]; - char *sockhost; - int secure = 0; if (IsWEBIRC(cptr)) return exit_client(cptr, cptr, &me, NULL, "Double CGI:IRC request (already identified)"); @@ -414,7 +411,6 @@ int dowebirc(Client *cptr, char *ip, char *host, char *options) CMD_FUNC(m_webirc) { char *ip, *host, *password, *options; - size_t ourlen; ConfigItem_webirc *e; char *error = NULL; diff --git a/src/modules/webredir.c b/src/modules/webredir.c index 4c25c2f5c..96ddbb8b3 100644 --- a/src/modules/webredir.c +++ b/src/modules/webredir.c @@ -172,7 +172,7 @@ int webredir_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) int webredir_config_run(ConfigFile *cf, ConfigEntry *ce, int type) { - ConfigEntry *cep, *cep2; + ConfigEntry *cep; if (type != CONFIG_SET) return 0; diff --git a/src/modules/websocket.c b/src/modules/websocket.c index 2c0f59de8..449326c06 100644 --- a/src/modules/websocket.c +++ b/src/modules/websocket.c @@ -467,7 +467,6 @@ void add_lf_if_needed(char **buf, int *len) */ int websocket_handle_packet(Client *sptr, char *readbuf, int length) { - char fin; /**< Final fragment */ char opcode; /**< Opcode */ char masked; /**< Masked */ int len; /**< Length of the packet */ @@ -481,7 +480,7 @@ int websocket_handle_packet(Client *sptr, char *readbuf, int length) return 0; } - fin = readbuf[0] & 0x80; + /* fin = readbuf[0] & 0x80; -- unused */ opcode = readbuf[0] & 0x7F; masked = readbuf[1] & 0x80; len = readbuf[1] & 0x7F; diff --git a/src/modules/who_old.c b/src/modules/who_old.c index 283466e98..4c59d000e 100644 --- a/src/modules/who_old.c +++ b/src/modules/who_old.c @@ -389,10 +389,9 @@ int i = 1; static int can_see(Client *sptr, Client *acptr, Channel *channel) { -int ret = 0; -int i=0; -Hook *h; -char has_common_chan = 0; + int ret = 0; + char has_common_chan = 0; + do { /* can only see people */ if (!IsUser(acptr)) diff --git a/src/modules/whois.c b/src/modules/whois.c index 94b206944..198cef290 100644 --- a/src/modules/whois.c +++ b/src/modules/whois.c @@ -89,7 +89,7 @@ CMD_FUNC(m_whois) for (tmp = canonize(parv[1]); (nick = strtoken(&p, tmp, ",")); tmp = NULL) { - unsigned char invis, showchannel, member, wilds, hideoper; /* <- these are all boolean-alike */ + unsigned char showchannel, wilds, hideoper; /* <- these are all boolean-alike */ if (MyUser(sptr) && (++ntargets > maxtargets)) { @@ -123,9 +123,6 @@ CMD_FUNC(m_whois) name = (!*acptr->name) ? "?" : acptr->name; - invis = acptr != sptr && IsInvisible(acptr); - member = (acptr->user->channel) ? 1 : 0; - hideoper = 0; if (IsHideOper(acptr) && (acptr != sptr) && !IsOper(sptr)) hideoper = 1; diff --git a/src/modules/whox.c b/src/modules/whox.c index 1b4249fd3..2bbc3ec21 100644 --- a/src/modules/whox.c +++ b/src/modules/whox.c @@ -129,7 +129,6 @@ MOD_UNLOAD(whox) */ CMD_FUNC(m_whox) { - static time_t last_used = 0; char *mask; char *orig_mask; char ch; /* Scratch char register */ @@ -813,7 +812,6 @@ static int convert_classical_who_request(Client *sptr, int *parc, char *parv[], { char *p; static char pbuf1[256]; - static char pbuf2[256]; int points; /* Figure out if the user is doing a 'classical' UnrealIRCd request, diff --git a/src/operclass.c b/src/operclass.c index d47b04ab9..7071f4391 100644 --- a/src/operclass.c +++ b/src/operclass.c @@ -285,7 +285,6 @@ OperPermission ValidatePermissionsForPath(char* path, Client *sptr, Client *vict ConfigItem_operclass *ce_operClass; OperClass *oc = NULL; OperClassACLPath *operPath; - OperClassACL *acl; if (!sptr) return OPER_DENY; diff --git a/src/packet.c b/src/packet.c index f3817edd0..19b3a6e05 100644 --- a/src/packet.c +++ b/src/packet.c @@ -126,8 +126,6 @@ static inline RealCommand *find_Cmd(char *cmd, int flags) RealCommand *find_Command(char *cmd, short token, int flags) { - RealCommand *p; - Debug((DEBUG_NOTICE, "FindCommand %s", cmd)); return find_Cmd(cmd, flags); diff --git a/src/parse.c b/src/parse.c index 062f14f1b..f91ed0b7c 100644 --- a/src/parse.c +++ b/src/parse.c @@ -75,15 +75,9 @@ int parse2(Client *cptr, Client **fromptr, MessageTag *mtags, char *ch); int parse(Client *cptr, char *buffer, int length) { Hook *h; - int buf_len = 0; Client *from = cptr; char *ch; int i, ret; -#ifdef DEBUGMODE - time_t then, ticks; - int retval; -#endif - RealCommand *cmptr = NULL; MessageTag *mtags = NULL; for (h = Hooks[HOOKTYPE_PACKET]; h; h = h->next) diff --git a/src/send.c b/src/send.c index 3228c4a04..a1fd1a0a2 100644 --- a/src/send.c +++ b/src/send.c @@ -33,9 +33,6 @@ static int vmakebuf_local_withprefix(char *buf, size_t buflen, struct Client *fr static char sendbuf[2048]; static char sendbuf2[4096]; -static char tcmd[2048]; -static char ccmd[2048]; -static char xcmd[2048]; void vsendto_prefix_one(struct Client *to, struct Client *from, MessageTag *mtags, const char *pattern, va_list vl); @@ -94,7 +91,6 @@ static void send_queued_cb(int fd, int revents, void *data) */ int send_queued(Client *to) { - char *msg; int len, rlen; dbufbuf *block; int want_read; @@ -357,8 +353,6 @@ void sendto_channel(Channel *chptr, Client *from, Client *skip, va_list vl; Member *lp; Client *acptr; - int i = 0,j = 0; - Hook *h; ++current_serial; for (lp = chptr->members; lp; lp = lp->next) @@ -586,8 +580,7 @@ void sendto_match_butone(Client *one, Client *from, char *mask, int what, MessageTag *mtags, FORMAT_STRING(const char *pattern), ...) { va_list vl; - int i; - Client *cptr, *acptr; + Client *cptr; char cansendlocal, cansendglobal; if (MyConnect(from)) @@ -781,9 +774,7 @@ void sendto_snomask_global(int snomask, FORMAT_STRING(const char *pattern), ...) */ void send_cap_notify(int add, char *token) { - va_list vl; Client *cptr; - char nbuf[1024]; ClientCapability *clicap = ClientCapabilityFindReal(token); long CAP_NOTIFY = ClientCapabilityBit("cap-notify"); @@ -825,7 +816,6 @@ void send_cap_notify(int add, char *token) void sendto_ops_butone(Client *one, Client *from, FORMAT_STRING(const char *pattern), ...) { va_list vl; - int i; Client *cptr; ++current_serial; @@ -976,7 +966,6 @@ static char buf[2048]; void sendto_connectnotice(Client *acptr, int disconnect, char *comment) { Client *cptr; - int i, j; char connect[512], secure[256]; if (!disconnect) @@ -1009,7 +998,6 @@ void sendto_connectnotice(Client *acptr, int disconnect, char *comment) void sendto_fconnectnotice(Client *acptr, int disconnect, char *comment) { Client *cptr; - int i, j; char connect[512], secure[256]; if (!disconnect) @@ -1051,8 +1039,6 @@ void sendto_serv_butone_nickcmd(Client *one, Client *sptr, char *umodes) list_for_each_entry(cptr, &server_list, special_node) { - va_list vl; - if (one && cptr == one->direction) continue; diff --git a/src/serv.c b/src/serv.c index f37410ad6..e4315570d 100644 --- a/src/serv.c +++ b/src/serv.c @@ -30,8 +30,6 @@ #endif extern void s_die(); -static char buf[BUFSIZE]; - MODVAR int max_connection_count = 1, max_client_count = 1; extern int do_garbage_collect; /* We need all these for cached MOTDs -- codemastr */ @@ -115,9 +113,9 @@ void reread_motdsandrules(); #ifndef _WIN32 char *getosname(void) { -static char buf[1024]; -struct utsname osinf; -char *p; + static char buf[1024]; + struct utsname osinf; + char *p; memset(&osinf, 0, sizeof(osinf)); if (uname(&osinf) != 0) @@ -767,7 +765,6 @@ CMD_FUNC(m_restart) { char *reason = parv[1]; Client *acptr; - int i; /* Check permissions */ if (!ValidatePermissionsForPath("server:restart",sptr,NULL,NULL,NULL)) @@ -1095,7 +1092,6 @@ void free_motd(MOTDFile *themotd) CMD_FUNC(m_die) { Client *acptr; - int i; if (!ValidatePermissionsForPath("server:die",sptr,NULL,NULL,NULL)) { @@ -1164,7 +1160,6 @@ void add_pending_net(Client *sptr, char *str) { PendingNet *net; PendingServer *srv; - int num = 1; char *p, *name; if (BadPtr(str) || !sptr) diff --git a/src/tls.c b/src/tls.c index 723b584d5..cf6556b16 100644 --- a/src/tls.c +++ b/src/tls.c @@ -176,9 +176,6 @@ int ssl_pem_passwd_cb(char *buf, int size, int rwflag, void *password) static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx) { - int verify_err = 0; - - verify_err = X509_STORE_CTX_get_error(ctx); /* We accept the connection. Certificate verifiction takes * place elsewhere, such as in _verify_link(). */ @@ -608,8 +605,6 @@ void SSL_set_nonblocking(SSL *s) char *tls_get_cipher(SSL *ssl) { static char buf[256]; - int bits; - const SSL_CIPHER *c; buf[0] = '\0'; strlcpy(buf, SSL_get_version(ssl), sizeof(buf)); @@ -1276,7 +1271,6 @@ int outdated_tls_client(Client *acptr) char buf[1024], *name, *p; const char *client_protocol = SSL_get_version(acptr->local->ssl); const char *client_ciphersuite = SSL_get_cipher(acptr->local->ssl); - int bad = 0; if (!tlsoptions) return 0; /* odd.. */ diff --git a/src/updconf.c b/src/updconf.c index e785f85d4..1af4e4a6f 100644 --- a/src/updconf.c +++ b/src/updconf.c @@ -253,7 +253,7 @@ char *updconf_addquotes(char *str) int upgrade_me_block(ConfigEntry *ce) { - ConfigEntry *cep, *cepp; + ConfigEntry *cep; char *name = NULL; char *info = NULL; int numeric = 0; @@ -323,7 +323,6 @@ int upgrade_link_block(ConfigEntry *ce) char *ciphers = NULL; char *password_receive_authmethod = NULL; int need_incoming = 0, need_outgoing = 0; - int upg_passwd_warning = 0; /* ripped from test_link */ for (cep = ce->ce_entries; cep; cep = cep->ce_next) @@ -493,7 +492,7 @@ int upgrade_link_block(ConfigEntry *ce) #define MAXFROMENTRIES 100 int upgrade_from_subblock(ConfigEntry *ce) { - ConfigEntry *cep, *cepp; + ConfigEntry *cep; char *list[MAXFROMENTRIES]; int listcnt = 0; @@ -595,7 +594,6 @@ int upgrade_loadmodule(ConfigEntry *ce) int upgrade_include(ConfigEntry *ce) { char *file = ce->ce_vardata; - char tmp[512], *p, *newfile; static int badwords_upgraded_already = 0; if (!file) @@ -1036,7 +1034,7 @@ int upgrade_listen_block(ConfigEntry *ce) int upgrade_cgiirc_block(ConfigEntry *ce) { - ConfigEntry *cep, *cepp; + ConfigEntry *cep; char *type = NULL; char *username = NULL; char *hostname = NULL; @@ -1607,7 +1605,7 @@ static void add_include_list(char *fname, ConfigFile **cf) void build_include_list_ex(char *fname, ConfigFile **cf_list) { - ConfigFile *cf, *cf2; + ConfigFile *cf; ConfigEntry *ce; if (strstr(fname, "://")) @@ -1648,7 +1646,6 @@ void update_conf(void) { ConfigFile *files; ConfigFile *cf; - ConfigEntry *ce, *cep, *cepp; char *mainconf = configfile; int upgraded_files = 0; diff --git a/src/url.c b/src/url.c index 56a199c8a..3f52c9c92 100644 --- a/src/url.c +++ b/src/url.c @@ -311,14 +311,14 @@ static void url_check_multi_handles(void) static void url_socket_pollcb(int fd, int revents, void *data) { int flags = 0; - int dummy, r; + int dummy; if (revents & FD_SELECT_READ) flags |= CURL_CSELECT_IN; if (revents & FD_SELECT_WRITE) flags |= CURL_CSELECT_OUT; - r = curl_multi_socket_action(multihandle, fd, flags, &dummy); + curl_multi_socket_action(multihandle, fd, flags, &dummy); url_check_multi_handles(); } diff --git a/src/user.c b/src/user.c index 97d67abbb..fa5ec135a 100644 --- a/src/user.c +++ b/src/user.c @@ -246,7 +246,6 @@ unsigned char hash_target(void *target) */ int check_for_target_limit(Client *sptr, void *target, const char *name) { - u_char *p; u_char hash = hash_target(target); int i;