Skip to content

Commit

Permalink
RHEL-15110: Only one domain socket listener should be allowed
Browse files Browse the repository at this point in the history
* It is another bug fix. It was possible to start two domain
  socket listeners using D-Bus method Start(). This should not
  be allowed. There should be only one client application
  trying to do registration.
  • Loading branch information
jirihnidek committed Nov 1, 2023
1 parent 6d3e4fe commit ef7c263
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/rhsmlib/dbus/objects/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ def __init__(self, conn=None, object_path=None, bus_name=None):
def Start(self, locale, sender=None):
locale = dbus_utils.dbus_to_python(locale, expected_type=str)
Locale.set(locale)

# When somebody else started domain socket listener, then
if self.impl.server is not None:
log.warning(f"domain socket listener already running, opened by: {self.impl.server.sender}")
raise exceptions.Failed(f"domain socket listener already running")

self._caller_uid = self._bus_interface.GetConnectionUnixUser(sender)

address: str = self.impl.start(sender)
Expand Down

0 comments on commit ef7c263

Please sign in to comment.