disallow logins from players with phony XUIDs

this simplifies XUID handling.
This commit is contained in:
Dylan K. Taylor 2019-07-03 16:47:02 +01:00
parent e07523056d
commit 85051554c4
2 changed files with 6 additions and 10 deletions

View File

@ -533,6 +533,8 @@ class NetworkSession{
} }
if($authenticated and $this->info->getXuid() === ""){ if($authenticated and $this->info->getXuid() === ""){
$error = "Expected XUID but none found"; $error = "Expected XUID but none found";
}elseif(!$authenticated and $this->info->getXuid() !== ""){
$error = "Unexpected XUID for non-XBOX-authenticated player";
} }
if($error !== null){ if($error !== null){
@ -543,15 +545,9 @@ class NetworkSession{
$this->authenticated = $authenticated; $this->authenticated = $authenticated;
if(!$this->authenticated){ if(!$this->authenticated and $authRequired){
if($authRequired){ $this->disconnect("disconnectionScreen.notAuthenticated");
$this->disconnect("disconnectionScreen.notAuthenticated"); return;
return;
}
if($this->info->getXuid() !== ""){
$this->logger->warning("Found XUID, but login keychain is not signed by Mojang");
}
} }
$this->logger->debug("Xbox Live authenticated: " . ($this->authenticated ? "YES" : "NO")); $this->logger->debug("Xbox Live authenticated: " . ($this->authenticated ? "YES" : "NO"));

View File

@ -283,7 +283,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
$this->uuid = $this->playerInfo->getUuid(); $this->uuid = $this->playerInfo->getUuid();
$this->rawUUID = $this->uuid->toBinary(); $this->rawUUID = $this->uuid->toBinary();
$this->xuid = $authenticated ? $this->playerInfo->getXuid() : ""; $this->xuid = $this->playerInfo->getXuid();
$this->perm = new PermissibleBase($this); $this->perm = new PermissibleBase($this);
$this->chunksPerTick = (int) $this->server->getProperty("chunk-sending.per-tick", 4); $this->chunksPerTick = (int) $this->server->getProperty("chunk-sending.per-tick", 4);