mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-06-12 19:14:46 +02:00
+- Fixed a sendto_serv_butone_token problem
This commit is contained in:
@@ -429,3 +429,4 @@
|
||||
- Added so stuff like Lost connection to, (report_error) only goes to realops
|
||||
- Added some more descriptive error messages
|
||||
- Added doc/crypto.doc describing the encrypted irc protocol
|
||||
- Fixed a sendto_serv_butone_token problem
|
||||
|
||||
+199
-22
@@ -423,7 +423,7 @@ extern Ban *is_banned(cptr, sptr, chptr)
|
||||
aClient *cptr, *sptr;
|
||||
aChannel *chptr;
|
||||
{
|
||||
Ban *tmp, *tmp2;
|
||||
Ban *tmp, *tmp2;
|
||||
char *s;
|
||||
static char realhost[NICKLEN + USERLEN + HOSTLEN + 6];
|
||||
static char virthost[NICKLEN + USERLEN + HOSTLEN + 6];
|
||||
@@ -442,21 +442,21 @@ extern Ban *is_banned(cptr, sptr, chptr)
|
||||
|
||||
s = make_nick_user_host(cptr->name, cptr->user->username,
|
||||
cptr->user->virthost);
|
||||
strcpy(virthost, s);
|
||||
/* We now check +b first, if a +b is found we then see if there is a +e.
|
||||
* If a +e was found we return NULL, if not, we return the ban.
|
||||
*/
|
||||
for (tmp = chptr->banlist; tmp; tmp = tmp->next)
|
||||
if ((match(tmp->banstr, realhost) == 0) ||
|
||||
(dovirt && (match(tmp->banstr, virthost) == 0))) {
|
||||
/* Ban found, now check for +e */
|
||||
for (tmp2 = chptr->exlist; tmp2; tmp2 = tmp2->next)
|
||||
if ((match(tmp2->banstr, realhost) == 0) ||
|
||||
(dovirt && (match(tmp2->banstr, virthost) == 0)))
|
||||
return (NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
strcpy(virthost, s);
|
||||
/* We now check +b first, if a +b is found we then see if there is a +e.
|
||||
* If a +e was found we return NULL, if not, we return the ban.
|
||||
*/
|
||||
for (tmp = chptr->banlist; tmp; tmp = tmp->next)
|
||||
if ((match(tmp->banstr, realhost) == 0) ||
|
||||
(dovirt && (match(tmp->banstr, virthost) == 0))) {
|
||||
/* Ban found, now check for +e */
|
||||
for (tmp2 = chptr->exlist; tmp2; tmp2 = tmp2->next)
|
||||
if ((match(tmp2->banstr, realhost) == 0) ||
|
||||
(dovirt && (match(tmp2->banstr, virthost) == 0)))
|
||||
return (NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return (tmp);
|
||||
}
|
||||
@@ -2964,7 +2964,7 @@ int m_join(cptr, sptr, parc, parv)
|
||||
}
|
||||
|
||||
sendto_serv_butone_token(cptr, parv[0], MSG_JOIN,
|
||||
TOK_JOIN, chptr->chname);
|
||||
TOK_JOIN, "%s", chptr->chname);
|
||||
|
||||
if (MyClient(sptr))
|
||||
{
|
||||
@@ -3059,7 +3059,7 @@ int m_part(cptr, sptr, parc, parv)
|
||||
*/
|
||||
if (parc < 3)
|
||||
sendto_serv_butone_token(cptr, parv[0],
|
||||
MSG_PART, TOK_PART, chptr->chname);
|
||||
MSG_PART, TOK_PART, "%s", chptr->chname);
|
||||
else
|
||||
sendto_serv_butone_token(cptr, parv[0],
|
||||
MSG_PART, TOK_PART, "%s :%s", chptr->chname,
|
||||
@@ -4290,13 +4290,14 @@ aParv *mp2parv(char *xmbuf, char *parmbuf)
|
||||
** that is based on the EFnet TS3 protocol.
|
||||
** -GZ (gz@starchat.net)
|
||||
**
|
||||
** Modified for Unreal3.0 by Stskeeps
|
||||
** Modified for UnrealIRCd by Stskeeps
|
||||
** Recoded by Stskeeps
|
||||
** parv[0] = sender prefix
|
||||
** parv[1] = channel timestamp
|
||||
** parv[2] = channel name
|
||||
** parv[3] = channel modes
|
||||
** parv[4] = channel mode parameters (key/limit)
|
||||
** parv[5] = nick names + modes - all in one parameter
|
||||
** parv[parc - 1] = nick names + modes - all in one parameter
|
||||
*/
|
||||
#define FL_VOICE 0x1
|
||||
#define FL_HALFOP 0x2
|
||||
@@ -4304,6 +4305,182 @@ aParv *mp2parv(char *xmbuf, char *parmbuf)
|
||||
#define FL_PROT 0x8
|
||||
#define FL_FOUNDER 0x10
|
||||
|
||||
#define Addit(x,y) modebuf[b] = x; strcat(parabuf, y); \
|
||||
strcat(parabuf, " "); \
|
||||
if (b == RESYNCMODES) \
|
||||
{ modebuf[b + 1] = '\0'; sendto_serv_butone_sjoin(cptr, \
|
||||
":%s MODE %s %s %s %lu", me.name, chptr->chname, \
|
||||
modebuf, parabuf, chptr->creationtime); \
|
||||
sendto_channel_butserv(chptr, sptr, \
|
||||
"%s MODE %s %s %s", me.name, chptr->chname, \
|
||||
modebuf, parabuf); \
|
||||
parabuf[0] = '\0'; \
|
||||
b = 1; \
|
||||
} else b++
|
||||
|
||||
#ifdef NEW_SJOIN
|
||||
int m_sjoin(cptr, sptr, parc, parv)
|
||||
aClient *cptr, *sptr;
|
||||
int parc;
|
||||
char *parv[];
|
||||
{
|
||||
unsigned short nopara;
|
||||
unsigned short nomode;
|
||||
unsigned short removeours;
|
||||
unsigned short removetheirs;
|
||||
unsigned short merge; /* same timestamp */
|
||||
char pvar[MAXMODEPARAMS][MODEBUFLEN + 3];
|
||||
aClient *acptr, *tempptr;
|
||||
aChannel *chptr;
|
||||
aSynchList *synchptr;
|
||||
Link *lp;
|
||||
Ban *ban;
|
||||
aParv *ap;
|
||||
int ts,oldts, pcount;
|
||||
unsigned short b;
|
||||
|
||||
if (IsClient(sptr) || parc < 6 || !IsServer(sptr))
|
||||
return 0;
|
||||
|
||||
if (!IsChannelName(parv[2]))
|
||||
return 0;
|
||||
|
||||
nopara = nomode = removeours = removetheirs = 0;
|
||||
|
||||
if (SupportSJOIN(sptr) && !strncmp(parv[4], "<none>", 6))
|
||||
nopara = 1;
|
||||
if (SupportSJOIN2(sptr) && !strncmp(parv[4], "<->", 6))
|
||||
nopara = 1;
|
||||
if (SupportSJ3(sptr) && !strcmp(parv[4], "*"))
|
||||
nopara = 1;
|
||||
|
||||
if (parv[3][1] == '\0')
|
||||
nomode = 1;
|
||||
|
||||
chptr = get_channel(cptr, parv[2], CREATE);
|
||||
|
||||
ts = atol(parv[1]);
|
||||
|
||||
if (chptr->creationtime > ts)
|
||||
removeours = 1;
|
||||
else if ((chptr->creationtime < ts) && (chptr->creationtime != 0))
|
||||
removetheirs = 1;
|
||||
else if (chptr->creationtime == ts)
|
||||
merge = 1;
|
||||
|
||||
if (chptr->creationtime == 0 && (ts > 0))
|
||||
oldts = -1;
|
||||
else
|
||||
oldts = chptr->creationtime;
|
||||
|
||||
if (ts < 750000)
|
||||
if (ts != 0)
|
||||
sendto_ops("Warning! Possible desynch: SJOIN for channel %s has a fishy timestamp (%ld)",
|
||||
chptr->chname, ts);
|
||||
parabuf[0] = '\0';
|
||||
modebuf[0] = '+';
|
||||
modebuf[1] = '\0';
|
||||
channel_modes(cptr, modebuf, parabuf, chptr);
|
||||
if (removeours)
|
||||
{
|
||||
modebuf[0] = '-';
|
||||
/* remove our modes if any */
|
||||
if (modebuf[1] != '\0')
|
||||
{
|
||||
int b;
|
||||
Ban *ban;
|
||||
|
||||
ap = mp2parv(modebuf, parabuf);
|
||||
set_mode(chptr, cptr, ap->parc, ap->parv, &pcount,
|
||||
pvar, 0);
|
||||
sendto_serv_butone_sjoin(cptr,
|
||||
":%s MODE %s %s %s %lu",
|
||||
me.name, chptr->chname, modebuf, parabuf,
|
||||
chptr->creationtime);
|
||||
sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s",
|
||||
me.name, chptr->chname, modebuf, parabuf);
|
||||
|
||||
}
|
||||
/* remove bans */
|
||||
b = 1;
|
||||
parabuf[0] = '\0';
|
||||
for (ban = chptr->banlist; ban; ban = ban->next)
|
||||
{
|
||||
Addit('b', ban->banstr);
|
||||
}
|
||||
for (ban = chptr->exlist; ban; ban = ban->next)
|
||||
{
|
||||
Addit('e', ban->banstr);
|
||||
}
|
||||
for (lp = chptr->members; lp; lp = lp->next)
|
||||
{
|
||||
if (lp->flags & MODE_CHANOWNER)
|
||||
{
|
||||
lp->flags &= ~MODE_CHANOWNER;
|
||||
Addit('q', lp->value.cptr->name);
|
||||
}
|
||||
if (lp->flags & MODE_CHANPROT)
|
||||
{
|
||||
lp->flags &= ~MODE_CHANPROT;
|
||||
Addit('a', lp->value.cptr->name);
|
||||
}
|
||||
if (lp->flags & MODE_CHANOP)
|
||||
{
|
||||
lp->flags &= ~MODE_CHANOP;
|
||||
Addit('o', lp->value.cptr->name);
|
||||
}
|
||||
if (lp->flags & MODE_HALFOP)
|
||||
{
|
||||
lp->flags &= ~MODE_HALFOP;
|
||||
Addit('h', lp->value.cptr->name);
|
||||
}
|
||||
if (lp->flags & MODE_VOICE)
|
||||
{
|
||||
lp->flags &= ~MODE_VOICE;
|
||||
Addit('v', lp->value.cptr->name);
|
||||
}
|
||||
}
|
||||
if(b > 1)
|
||||
{
|
||||
modebuf[b] = '\0';
|
||||
sendto_serv_butone_sjoin(cptr,
|
||||
":%s MODE %s %s %s %lu",
|
||||
me.name, chptr->chname,
|
||||
modebuf, parabuf,
|
||||
chptr->creationtime);
|
||||
sendto_channel_butserv(chptr,
|
||||
sptr, ":%s MODE %s %s %s",
|
||||
me.name, chptr->chname,
|
||||
modebuf, parabuf);
|
||||
|
||||
}
|
||||
}
|
||||
if (!merge && removeours)
|
||||
{
|
||||
strcpy(modebuf, parv[3]);
|
||||
parabuf[0] = '\0';
|
||||
if (!nopara)
|
||||
for (b = 4; b <= (parc - 2); b++)
|
||||
{
|
||||
strcat(parabuf, parv[b]);
|
||||
strcat(parabuf, " ");
|
||||
}
|
||||
|
||||
ap = mp2parv(modebuf, parabuf);
|
||||
set_mode(chptr, cptr, ap->parc, ap->parv, &pcount,
|
||||
pvar, 0);
|
||||
sendto_serv_butone_sjoin(cptr,
|
||||
":%s MODE %s %s %s %lu",
|
||||
me.name, chptr->chname, modebuf, parabuf,
|
||||
chptr->creationtime);
|
||||
sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s",
|
||||
me.name, chptr->chname, modebuf, parabuf);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#else
|
||||
|
||||
int m_sjoin(cptr, sptr, parc, parv)
|
||||
aClient *cptr, *sptr;
|
||||
int parc;
|
||||
@@ -4403,7 +4580,7 @@ int m_sjoin(cptr, sptr, parc, parv)
|
||||
ap = mp2parv(modebuf, parabuf);
|
||||
set_mode(chptr, cptr, ap->parc, ap->parv, &pcount, pvar, 0);
|
||||
sendto_serv_butone_sjoin(cptr, ":%s %s %s %s %s %lu",
|
||||
me.name, MSG_MODE, chptr->chname, modebuf, parabuf,
|
||||
me.name, MSG_MODE, chptr->chname, modebuf, parabuf,
|
||||
chptr->creationtime);
|
||||
sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s",
|
||||
me.name, chptr->chname, modebuf, parabuf);
|
||||
@@ -4960,7 +5137,7 @@ int m_sjoin(cptr, sptr, parc, parv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
static int send_ban_list(cptr, chname, creationtime, channel)
|
||||
aClient *cptr;
|
||||
char *chname;
|
||||
|
||||
+2
-2
@@ -2009,7 +2009,7 @@ int m_sqline(cptr, sptr, parc, parv)
|
||||
"%s :%s", parv[1], parv[2]);
|
||||
else
|
||||
sendto_serv_butone_token(cptr, parv[0], MSG_SQLINE, TOK_SQLINE,
|
||||
parv[1]);
|
||||
"%s", parv[1]);
|
||||
|
||||
asqline = make_sqline();
|
||||
|
||||
@@ -2044,7 +2044,7 @@ int m_unsqline(cptr, sptr, parc, parv)
|
||||
return 0;
|
||||
|
||||
sendto_serv_butone_token(cptr, parv[0], MSG_UNSQLINE, TOK_UNSQLINE,
|
||||
parv[1]);
|
||||
"%s", parv[1]);
|
||||
|
||||
if (!(asqline = find_sqline_nick(parv[1])))
|
||||
return;
|
||||
|
||||
+3
-3
@@ -2568,7 +2568,7 @@ int m_help(cptr, sptr, parc, parv)
|
||||
}
|
||||
if (message[1] == '!')
|
||||
sendto_serv_butone_token(IsServer(cptr) ? cptr : NULL,
|
||||
parv[0], MSG_HELP, TOK_HELP, message);
|
||||
parv[0], MSG_HELP, TOK_HELP, "%s", message);
|
||||
if (!myncmp(message, "IGNORE ", 7))
|
||||
{
|
||||
tmpl = make_link();
|
||||
@@ -2602,14 +2602,14 @@ int m_help(cptr, sptr, parc, parv)
|
||||
}
|
||||
|
||||
sendto_serv_butone_token(IsServer(cptr) ? cptr : NULL,
|
||||
parv[0], MSG_HELP, TOK_HELP, message);
|
||||
parv[0], MSG_HELP, TOK_HELP, "%s", message);
|
||||
sendto_helpops("from %s (Local): %s", parv[0], message);
|
||||
sendto_one(sptr, rpl_str(RPL_HELPFWD), me.name, parv[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendto_serv_butone_token(IsServer(cptr) ? cptr : NULL,
|
||||
parv[0], MSG_HELP, TOK_HELP, message);
|
||||
parv[0], MSG_HELP, TOK_HELP, "%s", message);
|
||||
sendto_helpops("from %s: %s", parv[0], message);
|
||||
}
|
||||
|
||||
|
||||
+4
-41
@@ -113,7 +113,7 @@ void iNAH_host(aClient *sptr, char *host)
|
||||
ircsprintf(sptr->user->virthost, host);
|
||||
if (MyConnect(sptr))
|
||||
sendto_serv_butone_token(&me, sptr->name, MSG_SETHOST,
|
||||
TOK_SETHOST, sptr->user->virthost);
|
||||
TOK_SETHOST, "%s", sptr->user->virthost);
|
||||
sptr->umodes |= UMODE_SETHOST;
|
||||
}
|
||||
|
||||
@@ -1502,45 +1502,8 @@ int m_nick(cptr, sptr, parc, parv)
|
||||
* Client setting NICK the first time.
|
||||
*
|
||||
* Generate a random string for them to pong with.
|
||||
*
|
||||
* The first two are server specific. The intent is to randomize
|
||||
* things well.
|
||||
*
|
||||
* We use lots of junk here, but only "low cost" things.
|
||||
*/
|
||||
md5data[0] = NOSPOOF_SEED01;
|
||||
md5data[1] = NOSPOOF_SEED02;
|
||||
md5data[2] = TStime();
|
||||
md5data[3] = me.sendM;
|
||||
md5data[4] = me.receiveM;
|
||||
md5data[5] = 0;
|
||||
md5data[6] = getpid();
|
||||
md5data[7] = sptr->ip.S_ADDR;
|
||||
md5data[8] = sptr->fd;
|
||||
md5data[9] = 0;
|
||||
md5data[10] = 0;
|
||||
md5data[11] = 0;
|
||||
md5data[12] = md5hash[0]; /* previous runs... */
|
||||
md5data[13] = md5hash[1];
|
||||
md5data[14] = md5hash[2];
|
||||
md5data[15] = md5hash[3];
|
||||
|
||||
/*
|
||||
* initialize the md5 buffer to known values
|
||||
*/
|
||||
MD5Init(md5hash);
|
||||
|
||||
/*
|
||||
* transform the above information into gibberish
|
||||
*/
|
||||
MD5Transform(md5hash, md5data);
|
||||
|
||||
/*
|
||||
* Never release any internal state of our generator. Instead,
|
||||
* use two parts of the returned hash and xor them to hide
|
||||
* both values.
|
||||
*/
|
||||
sptr->nospoof = (md5hash[0] ^ md5hash[1]);
|
||||
*/
|
||||
sptr->nospoof = 1+(int) (9000000.0*random()/(RAND_MAX+80000000.0));
|
||||
|
||||
/*
|
||||
* If on the odd chance it comes out zero, make it something
|
||||
@@ -1551,7 +1514,7 @@ int m_nick(cptr, sptr, parc, parv)
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** If you are having problems"
|
||||
" connecting due to ping timeouts, please"
|
||||
" type /notice %X nospoof now.",
|
||||
me.name, nick, sptr->nospoof, sptr->nospoof);
|
||||
me.name, nick, sptr->nospoof);
|
||||
sendto_one(sptr, "PING :%X", sptr->nospoof);
|
||||
#endif /* NOSPOOF */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user