Debian Codegraph @

src/bnetd/handle_bnet.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 1998 Mark Baysinger ([email protected])
3 * Copyright (C) 1998,1999,2000,2001 Ross Combs ([email protected])
4 * Copyright (C) 1999,2000 Rob Crittenden ([email protected])
5 * Copyright (C) 2000,2001 Marco Ziech ([email protected])
6 * Copyright (C) 2003 Dizzy
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23 #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/
24 #include "handle_bnet.h"cxx . . $ `<file>/src/bnetd/handle_bnet.h`/
25
26 #include <cctype>
27 #include <cerrno>
28 #include <cinttypes>
29 #include <cstdint>
30 #include <cstring>
31 #include <fstream>
32 #include <limits>
33 #include <sstream>
34 #include <tuple>
35
36 #include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/
37 #include "compat/strncasecmp.h"cxx . . $ `<file>/src/compat/strncasecmp.h`/
38 #include "common/packet.h"cxx . . $ `<file>/src/common/packet.h`/
39 #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/
40 #include "common/tag.h"cxx . . $ `<file>/src/common/tag.h`/
41 #include "common/bn_type.h"cxx . . $ `<file>/src/common/bn_type.h`/
42 #include "common/addr.h"cxx . . $ `<file>/src/common/addr.h`/
43 #include "common/bnettime.h"cxx . . $ `<file>/src/common/bnettime.h`/
44 #include "common/trans.h"cxx . . $ `<file>/src/common/trans.h`/
45 #include "common/list.h"cxx . . $ `<file>/src/common/list.h`/
46 #include "common/bnethash.h"cxx . . $ `<file>/src/common/bnethash.h`/
47 #include "common/bnethashconv.h"cxx . . $ `<file>/src/common/bnethashconv.h`/
48 #include "common/proginfo.h"cxx . . $ `<file>/src/common/proginfo.h`/
49 #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/
50 #include "common/bnetsrp3.h"cxx . . $ `<file>/src/common/bnetsrp3.h`/
51 #include "common/xstring.h"cxx . . $ `<file>/src/common/xstring.h`/
52
53 #include "handlers.h"cxx . . $ `<file>/src/bnetd/handlers.h`/
54 #include "connection.h"cxx . . $ `<file>/src/bnetd/connection.h`/
55 #include "prefs.h"cxx . . $ `<file>/src/bnetd/prefs.h`/
56 #include "versioncheck.h"cxx . . $ `<file>/src/bnetd/versioncheck.h`/
57 #include "handle_anongame.h"cxx . . $ `<file>/src/bnetd/handle_anongame.h`/
58 #include "account.h"cxx . . $ `<file>/src/bnetd/account.h`/
59 #include "account_wrap.h"cxx . . $ `<file>/src/bnetd/account_wrap.h`/
60 #include "clan.h"cxx . . $ `<file>/src/bnetd/clan.h`/
61 #include "channel.h"cxx . . $ `<file>/src/bnetd/channel.h`/
62 #include "game.h"cxx . . $ `<file>/src/bnetd/game.h`/
63 #include "game_conv.h"cxx . . $ `<file>/src/bnetd/game_conv.h`/
64 #include "ladder.h"cxx . . $ `<file>/src/bnetd/ladder.h`/
65 #include "watch.h"cxx . . $ `<file>/src/bnetd/watch.h`/
66 #include "realm.h"cxx . . $ `<file>/src/bnetd/realm.h`/
67 #include "adbanner.h"cxx . . $ `<file>/src/bnetd/adbanner.h`/
68 #include "character.h"cxx . . $ `<file>/src/bnetd/character.h`/
69 #include "command.h"cxx . . $ `<file>/src/bnetd/command.h`/
70 #include "tick.h"cxx . . $ `<file>/src/bnetd/tick.h`/
71 #include "message.h"cxx . . $ `<file>/src/bnetd/message.h`/
72 #include "file.h"cxx . . $ `<file>/src/bnetd/file.h`/
73 #include "news.h"cxx . . $ `<file>/src/bnetd/news.h`/
74 #include "team.h"cxx . . $ `<file>/src/bnetd/team.h`/
75 #include "server.h"cxx . . $ `<file>/src/bnetd/server.h`/
76 #include "friends.h"cxx . . $ `<file>/src/bnetd/friends.h`/
77 #include "autoupdate.h"cxx . . $ `<file>/src/bnetd/autoupdate.h`/
78 #include "anongame.h"cxx . . $ `<file>/src/bnetd/anongame.h`/
79 #include "i18n.h"cxx . . $ `<file>/src/bnetd/i18n.h`/
80 #ifdef WIN32_GUI
81 #include <win32/winmain.h>
82 #endif
83 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
84 #ifdef WITH_LUA
85 #include "luainterface.h"
86 #endif
87 namespace pvpgncxx . . $ pvpgn/
88 {
89
90 namespace bnetdcxx . . $ pvpgn/bnetd/
91 {
92
93 extern int last_newscxx . . $ pvpgn/bnetd/last_news.;
94 extern int first_newscxx . . $ pvpgn/bnetd/first_news.;
95
96 /* handlers prototypes */
97 static int _client_unknown_1bcxx . . $ pvpgn/bnetd/_client_unknown_1b(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
98 static int _client_compinfo1cxx . . $ pvpgn/bnetd/_client_compinfo1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
99 static int _client_compinfo2cxx . . $ pvpgn/bnetd/_client_compinfo2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
100 static int _client_countryinfo1cxx . . $ pvpgn/bnetd/_client_countryinfo1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
101 static int _client_auth_infocxx . . $ pvpgn/bnetd/_client_auth_info(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
102 static int _client_unknown2bcxx . . $ pvpgn/bnetd/_client_unknown2b(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
103 static int _client_progidentcxx . . $ pvpgn/bnetd/_client_progident(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
104 static int _client_createaccountw3cxx . . $ pvpgn/bnetd/_client_createaccountw3(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
105 static int _client_createacctreq1cxx . . $ pvpgn/bnetd/_client_createacctreq1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
106 static int _client_createacctreq2cxx . . $ pvpgn/bnetd/_client_createacctreq2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
107 static int _client_changepassreqcxx . . $ pvpgn/bnetd/_client_changepassreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
108 static int _client_echoreplycxx . . $ pvpgn/bnetd/_client_echoreply(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
109 static int _client_authreq1cxx . . $ pvpgn/bnetd/_client_authreq1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
110 static int _client_authreq109cxx . . $ pvpgn/bnetd/_client_authreq109(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
111 static int _client_regsnoopreplycxx . . $ pvpgn/bnetd/_client_regsnoopreply(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
112 static int _client_iconreqcxx . . $ pvpgn/bnetd/_client_iconreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
113 static int _client_cdkeycxx . . $ pvpgn/bnetd/_client_cdkey(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
114 static int _client_cdkey2cxx . . $ pvpgn/bnetd/_client_cdkey2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
115 static int _client_cdkey3cxx . . $ pvpgn/bnetd/_client_cdkey3(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
116 static int _client_udpokcxx . . $ pvpgn/bnetd/_client_udpok(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
117 static int _client_fileinforeqcxx . . $ pvpgn/bnetd/_client_fileinforeq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
118 static int _client_statsreqcxx . . $ pvpgn/bnetd/_client_statsreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
119 static int _client_loginreq1cxx . . $ pvpgn/bnetd/_client_loginreq1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
120 static int _client_loginreq2cxx . . $ pvpgn/bnetd/_client_loginreq2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
121 static int _client_loginreqw3cxx . . $ pvpgn/bnetd/_client_loginreqw3(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
122 static int _client_passchangereqcxx . . $ pvpgn/bnetd/_client_passchangereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
123 static int _client_passchangeproofreqcxx . . $ pvpgn/bnetd/_client_passchangeproofreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
124 static int _client_pingreqcxx . . $ pvpgn/bnetd/_client_pingreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
125 static int _client_logonproofreqcxx . . $ pvpgn/bnetd/_client_logonproofreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
126 static int _client_changegameportcxx . . $ pvpgn/bnetd/_client_changegameport(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
127 static int _client_friendslistreqcxx . . $ pvpgn/bnetd/_client_friendslistreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
128 static int _client_friendinforeqcxx . . $ pvpgn/bnetd/_client_friendinforeq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
129 static int _client_atfriendscreencxx . . $ pvpgn/bnetd/_client_atfriendscreen(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
130 static int _client_atinvitefriendcxx . . $ pvpgn/bnetd/_client_atinvitefriend(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
131 static int _client_atacceptinvitecxx . . $ pvpgn/bnetd/_client_atacceptinvite(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
132 static int _client_atacceptdeclineinvitecxx . . $ pvpgn/bnetd/_client_atacceptdeclineinvite(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
133 static int _client_motdw3cxx . . $ pvpgn/bnetd/_client_motdw3(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
134 static int _client_realmlistreqcxx . . $ pvpgn/bnetd/_client_realmlistreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
135 static int _client_realmlistreq110cxx . . $ pvpgn/bnetd/_client_realmlistreq110(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
136 static int _client_profilereqcxx . . $ pvpgn/bnetd/_client_profilereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
137 static int _client_realmjoinreq109cxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
138 static int _client_unknown39cxx . . $ pvpgn/bnetd/_client_unknown39(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
139 static int _client_charlistreqcxx . . $ pvpgn/bnetd/_client_charlistreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
140 static int _client_adreqcxx . . $ pvpgn/bnetd/_client_adreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
141 static int _client_adackcxx . . $ pvpgn/bnetd/_client_adack(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
142 static int _client_adclickcxx . . $ pvpgn/bnetd/_client_adclick(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
143 static int _client_adclick2cxx . . $ pvpgn/bnetd/_client_adclick2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
144 static int _client_readmemorycxx . . $ pvpgn/bnetd/_client_readmemory(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
145 static int _client_statsupdatecxx . . $ pvpgn/bnetd/_client_statsupdate(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
146 static int _client_playerinforeqcxx . . $ pvpgn/bnetd/_client_playerinforeq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
147 static int _client_progident2cxx . . $ pvpgn/bnetd/_client_progident2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
148 static int _client_joinchannelcxx . . $ pvpgn/bnetd/_client_joinchannel(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
149 static int _client_messagecxx . . $ pvpgn/bnetd/_client_message(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
150 static int _client_gamelistreqcxx . . $ pvpgn/bnetd/_client_gamelistreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
151 static int _client_joingamecxx . . $ pvpgn/bnetd/_client_joingame(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
152 static int _client_startgame1cxx . . $ pvpgn/bnetd/_client_startgame1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
153 static int _client_startgame3cxx . . $ pvpgn/bnetd/_client_startgame3(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
154 static int _client_startgame4cxx . . $ pvpgn/bnetd/_client_startgame4(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
155 static int _client_closegamecxx . . $ pvpgn/bnetd/_client_closegame(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
156 static int _client_gamereportcxx . . $ pvpgn/bnetd/_client_gamereport(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
157 static int _client_leavechannelcxx . . $ pvpgn/bnetd/_client_leavechannel(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
158 static int _client_ladderreqcxx . . $ pvpgn/bnetd/_client_ladderreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
159 static int _client_laddersearchreqcxx . . $ pvpgn/bnetd/_client_laddersearchreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
160 static int _client_mapauthreq1cxx . . $ pvpgn/bnetd/_client_mapauthreq1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
161 static int _client_mapauthreq2cxx . . $ pvpgn/bnetd/_client_mapauthreq2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
162 static int _client_changeclientcxx . . $ pvpgn/bnetd/_client_changeclient(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
163 static int _client_clanmemberlistreqcxx . . $ pvpgn/bnetd/_client_clanmemberlistreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
164 static int _client_clan_motdreqcxx . . $ pvpgn/bnetd/_client_clan_motdreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
165 static int _client_clan_motdchgcxx . . $ pvpgn/bnetd/_client_clan_motdchg(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
166 static int _client_clan_createreqcxx . . $ pvpgn/bnetd/_client_clan_createreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
167 static int _client_clan_createinvitereqcxx . . $ pvpgn/bnetd/_client_clan_createinvitereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
168 static int _client_clan_createinvitereplycxx . . $ pvpgn/bnetd/_client_clan_createinvitereply(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
169 static int _client_clan_disbandreqcxx . . $ pvpgn/bnetd/_client_clan_disbandreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
170 static int _client_clanmember_rankupdatereqcxx . . $ pvpgn/bnetd/_client_clanmember_rankupdatereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
171 static int _client_clanmember_removereqcxx . . $ pvpgn/bnetd/_client_clanmember_removereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
172 static int _client_clan_membernewchiefreqcxx . . $ pvpgn/bnetd/_client_clan_membernewchiefreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
173 static int _client_clan_invitereqcxx . . $ pvpgn/bnetd/_client_clan_invitereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
174 static int _client_clan_invitereplycxx . . $ pvpgn/bnetd/_client_clan_invitereply(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
175 static int _client_crashdumpcxx . . $ pvpgn/bnetd/_client_crashdump(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
176 static int _client_setemailreplycxx . . $ pvpgn/bnetd/_client_setemailreply(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
177 static int _client_changeemailreqcxx . . $ pvpgn/bnetd/_client_changeemailreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
178 static int _client_getpasswordreqcxx . . $ pvpgn/bnetd/_client_getpasswordreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
179 static int _client_claninforeqcxx . . $ pvpgn/bnetd/_client_claninforeq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
180 static int _client_extraworkcxx . . $ pvpgn/bnetd/_client_extrawork(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
181
182 /* connection state connected handler table */
183 static const t_htable_rowcxx . . $ pvpgn/bnetd/t_htable_row# bnet_htable_concxx . . $ pvpgn/bnetd/bnet_htable_con.[] = {
184 { CLIENT_UNKNOWN_1Bcxx . . $ `src/common/bnet_protocol.h:2829:9`!, _client_unknown_1bcxx . . $ pvpgn/bnetd/_client_unknown_1b(8d07eb83d60bed1d). },
185 { CLIENT_COMPINFO1cxx . . $ `src/common/bnet_protocol.h:398:9`!, _client_compinfo1cxx . . $ pvpgn/bnetd/_client_compinfo1(8d07eb83d60bed1d). },
186 { CLIENT_COMPINFO2cxx . . $ `src/common/bnet_protocol.h:432:9`!, _client_compinfo2cxx . . $ pvpgn/bnetd/_client_compinfo2(8d07eb83d60bed1d). },
187 { CLIENT_COUNTRYINFO1cxx . . $ `src/common/bnet_protocol.h:564:9`!, _client_countryinfo1cxx . . $ pvpgn/bnetd/_client_countryinfo1(8d07eb83d60bed1d). },
188 { CLIENT_AUTH_INFOcxx . . $ `src/common/bnet_protocol.h:596:9`!, _client_auth_infocxx . . $ pvpgn/bnetd/_client_auth_info(8d07eb83d60bed1d). },
189 { CLIENT_UNKNOWN_2Bcxx . . $ `src/common/bnet_protocol.h:663:9`!, _client_unknown2bcxx . . $ pvpgn/bnetd/_client_unknown2b(8d07eb83d60bed1d). },
190 { CLIENT_PROGIDENTcxx . . $ `src/common/bnet_protocol.h:700:9`!, _client_progidentcxx . . $ pvpgn/bnetd/_client_progident(8d07eb83d60bed1d). },
191 { CLIENT_CLOSEGAMEcxx . . $ `src/common/bnet_protocol.h:3059:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! },
192 { CLIENT_CREATEACCOUNT_W3cxx . . $ `src/common/bnet_protocol.h:1761:9`!, _client_createaccountw3cxx . . $ pvpgn/bnetd/_client_createaccountw3(8d07eb83d60bed1d). },
193 { CLIENT_CREATEACCTREQ1cxx . . $ `src/common/bnet_protocol.h:620:9`!, _client_createacctreq1cxx . . $ pvpgn/bnetd/_client_createacctreq1(8d07eb83d60bed1d). },
194 { CLIENT_CREATEACCTREQ2cxx . . $ `src/common/bnet_protocol.h:1843:9`!, _client_createacctreq2cxx . . $ pvpgn/bnetd/_client_createacctreq2(8d07eb83d60bed1d). },
195 { CLIENT_CHANGEPASSREQcxx . . $ `src/common/bnet_protocol.h:2138:9`!, _client_changepassreqcxx . . $ pvpgn/bnetd/_client_changepassreq(8d07eb83d60bed1d). },
196 { CLIENT_ECHOREPLYcxx . . $ `src/common/bnet_protocol.h:3434:9`!, _client_echoreplycxx . . $ pvpgn/bnetd/_client_echoreply(8d07eb83d60bed1d). },
197 { CLIENT_AUTHREQ1cxx . . $ `src/common/bnet_protocol.h:841:9`!, _client_authreq1cxx . . $ pvpgn/bnetd/_client_authreq1(8d07eb83d60bed1d). },
198 { CLIENT_AUTHREQ_109cxx . . $ `src/common/bnet_protocol.h:907:9`!, _client_authreq109cxx . . $ pvpgn/bnetd/_client_authreq109(8d07eb83d60bed1d). },
199 { CLIENT_REGSNOOPREPLYcxx . . $ `src/common/bnet_protocol.h:981:9`!, _client_regsnoopreplycxx . . $ pvpgn/bnetd/_client_regsnoopreply(8d07eb83d60bed1d). },
200 { CLIENT_ICONREQcxx . . $ `src/common/bnet_protocol.h:995:9`!, _client_iconreqcxx . . $ pvpgn/bnetd/_client_iconreq(8d07eb83d60bed1d). },
201 { CLIENT_CDKEYcxx . . $ `src/common/bnet_protocol.h:1057:9`!, _client_cdkeycxx . . $ pvpgn/bnetd/_client_cdkey(8d07eb83d60bed1d). },
202 { CLIENT_CDKEY2cxx . . $ `src/common/bnet_protocol.h:1112:9`!, _client_cdkey2cxx . . $ pvpgn/bnetd/_client_cdkey2(8d07eb83d60bed1d). },
203 { CLIENT_CDKEY3cxx . . $ `src/common/bnet_protocol.h:1151:9`!, _client_cdkey3cxx . . $ pvpgn/bnetd/_client_cdkey3(8d07eb83d60bed1d). },
204 { CLIENT_UDPOKcxx . . $ `src/common/bnet_protocol.h:1899:9`!, _client_udpokcxx . . $ pvpgn/bnetd/_client_udpok(8d07eb83d60bed1d). },
205 { CLIENT_FILEINFOREQcxx . . $ `src/common/bnet_protocol.h:1917:9`!, _client_fileinforeqcxx . . $ pvpgn/bnetd/_client_fileinforeq(8d07eb83d60bed1d). },
206 { CLIENT_STATSREQcxx . . $ `src/common/bnet_protocol.h:2023:9`!, _client_statsreqcxx . . $ pvpgn/bnetd/_client_statsreq(8d07eb83d60bed1d). },
207 { CLIENT_PINGREQcxx . . $ `src/common/bnet_protocol.h:3477:9`!, _client_pingreqcxx . . $ pvpgn/bnetd/_client_pingreq(8d07eb83d60bed1d). },
208 { CLIENT_LOGINREQ1cxx . . $ `src/common/bnet_protocol.h:2096:9`!, _client_loginreq1cxx . . $ pvpgn/bnetd/_client_loginreq1(8d07eb83d60bed1d). },
209 { CLIENT_LOGINREQ2cxx . . $ `src/common/bnet_protocol.h:1549:9`!, _client_loginreq2cxx . . $ pvpgn/bnetd/_client_loginreq2(8d07eb83d60bed1d). },
210 { CLIENT_LOGINREQ_W3cxx . . $ `src/common/bnet_protocol.h:1629:9`!, _client_loginreqw3cxx . . $ pvpgn/bnetd/_client_loginreqw3(8d07eb83d60bed1d). },
211 { CLIENT_PASSCHANGEREQcxx . . $ `src/common/bnet_protocol.h:1710:9`!, _client_passchangereqcxx . . $ pvpgn/bnetd/_client_passchangereq(8d07eb83d60bed1d). },
212 { CLIENT_PASSCHANGEPROOFREQcxx . . $ `src/common/bnet_protocol.h:1731:9`!, _client_passchangeproofreqcxx . . $ pvpgn/bnetd/_client_passchangeproofreq(8d07eb83d60bed1d). },
213 { CLIENT_LOGONPROOFREQcxx . . $ `src/common/bnet_protocol.h:1689:9`!, _client_logonproofreqcxx . . $ pvpgn/bnetd/_client_logonproofreq(8d07eb83d60bed1d). },
214 { CLIENT_CHANGECLIENTcxx . . $ `src/common/bnet_protocol.h:3627:9`!, _client_changeclientcxx . . $ pvpgn/bnetd/_client_changeclient(8d07eb83d60bed1d). },
215 { CLIENT_GETPASSWORDREQcxx . . $ `src/common/bnet_protocol.h:3649:9`!, _client_getpasswordreqcxx . . $ pvpgn/bnetd/_client_getpasswordreq(8d07eb83d60bed1d). },
216 { CLIENT_CHANGEEMAILREQcxx . . $ `src/common/bnet_protocol.h:3657:9`!, _client_changeemailreqcxx . . $ pvpgn/bnetd/_client_changeemailreq(8d07eb83d60bed1d). },
217 { CLIENT_CRASHDUMPcxx . . $ `src/common/bnet_protocol.h:3678:9`!, _client_crashdumpcxx . . $ pvpgn/bnetd/_client_crashdump(8d07eb83d60bed1d). },
218 { -1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! }
219 };
220
221 /* connection state loggedin handlers */
222 static const t_htable_rowcxx . . $ pvpgn/bnetd/t_htable_row# bnet_htable_logcxx . . $ pvpgn/bnetd/bnet_htable_log.[] = {
223 { CLIENT_CHANGEGAMEPORTcxx . . $ `src/common/bnet_protocol.h:1780:9`!, _client_changegameportcxx . . $ pvpgn/bnetd/_client_changegameport(8d07eb83d60bed1d). },
224 { CLIENT_FRIENDSLISTREQcxx . . $ `src/common/anongame_protocol.h:581:9`!, _client_friendslistreqcxx . . $ pvpgn/bnetd/_client_friendslistreq(8d07eb83d60bed1d). },
225 { CLIENT_FRIENDINFOREQcxx . . $ `src/common/anongame_protocol.h:613:9`!, _client_friendinforeqcxx . . $ pvpgn/bnetd/_client_friendinforeq(8d07eb83d60bed1d). },
226 { CLIENT_ARRANGEDTEAM_FRIENDSCREENcxx . . $ `src/common/anongame_protocol.h:475:9`!, _client_atfriendscreencxx . . $ pvpgn/bnetd/_client_atfriendscreen(8d07eb83d60bed1d). },
227 { CLIENT_ARRANGEDTEAM_INVITE_FRIENDcxx . . $ `src/common/anongame_protocol.h:497:9`!, _client_atinvitefriendcxx . . $ pvpgn/bnetd/_client_atinvitefriend(8d07eb83d60bed1d). },
228 { CLIENT_ARRANGEDTEAM_ACCEPT_INVITEcxx . . $ `src/common/bnet_protocol.h:3706:9`!, _client_atacceptinvitecxx . . $ pvpgn/bnetd/_client_atacceptinvite(8d07eb83d60bed1d). },
229 { CLIENT_ARRANGEDTEAM_ACCEPT_DECLINE_INVITEcxx . . $ `src/common/anongame_protocol.h:535:9`!, _client_atacceptdeclineinvitecxx . . $ pvpgn/bnetd/_client_atacceptdeclineinvite(8d07eb83d60bed1d). },
230 /* anongame packet (44ff) handled in handle_anongame.c */
231 { CLIENT_FINDANONGAMEcxx . . $ `src/common/anongame_protocol.h:35:9`!, handle_anongame_packetcxx . . $ pvpgn/bnetd/handle_anongame_packet(8d07eb83d60bed1d). },
232 { CLIENT_FILEINFOREQcxx . . $ `src/common/bnet_protocol.h:1917:9`!, _client_fileinforeqcxx . . $ pvpgn/bnetd/_client_fileinforeq(8d07eb83d60bed1d). },
233 { CLIENT_MOTD_W3cxx . . $ `src/common/bnet_protocol.h:1566:9`!, _client_motdw3cxx . . $ pvpgn/bnetd/_client_motdw3(8d07eb83d60bed1d). },
234 { CLIENT_REALMLISTREQcxx . . $ `src/common/bnet_protocol.h:1197:9`!, _client_realmlistreqcxx . . $ pvpgn/bnetd/_client_realmlistreq(8d07eb83d60bed1d). },
235 { CLIENT_REALMLISTREQ_110cxx . . $ `src/common/bnet_protocol.h:1212:9`!, _client_realmlistreq110cxx . . $ pvpgn/bnetd/_client_realmlistreq110(8d07eb83d60bed1d). },
236 { CLIENT_PROFILEREQcxx . . $ `src/common/bnet_protocol.h:1310:9`!, _client_profilereqcxx . . $ pvpgn/bnetd/_client_profilereq(8d07eb83d60bed1d). },
237 { CLIENT_REALMJOINREQ_109cxx . . $ `src/common/bnet_protocol.h:3584:9`!, _client_realmjoinreq109cxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d). },
238 { CLIENT_UNKNOWN_37cxx . . $ `src/common/bnet_protocol.h:1330:9`!, _client_charlistreqcxx . . $ pvpgn/bnetd/_client_charlistreq(8d07eb83d60bed1d). },
239 { CLIENT_UNKNOWN_39cxx . . $ `src/common/bnet_protocol.h:1530:9`!, _client_unknown39cxx . . $ pvpgn/bnetd/_client_unknown39(8d07eb83d60bed1d). },
240 { CLIENT_ECHOREPLYcxx . . $ `src/common/bnet_protocol.h:3434:9`!, _client_echoreplycxx . . $ pvpgn/bnetd/_client_echoreply(8d07eb83d60bed1d). },
241 { CLIENT_PINGREQcxx . . $ `src/common/bnet_protocol.h:3477:9`!, _client_pingreqcxx . . $ pvpgn/bnetd/_client_pingreq(8d07eb83d60bed1d). },
242 { CLIENT_ADREQcxx . . $ `src/common/bnet_protocol.h:3157:9`!, _client_adreqcxx . . $ pvpgn/bnetd/_client_adreq(8d07eb83d60bed1d). },
243 { CLIENT_ADACKcxx . . $ `src/common/bnet_protocol.h:3203:9`!, _client_adackcxx . . $ pvpgn/bnetd/_client_adack(8d07eb83d60bed1d). },
244 { CLIENT_ADCLICKcxx . . $ `src/common/bnet_protocol.h:3233:9`!, _client_adclickcxx . . $ pvpgn/bnetd/_client_adclick(8d07eb83d60bed1d). },
245 { CLIENT_ADCLICK2cxx . . $ `src/common/bnet_protocol.h:3248:9`!, _client_adclick2cxx . . $ pvpgn/bnetd/_client_adclick2(8d07eb83d60bed1d). },
246 { CLIENT_READMEMORYcxx . . $ `src/common/bnet_protocol.h:3277:9`!, _client_readmemorycxx . . $ pvpgn/bnetd/_client_readmemory(8d07eb83d60bed1d). },
247 { CLIENT_STATSREQcxx . . $ `src/common/bnet_protocol.h:2023:9`!, _client_statsreqcxx . . $ pvpgn/bnetd/_client_statsreq(8d07eb83d60bed1d). },
248 { CLIENT_STATSUPDATEcxx . . $ `src/common/bnet_protocol.h:3572:9`!, _client_statsupdatecxx . . $ pvpgn/bnetd/_client_statsupdate(8d07eb83d60bed1d). },
249 { CLIENT_PLAYERINFOREQcxx . . $ `src/common/bnet_protocol.h:2182:9`!, _client_playerinforeqcxx . . $ pvpgn/bnetd/_client_playerinforeq(8d07eb83d60bed1d). },
250 { CLIENT_PROGIDENT2cxx . . $ `src/common/bnet_protocol.h:2298:9`!, _client_progident2cxx . . $ pvpgn/bnetd/_client_progident2(8d07eb83d60bed1d). },
251 { CLIENT_JOINCHANNELcxx . . $ `src/common/bnet_protocol.h:2308:9`!, _client_joinchannelcxx . . $ pvpgn/bnetd/_client_joinchannel(8d07eb83d60bed1d). },
252 { CLIENT_MESSAGEcxx . . $ `src/common/bnet_protocol.h:2620:9`!, _client_messagecxx . . $ pvpgn/bnetd/_client_message(8d07eb83d60bed1d). },
253 { CLIENT_GAMELISTREQcxx . . $ `src/common/bnet_protocol.h:2638:9`!, _client_gamelistreqcxx . . $ pvpgn/bnetd/_client_gamelistreq(8d07eb83d60bed1d). },
254 { CLIENT_JOIN_GAMEcxx . . $ `src/common/bnet_protocol.h:3548:9`!, _client_joingamecxx . . $ pvpgn/bnetd/_client_joingame(8d07eb83d60bed1d). },
255 { CLIENT_STARTGAME1cxx . . $ `src/common/bnet_protocol.h:2801:9`!, _client_startgame1cxx . . $ pvpgn/bnetd/_client_startgame1(8d07eb83d60bed1d). },
256 { CLIENT_STARTGAME3cxx . . $ `src/common/bnet_protocol.h:2854:9`!, _client_startgame3cxx . . $ pvpgn/bnetd/_client_startgame3(8d07eb83d60bed1d). },
257 { CLIENT_STARTGAME4cxx . . $ `src/common/bnet_protocol.h:2919:9`!, _client_startgame4cxx . . $ pvpgn/bnetd/_client_startgame4(8d07eb83d60bed1d). },
258 { CLIENT_CLOSEGAMEcxx . . $ `src/common/bnet_protocol.h:3059:9`!, _client_closegamecxx . . $ pvpgn/bnetd/_client_closegame(8d07eb83d60bed1d). },
259 { CLIENT_CLOSEGAME2cxx . . $ `src/common/bnet_protocol.h:3060:9`!, _client_closegamecxx . . $ pvpgn/bnetd/_client_closegame(8d07eb83d60bed1d). },
260 { CLIENT_GAME_REPORTcxx . . $ `src/common/bnet_protocol.h:3517:9`!, _client_gamereportcxx . . $ pvpgn/bnetd/_client_gamereport(8d07eb83d60bed1d). },
261 { CLIENT_LEAVECHANNELcxx . . $ `src/common/bnet_protocol.h:3069:9`!, _client_leavechannelcxx . . $ pvpgn/bnetd/_client_leavechannel(8d07eb83d60bed1d). },
262 { CLIENT_LADDERREQcxx . . $ `src/common/bnet_protocol.h:3313:9`!, _client_ladderreqcxx . . $ pvpgn/bnetd/_client_ladderreq(8d07eb83d60bed1d). },
263 { CLIENT_LADDERSEARCHREQcxx . . $ `src/common/bnet_protocol.h:1022:9`!, _client_laddersearchreqcxx . . $ pvpgn/bnetd/_client_laddersearchreq(8d07eb83d60bed1d). },
264 { CLIENT_MAPAUTHREQ1cxx . . $ `src/common/bnet_protocol.h:3091:9`!, _client_mapauthreq1cxx . . $ pvpgn/bnetd/_client_mapauthreq1(8d07eb83d60bed1d). },
265 { CLIENT_MAPAUTHREQ2cxx . . $ `src/common/bnet_protocol.h:3125:9`!, _client_mapauthreq2cxx . . $ pvpgn/bnetd/_client_mapauthreq2(8d07eb83d60bed1d). },
266 { CLIENT_CLAN_DISBANDREQcxx . . $ `src/common/bnet_protocol.h:3835:9`!, _client_clan_disbandreqcxx . . $ pvpgn/bnetd/_client_clan_disbandreq(8d07eb83d60bed1d). },
267 { CLIENT_CLANMEMBERLIST_REQcxx . . $ `src/common/bnet_protocol.h:4047:9`!, _client_clanmemberlistreqcxx . . $ pvpgn/bnetd/_client_clanmemberlistreq(8d07eb83d60bed1d). },
268 { CLIENT_CLAN_MOTDCHGcxx . . $ `src/common/bnet_protocol.h:3982:9`!, _client_clan_motdchgcxx . . $ pvpgn/bnetd/_client_clan_motdchg(8d07eb83d60bed1d). },
269 { CLIENT_CLAN_MOTDREQcxx . . $ `src/common/bnet_protocol.h:3998:9`!, _client_clan_motdreqcxx . . $ pvpgn/bnetd/_client_clan_motdreq(8d07eb83d60bed1d). },
270 { CLIENT_CLAN_CREATEREQcxx . . $ `src/common/bnet_protocol.h:3755:9`!, _client_clan_createreqcxx . . $ pvpgn/bnetd/_client_clan_createreq(8d07eb83d60bed1d). },
271 { CLIENT_CLAN_CREATEINVITEREQcxx . . $ `src/common/bnet_protocol.h:3786:9`!, _client_clan_createinvitereqcxx . . $ pvpgn/bnetd/_client_clan_createinvitereq(8d07eb83d60bed1d). },
272 { CLIENT_CLAN_CREATEINVITEREPLYcxx . . $ `src/common/bnet_protocol.h:3823:9`!, _client_clan_createinvitereplycxx . . $ pvpgn/bnetd/_client_clan_createinvitereply(8d07eb83d60bed1d). },
273 { CLIENT_CLANMEMBER_RANKUPDATE_REQcxx . . $ `src/common/bnet_protocol.h:3965:9`!, _client_clanmember_rankupdatereqcxx . . $ pvpgn/bnetd/_client_clanmember_rankupdatereq(8d07eb83d60bed1d). },
274 { CLIENT_CLANMEMBER_REMOVE_REQcxx . . $ `src/common/bnet_protocol.h:3899:9`!, _client_clanmember_removereqcxx . . $ pvpgn/bnetd/_client_clanmember_removereq(8d07eb83d60bed1d). },
275 { CLIENT_CLAN_MEMBERNEWCHIEFREQcxx . . $ `src/common/bnet_protocol.h:3851:9`!, _client_clan_membernewchiefreqcxx . . $ pvpgn/bnetd/_client_clan_membernewchiefreq(8d07eb83d60bed1d). },
276 { CLIENT_CLAN_INVITEREQcxx . . $ `src/common/bnet_protocol.h:3885:9`!, _client_clan_invitereqcxx . . $ pvpgn/bnetd/_client_clan_invitereq(8d07eb83d60bed1d). },
277 { CLIENT_CLAN_INVITEREPLYcxx . . $ `src/common/bnet_protocol.h:3924:9`!, _client_clan_invitereplycxx . . $ pvpgn/bnetd/_client_clan_invitereply(8d07eb83d60bed1d). },
278 { CLIENT_CRASHDUMPcxx . . $ `src/common/bnet_protocol.h:3678:9`!, _client_crashdumpcxx . . $ pvpgn/bnetd/_client_crashdump(8d07eb83d60bed1d). },
279 { CLIENT_SETEMAILREPLYcxx . . $ `src/common/bnet_protocol.h:3634:9`!, _client_setemailreplycxx . . $ pvpgn/bnetd/_client_setemailreply(8d07eb83d60bed1d). },
280 { CLIENT_CLANINFOREQcxx . . $ `src/common/bnet_protocol.h:3686:9`!, _client_claninforeqcxx . . $ pvpgn/bnetd/_client_claninforeq(8d07eb83d60bed1d). },
281 { CLIENT_EXTRAWORKcxx . . $ `src/common/bnet_protocol.h:4089:9`!, _client_extraworkcxx . . $ pvpgn/bnetd/_client_extrawork(8d07eb83d60bed1d). },
282 { CLIENT_NULLcxx . . $ `src/common/bnet_protocol.h:73:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! },
283 { -1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! }
284 };
285
286 /* main handler function */
287 static int handlecxx . . $ pvpgn/bnetd/handle(fdbc71668e0e6037).(const t_htable_rowcxx . . $ pvpgn/bnetd/t_htable_row# * htable, int type, t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet);
288
289 extern int handle_bnet_packetcxx . . $ pvpgn/bnetd/handle_bnet_packet(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
290 {
291 if (!c) {
292 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got NULL connection", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
293 return -1;
294 }
295 if (!packet) {
296 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got NULL packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
297 return -1;
298 }
299 if (packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet) != packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.) {
300 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad packet (class {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), (int)packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet));
301 return -1;
302 }
303
304 switch (conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(c)) {
305 case conn_state_connected:
306 switch (handlecxx . . $ pvpgn/bnetd/handle(fdbc71668e0e6037).(bnet_htable_concxx . . $ pvpgn/bnetd/bnet_htable_con., packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet), c, packet)) {
307 case 1:
308 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] unknown (unlogged in) bnet packet type 0x{:04x}, len {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
309 break;
310 case -1:
311 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] (unlogged in) got error handling packet type 0x{:04x}, len {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
312 break;
313 };
314 break;
315
316 case conn_state_loggedin:
317 switch (handlecxx . . $ pvpgn/bnetd/handle(fdbc71668e0e6037).(bnet_htable_logcxx . . $ pvpgn/bnetd/bnet_htable_log., packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet), c, packet)) {
318 case 1:
319 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] unknown (logged in) bnet packet type 0x{:04x}, len {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
320 break;
321 case -1:
322 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] (logged in) got error handling packet type 0x{:04x}, len {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
323 break;
324 };
325 break;
326
327 case conn_state_untrusted:
328 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] unknown (untrusted) bnet packet type 0x{:04x}, len {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
329 break;
330
331 default:
332 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] invalid login state {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(c));
333 };
334
335 return 0;
336 }
337
338 static int handlecxx . . $ pvpgn/bnetd/handle(fdbc71668e0e6037).(const t_htable_rowcxx . . $ pvpgn/bnetd/t_htable_row# * htable, int type, t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
339 {
340 t_htable_rowcxx . . $ pvpgn/bnetd/t_htable_row# const *p;
341 int res = 1;
342
343 for (p = htable; p->typecxx . . $ pvpgn/bnetd/$anonymous_type_ed793abcf04a1eb7_0#type. != -1; p++)
344 if (p->typecxx . . $ pvpgn/bnetd/$anonymous_type_ed793abcf04a1eb7_0#type. == type) {
345 res = 0;
346 if (p->handlercxx . . $ pvpgn/bnetd/$anonymous_type_ed793abcf04a1eb7_0#handler. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
347 res = p->handlercxx . . $ pvpgn/bnetd/$anonymous_type_ed793abcf04a1eb7_0#handler.(c, packet);
348 if (res != 2)
349 break; /* return 2 means we want to continue parsing */
350 }
351
352 return res;
353 }
354
355 /* handlers for bnet packets */
356 static int _client_unknown_1bcxx . . $ pvpgn/bnetd/_client_unknown_1b(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
357 {
358 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_unknown_1bcxx . . $ pvpgn/t_client_unknown_1b#)) {
359 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad UNKNOWN_1B packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_unknown_1bcxx . . $ pvpgn/t_client_unknown_1b#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
360 return -1;
361 }
362
363 {
364 unsigned int newip;
365 unsigned short newport;
366
367 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] UNKNOWN_1B unknown1=0x{:04hx}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), bn_short_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_unknown_1bcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_unknown_1b..unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_104#unknown1.));
368 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] UNKNOWN_1B unknown2=0x{:08x}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_unknown_1bcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_unknown_1b..unknown2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_104#unknown2.));
369 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] UNKNOWN_1B unknown3=0x{:08x}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_unknown_1bcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_unknown_1b..unknown3cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_104#unknown3.));
370
371 newip = bn_int_nget(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_unknown_1bcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_unknown_1b..ipcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_104#ip.);
372 newport = bn_short_nget(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_unknown_1bcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_unknown_1b..portcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_104#port.);
373
374 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] UNKNOWN_1B set new UDP address to {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), addr_num_to_addr_strcxx . . $ pvpgn/addr_num_to_addr_str(9313bf3c546cb16).(newip, newport));
375 conn_set_game_addrcxx . . $ pvpgn/bnetd/conn_set_game_addr(c14bb6458e7562a).(c, newip);
376 conn_set_game_portcxx . . $ pvpgn/bnetd/conn_set_game_port(45a47db2bc2ee415).(c, newport);
377 }
378 return 0;
379 }
380
381 static int _client_compinfo1cxx . . $ pvpgn/bnetd/_client_compinfo1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
382 {
383 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
384
385 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_compinfo1cxx . . $ pvpgn/t_client_compinfo1#)) {
386 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad COMPINFO1 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_compinfo1cxx . . $ pvpgn/t_client_compinfo1#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
387 return -1;
388 }
389
390 {
391 char const *host;
392 char const *user;
393
394 if (!(host = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_compinfo1cxx . . $ pvpgn/t_client_compinfo1#), MAX_WINHOST_STRcxx . . $ MAX_WINHOST_STR.))) {
395 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad COMPINFO1 packet (missing or too long host)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
396 return -1;
397 }
398 if (!(user = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_compinfo1cxx . . $ pvpgn/t_client_compinfo1#)+stdcxx . . $ std/::strlen(host) + 1, MAX_WINUSER_STRcxx . . $ MAX_WINUSER_STR.))) {
399 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad COMPINFO1 packet (missing or too long user)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
400 return -1;
401 }
402
403 conn_set_hostcxx . . $ pvpgn/bnetd/conn_set_host(c8fb97a9af134824).(c, host);
404 conn_set_usercxx . . $ pvpgn/bnetd/conn_set_user(c8fb97a9af134824).(c, user);
405 }
406
407 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
408 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_compreplycxx . . $ pvpgn/t_server_compreply#));
409 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_COMPREPLYcxx . . $ `src/common/bnet_protocol.h:469:9`!);
410 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_compreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_compreply..reg_versioncxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_26#reg_version., SERVER_COMPREPLY_REG_VERSIONcxx . . $ `src/common/bnet_protocol.h:478:9`!);
411 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_compreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_compreply..reg_authcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_26#reg_auth., SERVER_COMPREPLY_REG_AUTHcxx . . $ `src/common/bnet_protocol.h:479:9`!);
412 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_compreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_compreply..client_idcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_26#client_id., SERVER_COMPREPLY_CLIENT_IDcxx . . $ `src/common/bnet_protocol.h:480:9`!);
413 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_compreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_compreply..client_tokencxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_26#client_token., SERVER_COMPREPLY_CLIENT_TOKENcxx . . $ `src/common/bnet_protocol.h:481:9`!);
414 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
415 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
416 }
417 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
418 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_sessionkey1cxx . . $ pvpgn/t_server_sessionkey1#));
419 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_SESSIONKEY1cxx . . $ `src/common/bnet_protocol.h:490:9`!);
420 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_sessionkey1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_sessionkey1..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_27#sessionkey., conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(c));
421 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
422 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
423 }
424 return 0;
425 }
426
427 static int _client_compinfo2cxx . . $ pvpgn/bnetd/_client_compinfo2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
428 {
429 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
430
431 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_compinfo2cxx . . $ pvpgn/t_client_compinfo2#)) {
432 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad COMPINFO2 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_compinfo2cxx . . $ pvpgn/t_client_compinfo2#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
433 return -1;
434 }
435
436 {
437 char const *host;
438 char const *user;
439
440 if (!(host = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_compinfo2cxx . . $ pvpgn/t_client_compinfo2#), MAX_WINHOST_STRcxx . . $ MAX_WINHOST_STR.))) {
441 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad COMPINFO2 packet (missing or too long host)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
442 return -1;
443 }
444 if (!(user = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_compinfo2cxx . . $ pvpgn/t_client_compinfo2#)+stdcxx . . $ std/::strlen(host) + 1, MAX_WINUSER_STRcxx . . $ MAX_WINUSER_STR.))) {
445 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad COMPINFO2 packet (missing or too long user)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
446 return -1;
447 }
448
449 conn_set_hostcxx . . $ pvpgn/bnetd/conn_set_host(c8fb97a9af134824).(c, host);
450 conn_set_usercxx . . $ pvpgn/bnetd/conn_set_user(c8fb97a9af134824).(c, user);
451 }
452
453 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
454 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_compreplycxx . . $ pvpgn/t_server_compreply#));
455 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_COMPREPLYcxx . . $ `src/common/bnet_protocol.h:469:9`!);
456 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_compreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_compreply..reg_versioncxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_26#reg_version., SERVER_COMPREPLY_REG_VERSIONcxx . . $ `src/common/bnet_protocol.h:478:9`!);
457 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_compreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_compreply..reg_authcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_26#reg_auth., SERVER_COMPREPLY_REG_AUTHcxx . . $ `src/common/bnet_protocol.h:479:9`!);
458 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_compreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_compreply..client_idcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_26#client_id., SERVER_COMPREPLY_CLIENT_IDcxx . . $ `src/common/bnet_protocol.h:480:9`!);
459 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_compreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_compreply..client_tokencxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_26#client_token., SERVER_COMPREPLY_CLIENT_TOKENcxx . . $ `src/common/bnet_protocol.h:481:9`!);
460 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
461 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
462 }
463
464 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
465 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_sessionkey2cxx . . $ pvpgn/t_server_sessionkey2#));
466 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_SESSIONKEY2cxx . . $ `src/common/bnet_protocol.h:513:9`!);
467 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_sessionkey2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_sessionkey2..sessionnumcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_28#sessionnum., conn_get_sessionnumcxx . . $ pvpgn/bnetd/conn_get_sessionnum(8bd2285a65940781).(c));
468 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_sessionkey2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_sessionkey2..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_28#sessionkey., conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(c));
469 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
470 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
471 }
472
473 return 0;
474 }
475
476 static int _client_countryinfo1cxx . . $ pvpgn/bnetd/_client_countryinfo1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
477 {
478 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_countryinfo1cxx . . $ pvpgn/t_client_countryinfo1#)) {
479 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad COUNTRYINFO1 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_countryinfo1cxx . . $ pvpgn/t_client_countryinfo1#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
480 return -1;
481 }
482 {
483 char const *langstr;
484 char const *countrycode;
485 char const *country;
486 unsigned int tzbias;
487
488 if (!(langstr = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_countryinfo1cxx . . $ pvpgn/t_client_countryinfo1#), MAX_LANG_STRcxx . . $ MAX_LANG_STR.))) {
489 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad COUNTRYINFO1 packet (missing or too long langstr)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
490 return -1;
491 }
492
493 if (!(countrycode = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_countryinfo1cxx . . $ pvpgn/t_client_countryinfo1#)+stdcxx . . $ std/::strlen(langstr) + 1, MAX_COUNTRYCODE_STRcxx . . $ MAX_COUNTRYCODE_STR.))) {
494 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad COUNTRYINFO1 packet (missing or too long countrycode)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
495 return -1;
496 }
497
498 if (!(country = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_countryinfo1cxx . . $ pvpgn/t_client_countryinfo1#)+stdcxx . . $ std/::strlen(langstr) + 1 + stdcxx . . $ std/::strlen(countrycode) + 1, MAX_COUNTRY_STRcxx . . $ MAX_COUNTRY_STR.))) {
499 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad COUNTRYINFO1 packet (missing or too long country)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
500 return -1;
501 }
502
503 if (!(packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_countryinfo1cxx . . $ pvpgn/t_client_countryinfo1#)+stdcxx . . $ std/::strlen(langstr) + 1 + stdcxx . . $ std/::strlen(countrycode) + 1 + stdcxx . . $ std/::strlen(country) + 1, MAX_COUNTRYNAME_STRcxx . . $ MAX_COUNTRYNAME_STR.))) {
504 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad COUNTRYINFO1 packet (missing or too long countryname)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
505 return -1;
506 }
507
508 tzbias = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_countryinfo1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_countryinfo1..biascxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_29#bias.);
509 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] COUNTRYINFO1 packet from tzbias=0x{:04x} langstr={} countrycode={} country={}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), tzbias, langstr, countrycode, country);
510 conn_set_countrycxx . . $ pvpgn/bnetd/conn_set_country(c8fb97a9af134824).(c, country);
511 conn_set_tzbiascxx . . $ pvpgn/bnetd/conn_set_tzbias(5b9d37d9dd0897d2).(c, uint32_to_int(tzbias));
512 }
513 return 0;
514 }
515
516 static int _client_auth_infocxx . . $ pvpgn/bnetd/_client_auth_info(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
517 {
518 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
519
520 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_auth_infocxx . . $ pvpgn/t_client_auth_info#)) {
521 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad AUTH_INFO packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_auth_infocxx . . $ pvpgn/t_client_auth_info#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
522 return -1;
523 }
524
525 {
526 char const *langstr;
527 char const *countryname;
528 unsigned int tzbias;
529 char archtag_str[5];
530 char clienttag_str[5];
531 char gamelang_str[5];
532
533 if (!(langstr = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_auth_infocxx . . $ pvpgn/t_client_auth_info#), MAX_LANG_STRcxx . . $ MAX_LANG_STR.))) {
534 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad AUTH_INFO packet (missing or too long langstr)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
535 return -1;
536 }
537
538 if (!(countryname = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_auth_infocxx . . $ pvpgn/t_client_auth_info#)+stdcxx . . $ std/::strlen(langstr) + 1, MAX_COUNTRYNAME_STRcxx . . $ MAX_COUNTRYNAME_STR.))) {
539 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad AUTH_INFO packet (missing or too long countryname)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
540 return -1;
541 }
542
543 /* check if it's an allowed client type */
544 if (tag_check_in_list(bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#clienttag.), prefs_get_allowed_clientscxx . . $ pvpgn/bnetd/prefs_get_allowed_clients(33a1f659e94feb42).())) {
545 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(c, conn_state_destroy);
546 return 0;
547 }
548
549 tzbias = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..biascxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#bias.);
550
551 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] AUTH_INFO packet {{ protocol={:#02x}, platform={}, product={}, versionid={:#02x}, language={}, localip={:#04x}, tzbias={:04x}, locale={}, language={}, country={}.{} }}",
552 conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c),
553 bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..protocolcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#protocol.),
554 tag_uint_to_str(archtag_str, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..archtagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#archtag.)),
555 tag_uint_to_str(clienttag_str, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#clienttag.)),
556 bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..versionidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#versionid.),
557 tag_uint_to_str(gamelang_str, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..gamelangcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#gamelang.)),
558 bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..localipcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#localip.),
559 tzbias,
560 bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..lcidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#lcid.),
561 bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..langidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#langid.),
562 langstr,
563 countryname);
564
565 conn_set_countrycxx . . $ pvpgn/bnetd/conn_set_country(c8fb97a9af134824).(c, langstr); /* FIXME: This isn't right. We want USA not ENU (English-US) */
566 conn_set_tzbiascxx . . $ pvpgn/bnetd/conn_set_tzbias(5b9d37d9dd0897d2).(c, uint32_to_int(tzbias));
567 conn_set_versionidcxx . . $ pvpgn/bnetd/conn_set_versionid(31721b9a6fcb2436).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..versionidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#versionid.));
568 conn_set_archtagcxx . . $ pvpgn/bnetd/conn_set_archtag(d97ad1b62a895b69).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..archtagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#archtag.));
569 conn_set_clienttagcxx . . $ pvpgn/bnetd/conn_set_clienttag(d97ad1b62a895b69).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#clienttag.));
570 conn_set_gamelangcxx . . $ pvpgn/bnetd/conn_set_gamelang(d97ad1b62a895b69).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..gamelangcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#gamelang.));
571
572 /* First, send an ECHO_REQ */
573
574 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
575 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_echoreqcxx . . $ pvpgn/t_server_echoreq#));
576 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_ECHOREQcxx . . $ `src/common/bnet_protocol.h:3444:9`!);
577 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_echoreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_echoreq..tickscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_130#ticks., get_tickscxx . . $ pvpgn/bnetd/get_ticks(db52760e79bf9054).());
578 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
579 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
580 }
581
582 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
583 {
584 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_authreq_109cxx . . $ pvpgn/t_server_authreq_109#));
585 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_AUTHREQ_109cxx . . $ `src/common/bnet_protocol.h:782:9`!);
586
587 // Logon type
588 if ((conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) == CLIENTTAG_WARCRAFT3_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:111:9`!))
589 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreq_109..logontypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_36#logontype., SERVER_AUTHREQ_109_LOGONTYPE_W3cxx . . $ `src/common/bnet_protocol.h:794:9`!);
590 else if ((conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) == CLIENTTAG_WAR3XP_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:113:9`!))
591 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreq_109..logontypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_36#logontype., SERVER_AUTHREQ_109_LOGONTYPE_W3XPcxx . . $ `src/common/bnet_protocol.h:795:9`!);
592 else
593 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreq_109..logontypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_36#logontype., SERVER_AUTHREQ_109_LOGONTYPEcxx . . $ `src/common/bnet_protocol.h:793:9`!);
594
595
596 // Session
597 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreq_109..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_36#sessionkey., conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(c));
598 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreq_109..sessionnumcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_36#sessionnum., conn_get_sessionnumcxx . . $ pvpgn/bnetd/conn_get_sessionnum(8bd2285a65940781).(c));
599
600
601 // CheckRevision
602 stdcxx . . $ std/::tuplecxx . . $ std/tuple#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::stringcxx . . $ std/string#> checkrevision = select_checkrevisioncxx . . $ pvpgn/bnetd/select_checkrevision(e17816cf095531bf).(bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..archtagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#archtag.), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#clienttag.), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_auth_infocxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_auth_info..versionidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_30#versionid.));
603 file_to_mod_timecxx . . $ pvpgn/bnetd/file_to_mod_time(58ff0399a75a534d).(c, stdcxx . . $ std/::getcxx . . $ std/get(51b66c851421c132).<0>(checkrevision).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), &rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreq_109..timestampcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_36#timestamp.); // Checkrevision file timestamp
604 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, stdcxx . . $ std/::getcxx . . $ std/get(51b66c851421c132).<0>(checkrevision).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); // CheckRevision filename
605 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, stdcxx . . $ std/::getcxx . . $ std/get(51b66c851421c132).<1>(checkrevision).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); // CheckRevision equation
606 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] selected \"{}\" \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), stdcxx . . $ std/::getcxx . . $ std/get(51b66c851421c132).<0>(checkrevision), stdcxx . . $ std/::getcxx . . $ std/get(51b66c851421c132).<1>(checkrevision));
607
608
609 // WarCraft 3 Server Signature
610 if ((conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) == CLIENTTAG_WARCRAFT3_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:111:9`!)
611 || (conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) == CLIENTTAG_WAR3XP_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:113:9`!))
612 {
613 char padding[128];
614 stdcxx . . $ std/::memset(padding, 0, 128);
615 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, padding, 128);
616 }
617
618 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
619 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
620 }
621 }
622 return 0;
623 }
624
625 static int _client_unknown2bcxx . . $ pvpgn/bnetd/_client_unknown2b(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
626 {
627 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_unknown_2bcxx . . $ pvpgn/t_client_unknown_2b#)) {
628 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad UNKNOWN_2B packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_unknown_2bcxx . . $ pvpgn/t_client_unknown_2b#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
629 return -1;
630 }
631 return 0;
632 }
633
634 static int _client_progidentcxx . . $ pvpgn/bnetd/_client_progident(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
635 {
636 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
637
638 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_progidentcxx . . $ pvpgn/t_client_progident#)) {
639 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad PROGIDENT packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_progidentcxx . . $ pvpgn/t_client_progident#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
640 return -1;
641 }
642
643 if (tag_check_in_list(bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progidentcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_34#clienttag.), prefs_get_allowed_clientscxx . . $ pvpgn/bnetd/prefs_get_allowed_clients(33a1f659e94feb42).())) {
644 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(c, conn_state_destroy);
645 return 0;
646 }
647
648 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] CLIENT_PROGIDENT archtag=0x{:08x} clienttag=0x{:08x} versionid=0x{:08x} unknown1=0x{:08x}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progidentcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident..archtagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_34#archtag.), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progidentcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_34#clienttag.), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progidentcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident..versionidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_34#versionid.), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progidentcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident..unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_34#unknown1.));
649
650 conn_set_archtagcxx . . $ pvpgn/bnetd/conn_set_archtag(d97ad1b62a895b69).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progidentcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident..archtagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_34#archtag.));
651 conn_set_clienttagcxx . . $ pvpgn/bnetd/conn_set_clienttag(d97ad1b62a895b69).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progidentcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_34#clienttag.));
652 conn_set_versionidcxx . . $ pvpgn/bnetd/conn_set_versionid(31721b9a6fcb2436).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progidentcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident..versionidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_34#versionid.));
653
654 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
655 {
656 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_authreq1cxx . . $ pvpgn/t_server_authreq1#));
657 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_AUTHREQ1cxx . . $ `src/common/bnet_protocol.h:752:9`!);
658
659
660 // CheckRevision
661 stdcxx . . $ std/::tuplecxx . . $ std/tuple#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::stringcxx . . $ std/string#> checkrevision = select_checkrevisioncxx . . $ pvpgn/bnetd/select_checkrevision(e17816cf095531bf).(bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progidentcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident..archtagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_34#archtag.), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progidentcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_34#clienttag.), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progidentcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident..versionidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_34#versionid.));
662 file_to_mod_timecxx . . $ pvpgn/bnetd/file_to_mod_time(58ff0399a75a534d).(c, stdcxx . . $ std/::getcxx . . $ std/get(51b66c851421c132).<0>(checkrevision).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), &rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreq1..timestampcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_35#timestamp.); // Checkrevision file timestamp
663 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, stdcxx . . $ std/::getcxx . . $ std/get(51b66c851421c132).<0>(checkrevision).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); // CheckRevision filename
664 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, stdcxx . . $ std/::getcxx . . $ std/get(51b66c851421c132).<1>(checkrevision).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); // CheckRevision equation
665 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] selected \"{}\" \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), stdcxx . . $ std/::getcxx . . $ std/get(51b66c851421c132).<0>(checkrevision), stdcxx . . $ std/::getcxx . . $ std/get(51b66c851421c132).<1>(checkrevision));
666
667
668 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
669 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
670 }
671
672 return 0;
673 }
674
675 static int _client_createaccountw3cxx . . $ pvpgn/bnetd/_client_createaccountw3(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
676 {
677 char const *username;
678 char const *plainpass;
679 t_hashcxx . . $ pvpgn/t_hash# sc_hash;
680 unsigned int i;
681 const char *account_salt;
682 const char *account_verifier;
683 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
684 bool presume_plainpass = true;
685
686 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_createaccount_w3cxx . . $ pvpgn/t_client_createaccount_w3#)) {
687 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CREATEACCOUNT_W3 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_createaccount_w3cxx . . $ pvpgn/t_client_createaccount_w3#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
688 return -1;
689 }
690
691 username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_createaccount_w3cxx . . $ pvpgn/t_client_createaccount_w3#), UNCHECKED_NAME_STRcxx . . $ UNCHECKED_NAME_STR.);
692 if (!username) {
693 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CREATEACCOUNT_W3 (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
694 return -1;
695 }
696
697 /* PELISH: We are testing if username missing and if packetsize is good
698 so we does not need to test if salt and verifier are present */
699 account_salt = (const char *)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(t_client_createaccount_w3, salt), 32);
700 account_verifier = (const char *)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(t_client_createaccount_w3, password_verifier), 32);
701
702 for (i = 0; i<16; i++){
703 int value = (unsigned char)account_verifier[i];
704 if (value == 0)
705 break;
706 presume_plainpass &= (stdcxx . . $ std/::isprintcxx . . $ std/isprint(a1851578aea3f541).(value)>0);
707 }
708
709 for (i = 16; (i < 32) && presume_plainpass; i++){
710 int value = account_verifier[i];
711 presume_plainpass &= (value == 0);
712 }
713
714 if (presume_plainpass)
715 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "This looks more like a plaintext password than like a verifier");
716
717 plainpass = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(t_client_createaccount_w3, password_verifier), 16);
718 if (presume_plainpass && !plainpass) {
719 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CREATEACCOUNT_W3 (missing password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
720 return -1;
721 }
722
723 t_packetcxx . . $ pvpgn/t_packet#* const rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
724 if (!rpacket)
725 return -1;
726
727 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_createaccount_w3cxx . . $ pvpgn/t_server_createaccount_w3#));
728 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CREATEACCOUNT_W3cxx . . $ `src/common/bnet_protocol.h:1794:9`!);
729
730 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] new account requested for \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
731
732 if (prefs_get_allow_new_accountscxx . . $ pvpgn/bnetd/prefs_get_allow_new_accounts(db52760e79bf9054).() == 0)
733 {
734 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account not created (disabled)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
735 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_createaccount_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_createaccount_w3..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_78#result., SERVER_CREATEACCOUNT_W3_RESULT_EXISTcxx . . $ `src/common/bnet_protocol.h:1801:9`!);
736 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
737 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
738 return 0;
739 }
740
741 if (account_check_namecxx . . $ pvpgn/bnetd/account_check_name(5c4306d8553b3696).(username) < 0)
742 {
743 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account not created (invalid symbols)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
744 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_createaccount_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_createaccount_w3..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_78#result., SERVER_CREATEACCOUNT_W3_RESULT_INVALIDcxx . . $ `src/common/bnet_protocol.h:1803:9`!);
745 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
746 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
747 return 0;
748 }
749
750 char lpass[20] = {};
751 if (plainpass)
752 {
753 /* convert plaintext password to lowercase for sc etc. */
754 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(lpass, sizeof lpass, "%s", plainpass);
755 strtolowercxx . . $ pvpgn/strtolower(7a9722d75b371431).(lpass);
756 }
757
758 //set password hash for sc etc.
759 bnet_hashcxx . . $ pvpgn/bnet_hash(2a8392f275be648).(&sc_hash, stdcxx . . $ std/::strlen(lpass), lpass);
760 if (!(account = accountlist_create_accountcxx . . $ pvpgn/bnetd/accountlist_create_account(fdad4c38d937b650).(username, hash_get_strcxx . . $ pvpgn/hash_get_str(d917ea147d03f908).(sc_hash))))
761 {
762 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_createaccount_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_createaccount_w3..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_78#result., SERVER_CREATEACCOUNT_W3_RESULT_EXISTcxx . . $ `src/common/bnet_protocol.h:1801:9`!);
763 }
764 else
765 {
766 if (presume_plainpass)
767 {
768 BigIntcxx . . $ pvpgn/BigInt# salt = BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).((unsigned char*)account_salt, 32, 4, false);
769 BnetSRP3cxx . . $ pvpgn/BnetSRP3# srp3 = BnetSRP3cxx . . $ pvpgn/BnetSRP3#BnetSRP3(2fa786934fe80e24).(username, plainpass);
770 srp3.setSaltcxx . . $ pvpgn/BnetSRP3#setSalt(29cbcaec537b00e2).(saltcxx . . $ pvpgn/BigInt#BigInt(b36b8e5b36868922).);
771 BigIntcxx . . $ pvpgn/BigInt# verifier = srp3.getVerifiercxx . . $ pvpgn/BnetSRP3#getVerifier(386d3f2c8bc32279).();
772 account_verifier = (const char*)verifier.getDatacxx . . $ pvpgn/BigInt#getData(7fde0967c2cfd879).(32, 4, false);
773 }
774 else {
775 //NEED TO TAG ACCOUNT AS "SC PASS BROKEN"
776 }
777 account_set_saltcxx . . $ pvpgn/bnetd/account_set_salt(4b12bc5edcfaeac7).(account, account_salt);
778 account_set_verifiercxx . . $ pvpgn/bnetd/account_set_verifier(4b12bc5edcfaeac7).(account, account_verifier);
779 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account created", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
780 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_createaccount_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_createaccount_w3..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_78#result., SERVER_CREATEACCOUNT_W3_RESULT_OKcxx . . $ `src/common/bnet_protocol.h:1800:9`!);
781 }
782
783 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
784 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
785
786 return 0;
787 }
788
789 static int _client_createacctreq1cxx . . $ pvpgn/bnetd/_client_createacctreq1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
790 {
791 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
792 char const *username;
793 t_hashcxx . . $ pvpgn/t_hash# newpasshash1;
794
795 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_createacctreq1cxx . . $ pvpgn/t_client_createacctreq1#)) {
796 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CREATEACCTREQ1 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_createacctreq1cxx . . $ pvpgn/t_client_createacctreq1#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
797 return -1;
798 }
799
800 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_createacctreq1cxx . . $ pvpgn/t_client_createacctreq1#), UNCHECKED_NAME_STRcxx . . $ UNCHECKED_NAME_STR.))) {
801 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CREATEACCTREQ1 (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
802 return -1;
803 }
804
805 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] new account requested for \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
806
807 rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
808 if (!rpacket)
809 return -1;
810 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_createacctreply1cxx . . $ pvpgn/t_server_createacctreply1#));
811 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CREATEACCTREPLY1cxx . . $ `src/common/bnet_protocol.h:638:9`!);
812
813 if (prefs_get_allow_new_accountscxx . . $ pvpgn/bnetd/prefs_get_allow_new_accounts(db52760e79bf9054).() == 0) {
814 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account not created (disabled)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
815 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_createacctreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_createacctreply1..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_32#result., SERVER_CREATEACCTREPLY1_RESULT_NOcxx . . $ `src/common/bnet_protocol.h:645:9`!);
816 goto out;
817 }
818
819 bnhash_to_hashcxx . . $ pvpgn/bnhash_to_hash(8ced6dd31669b167).(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_createacctreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_createacctreq1..password_hash1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_31#password_hash1., &newpasshash1);
820 if (!accountlist_create_accountcxx . . $ pvpgn/bnetd/accountlist_create_account(fdad4c38d937b650).(username, hash_get_strcxx . . $ pvpgn/hash_get_str(d917ea147d03f908).(newpasshash1))) {
821 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account not created (failed)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
822 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_createacctreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_createacctreply1..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_32#result., SERVER_CREATEACCTREPLY1_RESULT_NOcxx . . $ `src/common/bnet_protocol.h:645:9`!);
823 goto out;
824 }
825
826 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account created", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
827 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_createacctreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_createacctreply1..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_32#result., SERVER_CREATEACCTREPLY1_RESULT_OKcxx . . $ `src/common/bnet_protocol.h:644:9`!);
828
829 out:
830 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
831 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
832
833 return 0;
834 }
835
836 static int _client_createacctreq2cxx . . $ pvpgn/bnetd/_client_createacctreq2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
837 {
838 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
839 char const *username;
840 t_hashcxx . . $ pvpgn/t_hash# newpasshash1;
841
842 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_createacctreq2cxx . . $ pvpgn/t_client_createacctreq2#)) {
843 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLIENT_CREATEACCTREQ2 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_createacctreq2cxx . . $ pvpgn/t_client_createacctreq2#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
844 return -1;
845 }
846
847 username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_createacctreq2cxx . . $ pvpgn/t_client_createacctreq2#), UNCHECKED_NAME_STRcxx . . $ UNCHECKED_NAME_STR.);
848 if (!username) {
849 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CREATEACCTREQ2 (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
850 return -1;
851 }
852
853 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] new account requested for \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
854
855 rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
856 if (!rpacket)
857 return -1;
858 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_createacctreply2cxx . . $ pvpgn/t_server_createacctreply2#));
859 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CREATEACCTREPLY2cxx . . $ `src/common/bnet_protocol.h:1855:9`!);
860
861 if (prefs_get_allow_new_accountscxx . . $ pvpgn/bnetd/prefs_get_allow_new_accounts(db52760e79bf9054).() == 0) {
862 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account not created (disabled)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
863 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_createacctreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_createacctreply2..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_81#result., SERVER_CREATEACCTREPLY2_RESULT_EXISTcxx . . $ `src/common/bnet_protocol.h:1865:9`!);
864 goto out;
865 }
866
867 if (account_check_namecxx . . $ pvpgn/bnetd/account_check_name(5c4306d8553b3696).(username) < 0) {
868 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account not created (invalid symbols)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
869 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_createaccount_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_createaccount_w3..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_78#result., SERVER_CREATEACCTREPLY2_RESULT_INVALIDcxx . . $ `src/common/bnet_protocol.h:1863:9`!);
870 goto out;
871 }
872
873 bnhash_to_hashcxx . . $ pvpgn/bnhash_to_hash(8ced6dd31669b167).(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_createacctreq2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_createacctreq2..password_hash1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_80#password_hash1., &newpasshash1);
874 if (!accountlist_create_accountcxx . . $ pvpgn/bnetd/accountlist_create_account(fdad4c38d937b650).(username, hash_get_strcxx . . $ pvpgn/hash_get_str(d917ea147d03f908).(newpasshash1))) {
875 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account not created (failed)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
876 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_createacctreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_createacctreply2..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_81#result., SERVER_CREATEACCTREPLY2_RESULT_EXISTcxx . . $ `src/common/bnet_protocol.h:1865:9`!); /* FIXME: return reason for failure */
877 goto out;
878 }
879
880 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account created", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
881 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_createacctreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_createacctreply2..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_81#result., SERVER_CREATEACCTREPLY2_RESULT_OKcxx . . $ `src/common/bnet_protocol.h:1861:9`!);
882
883 out:
884 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
885 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
886
887 return 0;
888 }
889
890 static int _client_changepassreqcxx . . $ pvpgn/bnetd/_client_changepassreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
891 {
892 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
893
894 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_changepassreqcxx . . $ pvpgn/t_client_changepassreq#)) {
895 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CHANGEPASSREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_changepassreqcxx . . $ pvpgn/t_client_changepassreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
896 return -1;
897 }
898
899 {
900 char const *username;
901 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
902
903 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_changepassreqcxx . . $ pvpgn/t_client_changepassreq#), UNCHECKED_NAME_STRcxx . . $ UNCHECKED_NAME_STR.))) {
904 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CHANGEPASSREQ (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
905 return -1;
906 }
907
908 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] password change requested for \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
909
910 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
911 return -1;
912 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_changepassackcxx . . $ pvpgn/t_server_changepassack#));
913 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CHANGEPASSACKcxx . . $ `src/common/bnet_protocol.h:2157:9`!);
914
915 /* fail if logged in or no account */
916 if (connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(username) || !(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username))) {
917 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] password change for \"{}\" refused (no such account)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
918 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_changepassackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_changepassack..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_91#message., SERVER_CHANGEPASSACK_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2163:9`!);
919 }
920 else if (account_get_auth_changepasscxx . . $ pvpgn/bnetd/account_get_auth_changepass(367bfb076f70247b).(account) == 0) { /* default to true */
921 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] password change for \"{}\" refused (no change access)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
922 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_changepassackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_changepassack..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_91#message., SERVER_CHANGEPASSACK_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2163:9`!);
923 }
924 else if (conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(c) != bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changepassreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changepassreq..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_90#sessionkey.)) {
925 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] password change for \"{}\" refused (expected session key 0x{:08x}, got 0x{:08x})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username, conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changepassreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changepassreq..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_90#sessionkey.));
926 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_changepassackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_changepassack..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_91#message., SERVER_CHANGEPASSACK_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2163:9`!);
927 }
928 else {
929 structcxx . . $ pvpgn/bnetd/_client_changepassreq(8d07eb83d60bed1d).$anonymous_type_0# {
930 bn_intcxx . . $ pvpgn/bn_int# tickscxx . . $ pvpgn/bnetd/_client_changepassreq(8d07eb83d60bed1d).$anonymous_type_0#ticks.;
931 bn_intcxx . . $ pvpgn/bn_int# sessionkeycxx . . $ pvpgn/bnetd/_client_changepassreq(8d07eb83d60bed1d).$anonymous_type_0#sessionkey.;
932 bn_intcxx . . $ pvpgn/bn_int# passhash1cxx . . $ pvpgn/bnetd/_client_changepassreq(8d07eb83d60bed1d).$anonymous_type_0#passhash1.[5];
933 } temp;
934 char const *oldstrhash1;
935 t_hashcxx . . $ pvpgn/t_hash# oldpasshash1;
936 t_hashcxx . . $ pvpgn/t_hash# oldpasshash2;
937 t_hashcxx . . $ pvpgn/t_hash# trypasshash2;
938 t_hashcxx . . $ pvpgn/t_hash# newpasshash1;
939
940
941 if ((oldstrhash1 = account_get_passcxx . . $ pvpgn/bnetd/account_get_pass(4b37305d4a4563d0).(account))) {
942 bn_int_set(&temp.tickscxx . . $ pvpgn/bnetd/_client_changepassreq(8d07eb83d60bed1d).$anonymous_type_0#ticks., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changepassreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changepassreq..tickscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_90#ticks.));
943 bn_int_set(&temp.sessionkeycxx . . $ pvpgn/bnetd/_client_changepassreq(8d07eb83d60bed1d).$anonymous_type_0#sessionkey., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changepassreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changepassreq..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_90#sessionkey.));
944 if (hash_set_strcxx . . $ pvpgn/hash_set_str(bc9a1c18029b2ef4).(&oldpasshash1, oldstrhash1) < 0) {
945 bnhash_to_hashcxx . . $ pvpgn/bnhash_to_hash(8ced6dd31669b167).(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changepassreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changepassreq..newpassword_hash1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_90#newpassword_hash1., &newpasshash1);
946 account_set_passcxx . . $ pvpgn/bnetd/account_set_pass(4b12bc5edcfaeac7).(account, hash_get_strcxx . . $ pvpgn/hash_get_str(d917ea147d03f908).(newpasshash1));
947 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] password change for \"{}\" successful (bad previous password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account));
948 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_changepassackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_changepassack..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_91#message., SERVER_CHANGEPASSACK_MESSAGE_SUCCESScxx . . $ `src/common/bnet_protocol.h:2164:9`!);
949 }
950 else {
951 hash_to_bnhashcxx . . $ pvpgn/hash_to_bnhash(50eab12f45c1086c).((t_hashcxx . . $ pvpgn/t_hash# const *)&oldpasshash1, temp.passhash1cxx . . $ pvpgn/bnetd/_client_changepassreq(8d07eb83d60bed1d).$anonymous_type_0#passhash1.); /* avoid warning */
952 bnet_hashcxx . . $ pvpgn/bnet_hash(2a8392f275be648).(&oldpasshash2, sizeof(temp), &temp); /* do the double hash */
953 bnhash_to_hashcxx . . $ pvpgn/bnhash_to_hash(8ced6dd31669b167).(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changepassreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changepassreq..oldpassword_hash2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_90#oldpassword_hash2., &trypasshash2);
954
955 if (hash_eqcxx . . $ pvpgn/hash_eq(4301982f75a4a5fa).(trypasshash2, oldpasshash2) == 1) {
956 bnhash_to_hashcxx . . $ pvpgn/bnhash_to_hash(8ced6dd31669b167).(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changepassreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changepassreq..newpassword_hash1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_90#newpassword_hash1., &newpasshash1);
957 account_set_passcxx . . $ pvpgn/bnetd/account_set_pass(4b12bc5edcfaeac7).(account, hash_get_strcxx . . $ pvpgn/hash_get_str(d917ea147d03f908).(newpasshash1));
958 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] password change for \"{}\" successful (previous password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account));
959 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_changepassackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_changepassack..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_91#message., SERVER_CHANGEPASSACK_MESSAGE_SUCCESScxx . . $ `src/common/bnet_protocol.h:2164:9`!);
960 }
961 else {
962 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] password change for \"{}\" refused (wrong password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account));
963 conn_increment_passfail_countcxx . . $ pvpgn/bnetd/conn_increment_passfail_count(c4dfbc2386fe4fc3).(c);
964 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_changepassackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_changepassack..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_91#message., SERVER_CHANGEPASSACK_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2163:9`!);
965 }
966 }
967 }
968 else {
969 bnhash_to_hashcxx . . $ pvpgn/bnhash_to_hash(8ced6dd31669b167).(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changepassreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changepassreq..newpassword_hash1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_90#newpassword_hash1., &newpasshash1);
970 account_set_passcxx . . $ pvpgn/bnetd/account_set_pass(4b12bc5edcfaeac7).(account, hash_get_strcxx . . $ pvpgn/hash_get_str(d917ea147d03f908).(newpasshash1));
971 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] password change for \"{}\" successful (no previous password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account));
972 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_changepassackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_changepassack..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_91#message., SERVER_CHANGEPASSACK_MESSAGE_SUCCESScxx . . $ `src/common/bnet_protocol.h:2164:9`!);
973 }
974 }
975
976 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
977 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
978
979 }
980
981 return 0;
982 }
983
984 static int _client_echoreplycxx . . $ pvpgn/bnetd/_client_echoreply(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
985 {
986 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_echoreplycxx . . $ pvpgn/t_client_echoreply#)) {
987 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad ECHOREPLY packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_echoreplycxx . . $ pvpgn/t_client_echoreply#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
988 return -1;
989 }
990
991 {
992 unsigned int now;
993 unsigned int then;
994
995 now = get_tickscxx . . $ pvpgn/bnetd/get_ticks(db52760e79bf9054).();
996 then = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_echoreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_echoreply..tickscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_129#ticks.);
997 if (!now || !then || now < then)
998 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "[{}] bad timing in echo reply: now={} then={}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), now, then);
999 else
1000 conn_set_latencycxx . . $ pvpgn/bnetd/conn_set_latency(d97ad1b62a895b69).(c, now - then);
1001 }
1002
1003 return 0;
1004 }
1005
1006 static int _client_authreq1cxx . . $ pvpgn/bnetd/_client_authreq1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1007 {
1008 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "[{}] received AUTHREQ1(0x07) packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1009
1010 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_authreq1cxx . . $ pvpgn/t_client_authreq1#))
1011 {
1012 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad AUTHREQ1 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_authreq1cxx . . $ pvpgn/t_client_authreq1#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1013 return -1;
1014 }
1015
1016 auto send_failed_packet = [](t_connection *c)
1017 {
1018 t_packetcxx . . $ pvpgn/t_packet# *rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
1019 if (rpacket)
1020 {
1021 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_authreply1cxx . . $ pvpgn/t_server_authreply1#));
1022 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_AUTHREPLY1cxx . . $ `src/common/bnet_protocol.h:863:9`!);
1023 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(c, conn_state_untrusted);
1024
1025 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_38#message., SERVER_AUTHREPLY1_MESSAGE_BADVERSIONcxx . . $ `src/common/bnet_protocol.h:871:9`!);
1026 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
1027 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, ""); // undocumented extra null terminator
1028
1029 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1030
1031 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1032 }
1033 };
1034
1035 // The following if statements are sanity checks
1036 // The client should have already sent this information in a previous packet and is resending it again in this packet
1037 if (bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq1..archtagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_37#archtag.) != conn_get_archtagcxx . . $ pvpgn/bnetd/conn_get_archtag(8bd2285a65940781).(c))
1038 {
1039 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad AUTHREQ1 (mismatch architecture)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1040 send_failed_packet(cxx . . $ pvpgn/bnetd/_client_authreq1(8d07eb83d60bed1d).$anonymous_type_1#`operator()`(9b96bcfa0397d910).c);
1041 return -1;
1042 }
1043
1044 if (bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq1..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_37#clienttag.) != conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c))
1045 {
1046 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad AUTHREQ1 (mismatch client tag)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1047 send_failed_packet(cxx . . $ pvpgn/bnetd/_client_authreq1(8d07eb83d60bed1d).$anonymous_type_1#`operator()`(9b96bcfa0397d910).c);
1048 return -1;
1049 }
1050
1051 if (bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq1..versionidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_37#versionid.) != conn_get_versionidcxx . . $ pvpgn/bnetd/conn_get_versionid(3fda5c23f1f5e239).(c))
1052 {
1053 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad AUTHREQ1 (mismatch version ID)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1054 send_failed_packet(cxx . . $ pvpgn/bnetd/_client_authreq1(8d07eb83d60bed1d).$anonymous_type_1#`operator()`(9b96bcfa0397d910).c);
1055 return -1;
1056 }
1057
1058
1059 const char *exeinfo = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_authreq1cxx . . $ pvpgn/t_client_authreq1#), MAX_EXEINFO_STRcxx . . $ MAX_EXEINFO_STR.);
1060 if (exeinfo)
1061 {
1062 conn_set_clientexecxx . . $ pvpgn/bnetd/conn_set_clientexe(c8fb97a9af134824).(c, exeinfo);
1063 }
1064 else
1065 {
1066 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad AUTHREQ1 (missing or too long exeinfo)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1067 send_failed_packet(cxx . . $ pvpgn/bnetd/_client_authreq1(8d07eb83d60bed1d).$anonymous_type_1#`operator()`(9b96bcfa0397d910).c);
1068 return 0;
1069 }
1070
1071 stdcxx . . $ std/::stringcxx . . $ std/string# version_string = vernum_to_verstrcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq1..gameversioncxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_37#gameversion.));
1072 conn_set_clientvercxx . . $ pvpgn/bnetd/conn_set_clientver(c8fb97a9af134824).(c, version_string.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
1073 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] CLIENT_AUTHREQ1 archtag=0x{:08x} clienttag=0x{:08x} verstr={} exeinfo=\"{}\" versionid=0x{:08x} gameversion=0x{:08x} checksum=0x{:08x}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq1..archtagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_37#archtag.), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq1..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_37#clienttag.), version_string, exeinfo, conn_get_versionidcxx . . $ pvpgn/bnetd/conn_get_versionid(3fda5c23f1f5e239).(c), conn_get_gameversioncxx . . $ pvpgn/bnetd/conn_get_gameversion(3fda5c23f1f5e239).(c), conn_get_checksumcxx . . $ pvpgn/bnetd/conn_get_checksum(3fda5c23f1f5e239).(c));
1074
1075 conn_set_versionidcxx . . $ pvpgn/bnetd/conn_set_versionid(31721b9a6fcb2436).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq1..versionidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_37#versionid.));
1076 conn_set_checksumcxx . . $ pvpgn/bnetd/conn_set_checksum(31721b9a6fcb2436).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq1..checksumcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_37#checksum.));
1077 conn_set_gameversioncxx . . $ pvpgn/bnetd/conn_set_gameversion(31721b9a6fcb2436).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq1..gameversioncxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_37#gameversion.));
1078
1079
1080 const VersionCheckcxx . . $ pvpgn/bnetd/VersionCheck#* vc = select_versioncheckcxx . . $ pvpgn/bnetd/select_versioncheck(eb22150cf07bbdd6).(conn_get_archtagcxx . . $ pvpgn/bnetd/conn_get_archtag(8bd2285a65940781).(c), conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), conn_get_versionidcxx . . $ pvpgn/bnetd/conn_get_versionid(3fda5c23f1f5e239).(c), conn_get_gameversioncxx . . $ pvpgn/bnetd/conn_get_gameversion(3fda5c23f1f5e239).(c), conn_get_checksumcxx . . $ pvpgn/bnetd/conn_get_checksum(3fda5c23f1f5e239).(c));
1081 conn_set_versioncheckcxx . . $ pvpgn/bnetd/conn_set_versioncheck(2086118ca186da4).(c, vc);
1082 if (vc)
1083 {
1084 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] client matches versiontag \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).());
1085 }
1086 else
1087 {
1088 if (prefs_get_allow_unknown_versioncxx . . $ pvpgn/bnetd/prefs_get_allow_unknown_version(db52760e79bf9054).())
1089 {
1090 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] skipping versioncheck because allow_unknown_version is true", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1091 }
1092 else
1093 {
1094 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] client failed versioncheck", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1095 send_failed_packet(cxx . . $ pvpgn/bnetd/_client_authreq1(8d07eb83d60bed1d).$anonymous_type_1#`operator()`(9b96bcfa0397d910).c);
1096 return 0;
1097 }
1098 }
1099
1100
1101 t_packetcxx . . $ pvpgn/t_packet# *rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
1102 if (rpacket)
1103 {
1104 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_authreply1cxx . . $ pvpgn/t_server_authreply1#));
1105 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_AUTHREPLY1cxx . . $ `src/common/bnet_protocol.h:863:9`!);
1106
1107 char *mpqfilename = nullptr;
1108 if (vc)
1109 {
1110 mpqfilename = autoupdate_checkcxx . . $ pvpgn/bnetd/autoupdate_check(89dc5b73db77f621).(conn_get_archtagcxx . . $ pvpgn/bnetd/conn_get_archtag(8bd2285a65940781).(c), conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), conn_get_gamelangcxx . . $ pvpgn/bnetd/conn_get_gamelang(8bd2285a65940781).(c), vc->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), nullptr);
1111 }
1112
1113 // Only handle updates when there is an update file available.
1114 if (mpqfilename)
1115 {
1116 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] an upgrade for version {} is available \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).(), mpqfilename);
1117 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_38#message., SERVER_AUTHREPLY1_MESSAGE_UPDATEcxx . . $ `src/common/bnet_protocol.h:872:9`!);
1118 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, mpqfilename);
1119
1120 xfreecxx . . $ `src/common/xalloc.h:51:9`!(static_cast<void *>(mpqfilename));
1121 }
1122 else
1123 {
1124 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] no upgrade is available", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1125 }
1126
1127 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_38#message., SERVER_AUTHREPLY1_MESSAGE_OKcxx . . $ `src/common/bnet_protocol.h:873:9`!);
1128 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
1129 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, ""); // FIXME: what's the second string for?
1130
1131 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1132
1133 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1134 }
1135
1136 return 0;
1137 }
1138
1139 static int _client_authreq109cxx . . $ pvpgn/bnetd/_client_authreq109(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1140 {
1141 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_authreq_109cxx . . $ pvpgn/t_client_authreq_109#))
1142 {
1143 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad AUTHREQ_109 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_authreq_109cxx . . $ pvpgn/t_client_authreq_109#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1144 return 0;
1145 }
1146
1147 auto send_failed_packet = [](t_connection *c)
1148 {
1149 t_packetcxx . . $ pvpgn/t_packet# *rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
1150 if (rpacket)
1151 {
1152 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_authreply_109cxx . . $ pvpgn/t_server_authreply_109#));
1153 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_AUTHREPLY_109cxx . . $ `src/common/bnet_protocol.h:882:9`!);
1154 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(c, conn_state_untrusted);
1155
1156 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreply_109..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_39#message., SERVER_AUTHREPLY_109_MESSAGE_BADVERSIONcxx . . $ `src/common/bnet_protocol.h:891:9`!);
1157 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
1158
1159 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1160
1161 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1162 }
1163 };
1164
1165
1166 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# count = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq_109..cdkey_numbercxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_40#cdkey_number.);
1167 stdcxx . . $ std/::size_tcxx . . $ std/size_t# position = sizeof(t_client_authreq_109cxx . . $ pvpgn/t_client_authreq_109#) + (count * sizeof(t_cdkey_infocxx . . $ pvpgn/t_cdkey_info#));
1168
1169 const char *const exeinfo = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, position, MAX_EXEINFO_STRcxx . . $ MAX_EXEINFO_STR.);
1170 if (exeinfo)
1171 {
1172 conn_set_clientexecxx . . $ pvpgn/bnetd/conn_set_clientexe(c8fb97a9af134824).(c, exeinfo);
1173 }
1174 else
1175 {
1176 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad AUTHREQ_109 (missing or too long exeinfo)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1177 send_failed_packet(cxx . . $ pvpgn/bnetd/_client_authreq109(8d07eb83d60bed1d).$anonymous_type_2#`operator()`(9b96bcfa0397d910).c);
1178 return 0;
1179 }
1180
1181 position += stdcxx . . $ std/::strlen(exeinfo) + 1;
1182
1183 const char *const owner = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, position, MAX_OWNER_STRcxx . . $ MAX_OWNER_STR.);
1184 if (owner)
1185 {
1186 conn_set_ownercxx . . $ pvpgn/bnetd/conn_set_owner(c8fb97a9af134824).(c, owner);
1187 }
1188 else
1189 {
1190 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad AUTHREQ_109 (missing or too long owner)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1191 conn_set_ownercxx . . $ pvpgn/bnetd/conn_set_owner(c8fb97a9af134824).(c, "");
1192 }
1193
1194 conn_set_checksumcxx . . $ pvpgn/bnetd/conn_set_checksum(31721b9a6fcb2436).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq_109..checksumcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_40#checksum.));
1195 conn_set_gameversioncxx . . $ pvpgn/bnetd/conn_set_gameversion(31721b9a6fcb2436).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq_109..gameversioncxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_40#gameversion.));
1196 stdcxx . . $ std/::stringcxx . . $ std/string# version = vernum_to_verstrcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq_109..gameversioncxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_40#gameversion.));
1197 conn_set_clientvercxx . . $ pvpgn/bnetd/conn_set_clientver(c8fb97a9af134824).(c, version.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
1198
1199 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] CLIENT_AUTHREQ_109 ticks=0x{:08x}, verstr={} exeinfo=\"{}\" versionid=0x{:08x} gameversion=0x{:08x} checksum=0x{:08x}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_authreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_authreq_109..tickscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_40#ticks.), version, exeinfo, conn_get_versionidcxx . . $ pvpgn/bnetd/conn_get_versionid(3fda5c23f1f5e239).(c), conn_get_gameversioncxx . . $ pvpgn/bnetd/conn_get_gameversion(3fda5c23f1f5e239).(c), conn_get_checksumcxx . . $ pvpgn/bnetd/conn_get_checksum(3fda5c23f1f5e239).(c));
1200
1201 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1202 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
1203 {
1204 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_authreply_109cxx . . $ pvpgn/t_server_authreply_109#));
1205 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_AUTHREPLY_109cxx . . $ `src/common/bnet_protocol.h:882:9`!);
1206
1207
1208 const VersionCheckcxx . . $ pvpgn/bnetd/VersionCheck#* vc = select_versioncheckcxx . . $ pvpgn/bnetd/select_versioncheck(eb22150cf07bbdd6).(conn_get_archtagcxx . . $ pvpgn/bnetd/conn_get_archtag(8bd2285a65940781).(c), conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), conn_get_versionidcxx . . $ pvpgn/bnetd/conn_get_versionid(3fda5c23f1f5e239).(c), conn_get_gameversioncxx . . $ pvpgn/bnetd/conn_get_gameversion(3fda5c23f1f5e239).(c), conn_get_checksumcxx . . $ pvpgn/bnetd/conn_get_checksum(3fda5c23f1f5e239).(c));
1209 conn_set_versioncheckcxx . . $ pvpgn/bnetd/conn_set_versioncheck(2086118ca186da4).(c, vc);
1210 if (vc)
1211 {
1212 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] client matches versiontag \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).());
1213 }
1214 else
1215 {
1216 if (prefs_get_allow_unknown_versioncxx . . $ pvpgn/bnetd/prefs_get_allow_unknown_version(db52760e79bf9054).())
1217 {
1218 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] skipping versioncheck because allow_unknown_version is true", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1219 }
1220 else
1221 {
1222 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] client failed versioncheck", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1223 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1224 send_failed_packet(cxx . . $ pvpgn/bnetd/_client_authreq109(8d07eb83d60bed1d).$anonymous_type_2#`operator()`(9b96bcfa0397d910).c);
1225 return 0;
1226 }
1227 }
1228
1229
1230 char *mpqfilename = nullptr;
1231 if (vc)
1232 {
1233 mpqfilename = autoupdate_checkcxx . . $ pvpgn/bnetd/autoupdate_check(89dc5b73db77f621).(conn_get_archtagcxx . . $ pvpgn/bnetd/conn_get_archtag(8bd2285a65940781).(c), conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), conn_get_gamelangcxx . . $ pvpgn/bnetd/conn_get_gamelang(8bd2285a65940781).(c), conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1234 }
1235
1236 // Only handle updates when there is an update file available.
1237 if (mpqfilename)
1238 {
1239 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] an upgrade for {} is available \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).(), mpqfilename);
1240 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreply_109..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_39#message., SERVER_AUTHREPLY_109_MESSAGE_UPDATEcxx . . $ `src/common/bnet_protocol.h:890:9`!);
1241 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, mpqfilename);
1242
1243 xfreecxx . . $ `src/common/xalloc.h:51:9`!(static_cast<void *>(mpqfilename));
1244 }
1245 else
1246 {
1247 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] no upgrade is available", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1248 }
1249
1250 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_authreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_authreply_109..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_39#message., SERVER_AUTHREPLY_109_MESSAGE_OKcxx . . $ `src/common/bnet_protocol.h:889:9`!);
1251 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
1252
1253 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1254
1255 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1256 }
1257
1258 return 0;
1259 }
1260
1261 static int _client_regsnoopreplycxx . . $ pvpgn/bnetd/_client_regsnoopreply(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1262 {
1263 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_regsnoopreplycxx . . $ pvpgn/t_client_regsnoopreply#)) {
1264 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad REGSNOOPREPLY packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_regsnoopreplycxx . . $ pvpgn/t_client_regsnoopreply#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1265 return -1;
1266 }
1267 return 0;
1268 }
1269
1270 static int _client_iconreqcxx . . $ pvpgn/bnetd/_client_iconreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1271 {
1272 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1273
1274 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_iconreqcxx . . $ pvpgn/t_client_iconreq#)) {
1275 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad ICONREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_iconreqcxx . . $ pvpgn/t_client_iconreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1276 return -1;
1277 }
1278
1279 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
1280 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_iconreplycxx . . $ pvpgn/t_server_iconreply#));
1281 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_ICONREPLYcxx . . $ `src/common/bnet_protocol.h:1011:9`!);
1282 file_to_mod_timecxx . . $ pvpgn/bnetd/file_to_mod_time(58ff0399a75a534d).(c, prefs_get_iconfilecxx . . $ pvpgn/bnetd/prefs_get_iconfile(33a1f659e94feb42).(), &rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_iconreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_iconreply..timestampcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_45#timestamp.);
1283
1284 /* battle.net sends different file on iconreq for WAR3 and W3XP [Omega] */
1285 if ((conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) == CLIENTTAG_WARCRAFT3_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:111:9`!) || (conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) == CLIENTTAG_WAR3XP_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:113:9`!))
1286 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, prefs_get_war3_iconfilecxx . . $ pvpgn/bnetd/prefs_get_war3_iconfile(33a1f659e94feb42).());
1287 /* battle.net still sends "icons.bni" to sc/bw clients
1288 * clients request icons_STAR.bni seperatly */
1289 /* else if (std::strcmp(conn_get_clienttag(c),CLIENTTAG_STARCRAFT)==0)
1290 packet_append_string(rpacket,prefs_get_star_iconfile());
1291 else if (std::strcmp(conn_get_clienttag(c),CLIENTTAG_BROODWARS)==0)
1292 packet_append_string(rpacket,prefs_get_star_iconfile());
1293 */
1294 else
1295 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, prefs_get_iconfilecxx . . $ pvpgn/bnetd/prefs_get_iconfile(33a1f659e94feb42).());
1296
1297 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1298 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1299 }
1300
1301 return 0;
1302 }
1303
1304 static int _client_cdkeycxx . . $ pvpgn/bnetd/_client_cdkey(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1305 {
1306 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1307
1308 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_cdkeycxx . . $ pvpgn/t_client_cdkey#)) {
1309 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CDKEY packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_cdkeycxx . . $ pvpgn/t_client_cdkey#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1310 return -1;
1311 }
1312
1313 {
1314 char const *cdkey;
1315 char const *owner;
1316
1317 if (!(cdkey = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_cdkeycxx . . $ pvpgn/t_client_cdkey#), MAX_CDKEY_STRcxx . . $ MAX_CDKEY_STR.))) {
1318 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CDKEY packet (missing or too long cdkey)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1319 return -1;
1320 }
1321 if (!(owner = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_cdkeycxx . . $ pvpgn/t_client_cdkey#)+stdcxx . . $ std/::strlen(cdkey) + 1, MAX_OWNER_STRcxx . . $ MAX_OWNER_STR.))) {
1322 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CDKEY packet (missing or too long owner)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1323 return -1;
1324 }
1325
1326 conn_set_cdkeycxx . . $ pvpgn/bnetd/conn_set_cdkey(c8fb97a9af134824).(c, cdkey);
1327 conn_set_ownercxx . . $ pvpgn/bnetd/conn_set_owner(c8fb97a9af134824).(c, owner);
1328
1329 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
1330 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_cdkeyreplycxx . . $ pvpgn/t_server_cdkeyreply#));
1331 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CDKEYREPLYcxx . . $ `src/common/bnet_protocol.h:1074:9`!);
1332 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_cdkeyreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_cdkeyreply..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_49#message., SERVER_CDKEYREPLY_MESSAGE_OKcxx . . $ `src/common/bnet_protocol.h:1081:9`!);
1333 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, owner);
1334 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1335 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1336 }
1337 }
1338 #if 0 /* Blizzard used this to track down pirates, should only be accepted by old clients */
1339 if ((rpacket = packet_create(packet_class_bnet))) {
1340 packet_set_size(rpacket, sizeof(t_server_regsnoopreq));
1341 packet_set_type(rpacket, SERVER_REGSNOOPREQ);
1342 bn_int_set(&rpacket->u.server_regsnoopreq.unknown1, SERVER_REGSNOOPREQ_UNKNOWN1); /* sequence num */
1343 bn_int_set(&rpacket->u.server_regsnoopreq.hkey, SERVER_REGSNOOPREQ_HKEY_CURRENT_USER);
1344 packet_append_string(rpacket, SERVER_REGSNOOPREQ_REGKEY);
1345 packet_append_string(rpacket, SERVER_REGSNOOPREQ_REGVALNAME);
1346 conn_push_outqueue(c, rpacket);
1347 packet_del_ref(rpacket);
1348 }
1349 #endif
1350 return 0;
1351 }
1352
1353 static int _client_cdkey2cxx . . $ pvpgn/bnetd/_client_cdkey2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1354 {
1355 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1356
1357 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_cdkey2cxx . . $ pvpgn/t_client_cdkey2#)) {
1358 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CDKEY2 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_cdkey2cxx . . $ pvpgn/t_client_cdkey2#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1359 return -1;
1360 }
1361
1362 {
1363 char const *owner;
1364
1365 if (!(owner = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_cdkey2cxx . . $ pvpgn/t_client_cdkey2#), MAX_OWNER_STRcxx . . $ MAX_OWNER_STR.))) {
1366 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CDKEY2 packet (missing or too long owner)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1367 return -1;
1368 }
1369
1370 conn_set_ownercxx . . $ pvpgn/bnetd/conn_set_owner(c8fb97a9af134824).(c, owner);
1371
1372 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
1373 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_cdkeyreply2cxx . . $ pvpgn/t_server_cdkeyreply2#));
1374 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CDKEYREPLY2cxx . . $ `src/common/bnet_protocol.h:1879:9`!);
1375 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_cdkeyreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_cdkeyreply2..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_82#message., SERVER_CDKEYREPLY2_MESSAGE_OKcxx . . $ `src/common/bnet_protocol.h:1886:9`!);
1376 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, owner);
1377 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1378 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1379 }
1380 }
1381
1382 return 0;
1383 }
1384
1385 static int _client_cdkey3cxx . . $ pvpgn/bnetd/_client_cdkey3(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1386 {
1387 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1388
1389 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_cdkey3cxx . . $ pvpgn/t_client_cdkey3#)) {
1390 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CDKEY3 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_cdkey2cxx . . $ pvpgn/t_client_cdkey2#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1391 return -1;
1392 }
1393
1394 {
1395 char const *owner;
1396
1397 if (!(owner = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_cdkey3cxx . . $ pvpgn/t_client_cdkey3#), MAX_OWNER_STRcxx . . $ MAX_OWNER_STR.))) {
1398 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CDKEY3 packet (missing or too long owner)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1399 return -1;
1400 }
1401
1402 conn_set_ownercxx . . $ pvpgn/bnetd/conn_set_owner(c8fb97a9af134824).(c, owner);
1403
1404 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
1405 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_cdkeyreply3cxx . . $ pvpgn/t_server_cdkeyreply3#));
1406 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CDKEYREPLY3cxx . . $ `src/common/bnet_protocol.h:1182:9`!);
1407 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_cdkeyreply3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_cdkeyreply3..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_52#message., SERVER_CDKEYREPLY3_MESSAGE_OKcxx . . $ `src/common/bnet_protocol.h:1189:9`!);
1408 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, ""); /* FIXME: owner, message, ??? */
1409 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1410 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1411 }
1412 }
1413
1414 return 0;
1415 }
1416
1417 static int _client_udpokcxx . . $ pvpgn/bnetd/_client_udpok(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1418 {
1419 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_udpokcxx . . $ pvpgn/t_client_udpok#)) {
1420 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad UDPOK packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_udpokcxx . . $ pvpgn/t_client_udpok#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1421 return -1;
1422 }
1423 /* we could check the contents but there really isn't any point */
1424 conn_set_udpokcxx . . $ pvpgn/bnetd/conn_set_udpok(c4dfbc2386fe4fc3).(c);
1425
1426 return 0;
1427 }
1428
1429 static int _client_fileinforeqcxx . . $ pvpgn/bnetd/_client_fileinforeq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1430 {
1431 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1432
1433 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_fileinforeqcxx . . $ pvpgn/t_client_fileinforeq#)) {
1434 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad FILEINFOREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_fileinforeqcxx . . $ pvpgn/t_client_fileinforeq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1435 return -1;
1436 }
1437
1438 {
1439 char const *filename;
1440
1441 if (!(filename = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_fileinforeqcxx . . $ pvpgn/t_client_fileinforeq#), MAX_FILENAME_STRcxx . . $ MAX_FILENAME_STR.))) {
1442 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad FILEINFOREQ packet (missing or too long tosfile)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1443 return -1;
1444 }
1445 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] file requested: \"{}\" - type = 0x{:02x}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), filename, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_fileinforeqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_fileinforeq..typecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_84#type.));
1446
1447 /* TODO: if type is TOSFILE make bnetd to send default tosfile if selected is not found */
1448 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
1449 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_fileinforeplycxx . . $ pvpgn/t_server_fileinforeply#));
1450 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_FILEINFOREPLYcxx . . $ `src/common/bnet_protocol.h:1945:9`!);
1451 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_fileinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_fileinforeply..typecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_85#type., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_fileinforeqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_fileinforeq..typecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_84#type.));
1452 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_fileinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_fileinforeply..unknown2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_85#unknown2., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_fileinforeqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_fileinforeq..unknown2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_84#unknown2.));
1453 /* Note from Sherpya:
1454 * timestamp -> 0x852b7d00 - 0x01c0e863 b.net send this (bn_int),
1455 * I suppose is not a long
1456 * if bnserver-D2DV is bad diablo 2 crashes
1457 * timestamp doesn't work correctly and starcraft
1458 * needs name in client locale or displays hostname
1459 */
1460 file_to_mod_timecxx . . $ pvpgn/bnetd/file_to_mod_time(58ff0399a75a534d).(c, filename, &rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_fileinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_fileinforeply..timestampcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_85#timestamp.);
1461 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, filename);
1462 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1463 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1464 }
1465 }
1466
1467 return 0;
1468 }
1469
1470 static const char *_attribute_reqcxx . . $ pvpgn/bnetd/_attribute_req(7253521afda8dbc5).(t_accountcxx . . $ pvpgn/bnetd/t_account# * reqacc, t_accountcxx . . $ pvpgn/bnetd/t_account# * myacc, const char *key)
1471 {
1472 const char *result = "";
1473 const char *tval;
1474
1475 if (!reqacc)
1476 goto out;
1477 if (reqacc != myacc && !strncasecmp(key, "BNET", 4))
1478 goto out;
1479
1480 tval = account_get_strattrcxx . . $ `src/bnetd/account.h:96:9`!(reqacc, key);
1481 if (tval)
1482 result = tval;
1483
1484 out:
1485 return result;
1486 }
1487
1488 static int _client_statsreqcxx . . $ pvpgn/bnetd/_client_statsreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1489 {
1490 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1491 char const *name;
1492 char const *key;
1493 unsigned int name_count;
1494 unsigned int key_count;
1495 unsigned int i, j;
1496 unsigned int name_off;
1497 unsigned int keys_off;
1498 unsigned int key_off;
1499 t_accountcxx . . $ pvpgn/bnetd/t_account# *reqacc, *myacc;
1500
1501 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_statsreqcxx . . $ pvpgn/t_client_statsreq#)) {
1502 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STATSREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_statsreqcxx . . $ pvpgn/t_client_statsreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1503 return -1;
1504 }
1505
1506 name_count = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_statsreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_statsreq..name_countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_86#name_count.);
1507 key_count = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_statsreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_statsreq..key_countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_86#key_count.);
1508
1509 for (i = 0, name_off = sizeof(t_client_statsreqcxx . . $ pvpgn/t_client_statsreq#); i < name_count && (name = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, name_off, UNCHECKED_NAME_STRcxx . . $ UNCHECKED_NAME_STR.)); i++, name_off += stdcxx . . $ std/::strlen(name) + 1);
1510
1511 if (i < name_count) {
1512 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STATSREQ packet (only {} names of {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), i, name_count);
1513 return -1;
1514 }
1515 keys_off = name_off;
1516
1517 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
1518 return -1;
1519
1520 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_statsreplycxx . . $ pvpgn/t_server_statsreply#));
1521 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_STATSREPLYcxx . . $ `src/common/bnet_protocol.h:2078:9`!);
1522 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_statsreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_statsreply..name_countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_87#name_count., name_count);
1523 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_statsreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_statsreply..key_countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_87#key_count., key_count);
1524 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_statsreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_statsreply..requestidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_87#requestid., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_statsreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_statsreq..requestidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_86#requestid.));
1525
1526 myacc = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c);
1527
1528 for (i = 0, name_off = sizeof(t_client_statsreqcxx . . $ pvpgn/t_client_statsreq#); i < name_count && (name = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, name_off, UNCHECKED_NAME_STRcxx . . $ UNCHECKED_NAME_STR.)); i++, name_off += stdcxx . . $ std/::strlen(name) + 1) {
1529 reqacc = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(name);
1530 if (!reqacc)
1531 reqacc = myacc;
1532
1533 for (j = 0, key_off = keys_off; j < key_count && (key = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, key_off, MAX_ATTRKEY_STRcxx . . $ MAX_ATTRKEY_STR.)); j++, key_off += stdcxx . . $ std/::strlen(key) + 1) {
1534 if (*key == '\0')
1535 continue;
1536 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, _attribute_reqcxx . . $ pvpgn/bnetd/_attribute_req(7253521afda8dbc5).(reqacc, myacc, key));
1537 }
1538 }
1539
1540 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1541 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1542
1543 return 0;
1544 }
1545
1546 static int _client_loginreq1cxx . . $ pvpgn/bnetd/_client_loginreq1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1547 {
1548 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_loginreq1cxx . . $ pvpgn/t_client_loginreq1#)) {
1549 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad LOGINREQ1 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_loginreq1cxx . . $ pvpgn/t_client_loginreq1#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1550 return -1;
1551 }
1552
1553 {
1554 char const *username;
1555 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
1556
1557 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_loginreq1cxx . . $ pvpgn/t_client_loginreq1#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
1558 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad LOGINREQ1 (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1559 return -1;
1560 }
1561
1562 t_packetcxx . . $ pvpgn/t_packet#* const rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
1563 if (!rpacket)
1564 {
1565 return -1;
1566 }
1567
1568 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_loginreply1cxx . . $ pvpgn/t_server_loginreply1#));
1569 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_LOGINREPLY1cxx . . $ `src/common/bnet_protocol.h:2109:9`!);
1570
1571 // too many logins? [added by NonReal]
1572 if (prefs_get_max_concurrent_loginscxx . . $ pvpgn/bnetd/prefs_get_max_concurrent_logins(db52760e79bf9054).() > 0)
1573 {
1574 if (prefs_get_max_concurrent_loginscxx . . $ pvpgn/bnetd/prefs_get_max_concurrent_logins(db52760e79bf9054).() <= connlist_login_get_lengthcxx . . $ pvpgn/bnetd/connlist_login_get_length(db52760e79bf9054).())
1575 {
1576 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] login denied, too many concurrent logins. max: {}. current: {}.", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), prefs_get_max_concurrent_loginscxx . . $ pvpgn/bnetd/prefs_get_max_concurrent_logins(db52760e79bf9054).(), connlist_login_get_lengthcxx . . $ pvpgn/bnetd/connlist_login_get_length(db52760e79bf9054).());
1577 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY1_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2115:9`!);
1578 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1579 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1580 return -1;
1581 }
1582 }
1583
1584 /* fail if no account */
1585 if (!(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username))) {
1586 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (no such account)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1587 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY1_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2115:9`!);
1588 }
1589 else
1590 /* already logged in */
1591 if (connlist_find_connection_by_accountcxx . . $ pvpgn/bnetd/connlist_find_connection_by_account(831fe2ed2f0bd703).(account) && prefs_get_kick_old_logincxx . . $ pvpgn/bnetd/prefs_get_kick_old_login(db52760e79bf9054).() == 0) {
1592 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (already logged in)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1593 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY1_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2115:9`!);
1594 }
1595 else if (account_get_auth_bnetlogincxx . . $ pvpgn/bnetd/account_get_auth_bnetlogin(367bfb076f70247b).(account) == 0) { /* default to true */
1596 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (no bnet access)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1597 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY1_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2115:9`!);
1598 }
1599 else if (account_get_auth_lockcxx . . $ pvpgn/bnetd/account_get_auth_lock(367bfb076f70247b).(account) == 1) { /* default to false */
1600 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (this account is locked)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1601 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY1_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2115:9`!);
1602 }
1603 else if (conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(c) != bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_loginreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_loginreq1..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_88#sessionkey.)) {
1604 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] login for \"{}\" refused (expected session key 0x{:08x}, got 0x{:08x})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username, conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_loginreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_loginreq1..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_88#sessionkey.));
1605 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY1_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2115:9`!);
1606 }
1607 else {
1608 structcxx . . $ pvpgn/bnetd/_client_loginreq1(8d07eb83d60bed1d).$anonymous_type_3# {
1609 bn_intcxx . . $ pvpgn/bn_int# tickscxx . . $ pvpgn/bnetd/_client_loginreq1(8d07eb83d60bed1d).$anonymous_type_3#ticks.;
1610 bn_intcxx . . $ pvpgn/bn_int# sessionkeycxx . . $ pvpgn/bnetd/_client_loginreq1(8d07eb83d60bed1d).$anonymous_type_3#sessionkey.;
1611 bn_intcxx . . $ pvpgn/bn_int# passhash1cxx . . $ pvpgn/bnetd/_client_loginreq1(8d07eb83d60bed1d).$anonymous_type_3#passhash1.[5];
1612 } temp;
1613 char const *oldstrhash1;
1614 t_hashcxx . . $ pvpgn/t_hash# oldpasshash1;
1615 t_hashcxx . . $ pvpgn/t_hash# oldpasshash2;
1616 t_hashcxx . . $ pvpgn/t_hash# trypasshash2;
1617
1618 if ((oldstrhash1 = account_get_passcxx . . $ pvpgn/bnetd/account_get_pass(4b37305d4a4563d0).(account))) {
1619 bn_int_set(&temp.tickscxx . . $ pvpgn/bnetd/_client_loginreq1(8d07eb83d60bed1d).$anonymous_type_3#ticks., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_loginreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_loginreq1..tickscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_88#ticks.));
1620 bn_int_set(&temp.sessionkeycxx . . $ pvpgn/bnetd/_client_loginreq1(8d07eb83d60bed1d).$anonymous_type_3#sessionkey., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_loginreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_loginreq1..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_88#sessionkey.));
1621 if (hash_set_strcxx . . $ pvpgn/hash_set_str(bc9a1c18029b2ef4).(&oldpasshash1, oldstrhash1) < 0) {
1622 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (corrupted passhash1?)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1623 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY1_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2115:9`!);
1624 }
1625 else {
1626 hash_to_bnhashcxx . . $ pvpgn/hash_to_bnhash(50eab12f45c1086c).((t_hashcxx . . $ pvpgn/t_hash# const *)&oldpasshash1, temp.passhash1cxx . . $ pvpgn/bnetd/_client_loginreq1(8d07eb83d60bed1d).$anonymous_type_3#passhash1.); /* avoid warning */
1627
1628 bnet_hashcxx . . $ pvpgn/bnet_hash(2a8392f275be648).(&oldpasshash2, sizeof(temp), &temp); /* do the double hash */
1629 bnhash_to_hashcxx . . $ pvpgn/bnhash_to_hash(8ced6dd31669b167).(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_loginreq1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_loginreq1..password_hash2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_88#password_hash2., &trypasshash2);
1630
1631 if (hash_eqcxx . . $ pvpgn/hash_eq(4301982f75a4a5fa).(trypasshash2, oldpasshash2) == 1) {
1632 conn_logincxx . . $ pvpgn/bnetd/conn_login(37ada50ef2b0abe1).(c, account, username);
1633 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] \"{}\" logged in (correct password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1634 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY1_MESSAGE_SUCCESScxx . . $ `src/common/bnet_protocol.h:2116:9`!);
1635 #ifdef WITH_LUA
1636 if (lua_handle_user(c, NULL, NULL, luaevent_user_login) == 1)
1637 {
1638 // feature to break login from Lua
1639 conn_set_state(c, conn_state_destroy);
1640 return -1;
1641 }
1642 #endif
1643 #ifdef WIN32_GUI
1644 guiOnUpdateUserList();
1645 #endif
1646 }
1647 else {
1648 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (wrong password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1649 conn_increment_passfail_countcxx . . $ pvpgn/bnetd/conn_increment_passfail_count(c4dfbc2386fe4fc3).(c);
1650 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY1_MESSAGE_FAILcxx . . $ `src/common/bnet_protocol.h:2115:9`!);
1651 }
1652 }
1653 }
1654 else {
1655 conn_logincxx . . $ pvpgn/bnetd/conn_login(37ada50ef2b0abe1).(c, account, username);
1656 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] \"{}\" logged in (no password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1657 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY1_MESSAGE_SUCCESScxx . . $ `src/common/bnet_protocol.h:2116:9`!);
1658 #ifdef WIN32_GUI
1659 guiOnUpdateUserList();
1660 #endif
1661 }
1662 }
1663 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1664 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1665 }
1666
1667 return 0;
1668 }
1669
1670 void client_init_emailcxx . . $ pvpgn/bnetd/client_init_email(c3edbca9dfe59b8a).(t_connection * c, t_accountcxx . . $ pvpgn/bnetd/t_account# * account)
1671 {
1672 t_packetcxx . . $ pvpgn/t_packet# *packet;
1673 char const *email;
1674
1675 if (!c || !account)
1676 return;
1677 if (!(email = account_get_emailcxx . . $ pvpgn/bnetd/account_get_email(4b37305d4a4563d0).(account))) {
1678 if ((packet = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
1679 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(packet, sizeof(t_server_setemailreqcxx . . $ pvpgn/t_server_setemailreq#));
1680 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(packet, SERVER_SETEMAILREQcxx . . $ `src/common/bnet_protocol.h:3641:9`!);
1681 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, packet);
1682 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(packet);
1683 }
1684 }
1685 return;
1686 }
1687
1688 static int _client_loginreq2cxx . . $ pvpgn/bnetd/_client_loginreq2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1689 {
1690 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1691 int success = 0;
1692
1693 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_loginreq2cxx . . $ pvpgn/t_client_loginreq2#)) {
1694 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad LOGINREQ2 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_loginreq2cxx . . $ pvpgn/t_client_loginreq2#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1695 return -1;
1696 }
1697
1698 {
1699 char const *username;
1700 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
1701 char supports_locked_reply = 0;
1702 t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag = conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c);
1703
1704 if (clienttag == CLIENTTAG_STARCRAFT_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:87:9`! || clienttag == CLIENTTAG_BROODWARS_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:89:9`! || clienttag == CLIENTTAG_SHAREWARE_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:91:9`! ||
1705 clienttag == CLIENTTAG_DIABLORTL_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:93:9`! || clienttag == CLIENTTAG_DIABLOSHR_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:95:9`! || clienttag == CLIENTTAG_WARCIIBNE_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:97:9`! ||
1706 clienttag == CLIENTTAG_DIABLO2DV_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:99:9`! || clienttag == CLIENTTAG_STARJAPAN_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:101:9`! || clienttag == CLIENTTAG_DIABLO2ST_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:103:9`! ||
1707 clienttag == CLIENTTAG_DIABLO2XP_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:105:9`! || clienttag == CLIENTTAG_WARCRAFT3_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:111:9`! || clienttag == CLIENTTAG_WAR3XP_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:113:9`! )
1708 {
1709 if (conn_get_versionidcxx . . $ pvpgn/bnetd/conn_get_versionid(3fda5c23f1f5e239).(c) >= 0x0000000b)
1710 supports_locked_reply = 1;
1711 }
1712
1713 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_loginreq2cxx . . $ pvpgn/t_client_loginreq2#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
1714 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad LOGINREQ2 (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1715 return -1;
1716 }
1717
1718 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
1719 return -1;
1720 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_loginreply2cxx . . $ pvpgn/t_server_loginreply2#));
1721 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_LOGINREPLY2cxx . . $ `src/common/bnet_protocol.h:1814:9`!);
1722
1723 // too many logins? [added by NonReal]
1724 if (prefs_get_max_concurrent_loginscxx . . $ pvpgn/bnetd/prefs_get_max_concurrent_logins(db52760e79bf9054).() > 0) {
1725 if (prefs_get_max_concurrent_loginscxx . . $ pvpgn/bnetd/prefs_get_max_concurrent_logins(db52760e79bf9054).() <= connlist_login_get_lengthcxx . . $ pvpgn/bnetd/connlist_login_get_length(db52760e79bf9054).()) {
1726 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] login denied, too many concurrent logins. max: {}. current: {}.", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), prefs_get_max_concurrent_loginscxx . . $ pvpgn/bnetd/prefs_get_max_concurrent_logins(db52760e79bf9054).(), connlist_login_get_lengthcxx . . $ pvpgn/bnetd/connlist_login_get_length(db52760e79bf9054).());
1727 if (supports_locked_reply) {
1728 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply2..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_79#message., SERVER_LOGINREPLY2_MESSAGE_LOCKEDcxx . . $ `src/common/bnet_protocol.h:1824:9`!);
1729 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "Too many concurrent logins. Try again later.");
1730 }
1731 else {
1732 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply2..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_79#message., SERVER_LOGINREPLY2_MESSAGE_BADPASScxx . . $ `src/common/bnet_protocol.h:1823:9`!);
1733 }
1734
1735 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1736 return -1;
1737 }
1738 }
1739
1740 /* fail if no account */
1741 if (!(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username))) {
1742 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (no such account)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1743 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply2..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_79#message., SERVER_LOGINREPLY2_MESSAGE_NONEXISTcxx . . $ `src/common/bnet_protocol.h:1822:9`!);
1744 }
1745 /* already logged in */
1746 else if (connlist_find_connection_by_accountcxx . . $ pvpgn/bnetd/connlist_find_connection_by_account(831fe2ed2f0bd703).(account) && prefs_get_kick_old_logincxx . . $ pvpgn/bnetd/prefs_get_kick_old_login(db52760e79bf9054).() == 0) {
1747 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (already logged in)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1748 if (supports_locked_reply) {
1749 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY2_MESSAGE_LOCKEDcxx . . $ `src/common/bnet_protocol.h:1824:9`!);
1750 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "This account is already logged in.");
1751 }
1752 else {
1753 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY2_MESSAGE_BADPASScxx . . $ `src/common/bnet_protocol.h:1823:9`!);
1754 }
1755 }
1756 else if (account_get_auth_bnetlogincxx . . $ pvpgn/bnetd/account_get_auth_bnetlogin(367bfb076f70247b).(account) == 0) { /* default to true */
1757 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (no bnet access)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1758 if (supports_locked_reply) {
1759 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY2_MESSAGE_LOCKEDcxx . . $ `src/common/bnet_protocol.h:1824:9`!);
1760 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "This account is barred from bnet access.");
1761 }
1762 else {
1763 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY2_MESSAGE_BADPASScxx . . $ `src/common/bnet_protocol.h:1823:9`!);
1764 }
1765 }
1766 else if (account_get_auth_lockcxx . . $ pvpgn/bnetd/account_get_auth_lock(367bfb076f70247b).(account) == 1) { /* default to false */
1767 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (this account is locked)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1768 if (supports_locked_reply)
1769 {
1770 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY2_MESSAGE_LOCKEDcxx . . $ `src/common/bnet_protocol.h:1824:9`!);
1771 stdcxx . . $ std/::stringcxx . . $ std/string# msgtemp = localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "This account has been locked");
1772 msgtemp +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). account_get_locktextcxx . . $ pvpgn/bnetd/account_get_locktext(650897560b616fe8).(c, account, true);
1773 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, msgtemp.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
1774 }
1775 else {
1776 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply1..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_89#message., SERVER_LOGINREPLY2_MESSAGE_BADPASScxx . . $ `src/common/bnet_protocol.h:1823:9`!);
1777 }
1778 }
1779 else if (conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(c) != bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_loginreq2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_loginreq2..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_65#sessionkey.)) {
1780 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] login for \"{}\" refused (expected session key 0x{:08x}, got 0x{:08x})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username, conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_loginreq2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_loginreq2..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_65#sessionkey.));
1781 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply2..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_79#message., SERVER_LOGINREPLY2_MESSAGE_BADPASScxx . . $ `src/common/bnet_protocol.h:1823:9`!);
1782 }
1783 else {
1784 structcxx . . $ pvpgn/bnetd/_client_loginreq2(8d07eb83d60bed1d).$anonymous_type_4# {
1785 bn_intcxx . . $ pvpgn/bn_int# tickscxx . . $ pvpgn/bnetd/_client_loginreq2(8d07eb83d60bed1d).$anonymous_type_4#ticks.;
1786 bn_intcxx . . $ pvpgn/bn_int# sessionkeycxx . . $ pvpgn/bnetd/_client_loginreq2(8d07eb83d60bed1d).$anonymous_type_4#sessionkey.;
1787 bn_intcxx . . $ pvpgn/bn_int# passhash1cxx . . $ pvpgn/bnetd/_client_loginreq2(8d07eb83d60bed1d).$anonymous_type_4#passhash1.[5];
1788 } temp;
1789 char const *oldstrhash1;
1790 t_hashcxx . . $ pvpgn/t_hash# oldpasshash1;
1791 t_hashcxx . . $ pvpgn/t_hash# oldpasshash2;
1792 t_hashcxx . . $ pvpgn/t_hash# trypasshash2;
1793
1794 if ((oldstrhash1 = account_get_passcxx . . $ pvpgn/bnetd/account_get_pass(4b37305d4a4563d0).(account))) {
1795 bn_int_set(&temp.tickscxx . . $ pvpgn/bnetd/_client_loginreq2(8d07eb83d60bed1d).$anonymous_type_4#ticks., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_loginreq2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_loginreq2..tickscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_65#ticks.));
1796 bn_int_set(&temp.sessionkeycxx . . $ pvpgn/bnetd/_client_loginreq2(8d07eb83d60bed1d).$anonymous_type_4#sessionkey., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_loginreq2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_loginreq2..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_65#sessionkey.));
1797 if (hash_set_strcxx . . $ pvpgn/hash_set_str(bc9a1c18029b2ef4).(&oldpasshash1, oldstrhash1) < 0) {
1798 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (corrupted passhash1?)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1799 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply2..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_79#message., SERVER_LOGINREPLY2_MESSAGE_BADPASScxx . . $ `src/common/bnet_protocol.h:1823:9`!);
1800 }
1801 else {
1802 hash_to_bnhashcxx . . $ pvpgn/hash_to_bnhash(50eab12f45c1086c).((t_hashcxx . . $ pvpgn/t_hash# const *)&oldpasshash1, temp.passhash1cxx . . $ pvpgn/bnetd/_client_loginreq2(8d07eb83d60bed1d).$anonymous_type_4#passhash1.); /* avoid warning */
1803
1804 bnet_hashcxx . . $ pvpgn/bnet_hash(2a8392f275be648).(&oldpasshash2, sizeof(temp), &temp); /* do the double hash */
1805 bnhash_to_hashcxx . . $ pvpgn/bnhash_to_hash(8ced6dd31669b167).(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_loginreq2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_loginreq2..password_hash2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_65#password_hash2., &trypasshash2);
1806
1807 if (hash_eqcxx . . $ pvpgn/hash_eq(4301982f75a4a5fa).(trypasshash2, oldpasshash2) == 1) {
1808 conn_logincxx . . $ pvpgn/bnetd/conn_login(37ada50ef2b0abe1).(c, account, username);
1809 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] \"{}\" logged in (correct password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1810 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply2..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_79#message., SERVER_LOGINREPLY2_MESSAGE_SUCCESScxx . . $ `src/common/bnet_protocol.h:1821:9`!);
1811 success = 1;
1812 }
1813 else {
1814 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (wrong password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1815 conn_increment_passfail_countcxx . . $ pvpgn/bnetd/conn_increment_passfail_count(c4dfbc2386fe4fc3).(c);
1816 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply2..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_79#message., SERVER_LOGINREPLY2_MESSAGE_BADPASScxx . . $ `src/common/bnet_protocol.h:1823:9`!);
1817 }
1818 }
1819 }
1820 else {
1821 conn_logincxx . . $ pvpgn/bnetd/conn_login(37ada50ef2b0abe1).(c, account, username);
1822 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] \"{}\" logged in (no password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1823 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply2..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_79#message., SERVER_LOGINREPLY2_MESSAGE_SUCCESScxx . . $ `src/common/bnet_protocol.h:1821:9`!);
1824 success = 1;
1825 }
1826 }
1827 if (success && account) {
1828
1829 #ifdef WITH_LUA
1830 if (lua_handle_user(c, NULL, NULL, luaevent_user_login) == 1)
1831 {
1832 // feature to break login from Lua
1833 conn_set_state(c, conn_state_destroy);
1834 packet_del_ref(rpacket);
1835 return -1;
1836 }
1837 #endif
1838
1839 #ifdef WIN32_GUI
1840 guiOnUpdateUserList();
1841 #endif
1842 client_init_emailcxx . . $ pvpgn/bnetd/client_init_email(c3edbca9dfe59b8a).(c, account);
1843 }
1844
1845 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1846 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1847 }
1848
1849 return 0;
1850 }
1851
1852 static int _client_loginreqw3cxx . . $ pvpgn/bnetd/_client_loginreqw3(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1853 {
1854 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1855
1856 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_loginreq_w3cxx . . $ pvpgn/t_client_loginreq_w3#)) {
1857 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLIENT_LOGINREQ_W3 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_loginreq_w3cxx . . $ pvpgn/t_client_loginreq_w3#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1858 return -1;
1859 }
1860
1861 {
1862 char const *username;
1863 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
1864 char const *account_salt;
1865 char const *account_verifier;
1866 const char *conn_client_public_key;
1867 int i;
1868
1869 /* PELISH: Does not need to check conn_client_public_key != NULL because we testing packet size */
1870 conn_client_public_key = (char *)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(t_client_loginreq_w3, client_public_key), 32);
1871
1872
1873 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_loginreq_w3cxx . . $ pvpgn/t_client_loginreq_w3#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
1874 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLIENT_LOGINREQ_W3 (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1875 return -1;
1876 }
1877
1878 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
1879 return -1;
1880 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_loginreply_w3cxx . . $ pvpgn/t_server_loginreply_w3#));
1881 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_LOGINREPLY_W3cxx . . $ `src/common/bnet_protocol.h:1649:9`!);
1882
1883 for (i = 0; i < 32; i++)
1884 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..saltcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#salt.[i], 0);
1885
1886 for (i = 0; i < 32; i++)
1887 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..server_public_keycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#server_public_key.[i], 0);
1888
1889 {
1890 /* too many logins? */
1891 if (prefs_get_max_concurrent_loginscxx . . $ pvpgn/bnetd/prefs_get_max_concurrent_logins(db52760e79bf9054).() > 0 && prefs_get_max_concurrent_loginscxx . . $ pvpgn/bnetd/prefs_get_max_concurrent_logins(db52760e79bf9054).() <= connlist_login_get_lengthcxx . . $ pvpgn/bnetd/connlist_login_get_length(db52760e79bf9054).()) {
1892 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] login denied, too many concurrent logins. max: {}. current: {}.", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), prefs_get_max_concurrent_loginscxx . . $ pvpgn/bnetd/prefs_get_max_concurrent_logins(db52760e79bf9054).(), connlist_login_get_lengthcxx . . $ pvpgn/bnetd/connlist_login_get_length(db52760e79bf9054).());
1893 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#message., SERVER_LOGINREPLY_W3_MESSAGE_BADACCTcxx . . $ `src/common/bnet_protocol.h:1660:9`!);
1894 }
1895 else
1896 /* fail if no account */
1897 if (!(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username))) {
1898 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) login for \"{}\" refused (no such account)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1899 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#message., SERVER_LOGINREPLY_W3_MESSAGE_BADACCTcxx . . $ `src/common/bnet_protocol.h:1660:9`!);
1900 }
1901 else
1902 /* already logged in */
1903 if (connlist_find_connection_by_accountcxx . . $ pvpgn/bnetd/connlist_find_connection_by_account(831fe2ed2f0bd703).(account) && prefs_get_kick_old_logincxx . . $ pvpgn/bnetd/prefs_get_kick_old_login(db52760e79bf9054).() == 0) {
1904 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) login for \"{}\" refused (already logged in)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1905 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#message., SERVER_LOGINREPLY_W3_MESSAGE_ALREADYcxx . . $ `src/common/bnet_protocol.h:1659:9`!);
1906 }
1907 else if (account_get_auth_bnetlogincxx . . $ pvpgn/bnetd/account_get_auth_bnetlogin(367bfb076f70247b).(account) == 0) { /* default to true */
1908 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) login for \"{}\" refused (no bnet access)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1909 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#message., SERVER_LOGINREPLY_W3_MESSAGE_BADACCTcxx . . $ `src/common/bnet_protocol.h:1660:9`!);
1910 }
1911 else if (!(account_salt = account_get_saltcxx . . $ pvpgn/bnetd/account_get_salt(4b37305d4a4563d0).(account))) {
1912 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) \"{}\" passed account check (even though account has no salt)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1913 conn_set_loggedusercxx . . $ pvpgn/bnetd/conn_set_loggeduser(2e9022cda97b266d).(c, username);
1914 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#message., SERVER_LOGINREPLY_W3_MESSAGE_SUCCESScxx . . $ `src/common/bnet_protocol.h:1658:9`!);
1915 }
1916 else if (!(account_verifier = account_get_verifiercxx . . $ pvpgn/bnetd/account_get_verifier(4b37305d4a4563d0).(account))) {
1917 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) \"{}\" passed account check (even though account has no verifier)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1918 conn_set_loggedusercxx . . $ pvpgn/bnetd/conn_set_loggeduser(2e9022cda97b266d).(c, username);
1919 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#message., SERVER_LOGINREPLY_W3_MESSAGE_SUCCESScxx . . $ `src/common/bnet_protocol.h:1658:9`!);
1920 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void*)account_salt);
1921 }
1922 else {
1923
1924 for (i = 0; i < 32; i++){
1925 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..saltcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#salt.[i], account_salt[i]);
1926 }
1927
1928 BigIntcxx . . $ pvpgn/BigInt# salt = BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).((unsigned char*)account_salt, 32, 4, false);
1929 BigIntcxx . . $ pvpgn/BigInt# verifier = BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).((unsigned char*)account_verifier, 32, 1, false);
1930 BnetSRP3cxx . . $ pvpgn/BnetSRP3# srp3 = BnetSRP3cxx . . $ pvpgn/BnetSRP3#BnetSRP3(1adce25d148ffb4c).(username, salt);
1931
1932 BigIntcxx . . $ pvpgn/BigInt# client_public_key = BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).((unsigned char*)conn_client_public_key, 32, 1, false);
1933 BigIntcxx . . $ pvpgn/BigInt# server_public_key = srp3.getServerSessionPublicKeycxx . . $ pvpgn/BnetSRP3#getServerSessionPublicKey(3c5fe9d91d82707a).(verifier);
1934
1935 server_public_key.getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).((unsigned char*)&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..server_public_keycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#server_public_key., 32, 4, false);
1936
1937 BigIntcxx . . $ pvpgn/BigInt# hashed_server_secret_ = srp3.getHashedServerSecretcxx . . $ pvpgn/BnetSRP3#getHashedServerSecret(804960666f5ec39a).(client_public_key, verifier);
1938 BigIntcxx . . $ pvpgn/BigInt# client_proof = srp3.getClientPasswordProofcxx . . $ pvpgn/BnetSRP3#getClientPasswordProof(f61cf7c7bab94069).(client_public_key, server_public_key, hashed_server_secret_);
1939 BigIntcxx . . $ pvpgn/BigInt# server_proof = srp3.getServerPasswordProofcxx . . $ pvpgn/BnetSRP3#getServerPasswordProof(f61cf7c7bab94069).(client_public_key, client_proof, hashed_server_secret_);
1940
1941 char * conn_client_proof = (char*)client_proof.getDatacxx . . $ pvpgn/BigInt#getData(7fde0967c2cfd879).(20, 4, false);
1942 char * conn_server_proof = (char*)server_proof.getDatacxx . . $ pvpgn/BigInt#getData(7fde0967c2cfd879).(20, 4, false);
1943
1944 conn_set_client_proofcxx . . $ pvpgn/bnetd/conn_set_client_proof(2e9022cda97b266d).(c, conn_client_proof);
1945 conn_set_server_proofcxx . . $ pvpgn/bnetd/conn_set_server_proof(2e9022cda97b266d).(c, conn_server_proof);
1946
1947 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void*)account_verifier);
1948 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void*)account_salt);
1949 xfreecxx . . $ `src/common/xalloc.h:51:9`!(conn_client_proof);
1950 xfreecxx . . $ `src/common/xalloc.h:51:9`!(conn_server_proof);
1951
1952 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) \"{}\" passed account check", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
1953 conn_set_loggedusercxx . . $ pvpgn/bnetd/conn_set_loggeduser(2e9022cda97b266d).(c, username);
1954 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#message., SERVER_LOGINREPLY_W3_MESSAGE_SUCCESScxx . . $ `src/common/bnet_protocol.h:1658:9`!);
1955 }
1956 }
1957
1958 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
1959 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
1960
1961 }
1962
1963 return 0;
1964 }
1965
1966 static int _client_passchangereqcxx . . $ pvpgn/bnetd/_client_passchangereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
1967 {
1968 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
1969
1970 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_passchangereqcxx . . $ pvpgn/t_client_passchangereq#)) {
1971 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLIENT_PASSCHANGEREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_passchangereqcxx . . $ pvpgn/t_client_passchangereq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
1972 return -1;
1973 }
1974
1975 {
1976 char const *username;
1977 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
1978 char const *account_salt;
1979 char const *account_verifier;
1980 const char *conn_client_public_key;
1981 int i;
1982
1983 /* PELISH: Does not need to check conn_client_public_key != NULL because we testing packet size */
1984 conn_client_public_key = (char *)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(t_client_loginreq_w3, client_public_key), 32);
1985
1986
1987 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_passchangereqcxx . . $ pvpgn/t_client_passchangereq#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
1988 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLIENT_PASSCHANGEREQ (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
1989 return -1;
1990 }
1991
1992 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
1993 return -1;
1994 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_passchangereplycxx . . $ pvpgn/t_server_passchangereply#));
1995 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_PASSCHANGEREPLYcxx . . $ `src/common/bnet_protocol.h:1718:9`!);
1996
1997 for (i = 0; i < 32; i++)
1998 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..saltcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#salt.[i], 0);
1999
2000 for (i = 0; i < 32; i++)
2001 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..server_public_keycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#server_public_key.[i], 0);
2002
2003 {
2004 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_passchangereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_passchangereply..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_73#message., SERVER_PASSCHANGEREPLY_MESSAGE_REJECTcxx . . $ `src/common/bnet_protocol.h:1727:9`!);
2005
2006 /* fail if no account */
2007 if (!(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username))) {
2008 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) passchange for \"{}\" refused (no such account)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2009 }
2010 else
2011 /* fail if bnetlogin is disallowed */
2012 if (account_get_auth_bnetlogincxx . . $ pvpgn/bnetd/account_get_auth_bnetlogin(367bfb076f70247b).(account) == 0) { /* default to true */
2013 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) passchange for \"{}\" refused (no bnet access)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2014 }
2015 else
2016 /* fail if no salt */
2017 if ((account_salt = account_get_saltcxx . . $ pvpgn/bnetd/account_get_salt(4b37305d4a4563d0).(account)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
2018 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) passchange for \"{}\" refused (no SALT)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2019 }
2020 else
2021 /* fail if no verifier */
2022 if ((account_verifier = account_get_verifiercxx . . $ pvpgn/bnetd/account_get_verifier(4b37305d4a4563d0).(account)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
2023 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) passchange for \"{}\" refused (no VERIFIER)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2024 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void*)account_salt);
2025 }
2026 else {
2027
2028 for (i = 0; i < 32; i++){
2029 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_passchangereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_passchangereply..saltcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_73#salt.[i], account_salt[i]);
2030 }
2031
2032 BigIntcxx . . $ pvpgn/BigInt# salt = BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).((unsigned char*)account_salt, 32, 4, false);
2033 BigIntcxx . . $ pvpgn/BigInt# verifier = BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).((unsigned char*)account_verifier, 32, 1, false);
2034 BnetSRP3cxx . . $ pvpgn/BnetSRP3# srp3 = BnetSRP3cxx . . $ pvpgn/BnetSRP3#BnetSRP3(1adce25d148ffb4c).(username, salt);
2035
2036 BigIntcxx . . $ pvpgn/BigInt# client_public_key = BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).((unsigned char*)conn_client_public_key, 32, 1, false);
2037 BigIntcxx . . $ pvpgn/BigInt# server_public_key = srp3.getServerSessionPublicKeycxx . . $ pvpgn/BnetSRP3#getServerSessionPublicKey(3c5fe9d91d82707a).(verifier);
2038
2039 server_public_key.getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).((unsigned char*)&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_loginreply_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_loginreply_w3..server_public_keycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_69#server_public_key., 32, 4, false);
2040
2041 BigIntcxx . . $ pvpgn/BigInt# hashed_server_secret_ = srp3.getHashedServerSecretcxx . . $ pvpgn/BnetSRP3#getHashedServerSecret(804960666f5ec39a).(client_public_key, verifier);
2042 BigIntcxx . . $ pvpgn/BigInt# client_proof = srp3.getClientPasswordProofcxx . . $ pvpgn/BnetSRP3#getClientPasswordProof(f61cf7c7bab94069).(client_public_key, server_public_key, hashed_server_secret_);
2043 BigIntcxx . . $ pvpgn/BigInt# server_proof = srp3.getServerPasswordProofcxx . . $ pvpgn/BnetSRP3#getServerPasswordProof(f61cf7c7bab94069).(client_public_key, client_proof, hashed_server_secret_);
2044
2045 char * conn_client_proof = (char*)client_proof.getDatacxx . . $ pvpgn/BigInt#getData(7fde0967c2cfd879).(20, 4, false);
2046 char * conn_server_proof = (char*)server_proof.getDatacxx . . $ pvpgn/BigInt#getData(7fde0967c2cfd879).(20, 4, false);
2047
2048 conn_set_client_proofcxx . . $ pvpgn/bnetd/conn_set_client_proof(2e9022cda97b266d).(c, conn_client_proof);
2049 conn_set_server_proofcxx . . $ pvpgn/bnetd/conn_set_server_proof(2e9022cda97b266d).(c, conn_server_proof);
2050
2051 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void*)account_verifier);
2052 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void*)account_salt);
2053 xfreecxx . . $ `src/common/xalloc.h:51:9`!(conn_client_proof);
2054 xfreecxx . . $ `src/common/xalloc.h:51:9`!(conn_server_proof);
2055
2056 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) \"{}\" passed account passchange check", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2057 conn_set_loggedusercxx . . $ pvpgn/bnetd/conn_set_loggeduser(2e9022cda97b266d).(c, username);
2058 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_passchangereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_passchangereply..messagecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_73#message., SERVER_PASSCHANGEREPLY_MESSAGE_ACCEPTcxx . . $ `src/common/bnet_protocol.h:1726:9`!);
2059 }
2060 }
2061
2062 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
2063 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2064
2065 }
2066
2067 return 0;
2068 }
2069
2070 static int _client_passchangeproofreqcxx . . $ pvpgn/bnetd/_client_passchangeproofreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2071 {
2072 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
2073
2074 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_passchangeproofreqcxx . . $ pvpgn/t_client_passchangeproofreq#)) {
2075 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad PASSCHANGEPROOFREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_passchangeproofreqcxx . . $ pvpgn/t_client_passchangeproofreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
2076 return -1;
2077 }
2078
2079 {
2080 char const *username;
2081 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
2082 const char *salt;
2083 const char *verifier;
2084
2085 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] passchange proof requested", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
2086
2087 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
2088 return -1;
2089 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_passchangeproofreplycxx . . $ pvpgn/t_server_passchangeproofreply#));
2090 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_PASSCHANGEPROOFREPLYcxx . . $ `src/common/bnet_protocol.h:1740:9`!);
2091
2092 stdcxx . . $ std/::memset(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_passchangeproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_passchangeproofreply..server_password_proofcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_75#server_password_proof., 0, sizeof(rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_passchangeproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_passchangeproofreply..server_password_proofcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_75#server_password_proof.));
2093
2094 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_logonproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_logonproofreply..responsecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_71#response., SERVER_PASSCHANGEPROOFREPLY_RESPONSE_BADPASScxx . . $ `src/common/bnet_protocol.h:1748:9`!);
2095
2096 if (!(username = conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(c))) {
2097 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) got NULL username, 0x56ff before 0x55ff?", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
2098 }
2099 else if (!(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username))) {
2100 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) passchange in 0x56ff for \"{}\" refused (no such account)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2101 }
2102 else if (account_get_auth_lockcxx . . $ pvpgn/bnetd/account_get_auth_lock(367bfb076f70247b).(account) == 1) { /* default to false */
2103 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] passchange for \"{}\" refused (this account is locked)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2104 }
2105 else {
2106 int i;
2107 const char * client_password_proof;
2108
2109 if (!(client_password_proof = (const char*)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(t_client_passchangeproofreq, client_password_proof), 20))) {
2110 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] (W3) got bad PASSCHANGEPROOFREQ packet (missing hash)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
2111 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2112 return -1;
2113 }
2114
2115 if (stdcxx . . $ std/::memcmp(client_password_proof, conn_get_client_proofcxx . . $ pvpgn/bnetd/conn_get_client_proof(5104e66f1dd67144).(c), 20) == 0) {
2116 const char * server_proof = conn_get_server_proofcxx . . $ pvpgn/bnetd/conn_get_server_proof(5104e66f1dd67144).(c);
2117
2118 for (i = 0; i < 20; i++){
2119 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_passchangeproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_passchangeproofreply..server_password_proofcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_75#server_password_proof.[i], server_proof[i]);
2120 }
2121
2122 salt = (const char *)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(t_client_passchangeproofreq, salt), 32);
2123 verifier = (const char *)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(t_client_passchangeproofreq, password_verifier), 32);
2124 account_set_saltcxx . . $ pvpgn/bnetd/account_set_salt(4b12bc5edcfaeac7).(account, salt);
2125 account_set_verifiercxx . . $ pvpgn/bnetd/account_set_verifier(4b12bc5edcfaeac7).(account, verifier);
2126
2127 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) \"{}\" successful passchange (right client password proof)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2128 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_passchangeproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_passchangeproofreply..responsecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_75#response., SERVER_PASSCHANGEPROOFREPLY_RESPONSE_OKcxx . . $ `src/common/bnet_protocol.h:1747:9`!);
2129 }
2130 else {
2131 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) got wrong client password proof for \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2132 conn_increment_passfail_countcxx . . $ pvpgn/bnetd/conn_increment_passfail_count(c4dfbc2386fe4fc3).(c);
2133 }
2134 }
2135 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
2136 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2137 conn_set_client_proofcxx . . $ pvpgn/bnetd/conn_set_client_proof(2e9022cda97b266d).(c, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
2138 conn_set_server_proofcxx . . $ pvpgn/bnetd/conn_set_server_proof(2e9022cda97b266d).(c, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
2139 }
2140
2141 return 0;
2142 }
2143
2144 static int _client_pingreqcxx . . $ pvpgn/bnetd/_client_pingreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2145 {
2146 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
2147
2148 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_pingreqcxx . . $ pvpgn/t_client_pingreq#)) {
2149 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad PINGREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_pingreqcxx . . $ pvpgn/t_client_pingreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
2150 return -1;
2151 }
2152
2153 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
2154 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_pingreplycxx . . $ pvpgn/t_server_pingreply#));
2155 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_PINGREPLYcxx . . $ `src/common/bnet_protocol.h:3489:9`!);
2156 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
2157 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2158 }
2159
2160 return 0;
2161 }
2162
2163 static int _client_logonproofreqcxx . . $ pvpgn/bnetd/_client_logonproofreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2164 {
2165 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
2166
2167 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_logonproofreqcxx . . $ pvpgn/t_client_logonproofreq#)) {
2168 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad LOGONPROOFREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_logonproofreqcxx . . $ pvpgn/t_client_logonproofreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
2169 return -1;
2170 }
2171
2172 {
2173 char const *username;
2174 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
2175
2176 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] logon proof requested", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
2177
2178 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
2179 return -1;
2180 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_logonproofreplycxx . . $ pvpgn/t_server_logonproofreply#));
2181 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_LOGONPROOFREPLYcxx . . $ `src/common/bnet_protocol.h:1696:9`!);
2182
2183 stdcxx . . $ std/::memset(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_logonproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_logonproofreply..server_password_proofcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_71#server_password_proof., 0, sizeof(rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_logonproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_logonproofreply..server_password_proofcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_71#server_password_proof.));
2184
2185 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_logonproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_logonproofreply..responsecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_71#response., SERVER_LOGONPROOFREPLY_RESPONSE_BADPASScxx . . $ `src/common/bnet_protocol.h:1704:9`!);
2186
2187 if (!(username = conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(c))) {
2188 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) got NULL username, 0x54ff before 0x53ff?", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
2189 }
2190 else if (!(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username))) {
2191 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) login in 0x54ff for \"{}\" refused (no such account)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2192 }
2193 else if (account_get_auth_lockcxx . . $ pvpgn/bnetd/account_get_auth_lock(367bfb076f70247b).(account) == 1) { /* default to false */
2194 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] login for \"{}\" refused (this account is locked)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2195 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_logonproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_logonproofreply..responsecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_71#response., SERVER_LOGONPROOFREPLY_RESPONSE_CUSTOMcxx . . $ `src/common/bnet_protocol.h:1706:9`!);
2196 stdcxx . . $ std/::stringcxx . . $ std/string# msgtemp = localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "This account has been locked");
2197 msgtemp +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). account_get_locktextcxx . . $ pvpgn/bnetd/account_get_locktext(650897560b616fe8).(c, account, true);
2198 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, msgtemp.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
2199 }
2200 else {
2201 t_hashcxx . . $ pvpgn/t_hash# serverhash;
2202 t_hashcxx . . $ pvpgn/t_hash# clienthash;
2203 int i;
2204 const char * client_password_proof;
2205
2206 /* PELISH: This can not occur - We already tested packet size which must be wrong firstly.
2207 Also pvpgn will crash when will dereferencing NULL pointer (so we cant got this errorlog message)
2208 I vote for deleting this "if" */
2209 if (!(client_password_proof = (const char*)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(t_client_logonproofreq, client_password_proof), 20))) {
2210 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] (W3) got bad LOGONPROOFREQ packet (missing hash)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
2211 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2212 return -1;
2213 }
2214
2215 clienthash[0] = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_logonproofreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_logonproofreq..client_password_proofcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_70#client_password_proof.[0]);
2216 clienthash[1] = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_logonproofreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_logonproofreq..client_password_proofcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_70#client_password_proof.[4]);
2217 clienthash[2] = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_logonproofreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_logonproofreq..client_password_proofcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_70#client_password_proof.[8]);
2218 clienthash[3] = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_logonproofreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_logonproofreq..client_password_proofcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_70#client_password_proof.[12]);
2219 clienthash[4] = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_logonproofreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_logonproofreq..client_password_proofcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_70#client_password_proof.[16]);
2220
2221 hash_set_strcxx . . $ pvpgn/hash_set_str(bc9a1c18029b2ef4).(&serverhash, account_get_passcxx . . $ pvpgn/bnetd/account_get_pass(4b37305d4a4563d0).(account));
2222
2223 if (conn_get_client_proofcxx . . $ pvpgn/bnetd/conn_get_client_proof(5104e66f1dd67144).(c) && stdcxx . . $ std/::memcmp(client_password_proof, conn_get_client_proofcxx . . $ pvpgn/bnetd/conn_get_client_proof(5104e66f1dd67144).(c), 20) == 0) {
2224 const char * server_proof = conn_get_server_proofcxx . . $ pvpgn/bnetd/conn_get_server_proof(5104e66f1dd67144).(c);
2225
2226 for (i = 0; i < 20; i++){
2227 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_logonproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_logonproofreply..server_password_proofcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_71#server_password_proof.[i], server_proof[i]);
2228 }
2229
2230 conn_logincxx . . $ pvpgn/bnetd/conn_login(37ada50ef2b0abe1).(c, account, username);
2231 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) \"{}\" logged in (right client password proof)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2232 if ((conn_get_versionidcxx . . $ pvpgn/bnetd/conn_get_versionid(3fda5c23f1f5e239).(c) >= 0x0000000D) && (account_get_emailcxx . . $ pvpgn/bnetd/account_get_email(4b37305d4a4563d0).(account) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!))
2233 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_logonproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_logonproofreply..responsecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_71#response., SERVER_LOGONPROOFREPLY_RESPONSE_EMAILcxx . . $ `src/common/bnet_protocol.h:1705:9`!);
2234 else
2235 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_logonproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_logonproofreply..responsecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_71#response., SERVER_LOGONPROOFREPLY_RESPONSE_OKcxx . . $ `src/common/bnet_protocol.h:1703:9`!);
2236 // by amadeo updates the userlist
2237 #ifdef WIN32_GUI
2238 guiOnUpdateUserList();
2239 #endif
2240 }
2241 else if (hash_eqcxx . . $ pvpgn/hash_eq(4301982f75a4a5fa).(clienthash, serverhash)) {
2242
2243 conn_logincxx . . $ pvpgn/bnetd/conn_login(37ada50ef2b0abe1).(c, account, username);
2244 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) \"{}\" logged in (right password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2245 if ((conn_get_versionidcxx . . $ pvpgn/bnetd/conn_get_versionid(3fda5c23f1f5e239).(c) >= 0x0000000D) && (account_get_emailcxx . . $ pvpgn/bnetd/account_get_email(4b37305d4a4563d0).(account) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!))
2246 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_logonproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_logonproofreply..responsecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_71#response., SERVER_LOGONPROOFREPLY_RESPONSE_EMAILcxx . . $ `src/common/bnet_protocol.h:1705:9`!);
2247 else
2248 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_logonproofreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_logonproofreply..responsecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_71#response., SERVER_LOGONPROOFREPLY_RESPONSE_OKcxx . . $ `src/common/bnet_protocol.h:1703:9`!);
2249 #ifdef WITH_LUA
2250 if (lua_handle_user(c, NULL, NULL, luaevent_user_login) == 1)
2251 {
2252 // feature to break login from Lua
2253 conn_set_state(c, conn_state_destroy);
2254 packet_del_ref(rpacket);
2255 return -1;
2256 }
2257 #endif
2258 // by amadeo updates the userlist
2259 #ifdef WIN32_GUI
2260 guiOnUpdateUserList();
2261 #endif
2262
2263 }
2264 else {
2265 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] (W3) got wrong client password proof for \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
2266 conn_increment_passfail_countcxx . . $ pvpgn/bnetd/conn_increment_passfail_count(c4dfbc2386fe4fc3).(c);
2267 }
2268 }
2269 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
2270 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2271 conn_set_client_proofcxx . . $ pvpgn/bnetd/conn_set_client_proof(2e9022cda97b266d).(c, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
2272 conn_set_server_proofcxx . . $ pvpgn/bnetd/conn_set_server_proof(2e9022cda97b266d).(c, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
2273 }
2274 clan_send_status_windowcxx . . $ pvpgn/bnetd/clan_send_status_window(c4dfbc2386fe4fc3).(c);
2275
2276 return 0;
2277 }
2278
2279 static int _client_changegameportcxx . . $ pvpgn/bnetd/_client_changegameport(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2280 {
2281 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_changegameportcxx . . $ pvpgn/t_client_changegameport#)) {
2282 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad changegameport packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_changegameportcxx . . $ pvpgn/t_client_changegameport#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
2283 return -1;
2284 }
2285 {
2286 unsigned short port = bn_short_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changegameportcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changegameport..portcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_77#port.);
2287 if (port < 1024) {
2288 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] invalid port in changegameport packet: {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), (int)port);
2289 return -1;
2290 }
2291
2292 conn_set_game_portcxx . . $ pvpgn/bnetd/conn_set_game_port(45a47db2bc2ee415).(c, port);
2293 }
2294
2295 return 0;
2296 }
2297
2298 static int _client_friendslistreqcxx . . $ pvpgn/bnetd/_client_friendslistreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2299 {
2300 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
2301
2302 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_friendslistreqcxx . . $ pvpgn/t_client_friendslistreq#)) {
2303 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad FRIENDSLISTREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_friendslistreqcxx . . $ pvpgn/t_client_friendslistreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
2304 return -1;
2305 }
2306 {
2307 int frienduid;
2308 t_list *flist;
2309 t_friendcxx . . $ pvpgn/bnetd/t_friend# *fr;
2310 t_accountcxx . . $ pvpgn/bnetd/t_account# *account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c);
2311 int i;
2312 int n = account_get_friendcountcxx . . $ pvpgn/bnetd/account_get_friendcount(367bfb076f70247b).(account);
2313 int friendcount = 0;
2314 t_server_friendslistreply_statuscxx . . $ pvpgn/t_server_friendslistreply_status# status;
2315 t_connection *dest_c;
2316 t_game *game;
2317 t_channelcxx . . $ pvpgn/bnetd/t_channel# *channel;
2318 char stat;
2319
2320 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
2321 return -1;
2322
2323 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_friendslistreplycxx . . $ pvpgn/t_server_friendslistreply#));
2324 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_FRIENDSLISTREPLYcxx . . $ `src/common/anongame_protocol.h:593:9`!);
2325
2326 if ((flist = account_get_friendscxx . . $ pvpgn/bnetd/account_get_friends(27f2e57ffe21264).(account)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
2327 {
2328 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2329 return -1;
2330 }
2331
2332 for (i = 0; i < n; i++) {
2333 frienduid = account_get_friendcxx . . $ pvpgn/bnetd/account_get_friend(20c0a00602323ffe).(account, i);
2334 if ((fr = friendlist_find_uidcxx . . $ pvpgn/bnetd/friendlist_find_uid(9da8c1d9dfa566eb).(flist, frienduid)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
2335 continue;
2336 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(friend_get_account(fr)));
2337 game = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2338 channel = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2339
2340 if (!(dest_c = connlist_find_connection_by_uidcxx . . $ pvpgn/bnetd/connlist_find_connection_by_uid(d9e2ca1f510d44cc).(frienduid))) {
2341 bn_byte_set(&status.locationcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_26#location., FRIENDSTATUS_OFFLINEcxx . . $ `src/common/anongame_protocol.h:679:9`!);
2342 bn_byte_set(&status.statuscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_26#status., 0);
2343 bn_int_set(&status.clienttagcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_26#clienttag., 0);
2344 }
2345 else {
2346 bn_int_set(&status.clienttagcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_26#clienttag., conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(dest_c));
2347 stat = 0;
2348 if ((friend_get_mutualcxx . . $ pvpgn/bnetd/friend_get_mutual(1bd0d6ddce271d17).(fr)))
2349 stat |= FRIEND_TYPE_MUTUALcxx . . $ `src/common/anongame_protocol.h:643:9`!;
2350 if ((conn_get_dndstrcxx . . $ pvpgn/bnetd/conn_get_dndstr(c99dbccf638f5c6).(dest_c)))
2351 stat |= FRIEND_TYPE_DNDcxx . . $ `src/common/anongame_protocol.h:644:9`!;
2352 if ((conn_get_awaystrcxx . . $ pvpgn/bnetd/conn_get_awaystr(c99dbccf638f5c6).(dest_c)))
2353 stat |= FRIEND_TYPE_AWAYcxx . . $ `src/common/anongame_protocol.h:645:9`!;
2354 bn_byte_set(&status.statuscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_26#status., stat);
2355 if ((game = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(dest_c))) {
2356 if (game_get_flagcxx . . $ pvpgn/bnetd/game_get_flag(98b2c43fe55f6682).(game) != game_flag_private)
2357 bn_byte_set(&status.locationcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_26#location., FRIENDSTATUS_PUBLIC_GAMEcxx . . $ `src/common/anongame_protocol.h:682:9`!);
2358 else
2359 bn_byte_set(&status.locationcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_26#location., FRIENDSTATUS_PRIVATE_GAMEcxx . . $ `src/common/anongame_protocol.h:683:9`!);
2360 }
2361 else if ((channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(dest_c))) {
2362 bn_byte_set(&status.locationcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_26#location., FRIENDSTATUS_CHATcxx . . $ `src/common/anongame_protocol.h:681:9`!);
2363 }
2364 else {
2365 bn_byte_set(&status.locationcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_26#location., FRIENDSTATUS_ONLINEcxx . . $ `src/common/anongame_protocol.h:680:9`!);
2366 }
2367 }
2368
2369 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &status, sizeof(status));
2370
2371 if (game)
2372 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game));
2373 else if (channel)
2374 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, channel_get_namecxx . . $ pvpgn/bnetd/channel_get_name(7800017c14723985).(channel));
2375 else
2376 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
2377
2378 friendcount++;
2379 }
2380
2381 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_friendslistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_friendslistreply..friendcountcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_25#friendcount., friendcount);
2382
2383 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
2384 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2385 }
2386
2387 return 0;
2388 }
2389
2390 static int _client_friendinforeqcxx . . $ pvpgn/bnetd/_client_friendinforeq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2391 {
2392 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
2393
2394 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_friendinforeqcxx . . $ pvpgn/t_client_friendinforeq#)) {
2395 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad FRIENDINFOREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_friendinforeqcxx . . $ pvpgn/t_client_friendinforeq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
2396 return -1;
2397 }
2398
2399 {
2400 t_connection const *dest_c;
2401 t_game const *game;
2402 t_channelcxx . . $ pvpgn/bnetd/t_channel# const *channel;
2403 t_accountcxx . . $ pvpgn/bnetd/t_account# *account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c);
2404 int frienduid;
2405 t_friendcxx . . $ pvpgn/bnetd/t_friend# *fr;
2406 t_list *flist;
2407 int n = account_get_friendcountcxx . . $ pvpgn/bnetd/account_get_friendcount(367bfb076f70247b).(account);
2408 char type;
2409
2410 if (n == 0)
2411 return 0;
2412
2413 if (bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_friendinforeqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_friendinforeq..friendnumcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_27#friendnum.) > n) {
2414 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] bad friend number in FRIENDINFOREQ packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
2415 return -1;
2416 }
2417
2418 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
2419 return -1;
2420
2421 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_friendinforeplycxx . . $ pvpgn/t_server_friendinforeply#));
2422 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_FRIENDINFOREPLYcxx . . $ `src/common/anongame_protocol.h:632:9`!);
2423
2424 frienduid = account_get_friendcxx . . $ pvpgn/bnetd/account_get_friend(20c0a00602323ffe).(account, bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_friendinforeqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_friendinforeq..friendnumcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_27#friendnum.));
2425 if (frienduid < 0) {
2426 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] friend number {} not found", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), (int)bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_friendinforeqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_friendinforeq..friendnumcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_27#friendnum.));
2427 return -1;
2428 }
2429
2430 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_friendinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_friendinforeply..friendnumcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_28#friendnum., bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_friendinforeqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_friendinforeq..friendnumcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_27#friendnum.));
2431
2432 flist = account_get_friendscxx . . $ pvpgn/bnetd/account_get_friends(27f2e57ffe21264).(account);
2433 fr = friendlist_find_uidcxx . . $ pvpgn/bnetd/friendlist_find_uid(9da8c1d9dfa566eb).(flist, frienduid);
2434
2435 if (fr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || (dest_c = connlist_find_connection_by_accountcxx . . $ pvpgn/bnetd/connlist_find_connection_by_account(831fe2ed2f0bd703).(friend_get_accountcxx . . $ pvpgn/bnetd/friend_get_account(9d018d83140d552c).(fr))) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
2436 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_friendinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_friendinforeply..typecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_28#type., FRIEND_TYPE_NON_MUTUALcxx . . $ `src/common/anongame_protocol.h:642:9`!);
2437 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_friendinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_friendinforeply..statuscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_28#status., FRIENDSTATUS_OFFLINEcxx . . $ `src/common/anongame_protocol.h:679:9`!);
2438 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_friendinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_friendinforeply..clienttagcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_28#clienttag., 0);
2439 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
2440 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
2441 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2442 return 0;
2443 }
2444
2445 type = FRIEND_TYPE_NON_MUTUALcxx . . $ `src/common/anongame_protocol.h:642:9`!;
2446 if (friend_get_mutualcxx . . $ pvpgn/bnetd/friend_get_mutual(1bd0d6ddce271d17).(fr))
2447 type |= FRIEND_TYPE_MUTUALcxx . . $ `src/common/anongame_protocol.h:643:9`!;
2448 if ((conn_get_dndstrcxx . . $ pvpgn/bnetd/conn_get_dndstr(c99dbccf638f5c6).(dest_c)))
2449 type |= FRIEND_TYPE_DNDcxx . . $ `src/common/anongame_protocol.h:644:9`!;
2450 if ((conn_get_awaystrcxx . . $ pvpgn/bnetd/conn_get_awaystr(c99dbccf638f5c6).(dest_c)))
2451 type |= FRIEND_TYPE_AWAYcxx . . $ `src/common/anongame_protocol.h:645:9`!;
2452 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_friendinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_friendinforeply..typecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_28#type., type);
2453 if ((game = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(dest_c))) {
2454 if (game_get_flagcxx . . $ pvpgn/bnetd/game_get_flag(98b2c43fe55f6682).(game) != game_flag_private)
2455 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_friendinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_friendinforeply..statuscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_28#status., FRIENDSTATUS_PUBLIC_GAMEcxx . . $ `src/common/anongame_protocol.h:682:9`!);
2456 else
2457 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_friendinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_friendinforeply..statuscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_28#status., FRIENDSTATUS_PRIVATE_GAMEcxx . . $ `src/common/anongame_protocol.h:683:9`!);
2458 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game));
2459 }
2460 else if ((channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(dest_c))) {
2461 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_friendinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_friendinforeply..statuscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_28#status., FRIENDSTATUS_CHATcxx . . $ `src/common/anongame_protocol.h:681:9`!);
2462 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, channel_get_namecxx . . $ pvpgn/bnetd/channel_get_name(7800017c14723985).(channel));
2463 }
2464 else {
2465 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_friendinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_friendinforeply..statuscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_28#status., FRIENDSTATUS_ONLINEcxx . . $ `src/common/anongame_protocol.h:680:9`!);
2466 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
2467 }
2468
2469 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_friendinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_friendinforeply..clienttagcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_28#clienttag., conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(dest_c));
2470
2471 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
2472 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2473
2474 }
2475
2476 return 0;
2477 }
2478
2479 static int _client_atfriendscreencxx . . $ pvpgn/bnetd/_client_atfriendscreen(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2480 {
2481 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] got CLIENT_ARRANGEDTEAM_FRIENDSCREEN packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
2482
2483 const char *my_username = conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c);
2484 if (!my_username)
2485 {
2486 return -1;
2487 }
2488
2489 t_channelcxx . . $ pvpgn/bnetd/t_channel# *my_channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(c);
2490 int my_channel_is_public = 1;
2491 if (my_channel)
2492 {
2493 my_channel_is_public = channel_get_flagscxx . . $ pvpgn/bnetd/channel_get_flags(6768ecacf43d05ec).(my_channel) & channel_flags_publiccxx . . $ pvpgn/bnetd/channel_flags_public.;
2494 }
2495
2496
2497 t_packetcxx . . $ pvpgn/t_packet# *rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
2498 if (!rpacket)
2499 {
2500 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] could not create friendscreen server packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
2501 return -1;
2502 }
2503 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_arrangedteam_friendscreencxx . . $ pvpgn/t_server_arrangedteam_friendscreen#));
2504 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_ARRANGEDTEAM_FRIENDSCREENcxx . . $ `src/common/anongame_protocol.h:482:9`!);
2505
2506
2507 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# available_players = 0;
2508
2509 // begin search for mutual and available friends
2510 t_list *my_friend_list = account_get_friendscxx . . $ pvpgn/bnetd/account_get_friends(27f2e57ffe21264).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c));
2511 t_elem *entry;
2512 LIST_TRAVERSEcxx . . $ `src/common/list.h:94:9`!(my_friend_list, entry)
2513 {
2514 t_friendcxx . . $ pvpgn/bnetd/t_friend# *_friend = static_cast<t_friendcxx . . $ pvpgn/bnetd/t_friend# *>(elem_get_datacxx . . $ pvpgn/elem_get_data(317ff0e7f02bf2b).(entry));
2515 if (!_friend)
2516 {
2517 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "found NULL entry in list");
2518 continue;
2519 }
2520
2521 if (available_players == stdcxx . . $ std/::numeric_limitscxx . . $ std/numeric_limits#<decltype(available_players)>::maxcxx . . $ std/numeric_limits#max(ef2994725c9008f7).())
2522 {
2523 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "Reached maximum amount of available players to send in packet");
2524 break;
2525 }
2526
2527 // skip non-mutual friends
2528 if (friend_get_mutualcxx . . $ pvpgn/bnetd/friend_get_mutual(1bd0d6ddce271d17).(_friend) == FRIEND_NOTMUTUALcxx . . $ `src/bnetd/friends.h:21:9`!)
2529 {
2530 continue;
2531 }
2532
2533 t_accountcxx . . $ pvpgn/bnetd/t_account# *friend_account = friend_get_accountcxx . . $ pvpgn/bnetd/friend_get_account(9d018d83140d552c).(_friend);
2534 t_connection *friend_connection = connlist_find_connection_by_accountcxx . . $ pvpgn/bnetd/connlist_find_connection_by_account(831fe2ed2f0bd703).(friend_account);
2535 // if user is offline, then continue to next friend
2536 if (!friend_connection)
2537 {
2538 continue;
2539 }
2540
2541 const stdcxx . . $ std/::stringcxx . . $ std/string# my_version_tag = conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c) ? conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).() : ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).;
2542 const stdcxx . . $ std/::stringcxx . . $ std/string# friend_version_tag = conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(friend_connection) ? conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(friend_connection)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).() : ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).;
2543 // friend is using another game or is on a different version
2544 if (my_version_tag !=cxx . . $ std/`operator!=`(5ea818b58063a774). friend_version_tag)
2545 {
2546 continue;
2547 }
2548
2549 // friend has Do Not Disturb mode enabled
2550 if (conn_get_dndstrcxx . . $ pvpgn/bnetd/conn_get_dndstr(c99dbccf638f5c6).(friend_connection))
2551 {
2552 continue;
2553 }
2554
2555 // friend is away
2556 if (conn_get_awaystrcxx . . $ pvpgn/bnetd/conn_get_awaystr(c99dbccf638f5c6).(friend_connection))
2557 {
2558 continue;
2559 }
2560
2561 // friend is not in a channel
2562 t_channelcxx . . $ pvpgn/bnetd/t_channel# *friend_channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(friend_connection);
2563 if (!friend_channel)
2564 {
2565 continue;
2566 }
2567
2568 // // don't list YET if in same private channel
2569 if (!my_channel_is_public && (friend_channel == my_channel))
2570 {
2571 continue;
2572 }
2573
2574 const char *friend_name = account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(friend_account);
2575 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "Friend {} is available for an AT Game.", friend_name);
2576 available_players += 1;
2577 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, friend_name);
2578 }
2579
2580
2581 // now list matching users in same private chan
2582 if (!my_channel_is_public)
2583 {
2584 for (t_connection *user_connection = channel_get_firstcxx . . $ pvpgn/bnetd/channel_get_first(77c4a1edc1ac6ba1).(my_channel); user_connection; user_connection = channel_get_nextcxx . . $ pvpgn/bnetd/channel_get_next(181375335219f0cb).())
2585 {
2586 if (available_players == stdcxx . . $ std/::numeric_limitscxx . . $ std/numeric_limits#<decltype(available_players)>::maxcxx . . $ std/numeric_limits#max(ef2994725c9008f7).())
2587 {
2588 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "Reached maximum amount of available players to send in packet");
2589 break;
2590 }
2591
2592 // skip self
2593 if (user_connection == c)
2594 {
2595 continue;
2596 }
2597
2598 const stdcxx . . $ std/::stringcxx . . $ std/string# my_version_tag = conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c) ? conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(c)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).() : ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).;
2599 const stdcxx . . $ std/::stringcxx . . $ std/string# user_version_tag = conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(user_connection) ? conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(user_connection)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).() : ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).;
2600 // user is using another game or is on a different version
2601 if (my_version_tag !=cxx . . $ std/`operator!=`(5ea818b58063a774). user_version_tag)
2602 {
2603 continue;
2604 }
2605
2606 // user is dnd
2607 if (conn_get_dndstrcxx . . $ pvpgn/bnetd/conn_get_dndstr(c99dbccf638f5c6).(user_connection))
2608 {
2609 continue;
2610 }
2611
2612 // user is away
2613 if (conn_get_awaystrcxx . . $ pvpgn/bnetd/conn_get_awaystr(c99dbccf638f5c6).(user_connection))
2614 {
2615 continue;
2616 }
2617
2618 const char *username = account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(conn_get_account(user_connection));
2619 if (!username)
2620 {
2621 continue;
2622 }
2623
2624 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "user {} in private channel {} is available for an AT Game.", username, channel_get_namecxx . . $ pvpgn/bnetd/channel_get_name(7800017c14723985).(my_channel));
2625 available_players += 1;
2626 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, username);
2627 }
2628 }
2629
2630 if (available_players == 0)
2631 {
2632 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "No available players");
2633 }
2634
2635 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_friendscreencxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_friendscreen..f_countcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_18#f_count., available_players);
2636
2637 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
2638 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2639
2640 return 0;
2641 }
2642
2643 static int _client_atinvitefriendcxx . . $ pvpgn/bnetd/_client_atinvitefriend(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2644 {
2645 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
2646 t_clienttagcxx . . $ pvpgn/t_clienttag# ctag;
2647
2648 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_arrangedteam_invite_friendcxx . . $ pvpgn/t_client_arrangedteam_invite_friend#)) {
2649 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad ARRANGEDTEAM_INVITE_FRIEND packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_arrangedteam_invite_friendcxx . . $ pvpgn/t_client_arrangedteam_invite_friend#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
2650 return -1;
2651 }
2652
2653 ctag = conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c);
2654
2655 {
2656 int count_to_invite, count, id;
2657 char const *invited_usernames[8];
2658 t_accountcxx . . $ pvpgn/bnetd/t_account# *members[MAX_TEAMSIZEcxx . . $ `src/bnetd/team.h:36:9`!];
2659 int i, n, offset, teammemcount;
2660 t_connection *dest_c;
2661 t_teamcxx . . $ pvpgn/bnetd/t_team# *team;
2662 unsigned int teamid;
2663
2664 count_to_invite = bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_arrangedteam_invite_friendcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_arrangedteam_invite_friend..numfriendscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_19#numfriends.);
2665 count = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_arrangedteam_invite_friendcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_arrangedteam_invite_friend..countcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_19#count.);
2666 id = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_arrangedteam_invite_friendcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_arrangedteam_invite_friend..idcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_19#id.);
2667 teammemcount = count_to_invite + 1;
2668
2669 if ((count_to_invite < 1) || (count_to_invite > 3)) {
2670 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got invalid number of users to invite to game");
2671 return -1;
2672 }
2673
2674 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] got ARRANGEDTEAM INVITE packet for {} invitees", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), count_to_invite);
2675
2676 offset = sizeof(t_client_arrangedteam_invite_friendcxx . . $ pvpgn/t_client_arrangedteam_invite_friend#);
2677
2678 for (i = 0; i < count_to_invite; i++) {
2679 if (!(invited_usernames[i] = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, offset, MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
2680 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., "handle_bnet", "Could not get username from invite packet");
2681 return -1;
2682 }
2683 else {
2684 offset += stdcxx . . $ std/::strlen(invited_usernames[i]) + 1;
2685 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., "handle_bnet", "Added user {} to invite array.", invited_usernames[i]);
2686 }
2687 }
2688
2689 members[0] = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c);
2690 for (i = 1; i < MAX_TEAMSIZEcxx . . $ `src/bnetd/team.h:36:9`!; i++) {
2691 if ((i < teammemcount)) {
2692 if (!(members[i] = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(invited_usernames[i - 1]))) {
2693 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got invitation for non-existant user \"{}\"", invited_usernames[i - 1]);
2694 return -1;
2695 }
2696 }
2697 else
2698 members[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2699 }
2700
2701
2702 if (!(team = account_find_team_by_accountscxx . . $ pvpgn/bnetd/account_find_team_by_accounts(f97505bb25041b2).(members[0], members, ctag))) {
2703 team = create_teamcxx . . $ pvpgn/bnetd/create_team(42f9c07c658dd58a).(members, ctag); //no need to free on return -1 because it's already in teamlist
2704
2705 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "this team has never played before, creating new team");
2706 }
2707 else {
2708 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "this team has already played before");
2709 }
2710
2711 teamid = team_get_teamidcxx . . $ pvpgn/bnetd/team_get_teamid(3d0b4ed7d37a7d35).(team);
2712 account_set_currentatteamcxx . . $ pvpgn/bnetd/account_set_currentatteam(43f7d0f5a7c4b307).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), team_get_teamidcxx . . $ pvpgn/bnetd/team_get_teamid(3d0b4ed7d37a7d35).(team));
2713
2714
2715 //Create the packet to send to each of the users you wanted to invite
2716 conn_part_channelcxx . . $ pvpgn/bnetd/conn_part_channel(c4dfbc2386fe4fc3).(c);
2717
2718 for (i = 0; i < teammemcount; i++) {
2719
2720 if (!(dest_c = account_get_conncxx . . $ pvpgn/bnetd/account_get_conn(831fe2ed2f0bd703).(team_get_membercxx . . $ pvpgn/bnetd/team_get_member(98f1b445a9d30dd9).(team, i))))
2721 continue;
2722
2723 if ((dest_c == c))
2724 continue;
2725
2726 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
2727 return -1;
2728
2729 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_arrangedteam_send_invitecxx . . $ pvpgn/t_server_arrangedteam_send_invite#));
2730 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_ARRANGEDTEAM_SEND_INVITEcxx . . $ `src/common/anongame_protocol.h:521:9`!);
2731
2732 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_send_invitecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_send_invite..countcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_21#count., count);
2733 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_send_invitecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_send_invite..idcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_21#id., id);
2734 { /* trans support */
2735 unsigned short port = conn_get_game_portcxx . . $ pvpgn/bnetd/conn_get_game_port(70207a9c46bcade7).(c);
2736 unsigned int addr = conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(c);
2737
2738 trans_netcxx . . $ pvpgn/trans_net(cf0ba8ec647fd542).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(dest_c), &addr, &port);
2739
2740 bn_int_nset(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_send_invitecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_send_invite..inviteripcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_21#inviterip., addr);
2741 bn_short_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_send_invitecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_send_invite..portcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_21#port., port);
2742 }
2743 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_send_invitecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_send_invite..numfriendscxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_21#numfriends., count_to_invite);
2744
2745 for (n = 0; n < teammemcount; n++) {
2746 if (n != i)
2747 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(team_get_member(team, n)));
2748 }
2749
2750 //now send packet
2751 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(dest_c, rpacket);
2752 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2753
2754 account_set_currentatteamcxx . . $ pvpgn/bnetd/account_set_currentatteam(43f7d0f5a7c4b307).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(dest_c), teamid);
2755 }
2756
2757 //now send a ACK to the inviter
2758 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
2759 return -1;
2760 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_arrangedteam_invite_friend_ackcxx . . $ pvpgn/t_server_arrangedteam_invite_friend_ack#));
2761 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_ARRANGEDTEAM_INVITE_FRIEND_ACKcxx . . $ `src/common/anongame_protocol.h:509:9`!);
2762
2763 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_invite_friend_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_invite_friend_ack..countcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_20#count., count);
2764 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_invite_friend_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_invite_friend_ack..idcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_20#id., id);
2765 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_invite_friend_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_invite_friend_ack..timestampcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_20#timestamp., nowcxx . . $ pvpgn/bnetd/now.);
2766 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_invite_friend_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_invite_friend_ack..teamsizecxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_20#teamsize., count_to_invite + 1);
2767
2768 /*
2769 * five int's to fill
2770 * fill with uid's of all teammembers, including the inviter
2771 * and the rest with FFFFFFFF
2772 * to be used when sever recieves anongame search
2773 * [Omega]
2774 */
2775 for (i = 0; i < 5; i++) {
2776
2777 if (i < teammemcount) {
2778 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_invite_friend_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_invite_friend_ack..infocxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_20#info.[i], team_get_memberuidcxx . . $ pvpgn/bnetd/team_get_memberuid(ddee88b4298fccdd).(team, i));
2779 }
2780 else { /* fill rest with FFFFFFFF */
2781 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_invite_friend_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_invite_friend_ack..infocxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_20#info.[i], 0xFFFFFFFF);
2782 }
2783 }
2784
2785 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
2786 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2787
2788 }
2789
2790 return 0;
2791 }
2792
2793 static int _client_atacceptdeclineinvitecxx . . $ pvpgn/bnetd/_client_atacceptdeclineinvite(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2794 {
2795 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
2796 t_clienttagcxx . . $ pvpgn/t_clienttag# ctag;
2797
2798 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_arrangedteam_accept_decline_invitecxx . . $ pvpgn/t_client_arrangedteam_accept_decline_invite#)) {
2799 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad ARRANGEDTEAM_ACCEPT_DECLINE_INVITE packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_arrangedteam_accept_decline_invitecxx . . $ pvpgn/t_client_arrangedteam_accept_decline_invite#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
2800 return -1;
2801 }
2802
2803 ctag = conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c);
2804
2805 {
2806 char const *inviter;
2807 t_connection *dest_c;
2808
2809 //if user declined the invitation then
2810 if (bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_arrangedteam_accept_decline_invitecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_arrangedteam_accept_decline_invite..optioncxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_22#option.) == CLIENT_ARRANGEDTEAM_DECLINEcxx . . $ `src/common/anongame_protocol.h:546:9`!) {
2811 inviter = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_arrangedteam_accept_decline_invitecxx . . $ pvpgn/t_client_arrangedteam_accept_decline_invite#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.);
2812 dest_c = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(inviter);
2813
2814 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., "handle_bnet", "{} declined a arranged team game with {}", conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c), inviter);
2815
2816 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
2817 return -1;
2818 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_arrangedteam_member_declinecxx . . $ pvpgn/t_server_arrangedteam_member_decline#));
2819 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_ARRANGEDTEAM_MEMBER_DECLINEcxx . . $ `src/common/anongame_protocol.h:549:9`!);
2820
2821 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_member_declinecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_member_decline..countcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_23#count., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_arrangedteam_accept_decline_invitecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_arrangedteam_accept_decline_invite..countcxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_22#count.));
2822 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_arrangedteam_member_declinecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_arrangedteam_member_decline..actioncxx . . $ pvpgn/$anonymous_type_7419cb175bf0dbad_23#action., SERVER_ARRANGEDTEAM_DECLINEcxx . . $ `src/common/anongame_protocol.h:559:9`!);
2823 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
2824
2825 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(dest_c, rpacket);
2826 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2827 }
2828 }
2829
2830 return 0;
2831 }
2832
2833 static int _client_atacceptinvitecxx . . $ pvpgn/bnetd/_client_atacceptinvite(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2834 {
2835 // t_packet * rpacket;
2836
2837 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_arrangedteam_accept_invitecxx . . $ pvpgn/t_client_arrangedteam_accept_invite#)) {
2838 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad ARRANGEDTEAM_ACCEPT_INVITE packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_arrangedteam_accept_invitecxx . . $ pvpgn/t_client_arrangedteam_accept_invite#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
2839 return -1;
2840 }
2841 /* conn_set_channel(c, "Arranged Teams"); */
2842 return 0;
2843 }
2844
2845 typedef structcxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5# {
2846 t_connection *ccxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#c.;
2847 unsigned lnewscxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#lnews.;
2848 unsigned fnewscxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#fnews.;
2849 } t_motd_datacxx . . $ pvpgn/bnetd/t_motd_data#;
2850
2851 static int _news_cbcxx . . $ pvpgn/bnetd/_news_cb(7fa8c71bb12462fa).(stdcxx . . $ std/::time_tcxx . . $ std/time_t# date, t_lstr * lstr, void *data)
2852 {
2853 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
2854 t_motd_datacxx . . $ pvpgn/bnetd/t_motd_data# *motdd = (t_motd_datacxx . . $ pvpgn/bnetd/t_motd_data# *)data;
2855
2856 if (date < motdd->lnewscxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#lnews.)
2857 return -1; /* exit traversing */
2858
2859 rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
2860 if (!rpacket)
2861 return -1;
2862
2863 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_motd_w3cxx . . $ pvpgn/t_server_motd_w3#));
2864 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_MOTD_W3cxx . . $ `src/common/bnet_protocol.h:1603:9`!);
2865
2866 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_motd_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_motd_w3..msgtypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_67#msgtype., SERVER_MOTD_W3_MSGTYPEcxx . . $ `src/common/bnet_protocol.h:1617:9`!);
2867 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_motd_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_motd_w3..curr_timecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_67#curr_time., nowcxx . . $ pvpgn/bnetd/now.);
2868
2869 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_motd_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_motd_w3..first_news_timecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_67#first_news_time., motdd->fnewscxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#fnews.);
2870 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_motd_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_motd_w3..timestampcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_67#timestamp., date);
2871 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_motd_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_motd_w3..timestamp2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_67#timestamp2., date);
2872
2873 /* Append news to packet, we used the already cached len in the lstr */
2874 packet_append_lstrcxx . . $ pvpgn/packet_append_lstr(acd36b86cb91fbd0).(rpacket, lstr);
2875
2876 /* Send news packet */
2877 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(motdd->ccxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#c., rpacket);
2878 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2879
2880 return 0;
2881 }
2882
2883 // motd for warcraft 3 (http://img21.imageshack.us/img21/1808/j2py.png)
2884 static int _client_motdw3cxx . . $ pvpgn/bnetd/_client_motdw3(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2885 {
2886 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
2887 t_clienttagcxx . . $ pvpgn/t_clienttag# ctag;
2888 t_motd_datacxx . . $ pvpgn/bnetd/t_motd_data# motdd;
2889
2890 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_motd_w3cxx . . $ pvpgn/t_client_motd_w3#)) {
2891 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLIENT_MOTD_W3 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_motd_w3cxx . . $ pvpgn/t_client_motd_w3#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
2892 return -1;
2893 }
2894
2895 ctag = conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c);
2896 /* if in a game, remove user from his game */
2897 if (conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
2898 conn_set_gamecxx . . $ pvpgn/bnetd/conn_set_game(6346b62fdc8e3894).(c, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, game_type_none, 0);
2899
2900 /* News */
2901 motdd.lnewscxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#lnews. = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_motd_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_motd_w3..last_news_timecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_66#last_news_time.);
2902 motdd.fnewscxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#fnews. = news_get_firstnewscxx . . $ pvpgn/bnetd/news_get_firstnews(db52760e79bf9054).();
2903 motdd.ccxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#c. = c;
2904
2905 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "lastnews() {} news_time {}", news_get_lastnewscxx . . $ pvpgn/bnetd/news_get_lastnews(db52760e79bf9054).(), motdd.lnewscxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#lnews.);
2906 news_traversecxx . . $ pvpgn/bnetd/news_traverse(161353baa9c5a8aa).(_news_cbcxx . . $ pvpgn/bnetd/_news_cb(7fa8c71bb12462fa)., &motdd);
2907
2908 /* Welcome Message */
2909 rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
2910 if (!rpacket)
2911 return -1;
2912
2913 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_motd_w3cxx . . $ pvpgn/t_server_motd_w3#));
2914 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_MOTD_W3cxx . . $ `src/common/bnet_protocol.h:1603:9`!);
2915
2916 //bn_int_set(&rpacket->u.server_motd_w3.ticks,get_ticks());
2917 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_motd_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_motd_w3..msgtypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_67#msgtype., SERVER_MOTD_W3_MSGTYPEcxx . . $ `src/common/bnet_protocol.h:1617:9`!);
2918 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_motd_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_motd_w3..curr_timecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_67#curr_time., nowcxx . . $ pvpgn/bnetd/now.);
2919 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_motd_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_motd_w3..first_news_timecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_67#first_news_time., motdd.fnewscxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#fnews.);
2920 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_motd_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_motd_w3..timestampcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_67#timestamp., motdd.fnewscxx . . $ pvpgn/bnetd/$anonymous_type_879cd17f20686330_5#fnews. + 1);
2921 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_motd_w3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_motd_w3..timestamp2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_67#timestamp2., SERVER_MOTD_W3_WELCOMEcxx . . $ `src/common/bnet_protocol.h:1618:9`!);
2922
2923
2924 // read text from bnmotd_w3.txt
2925 {
2926 fmtcxx . . $ fmt/::MemoryWritercxx . . $ fmt/MemoryWriter# serverinfocxx . . $ fmt/BasicMemoryWriter#BasicMemoryWriter(3496de05b827211c).;
2927
2928 stdcxx . . $ std/::stringcxx . . $ std/string# filename = i18n_filenamecxx . . $ pvpgn/bnetd/i18n_filename(caf975da75400ef4).(prefs_get_motdw3filecxx . . $ pvpgn/bnetd/prefs_get_motdw3file(33a1f659e94feb42).(), conn_get_gamelang_localizedcxx . . $ pvpgn/bnetd/conn_get_gamelang_localized(c9be5e844f0af884).(c));
2929 stdcxx . . $ std/::FILEcxx . . $ std/FILE#* fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(filename.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "r");
2930 if (fp)
2931 {
2932 while (char* buff = file_get_linecxx . . $ pvpgn/file_get_line(e31226b218f63160).(fp))
2933 {
2934 char* line = message_format_linecxx . . $ pvpgn/bnetd/message_format_line(5f0435c1df2b4fd).(c, buff);
2935 serverinfo <<cxx . . $ fmt/BasicWriter#`operator<<`(c7404e572fb3e3df). (cxx . . $ fmt/BasicStringRef#BasicStringRef(88376428bb603c08).line + 1) <<cxx . . $ fmt/BasicWriter#`operator<<`(5d63ba784f8cac6). '\n';
2936 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void*)line);
2937 }
2938
2939 if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp) == EOFcxx . . $ `<external>/232824719582829767/stdio.h:105:9`!)
2940 {
2941 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not close motdw3 file \"{}\" after reading (std::fopen: {})", filename, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
2942 }
2943 }
2944 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, serverinfo.c_strcxx . . $ fmt/BasicWriter#c_str(1016ee5406d91ab9).());
2945 }
2946
2947 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
2948 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2949
2950 return 0;
2951 }
2952
2953 static int _client_realmlistreqcxx . . $ pvpgn/bnetd/_client_realmlistreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2954 {
2955 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
2956
2957 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_realmlistreqcxx . . $ pvpgn/t_client_realmlistreq#)) {
2958 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad REALMLISTREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_realmlistreqcxx . . $ pvpgn/t_client_realmlistreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
2959 return -1;
2960 }
2961
2962 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
2963 t_elem const *curr;
2964 t_realmcxx . . $ pvpgn/bnetd/t_realm# const *realm;
2965 t_server_realmlistreply_datacxx . . $ pvpgn/t_server_realmlistreply_data# realmdata;
2966 unsigned int count;
2967
2968 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_realmlistreplycxx . . $ pvpgn/t_server_realmlistreply#));
2969 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_REALMLISTREPLYcxx . . $ `src/common/bnet_protocol.h:1250:9`!);
2970 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmlistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmlistreply..unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_55#unknown1., SERVER_REALMLISTREPLY_UNKNOWN1cxx . . $ `src/common/bnet_protocol.h:1258:9`!);
2971 count = 0;
2972 LIST_TRAVERSE_CONSTcxx . . $ `src/common/list.h:95:9`!(realmlist(), curr) {
2973 realm = (t_realmcxx . . $ pvpgn/bnetd/t_realm#*)elem_get_datacxx . . $ pvpgn/elem_get_data(317ff0e7f02bf2b).(curr);
2974 if (!realm_get_activecxx . . $ pvpgn/bnetd/realm_get_active(d125a4483a7f736b).(realm))
2975 continue;
2976 bn_int_set(&realmdata.unknown3cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_56#unknown3., SERVER_REALMLISTREPLY_DATA_UNKNOWN3cxx . . $ `src/common/bnet_protocol.h:1272:9`!);
2977 bn_int_set(&realmdata.unknown4cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_56#unknown4., SERVER_REALMLISTREPLY_DATA_UNKNOWN4cxx . . $ `src/common/bnet_protocol.h:1273:9`!);
2978 bn_int_set(&realmdata.unknown5cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_56#unknown5., SERVER_REALMLISTREPLY_DATA_UNKNOWN5cxx . . $ `src/common/bnet_protocol.h:1274:9`!);
2979 bn_int_set(&realmdata.unknown6cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_56#unknown6., SERVER_REALMLISTREPLY_DATA_UNKNOWN6cxx . . $ `src/common/bnet_protocol.h:1275:9`!);
2980 bn_int_set(&realmdata.unknown7cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_56#unknown7., SERVER_REALMLISTREPLY_DATA_UNKNOWN7cxx . . $ `src/common/bnet_protocol.h:1276:9`!);
2981 bn_int_set(&realmdata.unknown8cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_56#unknown8., SERVER_REALMLISTREPLY_DATA_UNKNOWN8cxx . . $ `src/common/bnet_protocol.h:1277:9`!);
2982 bn_int_set(&realmdata.unknown9cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_56#unknown9., SERVER_REALMLISTREPLY_DATA_UNKNOWN9cxx . . $ `src/common/bnet_protocol.h:1278:9`!);
2983 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &realmdata, sizeof(realmdata));
2984 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, realm_get_namecxx . . $ pvpgn/bnetd/realm_get_name(83f045398bcf2fc5).(realm));
2985 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, realm_get_descriptioncxx . . $ pvpgn/bnetd/realm_get_description(83f045398bcf2fc5).(realm));
2986 count++;
2987 }
2988 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmlistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmlistreply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_55#count., count);
2989 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
2990 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
2991 }
2992
2993 return 0;
2994 }
2995
2996 static int _client_realmlistreq110cxx . . $ pvpgn/bnetd/_client_realmlistreq110(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
2997 {
2998 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
2999
3000 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_realmlistreq_110cxx . . $ pvpgn/t_client_realmlistreq_110#)) {
3001 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad REALMLISTREQ_110 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_realmlistreqcxx . . $ pvpgn/t_client_realmlistreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3002 return -1;
3003 }
3004
3005 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
3006 t_elem const *curr;
3007 t_realmcxx . . $ pvpgn/bnetd/t_realm# const *realm;
3008 t_server_realmlistreply_110_datacxx . . $ pvpgn/t_server_realmlistreply_110_data# realmdata;
3009 unsigned int count;
3010
3011 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_realmlistreply_110cxx . . $ pvpgn/t_server_realmlistreply_110#));
3012 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_REALMLISTREPLY_110cxx . . $ `src/common/bnet_protocol.h:1290:9`!);
3013 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmlistreply_110cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmlistreply_110..unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_57#unknown1., SERVER_REALMLISTREPLY_110_UNKNOWN1cxx . . $ `src/common/bnet_protocol.h:1299:9`!);
3014 count = 0;
3015 LIST_TRAVERSE_CONSTcxx . . $ `src/common/list.h:95:9`!(realmlist(), curr) {
3016 realm = (t_realmcxx . . $ pvpgn/bnetd/t_realm#*)elem_get_datacxx . . $ pvpgn/elem_get_data(317ff0e7f02bf2b).(curr);
3017 if (!realm_get_activecxx . . $ pvpgn/bnetd/realm_get_active(d125a4483a7f736b).(realm))
3018 continue;
3019 bn_int_set(&realmdata.unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_58#unknown1., SERVER_REALMLISTREPLY_110_DATA_UNKNOWN1cxx . . $ `src/common/bnet_protocol.h:1307:9`!);
3020 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &realmdata, sizeof(realmdata));
3021 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, realm_get_namecxx . . $ pvpgn/bnetd/realm_get_name(83f045398bcf2fc5).(realm));
3022 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, realm_get_descriptioncxx . . $ pvpgn/bnetd/realm_get_description(83f045398bcf2fc5).(realm));
3023 count++;
3024 }
3025 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmlistreply_110cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmlistreply_110..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_57#count., count);
3026 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3027 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3028 }
3029
3030 return 0;
3031 }
3032
3033 static int _client_claninforeqcxx . . $ pvpgn/bnetd/_client_claninforeq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3034 {
3035 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
3036 int count;
3037 char const *username;
3038 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
3039 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *clanmember;
3040 t_clancxx . . $ pvpgn/bnetd/t_clan# *clan;
3041 t_clantagcxx . . $ pvpgn/bnetd/t_clantag# clantag1, clantag2;
3042
3043 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_claninforeqcxx . . $ pvpgn/t_client_claninforeq#)) {
3044 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLANINFOREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_claninforeqcxx . . $ pvpgn/t_client_claninforeq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3045 return -1;
3046 }
3047
3048 count = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_claninforeqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_claninforeq..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_147#count.);
3049 clantag1 = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_claninforeqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_claninforeq..clantagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_147#clantag.);
3050 clan = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
3051
3052 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_claninforeqcxx . . $ pvpgn/t_client_claninforeq#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
3053 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLANINFOREQ (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3054 return -1;
3055 }
3056
3057 if (!(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username))) {
3058 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "requested claninfo for non-existant account");
3059 return -1;
3060 }
3061
3062 if ((clanmember = account_get_clanmembercxx . . $ pvpgn/bnetd/account_get_clanmember(4ce48d4e65930331).(account)) && (clan = clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(clanmember)))
3063 clantag2 = clan_get_clantagcxx . . $ pvpgn/bnetd/clan_get_clantag(1e16ca1cec114489).(clan);
3064 else
3065 clantag2 = 0;
3066
3067 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
3068 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_claninforeplycxx . . $ pvpgn/t_server_claninforeply#));
3069 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLANINFOREPLYcxx . . $ `src/common/bnet_protocol.h:3695:9`!);
3070 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_profilereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_profilereply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_60#count., count);
3071 if (clantag1 == clantag2) {
3072 t_bnettimecxx . . $ pvpgn/t_bnettime# bn_time;
3073 bn_longcxx . . $ pvpgn/bn_long# ltime;
3074
3075 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_claninforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_claninforeply..failcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_148#fail., 0);
3076
3077 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, clan_get_namecxx . . $ pvpgn/bnetd/clan_get_name(49ae76a143b2b3).(clan));
3078 char status = clanmember_get_statuscxx . . $ pvpgn/bnetd/clanmember_get_status(54878624261d8c60).(clanmember);
3079 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &status, 1);
3080 stdcxx . . $ std/::time_tcxx . . $ std/time_t# temp = clanmember_get_join_timecxx . . $ pvpgn/bnetd/clanmember_get_join_time(eb10b27a016fad21).(clanmember);
3081 bn_time =cxx . . $ pvpgn/$anonymous_type_c83edbf674c01669_0#`operator=`(372276d12cbccf26). time_to_bnettimecxx . . $ pvpgn/time_to_bnettime(f96d2c3d06d968c9).(temp, 0);
3082 bn_time =cxx . . $ pvpgn/$anonymous_type_c83edbf674c01669_0#`operator=`(372276d12cbccf26). bnettime_add_tzbiascxx . . $ pvpgn/bnettime_add_tzbias(f1f1310dc900a45f).(bn_time, -conn_get_tzbiascxx . . $ pvpgn/bnetd/conn_get_tzbias(b5160de3e9803af4).(c));
3083 bnettime_to_bn_longcxx . . $ pvpgn/bnettime_to_bn_long(5cee0b6c516bd57b).(bn_time, &ltime);
3084 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &ltime, 8);
3085 }
3086 else
3087 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_claninforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_claninforeply..failcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_148#fail., 1);
3088
3089
3090 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3091 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3092 }
3093
3094 return 0;
3095 }
3096
3097 static int _client_profilereqcxx . . $ pvpgn/bnetd/_client_profilereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3098 {
3099 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
3100 int count;
3101 char const *username;
3102 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
3103 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *clanmember;
3104 t_clancxx . . $ pvpgn/bnetd/t_clan# *clan;
3105 bn_intcxx . . $ pvpgn/bn_int# clanTAG;
3106
3107 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_profilereqcxx . . $ pvpgn/t_client_profilereq#)) {
3108 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad PROFILEREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_profilereqcxx . . $ pvpgn/t_client_profilereq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3109 return -1;
3110 }
3111
3112 count = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_profilereqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_profilereq..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_59#count.);
3113
3114 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_profilereqcxx . . $ pvpgn/t_client_profilereq#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
3115 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad PROFILEREQ (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3116 return -1;
3117 }
3118
3119 if (!(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username))) {
3120 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "requested profile for non-existant account");
3121 return -1;
3122 }
3123 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
3124 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_profilereplycxx . . $ pvpgn/t_server_profilereply#));
3125 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_PROFILEREPLYcxx . . $ `src/common/bnet_protocol.h:1319:9`!);
3126 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_profilereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_profilereply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_60#count., count);
3127 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_profilereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_profilereply..failcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_60#fail., 0);
3128 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, account_get_desccxx . . $ pvpgn/bnetd/account_get_desc(d4e1318117ac9d0e).(account).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
3129 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, account_get_loccxx . . $ pvpgn/bnetd/account_get_loc(d4e1318117ac9d0e).(account).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
3130 if ((clanmember = account_get_clanmembercxx . . $ pvpgn/bnetd/account_get_clanmember(4ce48d4e65930331).(account)) && (clan = clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(clanmember)))
3131 bn_int_set(&clanTAG, clan_get_clantagcxx . . $ pvpgn/bnetd/clan_get_clantag(1e16ca1cec114489).(clan));
3132 else
3133 bn_int_set(&clanTAG, 0);
3134 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, clanTAG, 4);
3135
3136 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3137 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3138 }
3139
3140 return 0;
3141 }
3142
3143
3144 static int _client_realmjoinreq109cxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3145 {
3146 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
3147
3148 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_realmjoinreq_109cxx . . $ pvpgn/t_client_realmjoinreq_109#)) {
3149 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad REALMJOINREQ_109 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_realmjoinreq_109cxx . . $ pvpgn/t_client_realmjoinreq_109#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3150 return -1;
3151 }
3152
3153 {
3154 char const *realmname;
3155 t_realmcxx . . $ pvpgn/bnetd/t_realm# *realm;
3156
3157 if (!(realmname = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_realmjoinreq_109cxx . . $ pvpgn/t_client_realmjoinreq_109#), MAX_REALMNAME_LENcxx . . $ MAX_REALMNAME_LEN.))) {
3158 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad REALMJOINREQ_109 (missing or too long realmname)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3159 return -1;
3160 }
3161
3162 if ((realm = realmlist_find_realmcxx . . $ pvpgn/bnetd/realmlist_find_realm(8fe5f3fa56e7fb14).(realmname))) {
3163 unsigned int salt;
3164 structcxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).$anonymous_type_6# {
3165 bn_intcxx . . $ pvpgn/bn_int# saltcxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).$anonymous_type_6#salt.;
3166 bn_intcxx . . $ pvpgn/bn_int# sessionkeycxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).$anonymous_type_6#sessionkey.;
3167 bn_intcxx . . $ pvpgn/bn_int# sessionnumcxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).$anonymous_type_6#sessionnum.;
3168 bn_intcxx . . $ pvpgn/bn_int# secretcxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).$anonymous_type_6#secret.;
3169 bn_intcxx . . $ pvpgn/bn_int# passhashcxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).$anonymous_type_6#passhash.[5];
3170 } temp;
3171 char const *pass_str;
3172 t_hashcxx . . $ pvpgn/t_hash# secret_hash;
3173 t_hashcxx . . $ pvpgn/t_hash# passhash;
3174 t_realmcxx . . $ pvpgn/bnetd/t_realm# *prev_realm;
3175
3176 /* FIXME: should we only set this after they log in to the realm server? */
3177 prev_realm = conn_get_realmcxx . . $ pvpgn/bnetd/conn_get_realm(c743a4e7d4d1463d).(c);
3178 if (prev_realm) {
3179 if (prev_realm != realm) {
3180 realm_add_player_numbercxx . . $ pvpgn/bnetd/realm_add_player_number(776df6f6ee711b79).(realm, 1);
3181 realm_add_player_numbercxx . . $ pvpgn/bnetd/realm_add_player_number(776df6f6ee711b79).(prev_realm, -1);
3182 conn_set_realmcxx . . $ pvpgn/bnetd/conn_set_realm(1e8eed0f1b1019dc).(c, realm);
3183 }
3184 }
3185 else {
3186 realm_add_player_numbercxx . . $ pvpgn/bnetd/realm_add_player_number(776df6f6ee711b79).(realm, 1);
3187 conn_set_realmcxx . . $ pvpgn/bnetd/conn_set_realm(1e8eed0f1b1019dc).(c, realm);
3188 }
3189
3190 if ((pass_str = account_get_passcxx . . $ pvpgn/bnetd/account_get_pass(4b37305d4a4563d0).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)))) {
3191 if (hash_set_strcxx . . $ pvpgn/hash_set_str(bc9a1c18029b2ef4).(&passhash, pass_str) == 0) {
3192 hash_to_bnhashcxx . . $ pvpgn/hash_to_bnhash(50eab12f45c1086c).((t_hashcxx . . $ pvpgn/t_hash# const *)&passhash, temp.passhashcxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).$anonymous_type_6#passhash.);
3193 salt = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_realmjoinreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_realmjoinreq_109..seqnocxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_137#seqno.);
3194 bn_int_set(&temp.saltcxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).$anonymous_type_6#salt., salt);
3195 bn_int_set(&temp.sessionkeycxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).$anonymous_type_6#sessionkey., conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(c));
3196 bn_int_set(&temp.sessionnumcxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).$anonymous_type_6#sessionnum., conn_get_sessionnumcxx . . $ pvpgn/bnetd/conn_get_sessionnum(8bd2285a65940781).(c));
3197 bn_int_set(&temp.secretcxx . . $ pvpgn/bnetd/_client_realmjoinreq109(8d07eb83d60bed1d).$anonymous_type_6#secret., conn_get_secretcxx . . $ pvpgn/bnetd/conn_get_secret(8bd2285a65940781).(c));
3198 bnet_hashcxx . . $ pvpgn/bnet_hash(2a8392f275be648).(&secret_hash, sizeof(temp), &temp);
3199
3200 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
3201 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_realmjoinreply_109cxx . . $ pvpgn/t_server_realmjoinreply_109#));
3202 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_REALMJOINREPLY_109cxx . . $ `src/common/bnet_protocol.h:3595:9`!);
3203 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..seqnocxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#seqno., salt);
3204 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..u1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#u1., 0x0);
3205 bn_short_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..u3cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#u3., 0x0); /* reg auth */
3206 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..bncs_addr1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#bncs_addr1., 0x0);
3207 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..sessionnumcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#sessionnum., conn_get_sessionnumcxx . . $ pvpgn/bnetd/conn_get_sessionnum(8bd2285a65940781).(c));
3208 { /* trans support */
3209 unsigned int addr = realm_get_ipcxx . . $ pvpgn/bnetd/realm_get_ip(d125a4483a7f736b).(realm);
3210 unsigned short port = realm_get_portcxx . . $ pvpgn/bnetd/realm_get_port(c87eeef7d816c78d).(realm);
3211
3212 trans_netcxx . . $ pvpgn/trans_net(cf0ba8ec647fd542).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(c), &addr, &port);
3213
3214 bn_int_nset(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..addrcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#addr., addr);
3215 bn_short_nset(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..portcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#port., port);
3216 }
3217 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#sessionkey., conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(c));
3218 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..u5cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#u5., 0);
3219 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..u6cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#u6., 0);
3220 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..bncs_addr2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#bncs_addr2., 0);
3221 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..u7cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#u7., 0);
3222 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..versionidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#versionid., conn_get_versionidcxx . . $ pvpgn/bnetd/conn_get_versionid(3fda5c23f1f5e239).(c));
3223 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#clienttag., conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c));
3224 hash_to_bnhashcxx . . $ pvpgn/hash_to_bnhash(50eab12f45c1086c).((t_hashcxx . . $ pvpgn/t_hash# const *)&secret_hash, rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..secret_hashcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#secret_hash.); /* avoid warning */
3225 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
3226 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3227 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3228 }
3229 return 0;
3230 }
3231 else
3232 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] realm join for \"{}\" failed (unable to hash password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(c));
3233 }
3234 else {
3235 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] realm join for \"{}\" failed (no password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(c));
3236 }
3237 }
3238 else
3239 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] could not find active realm \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), realmname);
3240
3241 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
3242 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_realmjoinreply_109cxx . . $ pvpgn/t_server_realmjoinreply_109#));
3243 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_REALMJOINREPLY_109cxx . . $ `src/common/bnet_protocol.h:3595:9`!);
3244 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..seqnocxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#seqno., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_realmjoinreq_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_realmjoinreq_109..seqnocxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_137#seqno.));
3245 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..u1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#u1., 0);
3246 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..sessionnumcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#sessionnum., 0);
3247 bn_short_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..u3cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#u3., 0);
3248 bn_int_nset(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..addrcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#addr., 0);
3249 bn_short_nset(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..portcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#port., 0);
3250 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..sessionkeycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#sessionkey., 0);
3251 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..u5cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#u5., 0);
3252 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..u6cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#u6., 0);
3253 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..u7cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#u7., 0);
3254 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..bncs_addr1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#bncs_addr1., 0);
3255 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..bncs_addr2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#bncs_addr2., 0);
3256 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..versionidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#versionid., 0);
3257 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#clienttag., 0);
3258 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..secret_hashcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#secret_hash.[0], 0);
3259 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..secret_hashcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#secret_hash.[1], 0);
3260 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..secret_hashcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#secret_hash.[2], 0);
3261 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..secret_hashcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#secret_hash.[3], 0);
3262 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_realmjoinreply_109cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_realmjoinreply_109..secret_hashcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_138#secret_hash.[4], 0);
3263 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
3264 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3265 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3266 }
3267 }
3268
3269 return 0;
3270 }
3271
3272 static int _client_charlistreqcxx . . $ pvpgn/bnetd/_client_charlistreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3273 {
3274 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
3275
3276 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_unknown_37cxx . . $ pvpgn/t_client_unknown_37#)) {
3277 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad UNKNOWN_37 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_unknown_37cxx . . $ pvpgn/t_client_unknown_37#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3278 return -1;
3279 }
3280 /*
3281 0x0070: 83 80 ff ff ff ff ff 2f t,taran,......./
3282 0x0080: ff ff ff ff ff ff ff ff ff ff 03 ff ff ff ff ff ................
3283 0x0090: ff ff ff ff ff ff ff ff ff ff ff 07 80 80 80 80 ................
3284 0x00a0: ff ff ff 00
3285 */
3286 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
3287 char const *charlist;
3288 char *temp;
3289
3290 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_unknown_37cxx . . $ pvpgn/t_server_unknown_37#));
3291 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_UNKNOWN_37cxx . . $ `src/common/bnet_protocol.h:1404:9`!);
3292 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_unknown_37cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_unknown_37..unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_62#unknown1., SERVER_UNKNOWN_37_UNKNOWN1cxx . . $ `src/common/bnet_protocol.h:1415:9`!);
3293 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_unknown_37cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_unknown_37..unknown2cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_62#unknown2., SERVER_UNKNOWN_37_UNKNOWN2cxx . . $ `src/common/bnet_protocol.h:1416:9`!);
3294
3295 if (!(charlist = account_get_closed_characterlistcxx . . $ pvpgn/bnetd/account_get_closed_characterlist(9626b5ecd71611).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), realm_get_namecxx . . $ pvpgn/bnetd/realm_get_name(83f045398bcf2fc5).(conn_get_realmcxx . . $ pvpgn/bnetd/conn_get_realm(c743a4e7d4d1463d).(c))))) {
3296 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_unknown_37cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_unknown_37..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_62#count., 0);
3297 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3298 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3299 return 0;
3300 }
3301 temp = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(charlist);
3302
3303 {
3304 char const *tok1;
3305 char const *tok2;
3306 t_character const *ch;
3307 unsigned int count;
3308
3309 count = 0;
3310 tok1 = (char const *)stdcxx . . $ std/::strtok(temp, ","); /* std::strtok modifies the string it is passed */
3311 tok2 = stdcxx . . $ std/::strtok(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, ",");
3312 while (tok1) {
3313 if (!tok2) {
3314 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] account \"{}\" has bad character list \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c), temp);
3315 break;
3316 }
3317
3318 if ((ch = characterlist_find_charactercxx . . $ pvpgn/bnetd/characterlist_find_character(145ff0e0c6ef3f48).(tok1, tok2))) {
3319 packet_append_ntstringcxx . . $ pvpgn/packet_append_ntstring(41801851180b7cbb).(rpacket, character_get_realmnamecxx . . $ pvpgn/bnetd/character_get_realmname(4383355f43ab5a1b).(ch));
3320 packet_append_ntstringcxx . . $ pvpgn/packet_append_ntstring(41801851180b7cbb).(rpacket, ",");
3321 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, character_get_namecxx . . $ pvpgn/bnetd/character_get_name(4383355f43ab5a1b).(ch));
3322 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, character_get_playerinfocxx . . $ pvpgn/bnetd/character_get_playerinfo(4383355f43ab5a1b).(ch));
3323 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, character_get_guildnamecxx . . $ pvpgn/bnetd/character_get_guildname(4383355f43ab5a1b).(ch));
3324 count++;
3325 }
3326 else
3327 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] character \"{}\" is missing", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), tok2);
3328 tok1 = stdcxx . . $ std/::strtok(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, ",");
3329 tok2 = stdcxx . . $ std/::strtok(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, ",");
3330 }
3331 xfreecxx . . $ `src/common/xalloc.h:51:9`!(temp);
3332
3333 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_unknown_37cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_unknown_37..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_62#count., count);
3334 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3335 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3336 }
3337 }
3338
3339 return 0;
3340 }
3341
3342 static int _client_unknown39cxx . . $ pvpgn/bnetd/_client_unknown39(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3343 {
3344 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_unknown_39cxx . . $ pvpgn/t_client_unknown_39#)) {
3345 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad UNKNOWN_39 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_unknown_39cxx . . $ pvpgn/t_client_unknown_39#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3346 return -1;
3347 }
3348 return 0;
3349 }
3350
3351 static int _client_adreqcxx . . $ pvpgn/bnetd/_client_adreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3352 {
3353 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_adreqcxx . . $ pvpgn/t_client_adreq#))
3354 {
3355 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad ADREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_adreqcxx . . $ pvpgn/t_client_adreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3356 return -1;
3357 }
3358
3359 /*
3360 eventlog(eventlog_level_debug, __FUNCTION__, "[%d] SID_CHECKAD { %d %d %d %d }", conn_get_socket(c), bn_int_get(packet->u.client_adreq.archtag),
3361 bn_int_get(packet->u.client_adreq.clienttag), bn_int_get(packet->u.client_adreq.prev_adid), bn_int_get(packet->u.client_adreq.ticks));
3362 */
3363
3364 const AdBannercxx . . $ pvpgn/bnetd/AdBanner#* ad = AdBannerListcxx . . $ pvpgn/bnetd/AdBannerList..pickcxx . . $ pvpgn/bnetd/AdBannerSelector#pick(2a7ca6d499ed1eb7).(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), conn_get_gamelangcxx . . $ pvpgn/bnetd/conn_get_gamelang(8bd2285a65940781).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_adreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_adreq..prev_adidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_116#prev_adid.));
3365 if (!ad)
3366 {
3367 return 0;
3368 }
3369
3370 t_packetcxx . . $ pvpgn/t_packet#* const rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
3371 if (!rpacket)
3372 {
3373 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "Could not create a packet");
3374 return -1;
3375 }
3376 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_adreplycxx . . $ pvpgn/t_server_adreply#));
3377 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_ADREPLYcxx . . $ `src/common/bnet_protocol.h:3189:9`!);
3378 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_adreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_adreply..adidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_117#adid., ad->get_idcxx . . $ pvpgn/bnetd/AdBanner#get_id(c9b1e749b64d5edc).());
3379 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_adreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_adreply..extensiontagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_117#extensiontag., ad->get_extension_tagcxx . . $ pvpgn/bnetd/AdBanner#get_extension_tag(d22c8608b6eae7b5).());
3380 file_to_mod_timecxx . . $ pvpgn/bnetd/file_to_mod_time(58ff0399a75a534d).(c, ad->get_filenamecxx . . $ pvpgn/bnetd/AdBanner#get_filename(a9df4fea84f883e).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), &rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_adreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_adreply..timestampcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_117#timestamp.);
3381 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, ad->get_filenamecxx . . $ pvpgn/bnetd/AdBanner#get_filename(a9df4fea84f883e).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
3382 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, ad->get_urlcxx . . $ pvpgn/bnetd/AdBanner#get_url(a9df4fea84f883e).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
3383 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3384 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3385
3386 return 0;
3387 }
3388
3389 static int _client_adackcxx . . $ pvpgn/bnetd/_client_adack(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3390 {
3391 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_adackcxx . . $ pvpgn/t_client_adack#)) {
3392 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad ADACK packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_adackcxx . . $ pvpgn/t_client_adack#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3393 return -1;
3394 }
3395
3396 /*
3397 {
3398 char const * tname;
3399
3400 eventlog(eventlog_level_info,__FUNCTION__,"[%d] ad acknowledgement for adid 0x%04x from \"%s\"",conn_get_socket(c),bn_int_get(packet->u.client_adack.adid),(tname = conn_get_chatname(c)));
3401 conn_unget_chatname(c,tname);
3402 }
3403 */
3404 return 0;
3405 }
3406
3407 static int _client_adclickcxx . . $ pvpgn/bnetd/_client_adclick(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3408 {
3409 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_adclickcxx . . $ pvpgn/t_client_adclick#)) {
3410 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad ADCLICK packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_adclickcxx . . $ pvpgn/t_client_adclick#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3411 return -1;
3412 }
3413
3414 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] ad click for adid 0x{:04x} from \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_adclickcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_adclick..adidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_119#adid.), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
3415
3416 return 0;
3417 }
3418
3419 static int _client_adclick2cxx . . $ pvpgn/bnetd/_client_adclick2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3420 {
3421 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_adclick2cxx . . $ pvpgn/t_client_adclick2#))
3422 {
3423 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad ADCLICK2 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_adclick2cxx . . $ pvpgn/t_client_adclick2#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3424 return -1;
3425 }
3426
3427 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "[{}] ad click2 for adid 0x{:04x} from \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_adclick2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_adclick2..adidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_120#adid.), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
3428
3429 const AdBannercxx . . $ pvpgn/bnetd/AdBanner#* const ad = AdBannerListcxx . . $ pvpgn/bnetd/AdBannerList..findcxx . . $ pvpgn/bnetd/AdBannerSelector#find(2a7ca6d499ed1eb7).(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), conn_get_gamelangcxx . . $ pvpgn/bnetd/conn_get_gamelang(8bd2285a65940781).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_adclick2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_adclick2..adidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_120#adid.));
3430 if (!ad)
3431 {
3432 return 0;
3433 }
3434
3435 t_packetcxx . . $ pvpgn/t_packet#* const rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.);
3436 if (!rpacket)
3437 {
3438 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "Could not create a packet");
3439 return -1;
3440 }
3441 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_adclickreply2cxx . . $ pvpgn/t_server_adclickreply2#));
3442 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_ADCLICKREPLY2cxx . . $ `src/common/bnet_protocol.h:3265:9`!);
3443 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_adclickreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_adclickreply2..adidcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_121#adid., ad->get_idcxx . . $ pvpgn/bnetd/AdBanner#get_id(c9b1e749b64d5edc).());
3444 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, ad->get_urlcxx . . $ pvpgn/bnetd/AdBanner#get_url(a9df4fea84f883e).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
3445 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3446 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3447
3448 return 0;
3449 }
3450
3451 static int _client_readmemorycxx . . $ pvpgn/bnetd/_client_readmemory(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3452 {
3453 unsigned int size, offset, request_id;
3454
3455 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_readmemorycxx . . $ pvpgn/t_client_readmemory#)) {
3456 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad READMEMORY packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_readmemorycxx . . $ pvpgn/t_client_readmemory#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3457 return -1;
3458 }
3459
3460 request_id = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_readmemorycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_readmemory..request_idcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_122#request_id.);
3461
3462 size = (unsigned int)packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet);
3463 offset = sizeof(t_client_readmemorycxx . . $ pvpgn/t_client_readmemory#);
3464
3465 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] Received READMEMORY packet with Request ID: {} and Memory size: {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), request_id, size - offset);
3466
3467 #ifdef WITH_LUA
3468 std::vector<int> _data;
3469 for (int i = offset; i < size; i++)
3470 {
3471 _data.push_back(packet->u.data[i]);
3472 }
3473 lua_handle_client_readmemory(c, request_id, _data);
3474 #endif
3475
3476 return 0;
3477 }
3478
3479 static int _client_statsupdatecxx . . $ pvpgn/bnetd/_client_statsupdate(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3480 {
3481 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_statsupdatecxx . . $ pvpgn/t_client_statsupdate#)) {
3482 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STATSUPDATE packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_statsupdatecxx . . $ pvpgn/t_client_statsupdate#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3483 return -1;
3484 }
3485
3486 {
3487 char const *name;
3488 char const *key;
3489 char const *val;
3490 unsigned int name_count;
3491 unsigned int key_count;
3492 unsigned int i, j;
3493 unsigned int name_off;
3494 unsigned int keys_off;
3495 unsigned int key_off;
3496 unsigned int vals_off;
3497 unsigned int val_off;
3498 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
3499
3500 name_count = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_statsupdatecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_statsupdate..name_countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_136#name_count.);
3501 key_count = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_statsupdatecxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_statsupdate..key_countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_136#key_count.);
3502
3503 if (name_count != 1)
3504 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "[{}] got suspicious STATSUPDATE packet (name_count={})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), name_count);
3505
3506 for (i = 0, name_off = sizeof(t_client_statsupdatecxx . . $ pvpgn/t_client_statsupdate#); i < name_count && (name = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, name_off, UNCHECKED_NAME_STRcxx . . $ UNCHECKED_NAME_STR.)); i++, name_off += stdcxx . . $ std/::strlen(name) + 1);
3507 if (i < name_count) {
3508 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STATSUPDATE packet (only {} names of {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), i, name_count);
3509 return -1;
3510 }
3511 keys_off = name_off;
3512
3513 for (i = 0, key_off = keys_off; i < key_count && (key = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, key_off, MAX_ATTRKEY_STRcxx . . $ MAX_ATTRKEY_STR.)); i++, key_off += stdcxx . . $ std/::strlen(key) + 1);
3514 if (i < key_count) {
3515 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STATSUPDATE packet (only {} keys of {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), i, key_count);
3516 return -1;
3517 }
3518 vals_off = key_off;
3519
3520 if ((account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c))) {
3521 if (account_get_auth_changeprofilecxx . . $ pvpgn/bnetd/account_get_auth_changeprofile(367bfb076f70247b).(account) == 0) { /* default to true */
3522 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] stats update for \"{}\" refused (no change profile access)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
3523 return -1;
3524 }
3525 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] updating player profile for \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
3526
3527 for (i = 0, name_off = sizeof(t_client_statsupdatecxx . . $ pvpgn/t_client_statsupdate#); i < name_count && (name = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, name_off, UNCHECKED_NAME_STRcxx . . $ UNCHECKED_NAME_STR.)); i++, name_off += stdcxx . . $ std/::strlen(name) + 1)
3528 for (j = 0, key_off = keys_off, val_off = vals_off; j < key_count && (key = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, key_off, MAX_ATTRKEY_STRcxx . . $ MAX_ATTRKEY_STR.)) && (val = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, val_off, MAX_ATTRVAL_STRcxx . . $ MAX_ATTRVAL_STR.)); j++, key_off += stdcxx . . $ std/::strlen(key) + 1, val_off += stdcxx . . $ std/::strlen(val) + 1)
3529 if (stdcxx . . $ std/::strlen(key) < 9 || strncasecmp(key, "profile\\", 8) != 0)
3530 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got STATSUPDATE with suspicious key \"{}\" value \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), key, val);
3531 else
3532 account_set_strattrcxx . . $ pvpgn/bnetd/account_set_strattr(47d7ee6351fa1de3).(account, key, val);
3533 }
3534 }
3535
3536 return 0;
3537 }
3538
3539 static int _client_playerinforeqcxx . . $ pvpgn/bnetd/_client_playerinforeq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3540 {
3541 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
3542
3543 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_playerinforeqcxx . . $ pvpgn/t_client_playerinforeq#)) {
3544 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad PLAYERINFOREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_playerinforeqcxx . . $ pvpgn/t_client_playerinforeq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3545 return -1;
3546 }
3547
3548 {
3549 char const *username;
3550 char const *info;
3551 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
3552
3553 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_playerinforeqcxx . . $ pvpgn/t_client_playerinforeq#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
3554 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad PLAYERINFOREQ (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3555 return -1;
3556 }
3557 if (!(info = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_playerinforeqcxx . . $ pvpgn/t_client_playerinforeq#)+stdcxx . . $ std/::strlen(username) + 1, MAX_PLAYERINFO_STRcxx . . $ MAX_PLAYERINFO_STR.))) {
3558 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad PLAYERINFOREQ (missing or too long info)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3559 return -1;
3560 }
3561
3562 if (info[0] != '\0')
3563 conn_set_playerinfocxx . . $ pvpgn/bnetd/conn_set_playerinfo(6b2655da947c846f).(c, info);
3564 if (!username[0])
3565 username = conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(c);
3566
3567 account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c);
3568
3569 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
3570 return -1;
3571 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_playerinforeplycxx . . $ pvpgn/t_server_playerinforeply#));
3572 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_PLAYERINFOREPLYcxx . . $ `src/common/bnet_protocol.h:2234:9`!);
3573
3574 if (account) {
3575 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, username);
3576 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, conn_get_playerinfocxx . . $ pvpgn/bnetd/conn_get_playerinfo(c99dbccf638f5c6).(c));
3577 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, username);
3578 }
3579 else {
3580 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
3581 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
3582 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
3583 }
3584 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3585 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3586 }
3587
3588 return 0;
3589 }
3590
3591 static int _client_progident2cxx . . $ pvpgn/bnetd/_client_progident2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3592 {
3593 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
3594
3595 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_progident2cxx . . $ pvpgn/t_client_progident2#)) {
3596 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad PROGIDENT2 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_progident2cxx . . $ pvpgn/t_client_progident2#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3597 return -1;
3598 }
3599
3600 /* d2 uses this packet with clienttag = 0 to request the channel list */
3601 if (bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progident2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident2..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_94#clienttag.)) {
3602 if (tag_check_in_list(bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progident2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident2..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_94#clienttag.), prefs_get_allowed_clientscxx . . $ pvpgn/bnetd/prefs_get_allowed_clients(33a1f659e94feb42).())) {
3603 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(c, conn_state_destroy);
3604 return 0;
3605 }
3606 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] CLIENT_PROGIDENT2 clienttag=0x{:08x}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progident2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident2..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_94#clienttag.));
3607
3608 /* Hmm... no archtag. Hope we get it in CLIENT_AUTHREQ1 (but we won't if we use the shortcut) */
3609
3610 conn_set_clienttagcxx . . $ pvpgn/bnetd/conn_set_clienttag(d97ad1b62a895b69).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_progident2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_progident2..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_94#clienttag.));
3611 }
3612
3613 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
3614 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_channellistcxx . . $ pvpgn/t_server_channellist#));
3615 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CHANNELLISTcxx . . $ `src/common/bnet_protocol.h:2321:9`!);
3616 {
3617 t_channelcxx . . $ pvpgn/bnetd/t_channel# *ch;
3618 t_elem const *curr;
3619
3620 LIST_TRAVERSE_CONSTcxx . . $ `src/common/list.h:95:9`!(channellist(), curr) {
3621 ch = (t_channelcxx . . $ pvpgn/bnetd/t_channel#*)elem_get_datacxx . . $ pvpgn/elem_get_data(317ff0e7f02bf2b).(curr);
3622 if ((!(channel_get_flagscxx . . $ pvpgn/bnetd/channel_get_flags(6768ecacf43d05ec).(ch) & channel_flags_clancxx . . $ pvpgn/bnetd/channel_flags_clan.)) && (!prefs_get_hide_temp_channelscxx . . $ pvpgn/bnetd/prefs_get_hide_temp_channels(db52760e79bf9054).() || channel_get_permanentcxx . . $ pvpgn/bnetd/channel_get_permanent(28c764f7c20ec9b2).(ch)) && (!channel_get_clienttagcxx . . $ pvpgn/bnetd/channel_get_clienttag(6768ecacf43d05ec).(ch) || channel_get_clienttagcxx . . $ pvpgn/bnetd/channel_get_clienttag(6768ecacf43d05ec).(ch) == conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c)) && (!(channel_get_flagscxx . . $ pvpgn/bnetd/channel_get_flags(6768ecacf43d05ec).(ch) & channel_flags_thevoidcxx . . $ pvpgn/bnetd/channel_flags_thevoid.)) && // don't display theVoid in channel list
3623 ((channel_get_maxcxx . . $ pvpgn/bnetd/channel_get_max(28c764f7c20ec9b2).(ch) != 0) || ((channel_get_maxcxx . . $ pvpgn/bnetd/channel_get_max(28c764f7c20ec9b2).(ch) == 0) && (account_is_operator_or_admincxx . . $ pvpgn/bnetd/account_is_operator_or_admin(4b12bc5edcfaeac7).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), channel_get_namecxx . . $ pvpgn/bnetd/channel_get_name(7800017c14723985).(ch)) == 1)))) // don't display restricted channel for no admins/ops
3624 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, channel_get_namecxx . . $ pvpgn/bnetd/channel_get_name(7800017c14723985).(ch));
3625 }
3626 }
3627 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
3628 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3629 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3630 }
3631
3632 return 0;
3633 }
3634
3635 static int _client_joinchannelcxx . . $ pvpgn/bnetd/_client_joinchannel(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3636 {
3637 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
3638 char const *cname;
3639 int found = 1;
3640 t_clancxx . . $ pvpgn/bnetd/t_clan# *user_clan;
3641 t_clantagcxx . . $ pvpgn/bnetd/t_clantag# clantag;
3642 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# clienttag;
3643 t_channelcxx . . $ pvpgn/bnetd/t_channel# *channel;
3644
3645 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_joinchannelcxx . . $ pvpgn/t_client_joinchannel#)) {
3646 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad JOINCHANNEL packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_joinchannelcxx . . $ pvpgn/t_client_joinchannel#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3647 return -1;
3648 }
3649
3650 account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c);
3651
3652 if (!(cname = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_joinchannelcxx . . $ pvpgn/t_client_joinchannel#), MAX_CHANNELNAME_LENcxx . . $ MAX_CHANNELNAME_LEN.))) {
3653 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad JOINCHANNEL (missing or too long cname)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3654 return -1;
3655 }
3656
3657 if ((channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(c)) && (strcasecmp(channel_get_namecxx . . $ pvpgn/bnetd/channel_get_name(7800017c14723985).(channel), cname) == 0))
3658 return 0; //we are already in this channel
3659
3660 stdcxx . . $ std/::stringcxx . . $ std/string# tmpstrcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
3661 clienttag = conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c);
3662 if ((clienttag == CLIENTTAG_WARCRAFT3_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:111:9`!) || (clienttag == CLIENTTAG_WAR3XP_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:113:9`!)) {
3663 conn_update_w3_playerinfocxx . . $ pvpgn/bnetd/conn_update_w3_playerinfo(c4dfbc2386fe4fc3).(c);
3664 switch (bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_joinchannelcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_joinchannel..channelflagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_95#channelflag.)) {
3665 case CLIENT_JOINCHANNEL_NORMALcxx . . $ `src/common/bnet_protocol.h:2314:9`!:
3666 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] CLIENT_JOINCHANNEL_NORMAL channel \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), cname);
3667
3668 if (prefs_get_ask_new_channelcxx . . $ pvpgn/bnetd/prefs_get_ask_new_channel(db52760e79bf9054).() && (!(channellist_find_channel_by_namecxx . . $ pvpgn/bnetd/channellist_find_channel_by_name(7177a8438ab16268).(cname, conn_get_countrycxx . . $ pvpgn/bnetd/conn_get_country(c99dbccf638f5c6).(c), realm_get_namecxx . . $ pvpgn/bnetd/realm_get_name(83f045398bcf2fc5).(conn_get_realmcxx . . $ pvpgn/bnetd/conn_get_realm(c743a4e7d4d1463d).(c)))))) {
3669 found = 0;
3670 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] didn't find channel \"{}\" to join", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), cname);
3671 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(c, message_type_channeldoesnotexistcxx . . $ pvpgn/bnetd/message_type_channeldoesnotexist., c, cname);
3672 }
3673 break;
3674 case CLIENT_JOINCHANNEL_GENERICcxx . . $ `src/common/bnet_protocol.h:2315:9`!:
3675
3676 if ((user_clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(account)) && (clantag = clan_get_clantagcxx . . $ pvpgn/bnetd/clan_get_clantag(1e16ca1cec114489).(user_clan)))
3677 {
3678 stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# ostrcxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).;
3679 ostr <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Clan " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). clantag_to_strcxx . . $ pvpgn/bnetd/clantag_to_str(81a3ae90da26a711).(clantag);
3680 tmpstr =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). ostr.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).();
3681 cname = tmpstr.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).();
3682 }
3683 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] CLIENT_JOINCHANNEL_GENERIC channel \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), cname);
3684
3685 /* don't have to do anything here */
3686 break;
3687 case CLIENT_JOINCHANNEL_CREATEcxx . . $ `src/common/bnet_protocol.h:2316:9`!:
3688 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] CLIENT_JOINCHANNEL_CREATE channel \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), cname);
3689 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] CLIENT_JOINCHANNEL_CREATE channel \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), cname);
3690 /* don't have to do anything here */
3691 break;
3692 }
3693
3694 if (found && conn_set_channelcxx . . $ pvpgn/bnetd/conn_set_channel(2e9022cda97b266d).(c, cname) < 0)
3695 conn_set_channelcxx . . $ pvpgn/bnetd/conn_set_channel(2e9022cda97b266d).(c, CHANNEL_NAME_BANNEDcxx . . $ `src/bnetd/channel.h:125:9`!); /* should not fail */
3696 }
3697 else {
3698
3699 // not W3
3700 if (conn_set_channelcxx . . $ pvpgn/bnetd/conn_set_channel(2e9022cda97b266d).(c, cname) < 0)
3701 conn_set_channelcxx . . $ pvpgn/bnetd/conn_set_channel(2e9022cda97b266d).(c, CHANNEL_NAME_BANNEDcxx . . $ `src/bnetd/channel.h:125:9`!); /* should not fail */
3702 }
3703 // here we set channel flags on user
3704 channel_set_userflagscxx . . $ pvpgn/bnetd/channel_set_userflags(c4dfbc2386fe4fc3).(c);
3705
3706 return 0;
3707 }
3708
3709 static int _client_messagecxx . . $ pvpgn/bnetd/_client_message(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3710 {
3711 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_messagecxx . . $ pvpgn/t_client_message#)) {
3712 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad MESSAGE packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_messagecxx . . $ pvpgn/t_client_message#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3713 return -1;
3714 }
3715
3716 {
3717 char const *text;
3718 t_channelcxx . . $ pvpgn/bnetd/t_channel# const *channel;
3719
3720 if (!(text = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_messagecxx . . $ pvpgn/t_client_message#), MAX_MESSAGE_LENcxx . . $ MAX_MESSAGE_LEN.))) {
3721 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad MESSAGE (missing or too long text)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3722 return -1;
3723 }
3724
3725 conn_set_idletimecxx . . $ pvpgn/bnetd/conn_set_idletime(c4dfbc2386fe4fc3).(c);
3726
3727 if ((channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(c)))
3728 channel_message_logcxx . . $ pvpgn/bnetd/channel_message_log(3119144774c93d10).(channel, c, 1, text);
3729 /* we don't log game commands currently */
3730
3731
3732
3733 if (text[0] == '/')
3734 handle_commandcxx . . $ pvpgn/bnetd/handle_command(2e9022cda97b266d).(c, text);
3735 else if (channel && !conn_quota_exceededcxx . . $ pvpgn/bnetd/conn_quota_exceeded(2e9022cda97b266d).(c, text))
3736 channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_talkcxx . . $ pvpgn/bnetd/message_type_talk., c, text);
3737 /* else discard */
3738 }
3739
3740 return 0;
3741 }
3742
3743 static int _glist_cbcxx . . $ pvpgn/bnetd/_glist_cb(7b7c187348591887).(t_game * game, void *data)
3744 {
3745 struct glist_cbdatacxx . . $ pvpgn/bnetd/glist_cbdata# *cbdata = (struct glist_cbdatacxx . . $ pvpgn/bnetd/glist_cbdata#*)data;
3746 char clienttag_str[5];
3747 t_server_gamelistreply_gamecxx . . $ pvpgn/t_server_gamelistreply_game# glgame;
3748 unsigned int addr;
3749 unsigned short port;
3750 bn_intcxx . . $ pvpgn/bn_int# game_spacer = { 1, 0, 0, 0 };
3751
3752 cbdata->tcountcxx . . $ pvpgn/bnetd/glist_cbdata#tcount.++;
3753 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] considering listing game=\"{}\", pass=\"{}\" clienttag=\"{}\" gtype={}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.), game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), game_get_passcxx . . $ pvpgn/bnetd/game_get_pass(743fb6d1aa411c4e).(game), tag_uint_to_str(clienttag_str, game_get_clienttagcxx . . $ pvpgn/bnetd/game_get_clienttag(d7b85b5cd2056731).(game)), (int)game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game));
3754
3755 if (prefs_get_hide_pass_gamescxx . . $ pvpgn/bnetd/prefs_get_hide_pass_games(db52760e79bf9054).() && game_get_flagcxx . . $ pvpgn/bnetd/game_get_flag(98b2c43fe55f6682).(game) == game_flag_private) {
3756 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] not listing because game is passworded or has private flag", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.));
3757 return 0;
3758 }
3759 if (prefs_get_hide_started_gamescxx . . $ pvpgn/bnetd/prefs_get_hide_started_games(db52760e79bf9054).() && game_get_statuscxx . . $ pvpgn/bnetd/game_get_status(e13bf945064795ea).(game) != game_status_open) {
3760 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] not listing because game is not open", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.));
3761 return 0;
3762 }
3763 if (game_get_clienttagcxx . . $ pvpgn/bnetd/game_get_clienttag(d7b85b5cd2056731).(game) != conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.)) {
3764 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] not listing because game is for a different client", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.));
3765 return 0;
3766 }
3767 if (cbdata->gtypecxx . . $ pvpgn/bnetd/glist_cbdata#gtype. != game_type_all && game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game) != cbdata->gtypecxx . . $ pvpgn/bnetd/glist_cbdata#gtype.) {
3768 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] not listing because game is wrong type", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.));
3769 return 0;
3770 }
3771 if (conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.) &&
3772 conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(game_get_ownercxx . . $ pvpgn/bnetd/game_get_owner(44263c0cd290cfb5).(game)) &&
3773 conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.)->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).() !=cxx . . $ std/`operator!=`(5ea818b58063a774). conn_get_versioncheckcxx . . $ pvpgn/bnetd/conn_get_versioncheck(314c35d933cb7240).(game_get_ownercxx . . $ pvpgn/bnetd/game_get_owner(44263c0cd290cfb5).(game))->get_version_tagcxx . . $ pvpgn/bnetd/VersionCheck#get_version_tag(219584694fe2b248).())
3774 {
3775 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] not listing because game is wrong versiontag", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.));
3776 return 0;
3777 }
3778
3779 bn_short_set(&glgame.gametypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#gametype., gtype_to_bngtypecxx . . $ pvpgn/bnetd/gtype_to_bngtype(721927292c512a57).(game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game)));
3780 bn_short_set(&glgame.unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#unknown1., SERVER_GAMELISTREPLY_GAME_UNKNOWN1cxx . . $ `src/common/bnet_protocol.h:2786:9`!);
3781 bn_short_set(&glgame.unknown3cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#unknown3., SERVER_GAMELISTREPLY_GAME_UNKNOWN3cxx . . $ `src/common/bnet_protocol.h:2787:9`!);
3782 addr = game_get_addrcxx . . $ pvpgn/bnetd/game_get_addr(d7b85b5cd2056731).(game);
3783 port = game_get_portcxx . . $ pvpgn/bnetd/game_get_port(5675c6bb4f2bafa6).(game);
3784 trans_netcxx . . $ pvpgn/trans_net(cf0ba8ec647fd542).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.), &addr, &port);
3785 bn_short_nset(&glgame.portcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#port., port);
3786 bn_int_nset(&glgame.game_ipcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#game_ip., addr);
3787 bn_int_set(&glgame.unknown4cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#unknown4., SERVER_GAMELISTREPLY_GAME_UNKNOWN4cxx . . $ `src/common/bnet_protocol.h:2788:9`!);
3788 bn_int_set(&glgame.unknown5cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#unknown5., SERVER_GAMELISTREPLY_GAME_UNKNOWN5cxx . . $ `src/common/bnet_protocol.h:2789:9`!);
3789 switch (game_get_statuscxx . . $ pvpgn/bnetd/game_get_status(e13bf945064795ea).(game)) {
3790 case game_status_started:
3791 bn_int_set(&glgame.statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#status., SERVER_GAMELISTREPLY_GAME_STATUS_STARTEDcxx . . $ `src/common/bnet_protocol.h:2792:9`!);
3792 break;
3793 case game_status_full:
3794 bn_int_set(&glgame.statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#status., SERVER_GAMELISTREPLY_GAME_STATUS_FULLcxx . . $ `src/common/bnet_protocol.h:2791:9`!);
3795 break;
3796 case game_status_open:
3797 bn_int_set(&glgame.statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#status., SERVER_GAMELISTREPLY_GAME_STATUS_OPENcxx . . $ `src/common/bnet_protocol.h:2790:9`!);
3798 break;
3799 case game_status_done:
3800 bn_int_set(&glgame.statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#status., SERVER_GAMELISTREPLY_GAME_STATUS_DONEcxx . . $ `src/common/bnet_protocol.h:2793:9`!);
3801 break;
3802 default:
3803 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "[{}] game \"{}\" has bad status={}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.), game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), (int)game_get_statuscxx . . $ pvpgn/bnetd/game_get_status(e13bf945064795ea).(game));
3804 bn_int_set(&glgame.statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#status., 0);
3805 }
3806 bn_int_set(&glgame.unknown6cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#unknown6., SERVER_GAMELISTREPLY_GAME_UNKNOWN6cxx . . $ `src/common/bnet_protocol.h:2794:9`!);
3807
3808 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(cbdata->rpacketcxx . . $ pvpgn/bnetd/glist_cbdata#rpacket.) + sizeof(glgame)+stdcxx . . $ std/::strlen(game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game)) + 1 + stdcxx . . $ std/::strlen(game_get_passcxx . . $ pvpgn/bnetd/game_get_pass(743fb6d1aa411c4e).(game)) + 1 + stdcxx . . $ std/::strlen(game_get_infocxx . . $ pvpgn/bnetd/game_get_info(743fb6d1aa411c4e).(game)) + 1 > MAX_PACKET_SIZEcxx . . $ MAX_PACKET_SIZE.) {
3809 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] out of room for games", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(cbdata->ccxx . . $ pvpgn/bnetd/glist_cbdata#c.));
3810 return -1; /* no more room */
3811 }
3812
3813 if (cbdata->countercxx . . $ pvpgn/bnetd/glist_cbdata#counter.) {
3814 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(cbdata->rpacketcxx . . $ pvpgn/bnetd/glist_cbdata#rpacket., &game_spacer, sizeof(game_spacer));
3815 }
3816
3817 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(cbdata->rpacketcxx . . $ pvpgn/bnetd/glist_cbdata#rpacket., &glgame, sizeof(glgame));
3818 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(cbdata->rpacketcxx . . $ pvpgn/bnetd/glist_cbdata#rpacket., game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game));
3819 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(cbdata->rpacketcxx . . $ pvpgn/bnetd/glist_cbdata#rpacket., game_get_passcxx . . $ pvpgn/bnetd/game_get_pass(743fb6d1aa411c4e).(game));
3820 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(cbdata->rpacketcxx . . $ pvpgn/bnetd/glist_cbdata#rpacket., game_get_infocxx . . $ pvpgn/bnetd/game_get_info(743fb6d1aa411c4e).(game));
3821 cbdata->countercxx . . $ pvpgn/bnetd/glist_cbdata#counter.++;
3822
3823 return 0;
3824 }
3825
3826 static int _client_gamelistreqcxx . . $ pvpgn/bnetd/_client_gamelistreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3827 {
3828 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
3829 char const *gamename;
3830 char const *gamepass;
3831 unsigned short bngtype;
3832 t_game_type gtype;
3833 t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag;
3834 t_game *game;
3835 t_server_gamelistreply_gamecxx . . $ pvpgn/t_server_gamelistreply_game# glgame;
3836 unsigned int addr;
3837 unsigned short port;
3838 char clienttag_str[5];
3839
3840 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_gamelistreqcxx . . $ pvpgn/t_client_gamelistreq#)) {
3841 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad GAMELISTREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_gamelistreqcxx . . $ pvpgn/t_client_gamelistreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3842 return -1;
3843 }
3844
3845 if (!(gamename = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_gamelistreqcxx . . $ pvpgn/t_client_gamelistreq#), MAX_GAMENAME_LENcxx . . $ MAX_GAMENAME_LEN.))) {
3846 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad GAMELISTREQ (missing or too long gamename)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3847 return -1;
3848 }
3849
3850 if (!(gamepass = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_gamelistreqcxx . . $ pvpgn/t_client_gamelistreq#)+stdcxx . . $ std/::strlen(gamename) + 1, MAX_GAMEPASS_LENcxx . . $ MAX_GAMEPASS_LEN.))) {
3851 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad GAMELISTREQ (missing or too long password)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3852 return -1;
3853 }
3854
3855 bngtype = bn_short_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_gamelistreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_gamelistreq..gametypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_100#gametype.);
3856 clienttag = conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c);
3857 gtype = bngreqtype_to_gtypecxx . . $ pvpgn/bnetd/bngreqtype_to_gtype(32e8eaed197b8d66).(clienttag, bngtype);
3858 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
3859 return -1;
3860 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_gamelistreplycxx . . $ pvpgn/t_server_gamelistreply#));
3861 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_GAMELISTREPLYcxx . . $ `src/common/bnet_protocol.h:2751:9`!);
3862
3863 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_gamelistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_gamelistreply..sstatuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_101#sstatus., 0);
3864
3865 /* specific game requested? */
3866 if (gamename[0] != '\0') {
3867 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] GAMELISTREPLY looking for specific game tag=\"{}\" bngtype=0x{:08x} gtype={} name=\"{}\" pass=\"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), tag_uint_to_str(clienttag_str, clienttag), bngtype, (int)gtype, gamename, gamepass);
3868 if ((game = gamelist_find_gamecxx . . $ pvpgn/bnetd/gamelist_find_game(e383c2f40f0b546f).(gamename, clienttag, gtype))) {
3869 /* game found but first we need to make sure everything is OK */
3870 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_gamelistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_gamelistreply..gamecountcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_101#gamecount., 0);
3871 switch (game_get_statuscxx . . $ pvpgn/bnetd/game_get_status(e13bf945064795ea).(game)) {
3872 case game_status_started:
3873 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_gamelistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_gamelistreply..sstatuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_101#sstatus., SERVER_GAMELISTREPLY_GAME_SSTATUS_STARTEDcxx . . $ `src/common/bnet_protocol.h:2763:9`!);
3874 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] GAMELISTREPLY found but started", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3875 break;
3876 case game_status_full:
3877 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_gamelistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_gamelistreply..sstatuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_101#sstatus., SERVER_GAMELISTREPLY_GAME_SSTATUS_FULLcxx . . $ `src/common/bnet_protocol.h:2762:9`!);
3878 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] GAMELISTREPLY found but full", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3879 break;
3880 case game_status_done:
3881 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_gamelistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_gamelistreply..sstatuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_101#sstatus., SERVER_GAMELISTREPLY_GAME_SSTATUS_NOTFOUNDcxx . . $ `src/common/bnet_protocol.h:2760:9`!);
3882 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] GAMELISTREPLY found but done", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3883 break;
3884 case game_status_open:
3885 case game_status_loaded:
3886 if (stdcxx . . $ std/::strcmp(gamepass, game_get_passcxx . . $ pvpgn/bnetd/game_get_pass(743fb6d1aa411c4e).(game))) { /* passworded game must match password in request */
3887 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_gamelistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_gamelistreply..sstatuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_101#sstatus., SERVER_GAMELISTREPLY_GAME_SSTATUS_PASScxx . . $ `src/common/bnet_protocol.h:2761:9`!);
3888 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] GAMELISTREPLY found but is password protected and wrong password given", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3889 break;
3890 }
3891
3892 if (game_get_statuscxx . . $ pvpgn/bnetd/game_get_status(e13bf945064795ea).(game) == game_status_loaded) {
3893 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_gamelistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_gamelistreply..sstatuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_101#sstatus., SERVER_GAMELISTREPLY_GAME_SSTATUS_LOADEDcxx . . $ `src/common/bnet_protocol.h:2765:9`!);
3894 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] GAMELISTREPLY found loaded game", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3895 }
3896
3897 /* everything seems fine, lets reply with the found game */
3898 bn_int_set(&glgame.statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#status., SERVER_GAMELISTREPLY_GAME_STATUS_OPENcxx . . $ `src/common/bnet_protocol.h:2790:9`!);
3899 bn_short_set(&glgame.gametypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#gametype., gtype_to_bngtypecxx . . $ pvpgn/bnetd/gtype_to_bngtype(721927292c512a57).(game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game)));
3900 bn_short_set(&glgame.unknown1cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#unknown1., SERVER_GAMELISTREPLY_GAME_UNKNOWN1cxx . . $ `src/common/bnet_protocol.h:2786:9`!);
3901 bn_short_set(&glgame.unknown3cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#unknown3., SERVER_GAMELISTREPLY_GAME_UNKNOWN3cxx . . $ `src/common/bnet_protocol.h:2787:9`!);
3902 addr = game_get_addrcxx . . $ pvpgn/bnetd/game_get_addr(d7b85b5cd2056731).(game);
3903 port = game_get_portcxx . . $ pvpgn/bnetd/game_get_port(5675c6bb4f2bafa6).(game);
3904 trans_netcxx . . $ pvpgn/trans_net(cf0ba8ec647fd542).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(c), &addr, &port);
3905 bn_short_nset(&glgame.portcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#port., port);
3906 bn_int_nset(&glgame.game_ipcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#game_ip., addr);
3907 bn_int_set(&glgame.unknown4cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#unknown4., SERVER_GAMELISTREPLY_GAME_UNKNOWN4cxx . . $ `src/common/bnet_protocol.h:2788:9`!);
3908 bn_int_set(&glgame.unknown5cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#unknown5., SERVER_GAMELISTREPLY_GAME_UNKNOWN5cxx . . $ `src/common/bnet_protocol.h:2789:9`!);
3909 bn_int_set(&glgame.unknown6cxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_102#unknown6., SERVER_GAMELISTREPLY_GAME_UNKNOWN6cxx . . $ `src/common/bnet_protocol.h:2794:9`!);
3910
3911 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &glgame, sizeof(glgame));
3912 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game));
3913 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, game_get_passcxx . . $ pvpgn/bnetd/game_get_pass(743fb6d1aa411c4e).(game));
3914 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, game_get_infocxx . . $ pvpgn/bnetd/game_get_info(743fb6d1aa411c4e).(game));
3915 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_gamelistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_gamelistreply..gamecountcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_101#gamecount., 1);
3916 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] GAMELISTREPLY specific game found", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3917 break;
3918 default:
3919 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "[{}] game \"{}\" has bad status {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game), game_get_statuscxx . . $ pvpgn/bnetd/game_get_status(e13bf945064795ea).(game));
3920 }
3921 }
3922 else {
3923 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_gamelistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_gamelistreply..gamecountcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_101#gamecount., 0);
3924 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] GAMELISTREPLY specific game doesn't seem to exist", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3925 }
3926 }
3927 else { /* list all public games of this type */
3928 struct glist_cbdatacxx . . $ pvpgn/bnetd/glist_cbdata# cbdata;
3929
3930 if (gtype == game_type_all)
3931 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "GAMELISTREPLY looking for public games tag=\"{}\" bngtype=0x{:08x} gtype=all", tag_uint_to_str(clienttag_str, clienttag), bngtype);
3932 else
3933 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "GAMELISTREPLY looking for public games tag=\"{}\" bngtype=0x{:08x} gtype={}", tag_uint_to_str(clienttag_str, clienttag), bngtype, (int)gtype);
3934
3935 cbdata.countercxx . . $ pvpgn/bnetd/glist_cbdata#counter. = 0;
3936 cbdata.tcountcxx . . $ pvpgn/bnetd/glist_cbdata#tcount. = 0;
3937 cbdata.ccxx . . $ pvpgn/bnetd/glist_cbdata#c. = c;
3938 cbdata.gtypecxx . . $ pvpgn/bnetd/glist_cbdata#gtype. = gtype;
3939 cbdata.rpacketcxx . . $ pvpgn/bnetd/glist_cbdata#rpacket. = rpacket;
3940 gamelist_traversecxx . . $ pvpgn/bnetd/gamelist_traverse(c7b2023d64399da8).(_glist_cbcxx . . $ pvpgn/bnetd/_glist_cb(7b7c187348591887)., &cbdata, gamelist_source_joinbutton);
3941
3942 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_gamelistreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_gamelistreply..gamecountcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_101#gamecount., cbdata.countercxx . . $ pvpgn/bnetd/glist_cbdata#counter.);
3943 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] GAMELISTREPLY sent {} of {} games", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), cbdata.countercxx . . $ pvpgn/bnetd/glist_cbdata#counter., cbdata.tcountcxx . . $ pvpgn/bnetd/glist_cbdata#tcount.);
3944 }
3945
3946 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
3947 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
3948
3949 return 0;
3950 }
3951
3952 static int _client_joingamecxx . . $ pvpgn/bnetd/_client_joingame(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
3953 {
3954 char const *gamename;
3955 char const *gamepass;
3956 t_game *game;
3957 t_game_type gtype;
3958
3959 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_join_gamecxx . . $ pvpgn/t_client_join_game#)) {
3960 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad JOIN_GAME packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_join_gamecxx . . $ pvpgn/t_client_join_game#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
3961 return -1;
3962 }
3963
3964 if (!(gamename = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_join_gamecxx . . $ pvpgn/t_client_join_game#), MAX_GAMENAME_LENcxx . . $ MAX_GAMENAME_LEN.))) {
3965 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLIENT_JOIN_GAME (missing or too long gamename)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3966 return -1;
3967 }
3968
3969 if (!(gamepass = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_join_gamecxx . . $ pvpgn/t_client_join_game#)+stdcxx . . $ std/::strlen(gamename) + 1, MAX_GAMEPASS_LENcxx . . $ MAX_GAMEPASS_LEN.))) {
3970 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLIENT_JOIN_GAME packet (missing or too long gamepass)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
3971 return -1;
3972 }
3973
3974 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] trying to join game \"{}\" pass=\"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), gamename, gamepass);
3975
3976 if (conn_get_joingamewhisper_ackcxx . . $ pvpgn/bnetd/conn_get_joingamewhisper_ack(c4dfbc2386fe4fc3).(c) == 0) {
3977 watchlistcxx . . $ pvpgn/bnetd/watchlist.->cxx . . $ pvpgn/scoped_ptr#`operator->`(155dc7f103cdb9db).dispatchcxx . . $ pvpgn/bnetd/WatchComponent#dispatch(5f92e2dc3f12ba14).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), gamename, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), Watchcxx . . $ pvpgn/bnetd/Watch#::ET_joingamecxx . . $ pvpgn/bnetd/Watch#ET_joingame.);
3978 conn_set_joingamewhisper_ackcxx . . $ pvpgn/bnetd/conn_set_joingamewhisper_ack(c14bb6458e7562a).(c, 1); /* 1 = already whispered. We reset this each time user joins a channel */
3979 clanmember_on_change_status_by_connectioncxx . . $ pvpgn/bnetd/clanmember_on_change_status_by_connection(c4dfbc2386fe4fc3).(c);
3980 }
3981
3982 if (conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(c))
3983 conn_part_channelcxx . . $ pvpgn/bnetd/conn_part_channel(c4dfbc2386fe4fc3).(c);
3984
3985 if (!stdcxx . . $ std/::strcmp(gamename, "BNet") && !handle_anongame_joincxx . . $ pvpgn/bnetd/handle_anongame_join(c4dfbc2386fe4fc3).(c)) {
3986 gtype = game_type_anongame;
3987 gamename = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
3988 return 0; /* tmp: do not record any anongames as yet */
3989 }
3990 else {
3991 if (!(game = gamelist_find_game_availablecxx . . $ pvpgn/bnetd/gamelist_find_game_available(e383c2f40f0b546f).(gamename, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), game_type_all))) {
3992 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] unable to find game \"{}\" for user to join", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), gamename);
3993 return 0;
3994 }
3995 gtype = game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game);
3996 gamename = game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game);
3997 if ((gtype == game_type_ladder && account_get_auth_joinladdergamecxx . . $ pvpgn/bnetd/account_get_auth_joinladdergame(367bfb076f70247b).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) == 0) || /* default to true */
3998 (gtype != game_type_ladder && account_get_auth_joinnormalgamecxx . . $ pvpgn/bnetd/account_get_auth_joinnormalgame(367bfb076f70247b).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) == 0)) { /* default to true */
3999 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] game join for \"{}\" to \"{}\" refused (no authority)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c), gamename);
4000 /* If the user is not in a game, then map authorization
4001 will fail and keep them from playing. */
4002 return 0;
4003 }
4004 }
4005
4006 if (conn_set_gamecxx . . $ pvpgn/bnetd/conn_set_game(6346b62fdc8e3894).(c, gamename, gamepass, "", gtype, STARTVER_UNKNOWNcxx . . $ `src/bnetd/game.h:251:9`!) < 0)
4007 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] \"{}\" joined game \"{}\", but could not be recorded on server", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c), gamename);
4008 else
4009 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] \"{}\" joined game \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c), gamename);
4010
4011 #ifdef WITH_LUA
4012 lua_handle_game(game, c, luaevent_game_userjoin);
4013 #endif
4014
4015 return 0;
4016 }
4017
4018 static int _client_startgame1cxx . . $ pvpgn/bnetd/_client_startgame1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4019 {
4020 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
4021
4022 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_startgame1cxx . . $ pvpgn/t_client_startgame1#)) {
4023 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME1 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_startgame1cxx . . $ pvpgn/t_client_startgame1#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4024 return -1;
4025 }
4026
4027 {
4028 char const *gamename;
4029 char const *gamepass;
4030 char const *gameinfo;
4031 unsigned short bngtype;
4032 unsigned int status;
4033 t_game *currgame;
4034
4035 if (!(gamename = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_startgame1cxx . . $ pvpgn/t_client_startgame1#), MAX_GAMENAME_LENcxx . . $ MAX_GAMENAME_LEN.))) {
4036 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME1 packet (missing or too long gamename)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4037 return -1;
4038 }
4039 if (!(gamepass = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_startgame1cxx . . $ pvpgn/t_client_startgame1#)+stdcxx . . $ std/::strlen(gamename) + 1, MAX_GAMEPASS_LENcxx . . $ MAX_GAMEPASS_LEN.))) {
4040 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME1 packet (missing or too long gamepass)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4041 return -1;
4042 }
4043 if (!(gameinfo = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_startgame1cxx . . $ pvpgn/t_client_startgame1#)+stdcxx . . $ std/::strlen(gamename) + 1 + stdcxx . . $ std/::strlen(gamepass) + 1, MAX_GAMEINFO_LENcxx . . $ MAX_GAMEINFO_LEN.))) {
4044 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME1 packet (missing or too long gameinfo)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4045 return -1;
4046 }
4047 if (conn_get_joingamewhisper_ackcxx . . $ pvpgn/bnetd/conn_get_joingamewhisper_ack(c4dfbc2386fe4fc3).(c) == 0) {
4048 if (watchlistcxx . . $ pvpgn/bnetd/watchlist.->cxx . . $ pvpgn/scoped_ptr#`operator->`(155dc7f103cdb9db).dispatchcxx . . $ pvpgn/bnetd/WatchComponent#dispatch(5f92e2dc3f12ba14).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), gamename, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), Watchcxx . . $ pvpgn/bnetd/Watch#::ET_joingamecxx . . $ pvpgn/bnetd/Watch#ET_joingame.) == 0)
4049 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., "handle_bnet", "Told Mutual Friends your in game {}", gamename);
4050
4051 conn_set_joingamewhisper_ackcxx . . $ pvpgn/bnetd/conn_set_joingamewhisper_ack(c14bb6458e7562a).(c, 1); //1 = already whispered. We reset this each time user joins a channel
4052 }
4053
4054
4055 bngtype = bn_short_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_startgame1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_startgame1..gametypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_103#gametype.);
4056 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] got startgame1 status for game \"{}\" is 0x{:08x} (gametype = 0x{:04x})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), gamename, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_startgame1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_startgame1..statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_103#status.), bngtype);
4057 status = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_startgame1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_startgame1..statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_103#status.) & CLIENT_STARTGAME1_STATUSMASKcxx . . $ `src/common/bnet_protocol.h:2816:9`!;
4058
4059 if ((currgame = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c))) {
4060 switch (status) {
4061 case CLIENT_STARTGAME1_STATUS_STARTEDcxx . . $ `src/common/bnet_protocol.h:2819:9`!:
4062 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(currgame, game_status_started);
4063 break;
4064 case CLIENT_STARTGAME1_STATUS_FULLcxx . . $ `src/common/bnet_protocol.h:2818:9`!:
4065 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(currgame, game_status_full);
4066 break;
4067 case CLIENT_STARTGAME1_STATUS_OPENcxx . . $ `src/common/bnet_protocol.h:2817:9`!:
4068 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(currgame, game_status_open);
4069 break;
4070 case CLIENT_STARTGAME1_STATUS_DONEcxx . . $ `src/common/bnet_protocol.h:2820:9`!:
4071 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(currgame, game_status_done);
4072 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] game \"{}\" is finished", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), gamename);
4073 break;
4074 }
4075 }
4076 else if (status != CLIENT_STARTGAME1_STATUS_DONEcxx . . $ `src/common/bnet_protocol.h:2820:9`!) {
4077 t_game_type gtype;
4078
4079 gtype = bngtype_to_gtypecxx . . $ pvpgn/bnetd/bngtype_to_gtype(32e8eaed197b8d66).(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), bngtype);
4080 if ((gtype == game_type_ladder && account_get_auth_createladdergamecxx . . $ pvpgn/bnetd/account_get_auth_createladdergame(367bfb076f70247b).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) == 0) || /* default to true */
4081 (gtype != game_type_ladder && account_get_auth_createnormalgamecxx . . $ pvpgn/bnetd/account_get_auth_createnormalgame(367bfb076f70247b).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) == 0)) /* default to true */
4082 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] game start for \"{}\" refused (no authority)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
4083 else
4084 conn_set_gamecxx . . $ pvpgn/bnetd/conn_set_game(6346b62fdc8e3894).(c, gamename, gamepass, gameinfo, gtype, STARTVER_GW1cxx . . $ `src/bnetd/game.h:252:9`!);
4085
4086 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
4087 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_startgame1_ackcxx . . $ pvpgn/t_server_startgame1_ack#));
4088 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_STARTGAME1_ACKcxx . . $ `src/common/bnet_protocol.h:3023:9`!);
4089
4090 if (conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c))
4091 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_startgame1_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_startgame1_ack..replycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_107#reply., SERVER_STARTGAME1_ACK_OKcxx . . $ `src/common/bnet_protocol.h:3030:9`!);
4092 else
4093 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_startgame1_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_startgame1_ack..replycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_107#reply., SERVER_STARTGAME1_ACK_NOcxx . . $ `src/common/bnet_protocol.h:3029:9`!);
4094
4095 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
4096 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4097 }
4098 }
4099 else
4100 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] client tried to set game status DONE to destroyed game", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4101 }
4102
4103 return 0;
4104 }
4105
4106 static int _client_startgame3cxx . . $ pvpgn/bnetd/_client_startgame3(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4107 {
4108 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
4109
4110 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_startgame3cxx . . $ pvpgn/t_client_startgame3#)) {
4111 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME3 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_startgame3cxx . . $ pvpgn/t_client_startgame3#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4112 return -1;
4113 }
4114
4115 {
4116 char const *gamename;
4117 char const *gamepass;
4118 char const *gameinfo;
4119 unsigned short bngtype;
4120 unsigned int status;
4121 t_game *currgame;
4122
4123 if (!(gamename = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_startgame3cxx . . $ pvpgn/t_client_startgame3#), MAX_GAMENAME_LENcxx . . $ MAX_GAMENAME_LEN.))) {
4124 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME3 packet (missing or too long gamename)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4125 return -1;
4126 }
4127 if (!(gamepass = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_startgame3cxx . . $ pvpgn/t_client_startgame3#)+stdcxx . . $ std/::strlen(gamename) + 1, MAX_GAMEPASS_LENcxx . . $ MAX_GAMEPASS_LEN.))) {
4128 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME3 packet (missing or too long gamepass)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4129 return -1;
4130 }
4131 if (!(gameinfo = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_startgame3cxx . . $ pvpgn/t_client_startgame3#)+stdcxx . . $ std/::strlen(gamename) + 1 + stdcxx . . $ std/::strlen(gamepass) + 1, MAX_GAMEINFO_LENcxx . . $ MAX_GAMEINFO_LEN.))) {
4132 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME3 packet (missing or too long gameinfo)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4133 return -1;
4134 }
4135 if (conn_get_joingamewhisper_ackcxx . . $ pvpgn/bnetd/conn_get_joingamewhisper_ack(c4dfbc2386fe4fc3).(c) == 0) {
4136 if (watchlistcxx . . $ pvpgn/bnetd/watchlist.->cxx . . $ pvpgn/scoped_ptr#`operator->`(155dc7f103cdb9db).dispatchcxx . . $ pvpgn/bnetd/WatchComponent#dispatch(5f92e2dc3f12ba14).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), gamename, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), Watchcxx . . $ pvpgn/bnetd/Watch#::ET_joingamecxx . . $ pvpgn/bnetd/Watch#ET_joingame.) == 0)
4137 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., "handle_bnet", "Told Mutual Friends your in game {}", gamename);
4138
4139 conn_set_joingamewhisper_ackcxx . . $ pvpgn/bnetd/conn_set_joingamewhisper_ack(c14bb6458e7562a).(c, 1); //1 = already whispered. We reset this each time user joins a channel
4140 }
4141 bngtype = bn_short_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_startgame3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_startgame3..gametypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_105#gametype.);
4142 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] got startgame3 status for game \"{}\" is 0x{:08x} (gametype = 0x{:04x})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), gamename, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_startgame3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_startgame3..statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_105#status.), bngtype);
4143 status = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_startgame3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_startgame3..statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_105#status.) & CLIENT_STARTGAME3_STATUSMASKcxx . . $ `src/common/bnet_protocol.h:2869:9`!;
4144
4145 if ((currgame = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c))) {
4146 switch (status) {
4147 case CLIENT_STARTGAME3_STATUS_STARTEDcxx . . $ `src/common/bnet_protocol.h:2873:9`!:
4148 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(currgame, game_status_started);
4149 break;
4150 case CLIENT_STARTGAME3_STATUS_FULLcxx . . $ `src/common/bnet_protocol.h:2872:9`!:
4151 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(currgame, game_status_full);
4152 break;
4153 case CLIENT_STARTGAME3_STATUS_OPEN1cxx . . $ `src/common/bnet_protocol.h:2870:9`!:
4154 case CLIENT_STARTGAME3_STATUS_OPENcxx . . $ `src/common/bnet_protocol.h:2871:9`!:
4155 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(currgame, game_status_open);
4156 break;
4157 case CLIENT_STARTGAME3_STATUS_DONEcxx . . $ `src/common/bnet_protocol.h:2874:9`!:
4158 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(currgame, game_status_done);
4159 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] game \"{}\" is finished", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), gamename);
4160 break;
4161 }
4162 }
4163 else if (status != CLIENT_STARTGAME3_STATUS_DONEcxx . . $ `src/common/bnet_protocol.h:2874:9`!) {
4164 t_game_type gtype;
4165
4166 gtype = bngtype_to_gtypecxx . . $ pvpgn/bnetd/bngtype_to_gtype(32e8eaed197b8d66).(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), bngtype);
4167 if ((gtype == game_type_ladder && account_get_auth_createladdergamecxx . . $ pvpgn/bnetd/account_get_auth_createladdergame(367bfb076f70247b).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) == 0) || (gtype != game_type_ladder && account_get_auth_createnormalgamecxx . . $ pvpgn/bnetd/account_get_auth_createnormalgame(367bfb076f70247b).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) == 0))
4168 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] game start for \"{}\" refused (no authority)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
4169 else
4170 conn_set_gamecxx . . $ pvpgn/bnetd/conn_set_game(6346b62fdc8e3894).(c, gamename, gamepass, gameinfo, gtype, STARTVER_GW3cxx . . $ `src/bnetd/game.h:253:9`!);
4171
4172 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
4173 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_startgame3_ackcxx . . $ pvpgn/t_server_startgame3_ack#));
4174 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_STARTGAME3_ACKcxx . . $ `src/common/bnet_protocol.h:3035:9`!);
4175
4176 if (conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c))
4177 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_startgame3_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_startgame3_ack..replycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_108#reply., SERVER_STARTGAME3_ACK_OKcxx . . $ `src/common/bnet_protocol.h:3042:9`!);
4178 else
4179 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_startgame3_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_startgame3_ack..replycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_108#reply., SERVER_STARTGAME3_ACK_NOcxx . . $ `src/common/bnet_protocol.h:3041:9`!);
4180
4181 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
4182 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4183 }
4184 }
4185 else
4186 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] client tried to set game status DONE to destroyed game", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4187 }
4188
4189 return 0;
4190 }
4191
4192 static int _client_startgame4cxx . . $ pvpgn/bnetd/_client_startgame4(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4193 {
4194 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
4195
4196 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_startgame4cxx . . $ pvpgn/t_client_startgame4#)) {
4197 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME4 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_startgame4cxx . . $ pvpgn/t_client_startgame4#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4198 return -1;
4199 }
4200
4201 if (conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) == CLIENTTAG_STARCRAFT_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:87:9`! || conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) == CLIENTTAG_BROODWARS_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:89:9`!)
4202 {
4203 // FIXME: (HarpyWar) Protection from hack attempt
4204 // Large map name size will cause crash Starcraft client for user who select an item in game list ("Join" area)
4205 // It occurs when the packet size of packet 0x0c in length interval 161-164
4206 // https://github.com/pvpgn/pvpgn-server/issues/159
4207 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) > 160)
4208 {
4209 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got abnormal STARTGAME4 packet length (got {} bytes, hack attempt?)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4210 return -1;
4211 }
4212 }
4213
4214 // Quick hack to make W3 part channels when creating a game
4215 if (conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(c))
4216 conn_part_channelcxx . . $ pvpgn/bnetd/conn_part_channel(c4dfbc2386fe4fc3).(c);
4217
4218 {
4219 char const *gamename;
4220 char const *gamepass;
4221 char const *gameinfo;
4222 unsigned short bngtype;
4223 unsigned int status;
4224 unsigned int flag;
4225 unsigned short option;
4226 t_game *currgame;
4227
4228 if (!(gamename = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_startgame4cxx . . $ pvpgn/t_client_startgame4#), MAX_GAMENAME_LENcxx . . $ MAX_GAMENAME_LEN.))) {
4229 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME4 packet (missing or too long gamename)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4230 return -1;
4231 }
4232 if (!(gamepass = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_startgame4cxx . . $ pvpgn/t_client_startgame4#)+stdcxx . . $ std/::strlen(gamename) + 1, MAX_GAMEPASS_LENcxx . . $ MAX_GAMEPASS_LEN.))) {
4233 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME4 packet (missing or too long gamepass)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4234 return -1;
4235 }
4236 if (!(gameinfo = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_startgame4cxx . . $ pvpgn/t_client_startgame4#)+stdcxx . . $ std/::strlen(gamename) + 1 + stdcxx . . $ std/::strlen(gamepass) + 1, MAX_GAMEINFO_LENcxx . . $ MAX_GAMEINFO_LEN.))) {
4237 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad STARTGAME4 packet (missing or too long gameinfo)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4238 return -1;
4239 }
4240 if (conn_get_joingamewhisper_ackcxx . . $ pvpgn/bnetd/conn_get_joingamewhisper_ack(c4dfbc2386fe4fc3).(c) == 0) {
4241 if (watchlistcxx . . $ pvpgn/bnetd/watchlist.->cxx . . $ pvpgn/scoped_ptr#`operator->`(155dc7f103cdb9db).dispatchcxx . . $ pvpgn/bnetd/WatchComponent#dispatch(5f92e2dc3f12ba14).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), gamename, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), Watchcxx . . $ pvpgn/bnetd/Watch#::ET_joingamecxx . . $ pvpgn/bnetd/Watch#ET_joingame.) == 0)
4242 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., "handle_bnet", "Told Mutual Friends your in game {}", gamename);
4243
4244 conn_set_joingamewhisper_ackcxx . . $ pvpgn/bnetd/conn_set_joingamewhisper_ack(c14bb6458e7562a).(c, 1); //1 = already whispered. We reset this each time user joins a channel
4245 }
4246 bngtype = bn_short_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_startgame4cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_startgame4..gametypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_106#gametype.);
4247 option = bn_short_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_startgame4cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_startgame4..optioncxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_106#option.);
4248 status = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_startgame4cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_startgame4..statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_106#status.);
4249 flag = bn_short_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_startgame4cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_startgame4..flagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_106#flag.);
4250
4251 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] got startgame4 status for game \"{}\" is 0x{:08x} (gametype=0x{:04x} option=0x{:04x}, flag=0x{:04x})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), gamename, status, bngtype, option, flag);
4252
4253 if ((currgame = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c))) {
4254 if ((status & CLIENT_STARTGAME4_STATUSMASK_OPEN_VALIDcxx . . $ `src/common/bnet_protocol.h:2937:9`!) == status) {
4255 if (status & CLIENT_STARTGAME4_STATUS_STARTcxx . . $ `src/common/bnet_protocol.h:2942:9`!)
4256 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(currgame, game_status_started);
4257 else if (status & CLIENT_STARTGAME4_STATUS_FULLcxx . . $ `src/common/bnet_protocol.h:2940:9`!)
4258 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(currgame, game_status_full);
4259 else
4260 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(currgame, game_status_open);
4261 }
4262 else {
4263 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] unknown startgame4 status {} (clienttag: {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), status, clienttag_uint_to_str(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c)));
4264 }
4265
4266 }
4267 else if ((status & CLIENT_STARTGAME4_STATUSMASK_INIT_VALIDcxx . . $ `src/common/bnet_protocol.h:2936:9`!) == status) {
4268 /*valid creation status would be:
4269 0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, 0x80, 0x81, 0x82, 0x83 */
4270
4271 t_game_type gtype;
4272 bool allow_create_custom = false;
4273 t_game *game;
4274
4275 gtype = bngtype_to_gtypecxx . . $ pvpgn/bnetd/bngtype_to_gtype(32e8eaed197b8d66).(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), bngtype);
4276 if ((gtype == game_type_ladder && account_get_auth_createladdergamecxx . . $ pvpgn/bnetd/account_get_auth_createladdergame(367bfb076f70247b).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) == 0) || (gtype != game_type_ladder && account_get_auth_createnormalgamecxx . . $ pvpgn/bnetd/account_get_auth_createnormalgame(367bfb076f70247b).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) == 0))
4277 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] game start for \"{}\" refused (no authority)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
4278 else
4279 {
4280 //find is there any existing game with same name and allow the host to create game
4281 // with same name only when another game is already started or already done
4282 if ((!(game = gamelist_find_game_availablecxx . . $ pvpgn/bnetd/gamelist_find_game_available(e383c2f40f0b546f).(gamename, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), game_type_all))) &&
4283 (conn_set_gamecxx . . $ pvpgn/bnetd/conn_set_game(6346b62fdc8e3894).(c, gamename, gamepass, gameinfo, gtype, STARTVER_GW4cxx . . $ `src/bnetd/game.h:254:9`!) == 0))
4284 {
4285 game_set_optioncxx . . $ pvpgn/bnetd/game_set_option(ab46a331a84c7de1).(conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c), bngoption_to_goptioncxx . . $ pvpgn/bnetd/bngoption_to_goption(683ce3e18ae389f3).(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), gtype, option));
4286 if (status & CLIENT_STARTGAME4_STATUS_PRIVATEcxx . . $ `src/common/bnet_protocol.h:2939:9`!)
4287 game_set_flagcxx . . $ pvpgn/bnetd/game_set_flag(3b1c59db3f21a39f).(conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c), game_flag_private);
4288 if (status & CLIENT_STARTGAME4_STATUS_FULLcxx . . $ `src/common/bnet_protocol.h:2940:9`!)
4289 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c), game_status_full);
4290 if (bngtype == CLIENT_GAMELISTREQ_LOADEDcxx . . $ `src/common/bnet_protocol.h:2666:9`!) /* PELISH: seems strange but it is really needed for loaded games */
4291 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c), game_status_loaded);
4292 //FIXME: still need special handling for status disc-is-loss and replay
4293
4294 }
4295 }
4296 }
4297 else
4298 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] client tried to set game status 0x{:x} to unexistent game (clienttag: {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), status, clienttag_uint_to_str(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c)));
4299 }
4300
4301 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
4302 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_startgame4_ackcxx . . $ pvpgn/t_server_startgame4_ack#));
4303 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_STARTGAME4_ACKcxx . . $ `src/common/bnet_protocol.h:3047:9`!);
4304
4305 if (conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c))
4306 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_startgame4_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_startgame4_ack..replycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_109#reply., SERVER_STARTGAME4_ACK_OKcxx . . $ `src/common/bnet_protocol.h:3054:9`!);
4307 else
4308 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_startgame4_ackcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_startgame4_ack..replycxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_109#reply., SERVER_STARTGAME4_ACK_NOcxx . . $ `src/common/bnet_protocol.h:3053:9`!);
4309 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
4310 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4311 }
4312
4313 /* First, send an ECHO_REQ */
4314 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
4315 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_echoreqcxx . . $ pvpgn/t_server_echoreq#));
4316 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_ECHOREQcxx . . $ `src/common/bnet_protocol.h:3444:9`!);
4317 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_echoreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_echoreq..tickscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_130#ticks., get_tickscxx . . $ pvpgn/bnetd/get_ticks(db52760e79bf9054).());
4318 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
4319 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4320 }
4321
4322 return 0;
4323 }
4324
4325 static int _client_closegamecxx . . $ pvpgn/bnetd/_client_closegame(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4326 {
4327 t_game *game;
4328
4329 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] client closing game", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4330 if (packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet) == CLIENT_CLOSEGAME2cxx . . $ `src/common/bnet_protocol.h:3060:9`! || ((conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) != CLIENTTAG_WARCRAFT3_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:111:9`!) && (conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) != CLIENTTAG_WAR3XP_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:113:9`!)))
4331 conn_set_gamecxx . . $ pvpgn/bnetd/conn_set_game(6346b62fdc8e3894).(c, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, game_type_none, 0);
4332 else if ((game = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c)))
4333 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(game, game_status_started);
4334
4335 return 0;
4336 }
4337
4338 static int _client_gamereportcxx . . $ pvpgn/bnetd/_client_gamereport(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4339 {
4340 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_game_reportcxx . . $ pvpgn/t_client_game_report#)) {
4341 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad GAME_REPORT packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_game_reportcxx . . $ pvpgn/t_client_game_report#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4342 return -1;
4343 }
4344
4345 {
4346 t_accountcxx . . $ pvpgn/bnetd/t_account# *my_account;
4347 t_accountcxx . . $ pvpgn/bnetd/t_account# *other_account;
4348 t_game *game;
4349 unsigned int player_count;
4350 unsigned int i, s;
4351 t_client_game_report_resultcxx . . $ pvpgn/t_client_game_report_result# const *result_data;
4352 unsigned int result_off;
4353 t_game_result result;
4354 char const *player;
4355 unsigned int player_off;
4356 t_game_result *results;
4357
4358 player_count = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_gamerepcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_gamerep..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_133#count.);
4359
4360 if (!(game = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c))) {
4361 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got GAME_REPORT when not in a game for user \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
4362 return -1;
4363 }
4364
4365 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] CLIENT_GAME_REPORT: {} ({} players)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c), player_count);
4366 my_account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c);
4367
4368 results = (t_game_result*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_game_result)* game_get_count(game));
4369
4370 for (i = 0; i < game_get_countcxx . . $ pvpgn/bnetd/game_get_count(d7b85b5cd2056731).(game); i++)
4371 results[i] = game_result_none;
4372
4373 for (i = 0, result_off = sizeof(t_client_game_reportcxx . . $ pvpgn/t_client_game_report#), player_off = sizeof(t_client_game_reportcxx . . $ pvpgn/t_client_game_report#)+player_count * sizeof(t_client_game_report_resultcxx . . $ pvpgn/t_client_game_report_result#); i < player_count; i++, result_off += sizeof(t_client_game_report_resultcxx . . $ pvpgn/t_client_game_report_result#), player_off += stdcxx . . $ std/::strlen(player) + 1) {
4374 /* PELISH: Fixme - Can this crash server (NULL pointer dereferencing)?? */
4375 if (!(result_data = (const t_client_game_report_resultcxx . . $ pvpgn/t_client_game_report_result#*)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, result_off, sizeof(t_client_game_report_resultcxx . . $ pvpgn/t_client_game_report_result#)))) {
4376 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got corrupt GAME_REPORT packet (missing results {}-{})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), i + 1, player_count);
4377 break;
4378 }
4379 if (!(player = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, player_off, MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
4380 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got corrupt GAME_REPORT packet (missing players {}-{})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), i + 1, player_count);
4381 break;
4382 }
4383
4384 if (player[0] == '\0') /* empty slots have empty player name */
4385 continue;
4386
4387 if (i >= game_get_countcxx . . $ pvpgn/bnetd/game_get_count(d7b85b5cd2056731).(game)) {
4388 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got more results than the game had players - ignoring extra results", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4389 break;
4390 }
4391
4392 if (!(other_account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(player))) {
4393 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got GAME_REPORT with unknown player \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), player);
4394 break;
4395 }
4396
4397 // as player position in game structure and in game report might differ,
4398 // search for right position
4399 for (s = 0; s < game_get_countcxx . . $ pvpgn/bnetd/game_get_count(d7b85b5cd2056731).(game); s++)
4400 {
4401 if (game_get_playercxx . . $ pvpgn/bnetd/game_get_player(c2a575aa55f70f03).(game, s) == other_account) break;
4402 }
4403
4404 if (s < game_get_countcxx . . $ pvpgn/bnetd/game_get_count(d7b85b5cd2056731).(game))
4405 {
4406 result = bngresult_to_gresultcxx . . $ pvpgn/bnetd/bngresult_to_gresult(18bda09b40921f72).(bn_int_get(result_data->resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_134#result.));
4407 results[s] = result;
4408 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] got player {} (\"{}\") result {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), i, player, game_result_get_strcxx . . $ pvpgn/bnetd/game_result_get_str(517f369a4a167f85).(result));
4409 }
4410 else
4411 {
4412 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got GAME_REPORT for non-participating player \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), player);
4413 }
4414
4415
4416 }
4417
4418 if (i == player_count) { /* if everything checked out... */
4419 char const *head;
4420 char const *body;
4421
4422 if (!(head = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, player_off, MAX_GAMEREP_HEAD_STRcxx . . $ MAX_GAMEREP_HEAD_STR.)))
4423 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got GAME_REPORT with missing or too long report head", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4424 else {
4425 player_off += stdcxx . . $ std/::strlen(head) + 1;
4426 if (!(body = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, player_off, MAX_GAMEREP_BODY_STRcxx . . $ MAX_GAMEREP_BODY_STR.)))
4427 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got GAME_REPORT with missing or too ling report body", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4428 else
4429 game_set_reportcxx . . $ pvpgn/bnetd/game_set_report(656ae8b4ac453ef4).(game, my_account, head, body);
4430 }
4431 }
4432
4433 if (game_set_reported_resultscxx . . $ pvpgn/bnetd/game_set_reported_results(144eebf375f9509c).(game, my_account, results) < 0)
4434 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)results);
4435
4436 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] finished parsing result... now leaving game", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4437 conn_set_gamecxx . . $ pvpgn/bnetd/conn_set_game(6346b62fdc8e3894).(c, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, game_type_none, 0);
4438 }
4439
4440 return 0;
4441 }
4442
4443 static int _client_leavechannelcxx . . $ pvpgn/bnetd/_client_leavechannel(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4444 {
4445 /* If this user in a channel, notify everyone that the user has left */
4446 if (conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(c))
4447 conn_part_channelcxx . . $ pvpgn/bnetd/conn_part_channel(c4dfbc2386fe4fc3).(c);
4448 return 0;
4449 }
4450
4451 static int _client_ladderreqcxx . . $ pvpgn/bnetd/_client_ladderreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4452 {
4453 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
4454
4455
4456 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_ladderreqcxx . . $ pvpgn/t_client_ladderreq#)) {
4457 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad LADDERREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_ladderreqcxx . . $ pvpgn/t_client_ladderreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4458 return -1;
4459 }
4460
4461 {
4462 t_ladder_entrycxx . . $ pvpgn/t_ladder_entry# entry;
4463 unsigned int i;
4464 unsigned int type;
4465 unsigned int start;
4466 unsigned int count;
4467 unsigned int idnum;
4468 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
4469 t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag;
4470 char const *timestr;
4471 t_bnettimecxx . . $ pvpgn/t_bnettime# bt;
4472 t_ladder_idcxx . . $ pvpgn/bnetd/t_ladder_id# id;
4473 t_ladder_sortcxx . . $ pvpgn/bnetd/t_ladder_sort# sort;
4474 bool error = false;
4475
4476 clienttag = conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c);
4477
4478 type = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_ladderreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_ladderreq..typecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_125#type.);
4479 start = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_ladderreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_ladderreq..startplacecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_125#startplace.);
4480 count = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_ladderreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_ladderreq..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_125#count.);
4481 idnum = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_ladderreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_ladderreq..idcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_125#id.);
4482
4483 /* eventlog(eventlog_level_debug,__FUNCTION__,"got LADDERREQ type=%u start=%u count=%u id=%u",type,start,count,id); */
4484
4485 switch (idnum) {
4486 case CLIENT_LADDERREQ_ID_STANDARDcxx . . $ `src/common/bnet_protocol.h:3323:9`!:
4487 id = ladder_id_normalcxx . . $ pvpgn/bnetd/ladder_id_normal.;
4488 break;
4489 case CLIENT_LADDERREQ_ID_IRONMANcxx . . $ `src/common/bnet_protocol.h:3324:9`!:
4490 id = ladder_id_ironmancxx . . $ pvpgn/bnetd/ladder_id_ironman.;
4491 break;
4492 default:
4493 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got unknown ladder ladderreq.id=0x{:08x}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), idnum);
4494 id = ladder_id_normalcxx . . $ pvpgn/bnetd/ladder_id_normal.;
4495 }
4496
4497 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
4498 return -1;
4499 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_ladderreplycxx . . $ pvpgn/t_server_ladderreply#));
4500 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_LADDERREPLYcxx . . $ `src/common/bnet_protocol.h:3395:9`!);
4501
4502 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_ladderreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_ladderreply..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_126#clienttag., clienttag);
4503 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_ladderreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_ladderreply..idcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_126#id., idnum);
4504 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_ladderreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_ladderreply..typecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_126#type., type);
4505 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_ladderreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_ladderreply..startplacecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_126#startplace., start);
4506 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_ladderreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_ladderreply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_126#count., count);
4507
4508 switch (type){
4509 case CLIENT_LADDERREQ_TYPE_HIGHESTRATEDcxx . . $ `src/common/bnet_protocol.h:3325:9`!:
4510 sort = ladder_sort_highestratedcxx . . $ pvpgn/bnetd/ladder_sort_highestrated.;
4511 break;
4512 case CLIENT_LADDERREQ_TYPE_MOSTWINScxx . . $ `src/common/bnet_protocol.h:3326:9`!:
4513 sort = ladder_sort_mostwinscxx . . $ pvpgn/bnetd/ladder_sort_mostwins.;
4514 break;
4515 case CLIENT_LADDERREQ_TYPE_MOSTGAMEScxx . . $ `src/common/bnet_protocol.h:3327:9`!:
4516 sort = ladder_sort_mostgamescxx . . $ pvpgn/bnetd/ladder_sort_mostgames.;
4517 break;
4518 default:
4519 sort = ladder_sort_defaultcxx . . $ pvpgn/bnetd/ladder_sort_default.;
4520 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got unknown value for ladderreq.type={}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), type);
4521 error = true;
4522 }
4523
4524 LadderListcxx . . $ pvpgn/bnetd/LadderList#* ladderList_active = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
4525 LadderListcxx . . $ pvpgn/bnetd/LadderList#* ladderList_current = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
4526
4527 if (!error)
4528 {
4529 ladderList_active = ladderscxx . . $ pvpgn/bnetd/ladders..getLadderListcxx . . $ pvpgn/bnetd/Ladders#getLadderList(2c0c64fbd1351270).(LadderKeycxx . . $ pvpgn/bnetd/LadderKey#LadderKey(f0da15e05d48c065).(id, clienttag, sort, ladder_time_activecxx . . $ pvpgn/bnetd/ladder_time_active.));
4530 ladderList_current = ladderscxx . . $ pvpgn/bnetd/ladders..getLadderListcxx . . $ pvpgn/bnetd/Ladders#getLadderList(2c0c64fbd1351270).(LadderKeycxx . . $ pvpgn/bnetd/LadderKey#LadderKey(f0da15e05d48c065).(id, clienttag, sort, ladder_time_currentcxx . . $ pvpgn/bnetd/ladder_time_current.));
4531 }
4532 if (!ladderList_active || ladderList_current)
4533 error = true;
4534
4535 for (i = start; i < start + count; i++) {
4536
4537
4538 const LadderReferencedObjectcxx . . $ pvpgn/bnetd/LadderReferencedObject#* referencedObject = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
4539 account = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
4540 if (!error){
4541
4542 if (!(referencedObject = ladderList_active->getReferencedObjectcxx . . $ pvpgn/bnetd/LadderList#getReferencedObject(56fd0941de524e93).(i + 1)))
4543 referencedObject = ladderList_current->getReferencedObjectcxx . . $ pvpgn/bnetd/LadderList#getReferencedObject(56fd0941de524e93).(i + 1);
4544 }
4545
4546 if ((referencedObject) && (account = referencedObject->getAccountcxx . . $ pvpgn/bnetd/LadderReferencedObject#getAccount(bd50dfe41cbbfab3).()))
4547 {
4548 bn_int_set(&entry.activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#active..winscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#wins., account_get_ladder_active_winscxx . . $ pvpgn/bnetd/account_get_ladder_active_wins(44091a2c7ac3910).(account, clienttag, id));
4549 bn_int_set(&entry.activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#active..losscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#loss., account_get_ladder_active_lossescxx . . $ pvpgn/bnetd/account_get_ladder_active_losses(44091a2c7ac3910).(account, clienttag, id));
4550 bn_int_set(&entry.activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#active..disconnectcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#disconnect., account_get_ladder_active_disconnectscxx . . $ pvpgn/bnetd/account_get_ladder_active_disconnects(44091a2c7ac3910).(account, clienttag, id));
4551 bn_int_set(&entry.activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#active..ratingcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#rating., account_get_ladder_active_ratingcxx . . $ pvpgn/bnetd/account_get_ladder_active_rating(44091a2c7ac3910).(account, clienttag, id));
4552 bn_int_set(&entry.activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#active..rankcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#rank., account_get_ladder_active_rankcxx . . $ pvpgn/bnetd/account_get_ladder_active_rank(829aa05f631ee398).(account, clienttag, id) - 1);
4553 if (!(timestr = account_get_ladder_active_last_timecxx . . $ pvpgn/bnetd/account_get_ladder_active_last_time(195610fd04255b8f).(account, clienttag, id)))
4554 timestr = BNETD_LADDER_DEFAULT_TIMEcxx . . $ `src/common/setup_before.h:118:9`!;
4555 bnettime_set_strcxx . . $ pvpgn/bnettime_set_str(faeb564d2075bce7).(&bt, timestr);
4556 bnettime_to_bn_longcxx . . $ pvpgn/bnettime_to_bn_long(5cee0b6c516bd57b).(bt, &entry.lastgame_activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#lastgame_active.);
4557
4558 bn_int_set(&entry.currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#current..winscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#wins., account_get_ladder_winscxx . . $ pvpgn/bnetd/account_get_ladder_wins(44091a2c7ac3910).(account, clienttag, id));
4559 bn_int_set(&entry.currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#current..losscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#loss., account_get_ladder_lossescxx . . $ pvpgn/bnetd/account_get_ladder_losses(44091a2c7ac3910).(account, clienttag, id));
4560 bn_int_set(&entry.currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#current..disconnectcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#disconnect., account_get_ladder_disconnectscxx . . $ pvpgn/bnetd/account_get_ladder_disconnects(44091a2c7ac3910).(account, clienttag, id));
4561 bn_int_set(&entry.currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#current..ratingcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#rating., account_get_ladder_ratingcxx . . $ pvpgn/bnetd/account_get_ladder_rating(44091a2c7ac3910).(account, clienttag, id));
4562 bn_int_set(&entry.currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#current..rankcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#rank., account_get_ladder_rankcxx . . $ pvpgn/bnetd/account_get_ladder_rank(829aa05f631ee398).(account, clienttag, id) - 1);
4563 if (!(timestr = account_get_ladder_last_timecxx . . $ pvpgn/bnetd/account_get_ladder_last_time(195610fd04255b8f).(account, clienttag, id)))
4564 timestr = BNETD_LADDER_DEFAULT_TIMEcxx . . $ `src/common/setup_before.h:118:9`!;
4565 bnettime_set_strcxx . . $ pvpgn/bnettime_set_str(faeb564d2075bce7).(&bt, timestr);
4566 bnettime_to_bn_longcxx . . $ pvpgn/bnettime_to_bn_long(5cee0b6c516bd57b).(bt, &entry.lastgame_currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#lastgame_current.);
4567 }
4568 else {
4569 bn_int_set(&entry.activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#active..winscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#wins., 0);
4570 bn_int_set(&entry.activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#active..losscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#loss., 0);
4571 bn_int_set(&entry.activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#active..disconnectcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#disconnect., 0);
4572 bn_int_set(&entry.activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#active..ratingcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#rating., 0);
4573 bn_int_set(&entry.activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#active..rankcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#rank., 0);
4574 bn_long_set_a_b(&entry.lastgame_activecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#lastgame_active., 0, 0);
4575
4576 bn_int_set(&entry.currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#current..winscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#wins., 0);
4577 bn_int_set(&entry.currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#current..losscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#loss., 0);
4578 bn_int_set(&entry.currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#current..disconnectcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#disconnect., 0);
4579 bn_int_set(&entry.currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#current..ratingcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#rating., 0);
4580 bn_int_set(&entry.currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#current..rankcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_127#rank., 0);
4581 bn_long_set_a_b(&entry.lastgame_currentcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#lastgame_current., 0, 0);
4582 }
4583
4584 bn_int_set(&entry.ttestcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#ttest.[0], i); // rank
4585 bn_int_set(&entry.ttestcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#ttest.[1], 0); //
4586 bn_int_set(&entry.ttestcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#ttest.[2], 0); //
4587 if (account)
4588 bn_int_set(&entry.ttestcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#ttest.[3], account_get_ladder_high_ratingcxx . . $ pvpgn/bnetd/account_get_ladder_high_rating(44091a2c7ac3910).(account, clienttag, id));
4589 else
4590 bn_int_set(&entry.ttestcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#ttest.[3], 0);
4591 bn_int_set(&entry.ttestcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#ttest.[4], 0); //
4592 bn_int_set(&entry.ttestcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_128#ttest.[5], 0); //
4593
4594 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, &entry, sizeof(entry));
4595
4596 if (account)
4597 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account));
4598 else
4599 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, " "); /* use a space so the client won't show the user's own account when double-clicked on */
4600 }
4601
4602 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
4603 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4604 }
4605
4606 return 0;
4607 }
4608
4609 static int _client_laddersearchreqcxx . . $ pvpgn/bnetd/_client_laddersearchreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4610 {
4611 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
4612
4613 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_laddersearchreqcxx . . $ pvpgn/t_client_laddersearchreq#)) {
4614 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad LADDERSEARCHREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_laddersearchreqcxx . . $ pvpgn/t_client_laddersearchreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4615 return -1;
4616 }
4617
4618 {
4619 char const *playername;
4620 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
4621 unsigned int idnum;
4622 unsigned int type;
4623 unsigned int rank; /* starts at zero */
4624 t_ladder_idcxx . . $ pvpgn/bnetd/t_ladder_id# id;
4625 t_ladder_sortcxx . . $ pvpgn/bnetd/t_ladder_sort# sort;
4626 t_clienttagcxx . . $ pvpgn/t_clienttag# ctag = conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c);
4627
4628 idnum = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_laddersearchreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_laddersearchreq..idcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_46#id.);
4629
4630 switch (idnum) {
4631 case CLIENT_LADDERREQ_ID_STANDARDcxx . . $ `src/common/bnet_protocol.h:3323:9`!:
4632 id = ladder_id_normalcxx . . $ pvpgn/bnetd/ladder_id_normal.;
4633 break;
4634 case CLIENT_LADDERREQ_ID_IRONMANcxx . . $ `src/common/bnet_protocol.h:3324:9`!:
4635 id = ladder_id_ironmancxx . . $ pvpgn/bnetd/ladder_id_ironman.;
4636 break;
4637 default:
4638 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got unknown ladder laddersearchreq.id=0x{:08x}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), idnum);
4639 id = ladder_id_normalcxx . . $ pvpgn/bnetd/ladder_id_normal.;
4640 }
4641
4642 type = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_laddersearchreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_laddersearchreq..typecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_46#type.);
4643 switch (type) {
4644 case CLIENT_LADDERSEARCHREQ_TYPE_HIGHESTRATEDcxx . . $ `src/common/bnet_protocol.h:1033:9`!:
4645 sort = ladder_sort_highestratedcxx . . $ pvpgn/bnetd/ladder_sort_highestrated.;
4646 break;
4647 case CLIENT_LADDERSEARCHREQ_TYPE_MOSTWINScxx . . $ `src/common/bnet_protocol.h:1034:9`!:
4648 sort = ladder_sort_mostwinscxx . . $ pvpgn/bnetd/ladder_sort_mostwins.;
4649 break;
4650 case CLIENT_LADDERSEARCHREQ_TYPE_MOSTGAMEScxx . . $ `src/common/bnet_protocol.h:1035:9`!:
4651 sort = ladder_sort_mostgamescxx . . $ pvpgn/bnetd/ladder_sort_mostgames.;
4652 break;
4653 default:
4654 sort = ladder_sort_defaultcxx . . $ pvpgn/bnetd/ladder_sort_default.;
4655 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got unknown ladder search type {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), type);
4656 }
4657
4658 if (!(playername = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_laddersearchreqcxx . . $ pvpgn/t_client_laddersearchreq#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
4659 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad LADDERSEARCHREQ packet (missing or too long playername)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4660 return -1;
4661 }
4662
4663 if (!(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(playername)))
4664 rank = SERVER_LADDERSEARCHREPLY_RANK_NONEcxx . . $ `src/common/bnet_protocol.h:1047:9`!;
4665 else {
4666 LadderListcxx . . $ pvpgn/bnetd/LadderList# * ladderList_active = ladderscxx . . $ pvpgn/bnetd/ladders..getLadderListcxx . . $ pvpgn/bnetd/Ladders#getLadderList(2c0c64fbd1351270).(LadderKeycxx . . $ pvpgn/bnetd/LadderKey#LadderKey(f0da15e05d48c065).(id, ctag, sort, ladder_time_activecxx . . $ pvpgn/bnetd/ladder_time_active.));
4667 LadderListcxx . . $ pvpgn/bnetd/LadderList# * ladderList_current = ladderscxx . . $ pvpgn/bnetd/ladders..getLadderListcxx . . $ pvpgn/bnetd/Ladders#getLadderList(2c0c64fbd1351270).(LadderKeycxx . . $ pvpgn/bnetd/LadderKey#LadderKey(f0da15e05d48c065).(id, ctag, sort, ladder_time_currentcxx . . $ pvpgn/bnetd/ladder_time_current.));
4668 unsigned int uid = account_get_uidcxx . . $ `src/bnetd/account.h:91:9`!(account);
4669 switch (type) {
4670 case CLIENT_LADDERSEARCHREQ_TYPE_HIGHESTRATEDcxx . . $ `src/common/bnet_protocol.h:1033:9`!:
4671 case CLIENT_LADDERSEARCHREQ_TYPE_MOSTWINScxx . . $ `src/common/bnet_protocol.h:1034:9`!:
4672 case CLIENT_LADDERSEARCHREQ_TYPE_MOSTGAMEScxx . . $ `src/common/bnet_protocol.h:1035:9`!:
4673 if (!(rank = ladderList_active->getRankcxx . . $ pvpgn/bnetd/LadderList#getRank(560347b7e9428769).(uid)))
4674 {
4675 if (!(rank = ladderList_current->getRankcxx . . $ pvpgn/bnetd/LadderList#getRank(560347b7e9428769).(uid)) || ladderList_active->getReferencedObjectcxx . . $ pvpgn/bnetd/LadderList#getReferencedObject(56fd0941de524e93).(rank))
4676 rank = 0;
4677 }
4678 break;
4679 default:
4680 rank = 0;
4681 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got unknown ladder search type {}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_laddersearchreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_laddersearchreq..typecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_46#type.));
4682 }
4683
4684 if (rank == 0)
4685 rank = SERVER_LADDERSEARCHREPLY_RANK_NONEcxx . . $ `src/common/bnet_protocol.h:1047:9`!;
4686 else
4687 rank--;
4688 }
4689
4690 if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)))
4691 return -1;
4692 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_laddersearchreplycxx . . $ pvpgn/t_server_laddersearchreply#));
4693 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_LADDERSEARCHREPLYcxx . . $ `src/common/bnet_protocol.h:1040:9`!);
4694 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_laddersearchreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_laddersearchreply..rankcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_47#rank., rank);
4695 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
4696 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4697 }
4698
4699 return 0;
4700 }
4701
4702 static int _client_mapauthreq1cxx . . $ pvpgn/bnetd/_client_mapauthreq1(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4703 {
4704 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
4705
4706 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_mapauthreq1cxx . . $ pvpgn/t_client_mapauthreq1#)) {
4707 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad MAPAUTHREQ1 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_mapauthreq1cxx . . $ pvpgn/t_client_mapauthreq1#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4708 return -1;
4709 }
4710
4711 {
4712 char const *mapname;
4713 t_game *game;
4714
4715 if (!(mapname = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_mapauthreq1cxx . . $ pvpgn/t_client_mapauthreq1#), MAP_NAME_LENcxx . . $ MAP_NAME_LEN.))) {
4716 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad MAPAUTHREQ1 packet (missing or too long mapname)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4717 return -1;
4718 }
4719
4720 game = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c);
4721
4722 if (game) {
4723 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] map auth requested for map \"{}\" gametype \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), mapname, game_type_get_strcxx . . $ pvpgn/bnetd/game_type_get_str(99410026be00fa29).(game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game)));
4724 game_set_mapnamecxx . . $ pvpgn/bnetd/game_set_mapname(bfbe5c8efad5152b).(game, mapname);
4725 }
4726 else
4727 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] map auth requested when not in a game", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4728
4729 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
4730 unsigned int val;
4731
4732 if (!game) {
4733 val = SERVER_MAPAUTHREPLY1_NOcxx . . $ `src/common/bnet_protocol.h:3111:9`!;
4734 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] map authorization denied (not in a game)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4735 }
4736 else if (strcasecmp(game_get_mapnamecxx . . $ pvpgn/bnetd/game_get_mapname(743fb6d1aa411c4e).(game), mapname) != 0) {
4737 val = SERVER_MAPAUTHREPLY1_NOcxx . . $ `src/common/bnet_protocol.h:3111:9`!;
4738 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] map authorization denied (map name \"{}\" does not match game map name \"{}\")", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), mapname, game_get_mapnamecxx . . $ pvpgn/bnetd/game_get_mapname(743fb6d1aa411c4e).(game));
4739 }
4740 else {
4741 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(game, game_status_started);
4742
4743 if (game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game) == game_type_ladder) {
4744 val = SERVER_MAPAUTHREPLY1_LADDER_OKcxx . . $ `src/common/bnet_protocol.h:3113:9`!;
4745 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] giving map ladder authorization (in a ladder game)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4746 }
4747 else if (ladder_check_mapcxx . . $ pvpgn/bnetd/ladder_check_map(d9e7688701682d37).(game_get_mapnamecxx . . $ pvpgn/bnetd/game_get_mapname(743fb6d1aa411c4e).(game), game_get_maptypecxx . . $ pvpgn/bnetd/game_get_maptype(8b14781ac714f1ed).(game), conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c))) {
4748 val = SERVER_MAPAUTHREPLY1_LADDER_OKcxx . . $ `src/common/bnet_protocol.h:3113:9`!;
4749 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] giving map ladder authorization (is a ladder map)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4750 }
4751 else {
4752 val = SERVER_MAPAUTHREPLY1_OKcxx . . $ `src/common/bnet_protocol.h:3112:9`!;
4753 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] giving map normal authorization", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4754 }
4755 }
4756
4757 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_mapauthreply1cxx . . $ pvpgn/t_server_mapauthreply1#));
4758 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_MAPAUTHREPLY1cxx . . $ `src/common/bnet_protocol.h:3105:9`!);
4759 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_mapauthreply1cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_mapauthreply1..responsecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_113#response., val);
4760 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
4761 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4762 }
4763 }
4764
4765 return 0;
4766 }
4767
4768 static int _client_mapauthreq2cxx . . $ pvpgn/bnetd/_client_mapauthreq2(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4769 {
4770 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
4771
4772 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_mapauthreq2cxx . . $ pvpgn/t_client_mapauthreq2#)) {
4773 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad MAPAUTHREQ2 packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_mapauthreq2cxx . . $ pvpgn/t_client_mapauthreq2#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4774 return -1;
4775 }
4776
4777 {
4778 char const *mapname;
4779 t_game *game;
4780
4781 if (!(mapname = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_mapauthreq2cxx . . $ pvpgn/t_client_mapauthreq2#), MAP_NAME_LENcxx . . $ MAP_NAME_LEN.))) {
4782 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad MAPAUTHREQ2 packet (missing or too long mapname)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4783 return -1;
4784 }
4785
4786 game = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c);
4787
4788 if (game) {
4789 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] map auth requested for map \"{}\" gametype \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), mapname, game_type_get_strcxx . . $ pvpgn/bnetd/game_type_get_str(99410026be00fa29).(game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game)));
4790 game_set_mapnamecxx . . $ pvpgn/bnetd/game_set_mapname(bfbe5c8efad5152b).(game, mapname);
4791 }
4792 else
4793 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] map auth requested when not in a game", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4794
4795 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
4796 unsigned int val;
4797
4798 if (!game) {
4799 val = SERVER_MAPAUTHREPLY2_NOcxx . . $ `src/common/bnet_protocol.h:3146:9`!;
4800 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] map authorization denied (not in a game)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4801 }
4802 else if (strcasecmp(game_get_mapnamecxx . . $ pvpgn/bnetd/game_get_mapname(743fb6d1aa411c4e).(game), mapname) != 0) {
4803 val = SERVER_MAPAUTHREPLY2_NOcxx . . $ `src/common/bnet_protocol.h:3146:9`!;
4804 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] map authorization denied (map name \"{}\" does not match game map name \"{}\")", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), mapname, game_get_mapnamecxx . . $ pvpgn/bnetd/game_get_mapname(743fb6d1aa411c4e).(game));
4805 }
4806 else {
4807 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(game, game_status_started);
4808
4809 if (game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game) == game_type_ladder) {
4810 val = SERVER_MAPAUTHREPLY2_LADDER_OKcxx . . $ `src/common/bnet_protocol.h:3148:9`!;
4811 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] giving map ladder authorization (in a ladder game)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4812 }
4813 else if (ladder_check_mapcxx . . $ pvpgn/bnetd/ladder_check_map(d9e7688701682d37).(game_get_mapnamecxx . . $ pvpgn/bnetd/game_get_mapname(743fb6d1aa411c4e).(game), game_get_maptypecxx . . $ pvpgn/bnetd/game_get_maptype(8b14781ac714f1ed).(game), conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c))) {
4814 val = SERVER_MAPAUTHREPLY2_LADDER_OKcxx . . $ `src/common/bnet_protocol.h:3148:9`!;
4815 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] giving map ladder authorization (is a ladder map)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4816 }
4817 else {
4818 val = SERVER_MAPAUTHREPLY2_OKcxx . . $ `src/common/bnet_protocol.h:3147:9`!;
4819 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] giving map normal authorization", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4820 }
4821 }
4822
4823 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_mapauthreply2cxx . . $ pvpgn/t_server_mapauthreply2#));
4824 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_MAPAUTHREPLY2cxx . . $ `src/common/bnet_protocol.h:3140:9`!);
4825 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_mapauthreply2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_mapauthreply2..responsecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_115#response., val);
4826 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
4827 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4828 }
4829 }
4830
4831 return 0;
4832 }
4833
4834 static int _client_changeclientcxx . . $ pvpgn/bnetd/_client_changeclient(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4835 {
4836 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_changeclientcxx . . $ pvpgn/t_client_changeclient#))
4837 {
4838 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLIENT_CHANGECLIENT packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_changeclientcxx . . $ pvpgn/t_client_changeclient#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4839 return -1;
4840 }
4841
4842 if (conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) != CLIENTTAG_WAR3XP_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:113:9`!
4843 || bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changeclientcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changeclient..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_140#clienttag.) != CLIENTTAG_WARCRAFT3_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:111:9`!)
4844 {
4845 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] invalid attempt to change client from {X} to {X}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changeclientcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changeclient..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_140#clienttag.));
4846 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(c, conn_state_destroy);
4847 return -1;
4848 }
4849
4850 conn_set_clienttagcxx . . $ pvpgn/bnetd/conn_set_clienttag(d97ad1b62a895b69).(c, bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changeclientcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changeclient..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_140#clienttag.));
4851
4852 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] changed client to {X}", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_changeclientcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_changeclient..clienttagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_140#clienttag.));
4853
4854 return 0;
4855 }
4856
4857 static int _client_clanmemberlistreqcxx . . $ pvpgn/bnetd/_client_clanmemberlistreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4858 {
4859 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_clanmemberlist_reqcxx . . $ pvpgn/t_client_clanmemberlist_req#)) {
4860 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLANMEMBERLIST_REQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clanmemberlist_reqcxx . . $ pvpgn/t_client_clanmemberlist_req#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4861 return -1;
4862 }
4863
4864 clan_send_memberlistcxx . . $ pvpgn/bnetd/clan_send_memberlist(8d07eb83d60bed1d).(c, packet);
4865 return 0;
4866 }
4867
4868 static int _client_clan_motdreqcxx . . $ pvpgn/bnetd/_client_clan_motdreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4869 {
4870 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_clan_motdreqcxx . . $ pvpgn/t_client_clan_motdreq#)) {
4871 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_MOTDREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clan_motdreqcxx . . $ pvpgn/t_client_clan_motdreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4872 return -1;
4873 }
4874
4875 clan_send_motd_replycxx . . $ pvpgn/bnetd/clan_send_motd_reply(8d07eb83d60bed1d).(c, packet);
4876 return 0;
4877 }
4878
4879 static int _client_clan_motdchgcxx . . $ pvpgn/bnetd/_client_clan_motdchg(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4880 {
4881 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_clan_motdreqcxx . . $ pvpgn/t_client_clan_motdreq#)) {
4882 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_MOTDCHGREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clan_motdreqcxx . . $ pvpgn/t_client_clan_motdreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4883 return -1;
4884 }
4885
4886 clan_save_motd_chgcxx . . $ pvpgn/bnetd/clan_save_motd_chg(8d07eb83d60bed1d).(c, packet);
4887 return 0;
4888 }
4889
4890 static int _client_clan_disbandreqcxx . . $ pvpgn/bnetd/_client_clan_disbandreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4891 {
4892 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
4893
4894 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_clan_disbandreqcxx . . $ pvpgn/t_client_clan_disbandreq#)) {
4895 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_DISBANDREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clan_disbandreqcxx . . $ pvpgn/t_client_clan_disbandreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4896 return -1;
4897 }
4898
4899 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
4900 t_clancxx . . $ pvpgn/bnetd/t_clan# *clan;
4901 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *member;
4902 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
4903
4904 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_clan_disbandreplycxx . . $ pvpgn/t_server_clan_disbandreply#));
4905 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLAN_DISBANDREPLYcxx . . $ `src/common/bnet_protocol.h:3841:9`!);
4906 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_disbandreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_disbandreply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_157#count., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_clan_disbandreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_clan_disbandreq..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_156#count.));
4907
4908 if (!((account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) && (clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(account)) && (member = account_get_clanmembercxx . . $ pvpgn/bnetd/account_get_clanmember(4ce48d4e65930331).(account)) && (clanmember_get_statuscxx . . $ pvpgn/bnetd/clanmember_get_status(54878624261d8c60).(member) >= CLAN_CHIEFTAINcxx . . $ `src/bnetd/clan.h:98:9`!))) {
4909 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "[{}] got suspicious CLAN_DISBANDREQ packet (request without required privileges)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4910 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_disbandreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_disbandreply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_157#result., CLAN_RESPONSE_NOT_AUTHORIZEDcxx . . $ `src/common/bnet_protocol.h:3958:9`!);
4911 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
4912 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4913 }
4914 else if ((clanlist_remove_clancxx . . $ pvpgn/bnetd/clanlist_remove_clan(6091e08b3a5a3db6).(clan) == 0) && (clan_removecxx . . $ pvpgn/bnetd/clan_remove(4c679297bf94b9eb).(clan_get_clantagcxx . . $ pvpgn/bnetd/clan_get_clantag(1e16ca1cec114489).(clan)) == 0)) {
4915 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_disbandreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_disbandreply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_157#result., CLAN_RESPONSE_SUCCESScxx . . $ `src/common/bnet_protocol.h:3951:9`!);
4916 clan_close_status_window_on_disbandcxx . . $ pvpgn/bnetd/clan_close_status_window_on_disband(6091e08b3a5a3db6).(clan);
4917 clan_send_packet_to_online_memberscxx . . $ pvpgn/bnetd/clan_send_packet_to_online_members(3930e223f0c15736).(clan, rpacket);
4918 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4919 clan_destroycxx . . $ pvpgn/bnetd/clan_destroy(6091e08b3a5a3db6).(clan);
4920 }
4921 else {
4922 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_disbandreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_disbandreply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_157#result., CLAN_RESPONSE_FAILcxx . . $ `src/common/bnet_protocol.h:3952:9`!);
4923 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
4924 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4925 }
4926 }
4927
4928 return 0;
4929 }
4930
4931 static int _client_clan_createreqcxx . . $ pvpgn/bnetd/_client_clan_createreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4932 {
4933 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_clan_createreqcxx . . $ pvpgn/t_client_clan_createreq#)) {
4934 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_INFOREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clan_createreqcxx . . $ pvpgn/t_client_clan_createreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4935 return -1;
4936 }
4937
4938 clan_get_possible_membercxx . . $ pvpgn/bnetd/clan_get_possible_member(8d07eb83d60bed1d).(c, packet);
4939
4940 return 0;
4941 }
4942
4943 static int _client_clan_createinvitereqcxx . . $ pvpgn/bnetd/_client_clan_createinvitereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
4944 {
4945 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
4946 unsigned size;
4947 const char *clanname;
4948 const char *username;
4949 t_clantagcxx . . $ pvpgn/bnetd/t_clantag# clantag;
4950 unsigned offset;
4951 t_clancxx . . $ pvpgn/bnetd/t_clan# *clan;
4952
4953 if ((size = packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet)) < sizeof(t_client_clan_createinvitereqcxx . . $ pvpgn/t_client_clan_createinvitereq#)) {
4954 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_CREATEINVITEREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clan_createinvitereqcxx . . $ pvpgn/t_client_clan_createinvitereq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
4955 return -1;
4956 }
4957 offset = sizeof(t_client_clan_createinvitereqcxx . . $ pvpgn/t_client_clan_createinvitereq#);
4958
4959 if (!(clanname = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, offset, CLAN_NAME_MAXcxx . . $ CLAN_NAME_MAX.))) {
4960 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_CREATEINVITEREQ packet (missing clanname)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4961 return -1;
4962 }
4963 offset += (stdcxx . . $ std/::strlen(clanname) + 1);
4964
4965 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < offset + 4) {
4966 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_CREATEINVITEREQ packet (missing clantag)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4967 return -1;
4968 }
4969 clantag = *((int *)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offset, 4));
4970 offset += 4;
4971
4972 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
4973 if ((clan = clan_createcxx . . $ pvpgn/bnetd/clan_create(52cf30ee556d2195).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c), clantag, clanname, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) && clanlist_add_clancxx . . $ pvpgn/bnetd/clanlist_add_clan(6091e08b3a5a3db6).(clan)) {
4974 char membercount;
4975 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < offset + 1) {
4976 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_CREATEINVITEREQ packet (missing membercount)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
4977 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
4978 return -1;
4979 }
4980 membercount = *((char *)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offset, 1));
4981 clan_set_createdcxx . . $ pvpgn/bnetd/clan_set_created(3a82cfd82b391e24).(clan, -membercount); /* FIXME: We should also check if membercount == count of names on end of this packet */
4982 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_clan_createinvitereqcxx . . $ pvpgn/t_server_clan_createinvitereq#));
4983 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLAN_CREATEINVITEREQcxx . . $ `src/common/bnet_protocol.h:3812:9`!);
4984 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_createinvitereqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_createinvitereq..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_154#count., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_clan_createinvitereqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_clan_createinvitereq..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_152#count.));
4985 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_createinvitereqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_createinvitereq..clantagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_154#clantag., clantag);
4986 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, clanname);
4987 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
4988 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(rpacket, packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offset, size - offset), size - offset); /* Pelish: we will send bad packet if we got bad packet... */
4989 offset++;
4990 do {
4991 username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, offset, MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.);
4992 if (username) {
4993 t_connection *conn;
4994 offset += (stdcxx . . $ std/::strlen(username) + 1);
4995 if ((conn = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(username)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
4996 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *clanmember;
4997 if (prefs_get_clan_newer_timecxx . . $ pvpgn/bnetd/prefs_get_clan_newer_time(db52760e79bf9054).() > 0) {
4998 clanmember = clan_add_membercxx . . $ pvpgn/bnetd/clan_add_member(d2839d873797151a).(clan, conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn), CLAN_NEWcxx . . $ `src/bnetd/clan.h:102:9`!);
4999 clanmember_set_fullmembercxx . . $ pvpgn/bnetd/clanmember_set_fullmember(7ffb9f43622f570).(clanmember, 1); /* FIXME: do only this here and no clan_add_member() */
5000 }
5001 else {
5002 clanmember = clan_add_membercxx . . $ pvpgn/bnetd/clan_add_member(d2839d873797151a).(clan, conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn), CLAN_PEONcxx . . $ `src/bnetd/clan.h:101:9`!);
5003 clanmember_set_fullmembercxx . . $ pvpgn/bnetd/clanmember_set_fullmember(7ffb9f43622f570).(clanmember, 1); /* FIXME: do only this here and no clan_add_member() */
5004 }
5005 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn, rpacket);
5006 }
5007 }
5008 } while (username && (offset < size));
5009 }
5010 else {
5011 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_clan_createinvitereplycxx . . $ pvpgn/t_server_clan_createinvitereply#));
5012 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLAN_CREATEINVITEREPLYcxx . . $ `src/common/bnet_protocol.h:3804:9`!);
5013 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_createinvitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_createinvitereply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_153#count., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_clan_createinvitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_clan_createinvitereply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_155#count.));
5014 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_createinvitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_createinvitereply..statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_153#status., 0);
5015 }
5016 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5017 }
5018
5019 return 0;
5020 }
5021
5022 static int _client_clan_createinvitereplycxx . . $ pvpgn/bnetd/_client_clan_createinvitereply(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
5023 {
5024 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
5025 t_connection *conn;
5026 t_clancxx . . $ pvpgn/bnetd/t_clan# *clan;
5027 const char *username;
5028 char status;
5029
5030 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_clan_createinvitereplycxx . . $ pvpgn/t_client_clan_createinvitereply#)) {
5031 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_CREATEINVITEREPLY packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clan_createinvitereqcxx . . $ pvpgn/t_client_clan_createinvitereq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
5032 return -1;
5033 }
5034 stdcxx . . $ std/::size_tcxx . . $ std/size_t# offset = sizeof(t_client_clan_createinvitereplycxx . . $ pvpgn/t_client_clan_createinvitereply#);
5035 username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, offset, MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.);
5036 if (!username)
5037 {
5038 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_CREATEINVITEREPLY packet (bad username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5039 return -1;
5040 }
5041 offset += (stdcxx . . $ std/::strlen(username) + 1);
5042 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < offset + 1) {
5043 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_CREATEINVITEREPLY packet (mising status)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5044 return -1;
5045 }
5046 status = *((char *)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offset, 1));
5047 if ((conn = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(username)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
5048 return -1;
5049 if ((clan = account_get_creating_clancxx . . $ pvpgn/bnetd/account_get_creating_clan(b1e25e267411fd2e).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn))) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
5050 return -1;
5051 if ((status != CLAN_RESPONSE_ACCEPTcxx . . $ `src/common/bnet_protocol.h:3957:9`!) && (rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
5052 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_clan_createinvitereplycxx . . $ pvpgn/t_server_clan_createinvitereply#));
5053 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLAN_CREATEINVITEREPLYcxx . . $ `src/common/bnet_protocol.h:3804:9`!);
5054 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_createinvitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_createinvitereply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_153#count., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_clan_createinvitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_clan_createinvitereply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_155#count.));
5055 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_createinvitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_createinvitereply..statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_153#status., status);
5056 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
5057 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn, rpacket);
5058 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5059 if (clan) {
5060 clanlist_remove_clancxx . . $ pvpgn/bnetd/clanlist_remove_clan(6091e08b3a5a3db6).(clan);
5061 clan_destroycxx . . $ pvpgn/bnetd/clan_destroy(6091e08b3a5a3db6).(clan);
5062 }
5063 }
5064 else {
5065 int created = clan_get_createdcxx . . $ pvpgn/bnetd/clan_get_created(6091e08b3a5a3db6).(clan);
5066 if (created > 0) {
5067 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "clan {} has already been created", clan_get_namecxx . . $ pvpgn/bnetd/clan_get_name(49ae76a143b2b3).(clan));
5068 return 0;
5069 }
5070 created++;
5071 if ((created >= 0) && (rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.))) {
5072 clan_set_createdcxx . . $ pvpgn/bnetd/clan_set_created(3a82cfd82b391e24).(clan, 1);
5073 clan_set_creation_timecxx . . $ pvpgn/bnetd/clan_set_creation_time(ac2f83eebe36ee1e).(clan, stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!));
5074 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_clan_createinvitereplycxx . . $ pvpgn/t_server_clan_createinvitereply#));
5075 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLAN_CREATEINVITEREPLYcxx . . $ `src/common/bnet_protocol.h:3804:9`!);
5076 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_createinvitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_createinvitereply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_153#count., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_clan_createinvitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_clan_createinvitereply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_155#count.));
5077 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_createinvitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_createinvitereply..statuscxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_153#status., CLAN_RESPONSE_SUCCESScxx . . $ `src/common/bnet_protocol.h:3951:9`!);
5078 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, "");
5079 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn, rpacket);
5080 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5081 clan_send_status_window_on_createcxx . . $ pvpgn/bnetd/clan_send_status_window_on_create(6091e08b3a5a3db6).(clan);
5082 clan_savecxx . . $ pvpgn/bnetd/clan_save(6091e08b3a5a3db6).(clan);
5083 }
5084 else
5085 clan_set_createdcxx . . $ pvpgn/bnetd/clan_set_created(3a82cfd82b391e24).(clan, created);
5086 }
5087 return 0;
5088 }
5089
5090 static int _client_clanmember_rankupdatereqcxx . . $ pvpgn/bnetd/_client_clanmember_rankupdatereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
5091 {
5092 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
5093
5094 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_clanmember_rankupdate_reqcxx . . $ pvpgn/t_client_clanmember_rankupdate_req#)) {
5095 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLANMEMBER_RANKUPDATE_REQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clanmember_rankupdate_reqcxx . . $ pvpgn/t_client_clanmember_rankupdate_req#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
5096 return -1;
5097 }
5098
5099 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
5100 {
5101 stdcxx . . $ std/::size_tcxx . . $ std/size_t# offset = sizeof(t_client_clanmember_rankupdate_reqcxx . . $ pvpgn/t_client_clanmember_rankupdate_req#);
5102 char status;
5103 t_clancxx . . $ pvpgn/bnetd/t_clan# *clan;
5104 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *dest_member;
5105 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *member;
5106 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
5107
5108 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_clanmember_rankupdate_replycxx . . $ pvpgn/t_server_clanmember_rankupdate_reply#));
5109 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLANMEMBER_RANKUPDATE_REPLYcxx . . $ `src/common/bnet_protocol.h:3973:9`!);
5110 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clanmember_rankupdate_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clanmember_rankupdate_reply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_169#count.,
5111 bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_clanmember_rankupdate_reqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_clanmember_rankupdate_req..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_168#count.));
5112 const char* const username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, offset, MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.);
5113 if (!username)
5114 {
5115 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] Could not retrieve username from CLANMEMBER_RANKUPDATE_REQ packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5116 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5117 return -1;
5118 }
5119
5120 offset += (stdcxx . . $ std/::strlen(username) + 1);
5121 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < offset + 1)
5122 {
5123 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLANMEMBER_RANKUPDATE_REQ packet (mising status)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5124 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5125 return -1;
5126 }
5127 status = *((char *)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offset, 1));
5128
5129 account = (conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c));
5130
5131 if ((clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(account)) && (member = clan_find_membercxx . . $ pvpgn/bnetd/clan_find_member(25bc33fde35a58c6).(clan, account))
5132 && (dest_member = clan_find_member_by_namecxx . . $ pvpgn/bnetd/clan_find_member_by_name(817adf809366c39).(clan, username)) && (member != dest_member)) {
5133 if ((status < CLAN_PEONcxx . . $ `src/bnetd/clan.h:101:9`!) || (status > CLAN_SHAMANcxx . . $ `src/bnetd/clan.h:99:9`!)) {
5134 /* PELISH: CLAN_NEW can not be promoted to anything
5135 * and also noone can be promoted to CLAN_CHIEFTAIN */
5136 DEBUG1cxx . . $ `src/common/eventlog.h:89:9`!("trying to change to bad status {}", status);
5137 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clanmember_rankupdate_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clanmember_rankupdate_reply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_169#result., SERVER_CLANMEMBER_RANKUPDATE_FAILEDcxx . . $ `src/common/bnet_protocol.h:3980:9`!);
5138 }
5139 else if ((((clanmember_get_statuscxx . . $ pvpgn/bnetd/clanmember_get_status(54878624261d8c60).(member) == CLAN_SHAMANcxx . . $ `src/bnetd/clan.h:99:9`!) && (status < CLAN_SHAMANcxx . . $ `src/bnetd/clan.h:99:9`!) && (clanmember_get_statuscxx . . $ pvpgn/bnetd/clanmember_get_status(54878624261d8c60).(dest_member) < CLAN_SHAMANcxx . . $ `src/bnetd/clan.h:99:9`!)) ||
5140 (clanmember_get_statuscxx . . $ pvpgn/bnetd/clanmember_get_status(54878624261d8c60).(member) == CLAN_CHIEFTAINcxx . . $ `src/bnetd/clan.h:98:9`!)) &&
5141 (clanmember_set_statuscxx . . $ pvpgn/bnetd/clanmember_set_status(8370cd72d0cb3a0b).(dest_member, status) == 0)) {
5142 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clanmember_rankupdate_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clanmember_rankupdate_reply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_169#result., SERVER_CLANMEMBER_RANKUPDATE_SUCCESScxx . . $ `src/common/bnet_protocol.h:3979:9`!);
5143 clanmember_on_change_statuscxx . . $ pvpgn/bnetd/clanmember_on_change_status(d12aaa857ef4d493).(dest_member);
5144 }
5145 else {
5146 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clanmember_rankupdate_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clanmember_rankupdate_reply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_169#result., SERVER_CLANMEMBER_RANKUPDATE_FAILEDcxx . . $ `src/common/bnet_protocol.h:3980:9`!);
5147 }
5148 }
5149 else {
5150 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clanmember_rankupdate_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clanmember_rankupdate_reply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_169#result., SERVER_CLANMEMBER_RANKUPDATE_FAILEDcxx . . $ `src/common/bnet_protocol.h:3980:9`!);
5151 }
5152 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
5153 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5154 }
5155
5156 return 0;
5157 }
5158
5159 static int _client_clanmember_removereqcxx . . $ pvpgn/bnetd/_client_clanmember_removereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
5160 {
5161 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
5162
5163 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_clanmember_remove_reqcxx . . $ pvpgn/t_client_clanmember_remove_req#)) {
5164 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLANMEMBER_REMOVE_REQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clanmember_remove_reqcxx . . $ pvpgn/t_client_clanmember_remove_req#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
5165 return -1;
5166 }
5167
5168 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
5169 t_accountcxx . . $ pvpgn/bnetd/t_account# *acc;
5170 t_clancxx . . $ pvpgn/bnetd/t_clan# *clan;
5171 const char *username;
5172 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *member;
5173 t_connection *dest_conn;
5174 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_clanmember_remove_replycxx . . $ pvpgn/t_server_clanmember_remove_reply#));
5175 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLANMEMBER_REMOVE_REPLYcxx . . $ `src/common/bnet_protocol.h:3906:9`!);
5176 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clanmember_remove_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clanmember_remove_reply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_165#count.,
5177 bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_clanmember_remove_reqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_clanmember_remove_req..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_164#count.));
5178 username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_clanmember_remove_reqcxx . . $ pvpgn/t_client_clanmember_remove_req#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.);
5179 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clanmember_remove_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clanmember_remove_reply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_165#result.,
5180 SERVER_CLANMEMBER_REMOVE_FAILEDcxx . . $ `src/common/bnet_protocol.h:3913:9`!); // initially presume it failed
5181
5182 if ((acc = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) && (clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(acc)) && (member = clan_find_member_by_namecxx . . $ pvpgn/bnetd/clan_find_member_by_name(817adf809366c39).(clan, username))) {
5183 dest_conn = clanmember_get_conncxx . . $ pvpgn/bnetd/clanmember_get_conn(6d9762d7066c7746).(member);
5184 if (clan_remove_membercxx . . $ pvpgn/bnetd/clan_remove_member(b047ad00324891dc).(clan, member) == 0) {
5185 t_packetcxx . . $ pvpgn/t_packet# *rpacket2;
5186 if (dest_conn) {
5187 clan_close_status_windowcxx . . $ pvpgn/bnetd/clan_close_status_window(c4dfbc2386fe4fc3).(dest_conn);
5188 conn_update_w3_playerinfocxx . . $ pvpgn/bnetd/conn_update_w3_playerinfo(c4dfbc2386fe4fc3).(dest_conn);
5189 channel_rejoincxx . . $ pvpgn/bnetd/channel_rejoin(c4dfbc2386fe4fc3).(dest_conn);
5190 }
5191 if ((rpacket2 = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
5192 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket2, sizeof(t_server_clanmember_removed_notifycxx . . $ pvpgn/t_server_clanmember_removed_notify#));
5193 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket2, SERVER_CLANMEMBER_REMOVED_NOTIFYcxx . . $ `src/common/bnet_protocol.h:4053:9`!);
5194 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket2, username);
5195 clan_send_packet_to_online_memberscxx . . $ pvpgn/bnetd/clan_send_packet_to_online_members(3930e223f0c15736).(clan, rpacket2);
5196 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket2);
5197 }
5198 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clanmember_remove_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clanmember_remove_reply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_165#result.,
5199 SERVER_CLANMEMBER_REMOVE_SUCCESScxx . . $ `src/common/bnet_protocol.h:3912:9`!);
5200 }
5201 }
5202 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
5203 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5204 }
5205
5206 return 0;
5207 }
5208
5209 static int _client_clan_membernewchiefreqcxx . . $ pvpgn/bnetd/_client_clan_membernewchiefreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
5210 {
5211 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
5212
5213 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_clan_membernewchiefreqcxx . . $ pvpgn/t_client_clan_membernewchiefreq#)) {
5214 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLIENT_CLAN_MEMBERNEWCHIEFREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clan_createreqcxx . . $ pvpgn/t_client_clan_createreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
5215 return -1;
5216 }
5217
5218 if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
5219 t_accountcxx . . $ pvpgn/bnetd/t_account# *acc;
5220 t_clancxx . . $ pvpgn/bnetd/t_clan# *clan;
5221 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *oldmember;
5222 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *newmember;
5223 const char *username;
5224 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_clan_membernewchiefreplycxx . . $ pvpgn/t_server_clan_membernewchiefreply#));
5225 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLAN_MEMBERNEWCHIEFREPLYcxx . . $ `src/common/bnet_protocol.h:3858:9`!);
5226 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_membernewchiefreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_membernewchiefreply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_159#count., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_clan_membernewchiefreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_clan_membernewchiefreq..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_158#count.));
5227 username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_clan_membernewchiefreqcxx . . $ pvpgn/t_client_clan_membernewchiefreq#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.);
5228 if ((acc = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) && (oldmember = account_get_clanmembercxx . . $ pvpgn/bnetd/account_get_clanmember(4ce48d4e65930331).(acc)) && (clanmember_get_statuscxx . . $ pvpgn/bnetd/clanmember_get_status(54878624261d8c60).(oldmember) == CLAN_CHIEFTAINcxx . . $ `src/bnetd/clan.h:98:9`!) && (clan = clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(oldmember)) && (newmember = clan_find_member_by_namecxx . . $ pvpgn/bnetd/clan_find_member_by_name(817adf809366c39).(clan, username)) && (clanmember_set_statuscxx . . $ pvpgn/bnetd/clanmember_set_status(8370cd72d0cb3a0b).(oldmember, CLAN_GRUNTcxx . . $ `src/bnetd/clan.h:100:9`!) == 0) && (clanmember_set_statuscxx . . $ pvpgn/bnetd/clanmember_set_status(8370cd72d0cb3a0b).(newmember, CLAN_CHIEFTAINcxx . . $ `src/bnetd/clan.h:98:9`!) == 0)) {
5229 clanmember_on_change_statuscxx . . $ pvpgn/bnetd/clanmember_on_change_status(d12aaa857ef4d493).(oldmember);
5230 clanmember_on_change_statuscxx . . $ pvpgn/bnetd/clanmember_on_change_status(d12aaa857ef4d493).(newmember);
5231 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_membernewchiefreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_membernewchiefreply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_159#result., SERVER_CLAN_MEMBERNEWCHIEFREPLY_SUCCESScxx . . $ `src/common/bnet_protocol.h:3864:9`!);
5232 clan_send_packet_to_online_memberscxx . . $ pvpgn/bnetd/clan_send_packet_to_online_members(3930e223f0c15736).(clan, rpacket);
5233 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5234 }
5235 else {
5236 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_membernewchiefreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_membernewchiefreply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_159#result., SERVER_CLAN_MEMBERNEWCHIEFREPLY_FAILEDcxx . . $ `src/common/bnet_protocol.h:3865:9`!);
5237 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
5238 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5239 }
5240 }
5241
5242 return 0;
5243 }
5244
5245 static int _client_clan_invitereqcxx . . $ pvpgn/bnetd/_client_clan_invitereq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
5246 {
5247 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
5248 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
5249 t_clancxx . . $ pvpgn/bnetd/t_clan# *clan;
5250 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *member;
5251 t_clantagcxx . . $ pvpgn/bnetd/t_clantag# clantag;
5252 const char *username;
5253 t_connection *conn;
5254 t_accountcxx . . $ pvpgn/bnetd/t_account# *conn_account;
5255 char response_code;
5256
5257 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_clan_invitereqcxx . . $ pvpgn/t_client_clan_invitereq#)) {
5258 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_INVITEREQ packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clan_invitereqcxx . . $ pvpgn/t_client_clan_invitereq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
5259 return -1;
5260 }
5261
5262 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_clan_invitereqcxx . . $ pvpgn/t_client_clan_invitereq#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
5263 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_INVITEREQ packet (missing or too long username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5264 return -1;
5265 }
5266
5267 if (rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)) {
5268
5269 // user not authorized
5270 if (!((account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) &&
5271 (clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(account)) &&
5272 (member = account_get_clanmembercxx . . $ pvpgn/bnetd/account_get_clanmember(4ce48d4e65930331).(account)) &&
5273 (clanmember_get_statuscxx . . $ pvpgn/bnetd/clanmember_get_status(54878624261d8c60).(member) >= CLAN_SHAMANcxx . . $ `src/bnetd/clan.h:99:9`!) &&
5274 (clantag = clan_get_clantagcxx . . $ pvpgn/bnetd/clan_get_clantag(1e16ca1cec114489).(clan)))) {
5275 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "[{}] got suspicious CLAN_INVITEREQ packet (request without required privileges)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5276 response_code = CLAN_RESPONSE_NOT_AUTHORIZEDcxx . . $ `src/common/bnet_protocol.h:3958:9`!;
5277 }
5278 else {
5279
5280 // target user not online
5281 if (!((conn = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(username)) &&
5282 (conn_account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn)))) {
5283 response_code = CLAN_RESPONSE_NOT_FOUNDcxx . . $ `src/common/bnet_protocol.h:3959:9`!;
5284
5285 // target user already in a clan or creating a clan
5286 }
5287 else if (account_get_clanmember_forcedcxx . . $ pvpgn/bnetd/account_get_clanmember_forced(4ce48d4e65930331).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn))) {
5288 response_code = CLAN_RESPONSE_NOT_FOUNDcxx . . $ `src/common/bnet_protocol.h:3959:9`!;
5289
5290 // clan allready ful
5291 }
5292 else if (clan_get_member_countcxx . . $ pvpgn/bnetd/clan_get_member_count(1e16ca1cec114489).(clan) >= prefs_get_clan_max_memberscxx . . $ pvpgn/bnetd/prefs_get_clan_max_members(db52760e79bf9054).()) {
5293 response_code = CLAN_RESPONSE_CLAN_FULLcxx . . $ `src/common/bnet_protocol.h:3960:9`!;
5294
5295 // valid invitereq
5296 }
5297 else {
5298 if (prefs_get_clan_newer_timecxx . . $ pvpgn/bnetd/prefs_get_clan_newer_time(db52760e79bf9054).() > 0) {
5299 clan_add_membercxx . . $ pvpgn/bnetd/clan_add_member(d2839d873797151a).(clan, conn_account, CLAN_NEWcxx . . $ `src/bnetd/clan.h:102:9`!);
5300 }
5301 else {
5302 clan_add_membercxx . . $ pvpgn/bnetd/clan_add_member(d2839d873797151a).(clan, conn_account, CLAN_PEONcxx . . $ `src/bnetd/clan.h:101:9`!);
5303 }
5304 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_clan_invitereqcxx . . $ pvpgn/t_server_clan_invitereq#));
5305 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLAN_INVITEREQcxx . . $ `src/common/bnet_protocol.h:3915:9`!);
5306 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_invitereqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_invitereq..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_166#count., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_clan_invitereqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_clan_invitereq..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_162#count.));
5307 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_invitereqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_invitereq..clantagcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_166#clantag., clantag);
5308 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, clan_get_namecxx . . $ pvpgn/bnetd/clan_get_name(49ae76a143b2b3).(clan));
5309 packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(rpacket, conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c));
5310 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn, rpacket);
5311 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5312 return 0;
5313 }
5314 }
5315
5316 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_clan_invitereplycxx . . $ pvpgn/t_server_clan_invitereply#));
5317 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLAN_INVITEREPLYcxx . . $ `src/common/bnet_protocol.h:3892:9`!);
5318 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_invitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_invitereply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_163#result., response_code);
5319 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_invitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_invitereply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_163#count., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_clan_invitereqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_clan_invitereq..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_162#count.));
5320
5321 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket);
5322 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5323 }
5324
5325 return 0;
5326 }
5327
5328 static int _client_clan_invitereplycxx . . $ pvpgn/bnetd/_client_clan_invitereply(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
5329 {
5330 t_packetcxx . . $ pvpgn/t_packet# *rpacket;
5331 t_accountcxx . . $ pvpgn/bnetd/t_account# *acc;
5332 t_clancxx . . $ pvpgn/bnetd/t_clan# *clan;
5333 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *member;
5334 const char *username;
5335 t_connection *conn;
5336 t_accountcxx . . $ pvpgn/bnetd/t_account# *conn_account;
5337 t_clancxx . . $ pvpgn/bnetd/t_clan# *conn_clan;
5338 t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# *conn_member;
5339 char status;
5340
5341 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_clan_invitereplycxx . . $ pvpgn/t_client_clan_invitereply#)) {
5342 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_INVITEREPLY packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_clan_createreqcxx . . $ pvpgn/t_client_clan_createreq#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
5343 return -1;
5344 }
5345 stdcxx . . $ std/::size_tcxx . . $ std/size_t# offset = sizeof(t_client_clan_invitereplycxx . . $ pvpgn/t_client_clan_invitereply#);
5346 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, offset, MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
5347 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_INVITEREPLY packet (missing username)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5348 return -1;
5349 }
5350 offset += (stdcxx . . $ std/::strlen(username) + 1);
5351 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < offset + 1) {
5352 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad CLAN_INVITEREPLY packet (mising status)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5353 return -1;
5354 }
5355 status = *((char *)packet_get_data_constcxx . . $ pvpgn/packet_get_data_const(9664b14508d475e9).(packet, offset, 1));
5356
5357 // reply without prior request
5358 if (!((acc = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) &&
5359 (member = account_get_clanmember_forcedcxx . . $ pvpgn/bnetd/account_get_clanmember_forced(4ce48d4e65930331).(acc)) &&
5360 (clan = clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(member)) &&
5361 (clanmember_get_fullmembercxx . . $ pvpgn/bnetd/clanmember_get_fullmember(d12aaa857ef4d493).(member) == 0))) {
5362 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "[{}] got suspicious CLAN_INVITEREPLY packet (reply without prior request)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5363 return -1;
5364
5365 // invalid inviter
5366 }
5367 else if (!((conn = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(username)) &&
5368 (conn_account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn)) &&
5369 (conn_clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(conn_account)) &&
5370 (conn_member = account_get_clanmembercxx . . $ pvpgn/bnetd/account_get_clanmember(4ce48d4e65930331).(conn_account)) &&
5371 (clanmember_get_statuscxx . . $ pvpgn/bnetd/clanmember_get_status(54878624261d8c60).(conn_member) >= CLAN_SHAMANcxx . . $ `src/bnetd/clan.h:99:9`!) &&
5372 (clan_get_clantagcxx . . $ pvpgn/bnetd/clan_get_clantag(1e16ca1cec114489).(clan) == clan_get_clantagcxx . . $ pvpgn/bnetd/clan_get_clantag(1e16ca1cec114489).(conn_clan)))) {
5373 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "[{}] got suspicious CLAN_INVITEREPLY packet (invalid inviter)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5374 return -1;
5375 }
5376
5377 if (rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_bnetcxx . . $ pvpgn/packet_class_bnet.)) {
5378 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_server_clan_invitereplycxx . . $ pvpgn/t_server_clan_invitereply#));
5379 packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, SERVER_CLAN_INVITEREPLYcxx . . $ `src/common/bnet_protocol.h:3892:9`!);
5380 bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_invitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_invitereply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_163#count., bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_clan_invitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_clan_invitereply..countcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_167#count.));
5381
5382 if (status != CLAN_RESPONSE_ACCEPTcxx . . $ `src/common/bnet_protocol.h:3957:9`!) {
5383 clan_remove_membercxx . . $ pvpgn/bnetd/clan_remove_member(b047ad00324891dc).(clan, member);
5384 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_invitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_invitereply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_163#result., status);
5385 }
5386 else {
5387 if (clan_get_member_countcxx . . $ pvpgn/bnetd/clan_get_member_count(1e16ca1cec114489).(clan) >= prefs_get_clan_max_memberscxx . . $ pvpgn/bnetd/prefs_get_clan_max_members(db52760e79bf9054).()) {
5388 clan_remove_membercxx . . $ pvpgn/bnetd/clan_remove_member(b047ad00324891dc).(clan, member);
5389 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_invitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_invitereply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_163#result., CLAN_RESPONSE_CLAN_FULLcxx . . $ `src/common/bnet_protocol.h:3960:9`!);
5390 }
5391 else
5392 {
5393 clanmember_set_fullmembercxx . . $ pvpgn/bnetd/clanmember_set_fullmember(7ffb9f43622f570).(member, 1);
5394 if (conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(c))
5395 {
5396 conn_update_w3_playerinfocxx . . $ pvpgn/bnetd/conn_update_w3_playerinfo(c4dfbc2386fe4fc3).(c);
5397 channel_set_userflagscxx . . $ pvpgn/bnetd/channel_set_userflags(c4dfbc2386fe4fc3).(c);
5398
5399 stdcxx . . $ std/::stringcxx . . $ std/string# channelname("Clan " +cxx . . $ std/operator+(39ed2c165380f78e). stdcxx . . $ std/::stringcxx . . $ std/string#(clantag_to_strcxx . . $ pvpgn/bnetd/clantag_to_str(81a3ae90da26a711).(clan_get_clantagcxx . . $ pvpgn/bnetd/clan_get_clantag(1e16ca1cec114489).(clan))));
5400 if (conn_set_channelcxx . . $ pvpgn/bnetd/conn_set_channel(2e9022cda97b266d).(c, channelname.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()) < 0)
5401 {
5402 conn_set_channelcxx . . $ pvpgn/bnetd/conn_set_channel(2e9022cda97b266d).(c, CHANNEL_NAME_BANNEDcxx . . $ `src/bnetd/channel.h:125:9`!); /* should not fail */
5403 }
5404 clanmember_set_onlinecxx . . $ pvpgn/bnetd/clanmember_set_online(c4dfbc2386fe4fc3).(c);
5405 }
5406 clan_send_status_windowcxx . . $ pvpgn/bnetd/clan_send_status_window(c4dfbc2386fe4fc3).(c);
5407 bn_byte_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_clan_invitereplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_clan_invitereply..resultcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_163#result., CLAN_RESPONSE_SUCCESScxx . . $ `src/common/bnet_protocol.h:3951:9`!);
5408 }
5409 }
5410 }
5411
5412 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn, rpacket);
5413 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket);
5414
5415 return 0;
5416 }
5417
5418 static int _client_crashdumpcxx . . $ pvpgn/bnetd/_client_crashdump(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
5419 {
5420 return 0;
5421 }
5422
5423 static int _client_setemailreplycxx . . $ pvpgn/bnetd/_client_setemailreply(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
5424 {
5425 char const *email;
5426 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
5427
5428 if (!(email = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_client_setemailreplycxx . . $ pvpgn/t_client_setemailreply#), MAX_EMAIL_STRcxx . . $ MAX_EMAIL_STR.))) {
5429 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad SETEMAILREPLY packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5430 return -1;
5431 }
5432 if (!(account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c))) {
5433 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account for connection in setemail request");
5434 return -1;
5435 }
5436 if (account_get_emailcxx . . $ pvpgn/bnetd/account_get_email(4b37305d4a4563d0).(account)) {
5437 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] account \"{}\" already have email set, ignore set email", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account));
5438 return 0;
5439 }
5440 if (account_set_emailcxx . . $ pvpgn/bnetd/account_set_email(6a8854b990ebab09).(account, emailcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).) < 0) {
5441 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] failed to init account \"{}\" email to \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account), email);
5442 return 0;
5443 }
5444 else
5445 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] init account \"{}\" email to \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account), email);
5446 return 0;
5447 }
5448
5449 static int _client_changeemailreqcxx . . $ pvpgn/bnetd/_client_changeemailreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
5450 {
5451 char const *oldaddr;
5452 char const *newaddr;
5453 char const *username;
5454 char const *email;
5455 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
5456 int pos;
5457
5458 pos = sizeof(t_client_changeemailreqcxx . . $ pvpgn/t_client_changeemailreq#);
5459 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, pos, MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
5460 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad username in CHANGEEMAILREQ packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5461 return -1;
5462 }
5463 pos += (stdcxx . . $ std/::strlen(username) + 1);
5464 if (!(oldaddr = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, pos, MAX_EMAIL_STRcxx . . $ MAX_EMAIL_STR.))) {
5465 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad old email in CHANGEEMAILREQ packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5466 return -1;
5467 }
5468 pos += (stdcxx . . $ std/::strlen(oldaddr) + 1);
5469 if (!(newaddr = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, pos, MAX_EMAIL_STRcxx . . $ MAX_EMAIL_STR.))) {
5470 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad new email in CHANGEEMAILREQ packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5471 return -1;
5472 }
5473 if (!(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username))) {
5474 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] change email for \"{}\" refused (no such account)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
5475 return 0;
5476 }
5477 if (!(email = account_get_emailcxx . . $ pvpgn/bnetd/account_get_email(4b37305d4a4563d0).(account)) || !email[0]) {
5478 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] account \"{}\" do not have email set, ignore changing", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account));
5479 return 0;
5480 }
5481 if (strcasecmp(email, oldaddr)) {
5482 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] account \"{}\" email mismatch, ignore changing", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account));
5483 return 0;
5484 }
5485 if (account_set_emailcxx . . $ pvpgn/bnetd/account_set_email(6a8854b990ebab09).(account, newaddrcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).) < 0) {
5486 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] failed to change account \"{}\" email to \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account), newaddr);
5487 return 0;
5488 }
5489 else
5490 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] change account \"{}\" email to \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account), newaddr);
5491 return 0;
5492 }
5493
5494 static int _client_getpasswordreqcxx . . $ pvpgn/bnetd/_client_getpasswordreq(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
5495 {
5496 char const *username;
5497 char const *try_email;
5498 char const *email;
5499 t_accountcxx . . $ pvpgn/bnetd/t_account# *account;
5500 int pos;
5501
5502 pos = sizeof(t_client_getpasswordreqcxx . . $ pvpgn/t_client_getpasswordreq#);
5503 if (!(username = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, pos, MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) {
5504 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad username in GETPASSWORDREQ packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5505 return -1;
5506 }
5507 pos += (stdcxx . . $ std/::strlen(username) + 1);
5508 if (!(try_email = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, pos, MAX_EMAIL_STRcxx . . $ MAX_EMAIL_STR.))) {
5509 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad email in GETPASSWORDREQ packet", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5510 return -1;
5511 }
5512 if (!(account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username))) {
5513 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] get password for \"{}\" refused (no such account)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), username);
5514 return 0;
5515 }
5516 if (!(email = account_get_emailcxx . . $ pvpgn/bnetd/account_get_email(4b37305d4a4563d0).(account)) || !email[0]) {
5517 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] account \"{}\" do not have email set, ignore get password", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account));
5518 return 0;
5519 }
5520 if (strcasecmp(email, try_email)) {
5521 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] account \"{}\" email mismatch, ignore get password", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account));
5522 return 0;
5523 }
5524 /* TODO: send mail to user with the real password or changed password!?
5525 * (as we cannot get the real password back, we should only change the password) --Soar */
5526 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "[{}] get password for account \"{}\" to email \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account), email);
5527 return 0;
5528 }
5529
5530
5531
5532 static int _client_extraworkcxx . . $ pvpgn/bnetd/_client_extrawork(8d07eb83d60bed1d).(t_connection * c, t_packetcxx . . $ pvpgn/t_packet# const *const packet)
5533 {
5534 if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_client_extraworkcxx . . $ pvpgn/t_client_extrawork#)) {
5535 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad EXTRAWORK packet (expected {} bytes, got {})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), sizeof(t_client_extraworkcxx . . $ pvpgn/t_client_extrawork#), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet));
5536 return -1;
5537 }
5538 {
5539 short gametype;
5540 short length;
5541 const char * data;
5542 stdcxx . . $ std/::stringcxx . . $ std/string# data_scxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
5543
5544 gametype = bn_short_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_extraworkcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_extrawork..gametypecxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_179#gametype.);
5545 length = bn_short_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_extraworkcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_extrawork..lengthcxx . . $ pvpgn/$anonymous_type_37d0d0c67ba6cc0e_179#length.);
5546
5547 if (!(data = (const char *)packet_get_raw_data_constcxx . . $ pvpgn/packet_get_raw_data_const(1f58ab00371793b4).(packet, sizeof(t_client_extraworkcxx . . $ pvpgn/t_client_extrawork#)))) {
5548 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "[{}] got bad EXTRAWORK packet (missing or too long data)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c));
5549 return -1;
5550 }
5551 // extract substring with given length
5552 data_s =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). stdcxx . . $ std/::stringcxx . . $ std/string#(data).substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(0, length);
5553 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] Received EXTRAWORK packet with GameType: {} and Length: {} ({})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(c), gametype, length, data_s.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
5554
5555 #ifdef WITH_LUA
5556 lua_handle_client_extrawork(c, gametype, length, data_s.c_str());
5557 #endif
5558 }
5559 return 0;
5560 }
5561
5562 }
5563
5564 }