- Added proper "not enough parameters" message for /SETNAME and cleaned up some whitespace

in the function, reported by Robby22 ().
- Fixed set::static-part set to 'no' not working properly. Reported by Robby22 ().
- Fixed crash in new resolver, reported by firstof9.
This commit is contained in:
Bram Matthys 2005-11-16 23:58:02 +00:00
parent 9d6801b271
commit 91ada621e6
4 changed files with 43 additions and 44 deletions

View file

@ -925,3 +925,7 @@
adchats). Reported by RandomNumber (#0002557).
- Fixed serious flood of notices to opers if link::options::dnscache was present.
Reported by firstof9.
- Added proper "not enough parameters" message for /SETNAME and cleaned up some whitespace
in the function, reported by Robby22 (#0002696).
- Fixed set::static-part set to 'no' not working properly. Reported by Robby22 (#0002698).
- Fixed crash in new resolver, reported by firstof9.

View file

@ -105,6 +105,8 @@ DLLFUNC CMD_FUNC(m_part)
{
if (!strcasecmp(STATIC_PART, "yes") || !strcmp(STATIC_PART, "1"))
commentx = NULL;
else if (!strcasecmp(STATIC_PART, "no") || !strcmp(STATIC_PART, "0"))
; /* keep original reason */
else
commentx = STATIC_PART;
}

View file

@ -92,43 +92,37 @@ DLLFUNC int MOD_UNLOAD(m_setname)(int module_unload)
yes it is experimental but anyways ;P
FREEDOM TO THE USERS! ;)
*/
DLLFUNC int m_setname(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
if (parc < 2)
return 0;
if (strlen(parv[1]) > (REALLEN))
{
if (MyConnect(sptr))
{
sendto_one(sptr,
":%s NOTICE %s :*** /SetName Error: \"Real names\" may maximum be %i characters of length",
me.name, sptr->name, REALLEN);
}
return 0;
}
if (strlen(parv[1]) < 1)
{
sendto_one(sptr,
":%s NOTICE %s :Couldn't change realname - Nothing in parameter",
me.name, sptr->name);
return 0;
}
/* set the new name before we check, but don't send to servers unless it is ok */
else
ircsprintf(sptr->info, "%s", parv[1]);
/* Check for n:lines here too */
if (!IsAnOper(sptr) && Find_ban(NULL, sptr->info, CONF_BAN_REALNAME))
{
int xx;
xx =
exit_client(cptr, sptr, &me,
"Your GECOS (real name) is banned from this server");
return xx;
}
sendto_serv_butone_token(cptr, sptr->name, MSG_SETNAME, TOK_SETNAME,
":%s", parv[1]);
if (MyConnect(sptr))
sendto_one(sptr,
":%s NOTICE %s :Your \"real name\" is now set to be %s - you have to set it manually to undo it",
me.name, parv[0], parv[1]);
return 0;
DLLFUNC CMD_FUNC(m_setname)
{
if ((parc < 2) || BadPtr(parv[1]))
{
sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "SETNAME");
return 0;
}
if (strlen(parv[1]) > REALLEN)
{
if (MyConnect(sptr))
{
sendnotice(sptr, "*** /SetName Error: \"Real names\" may maximum be %i characters of length",
REALLEN);
}
return 0;
}
/* set the new name before we check, but don't send to servers unless it is ok */
strcpy(sptr->info, parv[1]);
/* Check for n:lines here too */
if (!IsAnOper(sptr) && Find_ban(NULL, sptr->info, CONF_BAN_REALNAME))
return exit_client(cptr, sptr, &me,
"Your GECOS (real name) is banned from this server");
sendto_serv_butone_token(cptr, sptr->name, MSG_SETNAME, TOK_SETNAME, ":%s", parv[1]);
if (MyConnect(sptr))
sendnotice(sptr, "Your \"real name\" is now set to be %s - you have to set it manually to undo it",
parv[1]);
return 0;
}

View file

@ -1,10 +1,7 @@
/************************************************************************
* IRC - Internet Relay Chat, random.c
* IRC - Internet Relay Chat, res.c
* (C) 2005 Bram Matthys (Syzop) and the UnrealIRCd Team
*
* See file AUTHORS in IRC package for additional names of
* the programmers.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
@ -188,7 +185,8 @@ char ipv6 = r->ipv6;
if (!acptr)
return;
if (status != 0)
/* Check for status and null name (yes, we must) */
if ((status != 0) || !he->h_name || !*he->h_name)
{
/* Failed */
proceed_normal_client_handshake(acptr, NULL);
@ -199,6 +197,7 @@ char ipv6 = r->ipv6;
newr = MyMallocEx(sizeof(DNSReq));
newr->cptr = acptr;
newr->ipv6 = ipv6;
unrealdns_addreqtolist(newr);
#ifndef INET6
ares_gethostbyname(resolver_channel, he->h_name, AF_INET, unrealdns_cb_nametoip_verify, newr);