* Merged changes up to eAthena 15087.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15927 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
eathenabot 2012-04-22 17:18:25 +00:00
parent 490bd54958
commit e1ee9a8ef1

View File

@ -1343,6 +1343,7 @@ int parse_login(int fd)
case 0x01dd: // S 01dd <version>.L <username>.24B <password hash>.16B <clienttype>.B
case 0x01fa: // S 01fa <version>.L <username>.24B <password hash>.16B <clienttype>.B <?>.B(index of the connection in the clientinfo file (+10 if the command-line contains "pc"))
case 0x027c: // S 027c <version>.L <username>.24B <password hash>.16B <clienttype>.B <?>.13B(junk)
case 0x0825: // S 0825 <packetsize>.W <version>.L <clienttype>.B <userid>.24B <password>.27B <mac>.17B <ip>.15B <token>.(packetsize - 0x5C)B
{
size_t packet_len = RFIFOREST(fd);
@ -1351,7 +1352,8 @@ int parse_login(int fd)
|| (command == 0x02b0 && packet_len < 85)
|| (command == 0x01dd && packet_len < 47)
|| (command == 0x01fa && packet_len < 48)
|| (command == 0x027c && packet_len < 60) )
|| (command == 0x027c && packet_len < 60)
|| (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) )
return 0;
}
{
@ -1360,8 +1362,30 @@ int parse_login(int fd)
char password[NAME_LENGTH];
unsigned char passhash[16];
uint8 clienttype;
bool israwpass = (command==0x0064 || command==0x0277 || command==0x02b0);
bool israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825);
// Shinryo: For the time being, just use token as password.
if(command == 0x0825)
{
char *accname = (char *)RFIFOP(fd, 9);
char *token = (char *)RFIFOP(fd, 0x5C);
size_t uAccLen = strlen(accname);
size_t uTokenLen = RFIFOREST(fd) - 0x5C;
version = RFIFOL(fd,4);
if(uAccLen > NAME_LENGTH - 1 || uAccLen <= 0 || uTokenLen > NAME_LENGTH - 1 || uTokenLen <= 0)
{
login_auth_failed(sd, 3);
return 0;
}
safestrncpy(username, accname, uAccLen + 1);
safestrncpy(password, token, uTokenLen + 1);
clienttype = RFIFOB(fd, 8);
}
else
{
version = RFIFOL(fd,2);
safestrncpy(username, (const char*)RFIFOP(fd,6), NAME_LENGTH);
if( israwpass )
@ -1374,6 +1398,7 @@ int parse_login(int fd)
memcpy(passhash, RFIFOP(fd,30), 16);
clienttype = RFIFOB(fd,46);
}
}
RFIFOSKIP(fd,RFIFOREST(fd)); // assume no other packet was sent
sd->clienttype = clienttype;