Example #1
0
static int
ms_error(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	const char *para;

	para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>";

	ilog(L_SERVER, "Received ERROR message from %s: %s",
	     log_client_name(source_p, SHOW_IP), para);

	if(ConfigFileEntry.hide_error_messages == 2)
		return 0;

	if(client_p == source_p)
	{
		sendto_realops_flags(UMODE_ALL, L_ADMIN, "ERROR :from %s -- %s",
				     client_p->name, para);

		if(!ConfigFileEntry.hide_error_messages)
			sendto_realops_flags(UMODE_ALL, L_OPER,
					     "ERROR :from %s -- %s", client_p->name, para);
	}
	else
	{
		sendto_realops_flags(UMODE_ALL, L_ADMIN, "ERROR :from %s via %s -- %s",
				     source_p->name, client_p->name, para);

		if(!ConfigFileEntry.hide_error_messages)
			sendto_realops_flags(UMODE_ALL, L_OPER,
					     "ERROR :from %s via %s -- %s",
					     source_p->name, client_p->name, para);
	}

	return 0;
}
Example #2
0
/*
 * Note: At least at protocol level ERROR has only one parameter,
 * although this is called internally from other functions
 * --msa
 *
 *      parv[*] = parameters
 */
static void
m_error(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	const char *para;
	int hideit = ConfigFileEntry.hide_error_messages;

	para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>";

	if (IsAnyServer(client_p))
	{
		ilog(L_SERVER, "Received ERROR message from %s: %s",
		     log_client_name(source_p, SHOW_IP), para);
	}

	if(is_safe_error(para))
		hideit = 0;
	if(IsAnyServer(client_p))
	{
		if (hideit < 2)
			sendto_realops_snomask(SNO_GENERAL, hideit ? L_ADMIN : (is_remote_connect(client_p) ? L_NETWIDE : L_ALL),
					"ERROR :from %s -- %s",
					client_p->name, para);
		if (hideit > 0)
			sendto_realops_snomask(SNO_GENERAL, (hideit == 1 ? L_OPER : L_ALL) | (is_remote_connect(client_p) ? L_NETWIDE : L_ALL),
					"ERROR :from %s -- <hidden>",
					client_p->name);
	}

	exit_client(client_p, source_p, source_p, "ERROR");
}
Example #3
0
/*
 * Note: At least at protocol level ERROR has only one parameter,
 * although this is called internally from other functions
 * --msa
 *
 *      parv[0] = sender prefix
 *      parv[*] = parameters
 */
int
m_error(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	const char *para;
	para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>";

	if(IsAnyServer(client_p))
	{
		ilog(L_SERVER, "Received ERROR message from %s: %s",
		     log_client_name(source_p, SHOW_IP), para);
	}

	if(IsAnyServer(client_p) && ConfigFileEntry.hide_error_messages < 2)
	{
		sendto_realops_flags(UMODE_ALL, L_ADMIN,
				     "ERROR :from %s -- %s",
				     EmptyString(client_p->name) ? "" : client_p->name, para);

		if(!ConfigFileEntry.hide_error_messages)
			sendto_realops_flags(UMODE_ALL, L_OPER,
					     "ERROR :from %s -- %s",
					     EmptyString(client_p->name) ? "" : client_p->name,
					     para);
	}

	exit_client(client_p, source_p, source_p, "ERROR");

	return 0;
}
Example #4
0
static void
ms_error(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	const char *para;
	int hideit = ConfigFileEntry.hide_error_messages;

	para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>";

	ilog(L_SERVER, "Received ERROR message from %s: %s",
	     log_client_name(source_p, SHOW_IP), para);

	if(is_safe_error(para))
		hideit = 0;
	if(hideit == 2)
		return;

	if(client_p == source_p)
	{
		sendto_realops_snomask(SNO_GENERAL, hideit ? L_ADMIN : L_ALL, "ERROR :from %s -- %s",
				     client_p->name, para);
	}
	else
	{
		sendto_realops_snomask(SNO_GENERAL, hideit ? L_ADMIN : L_ALL, "ERROR :from %s via %s -- %s",
				     source_p->name, client_p->name, para);
	}
}
Example #5
0
/*
 * Note: At least at protocol level ERROR has only one parameter,
 * although this is called internally from other functions
 * --msa
 *
 *      parv[0] = sender prefix
 *      parv[*] = parameters
 */
