summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-09-26 04:53:59 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-09-26 04:53:59 +0000
commitd8bd3afd763c0813544ea6c8bbaa589dc0e44034 (patch)
tree2632a45ee7989d7219eaa79d07a39b406c95650c /src
parent927d2717a989d5b5c074390fbb71d8230b13d5d5 (diff)
Fixed bug #1107. We now have support for IRCds that send auth after the initial NICK/UID command, and automatically reidentifying users from their account name on InspIRCd1.2
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2513 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/protocol/bahamut.c1
-rw-r--r--src/protocol/inspircd11.c1
-rw-r--r--src/protocol/inspircd12.cpp30
-rw-r--r--src/protocol/ratbox.c1
-rw-r--r--src/protocol/unreal32.c1
-rw-r--r--src/users.c78
6 files changed, 80 insertions, 32 deletions
diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c
index ecbb2c530..5aa704100 100644
--- a/src/protocol/bahamut.c
+++ b/src/protocol/bahamut.c
@@ -129,6 +129,7 @@ IRCDVar myIrcd[] = {
NULL, /* character set */
0, /* CIDR channelbans */
"$", /* TLD Prefix for Global */
+ false, /* Auth for users is sent after the initial NICK/UID command */
}
,
{NULL}
diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c
index 38de551bf..cc8b7f73f 100644
--- a/src/protocol/inspircd11.c
+++ b/src/protocol/inspircd11.c
@@ -138,6 +138,7 @@ IRCDVar myIrcd[] = {
NULL, /* character set */
1, /* CIDR channelbans */
"$", /* TLD Prefix for Global */
+ false, /* Auth for users is sent after the initial NICK/UID command */
}
,
{NULL}
diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp
index 338097f1c..8000f16a3 100644
--- a/src/protocol/inspircd12.cpp
+++ b/src/protocol/inspircd12.cpp
@@ -138,6 +138,7 @@ IRCDVar myIrcd[] = {
NULL, /* character set */
1, /* CIDR channelbans */
"$", /* TLD Prefix for Global */
+ true, /* Auth for users is sent after the initial NICK/UID command */
}
,
{NULL}
@@ -402,6 +403,9 @@ static int has_banexceptionmod = 0;
static int has_inviteexceptionmod = 0;
static int has_hidechansmod = 0;
+/* Previously introduced user during burst */
+static User *prev_u_intro;
+
/* CHGHOST */
void inspircd_cmd_chghost(const char *nick, const char *vhost)
@@ -465,6 +469,11 @@ class InspIRCdProto : public IRCDProto
else --opcnt;
break;
case 'r':
+ /* The users server is syncing, do not
+ * set them -r yet - Adam
+ */
+ if (user->server->sync == SSYNC_IN_PROGRESS)
+ break;
if (add && !nick_identified(user)) {
common_svsmode(user, "-r", NULL);
user->mode &= ~UMODE_r;
@@ -1163,6 +1172,16 @@ int anope_event_uid(const char *source, int ac, const char **av)
Server *s = findserver_uid(servlist, source);
uint32 *ad = reinterpret_cast<uint32 *>(&addy);
int ts = strtoul(av[1], NULL, 10);
+
+ /* Previously introduced user is still in buffer, so should be marked UNID'd */
+ user = prev_u_intro;
+ prev_u_intro = NULL;
+ if (user && user->server->sync == SSYNC_IN_PROGRESS && !user->nc)
+ {
+ validate_user(user);
+ common_svsmode(user, "-r", NULL);
+ }
+ user = NULL;
inet_aton(av[6], &addy);
user = do_nick("", av[2], /* nick */
@@ -1173,6 +1192,10 @@ int anope_event_uid(const char *source, int ac, const char **av)
ts, htonl(*ad), av[4], av[0]);
if (user)
{
+ if (user->server->sync == SSYNC_IN_PROGRESS)
+ {
+ prev_u_intro = user;
+ }
ircdproto->ProcessUsermodes(user, 1, &av[8]);
user->SetCloakedHost(av[4]);
}
@@ -1249,11 +1272,8 @@ int anope_event_metadata(const char *source, int ac, const char **av)
{
if ((u = find_byuid(av[0])))
{
- /* Check to see if the account name is the same
- * as the one saved for this nick, if so identify
- * them - Adam
- */
- u->CheckAuthenticationToken(av[2]);
+ /* Identify the user for this account - Adam */
+ u->AutoID(av[2]);
}
}
diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c
index 271ab036c..33eb88570 100644
--- a/src/protocol/ratbox.c
+++ b/src/protocol/ratbox.c
@@ -114,6 +114,7 @@ IRCDVar myIrcd[] = {
NULL, /* character set */
0, /* CIDR channelbans */
"$$", /* TLD Prefix for Global */
+ false, /* Auth for users is sent after the initial NICK/UID command */
}
,
{NULL}
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c
index 9adbf0ffd..78d888518 100644
--- a/src/protocol/unreal32.c
+++ b/src/protocol/unreal32.c
@@ -151,6 +151,7 @@ IRCDVar myIrcd[] = {
NULL, /* character set */
0, /* CIDR channelbans */
"$", /* TLD Prefix for Global */
+ false, /* Auth for users is sent after the initial NICK/UID command */
}
,
{NULL}
diff --git a/src/users.c b/src/users.c
index b051dbe04..76e108154 100644
--- a/src/users.c
+++ b/src/users.c
@@ -366,6 +366,24 @@ void User::CheckAuthenticationToken(const char *svid)
}
}
+/** Auto identify the user to the given accountname.
+ * @param account Display nick of account
+ */
+void User::AutoID(const char *account)
+{
+ NickCore *tnc;
+ NickAlias *na;
+
+ if ((tnc = findcore(account)))
+ {
+ this->nc = tnc;
+ if ((na = findnick(this->nick)) && na->nc == tnc)
+ {
+ na->status |= NS_IDENTIFIED;
+ check_memos(this);
+ }
+ }
+}
/*************************************************************************/
/*************************************************************************/
@@ -777,37 +795,43 @@ User *do_nick(const char *source, const char *nick, const char *username, const
} /* if (!*source) */
- NickAlias *ntmp = findnick(user->nick);
- if (ntmp && user->nc == ntmp->nc)
- {
- ntmp->status |= NS_IDENTIFIED;
- nc_changed = 0;
- }
-
- if (!ntmp || ntmp->nc != user->nc || nc_changed)
- {
- if (validate_user(user))
- check_memos(user);
- }
- else
+ /* Do not attempt to validate the user if their server is syncing and this
+ * ircd has delayed auth - Adam
+ */
+ if (!(ircd->b_delay_auth && user->server->sync == SSYNC_IN_PROGRESS))
{
- ntmp->last_seen = time(NULL);
-
- if (ntmp->last_usermask)
- delete [] ntmp->last_usermask;
- ntmp->last_usermask = new char[user->GetIdent().length() + user->GetDisplayedHost().length() + 2];
- sprintf(ntmp->last_usermask, "%s@%s",
- user->GetIdent().c_str(), user->GetDisplayedHost().c_str());
- ircdproto->SetAutoIdentificationToken(user);
- alog("%s: %s!%s@%s automatically identified for nick %s", s_NickServ, user->nick, user->GetIdent().c_str(), user->host, user->nick);
- }
+ NickAlias *ntmp = findnick(user->nick);
+ if (ntmp && user->nc == ntmp->nc)
+ {
+ ntmp->status |= NS_IDENTIFIED;
+ nc_changed = 0;
+ }
- /* Bahamut sets -r on every nick changes, so we must test it even if nc_changed == 0 */
- if (ircd->check_nick_id)
- {
- if (nick_identified(user))
+ if (!ntmp || ntmp->nc != user->nc || nc_changed)
+ {
+ if (validate_user(user))
+ check_memos(user);
+ }
+ else
{
+ ntmp->last_seen = time(NULL);
+
+ if (ntmp->last_usermask)
+ delete [] ntmp->last_usermask;
+ ntmp->last_usermask = new char[user->GetIdent().length() + user->GetDisplayedHost().length() + 2];
+ sprintf(ntmp->last_usermask, "%s@%s",
+ user->GetIdent().c_str(), user->GetDisplayedHost().c_str());
ircdproto->SetAutoIdentificationToken(user);
+ alog("%s: %s!%s@%s automatically identified for nick %s", s_NickServ, user->nick, user->GetIdent().c_str(), user->host, user->nick);
+ }
+
+ /* Bahamut sets -r on every nick changes, so we must test it even if nc_changed == 0 */
+ if (ircd->check_nick_id)
+ {
+ if (nick_identified(user))
+ {
+ ircdproto->SetAutoIdentificationToken(user);
+ }
}
}