Skip to content

Commit

Permalink
Merge pull request #1134 from seb128/new-polkitd-uid
Browse files Browse the repository at this point in the history
tests: start the polkitd mock with the corresponding user if it exists
  • Loading branch information
tbzatek authored Aug 7, 2023
2 parents 60179ee + e61a421 commit b4924ca
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/tests/test_polkitd.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import unittest
import signal
import time
import pwd

import dbus
import dbus.service
Expand Down Expand Up @@ -194,4 +195,10 @@ def main():
_run(args.allowed_actions.split(','), args.bus_address)

if __name__ == '__main__':
# use the right user to start the service
try:
uid = pwd.getpwnam('polkitd').pw_uid
os.setuid(uid)
except KeyError:
pass
main()

0 comments on commit b4924ca

Please sign in to comment.