diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index 6aaa4c4b..9c41fb33 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -411,7 +411,7 @@ static void command_ax(shared_ptr, shared_ptr, shared_ptr c, const char16_t* args) { check_privileges(c, Privilege::Announce); string message = encode_sjis(args); - log(INFO, "[$ax from %010u] %s\n", c->license->serial_number, message.c_str()); + log(INFO, "[Client message from %010u] %s\n", c->license->serial_number, message.c_str()); } static void command_announce(shared_ptr s, shared_ptr, diff --git a/src/License.cc b/src/License.cc index a39f5770..c2881db5 100644 --- a/src/License.cc +++ b/src/License.cc @@ -59,7 +59,8 @@ LicenseManager::LicenseManager(const string& filename) : filename(filename) { } } catch (const cannot_open_file&) { - log(WARNING, "%s does not exist; no licenses are registered", this->filename.c_str()); + log(WARNING, "File %s does not exist; no licenses are registered", + this->filename.c_str()); } } diff --git a/src/Main.cc b/src/Main.cc index fcaf83a9..e1b914e0 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -119,11 +119,11 @@ void populate_state_from_config(shared_ptr s, try { s->local_address = s->all_addresses.at(local_address_str); string addr_str = string_for_address(s->local_address); - log(INFO, "added local address: %s (%s)", addr_str.c_str(), + log(INFO, "Added local address: %s (%s)", addr_str.c_str(), local_address_str.c_str()); } catch (const out_of_range&) { s->local_address = address_for_string(local_address_str.c_str()); - log(INFO, "added local address: %s", local_address_str.c_str()); + log(INFO, "Added local address: %s", local_address_str.c_str()); } s->all_addresses.emplace("", s->local_address); @@ -131,11 +131,11 @@ void populate_state_from_config(shared_ptr s, try { s->external_address = s->all_addresses.at(external_address_str); string addr_str = string_for_address(s->external_address); - log(INFO, "added external address: %s (%s)", addr_str.c_str(), + log(INFO, "Added external address: %s (%s)", addr_str.c_str(), external_address_str.c_str()); } catch (const out_of_range&) { s->external_address = address_for_string(external_address_str.c_str()); - log(INFO, "added external address: %s", external_address_str.c_str()); + log(INFO, "Added external address: %s", external_address_str.c_str()); } s->all_addresses.emplace("", s->external_address); @@ -155,12 +155,12 @@ void populate_state_from_config(shared_ptr s, string key_file_name = d.at("BlueBurstKeyFile")->as_string(); string key_file_contents = load_file("system/blueburst/keys/" + key_file_name + ".nsk"); if (key_file_contents.size() != sizeof(PSOBBEncryption::KeyFile)) { - log(WARNING, "key file is the wrong size (%zu bytes; should be %zu bytes)", + log(WARNING, "Blue Burst key file is the wrong size (%zu bytes; should be %zu bytes)", key_file_contents.size(), sizeof(PSOBBEncryption::KeyFile)); - log(WARNING, "ignoring key file; Blue Burst clients will not be able to connect"); + log(WARNING, "Ignoring key file; Blue Burst clients will not be able to connect"); } else { memcpy(&s->default_key_file, key_file_contents.data(), sizeof(PSOBBEncryption::KeyFile)); - log(INFO, "loaded key file: %s", key_file_name.c_str()); + log(INFO, "Loaded Blue Burst key file: %s", key_file_name.c_str()); } } @@ -198,15 +198,13 @@ void drop_privileges(const string& username) { throw runtime_error(string_printf("can\'t switch to user %d (%s)", pw->pw_uid, error.c_str())); } - log(INFO, "switched to user %s (%d:%d)", username.c_str(), pw->pw_uid, + log(INFO, "Switched to user %s (%d:%d)", username.c_str(), pw->pw_uid, pw->pw_gid); } int main(int argc, char* argv[]) { - log(INFO, "fuzziqer software newserv"); - string proxy_hostname; int proxy_port = 0; GameVersion proxy_version = GameVersion::GC; @@ -243,11 +241,13 @@ int main(int argc, char* argv[]) { populate_state_from_config(state, config_json); shared_ptr dns_server; - if (state->run_dns_server) { - log(INFO, "starting dns server"); + if (state->dns_server_port) { + log(INFO, "Starting DNS server"); dns_server.reset(new DNSServer(base, state->local_address, state->external_address)); - dns_server->listen("", 53); + dns_server->listen("", state->dns_server_port); + } else { + log(INFO, "DNS server is disabled"); } shared_ptr proxy_server; diff --git a/src/ServerState.cc b/src/ServerState.cc index 34ae3a60..e3b57eec 100644 --- a/src/ServerState.cc +++ b/src/ServerState.cc @@ -12,7 +12,8 @@ using namespace std; -ServerState::ServerState() : run_dns_server(true), +ServerState::ServerState() + : dns_server_port(0), allow_unregistered_users(false), run_shell_behavior(RunShellBehavior::Default), next_lobby_id(1), pre_lobby_event(0) { diff --git a/src/ServerState.hh b/src/ServerState.hh index 3d44dd32..c083339c 100644 --- a/src/ServerState.hh +++ b/src/ServerState.hh @@ -34,7 +34,7 @@ struct ServerState { std::u16string name; std::unordered_map port_configuration; std::string username; - bool run_dns_server; + uint16_t dns_server_port; bool allow_unregistered_users; RunShellBehavior run_shell_behavior; PSOBBEncryption::KeyFile default_key_file; diff --git a/system/config.json b/system/config.json index 8fa55a71..8d5896b9 100755 --- a/system/config.json +++ b/system/config.json @@ -7,8 +7,9 @@ "LocalAddress": "192.168.0.5", // Address to connect external clients to (IP address or interface name) "ExternalAddress": "en0", - // Set to false to disable the DNS server - "RunDNSServer": true, + // Port to listen for DNS queries on. Set this to zero (or comment it out) to + // disable the DNS server. + "DNSServerPort": 53, // By default, the interactive shell runs if stdin is a terminal, and doesn't // run if it's not. This option, if present, overrides that behavior. // "RunInteractiveShell": false,