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 "Undernet IRC Server Source Code.".
The branch, u2_10_12_branch has been updated
discards 4441d041f2b9e494e07102618d03cf57029da5bb (commit)
discards c3dc7b1b77dd33858f29c4d95562975f9e94ea1f (commit)
via b68d448eb015d4f2f18c68f85be0819f792030c4 (commit)
via 5b0d976506d298c9b057ff407905b315ff06929c (commit)
via 3a4e1bca047d879f7fbbd9d4c7530068b9fe5f98 (commit)
via 409bb69d637882304db359e1b24fc6114bd95077 (commit)
via e3bf7e94bdc733016ead3a07fec26cfc3b503748 (commit)
via 47af138e1904324d301956b7fda65447440d76ff (commit)
via 4db6d5dac69ece6bfd644f6dab8d6a8db86cb85b (commit)
via 651ab24733d56b431c0ad3d010f360399cab33e9 (commit)
via bcaf3c02b84a45cb4267ba9d0254accae8c66546 (commit)
via c61b85676c06c13793f038e6e8699186c8192fa5 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (4441d041f2b9e494e07102618d03cf57029da5bb)
\
N -- N -- N (b68d448eb015d4f2f18c68f85be0819f792030c4)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b68d448eb015d4f2f18c68f85be0819f792030c4
Author: Michael Poole <[email protected]>
Date: Fri Dec 27 21:33:29 2019 -0500
msgq_alloc: Address TODO comment
diff --git a/ircd/msgq.c b/ircd/msgq.c
index a5d11ec9..ec320500 100644
--- a/ircd/msgq.c
+++ b/ircd/msgq.c
@@ -247,8 +247,8 @@ msgq_mapiov(const struct MsgQ *mq, struct iovec *iov, int
count,
}
/** Allocate a message buffer large enough to hold \a length bytes.
- * TODO: \a in_mb needs better documentation.
- * @param[in] in_mb Some other message buffer(?).
+ *
+ * @param[in] in_mb Buffer containing the desired message.
* @param[in] length Number of bytes of space to reserve in output.
* @return Pointer to some usable message buffer.
*/
commit 5b0d976506d298c9b057ff407905b315ff06929c
Author: Michael Poole <[email protected]>
Date: Fri Dec 27 21:33:13 2019 -0500
init_conf: Update (remove) XXX and TODO comments
diff --git a/ircd/s_conf.c b/ircd/s_conf.c
index 5ed26ded..02fc7bb4 100644
--- a/ircd/s_conf.c
+++ b/ircd/s_conf.c
@@ -1060,8 +1060,7 @@ int init_conf(void)
/*
* make sure we're sane to start if the config
* file read didn't get everything we need.
- * XXX - should any of these abort the server?
- * TODO: add warning messages
+ * ircd_parser.y now has parse_error() for serious problems.
*/
if (0 == localConf.name || 0 == localConf.numeric)
return 0;
commit 3a4e1bca047d879f7fbbd9d4c7530068b9fe5f98
Author: Michael Poole <[email protected]>
Date: Sun Dec 22 23:08:16 2019 -0500
listener: Tidy up accept_connection()
diff --git a/ircd/listener.c b/ircd/listener.c
index 99fbaa66..c4d67872 100644
--- a/ircd/listener.c
+++ b/ircd/listener.c
@@ -436,6 +436,7 @@ void release_listener(struct Listener* listener)
static void accept_connection(struct Event* ev)
{
struct Listener* listener;
+ struct Socket* socket;
struct irc_sockaddr addr;
const char* msg;
int fd;
@@ -445,90 +446,75 @@ static void accept_connection(struct Event* ev)
assert(0 != ev_socket(ev));
assert(0 != s_data(ev_socket(ev)));
- listener = (struct Listener*) s_data(ev_socket(ev));
+ socket = ev_socket(ev);
+ listener = (struct Listener*) s_data(socket);
if (ev_type(ev) == ET_DESTROY) /* being destroyed */
return;
- else {
- assert(ev_type(ev) == ET_ACCEPT || ev_type(ev) == ET_ERROR);
- listener->last_accept = CurrentTime;
+ assert(ev_type(ev) == ET_ACCEPT || ev_type(ev) == ET_ERROR);
+
+ listener->last_accept = CurrentTime;
+ /* To be efficient, and to support edge-triggered event loops, we
+ * accept all the connections we can until we encounter an error.
+ */
+ while ((fd = os_accept(s_fd(socket), &addr)) >= 0)
+ {
+ /*
+ * Check for connection limit. If this fd exceeds the limit,
+ * all further accept()ed connections will also exceed it.
+ * Enable the server to clear out other connections before
+ * continuing to accept() new connections.
+ */
+ if (fd >= MAXCLIENTS)
+ {
+ msg = "All connections in use";
+ ++ServerStats->is_all_inuse;
+ reject:
+ len = snprintf(msgbuf, sizeof(msgbuf), ":%s ERROR :%s\r\n",
+ cli_name(&me), msg);
+ if (len < sizeof(msgbuf))
+ send(fd, msgbuf, len, 0);
+ close(fd);
+ continue;
+ }
+ /*
+ * check to see if listener is shutting down. Continue
+ * to accept(), because it makes sense to clear our the
+ * socket's queue as fast as possible.
+ */
+ if (!listener_active(listener))
+ {
+ msg = "Use another port";
+ ++ServerStats->is_inactive;
+ goto reject;
+ }
/*
- * There may be many reasons for error return, but
- * in otherwise correctly working environment the
- * probable cause is running out of file descriptors
- * (EMFILE, ENFILE or others?). The man pages for
- * accept don't seem to list these as possible,
- * although it's obvious that it may happen here.
- * Thus no specific errors are tested at this
- * point, just assume that connections cannot
- * be accepted until some old is closed first.
- *
- * This piece of code implements multi-accept, based
- * on the idea that poll/select can only be efficient,
- * if we succeed in handling all available events,
- * i.e. accept all pending connections.
- *
- * http://www.hpl.hp.com/techreports/2000/HPL-2000-174.html
+ * check to see if connection is allowed for this address mask
*/
- while (1)
+ if (!ipmask_check(&addr.addr, &listener->mask, listener->mask_bits))
{
- if ((fd = os_accept(s_fd(ev_socket(ev)), &addr)) == -1)
- {
- if (errno == EAGAIN) return;
+ msg = "Use another port";
+ ++ServerStats->is_bad_ip;
+ goto reject;
+ }
+
+ ++ServerStats->is_ac;
+ add_connection(listener, fd);
+ }
+
+ if ((errno != EAGAIN)
#ifdef EWOULDBLOCK
- if (errno == EWOULDBLOCK) return;
+ && (errno != EWOULDBLOCK)
#endif
- /* Lotsa admins seem to have problems with not giving enough file
- * descriptors to their server so we'll add a generic warning mechanism
- * here. If it turns out too many messages are generated for
- * meaningless reasons we can filter them back.
- */
- sendto_opmask_butone(0, SNO_TCPCOMMON,
- "Unable to accept connection: %m");
- return;
- }
- /*
- * check for connection limit. If this fd exceeds the limit,
- * all further accept()ed connections will also exceed it.
- * Enable the server to clear out other connections before
- * continuing to accept() new connections.
- */
- if (fd > MAXCLIENTS - 1)
- {
- msg = "All connections in use";
- ++ServerStats->is_all_inuse;
- reject:
- len = snprintf(msgbuf, sizeof(msgbuf), ":%s ERROR :%s\r\n",
- cli_name(&me), msg);
- if (len < sizeof(msgbuf))
- send(fd, msgbuf, len, 0);
- close(fd);
- return;
- }
- /*
- * check to see if listener is shutting down. Continue
- * to accept(), because it makes sense to clear our the
- * socket's queue as fast as possible.
- */
- if (!listener_active(listener))
- {
- msg = "Use another port";
- ++ServerStats->is_inactive;
- goto reject;
- }
- /*
- * check to see if connection is allowed for this address mask
- */
- if (!ipmask_check(&addr.addr, &listener->mask, listener->mask_bits))
- {
- msg = "Use another port";
- ++ServerStats->is_bad_ip;
- goto reject;
- }
- ++ServerStats->is_ac;
- /* nextping = CurrentTime; */
- add_connection(listener, fd);
- }
+ )
+ {
+ /* Lotsa admins seem to have problems with not giving enough file
+ * descriptors to their server so we'll add a generic warning mechanism
+ * here. If it turns out too many messages are generated for
+ * meaningless reasons we can filter them back.
+ */
+ sendto_opmask_butone(0, SNO_TCPCOMMON,
+ "Unable to accept connection: %m");
}
}
commit 409bb69d637882304db359e1b24fc6114bd95077
Author: Michael Poole <[email protected]>
Date: Fri Dec 27 21:21:20 2019 -0500
vdebug: Clamp log level to L_DEBUG
Fixes: c59e22b2636a1fcb8d9453dae5df638a8ddebb65
diff --git a/ircd/s_debug.c b/ircd/s_debug.c
index 490ca751..41abf91d 100644
--- a/ircd/s_debug.c
+++ b/ircd/s_debug.c
@@ -149,11 +149,14 @@ void vdebug(int level, const char *form, va_list vl)
{
static int loop = 0;
int err = errno;
+ int l_level = level;
+ if (l_level >= L_LAST_LEVEL)
+ l_level = L_DEBUG;
if (!loop && (debuglevel >= 0) && (level <= debuglevel))
{
loop = 1;
- log_vwrite(LS_DEBUG, level, 0, form, vl);
+ log_vwrite(LS_DEBUG, l_level, 0, form, vl);
loop = 0;
}
errno = err;
commit e3bf7e94bdc733016ead3a07fec26cfc3b503748
Author: Michael Poole <[email protected]>
Date: Sun Dec 22 22:17:03 2019 -0500
supported.h: Add +M channel mode; tidy up formatting
diff --git a/include/supported.h b/include/supported.h
index 5f0aa912..ad4a2be0 100644
--- a/include/supported.h
+++ b/include/supported.h
@@ -65,7 +65,9 @@
#define FEATURESVALUES2 NICKLEN, TOPICLEN, AWAYLEN, TOPICLEN, \
feature_int(FEAT_CHANNELLEN), CHANNELLEN, \
(feature_bool(FEAT_LOCAL_CHANNELS) ? "#&" : "#"),
"(ov)@+", "@+", \
- (feature_bool(FEAT_OPLEVELS) ? "b,AkU,l,imnpstrDdRcC"
: "b,k,l,imnpstrDdRcC"), \
+ (feature_bool(FEAT_OPLEVELS) \
+ ? "b,AkU,l,imnpstrDdRcCM" \
+ : "b,k,l,imnpstrDdRcCM"), \
"rfc1459", feature_str(FEAT_NETWORK)
#endif /* INCLUDED_supported_h */
commit 47af138e1904324d301956b7fda65447440d76ff
Author: Empus <[email protected]>
Date: Mon Dec 23 13:14:13 2019 +1000
channel mode +M (#5)
Add channel mode +M, moderation for users with no account stamp
* implementation of chanmode +M
channel moderation where only registered users can speak
* tidied up previous merge
* Update ircd/channel.c
Move MODE_DELJOINS
* chanmode +M: applied requested changes
* chanmode +M: corrected mode ordering
diff --git a/include/channel.h b/include/channel.h
index fc4916fe..fd136c89 100644
--- a/include/channel.h
+++ b/include/channel.h
@@ -113,12 +113,14 @@ struct Client;
#define MODE_APASS 0x200000
#define MODE_WASDELJOINS 0x400000 /**< Not DELJOINS, but some joins
* pending */
+#define MODE_MODERATENOREG 0x2000000 /**< +M Moderate unauthed users */
+
/** mode flags which take another parameter (With PARAmeterS)
*/
#define MODE_WPARAS
(MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT|MODE_APASS|MODE_UPASS)
/** Available Channel modes */
-#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AbiklmnopstUvrDdRcC" :
"biklmnopstvrDdRcC"
+#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AbiklmnopstUvrDdRcCM" :
"biklmnopstvrDdRcCM"
/** Available Channel modes that take parameters */
#define infochanmodeswithparams feature_bool(FEAT_OPLEVELS) ? "AbkloUv" :
"bklov"
diff --git a/ircd/channel.c b/ircd/channel.c
index 125ad7b8..a7ca024a 100644
--- a/ircd/channel.c
+++ b/ircd/channel.c
@@ -709,7 +709,7 @@ int member_can_send_to_channel(struct Membership* member,
int reveal)
return 0;
/* If only logged in users may join and you're not one, you can't speak. */
- if (member->channel->mode.mode & MODE_REGONLY && !IsAccount(member->user))
+ if (member->channel->mode.mode & (MODE_MODERATENOREG|MODE_REGONLY) &&
!IsAccount(member->user))
return 0;
/* If you're banned then you can't speak either. */
@@ -755,7 +755,7 @@ int client_can_send_to_channel(struct Client *cptr, struct
Channel *chptr, int r
*/
if (!member) {
if ((chptr->mode.mode & (MODE_NOPRIVMSGS|MODE_MODERATED)) ||
- ((chptr->mode.mode & MODE_REGONLY) && !IsAccount(cptr)))
+ ((chptr->mode.mode & (MODE_REGONLY|MODE_MODERATENOREG)) &&
!IsAccount(cptr)))
return 0;
else
return !find_ban(cptr, chptr->banlist);
@@ -781,7 +781,7 @@ const char* find_no_nickchange_channel(struct Client* cptr)
if (IsVoicedOrOpped(member))
continue;
if ((member->channel->mode.mode & MODE_MODERATED)
- || (member->channel->mode.mode & MODE_REGONLY && !IsAccount(cptr))
+ || (member->channel->mode.mode & (MODE_MODERATENOREG|MODE_REGONLY)
&& !IsAccount(cptr))
|| is_banned(member))
return member->channel->chname;
}
@@ -839,6 +839,8 @@ void channel_modes(struct Client *cptr, char *mbuf, char
*pbuf, int buflen,
*mbuf++ = 'c';
if (chptr->mode.mode & MODE_NOCTCP)
*mbuf++ = 'C';
+ if (chptr->mode.mode & MODE_MODERATENOREG)
+ *mbuf++ = 'M';
if (chptr->mode.limit) {
*mbuf++ = 'l';
ircd_snprintf(0, pbuf, buflen, "%u", chptr->mode.limit);
@@ -1536,6 +1538,7 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
MODE_REGISTERED, 'R',
MODE_NOCOLOR, 'c',
MODE_NOCTCP, 'C',
+ MODE_MODERATENOREG, 'M',
/* MODE_KEY, 'k', */
/* MODE_BAN, 'b', */
MODE_LIMIT, 'l',
@@ -1966,8 +1969,8 @@ modebuf_mode(struct ModeBuf *mbuf, unsigned int mode)
mode &= (MODE_ADD | MODE_DEL | MODE_PRIVATE | MODE_SECRET | MODE_MODERATED |
MODE_TOPICLIMIT | MODE_INVITEONLY | MODE_NOPRIVMSGS | MODE_REGONLY |
- MODE_NOCOLOR | MODE_NOCTCP |
- MODE_DELJOINS | MODE_WASDELJOINS | MODE_REGISTERED);
+ MODE_NOCOLOR | MODE_NOCTCP | MODE_MODERATENOREG |
+ MODE_DELJOINS | MODE_WASDELJOINS | MODE_REGISTERED);
if (!(mode & ~(MODE_ADD | MODE_DEL))) /* don't add empty modes... */
return;
@@ -2102,6 +2105,7 @@ modebuf_extract(struct ModeBuf *mbuf, char *buf)
MODE_DELJOINS, 'D',
MODE_NOCOLOR, 'c',
MODE_NOCTCP, 'C',
+ MODE_MODERATENOREG, 'M',
0x0, 0x0
};
unsigned int add;
@@ -3245,6 +3249,7 @@ mode_parse(struct ModeBuf *mbuf, struct Client *cptr,
struct Client *sptr,
MODE_DELJOINS, 'D',
MODE_NOCOLOR, 'c',
MODE_NOCTCP, 'C',
+ MODE_MODERATENOREG, 'M',
MODE_ADD, '+',
MODE_DEL, '-',
0x0, 0x0
diff --git a/ircd/m_clearmode.c b/ircd/m_clearmode.c
index fdac7883..c616f4c8 100644
--- a/ircd/m_clearmode.c
+++ b/ircd/m_clearmode.c
@@ -126,6 +126,7 @@ do_clearmode(struct Client *cptr, struct Client *sptr,
struct Channel *chptr,
MODE_DELJOINS, 'D',
MODE_NOCOLOR, 'c',
MODE_NOCTCP, 'C',
+ MODE_MODERATENOREG, 'M',
0x0, 0x0
};
int *flag_p;
commit 4db6d5dac69ece6bfd644f6dab8d6a8db86cb85b
Author: Michael Poole <[email protected]>
Date: Sat Dec 21 21:24:06 2019 -0500
s_auth: Support asynchronous reply for "STATS iauth"
This requires a check for when clients exit, like UPING does.
It also requires m_stats() to not send RPL_ENDOFSTATS for "STATS iauth".
When iauth advertises a "S" capability, send it "? stats2".
diff --git a/doc/readme.iauth b/doc/readme.iauth
index ad057f25..6572601b 100644
--- a/doc/readme.iauth
+++ b/doc/readme.iauth
@@ -270,6 +270,7 @@ Comments: Request that the iauth program send a particular
type of
information to the server. The predefined values for <type> are:
config - iauth should send an "a", followed by all current "A" lines
stats - iauth should send an "s", followed by all current "S" lines
+ stats2 - iauth should send all current "S" lines, followed by an "s"
Compatibility: This is an Undernet extension and ircd does not send it.
IAUTH MESSAGES
@@ -332,8 +333,9 @@ Comments: Sets policy options for the iauth conversation.
Old policy
When this policy is in effect and a DNS message (N or d) is
sent for a client, that client's registration timeout is
extended or reset.
-Compatibility: The U policy is an Undernet extension and is not
- recognized by ircd.
+ S - IAuth supports the "? stats2" info request.
+Compatibility: The U and A policies are an Undernet extensions and are
+ not recognized by ircd.
V - iauth Program Version
Syntax: V :<version string>
@@ -360,7 +362,8 @@ Syntax: s
Example: s
Notify: yes
Comments: Indicates a new set of statistics will be sent. Any cached
- statistics records should be cleared.
+ statistics records should be cleared. In response to a "? stats2"
+ request, instead marks the end of a set of statistics.
S - Statistics Information
Syntax: S <module> :<module information>
diff --git a/include/client.h b/include/client.h
index 751d0fc3..ee415750 100644
--- a/include/client.h
+++ b/include/client.h
@@ -154,6 +154,7 @@ enum Flag
FLAG_BURST, /**< Server is receiving a net.burst */
FLAG_BURST_ACK, /**< Server is waiting for eob ack */
FLAG_IPCHECK, /**< Added or updated IPregistry data */
+ FLAG_IAUTH_STATS, /**< Wanted IAuth statistics */
FLAG_LOCOP, /**< Local operator -- SRB */
FLAG_SERVNOTICE, /**< server notices such as kill */
FLAG_OPER, /**< Operator */
@@ -573,6 +574,8 @@ struct Client {
#define IsUPing(x) HasFlag(x, FLAG_UPING)
/** Return non-zero if the client has no '\n' in its buffer. */
#define NoNewLine(x) HasFlag(x, FLAG_NONL)
+/** Return non-zero if the client has requested IAuth statistics. */
+#define IsIAuthStats(x) HasFlag(x, FLAG_IAUTH_STATS)
/** Return non-zero if the client has set mode +g (debugging). */
#define SendDebug(x) HasFlag(x, FLAG_DEBUG)
/** Return non-zero if the client has set mode +s (server notices). */
diff --git a/include/s_auth.h b/include/s_auth.h
index 52c6863f..657e925a 100644
--- a/include/s_auth.h
+++ b/include/s_auth.h
@@ -49,6 +49,7 @@ extern void auth_send_exit(struct Client *cptr);
extern void auth_send_xreply(struct Client *sptr, const char *routing, const
char *reply);
extern void auth_mark_closing(void);
extern void auth_close_unused(void);
+extern void auth_cancel_iauth_stats(struct Client *cptr);
extern void report_iauth_conf(struct Client *cptr, const struct StatDesc *sd,
char *param);
extern void report_iauth_stats(struct Client *cptr, const struct StatDesc *sd,
char *param);
diff --git a/include/s_stats.h b/include/s_stats.h
index 417e5c2a..5730e6c1 100644
--- a/include/s_stats.h
+++ b/include/s_stats.h
@@ -58,6 +58,7 @@ struct StatDesc
#define STAT_FLAG_LOCONLY 0x04 /**< Local user only */
#define STAT_FLAG_CASESENS 0x08 /**< Flag is case-sensitive */
#define STAT_FLAG_VARPARAM 0x10 /**< May have an extra parameter */
+#define STAT_FLAG_ASYNC 0x20 /**< Response is asynchronous */
extern void stats_init(void);
const struct StatDesc *stats_find(const char *name_or_char);
diff --git a/ircd/m_stats.c b/ircd/m_stats.c
index 60c4718e..7d4d91b7 100644
--- a/ircd/m_stats.c
+++ b/ircd/m_stats.c
@@ -165,6 +165,10 @@ m_stats(struct Client* cptr, struct Client* sptr, int
parc, char* parv[])
/* Ok, dispatch the stats function */
(*sd->sd_func)(sptr, sd, param);
+ /* If the response is asynchronous, do not send RPL_ENDOFSTATS yet. */
+ if (sd->sd_flags & STAT_FLAG_ASYNC)
+ return 0;
+
/* Done sending them the stats */
return send_reply(sptr, RPL_ENDOFSTATS, parv[1]);
}
diff --git a/ircd/s_auth.c b/ircd/s_auth.c
index 68aab5e4..85b91dcd 100644
--- a/ircd/s_auth.c
+++ b/ircd/s_auth.c
@@ -60,6 +60,7 @@
#include "s_conf.h"
#include "s_debug.h"
#include "s_misc.h"
+#include "s_stats.h"
#include "s_user.h"
#include "send.h"
@@ -158,6 +159,7 @@ enum IAuthFlag
IAUTH_TIMEOUT, /**< Refuse new connections if IAuth
is behind. */
IAUTH_EXTRAWAIT, /**< Give IAuth extra time to answer.
*/
IAUTH_UNDERNET, /**< Enable Undernet extensions. */
+ IAUTH_STATS2, /**< Support "? stats2" request. */
IAUTH_LAST_FLAG /**< total number of flags */
};
/** Declare a bitset structure indexed by IAuthFlag. */
@@ -207,6 +209,10 @@ struct IAuth {
static struct IAuth *iauth;
/** Freelist of AuthRequest structures. */
static struct AuthRequest *auth_freelist;
+/** Clients currently receiving IAuth statistics. */
+static struct SLink *iauth_stats_clients;
+/** Clients queued to get IAuth statistics. */
+static struct SLink *iauth_stats_queued;
static void iauth_sock_callback(struct Event *ev);
static void iauth_stderr_callback(struct Event *ev);
@@ -1652,6 +1658,7 @@ static int iauth_cmd_debuglevel(struct IAuth *iauth,
struct Client *cli,
* \li T IAUTH_TIMEOUT
* \li W IAUTH_EXTRAWAIT
* \li U IAUTH_UNDERNET
+ * \li S IAUTH_STATS2
*
* @param[in] iauth Active IAuth session.
* @param[in] cli Client referenced by command.
@@ -1677,6 +1684,7 @@ static int iauth_cmd_policy(struct IAuth *iauth, struct
Client *cli,
case 'T': IAuthSet(iauth, IAUTH_TIMEOUT); break;
case 'W': IAuthSet(iauth, IAUTH_EXTRAWAIT); break;
case 'U': IAuthSet(iauth, IAUTH_UNDERNET); break;
+ case 'S': IAuthSet(iauth, IAUTH_STATS2); break;
}
/* Optionally notify operators. */
@@ -1787,14 +1795,34 @@ static int iauth_cmd_newstats(struct IAuth *iauth,
struct Client *cli,
struct SLink *head;
struct SLink *next;
- head = iauth->i_stats;
- iauth->i_stats = NULL;
- for (; head; head = next) {
- next = head->next;
- MyFree(head->value.cp);
- free_link(head);
+ if (iauth_stats_clients)
+ {
+ for (head = iauth_stats_clients; head; head = next)
+ {
+ next = head->next;
+ send_reply(head->value.cptr, RPL_ENDOFSTATS, "iauthstats");
+ free_link(head);
+ }
+
+ iauth_stats_clients = iauth_stats_queued;
+ iauth_stats_queued = NULL;
+ if (iauth_stats_clients)
+ {
+ sendto_iauth(NULL, "? stats2");
+ }
}
- sendto_opmask_butone(NULL, SNO_AUTH, "New iauth statistics.");
+ else
+ {
+ head = iauth->i_stats;
+ iauth->i_stats = NULL;
+ for (; head; head = next) {
+ next = head->next;
+ MyFree(head->value.cp);
+ free_link(head);
+ }
+ sendto_opmask_butone(NULL, SNO_AUTH, "New iauth statistics.");
+ }
+
return 0;
}
@@ -1811,11 +1839,23 @@ static int iauth_cmd_stats(struct IAuth *iauth, struct
Client *cli,
struct SLink *node, **pptr;
char *line;
- for (pptr = &iauth->i_stats; *pptr; pptr = &((*pptr)->next)) ;
- node = *pptr = make_link();
line = paste_params(parc, params);
- DupString(node->value.cp, line);
- node->next = 0; /* must be explicitly cleared */
+ if (iauth_stats_clients)
+ {
+ for (node = iauth_stats_clients; node; node = node->next)
+ {
+ struct Client *cptr = node->value.cptr;
+ send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":%s", line);
+ }
+ }
+ else
+ {
+ for (pptr = &iauth->i_stats; *pptr; pptr = &((*pptr)->next)) ;
+ node = *pptr = make_link();
+ DupString(node->value.cp, line);
+ node->next = 0; /* must be explicitly cleared */
+ }
+
return 0;
}
@@ -2500,20 +2540,63 @@ void report_iauth_conf(struct Client *cptr, const
struct StatDesc *sd, char *par
* @param[in] sd Stats descriptor for request.
* @param[in] param Extra parameter from user (may be NULL).
*/
- void report_iauth_stats(struct Client *cptr, const struct StatDesc *sd, char
*param)
+void report_iauth_stats(struct Client *cptr, const struct StatDesc *sd, char
*param)
{
struct SLink *link;
if (!iauth)
return;
- for (link = iauth->i_stats; link; link = link->next)
+ if (IAuthHas(iauth, IAUTH_STATS2))
{
- send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":%s", link->value.cp);
+ struct SLink *link;
+
+ link = make_link();
+ link->value.cptr = cptr;
+ if (iauth_stats_clients)
+ {
+ link->next = iauth_stats_queued;
+ iauth_stats_queued = link;
+ }
+ else
+ {
+ iauth_stats_clients = link;
+ sendto_iauth(NULL, "? stats2");
+ }
}
+ else
+ {
+ for (link = iauth->i_stats; link; link = link->next)
+ {
+ send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":%s", link->value.cp);
+ }
+ send_reply(cptr, RPL_ENDOFSTATS, sd->sd_name);
- if (param && !strcmp(param, "get"))
+ if (param && !strcmp(param, "get") && !IAuthHas(iauth, IAUTH_STATS2))
+ {
+ sendto_iauth(NULL, "? stats");
+ }
+ }
+}
+
+static void remove_client_from_slist(struct Client *cptr, struct SLink **pptr)
+{
+ for (; *pptr != NULL; pptr = &((*pptr)->next))
{
- sendto_iauth(NULL, "? stats");
+ if ((*pptr)->value.cptr == cptr)
+ {
+ struct SLink *link = *pptr;
+ *pptr = link->next;
+ free_link(link);
+ }
}
}
+
+/** Cancel a client's request for IAuth statistics.
+ * @param[in] cptr Client to cancel request for.
+ */
+void auth_cancel_iauth_stats(struct Client *cptr)
+{
+ remove_client_from_slist(cptr, &iauth_stats_clients);
+ remove_client_from_slist(cptr, &iauth_stats_queued);
+}
diff --git a/ircd/s_misc.c b/ircd/s_misc.c
index 18ded623..08236447 100644
--- a/ircd/s_misc.c
+++ b/ircd/s_misc.c
@@ -192,6 +192,11 @@ static void exit_one_client(struct Client* bcptr, const
char* comment)
*/
if (IsUPing(bcptr))
uping_cancel(bcptr, 0);
+ /*
+ * Remove from /stats iauthstats lst
+ */
+ if (IsIAuthStats(bcptr))
+ auth_cancel_iauth_stats(bcptr);
/*
* Stop a running /LIST clean
*/
diff --git a/ircd/s_stats.c b/ircd/s_stats.c
index 0a35b820..07ddf9cb 100644
--- a/ircd/s_stats.c
+++ b/ircd/s_stats.c
@@ -652,7 +652,7 @@ struct StatDesc statsinfo[] = {
{ 'z', "memory", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_z,
count_memory, 0,
"Memory/Structure allocation information." },
- { ' ', "iauth", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM),
FEAT_HIS_STATS_IAUTH,
+ { ' ', "iauth", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM | STAT_FLAG_ASYNC),
FEAT_HIS_STATS_IAUTH,
report_iauth_stats, 0,
"IAuth statistics." },
{ ' ', "iauthconf", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM),
FEAT_HIS_STATS_IAUTH,
commit 651ab24733d56b431c0ad3d010f360399cab33e9
Author: Michael Poole <[email protected]>
Date: Tue Dec 10 21:03:14 2019 -0500
s_auth: Clean up paste_params() and its usage
diff --git a/ircd/s_auth.c b/ircd/s_auth.c
index f2e3d920..68aab5e4 100644
--- a/ircd/s_auth.c
+++ b/ircd/s_auth.c
@@ -1702,41 +1702,31 @@ static int iauth_cmd_version(struct IAuth *iauth,
struct Client *cli,
return 0;
}
-/** Paste a parameter list together into a single string.
+/** Paste a parameter list together into a single (static) string.
* @param[in] parc Number of parameters.
* @param[in] params Parameter list to paste together.
* @return Pasted parameter list.
*/
static char *paste_params(int parc, char **params)
{
- char *str, *tmp;
- int len = 0, lengths[MAXPARA], i;
+ static char buf[BUFSIZE+1];
+ int len, i, j;
/* Compute the length... */
- for (i = 0; i < parc; i++)
- len += lengths[i] = strlen(params[i]);
-
- /* Allocate memory, accounting for string lengths, spaces (parc - 1), a
- * sentinel, and the trailing \0
- */
- str = MyMalloc(len + parc + 1);
-
- /* Build the pasted string */
- for (tmp = str, i = 0; i < parc; i++) {
- if (i) /* add space separator... */
- *(tmp++) = ' ';
- if (i == parc - 1) /* add colon sentinel */
- *(tmp++) = ':';
-
- /* Copy string component... */
- memcpy(tmp, params[i], lengths[i]);
- tmp += lengths[i]; /* move to end of string */
+ for (i = len = 0; i < parc; i++) {
+ char *p = params[i];
+ if (i && (len < BUFSIZE)) /* add space separator... */
+ buf[len++] = ' ';
+ if ((i == parc - 1) && (len < BUFSIZE)) /* add colon sentinel */
+ buf[len++] = ':';
+ for (j = 0; (p[j] != '\0') && (len < BUFSIZE); ++j) /* copy arg */
+ buf[len++] = p[j];
}
- /* terminate the string... */
- *tmp = '\0';
+ /* terminate the string */
+ buf[len] = '\0';
- return str; /* return the pasted string */
+ return buf;
}
/** Clear cached iauth configuration information.
@@ -1773,15 +1763,13 @@ static int iauth_cmd_newconfig(struct IAuth *iauth,
struct Client *cli,
static int iauth_cmd_config(struct IAuth *iauth, struct Client *cli,
int parc, char **params)
{
- struct SLink *node;
+ struct SLink *node, **pptr;
+ char *line;
- if (iauth->i_config) {
- for (node = iauth->i_config; node->next; node = node->next) ;
- node = node->next = make_link();
- } else {
- node = iauth->i_config = make_link();
- }
- node->value.cp = paste_params(parc, params);
+ for (pptr = &iauth->i_config; *pptr; pptr = &((*pptr)->next)) ;
+ node = *pptr = make_link();
+ line = paste_params(parc, params);
+ DupString(node->value.cp, line);
node->next = 0; /* must be explicitly cleared */
return 0;
}
@@ -1820,14 +1808,13 @@ static int iauth_cmd_newstats(struct IAuth *iauth,
struct Client *cli,
static int iauth_cmd_stats(struct IAuth *iauth, struct Client *cli,
int parc, char **params)
{
- struct SLink *node;
- if (iauth->i_stats) {
- for (node = iauth->i_stats; node->next; node = node->next) ;
- node = node->next = make_link();
- } else {
- node = iauth->i_stats = make_link();
- }
- node->value.cp = paste_params(parc, params);
+ struct SLink *node, **pptr;
+ char *line;
+
+ for (pptr = &iauth->i_stats; *pptr; pptr = &((*pptr)->next)) ;
+ node = *pptr = make_link();
+ line = paste_params(parc, params);
+ DupString(node->value.cp, line);
node->next = 0; /* must be explicitly cleared */
return 0;
}
commit bcaf3c02b84a45cb4267ba9d0254accae8c66546
Merge: 08df0f21 c61b8567
Author: Michael Poole <[email protected]>
Date: Sat Nov 23 09:39:13 2019 -0500
Merge pull request #7 from hiddn/cprivmsg_idle
idle reset for CPRIVMSG command
commit c61b85676c06c13793f038e6e8699186c8192fa5
Author: Hidden <[email protected]>
Date: Sun Nov 17 10:46:37 2019 -0500
idle reset for CPRIVMSG command
diff --git a/ircd/m_cprivmsg.c b/ircd/m_cprivmsg.c
index afda1bc9..685451f3 100644
--- a/ircd/m_cprivmsg.c
+++ b/ircd/m_cprivmsg.c
@@ -86,6 +86,8 @@
#include "ircd_reply.h"
#include "ircd_string.h"
#include "s_user.h"
+#include "ircd.h"
+#include "ircd_features.h"
/* #include <assert.h> -- Now using assert in ircd_log.h */
@@ -105,6 +107,9 @@ int m_cprivmsg(struct Client* cptr, struct Client* sptr,
int parc, char* parv[])
if (parc < 4 || EmptyString(parv[3]))
return need_more_params(sptr, "CPRIVMSG");
+ if (feature_bool(FEAT_IDLE_FROM_MSG))
+ cli_user(sptr)->last = CurrentTime;
+
return whisper(sptr, parv[1], parv[2], parv[3], 0);
}
-----------------------------------------------------------------------
Summary of changes:
include/channel.h | 4 +-
include/supported.h | 4 +-
ircd/channel.c | 15 ++++--
ircd/listener.c | 138 +++++++++++++++++++++++-----------------------------
ircd/m_clearmode.c | 1 +
ircd/m_cprivmsg.c | 5 ++
ircd/msgq.c | 4 +-
ircd/s_conf.c | 3 +-
ircd/s_debug.c | 5 +-
9 files changed, 91 insertions(+), 88 deletions(-)
hooks/post-receive
--
Undernet IRC Server Source Code.
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches