srvx-commits Mailing List for srvx IRC Services (Page 3)
Brought to you by:
entrope
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(80) |
Sep
(51) |
Oct
(94) |
Nov
(132) |
Dec
(85) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(163) |
Feb
(96) |
Mar
(70) |
Apr
(182) |
May
(173) |
Jun
(73) |
Jul
(101) |
Aug
(101) |
Sep
(71) |
Oct
(76) |
Nov
(58) |
Dec
(60) |
2003 |
Jan
(61) |
Feb
(14) |
Mar
(3) |
Apr
|
May
(7) |
Jun
(22) |
Jul
(81) |
Aug
(41) |
Sep
(34) |
Oct
(41) |
Nov
(16) |
Dec
(28) |
2004 |
Jan
(7) |
Feb
|
Mar
(3) |
Apr
(15) |
May
(11) |
Jun
(1) |
Jul
(4) |
Aug
(1) |
Sep
(4) |
Oct
(1) |
Nov
(1) |
Dec
(1) |
2005 |
Jan
(13) |
Feb
(6) |
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2010 |
Jan
(2) |
Feb
(3) |
Mar
(4) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2012 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2025 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Entrope <en...@us...> - 2009-03-06 12:50:43
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "srvx". The annotated tag, v1.4.0-rc3 has been created at 115d79653c3a63509fc7cc488bb455516dacdbd5 (tag) tagging 60b67210c87b61b0dcfb377cb892b151b67dd2ae (commit) replaces v1.4.0-rc2 tagged by Michael Poole on Fri Jul 11 23:39:51 2008 -0400 - Log ----------------------------------------------------------------- Release candidate 3 of version 1.4.0 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBIeCepY4N+PhZk3FoRAm8PAKCkhtC/ESjltw2x6J2jgryIgc3ZBQCg2BkF PfwElhj8VPy0D4Swio/TE0c= =t+CE -----END PGP SIGNATURE----- Michael Poole (7): Avoid crash when logging a HelpServ request with no request log file. Properly handle collisions during burst with persistent local clients. Support sending and receiving account timestamps (but ignore them for now). Allow NickServ to ignore accounts if the user's account create ts is wrong. Update UPGRADE file for srvx-1.4. Correctly handle a writable->unwritable transition on a socket in kevent. Simplify README and update it to mention the FAQ file. ----------------------------------------------------------------------- hooks/post-receive -- srvx |
From: Michael P. <md...@tr...> - 2005-07-19 18:31:53
|
Revision: srvx--devo--1.3--patch-25 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Tue Jul 19 14:31:26 EDT 2005 Standard-date: 2005-07-19 18:31:26 GMT Modified-files: ChangeLog src/opserv.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-25 Summary: Properly check alerts based on numchannels criteria Keywords: src/opserv.c (opserv_add_user_alert): Channel alerts also include ones with non-zero min_channels. Allow an alert to be both channel-based and nick-based. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-25 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,21 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-07-19 18:31:26 GMT Michael Poole <md...@tr...> patch-25 + + Summary: + Properly check alerts based on numchannels criteria + Revision: + srvx--devo--1.3--patch-25 + + src/opserv.c (opserv_add_user_alert): Channel alerts also include ones + with non-zero min_channels. Allow an alert to be both channel-based + and nick-based. + + modified files: + ChangeLog src/opserv.c + + 2005-07-19 18:18:48 GMT Michael Poole <md...@tr...> patch-24 Summary: --- orig/src/opserv.c +++ mod/src/opserv.c @@ -2562,9 +2562,14 @@ alert->discrim->reason = strdup(name); alert->reaction = reaction; dict_insert(opserv_user_alerts, name_dup, alert); - if (alert->discrim->channel) + /* Stick the alert into the appropriate additional alert dict(s). + * For channel alerts, we only use channels and min_channels; + * max_channels would have to be checked on /part, which we do not + * yet do, and which seems of questionable value. + */ + if (alert->discrim->channel || alert->discrim->min_channels) dict_insert(opserv_channel_alerts, name_dup, alert); - else if (alert->discrim->mask_nick) + if (alert->discrim->mask_nick) dict_insert(opserv_nick_based_alerts, name_dup, alert); return alert; } |
From: Michael P. <md...@tr...> - 2005-07-19 18:19:19
|
Revision: srvx--devo--1.3--patch-24 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Tue Jul 19 14:18:48 EDT 2005 Standard-date: 2005-07-19 18:18:48 GMT Modified-files: ChangeLog configure.in languages/validate.pl src/chanserv.c src/ioset.c src/ioset.h src/nickserv.c src/opserv.c src/proto-p10.c src/proto.h src/saxdb.c {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-71 {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-76 {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-77 {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-81 {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-84 {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-22 {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-23 New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-24 Summary: Fix gcc-4.0 compile warnings and errors. Keywords: configure.in: Make sure socklen_t is defined. src/chanserv.c (bad_channel_ban): Make victimCount unsigned. src/ioset.c (ioset_run): Fifth argument to getsockopt() should be socklen_t. src/ioset.h (clock_skew): Undeclare; it is defined as static. src/nickserv.c (is_secure_password): Create appropriately typed local variable for third argument of dict_find(). src/opserv.c (opserv_bad_channel): Likewise. src/proto-p10.c (call_oper_funcs): Declare at file scope rather than locally to mod_usermode() function. src/proto.h (dead_users): Undeclare; it is defined as static. src/saxdb.c (saxdb_write_int): Fix type of string buffer. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-24 * file metadata changed ./languages/validate.pl --permissions 664 => --permissions 775 ./{arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-71 --permissions 644 => --permissions 664 ./{arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-76 --permissions 644 => --permissions 664 ./{arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-77 --permissions 644 => --permissions 664 ./{arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-81 --permissions 644 => --permissions 664 ./{arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-84 --permissions 644 => --permissions 664 ./{arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-22 --permissions 644 => --permissions 664 ./{arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-23 --permissions 644 => --permissions 664 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,47 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-07-19 18:18:48 GMT Michael Poole <md...@tr...> patch-24 + + Summary: + Fix gcc-4.0 compile warnings and errors. + Revision: + srvx--devo--1.3--patch-24 + + configure.in: Make sure socklen_t is defined. + + src/chanserv.c (bad_channel_ban): Make victimCount unsigned. + + src/ioset.c (ioset_run): Fifth argument to getsockopt() should be + socklen_t. + + src/ioset.h (clock_skew): Undeclare; it is defined as static. + + src/nickserv.c (is_secure_password): Create appropriately typed local + variable for third argument of dict_find(). + + src/opserv.c (opserv_bad_channel): Likewise. + + src/proto-p10.c (call_oper_funcs): Declare at file scope rather than + locally to mod_usermode() function. + + src/proto.h (dead_users): Undeclare; it is defined as static. + + src/saxdb.c (saxdb_write_int): Fix type of string buffer. + + modified files: + ChangeLog configure.in languages/validate.pl src/chanserv.c + src/ioset.c src/ioset.h src/nickserv.c src/opserv.c + src/proto-p10.c src/proto.h src/saxdb.c + {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-71 + {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-76 + {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-77 + {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-81 + {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-84 + {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-22 + {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-23 + + 2005-07-04 00:37:07 GMT Zoot <zo...@ga...> patch-23 Summary: --- orig/configure.in +++ mod/configure.in @@ -2,8 +2,8 @@ dnl General initialization. AC_REVISION([$Id: configure.in,v 1.77 2004/01/02 01:49:15 entrope Exp $]) -AC_PREREQ(2.57) -AC_INIT(srvx, 1.3, srv...@li...) +AC_PREREQ(2.59) +AC_INIT([srvx],[1.3],[srv...@li...]) CODENAME=surge AC_CONFIG_HEADERS(src/config.h) AC_CONFIG_SRCDIR(src/opserv.c) @@ -96,6 +96,32 @@ AC_DEFINE(HAVE_SIN_LEN, 1, [Define if struct sockaddr_in contains a sin_len field]) fi +dnl Check for socklen_t. In traditional BSD this is an int, but some +dnl OSes use a different type. Test until we find something that will +dnl work properly. Test borrowed from a patch submitted for Python. +AC_CHECK_TYPE([socklen_t], ,[ + AC_MSG_CHECKING([for socklen_t equivalent]) + AC_CACHE_VAL([curl_cv_socklen_t_equiv], + [ +dnl Systems have either "struct sockaddr*" or "void*" as second +dnl arg to getpeername. + curl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void ; do + for t in int size_t unsigned long "unsigned long" ; do + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> +#include <sys/socket.h> +int getpeername (int $arg2 *, $t *);]], [[$t len; + getpeername(0, 0, &len);]])],[curl_cv_socklen_t_equiv="$t" + break],[]) + done + done + ]) + AC_MSG_RESULT($curl_cv_socklen_t_equiv) + AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined])], + [#include <sys/types.h> +#include<sys/socket.h>]) + dnl Can only check with -Werror, but the rest of configure doesn't like -Werror OLD_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -W -Wall -Werror" --- orig/src/chanserv.c +++ mod/src/chanserv.c @@ -2677,7 +2677,7 @@ } static int -bad_channel_ban(struct chanNode *channel, struct userNode *user, const char *ban, int *victimCount, struct modeNode **victims) +bad_channel_ban(struct chanNode *channel, struct userNode *user, const char *ban, unsigned int *victimCount, struct modeNode **victims) { unsigned int ii; --- orig/src/ioset.c +++ mod/src/ioset.c @@ -406,7 +406,10 @@ fd->readable_cb(fd); } if (FD_ISSET(nn, &write_fds) && !fd->connected) { - int rc, arglen = sizeof(rc); + socklen_t arglen; + int rc; + + arglen = sizeof(rc); if (getsockopt(fd->fd, SOL_SOCKET, SO_ERROR, &rc, &arglen) < 0) rc = errno; fd->connected = 1; --- orig/src/ioset.h +++ mod/src/ioset.h @@ -44,7 +44,6 @@ void (*destroy_cb)(struct io_fd *fd); }; -extern int clock_skew; extern int do_write_dbs; extern int do_reopen; --- orig/src/nickserv.c +++ mod/src/nickserv.c @@ -750,6 +750,8 @@ { unsigned int i, len; unsigned int cnt_digits = 0, cnt_upper = 0, cnt_lower = 0; + int p; + len = strlen(pass); if (len < nickserv_conf.password_min_length) { if (user) @@ -761,8 +763,8 @@ send_message(user, nickserv, "NSMSG_PASSWORD_ACCOUNT"); return 0; } - dict_find(nickserv_conf.weak_password_dict, pass, &i); - if (i) { + dict_find(nickserv_conf.weak_password_dict, pass, &p); + if (p) { if (user) send_message(user, nickserv, "NSMSG_PASSWORD_DICTIONARY"); return 0; --- orig/src/opserv.c +++ mod/src/opserv.c @@ -1801,9 +1801,10 @@ opserv_bad_channel(const char *name) { unsigned int found; + int present; - dict_find(opserv_exempt_channels, name, &found); - if (found) + dict_find(opserv_exempt_channels, name, &present); + if (present) return 0; if (gline_find(name)) --- orig/src/proto-p10.c +++ mod/src/proto-p10.c @@ -1987,8 +1987,9 @@ free_user(user); } +static void call_oper_funcs(struct userNode *user); + void mod_usermode(struct userNode *user, const char *mode_change) { - static void call_oper_funcs(struct userNode *user); int add = 1; const char *word = mode_change; --- orig/src/proto.h +++ mod/src/proto.h @@ -108,8 +108,6 @@ typedef void (*oper_func_t) (struct userNode *user); void reg_oper_func(oper_func_t handler); -extern struct userList dead_users; - /* replay silliness */ void replay_read_line(void); void replay_event_loop(void); --- orig/src/saxdb.c +++ mod/src/saxdb.c @@ -296,7 +296,7 @@ void saxdb_write_int(struct saxdb_context *dest, const char *name, unsigned long value) { - unsigned char buf[16]; + char buf[16]; /* we could optimize this to take advantage of the fact that buf will never need escapes */ snprintf(buf, sizeof(buf), "%lu", value); saxdb_write_string(dest, name, buf); |
From: Neateye <nit...@ao...> - 2005-06-01 19:14:37
|
Call out Gouranga be happy!!! Gouranga Gouranga Gouranga .... That which brings the highest happiness!! |
From: Michael P. <md...@tr...> - 2005-05-30 15:15:22
|
Revision: srvx--devo--1.3--patch-21 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Mon May 30 11:14:56 EDT 2005 Standard-date: 2005-05-30 15:14:56 GMT Modified-files: ChangeLog src/tools.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-21 Summary: Make match_ircglob() work more like the ircd. Keywords: src/tools.c (match_ircglob): Limit glob backtracking in the same way that ircds generally do. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-21 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,20 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-05-30 15:14:56 GMT Michael Poole <md...@tr...> patch-21 + + Summary: + Make match_ircglob() work more like the ircd. + Revision: + srvx--devo--1.3--patch-21 + + src/tools.c (match_ircglob): Limit glob backtracking in the same way + that ircds generally do. + + modified files: + ChangeLog src/tools.c + + 2005-05-01 17:16:58 GMT Michael Poole <md...@tr...> patch-20 Summary: --- orig/src/tools.c +++ mod/src/tools.c @@ -245,63 +245,57 @@ int match_ircglob(const char *text, const char *glob) { - unsigned int star_p, q_cnt; - while (1) { - switch (*glob) { - case 0: - return !*text; - case '\\': - glob++; - /* intentionally not tolower(...) so people can force - * capitalization, or we can overload \ in the future */ - if (*text++ != *glob++) - return 0; - break; - case '*': - case '?': - star_p = q_cnt = 0; - do { - if (*glob == '*') - star_p = 1; - else if (*glob == '?') - q_cnt++; - else - break; - glob++; - } while (1); - while (q_cnt) { - if (!*text++) - return 0; - q_cnt--; - } - if (star_p) { - /* if this is the last glob character, it will match any text */ - if (!*glob) - return 1; - /* Thanks to the loop above, we know that the next - * character is a normal character. So just look for - * the right character. - */ - for (; *text; text++) { - if ((tolower(*text) == tolower(*glob)) - && match_ircglob(text+1, glob+1)) { - return 1; - } - } - return 0; - } - /* if !star_p, fall through to normal character case, - * first checking to see if ?s carried us to the end */ - if (!*glob && !*text) + const char *m = glob, *n = text; + const char *m_tmp = glob, *n_tmp = text; + int star_p; + + for (;;) switch (*m) { + case '\0': + if (!*n) + return 1; + backtrack: + if (m_tmp == glob) + return 0; + m = m_tmp; + n = ++n_tmp; + break; + case '\\': + m++; + /* allow escaping to force capitalization */ + if (*m++ != *n++) + return 0; + break; + case '*': case '?': + for (star_p = 0; ; m++) { + if (*m == '*') + star_p = 1; + else if (*m == '?') { + if (!*n++) + goto backtrack; + } else break; + } + if (star_p) { + if (!*m) return 1; - default: - if (!*text) - return 0; - while (*text && *glob && *glob != '*' && *glob != '?' && *glob != '\\') { - if (tolower(*text++) != tolower(*glob++)) + else if (*m == '\\') { + m_tmp = ++m; + if (!*m) return 0; - } - } + for (n_tmp = n; *n && *n != *m; n++) ; + } else { + m_tmp = m; + for (n_tmp = n; *n && tolower(*n) != tolower(*m); n++) ; + } + } + /* and fall through */ + default: + if (!*n) + return *m != '\0'; + if (tolower(*m) != tolower(*n)) + goto backtrack; + m++; + n++; + break; } } |
From: Michael P. <md...@tr...> - 2005-05-01 17:17:26
|
Revision: srvx--devo--1.3--patch-20 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Sun May 1 13:16:58 EDT 2005 Standard-date: 2005-05-01 17:16:58 GMT New-directories: languages/en_GB/.arch-ids Removed-directories: languages/en_UK/.arch-ids Renamed-files: languages/en_UK/.arch-ids/=id languages/en_GB/.arch-ids/=id languages/en_UK/.arch-ids/README.id languages/en_GB/.arch-ids/README.id languages/en_UK/.arch-ids/chanserv.help.id languages/en_GB/.arch-ids/chanserv.help.id languages/en_UK/.arch-ids/opserv.help.id languages/en_GB/.arch-ids/opserv.help.id languages/en_UK/.arch-ids/strings.db.id languages/en_GB/.arch-ids/strings.db.id Renamed-directories: languages/en_UK languages/en_GB Modified-files: ChangeLog FAQ src/nickserv.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-20 Summary: Fix en_GB language name, fix NickServ mergedb command. Keywords: FAQ: Clarify FAQ #8. src/nickserv.c: Avoid losing channel information when replacing an account using the mergedb command. languages/en_UK: Rename to en_GB. * removed directories languages/en_UK/.arch-ids * added directories languages/en_GB/.arch-ids * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-20 * renamed files and symlinks languages/en_UK/.arch-ids/=id => languages/en_GB/.arch-ids/=id languages/en_UK/.arch-ids/README.id => languages/en_GB/.arch-ids/README.id languages/en_UK/.arch-ids/chanserv.help.id => languages/en_GB/.arch-ids/chanserv.help.id languages/en_UK/.arch-ids/opserv.help.id => languages/en_GB/.arch-ids/opserv.help.id languages/en_UK/.arch-ids/strings.db.id => languages/en_GB/.arch-ids/strings.db.id * renamed directories languages/en_UK => languages/en_GB * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,46 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-05-01 17:16:58 GMT Michael Poole <md...@tr...> patch-20 + + Summary: + Fix en_GB language name, fix NickServ mergedb command. + Revision: + srvx--devo--1.3--patch-20 + + FAQ: Clarify FAQ #8. + + src/nickserv.c: Avoid losing channel information when replacing an + account using the mergedb command. + + languages/en_UK: Rename to en_GB. + + modified files: + ChangeLog FAQ src/nickserv.c + + renamed files: + languages/en_UK/.arch-ids/=id + ==> languages/en_GB/.arch-ids/=id + languages/en_UK/.arch-ids/README.id + ==> languages/en_GB/.arch-ids/README.id + languages/en_UK/.arch-ids/chanserv.help.id + ==> languages/en_GB/.arch-ids/chanserv.help.id + languages/en_UK/.arch-ids/opserv.help.id + ==> languages/en_GB/.arch-ids/opserv.help.id + languages/en_UK/.arch-ids/strings.db.id + ==> languages/en_GB/.arch-ids/strings.db.id + + new directories: + languages/en_GB/.arch-ids + + removed directories: + languages/en_UK/.arch-ids + + renamed directories: + languages/en_UK + ==> languages/en_GB + + 2005-03-15 23:12:58 GMT Michael Poole <md...@tr...> patch-19 Summary: --- orig/FAQ +++ mod/FAQ @@ -52,8 +52,9 @@ see the comment near the start of src/mod-memoserv.c for configuration options. -Q8) How do I enable both HelpServ and MemoServ? In addition to the -configuration steps above, you must mention both when you run the -configure script. For example, run it using "./configure ---enable-modules=memoserv,helpserv". (You may add the snoop and/or -sockcheck modules as well; separate the module names with commas.) +Q8) How do I enable both HelpServ and MemoServ? +A8) In addition to the post-install configuration steps above, you +must mention both when you run the configure script. For example, run +it using "./configure --enable-modules=memoserv,helpserv". (You may +add the snoop and/or sockcheck modules as well; separate the module +names with commas.) --- orig/src/nickserv.c +++ mod/src/nickserv.c @@ -3215,6 +3215,7 @@ struct string_list *masks, *slist; struct handle_info *hi; struct userNode *authed_users; + struct userData *channels; unsigned long int id; unsigned int ii; dict_t subdb; @@ -3228,10 +3229,13 @@ } if ((hi = get_handle_info(handle))) { authed_users = hi->users; + channels = hi->channels; hi->users = NULL; + hi->channels = NULL; dict_remove(nickserv_handle_dict, hi->handle); } else { authed_users = NULL; + channels = NULL; } hi = register_handle(handle, str, id); if (authed_users) { @@ -3241,6 +3245,7 @@ authed_users = authed_users->next_authed; } } + hi->channels = channels; masks = database_get_data(obj, KEY_MASKS, RECDB_STRING_LIST); hi->masks = masks ? string_list_copy(masks) : alloc_string_list(1); str = database_get_data(obj, KEY_MAXLOGINS, RECDB_QSTRING); |
From: Michael P. <md...@tr...> - 2005-03-15 23:13:41
|
Revision: srvx--devo--1.3--patch-19 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Tue Mar 15 18:12:58 EST 2005 Standard-date: 2005-03-15 23:12:58 GMT Modified-files: ChangeLog src/nickserv.help src/opserv.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-19 Summary: Clarify NickServ REGISTER help messages; fix ?raw and ?dump errors. Keywords: src/nickserv.help (REGISTER): Rephrase the message about using the same password to hopefully make it clearer. src/opserv.c (cmd_dump, cmd_raw): Use local buffers to hold the original message, so that parse_line() will not unsplit the line into the "original" buffer and strip out the sentinel :. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-19 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,24 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-03-15 23:12:58 GMT Michael Poole <md...@tr...> patch-19 + + Summary: + Clarify NickServ REGISTER help messages; fix ?raw and ?dump errors. + Revision: + srvx--devo--1.3--patch-19 + + src/nickserv.help (REGISTER): Rephrase the message about using the + same password to hopefully make it clearer. + + src/opserv.c (cmd_dump, cmd_raw): Use local buffers to hold the + original message, so that parse_line() will not unsplit the line into + the "original" buffer and strip out the sentinel :. + + modified files: + ChangeLog src/nickserv.help src/opserv.c + + 2005-02-17 21:42:43 GMT Michael Poole <md...@tr...> patch-18 Summary: --- orig/src/nickserv.help +++ mod/src/nickserv.help @@ -340,19 +340,19 @@ "REGISTER" { "0: /services/nickserv/email_required" ( "/msg $N@$s REGISTER <account> <password> <email>", - "Registers a specified account with $b$N$b, adding your current user@host to your new account. You must the password you specify with $bregister$b to use $bauth$b to authenticate to your account.", + "Registers a specified account with $b$N$b, adding your current user@host to your new account. You must use the same password with $bauth$b to authenticate to your account.", "An email will be sent to the email address you give containing a cookie that will let you activate your account. Once you have that cookie, you must use the $bcookie$b command to be able to use your account.", "$uSee Also:$u auth, unregister" ); "1: /services/nickserv/email_enabled" ( "/msg $N@$s REGISTER <account> <password> [email]", - "Registers a specified account with $b$N$b, adding your current user@host to your new account. You must the password you specify with $bregister$b to use $bauth$b to authenticate to your account.", + "Registers a specified account with $b$N$b, adding your current user@host to your new account. You must use the same password with $bauth$b to authenticate to your account.", "If you specify an email address, an email will be sent to it containing a cookie that will let you activate your account. Once you have that cookie, you must use the $bcookie$b command to be able to use your account.", "$uSee Also:$u auth, unregister" ); "2: !/services/nickserv/email_enabled" ( "/msg $N@$s REGISTER <account> <password>", - "Registers a specified account with $b$N$b, adding your current user@host to your new account. You must the password you specify with $bregister$b to use $bauth$b to authenticate to your account.", + "Registers a specified account with $b$N$b, adding your current user@host to your new account. You must use the same password with $bauth$b to authenticate to your account.", "$uSee Also:$u auth, unregister" ); }; --- orig/src/opserv.c +++ mod/src/opserv.c @@ -1604,9 +1604,9 @@ static MODCMD_FUNC(cmd_dump) { - char linedup[MAXLEN], *original; + char linedup[MAXLEN], original[MAXLEN]; - original = unsplit_string(argv+1, argc-1, NULL); + unsplit_string(argv+1, argc-1, original); safestrncpy(linedup, original, sizeof(linedup)); /* assume it's only valid IRC if we can parse it */ if (parse_line(linedup, 1)) { @@ -1619,9 +1619,9 @@ static MODCMD_FUNC(cmd_raw) { - char linedup[MAXLEN], *original; + char linedup[MAXLEN], original[MAXLEN]; - original = unsplit_string(argv+1, argc-1, NULL); + unsplit_string(argv+1, argc-1, original); safestrncpy(linedup, original, sizeof(linedup)); /* Try to parse the line before sending it; if it's too wrong, * maybe it will core us instead of our uplink. */ |
From: Michael P. <md...@tr...> - 2005-02-17 21:43:20
|
Revision: srvx--devo--1.3--patch-18 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Thu Feb 17 16:42:43 EST 2005 Standard-date: 2005-02-17 21:42:43 GMT Modified-files: ChangeLog src/hash.c src/mod-helpserv.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-18 Summary: Fix registered channel desync; fix HelpServ crash for old cfg files Keywords: src/hash.c (AddChannelUser): Do not give ops to the first user to join a persistent channel. src/helpserv.c (helpserv_conf_read): Use a default description for bots. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-18 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,22 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-02-17 21:42:43 GMT Michael Poole <md...@tr...> patch-18 + + Summary: + Fix registered channel desync; fix HelpServ crash for old cfg files + Revision: + srvx--devo--1.3--patch-18 + + src/hash.c (AddChannelUser): Do not give ops to the first user to join + a persistent channel. + + src/helpserv.c (helpserv_conf_read): Use a default description for bots. + + modified files: + ChangeLog src/hash.c src/mod-helpserv.c + + 2005-02-11 03:10:49 GMT Michael Poole <md...@tr...> patch-17 Summary: --- orig/src/hash.c +++ mod/src/hash.c @@ -474,7 +474,8 @@ modeList_append(&channel->members, mNode); modeList_append(&user->channels, mNode); - if (channel->members.used == 1) + if (channel->members.used == 1 + && !(channel->modes & MODE_REGISTERED)) mNode->modes |= MODE_CHANOP; for (n=0; n<jf_used; n++) { --- orig/src/mod-helpserv.c +++ mod/src/mod-helpserv.c @@ -3648,7 +3648,7 @@ helpserv_conf.db_backup_frequency = str ? ParseInterval(str) : 7200; str = database_get_data(conf_node, "description", RECDB_QSTRING); - helpserv_conf.description = str; + helpserv_conf.description = str ? str : "Help Queue Manager"; str = database_get_data(conf_node, "reqlogfile", RECDB_QSTRING); if (str && strlen(str)) |
From: Michael P. <md...@tr...> - 2005-02-11 03:15:54
|
Revision: srvx--devo--1.3--patch-17 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Thu Feb 10 22:10:49 EST 2005 Standard-date: 2005-02-11 03:10:49 GMT Modified-files: ChangeLog configure.in src/nickserv.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-17 Summary: Mention 'slab' in --with-malloc docs. Merge fakehosts when merging accounts. Keywords: configure.in (--with-malloc): Mention the awesome 'slab' allocator option. src/nickserv.c (cmd_merge): Copy fakehost to target account if appropriate. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-17 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,21 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-02-11 03:10:49 GMT Michael Poole <md...@tr...> patch-17 + + Summary: + Mention 'slab' in --with-malloc docs. Merge fakehosts when merging accounts. + Revision: + srvx--devo--1.3--patch-17 + + configure.in (--with-malloc): Mention the awesome 'slab' allocator option. + + src/nickserv.c (cmd_merge): Copy fakehost to target account if appropriate. + + modified files: + ChangeLog configure.in src/nickserv.c + + 2005-02-08 04:42:43 GMT Michael Poole <md...@tr...> patch-16 Summary: --- orig/configure.in +++ mod/configure.in @@ -152,7 +152,7 @@ AC_MSG_CHECKING(which malloc to use) AC_ARG_WITH(malloc, [ --with-malloc=type Enables use of a special malloc library; one of: - system (the default), boehm-gc, dmalloc, mpatrol, srvx], + system (the default), boehm-gc, dmalloc, mpatrol, srvx, slab], [], [withval="system"]) if test "x$withval" = "xsystem" ; then --- orig/src/nickserv.c +++ mod/src/nickserv.c @@ -2860,6 +2860,13 @@ if (hi_from->lastseen > hi_to->lastseen) hi_to->lastseen = hi_from->lastseen; + /* Does a fakehost carry over? (This intentionally doesn't set it + * for users previously attached to hi_to. They'll just have to + * reconnect.) + */ + if (hi_from->fakehost && !hi_to->fakehost) + hi_to->fakehost = strdup(hi_from->fakehost); + /* Notify of success. */ sprintf(buffer, "%s (%s) merged account %s into %s.", user->nick, user->handle_info->handle, hi_from->handle, hi_to->handle); reply("NSMSG_HANDLES_MERGED", hi_from->handle, hi_to->handle); |
From: Michael P. <md...@tr...> - 2005-02-08 04:43:17
|
Revision: srvx--devo--1.3--patch-16 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Mon Feb 7 23:42:43 EST 2005 Standard-date: 2005-02-08 04:42:43 GMT Modified-files: ChangeLog src/proto-common.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-16 Summary: Fix memory corruption when removing certain bans from a channel. Keywords: src/proto-common.c (mod_chanmode_apply): Make sure we get a pointer to the ban we want to deallocate BEFORE we remove it from the banlist. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-16 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,20 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-02-08 04:42:43 GMT Michael Poole <md...@tr...> patch-16 + + Summary: + Fix memory corruption when removing certain bans from a channel. + Revision: + srvx--devo--1.3--patch-16 + + src/proto-common.c (mod_chanmode_apply): Make sure we get a pointer to + the ban we want to deallocate BEFORE we remove it from the banlist. + + modified files: + ChangeLog src/proto-common.c + + 2005-02-05 13:03:21 GMT Michael Poole <md...@tr...> patch-15 Summary: --- orig/src/proto-common.c +++ mod/src/proto-common.c @@ -569,9 +569,10 @@ * to be more specific than an existing ban. */ for (jj=0; jj<channel->banlist.used; ++jj) { - if (match_ircglobs(change->args[ii].u.hostmask, channel->banlist.list[jj]->ban)) { - banList_remove(&channel->banlist, channel->banlist.list[jj]); - free(channel->banlist.list[jj]); + bn = channel->banlist.list[jj]; + if (match_ircglobs(change->args[ii].u.hostmask, bn->ban)) { + banList_remove(&channel->banlist, bn); + free(bn); jj--; } } @@ -586,10 +587,11 @@ break; case MODE_REMOVE|MODE_BAN: for (jj=0; jj<channel->banlist.used; ++jj) { - if (strcmp(channel->banlist.list[jj]->ban, change->args[ii].u.hostmask)) + bn = channel->banlist.list[jj]; + if (strcmp(bn->ban, change->args[ii].u.hostmask)) continue; - free(channel->banlist.list[jj]); - banList_remove(&channel->banlist, channel->banlist.list[jj]); + free(bn); + banList_remove(&channel->banlist, bn); break; } break; |
From: Michael P. <md...@tr...> - 2005-02-05 13:04:05
|
Revision: srvx--devo--1.3--patch-15 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Sat Feb 5 08:03:21 EST 2005 Standard-date: 2005-02-05 13:03:21 GMT Modified-files: ChangeLog src/alloc-slab.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-15 Summary: Rearrange slab allocation header; minor slab fixes. Keywords: src/alloc-slab.c (ALLOC_MAGIC, FREE_MAGIC): Replace with single-byte values. (struct alloc_header): Move file_id and line into second 32-bit word of header. (slab_alloc): Remove commented-out debug statements. (slab_unalloc): Remove memset() of freed block and commented-out debug statements. (slab_free): memset() freed blocks here instead. Try to fix *_alloc_size counting errors (use the originally requested length rather than rounded-up length) * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-15 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,27 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-02-05 13:03:21 GMT Michael Poole <md...@tr...> patch-15 + + Summary: + Rearrange slab allocation header; minor slab fixes. + Revision: + srvx--devo--1.3--patch-15 + + src/alloc-slab.c (ALLOC_MAGIC, FREE_MAGIC): Replace with single-byte values. + (struct alloc_header): Move file_id and line into second 32-bit word + of header. + (slab_alloc): Remove commented-out debug statements. + (slab_unalloc): Remove memset() of freed block and commented-out debug + statements. + (slab_free): memset() freed blocks here instead. Try to fix + *_alloc_size counting errors (use the originally requested length + rather than rounded-up length) + + modified files: + ChangeLog src/alloc-slab.c + + 2005-02-05 03:52:51 GMT Michael Poole <md...@tr...> patch-14 Summary: --- orig/src/alloc-slab.c +++ mod/src/alloc-slab.c @@ -30,14 +30,14 @@ #if SLAB_DEBUG -#define ALLOC_MAGIC 0x1acf -#define FREE_MAGIC 0xfc1d +#define ALLOC_MAGIC 0x1a +#define FREE_MAGIC 0xcf struct alloc_header { - unsigned int file_id : 8; unsigned int size : 24; + unsigned int magic : 8; + unsigned int file_id : 8; unsigned int line : 16; - unsigned int magic : 16; }; static const char *file_ids[256]; @@ -226,7 +226,6 @@ assert(!slab->prev || slab == slab->prev->next); sset->child = slab; sset->nslabs++; - /* log_module(MAIN_LOG, LOG_DEBUG, "Allocated new %u-slab %p.", sset->size, slab); */ } slab = sset->child; @@ -235,7 +234,6 @@ <= (slab_pagesize() - sizeof(*slab) - sset->size)); slab->free = *item; if (++slab->used == sset->items_per_slab) { - /* log_module(MAIN_LOG, LOG_DEBUG, "%u-slab %p is empty.", sset->size, item); */ if (sset->child != slab) { /* Unlink slab and reinsert before sset->child. */ if (slab->prev) @@ -261,15 +259,12 @@ static void slab_unalloc(void *ptr, size_t size) { - void **item; struct slab *slab, *new_next; - item = ptr; assert(size < SMALL_CUTOFF); slab = (struct slab*)((((unsigned long)ptr | (slab_pagesize() - 1)) + 1) - sizeof(*slab)); - *item = slab->free; - memset(item + 1, 0xde, size - sizeof(*item)); - slab->free = item; + *(void**)ptr = slab->free; + slab->free = ptr; slab->parent->nallocs--; if (slab->used-- == slab->parent->items_per_slab @@ -288,9 +283,7 @@ slab->parent->child = slab; assert(!slab->next || slab == slab->next->prev); assert(!slab->prev || slab == slab->prev->next); - /* log_module(MAIN_LOG, LOG_DEBUG, "%u-slab %p became partial.", slab->parent->size, slab); */ } else if (!slab->used) { - /* log_module(MAIN_LOG, LOG_DEBUG, "%u-slab %p became full.", slab->parent->size, slab); */ /* Unlink slab from its parent. */ slab->parent->nslabs--; if (slab->prev) @@ -310,6 +303,8 @@ /* Make sure we have enough free slab pages. */ while (free_slab_count < SLAB_RESERVE) { struct slab *tslab; + void *item; + item = slab_map(slab_pagesize()); tslab = (struct slab*)((char*)item + slab_pagesize() - sizeof(*slab)); tslab->base = item; @@ -408,7 +403,7 @@ slab_free(const char *file, unsigned int line, void *ptr) { alloc_header_t *hdr; - size_t real; + size_t user, real; if (!ptr) return; @@ -418,20 +413,21 @@ hdr->file_id = get_file_id(file); hdr->line = line; hdr->magic = FREE_MAGIC; - real = hdr->size + sizeof(*hdr); + user = hdr->size; #else - real = *hdr + sizeof(*hdr); + user = *hdr; (void)file; (void)line; #endif - real = (real + SLAB_GRAIN - 1) & ~(SLAB_GRAIN - 1); + real = (user + sizeof(*hdr) + SLAB_GRAIN - 1) & ~(SLAB_GRAIN - 1); if (real < SMALL_CUTOFF) { + memset(hdr + 1, 0xde, real - sizeof(*hdr)); slab_unalloc(hdr, real); slab_alloc_count--; - slab_alloc_size -= real - sizeof(*hdr); + slab_alloc_size -= user; } else { munmap(hdr, slab_round_up(real)); big_alloc_count--; - big_alloc_size -= real - sizeof(*hdr); + big_alloc_size -= user; } } |
From: Michael P. <md...@tr...> - 2005-02-05 03:53:18
|
Revision: srvx--devo--1.3--patch-14 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Fri Feb 4 22:52:51 EST 2005 Standard-date: 2005-02-05 03:52:51 GMT Modified-files: ChangeLog src/alloc-slab.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-14 Summary: Even more slab allocator updates. Keywords: src/slab-alloc.c (SLAB_DEBUG): Default to on. (SMALL_CUTOFF): Fix default value (must be a multiple of 4). (slab_unalloc): Fix slab counting. When SLAB_RESERVE, allocate the set of pages in a burst, rather than supplementing them as we unmap. (slab_realloc): Fix a rather embarassing (and LARGE) memory leak. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-14 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,23 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-02-05 03:52:51 GMT Michael Poole <md...@tr...> patch-14 + + Summary: + Even more slab allocator updates. + Revision: + srvx--devo--1.3--patch-14 + + src/slab-alloc.c (SLAB_DEBUG): Default to on. + (SMALL_CUTOFF): Fix default value (must be a multiple of 4). + (slab_unalloc): Fix slab counting. When SLAB_RESERVE, allocate the + set of pages in a burst, rather than supplementing them as we unmap. + (slab_realloc): Fix a rather embarassing (and LARGE) memory leak. + + modified files: + ChangeLog src/alloc-slab.c + + 2005-02-04 16:36:40 GMT Michael Poole <md...@tr...> patch-13 Summary: --- orig/src/alloc-slab.c +++ mod/src/alloc-slab.c @@ -25,7 +25,7 @@ # error The slab allocator requires that your system have the mmap() system call. #endif -#define SLAB_DEBUG 0 +#define SLAB_DEBUG 1 #define SLAB_RESERVE 1024 #if SLAB_DEBUG @@ -97,7 +97,7 @@ #define SLAB_MIN (2 * sizeof(void*)) #define SLAB_GRAIN sizeof(void*) #define SLAB_ALIGN SLAB_GRAIN -#define SMALL_CUTOFF 582 +#define SMALL_CUTOFF 580 /* Element size < SMALL_CUTOFF -> use small slabs. * Larger elements are allocated directly using mmap(). The largest * regularly allocated struct in srvx 1.x is smaller than @@ -293,7 +293,6 @@ /* log_module(MAIN_LOG, LOG_DEBUG, "%u-slab %p became full.", slab->parent->size, slab); */ /* Unlink slab from its parent. */ slab->parent->nslabs--; - slab_count--; if (slab->prev) slab->prev->next = slab->next; if (slab->next) @@ -307,18 +306,20 @@ } #if SLAB_RESERVE - /* Make sure we have enough free slab pages. */ - while (free_slab_count < SLAB_RESERVE) { - struct slab *tslab; - item = slab_map(slab_pagesize()); - tslab = (struct slab*)((char*)item + slab_pagesize() - sizeof(*slab)); - tslab->base = item; - tslab->prev = free_slab_tail; - free_slab_tail = tslab; - if (!free_slab_head) - free_slab_head = tslab; - free_slab_count++; - slab_count++; + if (!free_slab_count) { + /* Make sure we have enough free slab pages. */ + while (free_slab_count < SLAB_RESERVE) { + struct slab *tslab; + item = slab_map(slab_pagesize()); + tslab = (struct slab*)((char*)item + slab_pagesize() - sizeof(*slab)); + tslab->base = item; + tslab->prev = free_slab_tail; + free_slab_tail = tslab; + if (!free_slab_head) + free_slab_head = tslab; + free_slab_count++; + slab_count++; + } } /* Unmap old slab, so accesses to stale pointers will fault. */ @@ -387,6 +388,7 @@ return ptr; newblock = slab_malloc(file, line, size); memcpy(newblock, ptr, osize); + slab_free(file, line, ptr); return newblock; } @@ -403,7 +405,7 @@ } void -slab_free(UNUSED_ARG(const char *file), UNUSED_ARG(unsigned int line), void *ptr) +slab_free(const char *file, unsigned int line, void *ptr) { alloc_header_t *hdr; size_t real; @@ -413,10 +415,13 @@ verify(ptr); hdr = (alloc_header_t*)ptr - 1; #if SLAB_DEBUG + hdr->file_id = get_file_id(file); + hdr->line = line; hdr->magic = FREE_MAGIC; real = hdr->size + sizeof(*hdr); #else real = *hdr + sizeof(*hdr); + (void)file; (void)line; #endif real = (real + SLAB_GRAIN - 1) & ~(SLAB_GRAIN - 1); if (real < SMALL_CUTOFF) { |
From: Michael P. <md...@tr...> - 2005-02-04 16:37:09
|
Revision: srvx--devo--1.3--patch-13 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Fri Feb 4 11:36:40 EST 2005 Standard-date: 2005-02-04 16:36:40 GMT Modified-files: ChangeLog src/alloc-slab.c src/log.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-13 Summary: more debugging updates Keywords: src/alloc-slab.c: Switch free slab list from a stack to queue, and make sure there are SLAB_RESERVE in the queue before an old slab is dereferenced. This causes a fault when dereferencing stale pointers to the last SLAB_RESERVE full slabs. src/log.c: Make struct logEntry *last static, to make sure gcc does not optimize it away. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-13 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,25 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-02-04 16:36:40 GMT Michael Poole <md...@tr...> patch-13 + + Summary: + more debugging updates + Revision: + srvx--devo--1.3--patch-13 + + src/alloc-slab.c: Switch free slab list from a stack to queue, and + make sure there are SLAB_RESERVE in the queue before an old slab is + dereferenced. This causes a fault when dereferencing stale pointers + to the last SLAB_RESERVE full slabs. + + src/log.c: Make struct logEntry *last static, to make sure gcc does + not optimize it away. + + modified files: + ChangeLog src/alloc-slab.c src/log.c + + 2005-01-31 22:28:59 GMT Michael Poole <md...@tr...> patch-12 Summary: --- orig/src/alloc-slab.c +++ mod/src/alloc-slab.c @@ -26,6 +26,7 @@ #endif #define SLAB_DEBUG 0 +#define SLAB_RESERVE 1024 #if SLAB_DEBUG @@ -105,7 +106,9 @@ */ static struct slabset little_slabs[SMALL_CUTOFF / SLAB_GRAIN]; -static struct slab *free_slabs; +static struct slab *free_slab_head; +static struct slab *free_slab_tail; +unsigned long free_slab_count; unsigned long big_alloc_count; unsigned long big_alloc_size; unsigned long slab_count; @@ -191,13 +194,15 @@ unsigned int ii, step; /* Allocate new slab. */ - if (free_slabs) { - slab = free_slabs; - free_slabs = slab->next; + if (free_slab_head) { + slab = free_slab_head; + if (!(free_slab_head = slab->next)) + free_slab_tail = NULL; } else { item = slab_map(slab_pagesize()); slab = (struct slab*)((char*)item + slab_pagesize() - sizeof(*slab)); slab->base = item; + slab_count++; } /* Populate free list. */ @@ -221,7 +226,6 @@ assert(!slab->prev || slab == slab->prev->next); sset->child = slab; sset->nslabs++; - slab_count++; /* log_module(MAIN_LOG, LOG_DEBUG, "Allocated new %u-slab %p.", sset->size, slab); */ } @@ -302,11 +306,34 @@ assert(!new_next->prev || new_next == new_next->prev->next); } +#if SLAB_RESERVE + /* Make sure we have enough free slab pages. */ + while (free_slab_count < SLAB_RESERVE) { + struct slab *tslab; + item = slab_map(slab_pagesize()); + tslab = (struct slab*)((char*)item + slab_pagesize() - sizeof(*slab)); + tslab->base = item; + tslab->prev = free_slab_tail; + free_slab_tail = tslab; + if (!free_slab_head) + free_slab_head = tslab; + free_slab_count++; + slab_count++; + } + + /* Unmap old slab, so accesses to stale pointers will fault. */ + munmap(slab->base, slab_pagesize()); + slab_count--; +#else /* Link to list of free slabs. */ - slab->prev = NULL; slab->parent = NULL; - slab->next = free_slabs; - free_slabs = slab; + slab->prev = free_slab_tail; + slab->next = NULL; + free_slab_tail = slab; + if (!free_slab_head) + free_slab_head = slab; + free_slab_count++; +#endif } } --- orig/src/log.c +++ mod/src/log.c @@ -723,7 +723,7 @@ unsigned int matched = 0; if (discrim->type) { - volatile struct logEntry *last; + static volatile struct logEntry *last; struct logEntry *entry; for (entry = discrim->type->log_oldest, last = NULL; |
From: Michael P. <md...@tr...> - 2005-01-31 22:34:33
|
Revision: srvx--devo--1.3--patch-12 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Mon Jan 31 17:28:59 EST 2005 Standard-date: 2005-01-31 22:28:59 GMT Modified-files: ChangeLog src/alloc-slab.c src/chanserv.h src/main.c src/opserv.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-12 Summary: More slab allocator updates. Keywords: src/alloc-slab.c: Disable extra debugging by default. Add more statistics counters. Change element type of little_slabs[]. Keep a global list of unused (full) slab pages, rather than per-slab. Various other cleanups and fixes. src/chanserv.h: Can only be off-channel with off_channel > 1. src/main.c: Update years in copyright notice. src/opserv.c: Remove OSMSG_STATS_MEMORY. Make cmd_stats_memory() allocator-specific. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-12 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,30 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-01-31 22:28:59 GMT Michael Poole <md...@tr...> patch-12 + + Summary: + More slab allocator updates. + Revision: + srvx--devo--1.3--patch-12 + + src/alloc-slab.c: Disable extra debugging by default. Add more + statistics counters. Change element type of little_slabs[]. Keep a + global list of unused (full) slab pages, rather than per-slab. + Various other cleanups and fixes. + + src/chanserv.h: Can only be off-channel with off_channel > 1. + + src/main.c: Update years in copyright notice. + + src/opserv.c: Remove OSMSG_STATS_MEMORY. Make cmd_stats_memory() + allocator-specific. + + modified files: + ChangeLog src/alloc-slab.c src/chanserv.h src/main.c + src/opserv.c + + 2005-01-31 11:08:15 GMT Michael Poole <md...@tr...> patch-11 Summary: --- orig/src/alloc-slab.c +++ mod/src/alloc-slab.c @@ -25,7 +25,7 @@ # error The slab allocator requires that your system have the mmap() system call. #endif -#define SLAB_DEBUG 1 +#define SLAB_DEBUG 0 #if SLAB_DEBUG @@ -86,8 +86,9 @@ }; struct slabset { - struct slabset *next; struct slab *child; + size_t nslabs; + size_t nallocs; size_t size; size_t items_per_slab; }; @@ -95,7 +96,7 @@ #define SLAB_MIN (2 * sizeof(void*)) #define SLAB_GRAIN sizeof(void*) #define SLAB_ALIGN SLAB_GRAIN -#define SMALL_CUTOFF 512 +#define SMALL_CUTOFF 582 /* Element size < SMALL_CUTOFF -> use small slabs. * Larger elements are allocated directly using mmap(). The largest * regularly allocated struct in srvx 1.x is smaller than @@ -103,10 +104,13 @@ * larger slabs. */ -static struct slabset *little_slabs[SMALL_CUTOFF / SLAB_GRAIN]; -static struct slabset slabset_slabs; -unsigned long alloc_count; -unsigned long alloc_size; +static struct slabset little_slabs[SMALL_CUTOFF / SLAB_GRAIN]; +static struct slab *free_slabs; +unsigned long big_alloc_count; +unsigned long big_alloc_size; +unsigned long slab_count; +unsigned long slab_alloc_count; +unsigned long slab_alloc_size; #if defined(MAP_ANON) #elif defined(MAP_ANONYMOUS) @@ -170,20 +174,11 @@ size = (size < SLAB_MIN) ? SLAB_MIN : (size + SLAB_GRAIN - 1) & ~(SLAB_GRAIN - 1); idx = size / SLAB_GRAIN; assert(idx < ArrayLength(little_slabs)); - if (!little_slabs[idx]) { - if (!slabset_slabs.size) { - unsigned int idx2 = (sizeof(struct slabset) + SLAB_GRAIN - 1) / SLAB_GRAIN; - slabset_slabs.size = sizeof(struct slabset); - slabset_slabs.items_per_slab = (slab_pagesize() - sizeof(struct slab)) / ((sizeof(struct slabset) + SLAB_ALIGN - 1) & ~(SLAB_ALIGN - 1)); - little_slabs[idx2] = &slabset_slabs; - if (idx == idx2) - return &slabset_slabs; - } - little_slabs[idx] = slab_alloc(&slabset_slabs); - little_slabs[idx]->size = size; - little_slabs[idx]->items_per_slab = (slab_pagesize() - sizeof(struct slab)) / ((size + SLAB_ALIGN - 1) & ~(SLAB_ALIGN - 1)); + if (!little_slabs[idx].size) { + little_slabs[idx].size = size; + little_slabs[idx].items_per_slab = (slab_pagesize() - sizeof(struct slab)) / ((size + SLAB_ALIGN - 1) & ~(SLAB_ALIGN - 1)); } - return little_slabs[idx]; + return &little_slabs[idx]; } static void * @@ -196,31 +191,47 @@ unsigned int ii, step; /* Allocate new slab. */ - item = slab_map(slab_pagesize()); - slab = (struct slab*)((char*)item + slab_pagesize() - sizeof(*slab)); - slab->base = item; + if (free_slabs) { + slab = free_slabs; + free_slabs = slab->next; + } else { + item = slab_map(slab_pagesize()); + slab = (struct slab*)((char*)item + slab_pagesize() - sizeof(*slab)); + slab->base = item; + } /* Populate free list. */ step = (sset->size + SLAB_ALIGN - 1) & ~(SLAB_ALIGN - 1); for (ii = 1, item = slab->free = slab->base; ii < sset->items_per_slab; ++ii, item = (*item = (char*)item + step)); + *item = NULL; /* Link to parent slabset. */ slab->parent = sset; - if ((slab->prev = sset->child)) { + slab->prev = sset->child; + if (slab->prev) { slab->next = slab->prev->next; slab->prev->next = slab; if (slab->next) slab->next->prev = slab; - } + } else + slab->next = NULL; + assert(!slab->next || slab == slab->next->prev); + assert(!slab->prev || slab == slab->prev->next); sset->child = slab; + sset->nslabs++; + slab_count++; + /* log_module(MAIN_LOG, LOG_DEBUG, "Allocated new %u-slab %p.", sset->size, slab); */ } slab = sset->child; item = slab->free; + assert(((unsigned long)item & (slab_pagesize() - 1)) + <= (slab_pagesize() - sizeof(*slab) - sset->size)); slab->free = *item; - if (slab->used++ == sset->items_per_slab) { + if (++slab->used == sset->items_per_slab) { + /* log_module(MAIN_LOG, LOG_DEBUG, "%u-slab %p is empty.", sset->size, item); */ if (sset->child != slab) { /* Unlink slab and reinsert before sset->child. */ if (slab->prev) @@ -231,11 +242,14 @@ slab->prev->next = slab; if ((slab->next = sset->child)) slab->next->prev = slab; + assert(!slab->next || slab == slab->next->prev); + assert(!slab->prev || slab == slab->prev->next); } else if (slab->next) { /* Advance sset->child to next pointer. */ sset->child = slab->next; } } + sset->nallocs++; memset(item, 0, sset->size); return item; } @@ -252,28 +266,47 @@ *item = slab->free; memset(item + 1, 0xde, size - sizeof(*item)); slab->free = item; + slab->parent->nallocs--; if (slab->used-- == slab->parent->items_per_slab && slab->parent->child != slab) { + /* Unlink from current position, relink as parent's first child. */ new_next = slab->parent->child; - slab->parent->child = slab; - } else if (!slab->used) { - for (new_next = slab; - new_next->next && new_next->next->used; - new_next = new_next->next) ; - new_next = new_next->next; - } else - new_next = NULL; - - if (new_next) { + assert(new_next != NULL); if (slab->prev) slab->prev->next = slab->next; if (slab->next) slab->next->prev = slab->prev; if ((slab->prev = new_next->prev)) slab->prev->next = slab; - if ((slab->next = new_next->next)) - slab->next->prev = slab; + slab->next = new_next; + new_next->prev = slab; + slab->parent->child = slab; + assert(!slab->next || slab == slab->next->prev); + assert(!slab->prev || slab == slab->prev->next); + /* log_module(MAIN_LOG, LOG_DEBUG, "%u-slab %p became partial.", slab->parent->size, slab); */ + } else if (!slab->used) { + /* log_module(MAIN_LOG, LOG_DEBUG, "%u-slab %p became full.", slab->parent->size, slab); */ + /* Unlink slab from its parent. */ + slab->parent->nslabs--; + slab_count--; + if (slab->prev) + slab->prev->next = slab->next; + if (slab->next) + slab->next->prev = slab->prev; + new_next = slab->next ? slab->next : slab->prev; + if (slab == slab->parent->child) + slab->parent->child = new_next; + if (new_next) { + assert(!new_next->next || new_next == new_next->next->prev); + assert(!new_next->prev || new_next == new_next->prev->next); + } + + /* Link to list of free slabs. */ + slab->prev = NULL; + slab->parent = NULL; + slab->next = free_slabs; + free_slabs = slab; } } @@ -285,10 +318,15 @@ assert(size < 1 << 24); real = (size + sizeof(*res) + SLAB_GRAIN - 1) & ~(SLAB_GRAIN - 1); - if (real < SMALL_CUTOFF) + if (real < SMALL_CUTOFF) { res = slab_alloc(slabset_create(real)); - else + slab_alloc_count++; + slab_alloc_size += size; + } else { res = slab_map(slab_round_up(real)); + big_alloc_count++; + big_alloc_size += size; + } #if SLAB_DEBUG res->file_id = get_file_id(file); res->size = size; @@ -298,8 +336,6 @@ *res = size; (void)file; (void)line; #endif - alloc_count++; - alloc_size += size; return res + 1; } @@ -323,7 +359,7 @@ if (osize >= size) return ptr; newblock = slab_malloc(file, line, size); - memcpy(newblock, ptr, size); + memcpy(newblock, ptr, osize); return newblock; } @@ -356,12 +392,15 @@ real = *hdr + sizeof(*hdr); #endif real = (real + SLAB_GRAIN - 1) & ~(SLAB_GRAIN - 1); - if (real < SMALL_CUTOFF) + if (real < SMALL_CUTOFF) { slab_unalloc(hdr, real); - else + slab_alloc_count--; + slab_alloc_size -= real - sizeof(*hdr); + } else { munmap(hdr, slab_round_up(real)); - alloc_count--; - alloc_size -= real - sizeof(*hdr); + big_alloc_count--; + big_alloc_size -= real - sizeof(*hdr); + } } void --- orig/src/chanserv.h +++ mod/src/chanserv.h @@ -71,7 +71,7 @@ #define IsProtected(x) ((x)->flags & CHANNEL_NODELETE) #define IsSuspended(x) ((x)->flags & CHANNEL_SUSPENDED) -#define IsOffChannel(x) ((x)->flags & CHANNEL_OFFCHANNEL) +#define IsOffChannel(x) (((x)->flags & CHANNEL_OFFCHANNEL) && (off_channel > 1)) struct chanData { --- orig/src/main.c +++ mod/src/main.c @@ -655,7 +655,7 @@ void version() { printf(" --------------------------------------------------\n" " - "PACKAGE_STRING" ("CODENAME"), Built: " __DATE__ ", " __TIME__".\n" - " - Copyright (C) 2000 - 2003, srvx Development Team\n" + " - Copyright (C) 2000 - 2005, srvx Development Team\n" " --------------------------------------------------\n"); } --- orig/src/opserv.c +++ mod/src/opserv.c @@ -228,7 +228,6 @@ { "OSMSG_WARN_LISTSTART", "Channel activity warnings:" }, { "OSMSG_WARN_LISTENTRY", "%s (%s)" }, { "OSMSG_WARN_LISTEND", "End of activity warning list." }, - { "OSMSG_STATS_MEMORY", "%u allocations totalling %u bytes." }, { "OSMSG_UPLINK_CONNECTING", "Establishing connection with %s (%s:%d)." }, { "OSMSG_CURRENT_UPLINK", "$b%s$b is already the current uplink." }, { "OSMSG_INVALID_UPLINK", "$b%s$b is not a valid uplink name." }, @@ -1581,10 +1580,24 @@ return 1; } -#if defined(WITH_MALLOC_SRVX) || defined(WITH_MALLOC_SLAB) +#if defined(WITH_MALLOC_SRVX) static MODCMD_FUNC(cmd_stats_memory) { extern unsigned long alloc_count, alloc_size; - reply("OSMSG_STATS_MEMORY", alloc_count, alloc_size); + send_message_type(MSG_TYPE_NOXLATE, user, cmd->parent->bot, + "%u allocations totalling %u bytes.", + alloc_count, alloc_size); + return 1; +} +#elif defined(WITH_MALLOC_SLAB) +static MODCMD_FUNC(cmd_stats_memory) { + extern unsigned long slab_alloc_count, slab_count, slab_alloc_size; + extern unsigned long big_alloc_count, big_alloc_size; + send_message_type(MSG_TYPE_NOXLATE, user, cmd->parent->bot, + "%u allocations in %u slabs totalling %u bytes.", + slab_alloc_count, slab_count, slab_alloc_size); + send_message_type(MSG_TYPE_NOXLATE, user, cmd->parent->bot, + "%u big allocations totalling %u bytes.", + big_alloc_count, big_alloc_size); return 1; } #endif |
From: Michael P. <md...@tr...> - 2005-01-31 11:13:26
|
Revision: srvx--devo--1.3--patch-11 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Mon Jan 31 06:08:15 EST 2005 Standard-date: 2005-01-31 11:08:15 GMT Modified-files: ChangeLog src/alloc-slab.c src/opserv.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-11 Summary: Add "?stats memory" and optional alloc_header to slab. Keywords: src/alloc-slab.c: Add alloc_header (but no redzone) debug support, enabled by default. Update alloc_count and alloc_size. src/opserv.c: Provide "stats memory" command for slab allocator. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-11 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,22 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-01-31 11:08:15 GMT Michael Poole <md...@tr...> patch-11 + + Summary: + Add "?stats memory" and optional alloc_header to slab. + Revision: + srvx--devo--1.3--patch-11 + + src/alloc-slab.c: Add alloc_header (but no redzone) debug support, + enabled by default. Update alloc_count and alloc_size. + + src/opserv.c: Provide "stats memory" command for slab allocator. + + modified files: + ChangeLog src/alloc-slab.c src/opserv.c + + 2005-01-31 05:14:52 GMT Michael Poole <md...@tr...> patch-10 Summary: --- orig/src/alloc-slab.c +++ mod/src/alloc-slab.c @@ -25,6 +25,57 @@ # error The slab allocator requires that your system have the mmap() system call. #endif +#define SLAB_DEBUG 1 + +#if SLAB_DEBUG + +#define ALLOC_MAGIC 0x1acf +#define FREE_MAGIC 0xfc1d + +struct alloc_header { + unsigned int file_id : 8; + unsigned int size : 24; + unsigned int line : 16; + unsigned int magic : 16; +}; + +static const char *file_ids[256]; +static struct file_id_entry { + const char *name; + unsigned int id : 8; +} file_id_map[256]; +unsigned int file_ids_used; + +static int +file_id_cmp(const void *a_, const void *b_) +{ + return strcmp(*(const char**)a_, *(const char**)b_); +} + +static unsigned int +get_file_id(const char *fname) +{ + struct file_id_entry *entry; + + entry = bsearch(&fname, file_id_map, file_ids_used, sizeof(file_id_map[0]), file_id_cmp); + if (entry) + return entry->id; + entry = file_id_map + file_ids_used; + file_ids[file_ids_used] = fname; + entry->name = fname; + entry->id = file_ids_used; + qsort(file_id_map, ++file_ids_used, sizeof(file_id_map[0]), file_id_cmp); + return file_ids_used - 1; +} + +typedef struct alloc_header alloc_header_t; + +#else + +typedef size_t alloc_header_t; + +#endif + struct slab { struct slabset *parent; struct slab *prev; @@ -199,6 +250,7 @@ assert(size < SMALL_CUTOFF); slab = (struct slab*)((((unsigned long)ptr | (slab_pagesize() - 1)) + 1) - sizeof(*slab)); *item = slab->free; + memset(item + 1, 0xde, size - sizeof(*item)); slab->free = item; if (slab->used-- == slab->parent->items_per_slab @@ -226,33 +278,52 @@ } void * -slab_malloc(UNUSED_ARG(const char *file), UNUSED_ARG(unsigned int line), size_t size) +slab_malloc(const char *file, unsigned int line, size_t size) { - size_t real, *res; + alloc_header_t *res; + size_t real; - real = size + sizeof(size_t); + assert(size < 1 << 24); + real = (size + sizeof(*res) + SLAB_GRAIN - 1) & ~(SLAB_GRAIN - 1); if (real < SMALL_CUTOFF) res = slab_alloc(slabset_create(real)); else res = slab_map(slab_round_up(real)); +#if SLAB_DEBUG + res->file_id = get_file_id(file); + res->size = size; + res->line = line; + res->magic = ALLOC_MAGIC; +#else *res = size; + (void)file; (void)line; +#endif + alloc_count++; + alloc_size += size; return res + 1; } void * slab_realloc(const char *file, unsigned int line, void *ptr, size_t size) { - size_t orig, *newblock; + alloc_header_t *orig; + void *newblock; + size_t osize; if (!ptr) return slab_malloc(file, line, size); verify(ptr); - orig = ((size_t*)ptr)[-1]; - if (orig >= size) + orig = (alloc_header_t*)ptr - 1; +#if SLAB_DEBUG + osize = orig->size; +#else + osize = *orig; +#endif + if (osize >= size) return ptr; newblock = slab_malloc(file, line, size); - memcpy(newblock, ptr, orig); + memcpy(newblock, ptr, size); return newblock; } @@ -271,33 +342,54 @@ void slab_free(UNUSED_ARG(const char *file), UNUSED_ARG(unsigned int line), void *ptr) { - size_t real, *size; + alloc_header_t *hdr; + size_t real; if (!ptr) return; verify(ptr); - size = (size_t*)ptr - 1; - real = *size + sizeof(size_t); + hdr = (alloc_header_t*)ptr - 1; +#if SLAB_DEBUG + hdr->magic = FREE_MAGIC; + real = hdr->size + sizeof(*hdr); +#else + real = *hdr + sizeof(*hdr); +#endif + real = (real + SLAB_GRAIN - 1) & ~(SLAB_GRAIN - 1); if (real < SMALL_CUTOFF) - slab_unalloc(size, real); + slab_unalloc(hdr, real); else - munmap(size, slab_round_up(real)); + munmap(hdr, slab_round_up(real)); + alloc_count--; + alloc_size -= real - sizeof(*hdr); } void verify(const void *ptr) { - size_t size; + alloc_header_t *hdr; + size_t real; if (!ptr) return; - else if ((size = ((size_t*)ptr)[-1] + sizeof(size_t)) >= SMALL_CUTOFF) - assert(((unsigned long)ptr & (slab_pagesize() - 1)) == sizeof(size_t)); + + hdr = (alloc_header_t*)ptr - 1; +#if SLAB_DEBUG + real = hdr->size + sizeof(*hdr); + assert(hdr->file_id < file_ids_used); + assert(hdr->magic == ALLOC_MAGIC); +#else + real = *hdr + sizeof(*hdr); +#endif + real = (real + SLAB_GRAIN - 1) & ~(SLAB_GRAIN - 1); + + if (real >= SMALL_CUTOFF) + assert(((unsigned long)ptr & (slab_pagesize() - 1)) == sizeof(*hdr)); else { struct slab *slab; size_t expected; - expected = (size + SLAB_GRAIN - 1) & ~(SLAB_GRAIN - 1); + expected = (real + SLAB_GRAIN - 1) & ~(SLAB_GRAIN - 1); slab = (struct slab*)((((unsigned long)ptr | (slab_pagesize() - 1)) + 1) - sizeof(*slab)); assert(slab->parent->size == expected); } --- orig/src/opserv.c +++ mod/src/opserv.c @@ -1581,7 +1581,7 @@ return 1; } -#if defined(WITH_MALLOC_SRVX) +#if defined(WITH_MALLOC_SRVX) || defined(WITH_MALLOC_SLAB) static MODCMD_FUNC(cmd_stats_memory) { extern unsigned long alloc_count, alloc_size; reply("OSMSG_STATS_MEMORY", alloc_count, alloc_size); @@ -4111,7 +4111,7 @@ opserv_define_func("STATS UPLINK", cmd_stats_uplink, 0, 0, 0); opserv_define_func("STATS UPTIME", cmd_stats_uptime, 0, 0, 0); opserv_define_func("STATS WARN", cmd_stats_warn, 0, 0, 0); -#if defined(WITH_MALLOC_SRVX) +#if defined(WITH_MALLOC_SRVX) || defined(WITH_MALLOC_SLAB) opserv_define_func("STATS MEMORY", cmd_stats_memory, 0, 0, 0); #endif opserv_define_func("TRACE", cmd_trace, 100, 0, 3); |
From: Michael P. <md...@tr...> - 2005-01-31 05:19:58
|
Revision: srvx--devo--1.3--patch-10 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Mon Jan 31 00:14:52 EST 2005 Standard-date: 2005-01-31 05:14:52 GMT New-files: src/.arch-ids/alloc-slab.c.id src/alloc-slab.c Modified-files: ChangeLog configure.in src/Makefile.am src/alloc-srvx.c src/chanserv.c src/chanserv.h src/common.h src/hash.h src/helpfile.c src/log.c src/main.c src/modcmd.c src/opserv.c src/proto-common.c src/proto-p10.c srvx.conf.example New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-10 Summary: Add slab allocator; reduce delta with srvx-gs. Keywords: configure.in: Check for getpagesize(). Support --with-malloc=slab. src/Makefile.am: Add alloc-slab.c as an extra source file. src/alloc-srvx.c: Clean up srvx_free() slightly. Check for previously allocated blocks. srvx.conf.example, src/chanserv.c, src/main.c, src/modcmd.c, src/proto-p10.c: Apply patches to bring closer to srvx-gs branch. src/log.c: Assert and _exit() on fatal log messages. src/opserv.c: Clarify logic for modes to set on join floods. src/proto-common.c: Accept off-channel commands in registered channels. * added files src/.arch-ids/alloc-slab.c.id src/alloc-slab.c {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-10 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,39 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-01-31 05:14:52 GMT Michael Poole <md...@tr...> patch-10 + + Summary: + Add slab allocator; reduce delta with srvx-gs. + Revision: + srvx--devo--1.3--patch-10 + + configure.in: Check for getpagesize(). Support --with-malloc=slab. + + src/Makefile.am: Add alloc-slab.c as an extra source file. + + src/alloc-srvx.c: Clean up srvx_free() slightly. Check for previously + allocated blocks. + + srvx.conf.example, src/chanserv.c, src/main.c, src/modcmd.c, + src/proto-p10.c: Apply patches to bring closer to srvx-gs branch. + + src/log.c: Assert and _exit() on fatal log messages. + + src/opserv.c: Clarify logic for modes to set on join floods. + + src/proto-common.c: Accept off-channel commands in registered channels. + + new files: + src/.arch-ids/alloc-slab.c.id src/alloc-slab.c + + modified files: + ChangeLog configure.in src/Makefile.am src/alloc-srvx.c + src/chanserv.c src/chanserv.h src/common.h src/hash.h + src/helpfile.c src/log.c src/main.c src/modcmd.c src/opserv.c + src/proto-common.c src/proto-p10.c srvx.conf.example + + 2005-01-26 21:16:54 GMT Michael Poole <md...@tr...> patch-9 Summary: --- orig/configure.in +++ mod/configure.in @@ -79,7 +79,7 @@ fi dnl We have fallbacks in case these are missing, so just check for them. -AC_CHECK_FUNCS(bcopy memcpy memset strdup strerror strsignal localtime_r setrlimit inet_ntoa getopt getopt_long regcomp regexec regfree sysconf,,) +AC_CHECK_FUNCS(bcopy getpagesize memcpy memset strdup strerror strsignal localtime_r setrlimit inet_ntoa getopt getopt_long regcomp regexec regfree sysconf,,) dnl Check for absolutely required library functions. AC_CHECK_FUNCS(select socket strcspn strspn strtod strtoul,,AC_MSG_ERROR([a required function was not found. srvx build will fail.])) @@ -180,6 +180,10 @@ AC_MSG_RESULT(srvx) AC_DEFINE(WITH_MALLOC_SRVX, 1, [Define if using the srvx internal debug allocator]) MODULE_OBJS="$MODULE_OBJS alloc-srvx.\$(OBJEXT)" +elif test "x$withval" = "xslab" ; then + AC_MSG_RESULT(slab) + AC_DEFINE(WITH_MALLOC_SLAB, 1, [Define if using the slab internal debug allocator]) + MODULE_OBJS="$MODULE_OBJS alloc-slab.\$(OBJEXT)" else AC_MSG_ERROR([Unknown malloc type $withval]) fi --- orig/src/Makefile.am +++ mod/src/Makefile.am @@ -22,7 +22,7 @@ mv $$TMPFILE arch-version.h ; \ fi -EXTRA_srvx_SOURCES = alloc-srvx.c proto-bahamut.c proto-common.c proto-p10.c mod-snoop.c mod-memoserv.c mod-helpserv.c mod-sockcheck.c +EXTRA_srvx_SOURCES = alloc-slab.c alloc-srvx.c proto-bahamut.c proto-common.c proto-p10.c mod-snoop.c mod-memoserv.c mod-helpserv.c mod-sockcheck.c srvx_LDADD = @MODULE_OBJS@ srvx_DEPENDENCIES = @MODULE_OBJS@ srvx_SOURCES = \ --- orig/src/alloc-srvx.c +++ mod/src/alloc-srvx.c @@ -15,6 +15,7 @@ */ #include "common.h" +#include "log.h" #undef malloc #undef free @@ -60,6 +61,11 @@ block = malloc(sizeof(*block) + size + sizeof(redzone)); assert(block != NULL); + if (block->magic == ALLOC_MAGIC && block->file_id < file_ids_used) { + /* Only report the error, due to possible false positives. */ + log_module(MAIN_LOG, LOG_WARNING, "Detected possible reallocation: %p (called by %s:%u/%u; allocated by %u:%u/%u).", + block, file, line, size, block->file_id, block->line, block->size); + } memset(block, 0, sizeof(*block) + size); memcpy((char*)(block + 1) + size, redzone, sizeof(redzone)); block->file_id = get_file_id(file); @@ -116,23 +122,21 @@ } void -srvx_free(const char *file, unsigned int line, void *ptr) +srvx_free(UNUSED_ARG(const char *file), UNUSED_ARG(unsigned int line), void *ptr) { struct alloc_header *block; size_t size; if (!ptr) return; + verify(ptr); block = (struct alloc_header *)ptr - 1; - assert(block->magic == ALLOC_MAGIC); - assert(0 == memcmp((char*)(block + 1) + block->size, redzone, sizeof(redzone))); size = block->size; memset(block + 1, 0xde, size); block->magic = FREE_MAGIC; free(block); alloc_count--; alloc_size -= size; - (void)file; (void)line; } void --- orig/src/chanserv.c +++ mod/src/chanserv.c @@ -1684,7 +1684,8 @@ return 0; } - if(!IsHelping(user) && (!(mn = GetUserMode(channel, user)) || !(mn->modes & MODE_CHANOP))) + if(!IsHelping(user) + && (!(mn = GetUserMode(channel, user)) || !(mn->modes & MODE_CHANOP))) { reply("CSMSG_MUST_BE_OPPED", channel->name); return 0; @@ -4456,18 +4457,21 @@ { struct suspended *suspended = data; struct chanNode *channel; - struct mod_chanmode change; if(!suspended->expires || (now < suspended->expires)) suspended->revoked = now; channel = suspended->cData->channel; suspended->cData->channel = channel; suspended->cData->flags &= ~CHANNEL_SUSPENDED; - mod_chanmode_init(&change); - change.argc = 1; - change.args[0].mode = MODE_CHANOP; - change.args[0].u.member = AddChannelUser(chanserv, channel); - mod_chanmode_announce(chanserv, channel, &change); + if(!IsOffChannel(suspended->cData)) + { + struct mod_chanmode change; + mod_chanmode_init(&change); + change.argc = 1; + change.args[0].mode = MODE_CHANOP; + change.args[0].u.member = AddChannelUser(chanserv, channel); + mod_chanmode_announce(chanserv, channel, &change); + } } static CHANSERV_FUNC(cmd_csuspend) @@ -5494,8 +5498,15 @@ new_owner = GetChannelAccess(cData, new_owner_hi); if(!new_owner) { - reply("CSMSG_NO_CHAN_USER", new_owner_hi->handle, channel->name); - return 0; + if(force) + { + new_owner = add_channel_user(cData, new_owner_hi, UL_COOWNER, 0, NULL); + } + else + { + reply("CSMSG_NO_CHAN_USER", new_owner_hi->handle, channel->name); + return 0; + } } if((chanserv_get_owned_count(new_owner_hi) >= chanserv_conf.max_owned) && !force) { @@ -6598,6 +6609,8 @@ s_expires = database_get_data(rd->d.object, KEY_EXPIRES, RECDB_QSTRING); owner = database_get_data(rd->d.object, KEY_OWNER, RECDB_QSTRING); reason = database_get_data(rd->d.object, KEY_REASON, RECDB_QSTRING); + if (!reason || !owner) + return; set_time = set ? (time_t)strtoul(set, NULL, 0) : now; triggered_time = triggered ? (time_t)strtoul(triggered, NULL, 0) : 0; --- orig/src/chanserv.h +++ mod/src/chanserv.h @@ -163,7 +163,7 @@ { char chan_name[CHANNELLEN+1]; char setter[NICKSERV_HANDLE_LEN+1]; - time_t set; + time_t set; char reason[1]; }; --- orig/src/common.h +++ mod/src/common.h @@ -102,6 +102,24 @@ extern void verify(const void *ptr); # define verify(x) verify(x) # endif +#elif defined(WITH_MALLOC_SLAB) +# define malloc(n) slab_malloc(__FILE__, __LINE__, (n)) +# undef calloc +# define calloc(m,n) slab_malloc(__FILE__, __LINE__, (m)*(n)) +# undef realloc +# define realloc(p,n) slab_realloc(__FILE__, __LINE__, (p), (n)) +# undef free +# define free(p) slab_free(__FILE__, __LINE__, (p)) +# undef strdup +# define strdup(s) slab_strdup(__FILE__, __LINE__, (s)) +extern void *slab_malloc(const char *, unsigned int, size_t); +extern void *slab_realloc(const char *, unsigned int, void *, size_t); +extern char *slab_strdup(const char *, unsigned int, const char *); +extern void slab_free(const char *, unsigned int, void *); +# if !defined(NDEBUG) +extern void verify(const void *ptr); +# define verify(x) verify(x) +# endif #endif #ifndef verify --- orig/src/hash.h +++ mod/src/hash.h @@ -58,7 +58,7 @@ #define FLAGS_STAMPED 0x1000 /* for users who have been stamped */ #define FLAGS_HIDDEN_HOST 0x2000 /* user's host is masked by their account */ #define FLAGS_REGNICK 0x4000 /* user owns their current nick */ -#define FLAGS_REGISTERING 0x8000 /* user has issued account register command, is waiting for email cookie */ +#define FLAGS_REGISTERING 0x8000 /* user has issued account register command, is waiting for email cookie */ #define IsOper(x) ((x)->modes & FLAGS_OPER) #define IsService(x) ((x)->modes & FLAGS_SERVICE) @@ -126,7 +126,7 @@ unsigned int limit, locks; char key[KEYLEN + 1]; time_t timestamp; /* creation time */ - + char topic[TOPICLEN + 1]; char topic_nick[NICKLEN + 1]; time_t topic_time; --- orig/src/helpfile.c +++ mod/src/helpfile.c @@ -84,7 +84,7 @@ * lang is a two-letter code according to ISO-639-1 (or three-letter * code according to ISO-639-2 for languages not in ISO-639-1), and * COUNTRY is the ISO 3166 country code in all upper case. - * + * * See also: * http://www.loc.gov/standards/iso639-2/ * http://www.loc.gov/standards/iso639-2/langhome.html --- orig/src/log.c +++ mod/src/log.c @@ -587,6 +587,10 @@ /* Special behavior before we start full operation */ fprintf(stderr, "%s: %s\n", log_severity_names[sev], msgbuf); } + if (sev == LOG_FATAL) { + assert(0 && "fatal message logged"); + _exit(1); + } } /* audit log searching */ @@ -719,7 +723,8 @@ unsigned int matched = 0; if (discrim->type) { - struct logEntry *entry, *last; + volatile struct logEntry *last; + struct logEntry *entry; for (entry = discrim->type->log_oldest, last = NULL; entry; --- orig/src/main.c +++ mod/src/main.c @@ -691,6 +691,12 @@ FILE *file_out; struct sigaction sv; +#if WITH_MALLOC_BOEHM_GC + GC_find_leak = 1; + GC_set_warn_proc(gc_warn_proc); + GC_enable_incremental(); +#endif + daemon = 1; debug = 0; tools_init(); @@ -816,10 +822,6 @@ MAIN_LOG = log_register_type("srvx", "file:main.log"); if (debug) log_debug(); -#if WITH_MALLOC_BOEHM_GC - GC_set_warn_proc(gc_warn_proc); - GC_enable_incremental(); -#endif timeq_init(); init_structs(); init_parse(); --- orig/src/modcmd.c +++ mod/src/modcmd.c @@ -145,18 +145,18 @@ { "channel", MODCMD_REQUIRE_CHANNEL }, { "chanuser", MODCMD_REQUIRE_CHANUSER }, { "disabled", MODCMD_DISABLED }, + { "helping", MODCMD_REQUIRE_HELPING }, { "ignore_csuspend", MODCMD_IGNORE_CSUSPEND }, { "joinable", MODCMD_REQUIRE_JOINABLE }, { "keepbound", MODCMD_KEEP_BOUND }, { "loghostmask", MODCMD_LOG_HOSTMASK }, - { "nolog", MODCMD_NO_LOG }, { "networkhelper", MODCMD_REQUIRE_NETWORK_HELPER }, { "never_csuspend", MODCMD_NEVER_CSUSPEND }, + { "nolog", MODCMD_NO_LOG }, { "oper", MODCMD_REQUIRE_OPER }, { "qualified", MODCMD_REQUIRE_QUALIFIED }, { "regchan", MODCMD_REQUIRE_REGCHAN }, { "supporthelper", MODCMD_REQUIRE_SUPPORT_HELPER }, - { "helping", MODCMD_REQUIRE_HELPING }, { "toy", MODCMD_TOY }, { NULL, 0 } }; @@ -545,7 +545,8 @@ rflags |= ACTION_STAFF; } if (cmd->min_opserv_level > 0) { - if (!oper_has_access(user, bot, cmd->min_opserv_level, !(options & SVCCMD_NOISY))) return 0; + if (!oper_has_access(user, bot, cmd->min_opserv_level, !(options & SVCCMD_NOISY))) + return 0; rflags |= ACTION_STAFF; } if (cmd->req_account_flags || cmd->deny_account_flags) { @@ -566,7 +567,7 @@ /* If it's an override, return a special value. */ if ((flags & MODCMD_REQUIRE_CHANUSER) && (options & SVCCMD_NOISY) - && (uData->access > 500) + && (!uData || (uData->access > 500)) && (!(uData = _GetChannelUser(channel->channel_info, user->handle_info, 0, 0)) || uData->access < cmd->min_channel_access) && !(flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING))) { @@ -1670,12 +1671,12 @@ if (flags & MODCMD_REQUIRE_HELPING) access = "helping"; else if (flags & MODCMD_REQUIRE_STAFF) { - switch (flags & MODCMD_REQUIRE_STAFF) { - case MODCMD_REQUIRE_OPER: access = "oper"; break; - case MODCMD_REQUIRE_OPER | MODCMD_REQUIRE_NETWORK_HELPER: - case MODCMD_REQUIRE_NETWORK_HELPER: access = "net.helper"; break; - default: access = "staff"; break; - } + if (flags & MODCMD_REQUIRE_OPER) + access = "oper"; + else if (flags & MODCMD_REQUIRE_NETWORK_HELPER) + access = "net.helper"; + else + access = "staff"; } else access = strtab(svccmd->min_channel_access); tbl.contents[ii+1][1+show_opserv_level] = access; --- orig/src/opserv.c +++ mod/src/opserv.c @@ -1896,8 +1896,7 @@ change.args[0].u.member = AddChannelUser(opserv, channel); change.argc++; } - if (!(channel->modes & MODE_MODERATED)) - change.modes_set |= MODE_MODERATED; + change.modes_set = (MODE_MODERATED | MODE_DELAYJOINS) & ~channel->modes; if (change.modes_set || change.argc) mod_chanmode_announce(opserv, channel, &change); send_target_message(0, channel->name, opserv, "OSMSG_FLOOD_MODERATE"); --- orig/src/proto-common.c +++ mod/src/proto-common.c @@ -440,16 +440,17 @@ mn->idle_since = now; /* Never send a NOTICE to a channel to one of the services */ - if (!pd->is_notice && cf->func && GetUserMode(cn, cf->service)) + if (!pd->is_notice && cf->func + && ((cn->modes & MODE_REGISTERED) || GetUserMode(cn, cf->service))) cf->func(pd->user, cn, pd->text+1, cf->service); /* This catches *all* text sent to the channel that the services server sees */ for (x = 0; x < ALLCHANMSG_FUNCS_MAX; x++) { cf = (struct chanmsg_func *)&allchanmsg_funcs[x]; if (!cf->func) - break; /* end of list */ + break; /* end of list */ else - cf->func(pd->user, cn, pd->text, cf->service); + cf->func(pd->user, cn, pd->text, cf->service); } } --- orig/src/proto-p10.c +++ mod/src/proto-p10.c @@ -1579,6 +1579,7 @@ dict_insert(irc_func_dict, "401", cmd_dummy); /* target left network */ dict_insert(irc_func_dict, "403", cmd_dummy); /* no such channel */ dict_insert(irc_func_dict, "404", cmd_dummy); /* cannot send to channel */ + dict_insert(irc_func_dict, "439", cmd_dummy); /* target change too fast */ dict_insert(irc_func_dict, "441", cmd_dummy); /* target isn't on that channel */ dict_insert(irc_func_dict, "442", cmd_dummy); /* you aren't on that channel */ dict_insert(irc_func_dict, "443", cmd_dummy); /* is already on channel (after invite?) */ --- orig/srvx.conf.example +++ mod/srvx.conf.example @@ -220,7 +220,7 @@ // How long is a channel unvisited (by masters or above) before it can be expired? "chan_expire_delay" "30d"; // what !set options should we show when user calls "!set" with no arguments? - "set_shows" ("DefaultTopic", "TopicMask", "Greeting", "UserGreeting", "Modes", "PubCmd", "InviteMe", "UserInfo", "GiveVoice", "GiveOps", "EnfOps", "EnfModes", "EnfTopic", "TopicSnarf", "Setters", "CtcpUser", "CtcpReaction", "Protect", "Toys", "DynLimit", "NoDelete"); + "set_shows" ("DefaultTopic", "TopicMask", "Greeting", "UserGreeting", "Modes", "PubCmd", "InviteMe", "StrictOp", "AutoOp", "EnfModes", "EnfTopic", "TopicSnarf", "UserInfo", "GiveVoice", "GiveOps", "EnfOps", "Setters", "CtcpUser", "CtcpReaction", "Protect", "Toys", "DynLimit", "NoDelete"); // A list of !8ball responses "8ball" ("Not a chance.", |
From: Michael P. <md...@tr...> - 2005-01-26 21:19:03
|
Revision: srvx--devo--1.3--patch-9 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Wed Jan 26 16:16:54 EST 2005 Standard-date: 2005-01-26 21:16:54 GMT Modified-files: ChangeLog src/chanserv.c src/common.h src/hash.c src/log.c src/proto-p10.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-9 Summary: offchannel fixes; more memory verification Keywords: src/chanserv.c (cmd_register): Do not join channels if the default options include being offchannel. src/common.h: Verify list allocations when appending or removing. src/hash.c (GetUserMode): Verify channel and user list allocations. src/log.c (log_entry_search): Keep pointer to last visited log entry. src/proto-p10.c (mod_chanmode_parse): Fail if trying to change +z when passed MCP_REGISTERED. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-9 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,30 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-01-26 21:16:54 GMT Michael Poole <md...@tr...> patch-9 + + Summary: + offchannel fixes; more memory verification + Revision: + srvx--devo--1.3--patch-9 + + src/chanserv.c (cmd_register): Do not join channels if the default + options include being offchannel. + + src/common.h: Verify list allocations when appending or removing. + + src/hash.c (GetUserMode): Verify channel and user list allocations. + + src/log.c (log_entry_search): Keep pointer to last visited log entry. + + src/proto-p10.c (mod_chanmode_parse): Fail if trying to change +z when + passed MCP_REGISTERED. + + modified files: + ChangeLog src/chanserv.c src/common.h src/hash.c src/log.c + src/proto-p10.c + + 2005-01-24 17:12:38 GMT Michael Poole <md...@tr...> patch-8 Summary: --- orig/src/chanserv.c +++ mod/src/chanserv.c @@ -1662,7 +1662,6 @@ static CHANSERV_FUNC(cmd_register) { - struct mod_chanmode *change; struct handle_info *handle; struct chanData *cData; struct modeNode *mn; @@ -1752,13 +1751,20 @@ scan_user_presence(add_channel_user(cData, handle, UL_OWNER, 0, NULL), NULL); cData->modes = chanserv_conf.default_modes; if(off_channel > 0) - cData->modes.modes_set |= MODE_REGISTERED; - change = mod_chanmode_dup(&cData->modes, 1); - change->args[change->argc].mode = MODE_CHANOP; - change->args[change->argc].u.member = AddChannelUser(chanserv, channel); - change->argc++; - mod_chanmode_announce(chanserv, channel, change); - mod_chanmode_free(change); + cData->modes.modes_set |= MODE_REGISTERED; + if (IsOffChannel(cData)) + { + mod_chanmode_announce(chanserv, channel, &cData->modes); + } + else + { + struct mod_chanmode *change = mod_chanmode_dup(&cData->modes, 1); + change->args[change->argc].mode = MODE_CHANOP; + change->args[change->argc].u.member = AddChannelUser(chanserv, channel); + change->argc++; + mod_chanmode_announce(chanserv, channel, change); + mod_chanmode_free(change); + } /* Initialize the channel's max user record. */ cData->max = channel->members.used; @@ -6476,8 +6482,6 @@ else strlist = alloc_string_list(2); chanserv_conf.old_ban_names = strlist; - /* the variable itself is actually declared in proto-common.c; this is equally - * parse issue. */ str = database_get_data(conf_node, "off_channel", RECDB_QSTRING); off_channel = str ? atoi(str) : 0; } --- orig/src/common.h +++ mod/src/common.h @@ -163,6 +163,7 @@ list->list = malloc(list->size*sizeof(list->list[0]));\ }\ void STRUCTNAME##_append(struct STRUCTNAME *list, ITEMTYPE new_item) {\ + verify(list->list);\ if (list->used == list->size) {\ list->size = list->size ? (list->size << 1) : 4;\ list->list = realloc(list->list, list->size*sizeof(list->list[0]));\ @@ -171,6 +172,7 @@ }\ int STRUCTNAME##_remove(struct STRUCTNAME *list, ITEMTYPE new_item) {\ unsigned int n, found;\ + verify(list->list);\ for (found=n=0; n<list->used; n++) {\ if (list->list[n] == new_item) {\ memmove(list->list+n, list->list+n+1, (list->used-n-1)*sizeof(list->list[n]));\ @@ -183,6 +185,7 @@ void STRUCTNAME##_clean(struct STRUCTNAME *list) {\ list->used = list->size = 0;\ free(list->list);\ + list->list = NULL;\ } /* The longest string that is likely to be produced in English is "10 --- orig/src/hash.c +++ mod/src/hash.c @@ -694,7 +694,9 @@ struct modeNode *mn = NULL; verify(channel); + verify(channel->members.list); verify(user); + verify(user->channels.list); if (channel->members.used < user->channels.used) { for (n=0; n<channel->members.used; n++) { verify(channel->members.list[n]); --- orig/src/log.c +++ mod/src/log.c @@ -719,9 +719,12 @@ unsigned int matched = 0; if (discrim->type) { - struct logEntry *entry; + struct logEntry *entry, *last; - for (entry = discrim->type->log_oldest; entry; entry = entry->next) { + for (entry = discrim->type->log_oldest, last = NULL; + entry; + last = entry, entry = entry->next) { + verify(entry); if (entry_match(discrim, entry)) { esf(entry, data); if (++matched >= discrim->limit) --- orig/src/proto-p10.c +++ mod/src/proto-p10.c @@ -2085,7 +2085,14 @@ case 'r': do_chan_mode(MODE_REGONLY); break; case 's': do_chan_mode(MODE_SECRET); break; case 't': do_chan_mode(MODE_TOPICLIMIT); break; - case 'z': do_chan_mode(MODE_REGISTERED); break; + case 'z': + if (!(flags & MCP_REGISTERED)) { + do_chan_mode(MODE_REGISTERED); + } else { + mod_chanmode_free(change); + return NULL; + } + break; #undef do_chan_mode case 'l': if (add) { |
From: Michael P. <md...@tr...> - 2005-01-24 17:13:23
|
Revision: srvx--devo--1.3--patch-8 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Mon Jan 24 12:12:38 EST 2005 Standard-date: 2005-01-24 17:12:38 GMT Modified-files: ChangeLog src/alloc-srvx.c src/chanserv.c src/opserv.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-8 Summary: typo fix in alloc-srvx.c; avoid dereferencing free()'d bans Keywords: src/alloc-srvx.c (srvx_realloc): Fix argument list to srvx_free(). src/chanserv.c (find_matching_bans): Make temporary copies of bans to be removed. Double-check remove count at end of loop. (unban_user, cmd_open): Free the string copies. (cmd_unbanall): Make temporary copies of removed bans and free them. (handle_mode): Likewise. src/opserv.c (cmd_clearbans): Likewise. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-8 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,27 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-01-24 17:12:38 GMT Michael Poole <md...@tr...> patch-8 + + Summary: + typo fix in alloc-srvx.c; avoid dereferencing free()'d bans + Revision: + srvx--devo--1.3--patch-8 + + src/alloc-srvx.c (srvx_realloc): Fix argument list to srvx_free(). + + src/chanserv.c (find_matching_bans): Make temporary copies of bans to + be removed. Double-check remove count at end of loop. + (unban_user, cmd_open): Free the string copies. + (cmd_unbanall): Make temporary copies of removed bans and free them. + (handle_mode): Likewise. + + src/opserv.c (cmd_clearbans): Likewise. + + modified files: + ChangeLog src/alloc-srvx.c src/chanserv.c src/opserv.c + + 2005-01-24 16:45:44 GMT Michael Poole <md...@tr...> patch-7 Summary: --- orig/src/alloc-srvx.c +++ mod/src/alloc-srvx.c @@ -98,7 +98,7 @@ alloc_count++; alloc_size += size; - srvx_free(block); + srvx_free(file, line, block + 1); return newblock + 1; } --- orig/src/chanserv.c +++ mod/src/chanserv.c @@ -3046,8 +3046,9 @@ if(!match[ii]) continue; change->args[count].mode = MODE_REMOVE | MODE_BAN; - change->args[count++].u.hostmask = bans->list[ii]->ban; + change->args[count++].u.hostmask = strdup(bans->list[ii]->ban); } + assert(count == change->argc); return change; } @@ -3080,7 +3081,11 @@ change = find_matching_bans(&channel->banlist, actee, mask); if(change) { + unsigned int ii; + modcmd_chanmode_announce(change); + for(ii = 0; ii < change->argc; ++ii) + free((char*)change->args[ii].u.hostmask); mod_chanmode_free(change); acted = 1; } @@ -3157,9 +3162,11 @@ for(ii=0; ii<channel->banlist.used; ii++) { change->args[ii].mode = MODE_REMOVE | MODE_BAN; - change->args[ii].u.hostmask = channel->banlist.list[ii]->ban; + change->args[ii].u.hostmask = strdup(channel->banlist.list[ii]->ban); } modcmd_chanmode_announce(change); + for(ii = 0; ii < change->argc; ++ii) + free((char*)change->args[ii].u.hostmask); mod_chanmode_free(change); reply("CSMSG_BANS_REMOVED", channel->name); return 1; @@ -3168,6 +3175,7 @@ static CHANSERV_FUNC(cmd_open) { struct mod_chanmode *change; + unsigned int ii; change = find_matching_bans(&channel->banlist, user, NULL); if(!change) @@ -3178,6 +3186,8 @@ change->modes_clear &= ~channel->channel_info->modes.modes_set; modcmd_chanmode_announce(change); reply("CSMSG_CHANNEL_OPENED", channel->name); + for(ii = 0; ii < change->argc; ++ii) + free((char*)change->args[ii].u.hostmask); mod_chanmode_free(change); return 1; } @@ -6217,7 +6227,7 @@ if(!bounce) bounce = mod_chanmode_alloc(change->argc + 1 - ii); bounce->args[bnc].mode = MODE_REMOVE | MODE_BAN; - bounce->args[bnc].u.hostmask = ban; + bounce->args[bnc].u.hostmask = strdup(ban); bnc++; send_message(user, chanserv, "CSMSG_MASK_PROTECTED", ban); } @@ -6226,6 +6236,9 @@ { if((bounce->argc = bnc) || bounce->modes_set || bounce->modes_clear) mod_chanmode_announce(chanserv, channel, bounce); + for(ii = 0; ii < change->argc; ++ii) + if(bounce->args[ii].mode == (MODE_REMOVE | MODE_BAN)) + free((char*)bounce->args[ii].u.hostmask); mod_chanmode_free(bounce); } } --- orig/src/opserv.c +++ mod/src/opserv.c @@ -523,9 +523,11 @@ change = mod_chanmode_alloc(channel->banlist.used); for (ii=0; ii<channel->banlist.used; ii++) { change->args[ii].mode = MODE_REMOVE | MODE_BAN; - change->args[ii].u.hostmask = channel->banlist.list[ii]->ban; + change->args[ii].u.hostmask = strdup(channel->banlist.list[ii]->ban); } modcmd_chanmode_announce(change); + for (ii=0; ii<change->argc; ++ii) + free((char*)change->args[ii].u.hostmask); mod_chanmode_free(change); reply("OSMSG_CLEARBANS_DONE", channel->name); return 1; |
From: Michael P. <md...@tr...> - 2005-01-24 16:46:30
|
Revision: srvx--devo--1.3--patch-7 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Mon Jan 24 11:45:44 EST 2005 Standard-date: 2005-01-24 16:45:44 GMT Modified-files: ChangeLog src/alloc-srvx.c src/common.h src/dict-splay.c src/hash.c src/mod-sockcheck.c src/proto-p10.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-7 Summary: More allocation debugging support. Keywords: src/alloc-srvx.c (srvx_realloc): Reorganize. (verify): New function. src/common.h (verify): Define and/or declare suitably. src/dict-splay.c (dict_splay): Verify node at each iteration. (dict_insert, dict_remove2, dict_find, dict_delete, dict_sanity_check): Verify entire dict. (dict_sanity_check_node): Verify node as valid allocation. src/hash.c (DelChannel): Verify channel before deletion. (GetUserMode): Verify channel, user, and each modeNode. src/mod-sockcheck.c (sockcheck_free_client): Verify client. (sockcheck_timeout_client, sockcheck_advance, sockcheck_readable, sockcheck_connected, sockcheck_begin_test): Likewise. (sockcheck_queue_address): Verify cached sockcheck entries. src/proto-p10.c (DelUser): Verify user before deletion. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-7 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,38 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-01-24 16:45:44 GMT Michael Poole <md...@tr...> patch-7 + + Summary: + More allocation debugging support. + Revision: + srvx--devo--1.3--patch-7 + + src/alloc-srvx.c (srvx_realloc): Reorganize. + (verify): New function. + + src/common.h (verify): Define and/or declare suitably. + + src/dict-splay.c (dict_splay): Verify node at each iteration. + (dict_insert, dict_remove2, dict_find, dict_delete, + dict_sanity_check): Verify entire dict. + (dict_sanity_check_node): Verify node as valid allocation. + + src/hash.c (DelChannel): Verify channel before deletion. + (GetUserMode): Verify channel, user, and each modeNode. + + src/mod-sockcheck.c (sockcheck_free_client): Verify client. + (sockcheck_timeout_client, sockcheck_advance, sockcheck_readable, + sockcheck_connected, sockcheck_begin_test): Likewise. + (sockcheck_queue_address): Verify cached sockcheck entries. + + src/proto-p10.c (DelUser): Verify user before deletion. + + modified files: + ChangeLog src/alloc-srvx.c src/common.h src/dict-splay.c + src/hash.c src/mod-sockcheck.c src/proto-p10.c + + 2005-01-21 15:10:49 GMT Michael Poole <md...@tr...> patch-6 Summary: --- orig/src/alloc-srvx.c +++ mod/src/alloc-srvx.c @@ -74,19 +74,22 @@ void * srvx_realloc(const char *file, unsigned int line, void *ptr, size_t size) { - struct alloc_header *block = NULL, *newblock; + struct alloc_header *block, *newblock; - if (ptr) { - block = (struct alloc_header *)ptr - 1; - assert(block->magic == ALLOC_MAGIC); - assert(0 == memcmp((char*)(block + 1) + block->size, redzone, sizeof(redzone))); - if (block->size >= size) - return block + 1; - } + if (!ptr) + return srvx_malloc(file, line, size); + + verify(ptr); + block = (struct alloc_header *)ptr - 1; + + if (block->size >= size) + return block + 1; newblock = malloc(sizeof(*newblock) + size + sizeof(redzone)); assert(newblock != NULL); - memset(newblock, 0, sizeof(*newblock) + size + sizeof(redzone)); + memset(newblock, 0, sizeof(*newblock)); + memcpy(newblock + 1, block + 1, block->size); + memset((char*)(newblock + 1) + block->size, 0, size - block->size); memcpy((char*)(newblock + 1) + size, redzone, sizeof(redzone)); newblock->file_id = get_file_id(file); newblock->line = line; @@ -95,15 +98,7 @@ alloc_count++; alloc_size += size; - if (ptr) { - memcpy(newblock + 1, block + 1, block->size); - size = block->size + sizeof(*block); - memset(block, 0, size); - block->magic = FREE_MAGIC; - free(block); - alloc_count--; - alloc_size -= size - sizeof(*block); - } + srvx_free(block); return newblock + 1; } @@ -139,3 +134,14 @@ alloc_size -= size; (void)file; (void)line; } + +void +verify(const void *ptr) +{ + const struct alloc_header *header; + if (!ptr) + return; + header = (const struct alloc_header*)ptr - 1; + assert(header->magic == ALLOC_MAGIC); + assert(!memcmp((char*)(header + 1) + header->size, redzone, sizeof(redzone))); +} --- orig/src/common.h +++ mod/src/common.h @@ -98,6 +98,14 @@ extern void *srvx_realloc(const char *, unsigned int, void *, size_t); extern char *srvx_strdup(const char *, unsigned int, const char *); extern void srvx_free(const char *, unsigned int, void *); +# if !defined(NDEBUG) +extern void verify(const void *ptr); +# define verify(x) verify(x) +# endif +#endif + +#ifndef verify +# define verify(ptr) (void)(ptr) #endif extern time_t now; --- orig/src/dict-splay.c +++ mod/src/dict-splay.c @@ -75,12 +75,15 @@ dict_splay(struct dict_node *node, const char *key) { struct dict_node N, *l, *r, *y; + int res; + if (!node) return NULL; N.l = N.r = NULL; l = r = &N; while (1) { - int res = irccasecmp(key, node->key); + verify(node); + res = irccasecmp(key, node->key); if (!res) break; if (res < 0) { if (!node->l) break; @@ -149,6 +152,7 @@ struct dict_node *new_node; if (!key) return; + verify(dict); new_node = malloc(sizeof(struct dict_node)); new_node->key = key; new_node->data = data; @@ -224,6 +228,7 @@ if (!dict->root) return 0; + verify(dict); dict->root = dict_splay(dict->root, key); if (irccasecmp(key, dict->root->key)) return 0; @@ -264,6 +269,7 @@ *found = 0; return NULL; } + verify(dict); dict->root = dict_splay(dict->root, key); was_found = !irccasecmp(key, dict->root->key); if (found) @@ -280,6 +286,7 @@ dict_iterator_t it, next; if (!dict) return; + verify(dict); for (it=dict_first(dict); it; it=next) { next = iter_next(it); dict_dispose_node(it, dict->free_keys, dict->free_data); @@ -296,6 +303,7 @@ static int dict_sanity_check_node(struct dict_node *node, struct dict_sanity_struct *dss) { + verify(node); if (!node->key) { snprintf(dss->error, sizeof(dss->error), "Node %p had null key", node); return 1; @@ -328,6 +336,7 @@ dss.node_count = 0; dss.bad_node = 0; dss.error[0] = 0; + verify(dict); if (dict->root && dict_sanity_check_node(dict->root, &dss)) { return strdup(dss.error); } else if (dss.node_count != dict->count) { --- orig/src/hash.c +++ mod/src/hash.c @@ -425,6 +425,7 @@ { unsigned int n; + verify(channel); dict_remove(channels, channel->name); if (channel->members.used || channel->locks) { @@ -691,8 +692,12 @@ { unsigned int n; struct modeNode *mn = NULL; + + verify(channel); + verify(user); if (channel->members.used < user->channels.used) { for (n=0; n<channel->members.used; n++) { + verify(channel->members.list[n]); if (user == channel->members.list[n]->user) { mn = channel->members.list[n]; break; @@ -700,6 +705,7 @@ } } else { for (n=0; n<user->channels.used; n++) { + verify(user->channels.list[n]); if (channel == user->channels.list[n]->channel) { mn = user->channels.list[n]; break; --- orig/src/mod-sockcheck.c +++ mod/src/mod-sockcheck.c @@ -230,7 +230,9 @@ if (SOCKCHECK_DEBUG) { log_module(PC_LOG, LOG_INFO, "Goodbye %s (%p)! I set you free!", client->addr->hostname, client); } - if (client->fd) ioset_close(client->fd->fd, 1); + verify(client); + if (client->fd) + ioset_close(client->fd->fd, 1); sockcheck_list_unref(client->tests); free(client->read); free(client->resp_state); @@ -248,6 +250,7 @@ if (SOCKCHECK_DEBUG) { log_module(PC_LOG, LOG_INFO, "Client %s timed out.", client->addr->hostname); } + verify(client); sockcheck_advance(client, client->state->responses.used-1); } @@ -472,6 +475,7 @@ { struct sockcheck_state *ns; + verify(client); timeq_del(0, sockcheck_timeout_client, client, TIMEQ_IGNORE_WHEN); if (SOCKCHECK_DEBUG) { unsigned int n, m; @@ -522,6 +526,7 @@ unsigned int nn; int res; + verify(client); res = read(fd->fd, client->read + client->read_used, client->read_size - client->read_used); if (res < 0) { switch (res = errno) { @@ -628,6 +633,7 @@ sockcheck_connected(struct io_fd *fd, int rc) { struct sockcheck_client *client = fd->data; + verify(client); client->fd = fd; switch (rc) { default: @@ -654,6 +660,7 @@ { struct io_fd *io_fd; + verify(client); if (client->fd) { ioset_close(client->fd->fd, 1); client->fd = NULL; @@ -708,6 +715,7 @@ sci = dict_find(checked_ip_dict, ipstr, NULL); if (sci) { + verify(sci); switch (sci->decision) { case CHECKING: /* We are already checking this host. */ --- orig/src/proto-p10.c +++ mod/src/proto-p10.c @@ -1943,6 +1943,8 @@ { unsigned int n; + verify(user); + /* mark them as dead, in case anybody cares */ user->dead = 1; |
From: Michael P. <md...@tr...> - 2005-01-21 15:15:09
|
Revision: srvx--devo--1.3--patch-6 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Fri Jan 21 10:10:49 EST 2005 Standard-date: 2005-01-21 15:10:49 GMT Modified-files: ChangeLog src/alloc-srvx.c src/dict-splay.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-6 Summary: More debug allocator fixes and enhancements Keywords: src/alloc-srvx.c (*_MAGIC): ASk recognized the CCSDS ASM sequence. (srvx_free): Overwrite with 0xDE bytes to distinguish from uninitialized values. As SailorFrag suggested, only overwrite the user region. src/dict-splay.c (dict_insert): Check whether free functions need to be worked around here as well. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-6 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,25 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-01-21 15:10:49 GMT Michael Poole <md...@tr...> patch-6 + + Summary: + More debug allocator fixes and enhancements + Revision: + srvx--devo--1.3--patch-6 + + src/alloc-srvx.c (*_MAGIC): ASk recognized the CCSDS ASM sequence. + (srvx_free): Overwrite with 0xDE bytes to distinguish from + uninitialized values. As SailorFrag suggested, only overwrite the + user region. + + src/dict-splay.c (dict_insert): Check whether free functions need to + be worked around here as well. + + modified files: + ChangeLog src/alloc-srvx.c src/dict-splay.c + + 2005-01-21 00:48:35 GMT Michael Poole <md...@tr...> patch-5 Summary: --- orig/src/alloc-srvx.c +++ mod/src/alloc-srvx.c @@ -19,7 +19,6 @@ #undef malloc #undef free -/* cookies for anybody who recognizes these bytes without help :) */ #define ALLOC_MAGIC 0x1acf #define FREE_MAGIC 0xfc1d const char redzone[] = { '\x03', '\x47', '\x76', '\xc7' }; @@ -132,11 +131,11 @@ block = (struct alloc_header *)ptr - 1; assert(block->magic == ALLOC_MAGIC); assert(0 == memcmp((char*)(block + 1) + block->size, redzone, sizeof(redzone))); - size = block->size + sizeof(*block); - memset(block, 0, size); + size = block->size; + memset(block + 1, 0xde, size); block->magic = FREE_MAGIC; free(block); alloc_count--; - alloc_size -= size - sizeof(*block); + alloc_size -= size; (void)file; (void)line; } --- orig/src/dict-splay.c +++ mod/src/dict-splay.c @@ -186,8 +186,18 @@ dict->root = new_node; } else { /* maybe we don't want to overwrite it .. oh well */ - if (dict->free_data) dict->free_data(dict->root->data); - if (dict->free_keys) dict->free_keys((void*)dict->root->key); + if (dict->free_data) { + if (dict->free_data == free) + free(dict->root->data); + else + dict->free_data(dict->root->data); + } + if (dict->free_keys) { + if (dict->free_keys == free) + free((void*)dict->root->key); + else + dict->free_keys((void*)dict->root->key); + } free(new_node); dict->root->key = key; dict->root->data = data; |
From: Michael P. <md...@tr...> - 2005-01-21 00:49:08
|
Revision: srvx--devo--1.3--patch-5 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Thu Jan 20 19:48:35 EST 2005 Standard-date: 2005-01-21 00:48:35 GMT Modified-files: ChangeLog src/alloc-srvx.c src/opserv.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-5 Summary: Add redzone and statistics reporting to debug allocator. Keywords: src/alloc-srvx.c (redzone): New variable to detect buffer overwrites. (alloc_count, alloc_size): New variables to track allocation stats. (srvx_malloc, srvx_realloc, srvx_free): Use the above. src/opserv.c (OSMSG_STATS_MEMORY): New translation string. (cmd_stats_memory): New (conditional) command function. (init_opserv): Conditionally provide cmd_stats_memory. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-5 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,25 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-01-21 00:48:35 GMT Michael Poole <md...@tr...> patch-5 + + Summary: + Add redzone and statistics reporting to debug allocator. + Revision: + srvx--devo--1.3--patch-5 + + src/alloc-srvx.c (redzone): New variable to detect buffer overwrites. + (alloc_count, alloc_size): New variables to track allocation stats. + (srvx_malloc, srvx_realloc, srvx_free): Use the above. + + src/opserv.c (OSMSG_STATS_MEMORY): New translation string. + (cmd_stats_memory): New (conditional) command function. + (init_opserv): Conditionally provide cmd_stats_memory. + + modified files: + ChangeLog src/alloc-srvx.c src/opserv.c + + 2005-01-20 23:41:17 GMT Michael Poole <md...@tr...> patch-4 Summary: --- orig/src/alloc-srvx.c +++ mod/src/alloc-srvx.c @@ -22,6 +22,7 @@ /* cookies for anybody who recognizes these bytes without help :) */ #define ALLOC_MAGIC 0x1acf #define FREE_MAGIC 0xfc1d +const char redzone[] = { '\x03', '\x47', '\x76', '\xc7' }; struct alloc_header { unsigned int file_id : 8; @@ -32,6 +33,7 @@ static char file_id_map[256][32]; static unsigned int file_ids_used; +unsigned long alloc_count, alloc_size; static int file_id_cmp(const void *a_, const void *b_) @@ -57,13 +59,16 @@ { struct alloc_header *block; - block = malloc(sizeof(*block) + size); + block = malloc(sizeof(*block) + size + sizeof(redzone)); assert(block != NULL); memset(block, 0, sizeof(*block) + size); + memcpy((char*)(block + 1) + size, redzone, sizeof(redzone)); block->file_id = get_file_id(file); block->line = line; block->size = size; block->magic = ALLOC_MAGIC; + alloc_count++; + alloc_size += size; return block + 1; } @@ -75,17 +80,21 @@ if (ptr) { block = (struct alloc_header *)ptr - 1; assert(block->magic == ALLOC_MAGIC); + assert(0 == memcmp((char*)(block + 1) + block->size, redzone, sizeof(redzone))); if (block->size >= size) return block + 1; } - newblock = malloc(sizeof(*newblock) + size); + newblock = malloc(sizeof(*newblock) + size + sizeof(redzone)); assert(newblock != NULL); - memset(newblock, 0, sizeof(*newblock) + size); + memset(newblock, 0, sizeof(*newblock) + size + sizeof(redzone)); + memcpy((char*)(newblock + 1) + size, redzone, sizeof(redzone)); newblock->file_id = get_file_id(file); newblock->line = line; newblock->size = size; newblock->magic = ALLOC_MAGIC; + alloc_count++; + alloc_size += size; if (ptr) { memcpy(newblock + 1, block + 1, block->size); @@ -93,6 +102,8 @@ memset(block, 0, size); block->magic = FREE_MAGIC; free(block); + alloc_count--; + alloc_size -= size - sizeof(*block); } return newblock + 1; @@ -120,9 +131,12 @@ return; block = (struct alloc_header *)ptr - 1; assert(block->magic == ALLOC_MAGIC); + assert(0 == memcmp((char*)(block + 1) + block->size, redzone, sizeof(redzone))); size = block->size + sizeof(*block); memset(block, 0, size); block->magic = FREE_MAGIC; free(block); + alloc_count--; + alloc_size -= size - sizeof(*block); (void)file; (void)line; } --- orig/src/opserv.c +++ mod/src/opserv.c @@ -228,6 +228,7 @@ { "OSMSG_WARN_LISTSTART", "Channel activity warnings:" }, { "OSMSG_WARN_LISTENTRY", "%s (%s)" }, { "OSMSG_WARN_LISTEND", "End of activity warning list." }, + { "OSMSG_STATS_MEMORY", "%u allocations totalling %u bytes." }, { "OSMSG_UPLINK_CONNECTING", "Establishing connection with %s (%s:%d)." }, { "OSMSG_CURRENT_UPLINK", "$b%s$b is already the current uplink." }, { "OSMSG_INVALID_UPLINK", "$b%s$b is not a valid uplink name." }, @@ -1578,6 +1579,14 @@ return 1; } +#if defined(WITH_MALLOC_SRVX) +static MODCMD_FUNC(cmd_stats_memory) { + extern unsigned long alloc_count, alloc_size; + reply("OSMSG_STATS_MEMORY", alloc_count, alloc_size); + return 1; +} +#endif + static MODCMD_FUNC(cmd_dump) { char linedup[MAXLEN], *original; @@ -4101,6 +4110,9 @@ opserv_define_func("STATS UPLINK", cmd_stats_uplink, 0, 0, 0); opserv_define_func("STATS UPTIME", cmd_stats_uptime, 0, 0, 0); opserv_define_func("STATS WARN", cmd_stats_warn, 0, 0, 0); +#if defined(WITH_MALLOC_SRVX) + opserv_define_func("STATS MEMORY", cmd_stats_memory, 0, 0, 0); +#endif opserv_define_func("TRACE", cmd_trace, 100, 0, 3); opserv_define_func("TRACE PRINT", NULL, 0, 0, 0); opserv_define_func("TRACE COUNT", NULL, 0, 0, 0); |
From: Michael P. <md...@tr...> - 2005-01-20 23:41:42
|
Revision: srvx--devo--1.3--patch-4 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Thu Jan 20 18:41:17 EST 2005 Standard-date: 2005-01-20 23:41:17 GMT New-files: src/.arch-ids/alloc-srvx.c.id src/alloc-srvx.c Modified-files: ChangeLog TODO configure.in src/Makefile.am src/common.h src/dict-splay.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-4 Summary: Add built-in debug malloc wrapper. Keywords: TODO: Remove the completed TODO item. configure.in: Add --with-malloc=srvx support. src/Makefile.am: Add alloc-srvx.c to extra sources. src/common.h: Reindent debug malloc directives; add directives for WITH_MALLOC_SRVX. src/dict-splay.c: Kludge around free() as macro vs function. * added files src/.arch-ids/alloc-srvx.c.id src/alloc-srvx.c {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-4 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,32 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-01-20 23:41:17 GMT Michael Poole <md...@tr...> patch-4 + + Summary: + Add built-in debug malloc wrapper. + Revision: + srvx--devo--1.3--patch-4 + + TODO: Remove the completed TODO item. + + configure.in: Add --with-malloc=srvx support. + + src/Makefile.am: Add alloc-srvx.c to extra sources. + + src/common.h: Reindent debug malloc directives; add directives for + WITH_MALLOC_SRVX. + + src/dict-splay.c: Kludge around free() as macro vs function. + + new files: + src/.arch-ids/alloc-srvx.c.id src/alloc-srvx.c + + modified files: + ChangeLog TODO configure.in src/Makefile.am src/common.h + src/dict-splay.c + + 2005-01-20 22:51:54 GMT Michael Poole <md...@tr...> patch-3 Summary: --- orig/TODO +++ mod/TODO @@ -18,6 +18,3 @@ [FEATREQ] Suspension durations and/or comments when suspending user access to a channel [FEATREQ] support "unregistered": ?ctrace print mode +s unregistered - -- rewrite memory allocation calls to use wrapper macros, and add - optional debugging for the stubs to tag size and/or type. --- orig/configure.in +++ mod/configure.in @@ -152,7 +152,7 @@ AC_MSG_CHECKING(which malloc to use) AC_ARG_WITH(malloc, [ --with-malloc=type Enables use of a special malloc library; one of: - system (the default), boehm-gc, dmalloc, mpatrol], + system (the default), boehm-gc, dmalloc, mpatrol, srvx], [], [withval="system"]) if test "x$withval" = "xsystem" ; then @@ -176,6 +176,10 @@ AC_CHECK_LIB(dl, dlopen, , AC_MSG_ERROR([libdl library is missing. boehm-gc build will fail.])) AC_CHECK_LIB(gc, GC_gcollect, , AC_MSG_ERROR([Boehm GC library is missing. boehm-gc build will fail.])) AC_DEFINE(WITH_MALLOC_BOEHM_GC, 1, [Define if using the Boehm GC to garbage collect and check memory leaks]) +elif test "x$withval" = "xsrvx" ; then + AC_MSG_RESULT(srvx) + AC_DEFINE(WITH_MALLOC_SRVX, 1, [Define if using the srvx internal debug allocator]) + MODULE_OBJS="$MODULE_OBJS alloc-srvx.\$(OBJEXT)" else AC_MSG_ERROR([Unknown malloc type $withval]) fi --- orig/src/Makefile.am +++ mod/src/Makefile.am @@ -22,7 +22,7 @@ mv $$TMPFILE arch-version.h ; \ fi -EXTRA_srvx_SOURCES = proto-bahamut.c proto-common.c proto-p10.c mod-snoop.c mod-memoserv.c mod-helpserv.c mod-sockcheck.c +EXTRA_srvx_SOURCES = alloc-srvx.c proto-bahamut.c proto-common.c proto-p10.c mod-snoop.c mod-memoserv.c mod-helpserv.c mod-sockcheck.c srvx_LDADD = @MODULE_OBJS@ srvx_DEPENDENCIES = @MODULE_OBJS@ srvx_SOURCES = \ --- orig/src/common.h +++ mod/src/common.h @@ -64,25 +64,40 @@ #endif #if defined(WITH_MALLOC_DMALLOC) -#define DMALLOC_FUNC_CHECK 1 -#include <string.h> -#include <dmalloc.h> +# define DMALLOC_FUNC_CHECK 1 +# include <string.h> +# include <dmalloc.h> #elif defined(WITH_MALLOC_MPATROL) -#include <string.h> -#include <mpatrol.h> +# include <string.h> +# include <mpatrol.h> #elif defined(WITH_MALLOC_BOEHM_GC) -#if !defined(NDEBUG) -#define GC_DEBUG 1 -#endif -#include <stdlib.h> -#include <string.h> -#include <gc/gc.h> -#define malloc(n) GC_MALLOC(n) -#define calloc(m,n) GC_MALLOC((m)*(n)) -#define realloc(p,n) GC_REALLOC((p),(n)) -#define free(p) GC_FREE(p) -#undef HAVE_STRDUP -#undef strdup +# if !defined(NDEBUG) +# define GC_DEBUG 1 +# endif +# include <stdlib.h> +# include <string.h> +# include <gc/gc.h> +# define malloc(n) GC_MALLOC(n) +# define calloc(m,n) GC_MALLOC((m)*(n)) +# define realloc(p,n) GC_REALLOC((p),(n)) +# define free(p) GC_FREE(p) +# undef HAVE_STRDUP +# undef strdup +#elif defined(WITH_MALLOC_SRVX) +# undef malloc +# define malloc(n) srvx_malloc(__FILE__, __LINE__, (n)) +# undef calloc +# define calloc(m,n) srvx_malloc(__FILE__, __LINE__, (m)*(n)) +# undef realloc +# define realloc(p,n) srvx_realloc(__FILE__, __LINE__, (p), (n)) +# undef free +# define free(p) srvx_free(__FILE__, __LINE__, (p)) +# undef strdup +# define strdup(s) srvx_strdup(__FILE__, __LINE__, (s)) +extern void *srvx_malloc(const char *, unsigned int, size_t); +extern void *srvx_realloc(const char *, unsigned int, void *, size_t); +extern char *srvx_strdup(const char *, unsigned int, const char *); +extern void srvx_free(const char *, unsigned int, void *); #endif extern time_t now; --- orig/src/dict-splay.c +++ mod/src/dict-splay.c @@ -123,10 +123,18 @@ static void dict_dispose_node(struct dict_node *node, free_f free_keys, free_f free_data) { - if (free_keys && node->key) - free_keys((void*)node->key); - if (free_data && node->data) - free_data(node->data); + if (free_keys && node->key) { + if (free_keys == free) + free((void*)node->key); + else + free_keys((void*)node->key); + } + if (free_data && node->data) { + if (free_data == free) + free(node->data); + else + free_data(node->data); + } free(node); } |
From: Michael P. <md...@tr...> - 2005-01-20 22:52:26
|
Revision: srvx--devo--1.3--patch-3 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Thu Jan 20 17:51:54 EST 2005 Standard-date: 2005-01-20 22:51:54 GMT Modified-files: ChangeLog src/modcmd.c src/opserv.help src/tools.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-3 Summary: various bugfixes and IPv6 preparation work Keywords: src/modcmd.c (modcmd_privmsg): Fix CTCP PING response type. src/opserv.help: Add column headers for command lists. src/tools.c (is_gline, split_ircmask): Accept colons in hostnames. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-3 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,23 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-01-20 22:51:54 GMT Michael Poole <md...@tr...> patch-3 + + Summary: + various bugfixes and IPv6 preparation work + Revision: + srvx--devo--1.3--patch-3 + + src/modcmd.c (modcmd_privmsg): Fix CTCP PING response type. + + src/opserv.help: Add column headers for command lists. + + src/tools.c (is_gline, split_ircmask): Accept colons in hostnames. + + modified files: + ChangeLog src/modcmd.c src/opserv.help src/tools.c + + 2005-01-05 01:03:05 GMT Michael Poole <md...@tr...> patch-2 Summary: --- orig/src/modcmd.c +++ mod/src/modcmd.c @@ -852,10 +852,10 @@ irc_notice_user(bot, user, "\001CLIENTINFO CLIENTINFO PING TIME USERINFO VERSION\x01"); } else if (!irccasecmp(text, "PING")) { if (term) { - snprintf(response, sizeof(response), "\x01PONG %s\x01", term); + snprintf(response, sizeof(response), "\x01PING %s\x01", term); irc_notice_user(bot, user, response); } else { - irc_notice_user(bot,user, "\x01PONG\x01"); + irc_notice_user(bot,user, "\x01PING\x01"); } } else if (!irccasecmp(text, "TIME")) { struct tm tm; --- orig/src/opserv.help +++ mod/src/opserv.help @@ -17,6 +17,7 @@ "USER" ("$bUSER COMMANDS$b", "Search for, gives information on, and gives some control over IRC users.", "Alerts are a way to automatically detect (and optionally G-line) certain users. For example, a \"gline info sub7server\" alert would G-line any users using \"sub7server\" as their full name (user info field).", + " COMMAND [MinAccess]", " ACCESS [${level/access}]", " ADDALERT [${level/addalert}]", " ADDTRUST [${level/addtrust}]", @@ -93,6 +94,7 @@ " CHANNEL REACTIONS - Automated reactions based on channel names", " CHANNEL CONTROL - Channel information and control", "There are also some miscellaneous channel-related commands:", + " COMMAND [MinAccess]", " CHANINFO [${level/chaninfo}]", " CSEARCH [${level/csearch}]", " JOIN [${level/join}]", @@ -123,6 +125,7 @@ "CHANNEL REACTIONS" ("$bCHANNEL REACTION COMMANDS$b", "\"Bad-word\" channels are for assisting in enforcement of network policies (such as disallowing \"warez\" channels). \"Warning\" channels are for channels which may be abused when they are present, but should be allowed otherwise.", + " COMMAND [MinAccess]", " ADDBAD [${level/addbad}]", " ADDEXEMPT [${level/addexempt}]", " DELBAD [${level/delbad}]", @@ -152,6 +155,7 @@ "CHANNEL CONTROL" ("$bCHANNEL CONTROL COMMANDS$b", "These are analogous to the same (or similar) $C commands, but can be used on any channel.", + " COMMAND [MinAccess]", " BAN [${level/ban}]", " CLEARBANS [${level/clearbans}]", " CLEARMODES [${level/clearmodes}]", @@ -231,6 +235,7 @@ "GLINES" ("$bGLINE COMMANDS$b", "Searches for, issues, and removes G-lines (network-global K-lines).", + " COMMAND [MinAccess]", " BLOCK [${level/block}]", " GLINE [${level/gline}]", " GTRACE [${level/gtrace}]", @@ -273,6 +278,7 @@ "CLONES" ("$bCLONE/JUPE COMMANDS$b", "Commands that add, remove or control fake (reserved) users or servers.", + " COMMAND [MinAccess]", " CLONE [${level/clone}]", " COLLIDE [${level/collide}]", " JUPE [${level/jupe}]", @@ -305,6 +311,7 @@ "LOGS" ("$bLOGGING COMMANDS$b", "Controls what goes into logs and searches them.", + " COMMAND [MinAccess]", " LOG [${level/log}]", " REOPEN [${level/reopen}]"); "LOG" ("/msg $O LOG <criteria> <value> [<criteria> <value>]...", @@ -326,6 +333,7 @@ "RUNNING" ("$bRUNNING COMMANDS$b", "These commands control srvx's runtime state.", + " COMMAND [MinAccess]", " DIE [${level/die}]", " JUMP [${level/jump}]", " RECONNECT [${level/reconnect}]", @@ -351,6 +359,7 @@ "SERVICES" ("$bSERVICES COMMANDS$b", "These commands control how other services behave.", + " COMMAND [MinAccess]", " BANEMAIL [${level/banemail}]", " BIND [${level/bind}]", " GAG [${level/gag}]", @@ -378,6 +387,7 @@ "OTHER" ("$bOTHER COMMANDS$b", "These commands do not easily fall into one of the other categories.", + " COMMAND [MinAccess]", " DUMP [${level/dump}]", " HELP [${level/help}]", " RAW [${level/raw}]", --- orig/src/tools.c +++ mod/src/tools.c @@ -378,7 +378,7 @@ return 0; if (!*text) return 0; - while (*text && (isalnum((char)*text) || strchr(".-?*", *text))) + while (*text && (isalnum((char)*text) || strchr(".-?*:", *text))) text++; return !*text; } @@ -405,9 +405,9 @@ *text = 0; if (ident) *ident = start; - + start = ++text; - while (*text && (isalnum((char)*text) || strchr(".-?*", *text))) + while (*text && (isalnum((char)*text) || strchr(".-?*:", *text))) text++; if (host) *host = start; |
From: Michael P. <md...@tr...> - 2005-01-05 01:09:27
|
Revision: srvx--devo--1.3--patch-2 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Tue Jan 4 20:03:05 EST 2005 Standard-date: 2005-01-05 01:03:05 GMT Modified-files: ChangeLog src/proto-p10.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-2 Summary: Add MODE_REGISTERED as +z for P10. Keywords: Add MODE_REGISTERED as +z for P10. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-2 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,19 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-01-05 01:03:05 GMT Michael Poole <md...@tr...> patch-2 + + Summary: + Add MODE_REGISTERED as +z for P10. + Revision: + srvx--devo--1.3--patch-2 + + Add MODE_REGISTERED as +z for P10. + + modified files: + ChangeLog src/proto-p10.c + + 2005-01-04 19:35:57 GMT Michael Poole <md...@tr...> patch-1 Summary: --- orig/src/proto-p10.c +++ mod/src/proto-p10.c @@ -2083,6 +2083,7 @@ case 'r': do_chan_mode(MODE_REGONLY); break; case 's': do_chan_mode(MODE_SECRET); break; case 't': do_chan_mode(MODE_TOPICLIMIT); break; + case 'z': do_chan_mode(MODE_REGISTERED); break; #undef do_chan_mode case 'l': if (add) { @@ -2226,6 +2227,7 @@ DO_MODE_CHAR(REGONLY, 'r'); DO_MODE_CHAR(NOCOLORS, 'c'); DO_MODE_CHAR(NOCTCPS, 'C'); + DO_MODE_CHAR(REGISTERED, 'z'); #undef DO_MODE_CHAR if (change->modes_clear & channel->modes & MODE_KEY) mod_chanmode_append(&chbuf, 'k', channel->key); @@ -2264,6 +2266,7 @@ DO_MODE_CHAR(REGONLY, 'r'); DO_MODE_CHAR(NOCOLORS, 'c'); DO_MODE_CHAR(NOCTCPS, 'C'); + DO_MODE_CHAR(REGISTERED, 'z'); #undef DO_MODE_CHAR if(change->modes_set & MODE_KEY) mod_chanmode_append(&chbuf, 'k', change->new_key); @@ -2319,6 +2322,7 @@ DO_MODE_CHAR(REGONLY, 'r'); DO_MODE_CHAR(NOCOLORS, 'c'); DO_MODE_CHAR(NOCTCPS, 'C'); + DO_MODE_CHAR(REGISTERED, 'z'); #undef DO_MODE_CHAR } if (change->modes_set) { @@ -2334,6 +2338,7 @@ DO_MODE_CHAR(REGONLY, 'r'); DO_MODE_CHAR(NOCOLORS, 'c'); DO_MODE_CHAR(NOCTCPS, 'C'); + DO_MODE_CHAR(REGISTERED, 'z'); #undef DO_MODE_CHAR switch (change->modes_set & (MODE_KEY|MODE_LIMIT)) { case MODE_KEY|MODE_LIMIT: @@ -2379,6 +2384,7 @@ case 'r': remove |= MODE_REGONLY; break; case 'c': remove |= MODE_NOCOLORS; break; case 'C': remove |= MODE_NOCTCPS; break; + case 'z': remove |= MODE_REGISTERED; break; } } |
From: Michael P. <md...@tr...> - 2005-01-04 19:50:05
|
Michael Poole writes: > Revision: srvx--devo--1.3--patch-1 > Archive: sr...@sr...--2005-srvx You may have noticed the new archive name for the new year. This is a fairly standard technique used with arch archives to put a limit on the size of a repository. However, I could not find good docs on how one rotates an archive like that. After a bit of trial and error, I wrote the following (which is also part of http://arch.srvx.net/~entrope/arch-for-cvs-users.html). Read-only users only need to take the steps mentioned in the third paragraph. Many arch developers use a technique called archive rotation to limit the number of patches tracked in a particular archive. The most common form of this is by embedding the year in the archive name; for example, md...@tr...--2004 versus md...@tr...--2005. This raises the question of how to easily update your archive and project trees. First you must create the new archive using tla make-archive in the normal fashion. You should update your ~/.arch-params/signing/ entries to match. Then use tla tag -S OLD-VERSION NEW-VERSION to create the archive continuation. This only has to be done once. Updating your project tree is slightly easier, but must be done by each user; use tla replay NEW-VERSION to add the patch log, then tla set-tree-version NEW-VERSION to remember it as the default. If you use an automatically updated ChangeLog, you will probably want to rotate it, as well. Michael Poole |