1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-01 05:36:37 +02:00

Made aClient->passwd dynamically allocated

This commit is contained in:
codemastr
2000-09-01 20:52:00 +00:00
parent ecdce7061b
commit 7cbbef2e36
4 changed files with 18 additions and 8 deletions
+2 -1
View File
@@ -1109,7 +1109,8 @@ int m_server_estab(cptr)
sendto_ops("Access denied (passwd mismatch) %s", inpath);
return exit_client(cptr, cptr, cptr, "Bad Password");
}
bzero(cptr->passwd, sizeof(cptr->passwd));
if (cptr->passwd)
MyFree(cptr->passwd);
#ifndef HUB
for (i = 0; i <= highest_fd; i++)
if (local[i] && IsServer(local[i]))
+14 -6
View File
@@ -802,7 +802,7 @@ static int register_user(cptr, sptr, nick, username, umode, virthost)
* - Wizzu
*/
else
sptr->passwd[0] = '\0';
MyFree(sptr->passwd);
}
/*
@@ -962,6 +962,7 @@ static int register_user(cptr, sptr, nick, username, umode, virthost)
*/
if (MyConnect(sptr))
{
if (sptr->passwd[0])
if (sptr->passwd[0] && (nsptr = find_person(NickServ, NULL)))
sendto_one(nsptr, ":%s PRIVMSG %s@%s :IDENTIFY %s",
sptr->name, NickServ, SERVICES_NAME, sptr->passwd);
@@ -980,9 +981,10 @@ static int register_user(cptr, sptr, nick, username, umode, virthost)
}
}
if (MyConnect(sptr) && !BadPtr(sptr->passwd))
bzero(sptr->passwd, sizeof(sptr->passwd));
if (MyConnect(sptr) && !BadPtr(sptr->passwd)) {
MyFree(sptr->passwd);
ircd_log("%s freed", sptr->passwd);
}
return 0;
}
@@ -3988,7 +3990,7 @@ int m_pass(cptr, sptr, parc, parv)
char *parv[];
{
char *password = parc > 1 ? parv[1] : NULL;
int PassLen = 0;
if (BadPtr(password))
{
sendto_one(cptr, err_str(ERR_NEEDMOREPARAMS),
@@ -4001,7 +4003,13 @@ int m_pass(cptr, sptr, parc, parv)
me.name, parv[0]);
return 0;
}
strncpyzt(cptr->passwd, password, sizeof(cptr->passwd));
PassLen = strlen(password);
if (cptr->passwd)
MyFree(cptr->passwd);
if (PassLen > (PASSWDLEN))
PassLen = PASSWDLEN;
cptr->passwd = MyMalloc(PassLen + 1);
strncpyzt(cptr->passwd, password, PassLen +1);
return 0;
}