int
m_error(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	const char *para;
	int hideit = ConfigFileEntry.hide_error_messages;

	para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>";

	if(IsAnyServer(client_p))
	{
		if(is_safe_error(para))
			hideit = 0;
		ilog(L_SERVER, "Received ERROR message from %s: %s",
		     log_client_name(source_p, SHOW_IP), para);
		if (hideit < 2)
			sendto_realops_flags(UMODE_ALL, hideit ? L_ADMIN : L_ALL,
					     "ERROR :from %s -- %s",
					     EmptyString(client_p->name) ? "" : client_p->name, para);
		if (hideit > 0)
			sendto_realops_flags(UMODE_ALL, hideit == 1 ? L_OPER : L_ALL,
					     "ERROR :from %s -- <hidden>",
					     EmptyString(client_p->name) ? "" : client_p->name);
	}

	exit_client(client_p, source_p, source_p, "ERROR");

	return 0;
}
Example #6
0
/*
 * Note: At least at protocol level ERROR has only one parameter,
 * although this is called internally from other functions
 * --msa
 *
 *      parv[0] = sender prefix
 *      parv[*] = parameters
 */
void
m_error(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
    const char *para;
#ifndef HIDE_SERVERS_IPS
    static int showip = HIDE_IP;
#else
    static int showip = MASK_IP;
#endif

    if(IsAnyServer(client_p))
    {
        para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>";

        ilog(L_ERROR, "Received ERROR message from %s: %s",
             log_client_name(source_p, SHOW_IP), para);

        if(ConfigFileEntry.hide_error_messages < 2)
        {
            sendto_realops_flags(UMODE_ALL, L_ADMIN,
                                 "ERROR :from %s -- %s",
                                 get_client_name(client_p, showip), para);

            if(!ConfigFileEntry.hide_error_messages)
                sendto_realops_flags(UMODE_ALL, L_OPER,
                                     "ERROR :from %s -- %s",
                                     get_client_name(client_p, showip), para);
        }
    }

    exit_client(client_p, source_p, source_p, "ERROR");
}
Example #7
0
/*
 * ms_svinfo - SVINFO message handler
 *      parv[1] = TS_CURRENT for the server
 *      parv[2] = TS_MIN for the server
 *      parv[3] = unused, send 0
 *      parv[4] = server's idea of UTC time
 */
static int
ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    signed long deltat;
    time_t theirtime;
    char squitreason[120];

    /* SVINFO isnt remote. */
    if(source_p != client_p)
        return 0;

    if(TS_CURRENT < atoi(parv[2]) || atoi(parv[1]) < TS_MIN)
    {
        /* TS version is too low on one of the sides, drop the link */
        sendto_realops_snomask(SNO_GENERAL, L_ALL,
                               "Link %s dropped, wrong TS protocol version (%s,%s)",
                               source_p->name, parv[1], parv[2]);
        rb_snprintf(squitreason, sizeof squitreason, "Incompatible TS version (%s,%s)",
                    parv[1], parv[2]);
        exit_client(source_p, source_p, source_p, squitreason);
        return 0;
    }

    /*
     * since we're here, might as well set rb_current_time() while we're at it
     */
    rb_set_time();
    theirtime = atol(parv[4]);
    deltat = labs(theirtime - rb_current_time());

    if(deltat > ConfigFileEntry.ts_max_delta)
    {
        sendto_realops_snomask(SNO_GENERAL, L_ALL,
                               "Link %s dropped, excessive TS delta"
                               " (my TS=%ld, their TS=%ld, delta=%ld)",
                               source_p->name,
                               (long) rb_current_time(), (long) theirtime, deltat);
        ilog(L_SERVER,
             "Link %s dropped, excessive TS delta"
             " (my TS=%ld, their TS=%ld, delta=%ld)",
             log_client_name(source_p, SHOW_IP), (long) rb_current_time(), (long) theirtime, deltat);
        rb_snprintf(squitreason, sizeof squitreason, "Excessive TS delta (my TS=%ld, their TS=%ld, delta=%ld)",
                    (long) rb_current_time(), (long) theirtime, deltat);
        disable_server_conf_autoconn(source_p->name);
        exit_client(source_p, source_p, source_p, squitreason);
        return 0;
    }

    if(deltat > ConfigFileEntry.ts_warn_delta)
    {
        sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                               "Link %s notable TS delta"
                               " (my TS=%ld, their TS=%ld, delta=%ld)",
                               source_p->name, (long) rb_current_time(), (long) theirtime, deltat);
    }

    return 0;
}
Example #8
0
/* send_linebuf()
 *
 * inputs	- client to send to, linebuf to attach
 * outputs	-
 * side effects - linebuf is attached to client
 */
