summaryrefslogtreecommitdiff
path: root/minecctl
diff options
context:
space:
mode:
Diffstat (limited to 'minecctl')
-rw-r--r--minecctl/misc-commands.c6
-rw-r--r--minecctl/server.c110
2 files changed, 5 insertions, 111 deletions
diff --git a/minecctl/misc-commands.c b/minecctl/misc-commands.c
index 8a54e64..1133e55 100644
--- a/minecctl/misc-commands.c
+++ b/minecctl/misc-commands.c
@@ -434,7 +434,11 @@ static bool select_free_ports(struct cfg *cfg, uint16_t *listen_port,
}
if (!used) {
- error("Found unused port, %" PRIu16, lport);
+ debug(DBG_CFG, "found unused port, "
+ "listen: %" PRIu16 ", "
+ "mc: %" PRIu16 ", "
+ "rcon: %" PRIu16,
+ lport, mport, rport);
if (listen_port && *listen_port == 0)
*listen_port = lport;
diff --git a/minecctl/server.c b/minecctl/server.c
index 3743526..8bd7b51 100644
--- a/minecctl/server.c
+++ b/minecctl/server.c
@@ -115,116 +115,6 @@ static bool read_file(int dfd, const char *filename, char *buf, size_t len,
return true;
}
-enum sprop_keys {
- SPROP_KEY_INVALID = 0,
- SPROP_KEY_SERVER_PORT,
- SPROP_KEY_RCON_PORT,
- SPROP_KEY_RCON_PASSWORD,
-};
-
-struct cfg_key_value_map sprop_key_map[] = {
- {
- .key_name = "server-port",
- .key_value = SPROP_KEY_SERVER_PORT,
- .value_type = CFG_VAL_TYPE_ADDRS,
- },
- {
- .key_name = "rcon.port",
- .key_value = SPROP_KEY_RCON_PORT,
- .value_type = CFG_VAL_TYPE_ADDRS,
- },
- {
- .key_name = "rcon.password",
- .key_value = SPROP_KEY_RCON_PASSWORD,
- .value_type = CFG_VAL_TYPE_STRING,
- }
-};
-
-static void sprop_parse(struct server_config *scfg, char *buf,
- unsigned *lineno, const char **error)
-{
- char *pos = buf;
- struct saddr *saddr, *tmp;
-
- *lineno = 0;
-
- while (true) {
- int key;
- const char *keyname;
- struct cfg_value value;
-
- if (!config_parse_line("server.properties", &pos, sprop_key_map,
- &key, &keyname, &value, false, lineno,
- error))
- break;
-
- switch (key) {
- case SPROP_KEY_SERVER_PORT:
- error("Got a server port");
-
- /* FIXME: these should use scfg_queue_dns */
- if (value.type != CFG_VAL_TYPE_ADDRS) {
- error("Got async DNS results!?");
- break;
- }
-
- if (!list_empty(&scfg->remotes)) {
- error("mc server address set both in %s and "
- "server.properties", scfg->filename);
- break;
- }
-
- list_for_each_entry_safe(saddr, tmp, &value.saddrs, list) {
- list_del(&saddr->list);
- list_add(&saddr->list, &scfg->remotes);
- }
-
- break;
-
- case SPROP_KEY_RCON_PORT:
- error("Got a rcon port");
-
- if (value.type != CFG_VAL_TYPE_ADDRS) {
- error("Got async DNS results!?");
- break;
- }
-
- if (!list_empty(&scfg->rcons)) {
- error("rcon address set both in %s and "
- "server.properties", scfg->filename);
- break;
- }
-
- list_for_each_entry_safe(saddr, tmp, &value.saddrs, list) {
- list_del(&saddr->list);
- list_add(&saddr->list, &scfg->rcons);
- }
-
- break;
-
- case SPROP_KEY_RCON_PASSWORD:
- error("Got an rcon password");
-
- if (scfg->rcon_password) {
- error("rcon password set both in %s and "
- "server.properties (%smatching)",
- scfg->filename,
- streq(scfg->rcon_password, value.str) ?
- "" : "not");
- break;
- }
-
- scfg->rcon_password = xstrdup(value.str);
- break;
-
- case SPROP_KEY_INVALID:
- _fallthrough_;
- default:
- break;
- }
- }
-}
-
bool server_read_config(struct cfg *cfg, struct server *server,
unsigned *lineno, const char **error)
{