Page 1 of 1

[FIXED] WriteFile() XMLRPC call still errors on Linux

Posted: 21 Jan 2019, 16:18
by Chris92
Hello xbx and others,
WriteFile() still seems to be broken on Linux dedicated servers, even after the attempted fixes.
Disregarding the too low max_request_size in the dedicated-server-api I'm still struggling to write files via the WriteFile() XMLRPC method.

My setup: Ubuntu 16.04 LTS
Server installed via the NADEO APT repository (in /opt/maniaplanet-server)

I'm trying to send files to the server, but the only error I'm getting is

Code: Select all

couldn't write file '/opt/maniaplanet-server/UserData/Maps'.
This is the PHP script I'm using:

Code: Select all

<?php
/**
 * Created by PhpStorm.
 * User: chris
 * Date: 10.01.2019
 * Time: 20:30
 */
require_once("./vendor/autoload.php");
class Main{
    //settings
    private $host = "IP_ADDRESS";
    private $port = "PORT";
    private $user = "SuperAdmin";
    private $pw = "SUPER_SECRET_PASSWORD";


    private function connect(){
        $conn = \Maniaplanet\DedicatedServer\Connection::factory($this->host, $this->port, 5, $this->user, $this->pw);
        $conn->triggerModeScriptEvent("XmlRpc.SetApiVersion", ["2.1.0"]);
        return $conn;
    }

    public function TryWriteFile(){
        $conn = $this->connect();
        $filename = "OTHERWORLD.Map.Gbx";
        $file = file_get_contents($filename);

        try{
            $conn->writeFile($filename, base64_encode($file));
            $conn->addmap($filename);
        }
        catch (Exception $ex){
            echo $ex->getMessage();
        }
    }
}

$main = new Main();
$main->TryWriteFile();
Directory permissions are 775 for UserData and Maps, user to run the server is in the games group and I've also tried running the server as root to no avail.

The map I'm using to test is Otherworld by Snake55wildcat

I hope we can get this nasty error resolved once and for all.

Re: WriteFile() XMLRPC call still errors on Linux

Posted: 21 Jan 2019, 18:26
by Chris92
Thanks to Miss, we might have narrowed down the source of the error.
Somehow the Linux server doesn't find the file name it should write the data in.
Tried with two Maps, one smaller map (332kb) and OTHERWORLD from above (1800kb)

Re: WriteFile() XMLRPC call still errors on Linux

Posted: 22 Jan 2019, 00:13
by Miss
Worth noting I'm only assuming that because of the specific error not including any filename.

Re: WriteFile() XMLRPC call still errors on Linux

Posted: 12 Feb 2019, 18:15
by Chris92
Seems to be fixed with the latest server version, according to initial tests.