Skip to content

Commit

Permalink
Merge pull request #362 from pvpgn/develop
Browse files Browse the repository at this point in the history
Finalize 1.99.7.2.1 release
  • Loading branch information
RElesgoe authored Jul 10, 2018
2 parents 36f9925 + 2b503e0 commit 9e7c471
Show file tree
Hide file tree
Showing 19 changed files with 309 additions and 182 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PvPGN is a free and open source cross-platform server software that supports Bat
[![License (GPL version 2)](https://img.shields.io/badge/license-GNU%20GPL%20version%202-blue.svg?style=flat-square)](http://opensource.org/licenses/GPL-2.0)
![Language (C++)](https://img.shields.io/badge/powered_by-C++-brightgreen.svg?style=flat-square)
[![Language (Lua)](https://img.shields.io/badge/powered_by-Lua-red.svg?style=flat-square)](https://lua.org)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/pvpgn/pvpgn-server/1.99.7.1-PRO/total.svg?maxAge=2592000)]()
[![Github Releases (by Release)](https://img.shields.io/github/downloads/pvpgn/pvpgn-server/1.99.7.2.1/total.svg?maxAge=2592000)]()

[![Compiler (Microsoft Visual C++)](https://img.shields.io/badge/compiled_with-Microsoft%20Visual%20C++-yellow.svg?style=flat-square)](https://msdn.microsoft.com/en-us/vstudio/hh386302.aspx)
[![Compiler (LLVM/Clang)](https://img.shields.io/badge/compiled_with-LLVM/Clang-lightgrey.svg?style=flat-square)](http://clang.llvm.org/)
Expand All @@ -25,8 +25,8 @@ By default, tracking is enabled and is only used for the purpose of sending info
- **WarCraft 2: Battle.net Edition**: 2.02a, 2.02b
- **WarCraft 3: Reign of Chaos**\*: 1.13a, 1.13b, 1.14a, 1.14b, 1.15a, 1.16a, 1.17a, 1.18a, 1.19a, 1.19b, 1.20a, 1.20b, 1.20c, 1.20d, 1.20e, 1.21a, 1.21b, 1.22a, 1.23a, 1.24a, 1.24b, 1.24c, 1.24d, 1.24e, 1.25b, 1.26a, 1.27a, 1.27b, 1.28, 1.28.1, 1.28.2, 1.28.4, 1.28.5
- **WarCraft 3: The Frozen Throne**\*: 1.13a, 1.13b, 1.14a, 1.14b, 1.15a, 1.16a, 1.17a, 1.18a, 1.19a, 1.19b, 1.20a, 1.20b, 1.20c, 1.20d, 1.20e, 1.21a, 1.21b, 1.22a, 1.23a, 1.24a, 1.24b, 1.24c, 1.24d, 1.24e, 1.25b, 1.26a, 1.27a, 1.27b, 1.28, 1.28.1, 1.28.2, 1.28.4, 1.28.5
- **StarCraft**: 1.08, 1.08b, 1.09, 1.09b, 1.10, 1.11, 1.11b, 1.12, 1.12b, 1.13, 1.13b, 1.13c, 1.13d, 1.13e, 1.13f, 1.14, 1.15, 1.15.1, 1.15.2, 1.15.3, 1.16, 1.16.1
- **StarCraft: Brood War**: 1.08, 1.08b, 1.09, 1.09b, 1.10, 1.11, 1.11b, 1.12, 1.12b, 1.13, 1.13b, 1.13c, 1.13d, 1.13e, 1.13f, 1.14, 1.15, 1.15.1, 1.15.2, 1.15.3, 1.16, 1.16.1
- **StarCraft**: 1.08, 1.08b, 1.09, 1.09b, 1.10, 1.11, 1.11b, 1.12, 1.12b, 1.13, 1.13b, 1.13c, 1.13d, 1.13e, 1.13f, 1.14, 1.15, 1.15.1, 1.15.2, 1.15.3, 1.16, 1.16.1, 1.17.0, 1.18.0
- **StarCraft: Brood War**: 1.08, 1.08b, 1.09, 1.09b, 1.10, 1.11, 1.11b, 1.12, 1.12b, 1.13, 1.13b, 1.13c, 1.13d, 1.13e, 1.13f, 1.14, 1.15, 1.15.1, 1.15.2, 1.15.3, 1.16, 1.16.1, 1.17.0, 1.18.0
- **Diablo**: 1.09, 1.09b
- **Diablo 2**: 1.10, 1.11, 1.11b, 1.12a, 1.13c, 1.14a, 1.14b, 1.14c, 1.14d
- **Diablo 2: Lord of Destruction**: 1.10, 1.11, 1.11b, 1.12a, 1.13c, 1.14a, 1.14b, 1.14c, 1.14d
Expand All @@ -44,15 +44,17 @@ By default, tracking is enabled and is only used for the purpose of sending info
- **Emperor: Battle for Dune**: 1.09

\* WarCraft 3 clients are unable to connect to PvPGN servers without a client-side modification, through tools such as [W3L](https://github.com/w3lh/w3l), to disable server signature verification.
\* StarCraft clients beginning with patch 1.18 will not be supported by PvPGN-PRO due to protocol changes. A 1.18.0 versioncheck entry is included for compatibility with bot software.

## Support
[Create an issue](https://github.com/pvpgn/pvpgn-server/issues) if you have any questions, suggestions, or anything else to say about PvPGN-PRO. Please note that D2GS is not part of the PvPGN project and is therefore unsupported here.
Set `loglevels = fatal,error,warn,info,debug,trace` in `bnetd.conf` before obtaining logs and posting them.

## Development
Submit pull requests to contribute to this project. Utilize C++11 features and adhere to the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md) whenever possible.

## Building
See [docs/ports.md](https://github.com/pvpgn/pvpgn-server/blob/master/docs/ports.md) for operating systems and compilers that have been confirmed to work with PvPGN. Any operating system that supports WinAPI or POSIX, and any C++11 compliant compiler should be able to build PvPGN.
See [docs/ports.md](https://github.com/pvpgn/pvpgn-server/blob/master/docs/ports.md) for operating systems and compilers that have been confirmed to work with PvPGN. Any operating system that supports WinAPI or POSIX, and any C++11 compliant compiler should be able to build PvPGN. The CMake files have been hardcoded to reject compilers older than Visual Studio 2015 and GCC 5.1.

#### Windows
Use [Magic Builder](https://github.com/pvpgn/pvpgn-magic-builder).
Expand Down
26 changes: 0 additions & 26 deletions conf/bnetd.conf.win32
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,6 @@ star_iconfile = "icons_STAR.bni"
# Example: allowed_clients = war3,w3xp
allowed_clients = all

# If this option is enabled, the verification step is skipped if possible.
# This only works with clients < 109. It is useful because you no longer
# need any of the IX86AUTH?.MPQ and PMACAUTH?.MPQ files. Note that it will
# also skip over all the autoupdate checks effectively disabling it.
#
# If you disable this you must have one or more of the MPQ files. Otherwise
# clients will hang when they first connect because they are attempting to
# download them. The versioncheck can only be skipped for clients older
# than 109. Starting with version 109 the clients will always do version
# checking since they do not function properly if the server does not
# request it.
skip_versioncheck = true

# If you enable the version checks but want to allow clients that don't pass
# the checksum test then enable this.
allow_bad_version = true
Expand All @@ -212,19 +199,6 @@ allow_bad_version = true
# is a good idea.
allow_unknown_version = true

# This defines how the exeinfo field in the versioncheck file is being
# checked. You can choose between no match at all [none] (default),
# exact match [exact], exact case-sensitive match [exactcase], dumb wildcard
# match [wildcard], and parsed value comparison [parse].
# NOTE: [parse] needs the mktime() function and might therefore not work on
# every system.
version_exeinfo_match = none

# If you have choosen [parse] above, this is the tolerance with which
# the time can differ. The value must be given in seconds. If it's 0 this
# check is disabled.
version_exeinfo_maxdiff = 0

# #
##############################################################################

Expand Down
61 changes: 60 additions & 1 deletion conf/versioncheck.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,39 @@
},
"STAR": {
"IX86": {
"0xd6": {
"checkRevisionFile": "ver-IX86-1.mpq",
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
"entries": [
{
"title": "StarCraft 1.18.0",
"version": "1.18.0.65",
"hash": "0x7ab2ce34",
"fileMetadata": "StarCraft.exe 10/20/17 01:12:49 8568296",
"versionTag": "STAR_1180"
}
]
},
"0xd5": {
"checkRevisionFile": "ver-IX86-1.mpq",
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
"entries": [
{
"title": "StarCraft: Brood War 1.17.0 - (StarCraft mode)",
"version": "1.17.0.1",
"hash": "0xcb82b07c",
"fileMetadata": "StarCraft.exe 07/11/16 15:59:46 1243112",
"versionTag": "STAR_1170"
},
{
"title": "StarCraft 1.17.0",
"version": "1.17.0.0",
"hash": "0xa5e7b4cc",
"fileMetadata": "StarCraft.exe 07/11/16 15:59:51 1243112",
"versionTag": "STAR_1170"
}
]
},
"0xd3": {
"checkRevisionFile": "ver-IX86-1.mpq",
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
Expand Down Expand Up @@ -1300,6 +1333,32 @@
},
"SEXP": {
"IX86": {
"0xd6": {
"checkRevisionFile": "ver-IX86-1.mpq",
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
"entries": [
{
"title": "StarCraft: Brood War 1.18.0",
"version": "1.18.0.65",
"hash": "0x7ab2ce34",
"fileMetadata": "StarCraft.exe 10/20/17 01:12:49 8568296",
"versionTag": "SEXP_1180"
}
]
},
"0xd5": {
"checkRevisionFile": "ver-IX86-1.mpq",
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
"entries": [
{
"title": "StarCraft: Brood War 1.17.0 - (Brood War mode)",
"version": "1.17.0.1",
"hash": "0xcb82b07c",
"fileMetadata": "StarCraft.exe 07/11/16 15:59:46 1243112",
"versionTag": "SEXP_1170"
}
]
},
"0xd3": {
"checkRevisionFile": "ver-IX86-1.mpq",
"equation": "A=2521522835 B=3428392135 C=218673704 4 A=A^S B=B-C C=C+A A=A-B",
Expand Down Expand Up @@ -1852,4 +1911,4 @@
}
}
}
}
}
23 changes: 18 additions & 5 deletions files/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,21 @@ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/var/status")

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/var/ DESTINATION ${LOCALSTATEDIR})

install(FILES ad000001.png ad000001.smk ad000002.mng newbie.save
bnserver.ini bnserver-D2DV.ini bnserver-D2XP.ini bnserver-WAR3.ini
ver-IX86-1.mpq IX86ver1.mpq PMACver1.mpq XMACver1.mpq IX86ExtraWork.mpq
icons.bni icons-WAR3.bni icons_STAR.bni
DESTINATION ${LOCALSTATEDIR}/files)
install(FILES ad000001.png
ad000001.smk
ad000002.mng
ad000002.smk
bnserver.ini
bnserver-D2DV.ini
bnserver-D2XP.ini
bnserver-WAR3.ini
icons.bni
icons_STAR.bni
icons-WAR3.bni
IX86ExtraWork.mpq
IX86ver1.mpq
newbie.save
PMACver1.mpq
ver-IX86-1.mpq
XMACver1.mpq
DESTINATION ${LOCALSTATEDIR}/files)
51 changes: 29 additions & 22 deletions src/bnetd/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <cstddef>
#include <cassert>
#include <cctype>
#include <chrono>

#include "compat/strdup.h"
#include "compat/strcasecmp.h"
Expand Down Expand Up @@ -373,33 +374,39 @@ namespace pvpgn

extern int accountlist_load_all(int flag)
{
unsigned int count;
int starttime = std::time(NULL);
static int loaded = 0; /* all accounts already loaded ? */
int res;
static bool loaded = false; // all accounts already loaded ?

if (loaded) return 0;
if (loaded)
{
return 0;
}

count = 0;
res = 0;
auto t0 = std::chrono::steady_clock::now();

force_account_add = 1; /* disable the protection */
switch (attrgroup_read_accounts(flag, _cb_read_accounts, &count))
unsigned int count = 0;
force_account_add = 1; // disable the protection
int ret = attrgroup_read_accounts(flag, _cb_read_accounts, &count);
force_account_add = 0; // enable the protection

auto t1 = std::chrono::steady_clock::now();

if (ret == 0)
{
case -1:
eventlog(eventlog_level_error, __FUNCTION__, "got error reading users");
res = -1;
break;
case 0:
loaded = 1;
eventlog(eventlog_level_info, __FUNCTION__, "loaded {} user accounts in {} seconds", count, std::time(nullptr) - starttime);
break;
default:
break;
}
force_account_add = 0; /* enable the protection */
loaded = true;
eventlog(eventlog_level_info, __FUNCTION__, "Successfully loaded {} user accounts in {} milliseconds", count, std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0).count());

return res;
return 0;
}
else if (ret == -1)
{
eventlog(eventlog_level_error, __FUNCTION__, "got error reading user accounts");

return -1;
}
else
{
return 0;
}
}

extern int accountlist_create(void)
Expand Down
67 changes: 49 additions & 18 deletions src/bnetd/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2936,33 +2936,64 @@ namespace pvpgn

static int _glist_cb(t_game *game, void *data)
{
struct glist_cb_struct *cbdata = (struct glist_cb_struct*)data;
auto cbdata = reinterpret_cast<struct glist_cb_struct*>(data);

if ((!cbdata->tag || !prefs_get_hide_pass_games() || game_get_flag(game) != game_flag_private) &&
(!cbdata->tag || game_get_clienttag(game) == cbdata->tag) &&
(cbdata->diff == game_difficulty_none || game_get_difficulty(game) == cbdata->diff) &&
(cbdata->lobby == false || (game_get_status(game) != game_status_started && game_get_status(game) != game_status_done)))
// when cbdata->tag != 0, user is requesting games of the same client tag
// return early when the game's client tag does not match the user's client tag
if (cbdata->tag != 0 && cbdata->tag != game_get_clienttag(game))
{
std::snprintf(msgtemp0, sizeof(msgtemp0), " %-16.16s %1.1s %-8.8s %-21.21s %5u ",
game_get_name(game),
game_get_flag(game) != game_flag_private ? "n" : "y",
game_status_get_str(game_get_status(game)),
game_type_get_str(game_get_type(game)),
game_get_ref(game));
return 0;
}

if (!cbdata->tag)
{
// when cbdata->lobby == true, only display list of all games in the lobby
// return early if game has started or is already finished
if (cbdata->lobby == true && (game_get_status(game) == game_status_started || game_get_status(game) == game_status_done))
{
return 0;
}

std::strcat(msgtemp0, clienttag_uint_to_str(game_get_clienttag(game)));
std::strcat(msgtemp0, " ");
// when cbdata->diff != game_difficulty_none, user is requesting a specific game difficulty
// return early if user is requesting a specific game difficulty that does not match the game's difficulty
if (cbdata->diff != game_difficulty_none && cbdata->diff != game_get_difficulty(game))
{
return 0;
}

unsigned int pref = prefs_get_hide_pass_games();
if (pref && game_get_flag(game) == game_flag_private)
{
// return early if hide_pass_games is true and the game is private
if (cbdata->tag != 0)
{
return 0;
}
// if user used /games all and is not an admin, return early
else if (cbdata->tag == 0 && account_get_auth_admin(conn_get_account(cbdata->c), nullptr) != 1)
{
return 0;
}
}


std::snprintf(msgtemp0, sizeof(msgtemp0), " %-16.16s %1.1s %-8.8s %-21.21s %5u ",
game_get_name(game),
game_get_flag(game) != game_flag_private ? "n" : "y",
game_status_get_str(game_get_status(game)),
game_type_get_str(game_get_type(game)),
game_get_ref(game));

if ((!prefs_get_hide_addr()) || (account_get_command_groups(conn_get_account(cbdata->c)) & command_get_group("/admin-addr"))) /* default to false */
std::strcat(msgtemp0, addr_num_to_addr_str(game_get_addr(game), game_get_port(game)));
if (!cbdata->tag)
{

message_send_text(cbdata->c, message_type_info, cbdata->c, msgtemp0);
std::strcat(msgtemp0, clienttag_uint_to_str(game_get_clienttag(game)));
std::strcat(msgtemp0, " ");
}

if ((!prefs_get_hide_addr()) || (account_get_command_groups(conn_get_account(cbdata->c)) & command_get_group("/admin-addr"))) /* default to false */
std::strcat(msgtemp0, addr_num_to_addr_str(game_get_addr(game), game_get_port(game)));

message_send_text(cbdata->c, message_type_info, cbdata->c, msgtemp0);

return 0;
}

Expand Down
12 changes: 4 additions & 8 deletions src/bnetd/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ namespace pvpgn

list_prepend_data(conn_head, temp);

eventlog(eventlog_level_info, __FUNCTION__, "[{}][{}] sessionkey=0x{:08} sessionnum=0x{:08}", temp->socket.tcp_sock, temp->socket.udp_sock, temp->protocol.sessionkey, temp->protocol.sessionnum);
eventlog(eventlog_level_debug, __FUNCTION__, "[{}][{}] sessionkey=0x{:08} sessionnum=0x{:08}", temp->socket.tcp_sock, temp->socket.udp_sock, temp->protocol.sessionkey, temp->protocol.sessionnum);

return temp;
}
Expand Down Expand Up @@ -1221,8 +1221,6 @@ namespace pvpgn

extern void conn_set_archtag(t_connection * c, t_tag archtag)
{
char archtag_str[5];

if (!c) {
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection");
return;
Expand All @@ -1232,9 +1230,7 @@ namespace pvpgn
return;
}
if (c->protocol.client.archtag != archtag)
eventlog(eventlog_level_info, __FUNCTION__, "[{}] setting client arch to \"{}\"", conn_get_socket(c), tag_uint_to_str(archtag_str, archtag));

c->protocol.client.archtag = archtag;
c->protocol.client.archtag = archtag;
}


Expand Down Expand Up @@ -1320,8 +1316,8 @@ namespace pvpgn
eventlog(eventlog_level_error, __FUNCTION__, "got UNKNOWN clienttag \"{}\"", tag_uint_to_str(clienttag_str, clienttag));
return;
}
if (c->protocol.client.clienttag != clienttag) {
eventlog(eventlog_level_info, __FUNCTION__, "[{}] setting client type to \"{}\"", conn_get_socket(c), tag_uint_to_str(clienttag_str, clienttag));
if (c->protocol.client.clienttag != clienttag)
{
c->protocol.client.clienttag = clienttag;
if (c->protocol.chat.channel)
channel_update_userflags(c);
Expand Down
6 changes: 6 additions & 0 deletions src/bnetd/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,12 @@ namespace pvpgn
if (game_get_type(game) != game_type_ladder && prefs_get_report_all_games() != 1)
{
eventlog(eventlog_level_debug, __FUNCTION__, "not reporting normal games");

if (ladder_info)
{
xfree(ladder_info);
}

return 0;
}

Expand Down
Loading

0 comments on commit 9e7c471

Please sign in to comment.