Software /
code /
prosody
Comparison
plugins/mod_version.lua @ 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 |
parent | 12977:74b9e05af71e |
child | 13476:b9267ce1b183 |
comparison
equal
deleted
inserted
replaced
13473:9eb081616842 | 13474:05c1098084cd |
---|---|
20 platform = "Windows"; | 20 platform = "Windows"; |
21 else | 21 else |
22 local os_version_command = module:get_option_string("os_version_command"); | 22 local os_version_command = module:get_option_string("os_version_command"); |
23 local ok, pposix = pcall(require, "prosody.util.pposix"); | 23 local ok, pposix = pcall(require, "prosody.util.pposix"); |
24 if not os_version_command and (ok and pposix and pposix.uname) then | 24 if not os_version_command and (ok and pposix and pposix.uname) then |
25 platform = pposix.uname().sysname; | 25 local ok, uname = pposix.uname(); |
26 if not ok then | |
27 module:log("debug", "Could not retrieve OS name: %s", uname); | |
28 else | |
29 platform = uname.sysname; | |
30 end | |
26 end | 31 end |
27 if not platform then | 32 if not platform then |
28 local uname = io.popen(os_version_command or "uname"); | 33 local uname = io.popen(os_version_command or "uname"); |
29 if uname then | 34 if uname then |
30 platform = uname:read("*a"); | 35 platform = uname:read("*a"); |