コード例 #1
0
ファイル: plexus.c プロジェクト: denora/protocol-legacy
/*
 do_nick(const char *source, char *nick, char *username, char *host,
              char *server, char *realname, time_t ts, uint32 svid,
              uint32 ip, char *vhost, char *uid, int hopcount, char *modes)
*/
int denora_event_nick(char *source, int ac, char **av)
{
	User *user;
	char *ipchar = NULL;

	if (denora->protocoldebug)
	{
		protocol_debug(source, ac, av);
	}
	if (ac != 2)
	{
		ipchar = host_resolve(av[5]);
		user = do_nick(source, av[0], av[4], av[5], av[7], av[9],
		               strtoul(av[2], NULL, 10),
		               strtoul(av[8], NULL, 0), ipchar, av[6], NULL,
		               strtoul(av[1], NULL, 0), av[3], NULL);
		free(ipchar);
	}
	else
	{
		do_nick(source, av[0], NULL, NULL, NULL, NULL,
		        strtoul(av[1], NULL, 10), 0, NULL, NULL, NULL, 0, NULL,
		        NULL);
	}
	return MOD_CONT;
}
コード例 #2
0
ファイル: plexus3.c プロジェクト: denora/protocol-legacy
/*
 do_nick(const char *source, char *nick, char *username, char *host,
              char *server, char *realname, time_t ts, uint32 svid,
              uint32 ip, char *vhost, char *uid, int hopcount, char *modes, char *account)
  NICK Trystan 1 1148214497 +aiow tslee is.my.vhost plexus3.nomadirc.net 0 c-67-186-230-12.hsd1.ut.comcast.net :Dreams are answers to questions not yet asked
       0       1 2           3    4     5           6                    7 8                                    9
  666 UID asdasd 1 1234817435 +ix Nesstest 566C206.B53EDE66.1DF57482.IP 66.63.160.250 666AAAAAD 0 66.63.160.250 :JasonX
          0      1 2           3  4        5                            6             7         8 9              10

[Feb 19 04:24:22.531142 2009] debug: Received: :57CAAEV6D NICK Miu :1235017456
[Feb 19 04:24:22.536789 2009] Source 57CAAEV6D
[Feb 19 04:24:22.537026 2009] av[0] = Miu
[Feb 19 04:24:22.537233 2009] av[1] = 1235017456
[Feb 19 04:24:22.537422 2009] Unknown NICK formatted message please report the following
*/
int denora_event_nick(char *source, int ac, char **av)
{
	Server *s;
	User *user;
	char *temp;
	char *ipchar = NULL;

	if (denora->protocoldebug)
	{
		protocol_debug(source, ac, av);
	}
	temp = sstrdup(source);

	if (UseTS6 && ac == 11)
	{
		s = server_find(source);
		/* Source is always the server */
		*source = '\0';
		user = do_nick(source, av[0], av[4], av[9], s->name, av[10],
		               strtoul(av[2], NULL, 10), 0, av[6], av[5],
		               av[7], strtoul(av[1], NULL, 10), av[3], NULL);
		if (user)
		{
			denora_set_umode(user, 1, &av[3]);
		}
	}
	else if (ac == 10)
	{
		ipchar = host_resolve(av[8]);
		user = do_nick(source, av[0], av[4], av[8], av[6], av[9],
		               strtoul(av[2], NULL, 10),
		               strtoul(av[7], NULL, 0), ipchar, av[5], NULL,
		               strtoul(av[1], NULL, 0), av[3], NULL);
		free(ipchar);
	}
	else if (ac == 2)
	{
		do_nick(source, av[0], NULL, NULL, NULL, NULL,
		        strtoul(av[1], NULL, 10), 0, NULL, NULL, NULL, 0,
		        NULL, NULL);
	}
	else
	{
		alog(LOG_DEBUG,
		     "Unknown NICK formatted message please report the following");
		protocol_debug(temp, ac, av);
	}
	free(temp);
	return MOD_CONT;
}
コード例 #3
0
ファイル: unreal31.c プロジェクト: danopia/denora
int denora_event_nick(char *source, int ac, char **av)
{
    User *user;
    char *ipchar = NULL;

    if (denora->protocoldebug) {
        protocol_debug(source, ac, av);
    }

    if (ac != 2) {
        if (ac == 7) {
            /*
               <codemastr> that was a bug that is now fixed in 3.2.1
               <codemastr> in  some instances it would use the non-nickv2 format
               <codemastr> it's sent when a nick collision occurs
               - so we have to leave it around for now -TSL
             */
            ipchar = host_resolve(av[4]);
            do_nick(source, av[0], av[3], av[4], av[5], av[6],
                    strtoul(av[2], NULL, 10), 0, 0, NULL, NULL, 0, NULL,
                    NULL);
            free(ipchar);
        } else {
            ipchar = host_resolve(av[4]);
            user = do_nick(source, av[0], av[3], av[4], av[5], av[9],
                           strtoul(av[2], NULL, 10), strtoul(av[6], NULL,
                                                             0), 0, av[8],
                           NULL, strtoul(av[1], NULL, 10), av[7], NULL);
            free(ipchar);
        }
    } else {
        do_nick(source, av[0], NULL, NULL, NULL, NULL,
                strtoul(av[1], NULL, 10), 0, NULL, NULL, NULL, 0, NULL,
                NULL);
    }
    return MOD_CONT;
}
コード例 #4
0
ファイル: plexus3.c プロジェクト: denora/protocol-legacy
void plexus_cmd_nick(char *nick, char *name, const char *mode)
{
	char *ipaddr;
	char *nicknumbuf = ts6_uid_retrieve();

	if (UseTS6)
	{
		ipaddr = host_resolve(ServiceHost);
		send_cmd(TS6SID, "UID %s 1 %ld %s %s %s %s %s 0 %s :%s", nick,
		         (long int) time(NULL), mode, ServiceUser, ServiceHost,
		         ipaddr, nicknumbuf, ServiceHost, name);

		new_uid(nick, nicknumbuf);
		free(ipaddr);
	}
	else
	{
		send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick,
		         (long int) time(NULL), mode, ServiceUser, ServiceHost,
		         ServerName, name);
	}
}
コード例 #5
0
ファイル: actions.c プロジェクト: TheKing/xanadu-irc-services
/**
 * Unban the nick from a channel
 * @param ci channel info for the channel
 * @param nick to remove the ban for
 * @return void
 */
