mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 16:59:44 +00:00
NetworkSession: Restore PM3 unexpected XUID handling behaviour (removes XUID instead of kicking the player)
close #3861, close #3089
This commit is contained in:
parent
df7bafe2bc
commit
94c58c00b5
@ -561,8 +561,6 @@ class NetworkSession{
|
|||||||
if($error === null){
|
if($error === null){
|
||||||
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";
|
|
||||||
}elseif($clientPubKey === null){
|
}elseif($clientPubKey === null){
|
||||||
$error = "Missing client public key"; //failsafe
|
$error = "Missing client public key"; //failsafe
|
||||||
}
|
}
|
||||||
@ -576,10 +574,16 @@ class NetworkSession{
|
|||||||
|
|
||||||
$this->authenticated = $authenticated;
|
$this->authenticated = $authenticated;
|
||||||
|
|
||||||
if(!$this->authenticated and $authRequired){
|
if(!$this->authenticated){
|
||||||
|
if($authRequired){
|
||||||
$this->disconnect("disconnectionScreen.notAuthenticated");
|
$this->disconnect("disconnectionScreen.notAuthenticated");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if($this->info->hasXboxData()){
|
||||||
|
$this->logger->warning("Discarding unexpected XUID for non-authenticated player");
|
||||||
|
$this->info = $this->info->withoutXboxData();
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->logger->debug("Xbox Live authenticated: " . ($this->authenticated ? "YES" : "NO"));
|
$this->logger->debug("Xbox Live authenticated: " . ($this->authenticated ? "YES" : "NO"));
|
||||||
|
|
||||||
if($this->manager->kickDuplicates($this)){
|
if($this->manager->kickDuplicates($this)){
|
||||||
|
@ -88,4 +88,23 @@ class PlayerInfo{
|
|||||||
public function getExtraData() : array{
|
public function getExtraData() : array{
|
||||||
return $this->extraData;
|
return $this->extraData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasXboxData() : bool{
|
||||||
|
return $this->xuid !== "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new PlayerInfo with XBL player info stripped. This is used to ensure that non-XBL players can't spoof
|
||||||
|
* XBL data.
|
||||||
|
*/
|
||||||
|
public function withoutXboxData() : self{
|
||||||
|
return new self(
|
||||||
|
$this->username,
|
||||||
|
$this->uuid,
|
||||||
|
$this->skin,
|
||||||
|
$this->locale,
|
||||||
|
"",
|
||||||
|
$this->extraData
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user