From 05aeba9ba9e8fcf3e8320ef69a2b3d89e5ab9309 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Mon, 12 Jul 2021 18:54:05 +0200 Subject: [PATCH] Get rid of Debug(()) function calls. I never use it anyway. --- include/config.h | 2 -- src/api-channelmode.c | 2 -- src/api-usermode.c | 4 ---- src/conf.c | 7 ------- src/crule.c | 5 ----- src/ircd.c | 40 -------------------------------------- src/match.c | 2 -- src/misc.c | 3 --- src/modules.c | 1 - src/modules/ident_lookup.c | 1 - src/modules/nick.c | 2 -- src/modules/server.c | 4 ---- src/modules/sjoin.c | 4 ---- src/modules/starttls.c | 5 ++--- src/parse.c | 4 ---- src/random.c | 1 - src/send.c | 7 ------- src/socket.c | 8 -------- src/support.c | 1 - src/tls.c | 3 --- src/url.c | 1 - 21 files changed, 2 insertions(+), 105 deletions(-) diff --git a/include/config.h b/include/config.h index e891c4dc2..9b68475b6 100644 --- a/include/config.h +++ b/include/config.h @@ -280,10 +280,8 @@ #define IRCD_PIDFILE PIDFILE #ifdef DEBUGMODE - #define Debug(x) debug x #define LOGFILE LPATH #else - #define Debug(x) ; #define LOGFILE "/dev/null" #endif diff --git a/src/api-channelmode.c b/src/api-channelmode.c index 3237da911..2c670429c 100644 --- a/src/api-channelmode.c +++ b/src/api-channelmode.c @@ -223,7 +223,6 @@ Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode) } if (i == EXTCMODETABLESZ) { - Debug((DEBUG_DEBUG, "CmodeAdd failed, no space")); if (module) module->errorcode = MODERR_NOSPACE; return NULL; @@ -243,7 +242,6 @@ Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode) { if (paraslot == MAXPARAMMODES - 1) { - Debug((DEBUG_DEBUG, "CmodeAdd failed, no space for parameter")); if (module) module->errorcode = MODERR_NOSPACE; return NULL; diff --git a/src/api-usermode.c b/src/api-usermode.c index b195c4f45..7b1fc6065 100644 --- a/src/api-usermode.c +++ b/src/api-usermode.c @@ -189,8 +189,6 @@ Umode *UmodeAdd(Module *module, char ch, int global, int unset_on_deoper, int (* Usermode_Table[i].flag = ch; Usermode_Table[i].allowed = allowed; Usermode_Table[i].unset_on_deoper = unset_on_deoper; - Debug((DEBUG_DEBUG, "UmodeAdd(%c) returning %04lx", - ch, Usermode_Table[i].mode)); /* Update usermode table highest */ for (j = 0; j < UMODETABLESZ; j++) if (Usermode_Table[i].flag) @@ -214,7 +212,6 @@ Umode *UmodeAdd(Module *module, char ch, int global, int unset_on_deoper, int (* } else { - Debug((DEBUG_DEBUG, "UmodeAdd failed, no space")); if (module) module->errorcode = MODERR_NOSPACE; return NULL; @@ -309,7 +306,6 @@ Snomask *SnomaskAdd(Module *module, char ch, int (*allowed)(Client *client, int } else { - Debug((DEBUG_DEBUG, "SnomaskAdd failed, no space")); *mode = 0; if (module) module->errorcode = MODERR_NOSPACE; diff --git a/src/conf.c b/src/conf.c index 6ac16dd99..4013fcd92 100644 --- a/src/conf.c +++ b/src/conf.c @@ -2511,13 +2511,10 @@ void config_rehash() next = (ListStruct *)link_ptr->next; if (link_ptr->refcount == 0) { - Debug((DEBUG_ERROR, "s_conf: deleting block %s (refcount 0)", link_ptr->servername)); delete_linkblock(link_ptr); } else { - Debug((DEBUG_ERROR, "s_conf: marking block %s (refcount %d) as temporary", - link_ptr->servername, link_ptr->refcount)); link_ptr->flag.temporary = 1; } } @@ -10840,8 +10837,6 @@ void link_cleanup(ConfigItem_link *link_ptr) void delete_linkblock(ConfigItem_link *link_ptr) { - Debug((DEBUG_ERROR, "delete_linkblock: deleting %s, refcount=%d", - link_ptr->servername, link_ptr->refcount)); if (link_ptr->class) { link_ptr->class->xrefcount--; @@ -10860,8 +10855,6 @@ void delete_linkblock(ConfigItem_link *link_ptr) void delete_classblock(ConfigItem_class *class_ptr) { - Debug((DEBUG_ERROR, "delete_classblock: deleting %s, clients=%d, xrefcount=%d", - class_ptr->name, class_ptr->clients, class_ptr->xrefcount)); safe_free(class_ptr->name); DelListItem(class_ptr, conf_class); safe_free(class_ptr); diff --git a/src/crule.c b/src/crule.c index faa9e6a2a..bbb9d8d69 100644 --- a/src/crule.c +++ b/src/crule.c @@ -372,11 +372,6 @@ char *crule_parse(char *rule) } if (ruleroot != NULL) crule_free((char **)&ruleroot); -#if !defined(CR_DEBUG) && !defined(CR_CHKCONF) - Debug((DEBUG_ERROR, "%s in rule: %s", crule_errstr[errcode], rule)); -#else - (void)fprintf(stderr, "%s in rule: %s\n", crule_errstr[errcode], rule); -#endif return NULL; } diff --git a/src/ircd.c b/src/ircd.c index 4c9fb3a89..46539af69 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -179,7 +179,6 @@ void server_reboot(char *mesg) int i; Client *client; sendto_realops("Aieeeee!!! Restarting server... %s", mesg); - Debug((DEBUG_NOTICE, "Restarting server... %s", mesg)); list_for_each_entry(client, &lclient_list, lclient_node) (void) send_queued(client); @@ -206,12 +205,6 @@ void server_reboot(char *mesg) CleanUp(); WinExec(cmdLine, SW_SHOWDEFAULT); } -#endif -#ifndef _WIN32 - Debug((DEBUG_FATAL, "Couldn't restart server: %s", strerror(errno))); -#else - Debug((DEBUG_FATAL, "Couldn't restart server: %s", - strerror(GetLastError()))); #endif unload_all_modules(); #ifdef _WIN32 @@ -360,9 +353,6 @@ void check_ping(Client *client) int ping = 0; ping = client->local->class ? client->local->class->pingfreq : iConf.handshake_timeout; - Debug((DEBUG_DEBUG, "c(%s)=%d p %d a %lld", client->name, - client->status, ping, - (long long)(TStime() - client->local->lasttime))); /* If ping is less than or equal to the last time we received a command from them */ if (ping > (TStime() - client->local->lasttime)) @@ -386,9 +376,6 @@ void check_ping(Client *client) ircd_log(LOG_ERROR, "No response from %s, closing link", get_client_name(client, FALSE)); } - if (IsTLSAcceptHandshake(client)) - Debug((DEBUG_DEBUG, "ssl accept handshake timeout: %s (%lld-%lld > %lld)", client->local->sockhost, - (long long)TStime(), (long long)client->local->since, (long long)ping)); ircsnprintf(scratch, sizeof(scratch), "Ping timeout: %lld seconds", (long long) (TStime() - client->local->lasttime)); exit_client(client, NULL, scratch); @@ -549,40 +536,19 @@ void fix_timers(void) list_for_each_entry(client, &lclient_list, lclient_node) { if (client->local->since > TStime()) - { - Debug((DEBUG_DEBUG, "fix_timers(): %s: client->local->since %ld -> %ld", - client->name, client->local->since, TStime())); client->local->since = TStime(); - } if (client->local->lasttime > TStime()) - { - Debug((DEBUG_DEBUG, "fix_timers(): %s: client->local->lasttime %ld -> %ld", - client->name, client->local->lasttime, TStime())); client->local->lasttime = TStime(); - } if (client->local->last > TStime()) - { - Debug((DEBUG_DEBUG, "fix_timers(): %s: client->local->last %ld -> %ld", - client->name, client->local->last, TStime())); client->local->last = TStime(); - } /* users */ if (MyUser(client)) { if (client->local->nextnick > TStime()) - { - Debug((DEBUG_DEBUG, "fix_timers(): %s: client->local->nextnick %ld -> %ld", - client->name, client->local->nextnick, TStime())); client->local->nextnick = TStime(); - } if (client->local->nexttarget > TStime()) - { - Debug((DEBUG_DEBUG, "fix_timers(): %s: client->local->nexttarget %ld -> %ld", - client->name, client->local->nexttarget, TStime())); client->local->nexttarget = TStime(); - } - } } @@ -611,7 +577,6 @@ void fix_timers(void) thr->since = TStime(); } } - Debug((DEBUG_DEBUG, "fix_timers(): removed %d throttling item(s)", cnt)); /* Make sure autoconnect for servers still works (lnk->hold) */ for (lnk = conf_link; lnk; lnk = lnk->next) @@ -621,7 +586,6 @@ void fix_timers(void) if (lnk->hold > TStime() + t) { lnk->hold = TStime() + (t / 2); /* compromise */ - Debug((DEBUG_DEBUG, "fix_timers(): link '%s' hold-time adjusted to %ld", lnk->servername, lnk->hold)); } } } @@ -1243,7 +1207,6 @@ int InitUnrealIRCd(int argc, char *argv[]) fix_timers(); write_pidfile(); - Debug((DEBUG_NOTICE, "Server ready...")); init_throttling(); loop.ircd_booted = 1; #if defined(HAVE_SETPROCTITLE) @@ -1366,9 +1329,6 @@ static void open_debugfile(void) else # endif strlcpy(client->name, "FD2-Pipe", sizeof(client->name)); - Debug((DEBUG_FATAL, - "Debug: File <%s> Level: %d at %s", client->name, - client->local->port, myctime(time(NULL)))); } #endif } diff --git a/src/match.c b/src/match.c index ccc1c39f9..157d87906 100644 --- a/src/match.c +++ b/src/match.c @@ -536,8 +536,6 @@ int fast_badword_replace(ConfigItem_badword *badword, char *line, char *buf, int int run = 1; int cleaned = 0; - Debug((DEBUG_NOTICE, "replacing %s -> %s in '%s'", badword->word, replacew, line)); - while(run) { pold = our_strcasestr(pold, badword->word); if (!pold) diff --git a/src/misc.c b/src/misc.c index bc1076bde..c3a7aff17 100644 --- a/src/misc.c +++ b/src/misc.c @@ -605,12 +605,9 @@ void exit_client_ex(Client *client, Client *origin, MessageTag *recv_mtags, char if (client->serv && client->serv->conf) { client->serv->conf->refcount--; - Debug((DEBUG_ERROR, "reference count for %s (%s) is now %d", - client->name, client->serv->conf->servername, client->serv->conf->refcount)); if (!client->serv->conf->refcount && client->serv->conf->flag.temporary) { - Debug((DEBUG_ERROR, "deleting temporary block %s", client->serv->conf->servername)); delete_linkblock(client->serv->conf); client->serv->conf = NULL; } diff --git a/src/modules.c b/src/modules.c index d7de75cd8..13d26b121 100644 --- a/src/modules.c +++ b/src/modules.c @@ -299,7 +299,6 @@ char *Module_Create(char *path_) char *expectedmodversion = our_mod_version; unsigned int expectedcompilerversion = our_compiler_version; long modsys_ver = 0; - Debug((DEBUG_DEBUG, "Attempting to load module from %s", path_)); path = Module_TransformPath(path_); diff --git a/src/modules/ident_lookup.c b/src/modules/ident_lookup.c index 93ec0edb9..603045836 100644 --- a/src/modules/ident_lookup.c +++ b/src/modules/ident_lookup.c @@ -43,7 +43,6 @@ MOD_UNLOAD() static void ident_lookup_failed(Client *client) { - Debug((DEBUG_NOTICE, "ident_lookup_failed() for %p", client)); ircstats.is_abad++; if (client->local->authfd != -1) { diff --git a/src/modules/nick.c b/src/modules/nick.c index 660f54247..829393728 100644 --- a/src/modules/nick.c +++ b/src/modules/nick.c @@ -1335,8 +1335,6 @@ int AllowClient(Client *client, char *username) static char uhost[HOSTLEN + USERLEN + 3]; static char fullname[HOSTLEN + 1]; - Debug((DEBUG_DNS, "ch_cl: check access for %s[%s]", client->name, client->local->sockhost)); - if (!check_init(client, sockhost, sizeof(sockhost))) return 0; diff --git a/src/modules/server.c b/src/modules/server.c index 363b0c1b9..edb575dce 100644 --- a/src/modules/server.c +++ b/src/modules/server.c @@ -1406,11 +1406,7 @@ int server_sync(Client *cptr, ConfigItem_link *aconf) if (!cptr->serv->conf) cptr->serv->conf = aconf; /* Only set serv->conf to aconf if not set already! Bug #0003913 */ if (incoming) - { cptr->serv->conf->refcount++; - Debug((DEBUG_ERROR, "reference count for %s (%s) is now %d", - cptr->name, cptr->serv->conf->servername, cptr->serv->conf->refcount)); - } cptr->serv->conf->class->clients++; cptr->local->class = cptr->serv->conf->class; RunHook(HOOKTYPE_SERVER_CONNECT, cptr); diff --git a/src/modules/sjoin.c b/src/modules/sjoin.c index 78b661951..429c050ad 100644 --- a/src/modules/sjoin.c +++ b/src/modules/sjoin.c @@ -463,7 +463,6 @@ getnick: continue; if (nick[0] == '\0') continue; - Debug((DEBUG_DEBUG, "Got nick: %s", nick)); if (!(modeflags & CHFL_BAN) && !(modeflags & CHFL_EXCEPT) && !(modeflags & CHFL_INVEX)) { Client *acptr; @@ -634,7 +633,6 @@ getnick: } /* Send out any possible remainder.. */ - Debug((DEBUG_DEBUG, "Sending '%li %s :%s' to ", ts, parabuf, parv[parc - 1])); sendto_server(client, 0, PROTO_SJSBY, recv_mtags, "%s", uid_buf); sendto_server(client, PROTO_SJSBY, 0, recv_mtags, "%s", uid_sjsby_buf); @@ -843,12 +841,10 @@ getnick: case EXSJ_THEYWON: parax = cm_getparameter(channel, flag); - Debug((DEBUG_DEBUG, "sjoin: they won: '%s'", parax)); Addit(Channelmode_Table[i].flag, parax); break; case EXSJ_SAME: - Debug((DEBUG_DEBUG, "sjoin: equal")); break; case EXSJ_MERGE: diff --git a/src/modules/starttls.c b/src/modules/starttls.c index 03dc883e7..48d08f3d0 100644 --- a/src/modules/starttls.c +++ b/src/modules/starttls.c @@ -97,14 +97,13 @@ CMD_FUNC(cmd_starttls) send_queued(client); SetStartTLSHandshake(client); - Debug((DEBUG_DEBUG, "Starting SSL handshake (due to STARTTLS) for %s", client->local->sockhost)); if ((client->local->ssl = SSL_new(ctx)) == NULL) goto fail; SetTLS(client); SSL_set_fd(client->local->ssl, client->local->fd); SSL_set_nonblocking(client->local->ssl); - if (!ircd_SSL_accept(client, client->local->fd)) { - Debug((DEBUG_DEBUG, "Failed SSL accept handshake in instance 1: %s", client->local->sockhost)); + if (!ircd_SSL_accept(client, client->local->fd)) + { SSL_set_shutdown(client->local->ssl, SSL_RECEIVED_SHUTDOWN); SSL_smart_shutdown(client->local->ssl); SSL_free(client->local->ssl); diff --git a/src/parse.c b/src/parse.c index 280352256..01344ff88 100644 --- a/src/parse.c +++ b/src/parse.c @@ -189,8 +189,6 @@ void parse(Client *cptr, char *buffer, int length) return; } - Debug((DEBUG_ERROR, "Parsing: %s (from %s)", buffer, (*cptr->name ? cptr->name : "*"))); - if (IsDeadSocket(cptr)) return; @@ -407,8 +405,6 @@ static void parse2(Client *cptr, Client **fromptr, MessageTag *mtags, int mtags_ sendto_one(from, NULL, ":%s %d %s %s :Unknown command", me.name, ERR_UNKNOWNCOMMAND, from->name, ch); - Debug((DEBUG_ERROR, "Unknown (%s) from %s", - ch, get_client_name(cptr, TRUE))); } } ircstats.is_unco++; diff --git a/src/random.c b/src/random.c index 0fc33bcfb..d49c85cc4 100644 --- a/src/random.c +++ b/src/random.c @@ -459,7 +459,6 @@ void init_random() if (fd >= 0) { int n = read(fd, &rdat.rnd, sizeof(rdat.rnd)); - Debug((DEBUG_INFO, "init_random: read from /dev/urandom returned %d", n)); close(fd); } #else diff --git a/src/send.c b/src/send.c index e4284bec7..b146cbf12 100644 --- a/src/send.c +++ b/src/send.c @@ -78,7 +78,6 @@ int dead_socket(Client *to, char *notice) if (!IsUser(to) && !IsUnknown(to) && !IsClosing(to)) sendto_ops_and_log("Link to server %s (%s) closed: %s", to->name, to->ip?to->ip:"", notice); - Debug((DEBUG_ERROR, "dead_socket: %s - %s", notice, get_client_name(to, FALSE))); safe_strdup(to->local->error_str, notice); return -1; } @@ -248,8 +247,6 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick) Hook *h; Client *intended_to = to; - Debug((DEBUG_ERROR, "Sending [%s] to %s", msg, to->name)); - if (to->direction) to = to->direction; if (IsDeadSocket(to)) @@ -259,11 +256,7 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick) { /* This is normal when 'to' was being closed (via exit_client * and close_connection) --Run - * Print the debug message anyway... */ - Debug((DEBUG_ERROR, - "Local socket %s with negative fd %d... AARGH!", to->name, - to->local->fd)); return; } diff --git a/src/socket.c b/src/socket.c index b256ad380..d850de6c6 100644 --- a/src/socket.c +++ b/src/socket.c @@ -101,8 +101,6 @@ void report_error(char *text, Client *client) host = (client) ? get_client_name(client, FALSE) : ""; - Debug((DEBUG_ERROR, text, host, STRERROR(errtmp))); - /* * Get the *real* error from the socket (well try to anyway..). * This may only work when SO_DEBUG is enabled but its worth the @@ -152,8 +150,6 @@ void report_baderror(char *text, Client *client) host = (client) ? get_client_name(client, FALSE) : ""; - Debug((DEBUG_ERROR, text, host, STRERROR(errtmp))); - /* * Get the *real* error from the socket (well try to anyway..). * This may only work when SO_DEBUG is enabled but its worth the @@ -932,7 +928,6 @@ refuse_client: if (ctx) { SetTLSAcceptHandshake(client); - Debug((DEBUG_DEBUG, "Starting TLS accept handshake for %s", client->local->sockhost)); if ((client->local->ssl = SSL_new(ctx)) == NULL) { goto refuse_client; @@ -943,7 +938,6 @@ refuse_client: SSL_set_ex_data(client->local->ssl, ssl_client_index, client); if (!ircd_SSL_accept(client, fd)) { - Debug((DEBUG_DEBUG, "Failed TLS accept handshake in instance 1: %s", client->local->sockhost)); SSL_set_shutdown(client->local->ssl, SSL_RECEIVED_SHUTDOWN); SSL_smart_shutdown(client->local->ssl); SSL_free(client->local->ssl); @@ -1275,8 +1269,6 @@ int connect_server(ConfigItem_link *aconf, Client *by, struct hostent *hp) sendto_realops("connect_server() CONTINUED (%s:%d), aconf %p, refcount: %d, TEMP: %s", __FILE__, __LINE__, aconf, aconf->refcount, aconf->flag.temporary ? "YES" : "NO"); #endif - Debug((DEBUG_ERROR, "reference count for %s (%s) is now %d", - client->name, client->serv->conf->servername, client->serv->conf->refcount)); if (by && IsUser(by)) strlcpy(client->serv->by, by->name, sizeof(client->serv->by)); else diff --git a/src/support.c b/src/support.c index 6207d938a..a1e8b0763 100644 --- a/src/support.c +++ b/src/support.c @@ -140,7 +140,6 @@ char *inetntop(int af, const void *in, char *out, size_t size) if (*(op - 1) == ':') *op++ = '0'; *op = '\0'; - Debug((DEBUG_DNS, "Expanding `%s' -> `%s'", tmp, out)); } return out; } diff --git a/src/tls.c b/src/tls.c index 025725c96..4ac515fa9 100644 --- a/src/tls.c +++ b/src/tls.c @@ -702,11 +702,9 @@ void ircd_SSL_client_handshake(int fd, int revents, void *data) --OpenFiles; return; case 0: - Debug((DEBUG_DEBUG, "SetTLSConnectHandshake(%s)", get_client_name(client, TRUE))); SetTLSConnectHandshake(client); return; case 1: - Debug((DEBUG_DEBUG, "SSL_init_finished should finish this job (%s)", get_client_name(client, TRUE))); return; default: return; @@ -986,7 +984,6 @@ int client_starttls(Client *client) if (ircd_SSL_connect(client, client->local->fd) < 0) { - Debug((DEBUG_DEBUG, "Failed SSL connect handshake in instance 1: %s", client->name)); SSL_set_shutdown(client->local->ssl, SSL_RECEIVED_SHUTDOWN); SSL_smart_shutdown(client->local->ssl); SSL_free(client->local->ssl); diff --git a/src/url.c b/src/url.c index 5a4e290ca..8d059b979 100644 --- a/src/url.c +++ b/src/url.c @@ -321,7 +321,6 @@ static void url_socket_pollcb(int fd, int revents, void *data) static int url_socket_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) { - Debug((DEBUG_DEBUG, "url_socket_cb: %d (%s)", (int)s, (what == CURL_POLL_REMOVE)?"remove":"add-or-modify")); if (what == CURL_POLL_REMOVE) { fd_close(s);