1
0
Fork 0

Check for root privileges by inspecting the effective UID

The effective UID is what matters when it comes to the ability to
perform privileged actions, not the real UID.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
This commit is contained in:
Ondřej Lysoněk 2019-03-21 11:10:28 +01:00
parent 9d83b77572
commit 4fdb48ef34

View file

@ -7,7 +7,7 @@ from configobj import ConfigObj, ConfigObjError
have_dmidecode = False
try:
if (os.getuid() == 0 and platform.machine() in ["i386", "i486", "i586", "i686", "x86_64"]):
if (os.geteuid() == 0 and platform.machine() in ["i386", "i486", "i586", "i686", "x86_64"]):
import dmidecode
have_dmidecode = True
except: