From 1d923ba7b0837c05d0a2e206be5a253ee167a905 Mon Sep 17 00:00:00 2001 From: MrKev <41-mrkev@users.noreply.git.ryujinx.app> Date: Tue, 27 May 2025 16:46:54 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20JWT=20Claims=20and=20Socket=20Flag=20Hand?= =?UTF-8?q?ling=20to=20Improve=20Just=20Dance=C2=AE=20Server=20Connection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See merge request ryubing/ryujinx!38 --- .../Services/Account/Acc/AccountService/ManagerServer.cs | 7 ++++--- src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs index 2f0454a89..8c86788b1 100644 --- a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ManagerServer.cs @@ -5,6 +5,7 @@ using Ryujinx.HLE.HOS.Kernel.Threading; using Ryujinx.HLE.HOS.Services.Account.Acc.AsyncContext; using System; using System.Collections.Generic; +using System.Security.Claims; using System.Security.Cryptography; using System.Security.Principal; using System.Text; @@ -38,7 +39,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService RsaSecurityKey secKey = new(parameters); - SigningCredentials credentials = new(secKey, "RS256"); + SigningCredentials credentials = new(secKey, SecurityAlgorithms.RsaSha256); credentials.Key.KeyId = parameters.ToString(); @@ -49,11 +50,11 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService RandomNumberGenerator.Fill(deviceId); byte[] deviceAccountId = new byte[0x10]; - RandomNumberGenerator.Fill(deviceId); + RandomNumberGenerator.Fill(deviceAccountId); SecurityTokenDescriptor descriptor = new() { - Subject = new GenericIdentity(Convert.ToHexString(rawUserId).ToLower()), + Subject = new ClaimsIdentity([new Claim(JwtRegisteredClaimNames.Sub, Convert.ToHexString(rawUserId).ToLower())]), SigningCredentials = credentials, Audience = "ed9e2f05d286f7b8", Issuer = "https://e0d67c509fb203858ebcb2fe3f88c2aa.baas.nintendo.com", diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs index 0a592d542..d4beb066c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs @@ -876,13 +876,15 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd { errno = LinuxError.SUCCESS; + // F_GETFL if (cmd == 0x3) { result = !socket.Blocking ? 0x800 : 0; } - else if (cmd == 0x4 && arg == 0x800) + // F_SETFL + else if (cmd == 0x4) { - socket.Blocking = false; + socket.Blocking = (arg & 0x800) != 0; result = 0; } else