diff options
| author | 2021-02-01 14:46:34 -0500 | |
|---|---|---|
| committer | 2021-02-01 14:46:34 -0500 | |
| commit | 5a922fa1607be4b15afe18f592c86b175d8b834a (patch) | |
| tree | 40965df157bd15ea2f468e8372510728c837f1a6 /src | |
| parent | 6a0204e95aa5358ef2bf7714559ccd366dba4617 (diff) | |
New upstream version 1.1.10.upstream/1.1.10upstream
Diffstat (limited to 'src')
44 files changed, 174 insertions, 100 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 858547d..826cb8c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = libopm bin_PROGRAMS = hopm -AM_CPPFLAGS = -DHOPM_PREFIX="\"$(prefix)\"" -DHOPM_ETCDIR="\"$(sysconfdir)\"" -DHOPM_LOGDIR="\"$(localstatedir)/log\"" -DHOPM_BINPATH="\"$(bindir)/hopm\"" +AM_CPPFLAGS = -DHOPM_PREFIX="\"$(prefix)\"" -DHOPM_ETCDIR="\"$(sysconfdir)\"" -DHOPM_LOGDIR="\"$(localstatedir)/log\"" -DHOPM_BINPATH="\"$(bindir)/hopm\"" -I$(top_srcdir)/src/libopm/src/ AM_YFLAGS = -d hopm_SOURCES = compat.c \ diff --git a/src/Makefile.in b/src/Makefile.in index 5da1450..a59e252 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -384,7 +384,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = libopm -AM_CPPFLAGS = -DHOPM_PREFIX="\"$(prefix)\"" -DHOPM_ETCDIR="\"$(sysconfdir)\"" -DHOPM_LOGDIR="\"$(localstatedir)/log\"" -DHOPM_BINPATH="\"$(bindir)/hopm\"" +AM_CPPFLAGS = -DHOPM_PREFIX="\"$(prefix)\"" -DHOPM_ETCDIR="\"$(sysconfdir)\"" -DHOPM_LOGDIR="\"$(localstatedir)/log\"" -DHOPM_BINPATH="\"$(bindir)/hopm\"" -I$(top_srcdir)/src/libopm/src/ AM_YFLAGS = -d hopm_SOURCES = compat.c \ compat.h \ diff --git a/src/compat.c b/src/compat.c index 51e30fa..134da9d 100644 --- a/src/compat.c +++ b/src/compat.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Andy Smith - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/compat.h b/src/compat.h index 519e681..fc448dd 100644 --- a/src/compat.h +++ b/src/compat.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Andy Smith - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/config-lexer.c b/src/config-lexer.c index 4987d2a..6b9f6e1 100644 --- a/src/config-lexer.c +++ b/src/config-lexer.c @@ -866,7 +866,7 @@ char *yytext; #line 1 "config-lexer.l" /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/config-lexer.l b/src/config-lexer.l index e7a9afc..db4423c 100644 --- a/src/config-lexer.l +++ b/src/config-lexer.l @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/config-parser.y b/src/config-parser.y index 6db1406..e2f0bfb 100644 --- a/src/config-parser.y +++ b/src/config-parser.y @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/config.c b/src/config.c index 30a02ed..773bc3f 100644 --- a/src/config.c +++ b/src/config.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/config.h b/src/config.h index da468a5..caa0b53 100644 --- a/src/config.h +++ b/src/config.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/dnsbl.c b/src/dnsbl.c index 9082d7a..9299e5f 100644 --- a/src/dnsbl.c +++ b/src/dnsbl.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/dnsbl.h b/src/dnsbl.h index 746e4af..a40bbac 100644 --- a/src/dnsbl.h +++ b/src/dnsbl.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/firedns.c b/src/firedns.c index bcee5da..81bf214 100644 --- a/src/firedns.c +++ b/src/firedns.c @@ -43,6 +43,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "list.h" #include "log.h" #include "dnsbl.h" +#include "opm_gettime.h" #define FIREDNS_TRIES 3 @@ -602,7 +603,7 @@ firedns_send_requests(struct s_header *h, struct s_connection *s, int l) return -1; } - time(&s->start); + s->start = opm_gettime(); firedns_fdinuse++; firedns_errno = FDNS_ERR_NONE; @@ -799,7 +800,7 @@ firedns_cycle(void) if (ufds == NULL) ufds = xcalloc(sizeof(*ufds) * OptionsItem.dns_fdlimit); - time(&timenow); + timenow = opm_gettime(); LIST_FOREACH_SAFE(node, node_next, CONNECTIONS.head) { @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,6 +54,7 @@ #include "negcache.h" #include "memory.h" #include "main.h" +#include "opm_gettime.h" /* @@ -599,9 +600,16 @@ irc_init(void) if (IRCItem.tls_hostname_verification) { +#ifndef LIBRESSL_VERSION_NUMBER SSL_set_hostflags(ssl_handle, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS); if (SSL_set1_host(ssl_handle, IRCItem.server) == 0) +#else + X509_VERIFY_PARAM *param = SSL_get0_param(ssl_handle); + X509_VERIFY_PARAM_set_hostflags(param, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS); + + if (X509_VERIFY_PARAM_set1_host(param, IRCItem.server, 0) == 0) +#endif { log_printf("IRC -> unable to set expected DNS hostname"); /* OpenSSL is unable to verify the server hostname at this point, so we exit. */ @@ -657,20 +665,16 @@ irc_close(void) static void irc_connect(void) { - time_t present; - - time(&present); - /* Only try to reconnect every IRCItem.reconnectinterval seconds */ - if ((present - IRC_LASTRECONNECT) < IRCItem.reconnectinterval) + if ((opm_gettime() - IRC_LASTRECONNECT) < IRCItem.reconnectinterval) { /* Sleep to avoid excessive CPU */ sleep(1); return; } - time(&IRC_LASTRECONNECT); - time(&IRC_LAST); + IRC_LASTRECONNECT = + IRC_LAST = opm_gettime(); irc_init(); @@ -714,7 +718,7 @@ irc_connect(void) IRCItem.username, IRCItem.username, IRCItem.realname); - time(&IRC_LAST); + IRC_LAST = opm_gettime(); } /* irc_parse @@ -774,7 +778,7 @@ irc_parse(void) if (OPT_DEBUG >= 2) log_printf("IRC READ -> %s", IRC_RAW); - time(&IRC_LAST); + IRC_LAST = opm_gettime(); /* Store a copy of IRC_RAW for the handlers (for functions that need PROOF) */ strlcpy(msg, IRC_RAW, sizeof(msg)); @@ -1016,11 +1020,7 @@ irc_send_channels(const char *data, ...) void irc_timer(void) { - time_t present, delta; - - time(&present); - - delta = present - IRC_LAST; + time_t delta = opm_gettime() - IRC_LAST; /* No data in IRCItem.readtimeout seconds */ if (delta >= IRCItem.readtimeout) @@ -1029,7 +1029,7 @@ irc_timer(void) irc_close(); /* Make sure we don't do this again for a while */ - time(&IRC_LAST); + IRC_LAST = opm_gettime(); } else if (delta >= IRCItem.readtimeout / 2) { @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/libopm/src/Makefile.am b/src/libopm/src/Makefile.am index 7726c07..b0c9504 100644 --- a/src/libopm/src/Makefile.am +++ b/src/libopm/src/Makefile.am @@ -1,18 +1,20 @@ noinst_LTLIBRARIES = libopm.la -libopm_la_SOURCES = config.c \ - config.h \ - libopm.c \ - libopm.h \ - list.c \ - list.h \ - memory.c \ - memory.h \ - opm_common.h \ - opm_error.h \ - opm.h \ - opm_types.h \ - proxy.c \ +libopm_la_SOURCES = config.c \ + config.h \ + libopm.c \ + libopm.h \ + list.c \ + list.h \ + memory.c \ + memory.h \ + opm_common.h \ + opm_error.h \ + opm.h \ + opm_gettime.c \ + opm_gettime.h \ + opm_types.h \ + proxy.c \ proxy.h libopm_la_LIBADD = @LTLIBOBJS@ diff --git a/src/libopm/src/Makefile.in b/src/libopm/src/Makefile.in index 99bd4d1..4153926 100644 --- a/src/libopm/src/Makefile.in +++ b/src/libopm/src/Makefile.in @@ -112,7 +112,8 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libopm_la_DEPENDENCIES = @LTLIBOBJS@ -am_libopm_la_OBJECTS = config.lo libopm.lo list.lo memory.lo proxy.lo +am_libopm_la_OBJECTS = config.lo libopm.lo list.lo memory.lo \ + opm_gettime.lo proxy.lo libopm_la_OBJECTS = $(am_libopm_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -135,7 +136,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/config.Plo ./$(DEPDIR)/libopm.Plo \ ./$(DEPDIR)/list.Plo ./$(DEPDIR)/memory.Plo \ - ./$(DEPDIR)/proxy.Plo + ./$(DEPDIR)/opm_gettime.Plo ./$(DEPDIR)/proxy.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -307,19 +308,21 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libopm.la -libopm_la_SOURCES = config.c \ - config.h \ - libopm.c \ - libopm.h \ - list.c \ - list.h \ - memory.c \ - memory.h \ - opm_common.h \ - opm_error.h \ - opm.h \ - opm_types.h \ - proxy.c \ +libopm_la_SOURCES = config.c \ + config.h \ + libopm.c \ + libopm.h \ + list.c \ + list.h \ + memory.c \ + memory.h \ + opm_common.h \ + opm_error.h \ + opm.h \ + opm_gettime.c \ + opm_gettime.h \ + opm_types.h \ + proxy.c \ proxy.h libopm_la_LIBADD = @LTLIBOBJS@ @@ -381,6 +384,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libopm.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opm_gettime.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxy.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @@ -545,6 +549,7 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/libopm.Plo -rm -f ./$(DEPDIR)/list.Plo -rm -f ./$(DEPDIR)/memory.Plo + -rm -f ./$(DEPDIR)/opm_gettime.Plo -rm -f ./$(DEPDIR)/proxy.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ @@ -595,6 +600,7 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libopm.Plo -rm -f ./$(DEPDIR)/list.Plo -rm -f ./$(DEPDIR)/memory.Plo + -rm -f ./$(DEPDIR)/opm_gettime.Plo -rm -f ./$(DEPDIR)/proxy.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic diff --git a/src/libopm/src/libopm.c b/src/libopm/src/libopm.c index d6118ff..430a29d 100644 --- a/src/libopm/src/libopm.c +++ b/src/libopm/src/libopm.c @@ -44,6 +44,7 @@ #include "opm_error.h" #include "opm_types.h" #include "opm_common.h" +#include "opm_gettime.h" #include "list.h" #include "proxy.h" @@ -826,7 +827,7 @@ libopm_check_closed(OPM_T *scanner) if (LIST_SIZE(&scanner->scans) == 0) return; - time(&present); + present = opm_gettime(); timeout = *(int *)libopm_config(scanner->config, OPM_CONFIG_TIMEOUT); LIST_FOREACH_SAFE(node1, next1, scanner->scans.head) @@ -964,7 +965,7 @@ libopm_do_connect(OPM_T * scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn) #endif conn->state = OPM_STATE_ESTABLISHED; - time(&conn->creation); /* Stamp creation time, for timeout */ + conn->creation = opm_gettime(); /* Stamp creation time, for timeout */ } /* check_poll diff --git a/src/libopm/src/list.c b/src/libopm/src/list.c index eb237bc..aea809f 100644 --- a/src/libopm/src/list.c +++ b/src/libopm/src/list.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/libopm/src/list.h b/src/libopm/src/list.h index 20dbef2..ebd0cef 100644 --- a/src/libopm/src/list.h +++ b/src/libopm/src/list.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/libopm/src/memory.c b/src/libopm/src/memory.c index abde66b..d2c8c3a 100644 --- a/src/libopm/src/memory.c +++ b/src/libopm/src/memory.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/libopm/src/memory.h b/src/libopm/src/memory.h index 268be66..f841fe0 100644 --- a/src/libopm/src/memory.h +++ b/src/libopm/src/memory.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/libopm/src/opm_gettime.c b/src/libopm/src/opm_gettime.c new file mode 100644 index 0000000..e2107b3 --- /dev/null +++ b/src/libopm/src/opm_gettime.c @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2014-2021 ircd-hybrid development team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + */ + +#include <stdlib.h> + +#include "opm_gettime.h" + +time_t +opm_gettime(void) +{ + struct timespec ts; + +#ifdef CLOCK_MONOTONIC_RAW + if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts) == 0) +#elif CLOCK_MONOTONIC + if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) +#else + if (clock_gettime(CLOCK_REALTIME, &ts) == 0) +#endif + return ts.tv_sec; + + exit(EXIT_FAILURE); + return -1; +} diff --git a/src/libopm/src/opm_gettime.h b/src/libopm/src/opm_gettime.h new file mode 100644 index 0000000..cba52fb --- /dev/null +++ b/src/libopm/src/opm_gettime.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2014-2021 ircd-hybrid development team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + */ + +#ifndef OPM_GETTIME_H +#define OPM_GETTIME_H + +#include <time.h> + +extern time_t opm_gettime(void); +#endif + @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/match.c b/src/match.c index 7d00da3..3f5473b 100644 --- a/src/match.c +++ b/src/match.c @@ -1,7 +1,7 @@ /* * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) * - * Copyright (c) 1997-2020 ircd-hybrid development team + * Copyright (c) 1997-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/match.h b/src/match.h index 5ca4b0d..f0b38ba 100644 --- a/src/match.h +++ b/src/match.h @@ -1,7 +1,7 @@ /* * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) * - * Copyright (c) 1997-2020 ircd-hybrid development team + * Copyright (c) 1997-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/memory.c b/src/memory.c index 8e9178d..54347d6 100644 --- a/src/memory.c +++ b/src/memory.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/memory.h b/src/memory.h index a3970fa..67833dc 100644 --- a/src/memory.h +++ b/src/memory.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/negcache.c b/src/negcache.c index 4a36b2a..236b006 100644 --- a/src/negcache.c +++ b/src/negcache.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Andy Smith - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,6 +37,7 @@ #include "config.h" #include "memory.h" #include "log.h" +#include "opm_gettime.h" extern unsigned int OPT_DEBUG; @@ -72,7 +73,7 @@ negcache_check(const char *ipstr) { struct negcache_item *n = pnode->data; - if (time(NULL) - n->seen <= OptionsItem.negcache) + if (opm_gettime() - n->seen <= OptionsItem.negcache) return n; } @@ -91,7 +92,7 @@ negcache_insert(const char *ipstr) return; /* Malformed IP address or already added to the trie */ struct negcache_item *n = xcalloc(sizeof(*n)); - n->seen = time(NULL); + n->seen = opm_gettime(); pnode->data = n; list_add(pnode, &n->node, &negcache_list); @@ -104,13 +105,14 @@ void negcache_rebuild(void) { node_t *node, *node_next; + time_t present = opm_gettime(); LIST_FOREACH_SAFE(node, node_next, negcache_list.head) { patricia_node_t *pnode = node->data; struct negcache_item *n = pnode->data; - if (n->seen + OptionsItem.negcache < time(NULL)) + if (n->seen + OptionsItem.negcache < present) { if (OPT_DEBUG >= 2) log_printf("NEGCACHE -> Deleting expired negcache node for %s added at %lu", diff --git a/src/negcache.h b/src/negcache.h index 625dcd0..6526b9a 100644 --- a/src/negcache.h +++ b/src/negcache.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Andy Smith - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/opercmd.c b/src/opercmd.c index 8cc6bf7..cb1ed37 100644 --- a/src/opercmd.c +++ b/src/opercmd.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,6 +35,7 @@ #include "scan.h" #include "memory.h" #include "stats.h" +#include "opm_gettime.h" static list_t COMMANDS; /* List of active commands */ @@ -108,8 +109,7 @@ command_create(const struct OperCommandHash *tab, const char *param, const char command->tab = tab; command->irc_nick = xstrdup(irc_nick); command->target = target; - - time(&command->added); + command->added = opm_gettime(); return command; } @@ -226,7 +226,7 @@ command_timer(void) { static unsigned int interval; node_t *node, *node_next; - time_t present; + time_t present = opm_gettime(); /* Only perform command removal every OptionsItem.command_interval seconds */ if (interval++ < OptionsItem.command_interval) @@ -234,8 +234,6 @@ command_timer(void) else interval = 0; - time(&present); - LIST_FOREACH_SAFE(node, node_next, COMMANDS.head) { struct Command *command = node->data; diff --git a/src/opercmd.h b/src/opercmd.h index 1a77c07..1d9010d 100644 --- a/src/opercmd.h +++ b/src/opercmd.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/patchlevel.h b/src/patchlevel.h index 415cdac..8950374 100644 --- a/src/patchlevel.h +++ b/src/patchlevel.h @@ -4,5 +4,5 @@ */ #ifndef PATCHLEVEL -#define PATCHLEVEL "hopm-1.1.9" +#define PATCHLEVEL "hopm-1.1.10" #endif @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/stats.c b/src/stats.c index dd0ac8c..af6a545 100644 --- a/src/stats.c +++ b/src/stats.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,7 +34,8 @@ #include "misc.h" #include "config.h" #include "stats.h" -#include "libopm/src/opm_types.h" +#include "opm_types.h" +#include "opm_gettime.h" static time_t STATS_UPTIME; static unsigned int STATS_CONNECTIONS; @@ -67,7 +68,7 @@ static struct StatsHash STATS_PROXIES[] = void stats_init(void) { - time(&STATS_UPTIME); + STATS_UPTIME = opm_gettime(); } /* stats_openproxy @@ -147,13 +148,9 @@ stats_dnsblsend(void) void stats_output(const char *target) { - time_t present; - time_t uptime; + time_t uptime = opm_gettime() - STATS_UPTIME; node_t *p; - time(&present); - uptime = present - STATS_UPTIME; - irc_send("PRIVMSG %s :Uptime: %s", target, time_dissect(uptime)); LIST_FOREACH(p, OpmItem.blacklists.head) diff --git a/src/stats.h b/src/stats.h index fba780c..972cfb1 100644 --- a/src/stats.h +++ b/src/stats.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |
