From ee061a7d309e3f0c8efe19fe3307df0d7a278dca Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sun, 18 Oct 2020 13:34:36 -0700 Subject: [PATCH] Fix check for administrator group on Synology devices. The id command prints a newline character after printing the group ids. This needs to be removed before checking for the administrator group (101). This fixes #2610. --- Duplicati/Server/WebServer/SynologyAuthenticationHandler.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Duplicati/Server/WebServer/SynologyAuthenticationHandler.cs b/Duplicati/Server/WebServer/SynologyAuthenticationHandler.cs index 928e36144..77fef2a19 100644 --- a/Duplicati/Server/WebServer/SynologyAuthenticationHandler.cs +++ b/Duplicati/Server/WebServer/SynologyAuthenticationHandler.cs @@ -193,7 +193,11 @@ namespace Duplicati.Server.WebServer var groups = GetEnvArg("SYNO_GROUP_IDS"); if (string.IsNullOrWhiteSpace(groups)) + { groups = ShellExec("id", "-G '" + username.Trim().Replace("'", "\\'") + "'", exitcode: 0).Result ?? string.Empty; + groups = groups.Replace(Environment.NewLine, String.Empty); + } + if (!groups.Split(new char[] { ' ' }).Contains("101")) { response.Status = System.Net.HttpStatusCode.Forbidden;