Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v24.3 #386

Merged
merged 19 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/ISSUE_TEMPLATE/01_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ body:
label: NZBGet Version
description: Which version of NZBGet has this bug?
options:
- v24.4-testing
- v24.3-stable
- v24.2-stable
- v24.3-testing
- v24.1-stable
- v24.1-testing
- v24-stable
- v24-testing
- v23-stable
- v23-testing
- v22-stable (nzbgetcom takeover)
- v22-testing (nzbgetcom takeover)
- v21 or earlier (orignal nzbget)
- latest-stable (if not listed here)
- latest-testing (if not listed here)
Expand Down
7 changes: 2 additions & 5 deletions .github/ISSUE_TEMPLATE/03_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ body:
label: NZBGet Version
description: Version of NZBGet for the scope of this issue
options:
- v24.4-testing
- v24.3-stable
- v24.2-stable
- v24.3-testing
- v24.1-stable
- v24.1-testing
- v24-stable
- v24-testing
- v23-stable
- v23-testing
- v22-stable (nzbgetcom takeover)
- v22-testing (nzbgetcom takeover)
- v21 or earlier (orignal nzbget)
- latest-stable (if not listed here)
- latest-testing (if not listed here)
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set_property(GLOBAL PROPERTY PACKAGE)
set_property(GLOBAL PROPERTY LIBS)
set_property(GLOBAL PROPERTY INCLUDES)

set(VERSION "24.2")
set(VERSION "24.3")
set(PACKAGE "nzbget")
set(PACKAGE_BUGREPORT "https://github.com/nzbgetcom/nzbget/issues")
set(CMAKE_CXX_STANDARD 17)
Expand Down
28 changes: 28 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
nzbget-24.3
- Features:
- Disk performance tests for better analysis of user environment performance
[#375](https://github.com/nzbgetcom/nzbget/commit/220e842ad5181f6911a6b1796fdc01d0091d0c71)
- The `STATUS` page now displays `WriteBuffer` and `InterDir` disk information
- the API method `status` now returns 6 additional properties:
- FreeInterDiskSpaceLo `(int)` - Free disk space on `InterDir`, in bytes. This field contains the low 32-bits of 64-bit value
- FreeInterDiskSpaceHi `(int)` - Free disk space on `InterDir`, in bytes. This field contains the high 32-bits of 64-bit value
- FreeInterDiskSpaceMB `(int)` - Free disk space on `InterDir`, in MiB.
- TotalInterDiskSpaceLo `(int)` - Total disk space on `InterDir`, in bytes. This field contains the low 32-bits of 64-bit value
- TotalInterDiskSpaceHi `(int)` - Total disk space on `InterDir`, in bytes. This field contains the high 32-bits of 64-bit value
- TotalInterDiskSpaceMB `(int)` - Total disk space on `InterDir`, in MiB.
- Bits/s units are now also displayed in server speed test results

- Bug fixes:
- Fixed a critical bug related to corrupt downloaded files exceeding 2.6 GB on all x32 POSIX systems using `DirectWrite`
[#378](https://github.com/nzbgetcom/nzbget/commit/a59edac8bfbaf75d4f262909ef71026241b7bddc)
- Fixed a potential buffer overflow using `getrealpath` function
[#346](https://github.com/nzbgetcom/nzbget/commit/f89978f7479cbb0ff2f96c8632d9d2f31834e6c8)
- Added removal of unnecessary privileges if the nzbget daemon is run as root and an invalid `DaemonUsername` is specified
[#345](https://github.com/nzbgetcom/nzbget/commit/61585fac12e697baafa547012ed2970135de687f)

- For developers:
- Fixed omission in `CMAKE_CXX_FLAGS_DEBUG` using CLang that caused a wrong debug build
[#338](https://github.com/nzbgetcom/nzbget/commit/8d2c00e8d69503858a1ee0414dc6825b30508a92)
- Fixed failed unit tests on POSIX systems built without ncurses
[#376](https://github.com/nzbgetcom/nzbget/commit/b5c3068803f037984eba4f493ba38c71852a3073)

nzbget-24.2
- Features:
- System info tab and Server Speed Tests
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
![GitHub release (by tag)](https://img.shields.io/github/downloads/nzbgetcom/nzbget/v24.0/total?label=v24.0)
![GitHub release (by tag)](https://img.shields.io/github/downloads/nzbgetcom/nzbget/v24.1/total?label=v24.1)
![GitHub release (by tag)](https://img.shields.io/github/downloads/nzbgetcom/nzbget/v24.2/total?label=v24.2)
![GitHub release (by tag)](https://img.shields.io/github/downloads/nzbgetcom/nzbget/v24.3/total?label=v24.3)
![docker pulls](https://img.shields.io/docker/pulls/nzbgetcom/nzbget.svg)

[![linux build](https://github.com/nzbgetcom/nzbget/actions/workflows/linux.yml/badge.svg?branch=main)](https://github.com/nzbgetcom/nzbget/actions/workflows/linux.yml)
Expand Down Expand Up @@ -75,6 +76,7 @@ Android packages are available for Android 5.0+. [Android readme](docs/ANDROID.m
## Brief introduction on how to use NZBGet
- [How to use](docs/HOW_TO_USE.md)
- [Performance tips](docs/PERFORMANCE.md)
- [API reference](docs/api/API.md)

## Contribution

Expand Down
25 changes: 11 additions & 14 deletions daemon/extension/Extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,11 @@ namespace Extension
Xml::AddNewNode(structNode, "Version", "string", script.GetVersion());
Xml::AddNewNode(structNode, "NZBGetMinVersion", "string", script.GetNzbgetMinVersion());

Xml::AddNewNode(structNode, "PostScript", "boolean", BoolToStr(script.GetPostScript()));
Xml::AddNewNode(structNode, "ScanScript", "boolean", BoolToStr(script.GetScanScript()));
Xml::AddNewNode(structNode, "QueueScript", "boolean", BoolToStr(script.GetQueueScript()));
Xml::AddNewNode(structNode, "SchedulerScript", "boolean", BoolToStr(script.GetSchedulerScript()));
Xml::AddNewNode(structNode, "FeedScript", "boolean", BoolToStr(script.GetFeedScript()));
Xml::AddNewNode(structNode, "PostScript", "boolean", Xml::BoolToStr(script.GetPostScript()));
Xml::AddNewNode(structNode, "ScanScript", "boolean", Xml::BoolToStr(script.GetScanScript()));
Xml::AddNewNode(structNode, "QueueScript", "boolean", Xml::BoolToStr(script.GetQueueScript()));
Xml::AddNewNode(structNode, "SchedulerScript", "boolean", Xml::BoolToStr(script.GetSchedulerScript()));
Xml::AddNewNode(structNode, "FeedScript", "boolean", Xml::BoolToStr(script.GetFeedScript()));

Xml::AddNewNode(structNode, "QueueEvents", "string", script.GetQueueEvents());
Xml::AddNewNode(structNode, "TaskTime", "string", script.GetTaskTime());
Expand All @@ -375,7 +375,7 @@ namespace Extension
Xml::AddNewNode(commandsNode, "Name", "string", command.name.c_str());
Xml::AddNewNode(commandsNode, "DisplayName", "string", command.displayName.c_str());
Xml::AddNewNode(commandsNode, "Action", "string", command.action.c_str());
Xml::AddNewNode(commandsNode, "Multi", "boolean", BoolToStr(command.section.multi));
Xml::AddNewNode(commandsNode, "Multi", "boolean", Xml::BoolToStr(command.section.multi));
Xml::AddNewNode(commandsNode, "Section", "string", command.section.name.c_str());
Xml::AddNewNode(commandsNode, "Prefix", "string", command.section.prefix.c_str());

Expand All @@ -392,7 +392,7 @@ namespace Extension
{
Xml::AddNewNode(optionsNode, "Name", "string", option.name.c_str());
Xml::AddNewNode(optionsNode, "DisplayName", "string", option.displayName.c_str());
Xml::AddNewNode(optionsNode, "Multi", "boolean", BoolToStr(option.section.multi));
Xml::AddNewNode(optionsNode, "Multi", "boolean", Xml::BoolToStr(option.section.multi));
Xml::AddNewNode(optionsNode, "Section", "string", option.section.name.c_str());
Xml::AddNewNode(optionsNode, "Prefix", "string", option.section.prefix.c_str());

Expand All @@ -402,7 +402,8 @@ namespace Extension
}
else if (const double* val = std::get_if<double>(&option.value))
{
Xml::AddNewNode(optionsNode, "Value", "double", std::to_string(*val).c_str());
std::string valStr = std::to_string(*val);
Xml::AddNewNode(optionsNode, "Value", "double", valStr.c_str());
}

xmlNodePtr selectNode = xmlNewNode(nullptr, BAD_CAST "Select");
Expand All @@ -414,7 +415,8 @@ namespace Extension
}
else if (const double* val = std::get_if<double>(&selectOption))
{
Xml::AddNewNode(selectNode, "Value", "double", std::to_string(*val).c_str());
std::string valStr = std::to_string(*val);
Xml::AddNewNode(selectNode, "Value", "double", valStr.c_str());
}
}

Expand All @@ -440,9 +442,4 @@ namespace Extension

return result;
}

const char* BoolToStr(bool value)
{
return value ? "true" : "false";
}
}
2 changes: 0 additions & 2 deletions daemon/extension/Extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ namespace Extension

std::string ToJsonStr(const Script& script);
std::string ToXmlStr(const Script& script);

const char* BoolToStr(bool value);
}

#endif
11 changes: 10 additions & 1 deletion daemon/main/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ void Options::Init(const char* exeName, const char* configFilename, bool noConfi
}

ConvertOldOptions(&m_optEntries);

CheckDirs();
InitOptions();
CheckOptions();

Expand Down Expand Up @@ -429,7 +431,11 @@ void Options::InitDefaults()
SetOption(OPTION_WRITELOG, "append");
SetOption(OPTION_ROTATELOG, "3");
SetOption(OPTION_APPENDCATEGORYDIR, "yes");
#ifdef DISABLE_CURSES
SetOption(OPTION_OUTPUTMODE, "color");
#else
SetOption(OPTION_OUTPUTMODE, "curses");
#endif
SetOption(OPTION_DUPECHECK, "yes");
SetOption(OPTION_DOWNLOADRATE, "0");
SetOption(OPTION_CONTROLIP, "0.0.0.0");
Expand Down Expand Up @@ -656,7 +662,7 @@ void Options::CheckDir(CString& dir, const char* optionName,
}
}

void Options::InitOptions()
void Options::CheckDirs()
{
const char* mainDir = GetOption(OPTION_MAINDIR);

Expand All @@ -667,7 +673,10 @@ void Options::InitOptions()
CheckDir(m_webDir, OPTION_WEBDIR, nullptr, true, false);
CheckDir(m_scriptDir, OPTION_SCRIPTDIR, mainDir, true, false);
CheckDir(m_nzbDir, OPTION_NZBDIR, mainDir, false, true);
}

void Options::InitOptions()
{
m_requiredDir = GetOption(OPTION_REQUIREDDIR);

m_configTemplate = GetOption(OPTION_CONFIGTEMPLATE);
Expand Down
2 changes: 2 additions & 0 deletions daemon/main/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ class Options
bool GetRemoteClientMode() { return m_remoteClientMode; }

private:
void CheckDirs();

OptEntries m_optEntries;
Mutex m_optEntriesMutex;
Categories m_categories;
Expand Down
28 changes: 17 additions & 11 deletions daemon/main/nzbget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1010,18 +1010,24 @@ void NZBGet::Daemonize()
if (getuid() == 0 || geteuid() == 0)
{
struct passwd *pw = getpwnam(m_options->GetDaemonUsername());
if (pw)
if (pw == nullptr)
{
// Change owner of lock file
fchown(lfp, pw->pw_uid, pw->pw_gid);
// Set aux groups to null.
setgroups(0, (const gid_t*)0);
// Set primary group.
setgid(pw->pw_gid);
// Try setting aux groups correctly - not critical if this fails.
initgroups(m_options->GetDaemonUsername(), pw->pw_gid);
// Finally, set uid.
setuid(pw->pw_uid);
error("Starting daemon failed: invalid DaemonUsername");
exit(1);
}

// Change owner of lock- and logfile
chown(m_options->GetLockFile(), pw->pw_uid, pw->pw_gid);
chown(m_options->GetLogFile(), pw->pw_uid, pw->pw_gid);

// Set aux groups to null, configure primary and aux groups, and then assign uid
if (setgroups(0, (const gid_t*)0) ||
setgid(pw->pw_gid) ||
initgroups(m_options->GetDaemonUsername(), pw->pw_gid) ||
setuid(pw->pw_uid))
{
error("Starting daemon failed: could not drop privileges");
exit(1);
}
}

Expand Down
4 changes: 3 additions & 1 deletion daemon/main/nzbget.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,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/>.
*/


Expand Down Expand Up @@ -224,6 +224,7 @@ compiled */
#include <variant>
#include <limits>
#include <type_traits>
#include <random>

#include <libxml/parser.h>
#include <libxml/xmlreader.h>
Expand Down Expand Up @@ -355,6 +356,7 @@ typedef int pid_t;
#define FOPEN_WB "wb"
#define FOPEN_AB "ab"
#define CHILD_WATCHDOG 1
#define fseek fseeko

#endif /* POSIX */

Expand Down
13 changes: 9 additions & 4 deletions daemon/queue/DiskState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1233,8 +1233,12 @@ bool DiskState::SaveFileState(FileInfo* fileInfo, StateDiskFile& outfile, bool c
outfile.PrintLine("%i", (int)fileInfo->GetArticles()->size());
for (ArticleInfo* articleInfo : fileInfo->GetArticles())
{
outfile.PrintLine("%i,%u,%i,%u", (int)articleInfo->GetStatus(), (uint32)articleInfo->GetSegmentOffset(),
articleInfo->GetSegmentSize(), (uint32)articleInfo->GetCrc());
outfile.PrintLine("%i,%" PRIi64 ",%i,%u",
(int)articleInfo->GetStatus(),
articleInfo->GetSegmentOffset(),
articleInfo->GetSegmentSize(),
articleInfo->GetCrc()
);
}

outfile.Close();
Expand Down Expand Up @@ -1313,9 +1317,10 @@ bool DiskState::LoadFileState(FileInfo* fileInfo, Servers* servers, StateDiskFil

if (formatVersion >= 2)
{
uint32 segmentOffset, crc;
int64 segmentOffset;
uint32 crc;
int segmentSize;
if (infile.ScanLine("%i,%u,%i,%u", &statusInt, &segmentOffset, &segmentSize, &crc) != 4) goto error;
if (infile.ScanLine("%i,%" PRIi64 ",%i,%u", &statusInt, &segmentOffset, &segmentSize, &crc) != 4) goto error;
pa->SetSegmentOffset(segmentOffset);
pa->SetSegmentSize(segmentSize);
pa->SetCrc(crc);
Expand Down
Loading
Loading