- Index: src/console_cmds.cpp
- ===================================================================
- --- src/console_cmds.cpp (Revision 20473)
- +++ src/console_cmds.cpp (Arbeitskopie)
- @@ -18,6 +18,7 @@
- #include "network/network.h"
- #include "network/network_func.h"
- #include "network/network_base.h"
- +#include "network/core/config.h"
- #include "command_func.h"
- #include "settings_func.h"
- #include "fios.h"
- @@ -570,16 +571,35 @@
- {
- if (argc == 0) {
- IConsoleHelp("Remote control the server from another client. Usage: 'rcon <password> <command>'");
- - IConsoleHelp("Remember to enclose the command in quotes, otherwise only the first parameter is sent");
- return true;
- }
- if (argc < 3) return false;
- + char buf[NETWORK_RCONCOMMAND_LENGTH];
- + char* end = buf;
- +
- + if (argc == 3) {
- + end = strecat(buf, argv[2], lastof(buf));
- + } else {
- + strecat(buf, "\"", lastof(buf));
- + strecat(buf, argv[2], lastof(buf));
- + for (int i=3; i<argc; i++) {
- + strecat(buf, "\" \"", lastof(buf));
- + strecat(buf, argv[i], lastof(buf));
- + }
- + end = strecat(buf, "\"", lastof(buf));
- + }
- +
- + if (end == lastof(buf)) {
- + IConsoleError("Command string too long");
- + return false;
- + }
- +
- if (_network_server) {
- - IConsoleCmdExec(argv[2]);
- + IConsoleCmdExec(buf);
- } else {
- - NetworkClientSendRcon(argv[1], argv[2]);
- + NetworkClientSendRcon(argv[1], buf);
- }
- return true;
- }