Changeset

13474:05c1098084cd

mod_version: Handle access denied from uname() Discovered while experimenting with a stricter SystemCallFilter setting See man:systemd.exec(5)
author Kim Alvefur <zash@zash.se>
date Sat, 06 Apr 2024 14:31:28 +0200
parents 13473:9eb081616842
children 13475:c14659710747
files plugins/mod_version.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_version.lua	Wed Apr 03 21:56:03 2024 -0700
+++ b/plugins/mod_version.lua	Sat Apr 06 14:31:28 2024 +0200
@@ -22,7 +22,12 @@
 		local os_version_command = module:get_option_string("os_version_command");
 		local ok, pposix = pcall(require, "prosody.util.pposix");
 		if not os_version_command and (ok and pposix and pposix.uname) then
-			platform = pposix.uname().sysname;
+			local ok, uname = pposix.uname();
+			if not ok then
+				module:log("debug", "Could not retrieve OS name: %s", uname);
+			else
+				platform = uname.sysname;
+			end
 		end
 		if not platform then
 			local uname = io.popen(os_version_command or "uname");