当前位置: 首页>>代码示例>>C++>>正文


C++ BadPtr函数代码示例

本文整理汇总了C++中BadPtr函数的典型用法代码示例。如果您正苦于以下问题:C++ BadPtr函数的具体用法?C++ BadPtr怎么用?C++ BadPtr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BadPtr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: m_notice

/**
 * Handle NOTICE commands
 *
 * @param source is the nick of the person whom sent the notice
 * @param receiver is the nick whom it was sent to
 * @param msg is the message that was sent
 *
 * @return always returns MOD_CONT
 */
int m_notice(char *source, char *receiver, char *msg)
{
    char *temp = NULL;
    char *version;
    char *clean;

    if (BadPtr(source) || BadPtr(receiver) || BadPtr(msg)) {
        return MOD_CONT;
    }

    if (!stricmp(receiver, s_StatServ)
        || (s_StatServ_alias && !stricmp(receiver, s_StatServ_alias))) {
        clean = normalizeBuffer(msg);
        doCleanBuffer((char *) clean);
        temp = myStrGetToken(clean, ' ', 0);
        if (!temp) {
            free(clean);
            return MOD_CONT;
        }
        if (!stricmp(temp, "VERSION")) {
            version = myStrGetTokenRemainder(clean, ' ', 1);
            handle_ctcp_version(source, version);
            free(version);
        }
        free(clean);
        free(temp);
    }

    return MOD_CONT;
}
开发者ID:danopia,项目名称:denora,代码行数:39,代码来源:messages.c

示例2: m_svslogin

/*
 * SVSLOGIN message
 *
 * parv[0]: source
 * parv[1]: propagation mask
 * parv[2]: target PUID
 * parv[3]: ESVID
 */
static int m_svslogin(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
	if (!SASL_SERVER || MyClient(sptr) || (parc < 3) || !parv[3])
		return 0;

	if (!stricmp(parv[1], me.name))
	{
		aClient *target_p;

		/* is the PUID valid? */
		if ((target_p = decode_puid(parv[2])) == NULL)
			return 0;

		if (target_p->user == NULL)
			make_user(target_p);

		strlcpy(target_p->user->svid, parv[3], sizeof(target_p->user->svid));

		sendto_one(target_p, err_str(RPL_LOGGEDIN), me.name,
			   BadPtr(target_p->name) ? "*" : target_p->name,
			   BadPtr(target_p->name) ? "*" : target_p->name,
			   BadPtr(target_p->user->username) ? "*" : target_p->user->username,
			   BadPtr(target_p->user->realhost) ? "*" : target_p->user->realhost,
			   target_p->user->svid, target_p->user->svid);

		return 0;
	}

	/* not for us; propagate. */
	sendto_serv_butone_token(cptr, parv[0], MSG_SVSLOGIN, TOK_SVSLOGIN, "%s %s %s",
				 parv[1], parv[2], parv[3]);

	return 0;
}
开发者ID:Adam-,项目名称:unrealircd,代码行数:42,代码来源:m_sasl.c

示例3: ms_links

/*
 * ms_links - server message handler
 *
 * parv[0] = sender prefix
 * parv[1] = servername mask
 *
 * or
 *
 * parv[0] = sender prefix
 * parv[1] = server to query
 * parv[2] = servername mask
 */
int
ms_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   char *mask;
   struct Client *acptr;

   if (parc > 2)
   {
     if (hunt_server_cmd(sptr, CMD_LINKS, cptr, 1, "%C :%s", 1, parc, parv) !=
         HUNTED_ISME)
       return 0;
     mask = parv[2];
   }
   else
     mask = parc < 2 ? 0 : parv[1];
 
   for (acptr = GlobalClientList, collapse(mask); acptr; acptr = cli_next(acptr))
   {
     if (!IsServer(acptr) && !IsMe(acptr))
       continue;
     if (!BadPtr(mask) && match(mask, cli_name(acptr)))
       continue;
     send_reply(sptr, RPL_LINKS, cli_name(acptr), cli_name(cli_serv(acptr)->up),
                cli_hopcount(acptr), cli_serv(acptr)->prot,
                ((cli_info(acptr))[0] ? cli_info(acptr) : "(Unknown Location)"));
   }
 
   send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask);
   return 0;
 }
