Change tabs to spaces to satisfy travis.

develop
Japa Illo 2017-10-04 09:48:12 +05:30
parent bb1eb0b48a
commit 3c5483df03
2 changed files with 34 additions and 34 deletions

@ -284,10 +284,10 @@ void ServerConnection::threadFn()
} }
else else
{ {
if (((fn->flags & SF_ALLOW_REMOTE) != SF_ALLOW_REMOTE) && strcmp(socket->GetClientAddr(), "127.0.0.1") != 0) if (((fn->flags & SF_ALLOW_REMOTE) != SF_ALLOW_REMOTE) && strcmp(socket->GetClientAddr(), "127.0.0.1") != 0)
{ {
stream.printerr("In call to %s: forbidden host: %s\n", fn->name, socket->GetClientAddr()); stream.printerr("In call to %s: forbidden host: %s\n", fn->name, socket->GetClientAddr());
} }
else if (!fn->in()->ParseFromArray(buf.get(), header.size)) else if (!fn->in()->ParseFromArray(buf.get(), header.size))
{ {
stream.printerr("In call to %s: could not decode input args.\n", fn->name); stream.printerr("In call to %s: could not decode input args.\n", fn->name);
@ -379,33 +379,33 @@ bool ServerMain::listen(int port)
socket->Initialize(); socket->Initialize();
bool allow_remote = false; bool allow_remote = false;
std::string filename("dfhack-config/remote-server.cfg"); std::string filename("dfhack-config/remote-server.cfg");
std::ifstream configFile(filename); std::ifstream configFile(filename);
if (configFile.is_open()) if (configFile.is_open())
{ {
std::string line; std::string line;
while (std::getline(configFile, line)) while (std::getline(configFile, line))
{ {
if (line.compare(0, 1, "#") == 0) if (line.compare(0, 1, "#") == 0)
continue; continue;
if (line.compare(0, 24, "allow-remote-connections") == 0) if (line.compare(0, 24, "allow-remote-connections") == 0)
{ {
allow_remote = (line.compare(25, std::string::npos, "true") == 0); allow_remote = (line.compare(25, std::string::npos, "true") == 0);
} }
} }
} }
if (allow_remote) if (allow_remote)
{ {
if (!socket->Listen(NULL, port)) if (!socket->Listen(NULL, port))
return false; return false;
} }
else else
{ {
if (!socket->Listen("127.0.0.1", port)) if (!socket->Listen("127.0.0.1", port))
return false; return false;
} }
thread = new tthread::thread(threadFn, this); thread = new tthread::thread(threadFn, this);
thread->detach(); thread->detach();

@ -47,9 +47,9 @@ namespace DFHack
// Don't automatically suspend the core around the call. // Don't automatically suspend the core around the call.
// The function is supposed to manage locking itself. // The function is supposed to manage locking itself.
SF_DONT_SUSPEND = 2, SF_DONT_SUSPEND = 2,
// The function is considered safe to call from a remote computer. // The function is considered safe to call from a remote computer.
// All other functions cannot be allowed for security reasons. // All other functions cannot be allowed for security reasons.
SF_ALLOW_REMOTE = 4 SF_ALLOW_REMOTE = 4
}; };
class DFHACK_EXPORT ServerFunctionBase : public RPCFunctionBase { class DFHACK_EXPORT ServerFunctionBase : public RPCFunctionBase {