1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 10:06:37 +02:00

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
This commit is contained in:
Adam-
2009-09-26 04:53:59 +00:00
parent 927d2717a9
commit d8bd3afd76
8 changed files with 87 additions and 33 deletions
+1
View File
@@ -525,6 +525,7 @@ struct ircdvars_ {
* 0 for no support, 1 for strict cidr support, anything else
* for ircd specific support (nefarious only cares about first /mask) */
const char *globaltldprefix; /* TLD prefix used for Global */
bool b_delay_auth; /* Auth for users is sent after the initial NICK/UID command */
};
struct ircdcapab_ {
+5
View File
@@ -145,5 +145,10 @@ public: // XXX: exposing a tiny bit too much
* @param svid Services id
*/
void CheckAuthenticationToken(const char *svid);
/** Auto identify the user to the given accountname.
* @param account Display nick of account
*/
void AutoID(const char *acc);
};
+1
View File
@@ -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}
+1
View File
@@ -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}
+25 -5
View File
@@ -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]);
}
}
+1
View File
@@ -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}
+1
View File
@@ -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}
+52 -28
View File
@@ -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)
/* 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->status |= NS_IDENTIFIED;
nc_changed = 0;
}
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))
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
{
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);
}
}
}