void common_unban(ChannelInfo * ci, char *nick)
{
    int count, i;
    char *av[3], **bans;
    User *u;
    char *host = NULL;
    int matchfound = 0;

    if (!ci || !ci->c || !nick) {
        return;
    }

    if (!(u = finduser(nick))) {
        return;
    }

    if (u->hostip == NULL) {
        host = host_resolve(u->host);
        /* we store the just resolved hostname so we don't
         * need to do this again */
        if (host) {
            u->hostip = sstrdup(host);
        }
    } else {
        host = sstrdup(u->hostip);
    }

    if (ircd->svsmode_unban) {
        xanadu_cmd_unban(ci->name, nick);
    } else {
        av[0] = ci->name;
        av[1] = sstrdup("-b");
        count = ci->c->bancount;
        bans = scalloc(sizeof(char *) * count, 1);
        memcpy(bans, ci->c->bans, sizeof(char *) * count);
        for (i = 0; i < count; i++) {
            if (match_usermask(bans[i], u)) {
                xanadu_cmd_mode(whosends(ci), ci->name, "-b %s", bans[i]);
                av[2] = bans[i];
                do_cmode(whosends(ci), 3, av);
                matchfound++;
            }
            if (host) {
                /* prevent multiple unbans if the first one was successful in
                   locating the ban for us. This is due to match_userip() checks
                   the vhost again, and thus can return false positive results
                   for the function. but won't prevent thus from clearing out
                   the bans against an IP address since the first would fail and
                   the second would match - TSL
                 */
                if (!matchfound) {
                    if (match_userip(bans[i], u, host)) {
                        xanadu_cmd_mode(whosends(ci), ci->name, "-b %s",
                                       bans[i]);
                        av[2] = bans[i];
                        do_cmode(whosends(ci), 3, av);
                    }
                }
            }
            matchfound = 0;
        }
        free(bans);
        free(av[1]);
    }
    /* host_resolve() sstrdup us this info so we gotta free it */
    if (host) {
        free(host);
    }
}