static int
_send_linebuf(struct Client *to, buf_head_t *linebuf)
{
    if(IsMe(to))
    {
        sendto_realops_snomask(SNO_GENERAL, L_ALL, "Trying to send message to myself!");
        return 0;
    }

    if(!MyConnect(to) || IsIOError(to))
        return 0;

    if(linebuf_len(&to->localClient->buf_sendq) > get_sendq(to))
    {
        if(IsServer(to))
        {
            sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                   "Max SendQ limit exceeded for %s: %u > %lu",
                                   get_server_name(to, HIDE_IP),
                                   linebuf_len(&to->localClient->buf_sendq),
                                   get_sendq(to));

            ilog(L_SERVER, "Max SendQ limit exceeded for %s: %u > %lu",
                 log_client_name(to, SHOW_IP),
                 linebuf_len(&to->localClient->buf_sendq),
                 get_sendq(to));
        }

        if(IsClient(to))
            to->flags |= FLAGS_SENDQEX;

        dead_link(to);
        return -1;
    }
    else
    {
        /* just attach the linebuf to the sendq instead of
         * generating a new one
         */
        linebuf_attach(&to->localClient->buf_sendq, linebuf);
    }

    /*
     ** Update statistics. The following is slightly incorrect
     ** because it counts messages even if queued, but bytes
     ** only really sent. Queued bytes get updated in SendQueued.
     */
    to->localClient->sendM += 1;
    me.localClient->sendM += 1;
    if(linebuf_len(&to->localClient->buf_sendq) > 0)
        send_queued_write(to->localClient->fd, to);
    return 0;
}
Example #9
0
/*
 * ms_svinfo - SVINFO message handler
 *	parv[0] = sender prefix
 *	parv[1] = TS_CURRENT for the server
 *	parv[2] = TS_MIN for the server
 *	parv[3] = unused, send 0
 *	parv[4] = server's idea of UTC time
 */
static int
ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	long int deltat;
	time_t theirtime;

	/* SVINFO isnt remote. */
	if(source_p != client_p)
		return 0;

	if(TS_CURRENT < atoi(parv[2]) || atoi(parv[1]) < TS_MIN)
	{
		/* TS version is too low on one of the sides, drop the link */
		sendto_realops_flags(UMODE_ALL, L_ALL,
				     "Link %s dropped, wrong TS protocol version (%s,%s)",
				     source_p->name, parv[1], parv[2]);
		exit_client(source_p, source_p, source_p, "Incompatible TS version");
		return 0;
	}

	/*
	 * since we're here, might as well call rb_set_time() while we're at it
	 */
	rb_set_time();
	theirtime = atol(parv[4]);
	deltat = labs(theirtime - rb_current_time());

	if(deltat > ConfigFileEntry.ts_max_delta)
	{
		sendto_realops_flags(UMODE_ALL, L_ALL,
				     "Link %s dropped, excessive TS delta"
				     " (my TS=%" RBTT_FMT ", their TS=%" RBTT_FMT " delta=%ld)",
				     source_p->name, rb_current_time(), theirtime, deltat);
		ilog(L_SERVER,
		     "Link %s dropped, excessive TS delta"
		     " (my TS=%" RBTT_FMT ", their TS=%" RBTT_FMT ", delta=%ld)",
		     log_client_name(source_p, SHOW_IP), rb_current_time(), theirtime, deltat);
		exit_client(source_p, source_p, source_p, "Excessive TS delta");
		return 0;
	}

	if(deltat > ConfigFileEntry.ts_warn_delta)
	{
		sendto_realops_flags(UMODE_ALL, L_ALL,
				     "Link %s notable TS delta"
				     " (my TS=% " RBTT_FMT ", their TS=%" RBTT_FMT ", delta=%ld)",
				     source_p->name, rb_current_time(), theirtime, deltat);
	}

	return 0;
}