Renamed COUNTRYINFO_109 packet to AUTH_INFO
This commit is contained in:
parent
df837c6f3e
commit
7a1816ba1d
8 changed files with 57 additions and 50 deletions
|
@ -98,7 +98,7 @@ namespace pvpgn
|
|||
static int _client_compinfo1(t_connection * c, t_packet const *const packet);
|
||||
static int _client_compinfo2(t_connection * c, t_packet const *const packet);
|
||||
static int _client_countryinfo1(t_connection * c, t_packet const *const packet);
|
||||
static int _client_countryinfo109(t_connection * c, t_packet const *const packet);
|
||||
static int _client_auth_info(t_connection * c, t_packet const *const packet);
|
||||
static int _client_unknown2b(t_connection * c, t_packet const *const packet);
|
||||
static int _client_progident(t_connection * c, t_packet const *const packet);
|
||||
static int _client_createaccountw3(t_connection * c, t_packet const *const packet);
|
||||
|
@ -185,7 +185,7 @@ namespace pvpgn
|
|||
{ CLIENT_COMPINFO1, _client_compinfo1 },
|
||||
{ CLIENT_COMPINFO2, _client_compinfo2 },
|
||||
{ CLIENT_COUNTRYINFO1, _client_countryinfo1 },
|
||||
{ CLIENT_COUNTRYINFO_109, _client_countryinfo109 },
|
||||
{ CLIENT_AUTH_INFO, _client_auth_info },
|
||||
{ CLIENT_UNKNOWN_2B, _client_unknown2b },
|
||||
{ CLIENT_PROGIDENT, _client_progident },
|
||||
{ CLIENT_CLOSEGAME, NULL },
|
||||
|
@ -513,12 +513,12 @@ namespace pvpgn
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int _client_countryinfo109(t_connection * c, t_packet const *const packet)
|
||||
static int _client_auth_info(t_connection * c, t_packet const *const packet)
|
||||
{
|
||||
t_packet *rpacket;
|
||||
|
||||
if (packet_get_size(packet) < sizeof(t_client_countryinfo_109)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad COUNTRYINFO_109 packet (expected {} bytes, got {})", conn_get_socket(c), sizeof(t_client_countryinfo_109), packet_get_size(packet));
|
||||
if (packet_get_size(packet) < sizeof(t_client_auth_info)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad AUTH_INFO packet (expected {} bytes, got {})", conn_get_socket(c), sizeof(t_client_auth_info), packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -530,37 +530,44 @@ namespace pvpgn
|
|||
char clienttag_str[5];
|
||||
char gamelang_str[5];
|
||||
|
||||
if (!(langstr = packet_get_str_const(packet, sizeof(t_client_countryinfo_109), MAX_LANG_STR))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad COUNTRYINFO_109 packet (missing or too long langstr)", conn_get_socket(c));
|
||||
if (!(langstr = packet_get_str_const(packet, sizeof(t_client_auth_info), MAX_LANG_STR))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad AUTH_INFO packet (missing or too long langstr)", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(countryname = packet_get_str_const(packet, sizeof(t_client_countryinfo_109)+std::strlen(langstr) + 1, MAX_COUNTRYNAME_STR))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad COUNTRYINFO_109 packet (missing or too long countryname)", conn_get_socket(c));
|
||||
if (!(countryname = packet_get_str_const(packet, sizeof(t_client_auth_info)+std::strlen(langstr) + 1, MAX_COUNTRYNAME_STR))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad AUTH_INFO packet (missing or too long countryname)", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* check if it's an allowed client type */
|
||||
if (tag_check_in_list(bn_int_get(packet->u.client_countryinfo_109.clienttag), prefs_get_allowed_clients())) {
|
||||
if (tag_check_in_list(bn_int_get(packet->u.client_auth_info.clienttag), prefs_get_allowed_clients())) {
|
||||
conn_set_state(c, conn_state_destroy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
tzbias = bn_int_get(packet->u.client_auth_info.bias);
|
||||
|
||||
tzbias = bn_int_get(packet->u.client_countryinfo_109.bias);
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] COUNTRYINFO_109 packet tzbias=0x{:04x} lcid={} langid={} arch=\"{}\" client=\"{}\" versionid=0x{:08x} gamelang=\"{}\"",
|
||||
conn_get_socket(c), tzbias, bn_int_get(packet->u.client_countryinfo_109.lcid), bn_int_get(packet->u.client_countryinfo_109.langid),
|
||||
tag_uint_to_str(archtag_str, bn_int_get(packet->u.client_countryinfo_109.archtag)), tag_uint_to_str(clienttag_str, bn_int_get(packet->u.client_countryinfo_109.clienttag)),
|
||||
bn_int_get(packet->u.client_countryinfo_109.versionid), tag_uint_to_str(gamelang_str, bn_int_get(packet->u.client_countryinfo_109.gamelang)));
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] COUNTRYINFO_109 packet from \"{}\" \"{}\"", conn_get_socket(c), countryname, langstr);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] AUTH_INFO packet {{ protocol={:#02x}, platform={}, product={}, versionid={:#02x}, language={}, localip={:#04x}, tzbias={:04x}, locale={}, language={}, country={}.{} }}",
|
||||
conn_get_socket(c),
|
||||
bn_int_get(packet->u.client_auth_info.protocol),
|
||||
tag_uint_to_str(archtag_str, bn_int_get(packet->u.client_auth_info.archtag)),
|
||||
tag_uint_to_str(clienttag_str, bn_int_get(packet->u.client_auth_info.clienttag)),
|
||||
bn_int_get(packet->u.client_auth_info.versionid),
|
||||
tag_uint_to_str(gamelang_str, bn_int_get(packet->u.client_auth_info.gamelang)),
|
||||
bn_int_get(packet->u.client_auth_info.localip),
|
||||
tzbias,
|
||||
bn_int_get(packet->u.client_auth_info.lcid),
|
||||
bn_int_get(packet->u.client_auth_info.langid),
|
||||
langstr,
|
||||
countryname);
|
||||
|
||||
conn_set_country(c, langstr); /* FIXME: This isn't right. We want USA not ENU (English-US) */
|
||||
conn_set_tzbias(c, uint32_to_int(tzbias));
|
||||
conn_set_versionid(c, bn_int_get(packet->u.client_countryinfo_109.versionid));
|
||||
conn_set_archtag(c, bn_int_get(packet->u.client_countryinfo_109.archtag));
|
||||
conn_set_clienttag(c, bn_int_get(packet->u.client_countryinfo_109.clienttag));
|
||||
conn_set_gamelang(c, bn_int_get(packet->u.client_countryinfo_109.gamelang));
|
||||
conn_set_versionid(c, bn_int_get(packet->u.client_auth_info.versionid));
|
||||
conn_set_archtag(c, bn_int_get(packet->u.client_auth_info.archtag));
|
||||
conn_set_clienttag(c, bn_int_get(packet->u.client_auth_info.clienttag));
|
||||
conn_set_gamelang(c, bn_int_get(packet->u.client_auth_info.gamelang));
|
||||
|
||||
/* First, send an ECHO_REQ */
|
||||
|
||||
|
@ -592,7 +599,7 @@ namespace pvpgn
|
|||
|
||||
|
||||
// CheckRevision
|
||||
std::tuple<std::string, std::string> checkrevision = select_checkrevision(bn_int_get(packet->u.client_countryinfo_109.archtag), bn_int_get(packet->u.client_countryinfo_109.clienttag), bn_int_get(packet->u.client_countryinfo_109.versionid));
|
||||
std::tuple<std::string, std::string> checkrevision = select_checkrevision(bn_int_get(packet->u.client_auth_info.archtag), bn_int_get(packet->u.client_auth_info.clienttag), bn_int_get(packet->u.client_auth_info.versionid));
|
||||
file_to_mod_time(c, std::get<0>(checkrevision).c_str(), &rpacket->u.server_authreq_109.timestamp); // Checkrevision file timestamp
|
||||
packet_append_string(rpacket, std::get<0>(checkrevision).c_str()); // CheckRevision filename
|
||||
packet_append_string(rpacket, std::get<1>(checkrevision).c_str()); // CheckRevision equation
|
||||
|
|
|
@ -730,7 +730,7 @@ extern int main(int argc, char * argv[])
|
|||
|
||||
/* default values */
|
||||
user.archtag = ARCHTAG_WINX86;
|
||||
user.gamelang = CLIENT_COUNTRYINFO_109_GAMELANG;
|
||||
user.gamelang = CLIENT_AUTH_INFO_GAMELANG;
|
||||
user.ignoreversion = 0;
|
||||
|
||||
read_commandline(argc, argv, &servname, &servport, &user.clienttag, &user.archtag, &changepass,
|
||||
|
|
|
@ -399,7 +399,7 @@ extern int main(int argc, char * argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if ((sd = client_connect(argv[0], servname, servport, cdowner, cdkey, clienttag, ignoreversion, &saddr, &sessionkey, &sessionnum, ARCHTAG_WINX86, CLIENT_COUNTRYINFO_109_GAMELANG)) < 0)
|
||||
if ((sd = client_connect(argv[0], servname, servport, cdowner, cdkey, clienttag, ignoreversion, &saddr, &sessionkey, &sessionnum, ARCHTAG_WINX86, CLIENT_AUTH_INFO_GAMELANG)) < 0)
|
||||
{
|
||||
std::fprintf(stderr, "%s: fatal error during handshake\n", argv[0]);
|
||||
if (changed_in)
|
||||
|
|
|
@ -322,31 +322,31 @@ namespace pvpgn
|
|||
|
||||
return -1;
|
||||
}
|
||||
packet_set_size(packet, sizeof(t_client_countryinfo_109));
|
||||
packet_set_type(packet, CLIENT_COUNTRYINFO_109);
|
||||
bn_int_set(&packet->u.client_countryinfo_109.protocol, CLIENT_COUNTRYINFO_109_PROTOCOL);
|
||||
bn_int_tag_set(&packet->u.client_countryinfo_109.archtag, archtag);
|
||||
bn_int_tag_set(&packet->u.client_countryinfo_109.clienttag, clienttag);
|
||||
packet_set_size(packet, sizeof(t_client_auth_info));
|
||||
packet_set_type(packet, CLIENT_AUTH_INFO);
|
||||
bn_int_set(&packet->u.client_auth_info.protocol, CLIENT_AUTH_INFO_PROTOCOL);
|
||||
bn_int_tag_set(&packet->u.client_auth_info.archtag, archtag);
|
||||
bn_int_tag_set(&packet->u.client_auth_info.clienttag, clienttag);
|
||||
//AARON
|
||||
|
||||
bn_int_set(&packet->u.client_countryinfo_109.versionid, versionid);
|
||||
bn_int_tag_set(&packet->u.client_countryinfo_109.gamelang, gamelang);
|
||||
bn_int_set(&packet->u.client_countryinfo_109.localip, CLIENT_COUNTRYINFO_109_LOCALIP);
|
||||
bn_int_set(&packet->u.client_auth_info.versionid, versionid);
|
||||
bn_int_tag_set(&packet->u.client_auth_info.gamelang, gamelang);
|
||||
bn_int_set(&packet->u.client_auth_info.localip, CLIENT_AUTH_INFO_LOCALIP);
|
||||
{
|
||||
int bias;
|
||||
|
||||
bias = local_tzbias();
|
||||
|
||||
bn_int_set(&packet->u.client_countryinfo_109.bias, (unsigned int)bias); /* rely on 2's complement */
|
||||
bn_int_set(&packet->u.client_auth_info.bias, (unsigned int)bias); /* rely on 2's complement */
|
||||
dprintf("my tzbias = %d (0x%08hx)\n", bias, (unsigned int)bias);
|
||||
}
|
||||
/* FIXME: determine from locale */
|
||||
bn_int_set(&packet->u.client_countryinfo_109.lcid, CLIENT_COUNTRYINFO_109_LANGID_USENGLISH);
|
||||
bn_int_set(&packet->u.client_countryinfo_109.langid, CLIENT_COUNTRYINFO_109_LANGID_USENGLISH);
|
||||
packet_append_string(packet, CLIENT_COUNTRYINFO_109_LANGSTR_USENGLISH);
|
||||
bn_int_set(&packet->u.client_auth_info.lcid, CLIENT_AUTH_INFO_LANGID_USENGLISH);
|
||||
bn_int_set(&packet->u.client_auth_info.langid, CLIENT_AUTH_INFO_LANGID_USENGLISH);
|
||||
packet_append_string(packet, CLIENT_AUTH_INFO_LANGSTR_USENGLISH);
|
||||
/* FIXME: determine from locale+timezone... from domain name... nothing really would
|
||||
work. Maybe add some command-line options */
|
||||
packet_append_string(packet, CLIENT_COUNTRYINFO_109_COUNTRYNAME_USA);
|
||||
packet_append_string(packet, CLIENT_AUTH_INFO_COUNTRYNAME_USA);
|
||||
client_blocksend_packet(sd, packet);
|
||||
packet_del_ref(packet);
|
||||
|
||||
|
|
|
@ -67,13 +67,13 @@
|
|||
#define CLIENT_EXEINFO_WAR3 "war3.exe 07/19/07 18:41:12 409660"
|
||||
#define CLIENT_CHECKSUM_WAR3 0x1b735294
|
||||
|
||||
#define CLIENT_COUNTRYINFO_109_PROTOCOL 0x00000000
|
||||
#define CLIENT_COUNTRYINFO_109_VERSIONID_D2DV 0x00000009
|
||||
#define CLIENT_COUNTRYINFO_109_GAMELANG "enUS"
|
||||
#define CLIENT_COUNTRYINFO_109_LOCALIP 0x00000000
|
||||
#define CLIENT_COUNTRYINFO_109_LANGID_USENGLISH 0x00000409
|
||||
#define CLIENT_COUNTRYINFO_109_LANGSTR_USENGLISH "ENU"
|
||||
#define CLIENT_COUNTRYINFO_109_COUNTRYNAME_USA "United States"
|
||||
#define CLIENT_AUTH_INFO_PROTOCOL 0x00000000
|
||||
#define CLIENT_AUTH_INFO_VERSIONID_D2DV 0x00000009
|
||||
#define CLIENT_AUTH_INFO_GAMELANG "enUS"
|
||||
#define CLIENT_AUTH_INFO_LOCALIP 0x00000000
|
||||
#define CLIENT_AUTH_INFO_LANGID_USENGLISH 0x00000409
|
||||
#define CLIENT_AUTH_INFO_LANGSTR_USENGLISH "ENU"
|
||||
#define CLIENT_AUTH_INFO_COUNTRYNAME_USA "United States"
|
||||
|
||||
#include "compat/psock.h"
|
||||
|
||||
|
|
|
@ -593,7 +593,7 @@ namespace pvpgn
|
|||
6C 65 27 73 20 52 65 70 75 62 6C 69 63 20 6F 66 le's Republic of
|
||||
20 43 68 69 6E 61 00 China.
|
||||
*/
|
||||
#define CLIENT_COUNTRYINFO_109 0x50ff
|
||||
#define CLIENT_AUTH_INFO 0x50ff
|
||||
typedef struct
|
||||
{
|
||||
t_bnet_header h;
|
||||
|
@ -608,7 +608,7 @@ namespace pvpgn
|
|||
bn_int langid; /* Win32 LangID */
|
||||
/* langstr */
|
||||
/* countryname */
|
||||
} PACKED_ATTR() t_client_countryinfo_109;
|
||||
} PACKED_ATTR() t_client_auth_info;
|
||||
/******************************************************/
|
||||
|
||||
|
||||
|
|
|
@ -333,8 +333,8 @@ namespace pvpgn
|
|||
return "CLIENT_COMPINFO2";
|
||||
case CLIENT_COUNTRYINFO1:
|
||||
return "CLIENT_COUNTRYINFO1";
|
||||
case CLIENT_COUNTRYINFO_109:
|
||||
return "CLIENT_COUNTRYINFO_109";
|
||||
case CLIENT_AUTH_INFO:
|
||||
return "CLIENT_AUTH_INFO";
|
||||
case CLIENT_CREATEACCTREQ1:
|
||||
return "CLIENT_CREATEACCTREQ1";
|
||||
case CLIENT_UNKNOWN_2B:
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace pvpgn
|
|||
t_server_fileinforeply server_fileinforeply;
|
||||
t_client_statsupdate client_statsupdate;
|
||||
t_client_countryinfo1 client_countryinfo1;
|
||||
t_client_countryinfo_109 client_countryinfo_109;
|
||||
t_client_auth_info client_auth_info;
|
||||
t_client_unknown_2b client_unknown_2b;
|
||||
t_client_compinfo1 client_compinfo1;
|
||||
t_client_compinfo2 client_compinfo2;
|
||||
|
|
Loading…
Add table
Reference in a new issue