more than 4096 IP's in 60s it warns 'dst cache overflow'. This limit can be
changed by modifying /proc/sys/net/ipv4/route/max_size.
+A patch to select is also recommended if you have regular poll/select
+errors.
\ No newline at end of file
The admin message is used to find the name of the administrator of
the given server, or current server if <server> parameter is omitted.
Each server must have the ability to forward ADMIN messages to other
- servers.
+ servers. The given server may be a nick, where the server that the
+ nick is on will be queried.
Numeric Replies:
extern int need_more_params(struct Client* cptr, const char* cmd);
extern int send_error_to_client(struct Client* cptr, int error, ...);
extern int send_reply(struct Client* to, int reply, ...);
-extern int send_admin_info(struct Client* to);
#define SND_EXPLICIT 0x40000000 /* first arg is a pattern to use */
extern void user_count_memory(size_t* count_out, size_t* bytes_out);
-extern int user_set_away(struct User* user, char* message);
extern int do_nick_name(char* nick);
extern int set_nick_name(struct Client* cptr, struct Client* sptr,
const char* nick, int parc, char* parv[]);
return 0; /* convenience return */
}
-int send_admin_info(struct Client* sptr)
-{
- const struct LocalConf* admin = conf_get_local();
- assert(0 != sptr);
-
- send_reply(sptr, RPL_ADMINME, cli_name(&me));
- send_reply(sptr, RPL_ADMINLOC1, admin->location1);
- send_reply(sptr, RPL_ADMINLOC2, admin->location2);
- send_reply(sptr, RPL_ADMINEMAIL, admin->contact);
- return 0;
-}
#include <assert.h>
+static int send_admin_info(struct Client* sptr)
+{
+ const struct LocalConf* admin = conf_get_local();
+ assert(0 != sptr);
+
+ send_reply(sptr, RPL_ADMINME, cli_name(&me));
+ send_reply(sptr, RPL_ADMINLOC1, admin->location1);
+ send_reply(sptr, RPL_ADMINLOC2, admin->location2);
+ send_reply(sptr, RPL_ADMINEMAIL, admin->contact);
+ return 0;
+}
+
+
/*
* m_admin - generic message handler
*
if (parc > 1) {
struct Client *acptr;
- if (!(acptr = find_match_server(parv[1])))
+ acptr = FindUser(parv[1]);
+ if (acptr)
+ parv[1] = cli_name(cli_user(acptr)->server);
+ else if (!(acptr = find_match_server(parv[1])))
return send_reply(sptr, ERR_NOSUCHSERVER, parv[1]);
parv[1] = cli_name(acptr);
#endif /* 0 */
#include "client.h"
#include "ircd.h"
+#include "ircd_alloc.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include <assert.h>
+/*
+ * user_set_away - set user away state
+ * returns 1 if client is away or changed away message, 0 if
+ * client is removing away status.
+ * NOTE: this function may modify user and message, so they
+ * must be mutable.
+ */
+static int user_set_away(struct User* user, char* message)
+{
+ char* away;
+ assert(0 != user);
+
+ away = user->away;
+
+ if (EmptyString(message)) {
+ /*
+ * Marking as not away
+ */
+ if (away) {
+ MyFree(away);
+ user->away = 0;
+ }
+ }
+ else {
+ /*
+ * Marking as away
+ */
+ unsigned int len = strlen(message);
+
+ if (len > TOPICLEN) {
+ message[TOPICLEN] = '\0';
+ len = TOPICLEN;
+ }
+ if (away)
+ away = (char*) MyRealloc(away, len + 1);
+ else
+ away = (char*) MyMalloc(len + 1);
+ assert(0 != away);
+
+ user->away = away;
+ strcpy(away, message);
+ }
+ return (user->away != 0);
+}
+
+
/*
* m_away - generic message handler template
* - Added 14 Dec 1988 by jto.
*
* parv[0] = sender prefix
* parv[1] = away message
+ *
+ * TODO: Throttle aways - many people have a script which resets the away
+ * message every 10 seconds which really chews the bandwidth.
*/
int m_away(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
* checked it's args, if we don't have parc == 4, something
* isn't right.
*/
+ protocol_violation(sptr, "Too few parameters to connect");
return need_more_params(sptr, "CONNECT");
}
return 0;
}
-
-#if 0
-/*
- * m_desynch
- *
- * Writes to all +g users; for sending wall type debugging/anti-hack info.
- * Added 23 Apr 1998 --Run
- *
- * parv[0] - sender prefix
- * parv[parc-1] - message text
- */
-int m_desynch(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
- if (IsServer(sptr) && parc >= 2)
- {
- int i;
- struct Client *acptr;
- /* Send message to local +g clients as if it were a wallops */
- sprintf_irc(sendbuf, ":%s WALLOPS :%s", parv[0], parv[parc - 1]); /* XXX DEAD */
- for (i = 0; i <= HighestFd; i++)
- if ((acptr = LocalClientArray[i]) && !IsServer(acptr) && !IsMe(acptr) &&
- SendDebug(acptr))
- sendbufto_one(acptr); /* XXX DEAD */
- /* Send message to remote +g clients */
- sendto_g_serv_butone(cptr, "%s DESYNCH :%s", NumServ(sptr), parv[parc - 1]); /* XXX DEAD */
- }
- return 0;
-}
-#endif /* 0 */
-
return 0;
}
-
-
-#if 0
-/*
- * m_end_of_burst - Added Xorath 6-14-96, rewritten by Run 24-7-96
- * - and fixed by record and Kev 8/1/96
- * - and really fixed by Run 15/8/96 :p
- * This the last message in a net.burst.
- * It clears a flag for the server sending the burst.
- *
- * parv[0] - sender prefix
- */
-int m_end_of_burst(struct Client *cptr, struct Client *sptr, int parc, char **parv)
-{
- if (!IsServer(sptr))
- return 0;
-
- sendto_op_mask(SNO_NETWORK, "Completed net.burst from %s.", sptr->name); /* XXX DEAD */
- sendto_serv_butone(cptr, "%s EB", NumServ(sptr)); /* XXX DEAD */
- ClearBurst(sptr);
- SetBurstAck(sptr);
- if (MyConnect(sptr))
- sendto_one(sptr, "%s EA", NumServ(&me)); /* XXX DEAD */
-
- return 0;
-}
-/*
- * m_end_of_burst_ack
- *
- * This the acknowledge message of the `END_OF_BURST' message.
- * It clears a flag for the server receiving the burst.
- *
- * parv[0] - sender prefix
- */
-int m_end_of_burst_ack(struct Client *cptr, struct Client *sptr, int parc, char **parv)
-{
- if (!IsServer(sptr))
- return 0;
-
- sendto_op_mask(SNO_NETWORK, "%s acknowledged end of net.burst.", sptr->name); /* XXX DEAD */
- sendto_serv_butone(cptr, "%s EA", NumServ(sptr)); /* XXX DEAD */
- ClearBurstAck(sptr);
-
- return 0;
-}
-
-#endif /* 0 */
-
return 0;
}
-
-#if 0
-/*
- * m_help
- *
- * parv[0] = sender prefix
- */
-int m_help(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
- int i;
-
- for (i = 0; msgtab[i].cmd; i++)
- sendto_one(sptr, ":%s NOTICE %s :%s", me.name, parv[0], msgtab[i].cmd); /* XXX DEAD */
- return 0;
-}
-#endif /* 0 */
-
#include "numnicks.h"
#include "s_misc.h"
#include "s_user.h"
+#include "s_conf.h"
#include "send.h"
#include "version.h"
{
const char **text = infotext;
- if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) ==
+ if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) !=
HUNTED_ISME)
+ return 0;
+
+ while (text[2])
{
- while (text[2])
- {
- if (!IsOper(sptr))
- send_reply(sptr, RPL_INFO, *text);
- text++;
- }
- if (IsOper(sptr))
- {
- while (*text)
- send_reply(sptr, RPL_INFO, *text++);
- send_reply(sptr, RPL_INFO, "");
- }
- send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s",
- creation, generation);
- send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s",
- myctime(cli_firsttime(&me)));
- send_reply(sptr, RPL_ENDOFINFO);
+ send_reply(sptr, RPL_INFO, *text);
+ text++;
}
+ send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s",
+ creation, generation);
+ send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s",
+ myctime(cli_firsttime(&me)));
+ send_reply(sptr, RPL_ENDOFINFO);
+
return 0;
}
if (IsServer(sptr))
return 0;
- if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) ==
+ if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) !=
HUNTED_ISME)
+ return 0;
+ while (text[2])
{
- while (text[2])
- {
- if (!IsOper(sptr))
- send_reply(sptr, RPL_INFO, *text);
- text++;
- }
- if (IsOper(sptr))
- {
- while (*text)
- send_reply(sptr, RPL_INFO, *text++);
- send_reply(sptr, RPL_INFO, "");
- }
- send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s",
- creation, generation);
- send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s",
- myctime(cli_firsttime(&me)));
- send_reply(sptr, RPL_ENDOFINFO);
+ if (!IsOper(sptr))
+ send_reply(sptr, RPL_INFO, *text);
+ text++;
+ }
+ if (IsOper(sptr))
+ {
+ while (*text)
+ send_reply(sptr, RPL_INFO, *text++);
+ send_reply(sptr, RPL_INFO, "");
}
+ send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s",
+ creation, generation);
+ send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s",
+ myctime(cli_firsttime(&me)));
+ send_reply(sptr, RPL_ENDOFINFO);
return 0;
}
return 0;
}
-
-#if 0
-/*
- * m_info
- *
- * parv[0] = sender prefix
- * parv[1] = servername
- */
-int m_info(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
- const char **text = infotext;
-
- if (hunt_server(1, cptr, sptr, "%s%s " TOK_INFO " :%s", 1, parc, parv) == HUNTED_ISME) /* XXX DEAD */
- {
- while (text[2])
- {
- if (!IsOper(sptr))
- sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text); /* XXX DEAD */
- text++;
- }
- if (IsOper(sptr))
- {
- while (*text)
- sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text++); /* XXX DEAD */
- sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], ""); /* XXX DEAD */
- }
- sendto_one(sptr, ":%s %d %s :Birth Date: %s, compile # %s", /* XXX DEAD */
- me.name, RPL_INFO, parv[0], creation, generation);
- sendto_one(sptr, ":%s %d %s :On-line since %s", /* XXX DEAD */
- me.name, RPL_INFO, parv[0], myctime(me.firsttime));
- sendto_one(sptr, rpl_str(RPL_ENDOFINFO), me.name, parv[0]); /* XXX DEAD */
- }
- return 0;
-}
-#endif /* 0 */
-
*bytes_out = userCount * sizeof(struct User);
}
-/*
- * user_set_away - set user away state
- * returns 1 if client is away or changed away message, 0 if
- * client is removing away status.
- * NOTE: this function may modify user and message, so they
- * must be mutable.
- */
-int user_set_away(struct User* user, char* message)
-{
- char* away;
- assert(0 != user);
-
- away = user->away;
-
- if (EmptyString(message)) {
- /*
- * Marking as not away
- */
- if (away) {
- MyFree(away);
- user->away = 0;
- }
- }
- else {
- /*
- * Marking as away
- */
- unsigned int len = strlen(message);
-
- if (len > TOPICLEN) {
- message[TOPICLEN] = '\0';
- len = TOPICLEN;
- }
- if (away)
- away = (char*) MyRealloc(away, len + 1);
- else
- away = (char*) MyMalloc(len + 1);
- assert(0 != away);
-
- user->away = away;
- strcpy(away, message);
- }
- return (user->away != 0);
-}
/*
* next_client