开发者ID:Niichan,项目名称:snircd,代码行数:42,代码来源:m_links.c

示例4: parse_d_file

void
parse_d_file(FBFILE * file)
{
	struct ConfItem *aconf;
	char *reason_field = (char *) NULL;
	char *host_field = (char *) NULL;
	char line[BUFSIZE];
	char *p;

	while (fbgets(line, sizeof(line), file))
	{
		if((p = strchr(line, '\n')))
			*p = '\0';

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

		host_field = getfield(line);
		if(BadPtr(host_field))
			continue;

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

		aconf = make_conf();
		aconf->status = CONF_DLINE;
		conf_add_fields(aconf, host_field, reason_field, "", 0, NULL);
		conf_add_d_conf(aconf);
	}
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:31,代码来源:kdparse.c

示例5: parse_resv_file

void
parse_resv_file(FBFILE * file)
{
	char *reason_field;
	char *host_field;
	char line[BUFSIZE];
	char *p;

	while (fbgets(line, sizeof(line), file))
	{
		if((p = strchr(line, '\n')))
			*p = '\0';

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

		host_field = getfield(line);
		if(BadPtr(host_field))
			continue;

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

		if(IsChannelName(host_field))
			create_resv(host_field, reason_field, RESV_CHANNEL);
		else if(clean_resv_nick(host_field))
			create_resv(host_field, reason_field, RESV_NICK);
	}
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:30,代码来源:kdparse.c

示例6: get_listener_name

inline char *
get_listener_name(aListener *lptr)
{
   static char nbuf[HOSTLEN * 2 + USERLEN + 5];

   ircsprintf(nbuf, "%s[@%s.%d][%s]", me.name, BadPtr(lptr->vhost_string) ?
              "0.0.0.0" : lptr->vhost_string, lptr->port, 
               BadPtr(lptr->allow_string) ?  "*" : lptr->allow_string);

   return nbuf;
}
开发者ID:TrapSquad,项目名称:realistichat,代码行数:11,代码来源:s_misc.c

示例7: CMD_FUNC

DLLFUNC CMD_FUNC(m_starttls)
{
	if (!MyConnect(sptr) || !IsUnknown(sptr))
		return 0;
#ifndef USE_SSL
	/* sendnotice(sptr, "This server does not support SSL"); */
	/* or numeric 691? */
	/* actually... it's probably best to just act like we don't know this command...? */
	sendto_one(sptr, err_str(ERR_NOTREGISTERED), me.name, "STARTTLS");
	return 0;
#else
	if (iConf.ssl_options & SSLFLAG_NOSTARTTLS)
	{
		sendto_one(sptr, err_str(ERR_NOTREGISTERED), me.name, "STARTTLS");
		return 0;
	}
	if (IsSecure(sptr))
	{
		sendto_one(sptr, err_str(ERR_STARTTLS), me.name, !BadPtr(sptr->name) ? sptr->name : "*", "STARTTLS failed. Already using TLS.");
		return 0;
	}
	dbuf_delete(&sptr->recvQ, 1000000); /* Clear up any remaining plaintext commands */
	sendto_one(sptr, rpl_str(RPL_STARTTLS), me.name, !BadPtr(sptr->name) ? sptr->name : "*");
	send_queued(sptr);

	SetSSLStartTLSHandshake(sptr);
	Debug((DEBUG_DEBUG, "Starting SSL handshake (due to STARTTLS) for %s", sptr->sockhost));
	if ((sptr->ssl = SSL_new(ctx_server)) == NULL)
		goto fail;
	sptr->flags |= FLAGS_SSL;
	SSL_set_fd(sptr->ssl, sptr->fd);
	SSL_set_nonblocking(sptr->ssl);
	if (!ircd_SSL_accept(sptr, sptr->fd)) {
		Debug((DEBUG_DEBUG, "Failed SSL accept handshake in instance 1: %s", sptr->sockhost));
		SSL_set_shutdown(sptr->ssl, SSL_RECEIVED_SHUTDOWN);
		SSL_smart_shutdown(sptr->ssl);
		SSL_free(sptr->ssl);
		goto fail;
	}

	/* HANDSHAKE IN PROGRESS */
	return 0;
fail:
	/* Failure */
	sendto_one(sptr, err_str(ERR_STARTTLS), me.name, !BadPtr(sptr->name) ? sptr->name : "*", "STARTTLS failed");
	sptr->ssl = NULL;
	sptr->flags &= ~FLAGS_SSL;
	SetUnknown(sptr);
	return 0;
#endif
}
开发者ID:JourneymanGeek,项目名称:rabbitircd,代码行数:51,代码来源:m_starttls.c

示例8: do_jumpserver_exit_client

static int do_jumpserver_exit_client(aClient *sptr)
{
#ifdef USE_SSL
	if (IsSecure(sptr) && jss->ssl_server)
		sendto_one(sptr, rpl_str(RPL_REDIR), me.name,
			BadPtr(sptr->name) ? "*" : sptr->name,
			jss->ssl_server, jss->ssl_port);
	else
#endif
		sendto_one(sptr, rpl_str(RPL_REDIR), me.name,
			BadPtr(sptr->name) ? "*" : sptr->name,
			jss->server, jss->port);
 	return exit_client(sptr, sptr, sptr, jss->reason);
}
开发者ID:RanadeepPolavarapu,项目名称:IRCd,代码行数:14,代码来源:jumpserver.32.c

示例9: exit_banned_client

/*
 * exit_banned_client()
 *
 * Sends an appropriate ban message and disconnects a client.
 */
int
exit_banned_client(aClient *cptr, int loc, char type, char *banmsg, int fast)
{
    char rbuf[512];
    char *target = "*";
    char *reason = "<no reason specified>";
    
    if (cptr->name[0])
        target = cptr->name;
    
    if (!BadPtr(banmsg))
        reason = banmsg;
    
    ircsnprintf(rbuf, sizeof(rbuf), "%c-banned: %s", type, reason);
    
    if (!fast)
    {
      sendto_one(&me, cptr, "NOTICE %s :*** You are banned from %s", target,
                   loc ? me.name : Network_Name);
      sendto_one(&me, cptr, "NOTICE %s :*** Reason: %s", target, reason);
      sendto_one(&me, cptr, "NOTICE %s :*** Connection info: %s [%s]", target,
                   get_client_name(cptr, FALSE),
                   cipntoa(cptr));
      sendto_one(&me, cptr, "NOTICE %s :*** Ban contact: %s", target,
                   loc ? Local_Kline_Address : Network_Kline_Address);
      sendto_one(&me, cptr, "NOTICE %s :*** When contacting %s, please include "
                   "all of the information shown above", target, Network_Name);
      sendto_one(&me, cptr, err_str(ERR_YOUREBANNEDCREEP), me.name, target, rbuf);
        
        throttle_force(cipntoa(cptr));
    }
    
    return exit_client(cptr, cptr, &me, rbuf);
}
开发者ID:TrapSquad,项目名称:realistichat,代码行数:39,代码来源:s_misc.c

示例10: strlen

/*
**  Get Channel block for i (and allocate a new channel
**  block, if it didn't exists before).
*/
aChannel *get_channel(aClient *cptr, char *chname, int flag)
{
	aChannel *chptr;
	int  len;

	if (BadPtr(chname))
		return NULL;

	len = strlen(chname);
	if (MyClient(cptr) && len > CHANNELLEN)
	{
		len = CHANNELLEN;
		*(chname + CHANNELLEN) = '\0';
	}
	if ((chptr = find_channel(chname, (aChannel *)NULL)))
		return (chptr);
	if (flag == CREATE)
	{
		chptr = (aChannel *)MyMalloc(sizeof(aChannel) + len);
		bzero((char *)chptr, sizeof(aChannel));
		strncpyzt(chptr->chname, chname, len + 1);
		if (channel)
			channel->prevch = chptr;
		chptr->topic = NULL;
		chptr->topic_nick = NULL;
		chptr->prevch = NULL;
		chptr->nextch = channel;
		chptr->creationtime = MyClient(cptr) ? TStime() : (TS)0;
		channel = chptr;
		(void)add_to_channel_hash_table(chname, chptr);
		IRCstats.channels++;
		RunHook2(HOOKTYPE_CHANNEL_CREATE, cptr, chptr);
	}
	return chptr;
}
开发者ID:HengeSense,项目名称:Technokats-Website,代码行数:39,代码来源:channel.c

示例11: mo_list

/*
** mo_list
**      parv[0] = sender prefix
**      parv[1] = channel
*/
static void mo_list(struct Client *client_p,
                   struct Client *source_p,
                   int parc,
                   char *parv[])
{

  /* If its a LazyLinks connection, let uplink handle the list
   * even for opers!
   */

  if( uplink && IsCapable( uplink, CAP_LL) )
    {
      if(parc < 2)
	sendto_one( uplink, ":%s LIST", source_p->name );
      else
	sendto_one( uplink, ":%s LIST %s", source_p->name, parv[1] );
      return;
    }

  /* If no arg, do all channels *whee*, else just one channel */
  if (parc < 2 || BadPtr(parv[1]))
    {
      list_all_channels(source_p);
    }
  else
    {
      list_named_channel(source_p,parv[1]);
    }
}
开发者ID:Cloudxtreme,项目名称:ircd-3,代码行数:34,代码来源:m_list.c

示例12: if

/*
** collapse a pattern string into minimal components.
** This particular version is "in place", so that it changes the pattern
** which is to be reduced to a "minimal" size.
*/
char *collapse(char *pattern)
{
	char *s = pattern, *s1, *t;

	if (BadPtr(pattern))
		return pattern;
	/*
	 * Collapse all \** into \*, \*[?]+\** into \*[?]+
	 */
	for (; *s; s++)
		if (*s == '\\')
			if (!*(s + 1))
				break;
			else
				s++;
		else if (*s == '*')
		{
			if (*(t = s1 = s + 1) == '*')
				while (*t == '*')
					t++;
			else if (*t == '?')
				for (t++, s1++; *t == '*' || *t == '?'; t++)
					if (*t == '?')
						*s1++ = *t;
			while ((*s1++ = *t++))
				;
		}
	return pattern;
}
开发者ID:ItsAGeekThing,项目名称:Xtheme,代码行数:34,代码来源:match.c

示例13: m_whowas

/*
** m_whowas
**      parv[0] = sender prefix
**      parv[1] = nickname queried
*/
static void
m_whowas(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
	static time_t last_used = 0L;

	if(parc < 2 || BadPtr(parv[1]))
	{
		sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), me.name, parv[0]);
		return;
	}

	if((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
	{
		sendto_one(source_p, form_str(RPL_LOAD2HI),
			   me.name, source_p->name, "WHOWAS");
		sendto_one(source_p, form_str(RPL_ENDOFWHOWAS), me.name, parv[0], parv[1]);
		return;
	}
	else
	{
		last_used = CurrentTime;
	}

	whowas_do(client_p, source_p, parc, parv);
}
开发者ID:BackupTheBerlios,项目名称:shadowircd,代码行数:30,代码来源:m_whowas.c

示例14: m_sasl

/*
 * SASL message
 *
 * parv[0]: prefix
 * parv[1]: distribution mask
 * parv[2]: target PUID
 * parv[3]: mode/state
 * parv[4]: data
 * parv[5]: out-of-bound data
 */
static int m_sasl(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
	if (!SASL_SERVER || MyClient(sptr) || (parc < 4) || !parv[4])
		return 0;

	if (!stricmp(parv[1], me.name))
	{
		aClient *target_p;

		/* is the PUID valid? */
		if ((target_p = decode_puid(parv[2])) == NULL)
			return 0;

		if (target_p->user == NULL)
			make_user(target_p);

		/* reject if another SASL agent is answering */
		if (*target_p->sasl_agent && stricmp(parv[0], target_p->sasl_agent))
			return 0;
		else
			strlcpy(target_p->sasl_agent, parv[0], sizeof(target_p->sasl_agent));

		if (*parv[3] == 'C')
			sendto_one(target_p, "AUTHENTICATE %s", parv[4]);
		else if (*parv[3] == 'D')
		{
			if (*parv[4] == 'F')
				sendto_one(target_p, err_str(ERR_SASLFAIL), me.name, BadPtr(target_p->name) ? "*" : target_p->name);
			else if (*parv[4] == 'S')
			{
				target_p->sasl_complete++;
				sendto_one(target_p, err_str(RPL_SASLSUCCESS), me.name, BadPtr(target_p->name) ? "*" : target_p->name);
			}

			*target_p->sasl_agent = '\0';
		}

		return 0;
	}

	/* not for us; propagate. */
	sendto_serv_butone_token(cptr, parv[0], MSG_SASL, TOK_SASL, "%s %s %c %s %s",
				 parv[1], parv[2], *parv[3], parv[4], parc > 5 ? parv[5] : "");

	return 0;
}
开发者ID:Adam-,项目名称:unrealircd,代码行数:56,代码来源:m_sasl.c

示例15: m_quit

/*
 * m_quit - client message handler
 *
 * parv[0]        = sender prefix
 * parv[parc - 1] = comment
 */
int m_quit(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
    char *quitnocolour = 0;
    int quittype = 0;
    int ret = 0;

    assert(0 != cptr);
    assert(0 != sptr);
    assert(cptr == sptr);

    ret = find_fline(cptr, sptr, parv[parc-1], WFFLAG_QUIT, parv[1]);
    if (ret != 0) {
        if (ret == 2)
            return CPTR_KILLED;
        else
            parv[parc - 1] = "";
    }

    if (cli_user(sptr)) {
        struct Membership* chan;
        for (chan = cli_user(sptr)->channel; chan; chan = chan->next_channel) {
            if (!IsZombie(chan) && !member_can_send_to_channel(chan))
                quittype |= 1;
            if (chan->channel->mode.mode & MODE_NOQUITPARTS)
                quittype |= 2;
            if (parc > 1 && !BadPtr(parv[parc - 1]) && HasColour(parv[parc - 1])) {
                if (chan->channel->mode.mode & MODE_NOCOLOUR)
                    quittype |= 2;
                else if (chan->channel->mode.mode & MODE_STRIP)
                    quittype |= 4;
            }
        }
    }
    if (parc > 1 && !BadPtr(parv[parc - 1])) {
        if (quittype & 1)
            return exit_client(cptr, sptr, sptr, "Signed off");
        else if (quittype & 2)
            return exit_client(cptr, sptr, sptr, "Quit");
        else if (quittype & 4 ) {
            if (!quitnocolour) quitnocolour = (char*)StripColour(parv[parc - 1]);
            return exit_client_msg(cptr, sptr, sptr, "Quit: %s", quitnocolour);
        } else
            return exit_client_msg(cptr, sptr, sptr, "Quit: %s", parv[parc - 1]);
    } else
        return exit_client(cptr, sptr, sptr, "Quit");
}
开发者ID:macressler,项目名称:nefarious,代码行数:52,代码来源:m_quit.c


注:本文中的BadPtr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。