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.
This commit is contained in:
Kenneth Hsu
2020-10-18 13:34:36 -07:00
parent a80d50687e
commit ee061a7d30
@@ -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;