コード例 #1
0
static int
mo_testgecos(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	struct ConfItem *aconf;

	if(!(aconf = find_xline(parv[1], 0)))
	{
		sendto_one_numeric(source_p, s_RPL(RPL_NOTESTLINE), parv[1]);
		return 0;
	}

	sendto_one_numeric(source_p, s_RPL(RPL_TESTLINE),
		   (aconf->flags & CONF_FLAGS_TEMPORARY) ? 'x' : 'X',
		   (aconf->flags & CONF_FLAGS_TEMPORARY) ? (time_t)((aconf->hold -
							     rb_current_time()) / 60) : (time_t)0L,
		   aconf->host, aconf->passwd);
	return 0;
}
コード例 #2
0
static int
mo_testgecos(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    struct ConfItem *aconf;

    if(!(aconf = find_xline(parv[1], 0))) {
        sendto_one(source_p, form_str(RPL_NOTESTLINE),
                   me.name, source_p->name, parv[1]);
        return 0;
    }

    sendto_one(source_p, form_str(RPL_TESTLINE),
               me.name, source_p->name,
               aconf->hold ? 'x' : 'X',
               aconf->hold ? (long) ((aconf->hold - rb_current_time()) / 60) : 0L,
               aconf->host, aconf->passwd);
    return 0;
}
コード例 #3
0
void
parse_x_file(FILE * file)
{
	struct ConfItem *aconf;
	char *gecos_field = NULL;
	char *reason_field = NULL;
	char line[BUFSIZE];
	char *p;

	while (fgets(line, sizeof(line), file))
	{
		if((p = strpbrk(line, "\r\n")))
			*p = '\0';

		if((*line == '\0') || (line[0] == '#'))
			continue;

		gecos_field = getfield(line);
		if(EmptyString(gecos_field))
			continue;

		/* field for xline types, which no longer exist */
		getfield(NULL);

		reason_field = getfield(NULL);
		if(EmptyString(reason_field))
			continue;

		/* sanity checking */
		if((find_xline(gecos_field, 0) != NULL) ||
		   (strchr(reason_field, ':') != NULL))
			continue;

		aconf = make_conf();
		aconf->status = CONF_XLINE;

		DupString(aconf->name, gecos_field);
		DupString(aconf->passwd, reason_field);

		dlinkAddAlloc(aconf, &xline_conf_list);
	}
}