| 1 | /* |
| 2 | * Copyright (C) 1998,1999,2000,2001 Ross Combs ([email protected]) |
| 3 | * Copyright (C) 2000,2001 Marco Ziech ([email protected]) |
| 4 | * Copyright (C) 2002,2003,2004 Dizzy |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version 2 |
| 9 | * of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | */ |
| 20 | #define ACCOUNT_INTERNAL_ACCESScxx . . $ `src/bnetd/account.cpp:20:9`! |
| 21 | #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/ |
| 22 | #include "account.h"cxx . . $ `<file>/src/bnetd/account.h`/ |
| 23 | |
| 24 | #include <cstddef> |
| 25 | #include <cassert> |
| 26 | #include <cctype> |
| 27 | #include <chrono> |
| 28 | |
| 29 | #include "compat/strdup.h"cxx . . $ `<file>/src/compat/strdup.h`/ |
| 30 | #include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/ |
| 31 | #include "compat/strncasecmp.h"cxx . . $ `<file>/src/compat/strncasecmp.h`/ |
| 32 | #include "compat/pdir.h"cxx . . $ `<file>/src/compat/pdir.h`/ |
| 33 | #include "common/list.h"cxx . . $ `<file>/src/common/list.h`/ |
| 34 | #include "common/elist.h"cxx . . $ `<file>/src/common/elist.h`/ |
| 35 | #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 36 | #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 37 | #include "common/field_sizes.h"cxx . . $ `<file>/src/common/field_sizes.h`/ |
| 38 | #include "common/bnethash.h"cxx . . $ `<file>/src/common/bnethash.h`/ |
| 39 | #include "common/introtate.h"cxx . . $ `<file>/src/common/introtate.h`/ |
| 40 | |
| 41 | #include "prefs.h"cxx . . $ `<file>/src/bnetd/prefs.h`/ |
| 42 | #include "account_wrap.h"cxx . . $ `<file>/src/bnetd/account_wrap.h`/ |
| 43 | #include "common/hashtable.h"cxx . . $ `<file>/src/common/hashtable.h`/ |
| 44 | #include "connection.h"cxx . . $ `<file>/src/bnetd/connection.h`/ |
| 45 | #include "watch.h"cxx . . $ `<file>/src/bnetd/watch.h`/ |
| 46 | #include "friends.h"cxx . . $ `<file>/src/bnetd/friends.h`/ |
| 47 | #include "team.h"cxx . . $ `<file>/src/bnetd/team.h`/ |
| 48 | #include "common/tag.h"cxx . . $ `<file>/src/common/tag.h`/ |
| 49 | #include "ladder.h"cxx . . $ `<file>/src/bnetd/ladder.h`/ |
| 50 | #include "clan.h"cxx . . $ `<file>/src/bnetd/clan.h`/ |
| 51 | #include "server.h"cxx . . $ `<file>/src/bnetd/server.h`/ |
| 52 | #include "attrgroup.h"cxx . . $ `<file>/src/bnetd/attrgroup.h`/ |
| 53 | #include "attrlayer.h"cxx . . $ `<file>/src/bnetd/attrlayer.h`/ |
| 54 | #include "storage.h"cxx . . $ `<file>/src/bnetd/storage.h`/ |
| 55 | #include "common/flags.h"cxx . . $ `<file>/src/common/flags.h`/ |
| 56 | #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/ |
| 57 | #include "common/xstring.h"cxx . . $ `<file>/src/common/xstring.h`/ |
| 58 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 59 | |
| 60 | namespace pvpgncxx . . $ pvpgn/ |
| 61 | { |
| 62 | |
| 63 | namespace bnetdcxx . . $ pvpgn/bnetd/ |
| 64 | { |
| 65 | |
| 66 | static t_hashtablecxx . . $ pvpgn/t_hashtable# * accountlist_headcxx . . $ pvpgn/bnetd/accountlist_head. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 67 | static t_hashtablecxx . . $ pvpgn/t_hashtable# * accountlist_uid_headcxx . . $ pvpgn/bnetd/accountlist_uid_head. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 68 | |
| 69 | unsigned int maxuseridcxx . . $ pvpgn/bnetd/maxuserid. = 0; |
| 70 | |
| 71 | /* This is to force the creation of all accounts when we initially load the accountlist. */ |
| 72 | static int force_account_addcxx . . $ pvpgn/bnetd/force_account_add. = 0; |
| 73 | |
| 74 | static unsigned int account_hashcxx . . $ pvpgn/bnetd/account_hash(c61c63047ce273de).(char const * username); |
| 75 | static t_accountcxx . . $ pvpgn/bnetd/t_account# * account_loadcxx . . $ pvpgn/bnetd/account_load(77650b37a34ee6ec).(t_attrgroupcxx . . $ pvpgn/bnetd/t_attrgroup# *); |
| 76 | static int account_load_friendscxx . . $ pvpgn/bnetd/account_load_friends(367bfb076f70247b).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account); |
| 77 | static int account_unload_friendscxx . . $ pvpgn/bnetd/account_unload_friends(367bfb076f70247b).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account); |
| 78 | static void account_destroycxx . . $ pvpgn/bnetd/account_destroy(a405232c11a3fb7b).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account); |
| 79 | static t_accountcxx . . $ pvpgn/bnetd/t_account# * accountlist_add_accountcxx . . $ pvpgn/bnetd/accountlist_add_account(473656eae0be4930).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account); |
| 80 | |
| 81 | static unsigned int account_hashcxx . . $ pvpgn/bnetd/account_hash(c61c63047ce273de).(char const *username) |
| 82 | { |
| 83 | register unsigned int h; |
| 84 | register unsigned int len = stdcxx . . $ std/::strlen(username); |
| 85 | |
| 86 | int c; |
| 87 | for (h = 5381; len > 0; --len, ++username) { |
| 88 | h += h << 5; |
| 89 | |
| 90 | c = (int)*username; |
| 91 | // FIXME: (HarpyWar) I add this condition because if we call connlist_find_connection_by_accountname |
| 92 | // with wrong account name, then it fails on std::isupper(c) |
| 93 | if (c < -1 || c > 255) |
| 94 | break; |
| 95 | |
| 96 | if (stdcxx . . $ std/::isuppercxx . . $ std/isupper(a1851578aea3f541).(c) == 0) |
| 97 | h ^= *username; |
| 98 | else |
| 99 | h ^= stdcxx . . $ std/::tolowercxx . . $ std/tolower(a1851578aea3f541).(c); |
| 100 | } |
| 101 | return h; |
| 102 | } |
| 103 | |
| 104 | |
| 105 | static t_accountcxx . . $ pvpgn/bnetd/t_account# * account_createcxx . . $ pvpgn/bnetd/account_create(fdad4c38d937b650).(char const * username, char const * passhash1) |
| 106 | { |
| 107 | t_accountcxx . . $ pvpgn/bnetd/t_account# * account; |
| 108 | |
| 109 | if (username && !passhash1) { |
| 110 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL passhash1"); |
| 111 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 112 | } |
| 113 | |
| 114 | if (username && account_check_namecxx . . $ pvpgn/bnetd/account_check_name(5c4306d8553b3696).(username)) { |
| 115 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got invalid chars in username"); |
| 116 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 117 | } |
| 118 | |
| 119 | account = (t_accountcxx . . $ pvpgn/bnetd/t_account#*)xmalloccxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/xalloc.h:43:9`!(sizeof(t_account)); |
| 120 | |
| 121 | account->namecxx . . $ pvpgn/bnetd/account_struct#name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 122 | account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 123 | account->attrgroupcxx . . $ pvpgn/bnetd/account_struct#attrgroup. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 124 | account->friendscxx . . $ pvpgn/bnetd/account_struct#friends. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 125 | account->teamscxx . . $ pvpgn/bnetd/account_struct#teams. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 126 | account->conncxx . . $ pvpgn/bnetd/account_struct#conn. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 127 | FLAG_ZEROcxx . . $ `src/common/flags.h:22:9`!(&account->flags); |
| 128 | |
| 129 | account->namehashcxx . . $ pvpgn/bnetd/account_struct#namehash. = 0; /* hash it later before inserting */ |
| 130 | account->uidcxx . . $ pvpgn/bnetd/account_struct#uid. = 0; /* hash it later before inserting */ |
| 131 | |
| 132 | if (username) |
| 133 | { |
| 134 | /* actually making a new account */ |
| 135 | /* first check if such a username already owns an account. |
| 136 | * we search in the memory hash mainly for non-indexed storage types. |
| 137 | * indexed storage types check themselves if the username exists already |
| 138 | * in the storage (see storage_sql.c) */ |
| 139 | if (accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username)) { |
| 140 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "user \"{}\" already has an account", username); |
| 141 | goto err; |
| 142 | } |
| 143 | |
| 144 | account->attrgroupcxx . . $ pvpgn/bnetd/account_struct#attrgroup. = attrgroup_create_newusercxx . . $ pvpgn/bnetd/attrgroup_create_newuser(6822726a480688df).(username); |
| 145 | if (!account->attrgroupcxx . . $ pvpgn/bnetd/account_struct#attrgroup.) { |
| 146 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "failed to add user"); |
| 147 | goto err; |
| 148 | } |
| 149 | |
| 150 | account->namecxx . . $ pvpgn/bnetd/account_struct#name. = xstrdupcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/xalloc.h:49:9`!(username); |
| 151 | |
| 152 | if (account_set_strattrcxx . . $ pvpgn/bnetd/account_set_strattr(47d7ee6351fa1de3).(account, "BNET\\acct\\username", username) < 0) { |
| 153 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not set username"); |
| 154 | goto err; |
| 155 | } |
| 156 | |
| 157 | if (account_set_numattrcxx . . $ pvpgn/bnetd/account_set_numattr(b06e4a21d084b754).(account, "BNET\\acct\\userid", maxuseridcxx . . $ pvpgn/bnetd/maxuserid. + 1) < 0) { |
| 158 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not set userid"); |
| 159 | goto err; |
| 160 | } |
| 161 | |
| 162 | if (account_set_strattrcxx . . $ pvpgn/bnetd/account_set_strattr(47d7ee6351fa1de3).(account, "BNET\\acct\\passhash1", passhash1) < 0) { |
| 163 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not set passhash1"); |
| 164 | goto err; |
| 165 | } |
| 166 | |
| 167 | if (account_set_numattrcxx . . $ pvpgn/bnetd/account_set_numattr(b06e4a21d084b754).(account, "BNET\\acct\\ctime", (unsigned int)nowcxx . . $ pvpgn/bnetd/now.)) { |
| 168 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not set ctime"); |
| 169 | goto err; |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | return account; |
| 174 | |
| 175 | err: |
| 176 | account_destroycxx . . $ pvpgn/bnetd/account_destroy(a405232c11a3fb7b).(account); |
| 177 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 178 | } |
| 179 | |
| 180 | static void account_destroycxx . . $ pvpgn/bnetd/account_destroy(a405232c11a3fb7b).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 181 | { |
| 182 | assertcxx . . $ `/usr/include/assert.h:102:11`!(account); |
| 183 | |
| 184 | friendlist_closecxx . . $ pvpgn/bnetd/friendlist_close(20db0232078327de).(account->friendscxx . . $ pvpgn/bnetd/account_struct#friends.); |
| 185 | teams_destroycxx . . $ pvpgn/bnetd/teams_destroy(20db0232078327de).(account->teamscxx . . $ pvpgn/bnetd/account_struct#teams.); |
| 186 | if (account->attrgroupcxx . . $ pvpgn/bnetd/account_struct#attrgroup.) |
| 187 | attrgroup_destroycxx . . $ pvpgn/bnetd/attrgroup_destroy(4a06131a44a32a35).(account->attrgroupcxx . . $ pvpgn/bnetd/account_struct#attrgroup.); |
| 188 | if (account->namecxx . . $ pvpgn/bnetd/account_struct#name.) |
| 189 | xfreecxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/xalloc.h:51:9`!(account->name); |
| 190 | |
| 191 | xfreecxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/xalloc.h:51:9`!(account); |
| 192 | } |
| 193 | |
| 194 | |
| 195 | extern unsigned int account_get_uid_realcxx . . $ pvpgn/bnetd/account_get_uid_real(71710757b6259f24).(t_accountcxx . . $ pvpgn/bnetd/t_account# const * account, char const * fn, unsigned int ln) |
| 196 | { |
| 197 | if (!account) { |
| 198 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account (from {}:{})", fn, ln); |
| 199 | return 0; |
| 200 | } |
| 201 | |
| 202 | return account->uidcxx . . $ pvpgn/bnetd/account_struct#uid.; |
| 203 | } |
| 204 | |
| 205 | |
| 206 | extern int account_matchcxx . . $ pvpgn/bnetd/account_match(4b12bc5edcfaeac7).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, char const * username) |
| 207 | { |
| 208 | unsigned int userid = 0; |
| 209 | unsigned int namehash; |
| 210 | char const * tname; |
| 211 | |
| 212 | if (!account) |
| 213 | { |
| 214 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 215 | return -1; |
| 216 | } |
| 217 | if (!username) |
| 218 | { |
| 219 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL username"); |
| 220 | return -1; |
| 221 | } |
| 222 | |
| 223 | if (username[0] == '#') |
| 224 | if (str_to_uintcxx . . $ pvpgn/str_to_uint(6974107818eeb505).(&username[1], &userid) < 0) |
| 225 | userid = 0; |
| 226 | |
| 227 | if (userid) |
| 228 | { |
| 229 | if (account->uidcxx . . $ pvpgn/bnetd/account_struct#uid. == userid) |
| 230 | return 1; |
| 231 | } |
| 232 | else |
| 233 | { |
| 234 | namehash = account_hashcxx . . $ pvpgn/bnetd/account_hash(c61c63047ce273de).(username); |
| 235 | if (account->namehashcxx . . $ pvpgn/bnetd/account_struct#namehash. == namehash && |
| 236 | (tname = account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account))) |
| 237 | { |
| 238 | if (strcasecmp(tname, username) == 0) |
| 239 | return 1; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | return 0; |
| 244 | } |
| 245 | |
| 246 | |
| 247 | extern int account_savecxx . . $ pvpgn/bnetd/account_save(43f7d0f5a7c4b307).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, unsigned flags) |
| 248 | { |
| 249 | assertcxx . . $ `/usr/include/assert.h:102:11`!(account); |
| 250 | |
| 251 | return attrgroup_savecxx . . $ pvpgn/bnetd/attrgroup_save(fe3030925edb1d32).(account->attrgroupcxx . . $ pvpgn/bnetd/account_struct#attrgroup., flags); |
| 252 | } |
| 253 | |
| 254 | |
| 255 | extern int account_flushcxx . . $ pvpgn/bnetd/account_flush(43f7d0f5a7c4b307).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, unsigned flags) |
| 256 | { |
| 257 | int res; |
| 258 | |
| 259 | assertcxx . . $ `/usr/include/assert.h:102:11`!(account); |
| 260 | |
| 261 | res = attrgroup_flushcxx . . $ pvpgn/bnetd/attrgroup_flush(fe3030925edb1d32).(account->attrgroupcxx . . $ pvpgn/bnetd/account_struct#attrgroup., flags); |
| 262 | if (res < 0) return res; |
| 263 | |
| 264 | account_unload_friendscxx . . $ pvpgn/bnetd/account_unload_friends(367bfb076f70247b).(account); |
| 265 | |
| 266 | return res; |
| 267 | } |
| 268 | |
| 269 | |
| 270 | extern char const * account_get_strattr_realcxx . . $ pvpgn/bnetd/account_get_strattr_real(95f204def2b9fb07).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, char const * key, char const * fn, unsigned int ln) |
| 271 | { |
| 272 | if (!account) { |
| 273 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account (from {}:{})", fn, ln); |
| 274 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 275 | } |
| 276 | |
| 277 | if (!key) { |
| 278 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL key (from {}:{})", fn, ln); |
| 279 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 280 | } |
| 281 | |
| 282 | return attrgroup_get_attrcxx . . $ pvpgn/bnetd/attrgroup_get_attr(3e86f89d9efd4044).(account->attrgroupcxx . . $ pvpgn/bnetd/account_struct#attrgroup., key); |
| 283 | } |
| 284 | |
| 285 | extern int account_set_strattrcxx . . $ pvpgn/bnetd/account_set_strattr(47d7ee6351fa1de3).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, char const * key, char const * val) |
| 286 | { |
| 287 | if (!account) { |
| 288 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 289 | return 0; |
| 290 | } |
| 291 | |
| 292 | if (!key) { |
| 293 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL key"); |
| 294 | return -1; |
| 295 | } |
| 296 | |
| 297 | return attrgroup_set_attrcxx . . $ pvpgn/bnetd/attrgroup_set_attr(3b126050c6ffe578).(account->attrgroupcxx . . $ pvpgn/bnetd/account_struct#attrgroup., key, val); |
| 298 | } |
| 299 | |
| 300 | static t_accountcxx . . $ pvpgn/bnetd/t_account# * account_loadcxx . . $ pvpgn/bnetd/account_load(77650b37a34ee6ec).(t_attrgroupcxx . . $ pvpgn/bnetd/t_attrgroup# *attrgroup) |
| 301 | { |
| 302 | t_accountcxx . . $ pvpgn/bnetd/t_account# * account; |
| 303 | |
| 304 | assertcxx . . $ `/usr/include/assert.h:102:11`!(attrgroup); |
| 305 | |
| 306 | if (!(account = account_createcxx . . $ pvpgn/bnetd/account_create(fdad4c38d937b650).(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`!))) { |
| 307 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not create account"); |
| 308 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 309 | } |
| 310 | |
| 311 | account->attrgroupcxx . . $ pvpgn/bnetd/account_struct#attrgroup. = attrgroup; |
| 312 | |
| 313 | return account; |
| 314 | } |
| 315 | |
| 316 | static t_accountcxx . . $ pvpgn/bnetd/t_account# * account_load_newcxx . . $ pvpgn/bnetd/account_load_new(12c6cbb6f1dc4ea3).(char const * name, unsigned uid) |
| 317 | { |
| 318 | t_accountcxx . . $ pvpgn/bnetd/t_account# *account; |
| 319 | t_attrgroupcxx . . $ pvpgn/bnetd/t_attrgroup# *attrgroup; |
| 320 | |
| 321 | if (name && account_check_namecxx . . $ pvpgn/bnetd/account_check_name(5c4306d8553b3696).(name)) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 322 | |
| 323 | force_account_addcxx . . $ pvpgn/bnetd/force_account_add. = 1; /* disable the protection */ |
| 324 | |
| 325 | attrgroup = attrgroup_create_nameuidcxx . . $ pvpgn/bnetd/attrgroup_create_nameuid(bbf52630eb81381c).(name, uid); |
| 326 | if (!attrgroup) { |
| 327 | force_account_addcxx . . $ pvpgn/bnetd/force_account_add. = 0; |
| 328 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 329 | } |
| 330 | |
| 331 | if (!(account = account_loadcxx . . $ pvpgn/bnetd/account_load(77650b37a34ee6ec).(attrgroup))) { |
| 332 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not load account"); |
| 333 | attrgroup_destroycxx . . $ pvpgn/bnetd/attrgroup_destroy(4a06131a44a32a35).(attrgroup); |
| 334 | force_account_addcxx . . $ pvpgn/bnetd/force_account_add. = 0; |
| 335 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 336 | } |
| 337 | |
| 338 | if (!accountlist_add_accountcxx . . $ pvpgn/bnetd/accountlist_add_account(473656eae0be4930).(account)) { |
| 339 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not add account to list"); |
| 340 | account_destroycxx . . $ pvpgn/bnetd/account_destroy(a405232c11a3fb7b).(account); |
| 341 | force_account_addcxx . . $ pvpgn/bnetd/force_account_add. = 0; |
| 342 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 343 | } |
| 344 | |
| 345 | force_account_addcxx . . $ pvpgn/bnetd/force_account_add. = 0; |
| 346 | |
| 347 | return account; |
| 348 | } |
| 349 | |
| 350 | static int _cb_read_accountscxx . . $ pvpgn/bnetd/_cb_read_accounts(5c1d8b1d7ec6e769).(t_attrgroupcxx . . $ pvpgn/bnetd/t_attrgroup# *attrgroup, void *data) |
| 351 | { |
| 352 | unsigned int *count = (unsigned int *)data; |
| 353 | t_accountcxx . . $ pvpgn/bnetd/t_account# *account; |
| 354 | |
| 355 | if (!(account = account_loadcxx . . $ pvpgn/bnetd/account_load(77650b37a34ee6ec).(attrgroup))) { |
| 356 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not load account"); |
| 357 | attrgroup_destroycxx . . $ pvpgn/bnetd/attrgroup_destroy(4a06131a44a32a35).(attrgroup); |
| 358 | return -1; |
| 359 | } |
| 360 | |
| 361 | if (!accountlist_add_accountcxx . . $ pvpgn/bnetd/accountlist_add_account(473656eae0be4930).(account)) { |
| 362 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not add account to list"); |
| 363 | account_destroycxx . . $ pvpgn/bnetd/account_destroy(a405232c11a3fb7b).(account); |
| 364 | return -1; |
| 365 | } |
| 366 | |
| 367 | /* might as well free up the memory since we probably won't need it */ |
| 368 | account_flushcxx . . $ pvpgn/bnetd/account_flush(43f7d0f5a7c4b307).(account, FS_FORCEcxx . . $ `src/bnetd/attrlayer.h:27:9`!); /* force unload */ |
| 369 | |
| 370 | (*count)++; |
| 371 | |
| 372 | return 0; |
| 373 | } |
| 374 | |
| 375 | extern int accountlist_load_allcxx . . $ pvpgn/bnetd/accountlist_load_all(7864480464b09eea).(int flag) |
| 376 | { |
| 377 | static bool loaded = false; // all accounts already loaded ? |
| 378 | |
| 379 | if (loaded) |
| 380 | { |
| 381 | return 0; |
| 382 | } |
| 383 | |
| 384 | auto t0 = stdcxx . . $ std/::chronocxx . . $ std/chrono/::steady_clockcxx . . $ std/chrono/_V2/steady_clock#::nowcxx . . $ std/chrono/_V2/steady_clock#now(edffc6b45db65c20).(); |
| 385 | |
| 386 | unsigned int count = 0; |
| 387 | force_account_addcxx . . $ pvpgn/bnetd/force_account_add. = 1; // disable the protection |
| 388 | int ret = attrgroup_read_accountscxx . . $ pvpgn/bnetd/attrgroup_read_accounts(acb8d98e46f9914a).(flag, _cb_read_accountscxx . . $ pvpgn/bnetd/_cb_read_accounts(5c1d8b1d7ec6e769)., &count); |
| 389 | force_account_addcxx . . $ pvpgn/bnetd/force_account_add. = 0; // enable the protection |
| 390 | |
| 391 | auto t1 = stdcxx . . $ std/::chronocxx . . $ std/chrono/::steady_clockcxx . . $ std/chrono/_V2/steady_clock#::nowcxx . . $ std/chrono/_V2/steady_clock#now(edffc6b45db65c20).(); |
| 392 | |
| 393 | if (ret == 0) |
| 394 | { |
| 395 | loaded = true; |
| 396 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "Successfully loaded {} user accounts in {} milliseconds", count, stdcxx . . $ std/::chronocxx . . $ std/chrono/::duration_castcxx . . $ std/chrono/duration_cast(b7f67bf9c2f19806).<stdcxx . . $ std/::chronocxx . . $ std/chrono/::millisecondscxx . . $ std/chrono/milliseconds#>(t1 -cxx . . $ std/chrono/operator-(37d29b8d7121dc12). t0).countcxx . . $ std/chrono/duration#count(8f5363d873dd4781).()); |
| 397 | |
| 398 | return 0; |
| 399 | } |
| 400 | else if (ret == -1) |
| 401 | { |
| 402 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got error reading user accounts"); |
| 403 | |
| 404 | return -1; |
| 405 | } |
| 406 | else |
| 407 | { |
| 408 | return 0; |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | extern int accountlist_createcxx . . $ pvpgn/bnetd/accountlist_create(b126dc7c1de90089).(void) |
| 413 | { |
| 414 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "started creating accountlist"); |
| 415 | |
| 416 | if (!(accountlist_headcxx . . $ pvpgn/bnetd/accountlist_head. = hashtable_create(prefs_get_hashtable_sizecxx . . $ pvpgn/bnetd/prefs_get_hashtable_size(db52760e79bf9054).()))) |
| 417 | { |
| 418 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not create accountlist_head"); |
| 419 | return -1; |
| 420 | } |
| 421 | |
| 422 | if (!(accountlist_uid_headcxx . . $ pvpgn/bnetd/accountlist_uid_head. = hashtable_create(prefs_get_hashtable_sizecxx . . $ pvpgn/bnetd/prefs_get_hashtable_size(db52760e79bf9054).()))) |
| 423 | { |
| 424 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not create accountlist_uid_head"); |
| 425 | return -1; |
| 426 | } |
| 427 | |
| 428 | /* load accounts without force, indexed storage types wont be loading */ |
| 429 | accountlist_load_allcxx . . $ pvpgn/bnetd/accountlist_load_all(7864480464b09eea).(ST_NONEcxx . . $ `src/bnetd/storage.h:26:9`!); |
| 430 | maxuseridcxx . . $ pvpgn/bnetd/maxuserid. = storagecxx . . $ pvpgn/bnetd/storage.->read_maxuseridcxx . . $ pvpgn/bnetd/$anonymous_type_c7c18ce0294b47dd_0#read_maxuserid.(); |
| 431 | |
| 432 | return 0; |
| 433 | } |
| 434 | |
| 435 | |
| 436 | extern int accountlist_destroycxx . . $ pvpgn/bnetd/accountlist_destroy(b126dc7c1de90089).(void) |
| 437 | { |
| 438 | t_entrycxx . . $ pvpgn/t_entry# * curr; |
| 439 | t_accountcxx . . $ pvpgn/bnetd/t_account# * account; |
| 440 | |
| 441 | HASHTABLE_TRAVERSEcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/hashtable.h:107:9`!(accountlist_head, curr) |
| 442 | { |
| 443 | if (!(account = (t_accountcxx . . $ pvpgn/bnetd/t_account#*)entry_get_data(curr))) |
| 444 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "found NULL account in list"); |
| 445 | else |
| 446 | { |
| 447 | if (account_flushcxx . . $ pvpgn/bnetd/account_flush(43f7d0f5a7c4b307).(account, FS_FORCEcxx . . $ `src/bnetd/attrlayer.h:27:9`!) < 0) |
| 448 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not save account"); |
| 449 | |
| 450 | account_destroycxx . . $ pvpgn/bnetd/account_destroy(a405232c11a3fb7b).(account); |
| 451 | } |
| 452 | hashtable_remove_entry(accountlist_headcxx . . $ pvpgn/bnetd/accountlist_head., curr); |
| 453 | } |
| 454 | |
| 455 | HASHTABLE_TRAVERSEcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/hashtable.h:107:9`!(accountlist_uid_head, curr) |
| 456 | { |
| 457 | hashtable_remove_entry(accountlist_headcxx . . $ pvpgn/bnetd/accountlist_head., curr); |
| 458 | } |
| 459 | |
| 460 | if (hashtable_destroy(accountlist_headcxx . . $ pvpgn/bnetd/accountlist_head.) < 0) |
| 461 | return -1; |
| 462 | accountlist_headcxx . . $ pvpgn/bnetd/accountlist_head. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 463 | if (hashtable_destroy(accountlist_uid_headcxx . . $ pvpgn/bnetd/accountlist_uid_head.) < 0) |
| 464 | return -1; |
| 465 | accountlist_uid_headcxx . . $ pvpgn/bnetd/accountlist_uid_head. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 466 | return 0; |
| 467 | } |
| 468 | |
| 469 | |
| 470 | extern t_hashtablecxx . . $ pvpgn/t_hashtable# * accountlistcxx . . $ pvpgn/bnetd/accountlist(be8548fcc1b5d2a).(void) |
| 471 | { |
| 472 | return accountlist_headcxx . . $ pvpgn/bnetd/accountlist_head.; |
| 473 | } |
| 474 | |
| 475 | extern t_hashtablecxx . . $ pvpgn/t_hashtable# * accountlist_uidcxx . . $ pvpgn/bnetd/accountlist_uid(be8548fcc1b5d2a).(void) |
| 476 | { |
| 477 | return accountlist_uid_headcxx . . $ pvpgn/bnetd/accountlist_uid_head.; |
| 478 | } |
| 479 | |
| 480 | |
| 481 | extern unsigned int accountlist_get_lengthcxx . . $ pvpgn/bnetd/accountlist_get_length(db52760e79bf9054).(void) |
| 482 | { |
| 483 | return hashtable_get_length(accountlist_headcxx . . $ pvpgn/bnetd/accountlist_head.); |
| 484 | } |
| 485 | |
| 486 | |
| 487 | extern int accountlist_savecxx . . $ pvpgn/bnetd/accountlist_save(4c679297bf94b9eb).(unsigned flags) |
| 488 | { |
| 489 | return attrlayer_savecxx . . $ pvpgn/bnetd/attrlayer_save(7864480464b09eea).(flags); |
| 490 | } |
| 491 | |
| 492 | extern int accountlist_flushcxx . . $ pvpgn/bnetd/accountlist_flush(4c679297bf94b9eb).(unsigned flags) |
| 493 | { |
| 494 | return attrlayer_flushcxx . . $ pvpgn/bnetd/attrlayer_flush(7864480464b09eea).(flags); |
| 495 | } |
| 496 | |
| 497 | extern t_accountcxx . . $ pvpgn/bnetd/t_account# * accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(char const * username) |
| 498 | { |
| 499 | unsigned int userid = 0; |
| 500 | t_entrycxx . . $ pvpgn/t_entry# * curr; |
| 501 | t_accountcxx . . $ pvpgn/bnetd/t_account# * account; |
| 502 | |
| 503 | if (!username) |
| 504 | { |
| 505 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL username"); |
| 506 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 507 | } |
| 508 | |
| 509 | if (username[0] == '#') { |
| 510 | if (str_to_uintcxx . . $ pvpgn/str_to_uint(6974107818eeb505).(&username[1], &userid) < 0) |
| 511 | userid = 0; |
| 512 | } |
| 513 | else if (!(prefs_get_savebynamecxx . . $ pvpgn/bnetd/prefs_get_savebyname(db52760e79bf9054).())) |
| 514 | if (str_to_uintcxx . . $ pvpgn/str_to_uint(6974107818eeb505).(username, &userid) < 0) |
| 515 | userid = 0; |
| 516 | |
| 517 | /* all accounts in list must be hashed already, no need to check */ |
| 518 | |
| 519 | if (userid) { |
| 520 | account = accountlist_find_account_by_uidcxx . . $ pvpgn/bnetd/accountlist_find_account_by_uid(c4505e327c9ccd36).(userid); |
| 521 | if (account) return account; |
| 522 | } |
| 523 | |
| 524 | if ((!(userid)) || (userid && ((username[0] == '#') || (stdcxx . . $ std/::isdigitcxx . . $ std/isdigit(a1851578aea3f541).((int)username[0]))))) |
| 525 | { |
| 526 | unsigned int namehash; |
| 527 | char const * tname; |
| 528 | |
| 529 | namehash = account_hashcxx . . $ pvpgn/bnetd/account_hash(c61c63047ce273de).(username); |
| 530 | HASHTABLE_TRAVERSE_MATCHINGcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/hashtable.h:108:9`!(accountlist_head, curr, namehash) |
| 531 | { |
| 532 | account = (t_accountcxx . . $ pvpgn/bnetd/t_account#*)entry_get_data(curr); |
| 533 | if ((tname = account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account))) |
| 534 | { |
| 535 | if (strcasecmp(tname, username) == 0) |
| 536 | { |
| 537 | hashtable_entry_release(curr); |
| 538 | return account; |
| 539 | } |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | return account_load_newcxx . . $ pvpgn/bnetd/account_load_new(12c6cbb6f1dc4ea3).(username, 0); |
| 545 | } |
| 546 | |
| 547 | |
| 548 | extern t_accountcxx . . $ pvpgn/bnetd/t_account# * accountlist_find_account_by_uidcxx . . $ pvpgn/bnetd/accountlist_find_account_by_uid(c4505e327c9ccd36).(unsigned int uid) |
| 549 | { |
| 550 | t_entrycxx . . $ pvpgn/t_entry# * curr; |
| 551 | t_accountcxx . . $ pvpgn/bnetd/t_account# * account; |
| 552 | |
| 553 | if (uid) { |
| 554 | HASHTABLE_TRAVERSE_MATCHINGcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/hashtable.h:108:9`!(accountlist_uid_head, curr, uid) |
| 555 | { |
| 556 | account = (t_accountcxx . . $ pvpgn/bnetd/t_account#*)entry_get_data(curr); |
| 557 | if (account->uidcxx . . $ pvpgn/bnetd/account_struct#uid. == uid) { |
| 558 | hashtable_entry_release(curr); |
| 559 | return account; |
| 560 | } |
| 561 | } |
| 562 | } |
| 563 | return account_load_newcxx . . $ pvpgn/bnetd/account_load_new(12c6cbb6f1dc4ea3).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, uid); |
| 564 | } |
| 565 | |
| 566 | |
| 567 | extern char const *accountlist_find_vague_accountcxx . . $ pvpgn/bnetd/accountlist_find_vague_account(f379082f354693e).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, char const *vague_username) |
| 568 | { |
| 569 | char const *tname; |
| 570 | |
| 571 | if (!vague_username) { |
| 572 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL vague_username"); |
| 573 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 574 | } |
| 575 | if (!account) { |
| 576 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 577 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 578 | } |
| 579 | |
| 580 | |
| 581 | if (tname = account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account)) { |
| 582 | if (find_substrcxx . . $ pvpgn/find_substr(9efbdc942cde3d3d).((char*)tname, vague_username)) { |
| 583 | return tname; |
| 584 | } |
| 585 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 586 | } |
| 587 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 588 | } |
| 589 | |
| 590 | |
| 591 | extern int accountlist_allow_addcxx . . $ pvpgn/bnetd/accountlist_allow_add(b126dc7c1de90089).(void) |
| 592 | { |
| 593 | if (force_account_addcxx . . $ pvpgn/bnetd/force_account_add.) |
| 594 | return 1; /* the permission was forced */ |
| 595 | |
| 596 | if (prefs_get_max_accountscxx . . $ pvpgn/bnetd/prefs_get_max_accounts(db52760e79bf9054).() == 0) |
| 597 | return 1; /* allow infinite accounts */ |
| 598 | |
| 599 | if (prefs_get_max_accountscxx . . $ pvpgn/bnetd/prefs_get_max_accounts(db52760e79bf9054).() <= hashtable_get_length(accountlist_headcxx . . $ pvpgn/bnetd/accountlist_head.)) |
| 600 | return 0; /* maximum account limit reached */ |
| 601 | |
| 602 | return 1; /* otherwise let them proceed */ |
| 603 | } |
| 604 | |
| 605 | static t_accountcxx . . $ pvpgn/bnetd/t_account# * accountlist_add_accountcxx . . $ pvpgn/bnetd/accountlist_add_account(473656eae0be4930).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 606 | { |
| 607 | unsigned int uid; |
| 608 | char const * username; |
| 609 | |
| 610 | if (!account) { |
| 611 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 612 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 613 | } |
| 614 | |
| 615 | username = account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(account); |
| 616 | uid = account_get_numattrcxx . . $ `src/bnetd/account_wrap.h:45:9`!(account, "BNET\\acct\\userid"); |
| 617 | |
| 618 | if (!username || stdcxx . . $ std/::strlen(username) < 1) { |
| 619 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad account (empty username)"); |
| 620 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 621 | } |
| 622 | if (uid < 1) { |
| 623 | ERROR2cxx . . $ `src/common/eventlog.h:75:9`!("got bad account (bad uid: {}) for \"{}\", fix it!", uid, username); |
| 624 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 625 | } |
| 626 | |
| 627 | /* check whether the account limit was reached */ |
| 628 | if (!accountlist_allow_addcxx . . $ pvpgn/bnetd/accountlist_allow_add(b126dc7c1de90089).()) { |
| 629 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "account limit reached (current is {}, storing {})", prefs_get_max_accountscxx . . $ pvpgn/bnetd/prefs_get_max_accounts(db52760e79bf9054).(), hashtable_get_length(accountlist_headcxx . . $ pvpgn/bnetd/accountlist_head.)); |
| 630 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 631 | } |
| 632 | |
| 633 | /* delayed hash, do it before inserting account into the list */ |
| 634 | account->namehashcxx . . $ pvpgn/bnetd/account_struct#namehash. = account_hashcxx . . $ pvpgn/bnetd/account_hash(c61c63047ce273de).(username); |
| 635 | account->uidcxx . . $ pvpgn/bnetd/account_struct#uid. = uid; |
| 636 | |
| 637 | /* FIXME: this check actually (with the new attr system) happens too late |
| 638 | * we already have created the attrgroup here which is "dirty" and refusing |
| 639 | * an account here will trigger attrgroup_destroy which will "sync" the |
| 640 | * bad data to the storage! The codes should make sure we don't fail here */ |
| 641 | /* mini version of accountlist_find_account(username) || accountlist_find_account(uid) */ |
| 642 | { |
| 643 | t_entrycxx . . $ pvpgn/t_entry# * curr; |
| 644 | t_accountcxx . . $ pvpgn/bnetd/t_account# * curraccount; |
| 645 | char const * tname; |
| 646 | |
| 647 | if (uid <= maxuseridcxx . . $ pvpgn/bnetd/maxuserid.) |
| 648 | HASHTABLE_TRAVERSE_MATCHINGcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/hashtable.h:108:9`!(accountlist_uid_head, curr, uid) |
| 649 | { |
| 650 | curraccount = (t_accountcxx . . $ pvpgn/bnetd/t_account#*)entry_get_data(curr); |
| 651 | if (curraccount->uidcxx . . $ pvpgn/bnetd/account_struct#uid. == uid) |
| 652 | { |
| 653 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "BUG: user \"{}\":" UID_FORMATcxx . . $ `src/common/setup_before.h:83:9`! " already has an account (\"{}\":" UID_FORMATcxx . . $ `src/common/setup_before.h:83:9`! ")", username, uid, account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(curraccount), curraccount->uidcxx . . $ pvpgn/bnetd/account_struct#uid.); |
| 654 | hashtable_entry_release(curr); |
| 655 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | HASHTABLE_TRAVERSE_MATCHINGcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/hashtable.h:108:9`!(accountlist_head, curr, account->namehash) |
| 660 | { |
| 661 | curraccount = (t_accountcxx . . $ pvpgn/bnetd/t_account#*)entry_get_data(curr); |
| 662 | if ((tname = account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(curraccount))) |
| 663 | { |
| 664 | if (strcasecmp(tname, username) == 0) |
| 665 | { |
| 666 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "BUG: user \"{}\":" UID_FORMATcxx . . $ `src/common/setup_before.h:83:9`! " already has an account (\"{}\":" UID_FORMATcxx . . $ `src/common/setup_before.h:83:9`! ")", username, uid, tname, curraccount->uidcxx . . $ pvpgn/bnetd/account_struct#uid.); |
| 667 | hashtable_entry_release(curr); |
| 668 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 669 | } |
| 670 | } |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | if (hashtable_insert_data(accountlist_headcxx . . $ pvpgn/bnetd/accountlist_head., account, account->namehashcxx . . $ pvpgn/bnetd/account_struct#namehash.) < 0) { |
| 675 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not add account to list"); |
| 676 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 677 | } |
| 678 | |
| 679 | if (hashtable_insert_data(accountlist_uid_headcxx . . $ pvpgn/bnetd/accountlist_uid_head., account, uid)<0) { |
| 680 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not add account to list"); |
| 681 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 682 | } |
| 683 | |
| 684 | /* hashtable_stats(accountlist_head); */ |
| 685 | |
| 686 | if (uid>maxuseridcxx . . $ pvpgn/bnetd/maxuserid.) |
| 687 | maxuseridcxx . . $ pvpgn/bnetd/maxuserid. = uid; |
| 688 | |
| 689 | return account; |
| 690 | } |
| 691 | |
| 692 | extern t_accountcxx . . $ pvpgn/bnetd/t_account# * accountlist_create_accountcxx . . $ pvpgn/bnetd/accountlist_create_account(fdad4c38d937b650).(const char *username, const char *passhash1) |
| 693 | { |
| 694 | t_accountcxx . . $ pvpgn/bnetd/t_account# *res; |
| 695 | |
| 696 | assertcxx . . $ `/usr/include/assert.h:102:11`!(username != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 697 | assertcxx . . $ `/usr/include/assert.h:102:11`!(passhash1 != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 698 | |
| 699 | res = account_createcxx . . $ pvpgn/bnetd/account_create(fdad4c38d937b650).(username, passhash1); |
| 700 | if (!res) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; /* eventlog reported ealier */ |
| 701 | |
| 702 | if (!accountlist_add_accountcxx . . $ pvpgn/bnetd/accountlist_add_account(473656eae0be4930).(res)) { |
| 703 | account_destroycxx . . $ pvpgn/bnetd/account_destroy(a405232c11a3fb7b).(res); |
| 704 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; /* eventlog reported earlier */ |
| 705 | } |
| 706 | |
| 707 | account_savecxx . . $ pvpgn/bnetd/account_save(43f7d0f5a7c4b307).(res, FS_FORCEcxx . . $ `src/bnetd/attrlayer.h:27:9`!); /* sync new account to storage */ |
| 708 | |
| 709 | return res; |
| 710 | } |
| 711 | |
| 712 | extern int account_check_namecxx . . $ pvpgn/bnetd/account_check_name(5c4306d8553b3696).(char const * name) |
| 713 | { |
| 714 | unsigned int i; |
| 715 | char ch; |
| 716 | |
| 717 | if (!name) { |
| 718 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL name"); |
| 719 | return -1; |
| 720 | } |
| 721 | |
| 722 | size_t namelen = stdcxx . . $ std/::strlen(name); |
| 723 | for (i = 0; i < namelen; i++) |
| 724 | { |
| 725 | /* These are the Battle.net rules but they are too strict. |
| 726 | * We want to allow any characters that wouldn't cause |
| 727 | * problems so this should test for what is _not_ allowed |
| 728 | * instead of what is. |
| 729 | */ |
| 730 | ch = name[i]; |
| 731 | /* hardcoded safety checks */ |
| 732 | if (ch == '/' || ch == '\\') return -1; |
| 733 | if (stdcxx . . $ std/::isalnumcxx . . $ std/isalnum(a1851578aea3f541).((unsigned char)ch)) continue; |
| 734 | if (stdcxx . . $ std/::strchr(prefs_get_account_allowed_symbolscxx . . $ pvpgn/bnetd/prefs_get_account_allowed_symbols(33a1f659e94feb42).(), ch)) continue; |
| 735 | return -1; |
| 736 | } |
| 737 | if (i < MIN_USERNAME_LENcxx . . $ MIN_USERNAME_LEN. || i >= MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.) |
| 738 | return -1; |
| 739 | return 0; |
| 740 | } |
| 741 | |
| 742 | extern char const * account_get_name_realcxx . . $ pvpgn/bnetd/account_get_name_real(325e20526b023caa).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, char const * fn, unsigned int ln) |
| 743 | { |
| 744 | char const * temp; |
| 745 | |
| 746 | if (!account) |
| 747 | { |
| 748 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account (from {}:{})", fn, ln); |
| 749 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; /* FIXME: places assume this can't fail */ |
| 750 | } |
| 751 | |
| 752 | if (account->namecxx . . $ pvpgn/bnetd/account_struct#name.) /* we have a cached username so return it */ |
| 753 | return account->namecxx . . $ pvpgn/bnetd/account_struct#name.; |
| 754 | |
| 755 | /* we dont have a cached username so lets get it from attributes */ |
| 756 | if (!(temp = account_get_strattrcxx . . $ `src/bnetd/account.h:96:9`!(account, "BNET\\acct\\username"))) |
| 757 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "account has no username"); |
| 758 | else |
| 759 | account->namecxx . . $ pvpgn/bnetd/account_struct#name. = xstrdupcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/xalloc.h:49:9`!(temp); |
| 760 | return account->namecxx . . $ pvpgn/bnetd/account_struct#name.; |
| 761 | } |
| 762 | |
| 763 | |
| 764 | extern int account_check_mutualcxx . . $ pvpgn/bnetd/account_check_mutual(9f6a50bf8c531a3f).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, int myuserid) |
| 765 | { |
| 766 | if (account == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 767 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 768 | return -1; |
| 769 | } |
| 770 | |
| 771 | if (!myuserid) { |
| 772 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL userid"); |
| 773 | return -1; |
| 774 | } |
| 775 | |
| 776 | if (account->friendscxx . . $ pvpgn/bnetd/account_struct#friends. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 777 | { |
| 778 | t_friendcxx . . $ pvpgn/bnetd/t_friend# * fr; |
| 779 | if ((fr = friendlist_find_uidcxx . . $ pvpgn/bnetd/friendlist_find_uid(9da8c1d9dfa566eb).(account->friendscxx . . $ pvpgn/bnetd/account_struct#friends., myuserid)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 780 | { |
| 781 | friend_set_mutualcxx . . $ pvpgn/bnetd/friend_set_mutual(213560cf9f8c5a35).(fr, FRIEND_ISMUTUALcxx . . $ `src/bnetd/friends.h:22:9`!); |
| 782 | return 0; |
| 783 | } |
| 784 | } |
| 785 | else |
| 786 | { |
| 787 | int i; |
| 788 | int n = account_get_friendcountcxx . . $ pvpgn/bnetd/account_get_friendcount(367bfb076f70247b).(account); |
| 789 | int frienduid; |
| 790 | for (i = 0; i < n; i++) |
| 791 | { |
| 792 | frienduid = account_get_friendcxx . . $ pvpgn/bnetd/account_get_friend(20c0a00602323ffe).(account, i); |
| 793 | if (!frienduid) { |
| 794 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL friend"); |
| 795 | continue; |
| 796 | } |
| 797 | |
| 798 | if (myuserid == frienduid) |
| 799 | return 0; |
| 800 | } |
| 801 | } |
| 802 | |
| 803 | // If friend isnt in list return -1 to tell func NO |
| 804 | return -1; |
| 805 | } |
| 806 | |
| 807 | extern t_listcxx . . $ pvpgn/t_list# * account_get_friendscxx . . $ pvpgn/bnetd/account_get_friends(27f2e57ffe21264).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 808 | { |
| 809 | if (!account) |
| 810 | { |
| 811 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 812 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 813 | } |
| 814 | |
| 815 | if (!FLAG_ISSETcxx . . $ `src/common/flags.h:25:9`!(account->flags, ACCOUNT_FLAG_FLOADEDcxx . . $ `src/bnetd/account.h:37:9`!)) |
| 816 | if (account_load_friendscxx . . $ pvpgn/bnetd/account_load_friends(367bfb076f70247b).(account) < 0) |
| 817 | { |
| 818 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not load friend list"); |
| 819 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 820 | } |
| 821 | |
| 822 | return account->friendscxx . . $ pvpgn/bnetd/account_struct#friends.; |
| 823 | } |
| 824 | |
| 825 | static int account_load_friendscxx . . $ pvpgn/bnetd/account_load_friends(367bfb076f70247b).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 826 | { |
| 827 | int i; |
| 828 | int n; |
| 829 | int frienduid; |
| 830 | t_accountcxx . . $ pvpgn/bnetd/t_account# * acc; |
| 831 | t_friendcxx . . $ pvpgn/bnetd/t_friend# * fr; |
| 832 | |
| 833 | int newlist = 0; |
| 834 | if (!account) |
| 835 | { |
| 836 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 837 | return -1; |
| 838 | } |
| 839 | |
| 840 | if (FLAG_ISSETcxx . . $ `src/common/flags.h:25:9`!(account->flags, ACCOUNT_FLAG_FLOADEDcxx . . $ `src/bnetd/account.h:37:9`!)) |
| 841 | return 0; |
| 842 | |
| 843 | if (account->friendscxx . . $ pvpgn/bnetd/account_struct#friends. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 844 | { |
| 845 | account->friendscxx . . $ pvpgn/bnetd/account_struct#friends. = list_create(); |
| 846 | newlist = 1; |
| 847 | } |
| 848 | |
| 849 | n = account_get_friendcountcxx . . $ pvpgn/bnetd/account_get_friendcount(367bfb076f70247b).(account); |
| 850 | for (i = 0; i < n; i++) |
| 851 | { |
| 852 | frienduid = account_get_friendcxx . . $ pvpgn/bnetd/account_get_friend(20c0a00602323ffe).(account, i); |
| 853 | if (!frienduid) { |
| 854 | account_remove_friendcxx . . $ pvpgn/bnetd/account_remove_friend(9f6a50bf8c531a3f).(account, i); |
| 855 | continue; |
| 856 | } |
| 857 | fr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 858 | if (newlist || (fr = friendlist_find_uidcxx . . $ pvpgn/bnetd/friendlist_find_uid(9da8c1d9dfa566eb).(account->friendscxx . . $ pvpgn/bnetd/account_struct#friends., frienduid)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 859 | { |
| 860 | if ((acc = accountlist_find_account_by_uidcxx . . $ pvpgn/bnetd/accountlist_find_account_by_uid(c4505e327c9ccd36).(frienduid)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 861 | { |
| 862 | if (account_remove_friendcxx . . $ pvpgn/bnetd/account_remove_friend(9f6a50bf8c531a3f).(account, i) == 0) |
| 863 | { |
| 864 | i--; |
| 865 | n--; |
| 866 | } |
| 867 | continue; |
| 868 | } |
| 869 | if (account_check_mutualcxx . . $ pvpgn/bnetd/account_check_mutual(9f6a50bf8c531a3f).(acc, account_get_uidcxx . . $ `src/bnetd/account.h:91:9`!(account)) == 0) |
| 870 | friendlist_add_accountcxx . . $ pvpgn/bnetd/friendlist_add_account(7bf52703037b2a17).(account->friendscxx . . $ pvpgn/bnetd/account_struct#friends., acc, FRIEND_ISMUTUALcxx . . $ `src/bnetd/friends.h:22:9`!); |
| 871 | else |
| 872 | friendlist_add_accountcxx . . $ pvpgn/bnetd/friendlist_add_account(7bf52703037b2a17).(account->friendscxx . . $ pvpgn/bnetd/account_struct#friends., acc, FRIEND_NOTMUTUALcxx . . $ `src/bnetd/friends.h:21:9`!); |
| 873 | } |
| 874 | else { |
| 875 | if ((acc = friend_get_accountcxx . . $ pvpgn/bnetd/friend_get_account(9d018d83140d552c).(fr)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 876 | { |
| 877 | account_remove_friendcxx . . $ pvpgn/bnetd/account_remove_friend(9f6a50bf8c531a3f).(account, i); |
| 878 | continue; |
| 879 | } |
| 880 | if (account_check_mutualcxx . . $ pvpgn/bnetd/account_check_mutual(9f6a50bf8c531a3f).(acc, account_get_uidcxx . . $ `src/bnetd/account.h:91:9`!(account)) == 0) |
| 881 | friend_set_mutualcxx . . $ pvpgn/bnetd/friend_set_mutual(213560cf9f8c5a35).(fr, FRIEND_ISMUTUALcxx . . $ `src/bnetd/friends.h:22:9`!); |
| 882 | else |
| 883 | friend_set_mutualcxx . . $ pvpgn/bnetd/friend_set_mutual(213560cf9f8c5a35).(fr, FRIEND_NOTMUTUALcxx . . $ `src/bnetd/friends.h:21:9`!); |
| 884 | } |
| 885 | } |
| 886 | if (!newlist) |
| 887 | friendlist_purgecxx . . $ pvpgn/bnetd/friendlist_purge(20db0232078327de).(account->friendscxx . . $ pvpgn/bnetd/account_struct#friends.); |
| 888 | FLAG_SETcxx . . $ `src/common/flags.h:23:9`!(&account->flags, ACCOUNT_FLAG_FLOADEDcxx . . $ `src/bnetd/account.h:37:9`!); |
| 889 | return 0; |
| 890 | } |
| 891 | |
| 892 | static int account_unload_friendscxx . . $ pvpgn/bnetd/account_unload_friends(367bfb076f70247b).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 893 | { |
| 894 | if (account->friendscxx . . $ pvpgn/bnetd/account_struct#friends. != nullptr && friendlist_unloadcxx . . $ pvpgn/bnetd/friendlist_unload(20db0232078327de).(account->friendscxx . . $ pvpgn/bnetd/account_struct#friends.) < 0) |
| 895 | return -1; |
| 896 | FLAG_CLEARcxx . . $ `src/common/flags.h:24:9`!(&account->flags, ACCOUNT_FLAG_FLOADEDcxx . . $ `src/bnetd/account.h:37:9`!); |
| 897 | return 0; |
| 898 | } |
| 899 | |
| 900 | extern int account_set_clanmembercxx . . $ pvpgn/bnetd/account_set_clanmember(5828098b1d22acf3).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# * clanmember) |
| 901 | { |
| 902 | if (account == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 903 | { |
| 904 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 905 | return -1; |
| 906 | } |
| 907 | |
| 908 | account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember. = clanmember; |
| 909 | return 0; |
| 910 | } |
| 911 | |
| 912 | extern t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# * account_get_clanmembercxx . . $ pvpgn/bnetd/account_get_clanmember(4ce48d4e65930331).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 913 | { |
| 914 | t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# * member; |
| 915 | |
| 916 | if (account == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 917 | { |
| 918 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 919 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 920 | } |
| 921 | |
| 922 | if ((member = account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember.) && (clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(member)) && (clan_get_createdcxx . . $ pvpgn/bnetd/clan_get_created(6091e08b3a5a3db6).(clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(member)) > 0) && (clanmember_get_fullmembercxx . . $ pvpgn/bnetd/clanmember_get_fullmember(d12aaa857ef4d493).(member) == 1)) |
| 923 | return member; |
| 924 | else |
| 925 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 926 | } |
| 927 | |
| 928 | extern t_clanmembercxx . . $ pvpgn/bnetd/t_clanmember# * account_get_clanmember_forcedcxx . . $ pvpgn/bnetd/account_get_clanmember_forced(4ce48d4e65930331).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 929 | { |
| 930 | if (account == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 931 | { |
| 932 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 933 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 934 | } |
| 935 | |
| 936 | return account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember.; |
| 937 | } |
| 938 | |
| 939 | extern t_clancxx . . $ pvpgn/bnetd/t_clan# * account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 940 | { |
| 941 | if (account == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 942 | { |
| 943 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 944 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 945 | } |
| 946 | |
| 947 | if (account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember. && (clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember.) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) && (clan_get_createdcxx . . $ pvpgn/bnetd/clan_get_created(6091e08b3a5a3db6).(clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember.)) > 0) && (clanmember_get_fullmembercxx . . $ pvpgn/bnetd/clanmember_get_fullmember(d12aaa857ef4d493).(account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember.) == 1)) |
| 948 | return clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember.); |
| 949 | else |
| 950 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 951 | } |
| 952 | |
| 953 | extern t_clancxx . . $ pvpgn/bnetd/t_clan# * account_get_creating_clancxx . . $ pvpgn/bnetd/account_get_creating_clan(b1e25e267411fd2e).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 954 | { |
| 955 | if (account == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 956 | { |
| 957 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 958 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 959 | } |
| 960 | |
| 961 | if (account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember. && (clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember.) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) && ((clan_get_createdcxx . . $ pvpgn/bnetd/clan_get_created(6091e08b3a5a3db6).(clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember.)) <= 0) || (clanmember_get_fullmembercxx . . $ pvpgn/bnetd/clanmember_get_fullmember(d12aaa857ef4d493).(account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember.) == 0))) |
| 962 | |
| 963 | return clanmember_get_clancxx . . $ pvpgn/bnetd/clanmember_get_clan(18fc6df730a9c54c).(account->clanmembercxx . . $ pvpgn/bnetd/account_struct#clanmember.); |
| 964 | else |
| 965 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 966 | } |
| 967 | |
| 968 | int account_set_conncxx . . $ pvpgn/bnetd/account_set_conn(dd21e8ef2296c4e9).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, t_connection * conn) |
| 969 | { |
| 970 | if (!(account)) |
| 971 | { |
| 972 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 973 | return -1; |
| 974 | } |
| 975 | |
| 976 | account->conncxx . . $ pvpgn/bnetd/account_struct#conn. = conn; |
| 977 | |
| 978 | return 0; |
| 979 | } |
| 980 | |
| 981 | t_connection * account_get_conncxx . . $ pvpgn/bnetd/account_get_conn(831fe2ed2f0bd703).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 982 | { |
| 983 | if (!(account)) |
| 984 | { |
| 985 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL account"); |
| 986 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 987 | } |
| 988 | |
| 989 | return account->conncxx . . $ pvpgn/bnetd/account_struct#conn.; |
| 990 | } |
| 991 | |
| 992 | void account_add_teamcxx . . $ pvpgn/bnetd/account_add_team(7568b6ec01afeb15).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, t_teamcxx . . $ pvpgn/bnetd/t_team# * team) |
| 993 | { |
| 994 | assertcxx . . $ `/usr/include/assert.h:102:11`!(account); |
| 995 | assertcxx . . $ `/usr/include/assert.h:102:11`!(team); |
| 996 | |
| 997 | if (!(account->teamscxx . . $ pvpgn/bnetd/account_struct#teams.)) |
| 998 | account->teamscxx . . $ pvpgn/bnetd/account_struct#teams. = list_create(); |
| 999 | |
| 1000 | list_append_data(account->teamscxx . . $ pvpgn/bnetd/account_struct#teams., team); |
| 1001 | } |
| 1002 | |
| 1003 | t_teamcxx . . $ pvpgn/bnetd/t_team# * account_find_team_by_accountscxx . . $ pvpgn/bnetd/account_find_team_by_accounts(f97505bb25041b2).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, t_accountcxx . . $ pvpgn/bnetd/t_account# **accounts, t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag) |
| 1004 | { |
| 1005 | if ((account->teamscxx . . $ pvpgn/bnetd/account_struct#teams.)) |
| 1006 | return _list_find_team_by_accountscxx . . $ pvpgn/bnetd/_list_find_team_by_accounts(9996263dfee4e414).(accounts, clienttag, account->teamscxx . . $ pvpgn/bnetd/account_struct#teams.); |
| 1007 | else |
| 1008 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1009 | } |
| 1010 | |
| 1011 | t_teamcxx . . $ pvpgn/bnetd/t_team# * account_find_team_by_teamidcxx . . $ pvpgn/bnetd/account_find_team_by_teamid(23ecc65a048e0bcb).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account, unsigned int teamid) |
| 1012 | { |
| 1013 | if ((account->teamscxx . . $ pvpgn/bnetd/account_struct#teams.)) |
| 1014 | return _list_find_team_by_teamidcxx . . $ pvpgn/bnetd/_list_find_team_by_teamid(924765dc6b5f1897).(teamid, account->teamscxx . . $ pvpgn/bnetd/account_struct#teams.); |
| 1015 | else |
| 1016 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1017 | } |
| 1018 | |
| 1019 | t_listcxx . . $ pvpgn/t_list# * account_get_teamscxx . . $ pvpgn/bnetd/account_get_teams(27f2e57ffe21264).(t_accountcxx . . $ pvpgn/bnetd/t_account# * account) |
| 1020 | { |
| 1021 | assertcxx . . $ `/usr/include/assert.h:102:11`!(account); |
| 1022 | |
| 1023 | return account->teamscxx . . $ pvpgn/bnetd/account_struct#teams.; |
| 1024 | } |
| 1025 | |
| 1026 | } |
| 1027 | |
| 1028 | } |