*/
int
-register_local_user(struct Client *client_p, struct Client *source_p, const char *username)
+register_local_user(struct Client *client_p, struct Client *source_p)
{
struct ConfItem *aconf, *xconf;
struct User *user = source_p->user;
s_assert(NULL != source_p);
s_assert(MyConnect(source_p));
- s_assert(source_p->username != username);
if(source_p == NULL)
return -1;
client_p->localClient->last = rb_current_time();
/* XXX - fixme. we shouldnt have to build a users buffer twice.. */
- if(!IsGotId(source_p) && (strchr(username, '[') != NULL))
+ if(!IsGotId(source_p) && (strchr(source_p->username, '[') != NULL))
{
const char *p;
int i = 0;
- p = username;
+ p = source_p->username;
while(*p && i < USERLEN)
{
}
myusername[i] = '\0';
- username = myusername;
}
+ else
+ rb_strlcpy(myusername, source_p->username, sizeof myusername);
- if((status = check_client(client_p, source_p, username)) < 0)
+ if((status = check_client(client_p, source_p, myusername)) < 0)
return (CLIENT_EXITED);
/* Apply nick override */
/* dont replace username if its supposed to be spoofed --fl */
if(!IsConfDoSpoofIp(aconf) || !strchr(aconf->info.name, '@'))
{
- p = username;
+ p = myusername;
if(!IsNoTilde(aconf))
source_p->username[i++] = '~';
else
{
sendto_realops_snomask(SNO_REJ, L_NETWIDE,
- "DNSBL listed: %s!%s@%s{%s} %s (%s)", source_p->name,
- source_p->username, source_p->host, source_p->sockhost, source_p->info,
- source_p->preClient->dnsbl_listed->host);
+ "Listed on DNSBL %s: %s (%s@%s) [%s] [%s]",
+ source_p->preClient->dnsbl_listed->host,
+ source_p->name,
+ source_p->username, source_p->host,
+ IsIPSpoof(source_p) ? "255.255.255.255" : source_p->sockhost,
+ source_p->info);
rb_dlink_list varlist = { NULL, NULL, 0 };
int
introduce_client(struct Client *client_p, struct Client *source_p, struct User *user, const char *nick, int use_euid)
{
- static char ubuf[12];
+ char ubuf[BUFSIZE];
struct Client *identifyservice_p;
char *p;
hook_data_umode_changed hdata;
hook_data_client hdata2;
- char sockhost[HOSTLEN];
if(MyClient(source_p))
- send_umode(source_p, source_p, 0, 0, ubuf);
+ send_umode(source_p, source_p, 0, ubuf);
else
- send_umode(NULL, source_p, 0, 0, ubuf);
+ send_umode(NULL, source_p, 0, ubuf);
if(!*ubuf)
{
s_assert(has_id(source_p));
- if(source_p->sockhost[0] == ':')
- {
- sockhost[0] = '0';
- sockhost[1] = '\0';
- rb_strlcat(sockhost, source_p->sockhost, sizeof(sockhost));
- } else
- strcpy(sockhost, source_p->sockhost);
-
if (use_euid)
sendto_server(client_p, NULL, CAP_EUID | CAP_TS6, NOCAPS,
":%s EUID %s %d %ld %s %s %s %s %s %s %s :%s",
source_p->hopcount + 1,
(long) source_p->tsinfo, ubuf,
source_p->username, source_p->host,
- IsIPSpoof(source_p) ? "0" : sockhost,
+ IsIPSpoof(source_p) ? "0" : source_p->sockhost,
source_p->id,
IsDynSpoof(source_p) ? source_p->orighost : "*",
EmptyString(source_p->user->suser) ? "*" : source_p->user->suser,
source_p->hopcount + 1,
(long) source_p->tsinfo, ubuf,
source_p->username, source_p->host,
- IsIPSpoof(source_p) ? "0" : sockhost,
+ IsIPSpoof(source_p) ? "0" : source_p->sockhost,
source_p->id, source_p->info);
if(!EmptyString(source_p->certfp))
if(hostname == NULL)
return NO;
+ if(!strcmp(hostname, "localhost"))
+ return YES;
+
if('.' == *p || ':' == *p || '/' == *p)
return NO;
* -avalon
*/
void
-send_umode(struct Client *client_p, struct Client *source_p, int old, int sendmask, char *umode_buf)
+send_umode(struct Client *client_p, struct Client *source_p, int old, char *umode_buf)
{
int i;
int flag;
char buf[BUFSIZE];
rb_dlink_node *ptr;
- send_umode(NULL, source_p, old, 0, buf);
+ send_umode(NULL, source_p, old, buf);
RB_DLINK_FOREACH(ptr, serv_list.head)
{
}
if(client_p && MyClient(client_p))
- send_umode(client_p, source_p, old, 0, buf);
+ send_umode(client_p, source_p, old, buf);
}
/*
vsnprintf(reason, 255, format, ap);
va_end(ap);
- sendto_common_channels_local_butone(target_p, NOCAPS, ":%s!%s@%s QUIT :%s",
+ sendto_common_channels_local_butone(target_p, NOCAPS, CLICAP_CHGHOST, ":%s!%s@%s QUIT :%s",
target_p->name, target_p->username, target_p->host,
reason);
*mptr = '\0';
- sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, NOCAPS, CLICAP_EXTENDED_JOIN, chptr,
+ sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, NOCAPS, CLICAP_EXTENDED_JOIN | CLICAP_CHGHOST, chptr,
":%s!%s@%s JOIN %s", nick, user, host, chptr->chname);
- sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, CLICAP_EXTENDED_JOIN, NOCAPS, chptr,
+ sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, CLICAP_EXTENDED_JOIN, CLICAP_CHGHOST, chptr,
":%s!%s@%s JOIN %s %s :%s", nick, user, host, chptr->chname,
EmptyString(target_p->user->suser) ? "*" : target_p->user->suser,
target_p->info);
/* Resend away message to away-notify enabled clients. */
if (target_p->user->away)
- sendto_common_channels_local_butone(target_p, CLICAP_AWAY_NOTIFY, ":%s!%s@%s AWAY :%s",
- target_p->name, target_p->username, target_p->host,
+ sendto_common_channels_local_butone(target_p, CLICAP_AWAY_NOTIFY, CLICAP_CHGHOST, ":%s!%s@%s AWAY :%s",
+ nick, user, host,
target_p->user->away);
+ sendto_common_channels_local_butone(target_p, CLICAP_CHGHOST, NOCAPS,
+ ":%s!%s@%s CHGHOST %s %s",
+ target_p->name, target_p->username, target_p->host, user, host);
+
if(MyClient(target_p) && changed_case)
sendto_one(target_p, ":%s!%s@%s NICK %s",
- target_p->name, target_p->username, target_p->host, nick);
+ target_p->name, user, host, nick);
/* TODO: send some snotes to SNO_NCHANGE/SNO_CCONN/SNO_CCONNEXT? */
}
else if(changed_case)
{
- sendto_common_channels_local(target_p, NOCAPS, ":%s!%s@%s NICK :%s",
- target_p->name, target_p->username,
- target_p->host, nick);
+ sendto_common_channels_local(target_p, NOCAPS, NOCAPS, ":%s!%s@%s NICK :%s",
+ target_p->name, user, host, nick);
if(MyConnect(target_p))
sendto_realops_snomask(SNO_NCHANGE, L_ALL,