-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix/permissions-after-unpack' of github.com:nzbgetcom/n…
…zbget into feature/test-fix-permissions
- Loading branch information
Showing
30 changed files
with
1,817 additions
and
897 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
* This file is part of nzbget. See <https://nzbget.com>. | ||
* | ||
* Copyright (C) 2013-2018 Andrey Prygunkov <[email protected]> | ||
* | ||
* Copyright (C) 2023-2024 Denis <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
|
@@ -14,7 +15,7 @@ | |
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
|
||
|
@@ -732,6 +733,10 @@ bool UnpackController::Cleanup() | |
ok = false; | ||
} | ||
|
||
#ifndef WIN32 | ||
FileSystem::SetFilePermissionsWithUmask(dstFile.Str(), g_Options->GetUMask()); | ||
#endif | ||
|
||
extractedFiles.push_back(filename); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
* This file is part of nzbget. See <https://nzbget.com>. | ||
* | ||
* Copyright (C) 2007-2017 Andrey Prygunkov <[email protected]> | ||
* Copyright (C) 2024 Denis <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -956,6 +957,16 @@ void FileSystem::FixExecPermission(const char* filename) | |
chmod(filename, buffer.st_mode); | ||
} | ||
} | ||
|
||
void FileSystem::SetFilePermissionsWithUmask(const char* filename, mode_t umask) | ||
{ | ||
struct stat buffer; | ||
if (!stat(filename, &buffer)) | ||
{ | ||
mode_t permissions = buffer.st_mode & ~umask; | ||
chmod(filename, permissions); | ||
} | ||
} | ||
#endif | ||
|
||
#ifdef WIN32 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
* This file is part of nzbget. See <https://nzbget.com>. | ||
* | ||
* Copyright (C) 2007-2017 Andrey Prygunkov <[email protected]> | ||
* Copyright (C) 2024 Denis <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -14,7 +15,7 @@ | |
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
|
||
|
@@ -61,6 +62,7 @@ class FileSystem | |
#ifndef WIN32 | ||
static CString ExpandHomePath(const char* filename); | ||
static void FixExecPermission(const char* filename); | ||
static void SetFilePermissionsWithUmask(const char* filename, mode_t umask); | ||
#endif | ||
static CString ExpandFileName(const char* filename); | ||
static CString GetExeFileName(const char* argv0); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is part of nzbget. See <https://nzbget.com>. | ||
* | ||
* CCopyright (C) 2023 Denis <[email protected]> | ||
* Copyright (C) 2023 Denis <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
Oops, something went wrong.