Nicer error message for pwfile owner/permission mismatch
This commit is contained in:
parent
ee4a9c6ed8
commit
e363303359
1 changed files with 2 additions and 2 deletions
|
|
@ -105,10 +105,10 @@ def read_data_from_shared_memory(shm_name: str) -> Any:
|
|||
with SharedMemory(shm_name, readonly=True) as shm:
|
||||
shm.unlink()
|
||||
if shm.stats.st_uid != os.geteuid() or shm.stats.st_gid != os.getegid():
|
||||
raise ValueError('Incorrect owner on pwfile')
|
||||
raise ValueError(f'Incorrect owner on pwfile: uid={shm.stats.st_uid} gid={shm.stats.st_gid}')
|
||||
mode = stat.S_IMODE(shm.stats.st_mode)
|
||||
if mode != stat.S_IREAD | stat.S_IWRITE:
|
||||
raise ValueError('Incorrect permissions on pwfile')
|
||||
raise ValueError(f'Incorrect permissions on pwfile: 0o{mode:03o}')
|
||||
return json.loads(shm.read_data_with_size())
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue