Cuberite Forum
Server commander - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Requests (https://forum.cuberite.org/forum-3.html)
+--- Thread: Server commander (/thread-2265.html)

Pages: 1 2


RE: Server commander - jan64 - 12-21-2015

"Massive security hole v0.1" ?
You could try redirecting the output using "./malware > out.txt < in.txt 2>&1", which should work both in linux and windows.
Although, i have no idea why it would deadlock except for the command not terminating.


RE: Server commander - xoft - 12-21-2015

Actually it's a problem with how Linux handles creating new processes. It does so by using fork(), which duplicates the current process, and then exec(), which replaces the current binary with another binary. It works pretty well for traditional programs, but doesn't cooperate too well with threads - only the thread calling the fork() function is copied, the rest of the threads are thrown away in the copy of the executable, which means that if any of those threads held any mutexes, those mutexes will be locked forever in the child process. If one of those mutexes just happens to be something important, such as CRT's mutex for memory allocations, we're in trouble.


RE: Server commander - NiLSPACE - 12-21-2015

@jan64 Yes, absolutely, but I expect this to be used for private matters instead of using it publicly.


Alternate - JuliB - 12-23-2015

Is there any other way to communicate with the OS? I believe creating a file is enough. After a server restart the server script can detect the file and react (Plan B).


RE: Server commander - xoft - 12-23-2015

Creating a file should be easy enough - use Lua's built-in IO library.

Another option would be to use an external process listening on a socket to actually execute the commands. You'd lose the possibility of IO redirection and waiting for process end, but it would work. Also, not too platform-independent.


RE: Server commander - JuliB - 12-23-2015

(12-23-2015, 08:25 PM)JuliB Wrote: And how can I use the IO library? Is it like C++ with ofstream? Sry, I'm a total newbie...

Maybe it is better if I get it out myself Wink
But thank you for help me ! (correct english?)