From 09f381bc2734db95393fb88d31559c1cac15cc2d Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Jun 18 2021 17:31:35 +0000 Subject: Also request the username from SSSd With SSSd, it is possible to login with one's email address. In this case, the username needs to be mapped to `nickname`, but it was not requested from DBus. This commit adds the query and the corresponding mapping. Signed-off-by: Aurélien Bompard --- diff --git a/ipsilon/info/infosssd.py b/ipsilon/info/infosssd.py index 009a2a7..8ce779b 100644 --- a/ipsilon/info/infosssd.py +++ b/ipsilon/info/infosssd.py @@ -27,6 +27,8 @@ SSSD_ATTRS = ['mail', # These are mapped from the infosssd configuration in sssd.conf sssd_mapping = [ + ['username', 'nickname'], + ['username', 'preferred_username'], ['gecos', 'fullname'], ['mail', 'email'], ['givenname', 'givenname'], @@ -84,7 +86,11 @@ Info plugin that uses DBus to retrieve user data from SSSd.""" user_obj = self.bus.get_object('org.freedesktop.sssd.infopipe', user_path) - # Get GECOS, attributes, and groups + # Get username, GECOS, attributes, and groups + reply['username'] = self._unwrap_dbus_str(user_obj.Get( + 'org.freedesktop.sssd.infopipe.Users.User', + 'name', + dbus_interface=dbus.PROPERTIES_IFACE)) reply['gecos'] = self._unwrap_dbus_str(user_obj.Get( 'org.freedesktop.sssd.infopipe.Users.User', 'gecos',