On Thu, 23 Jul 2015, Tomas Babej wrote:
+    def get_trusted_domain_object_type(self, name_or_sid):
+        """
+        Return the type of the object corresponding to the given name in
+        the trusted domain, which is either 'user', 'group' or 'both'.
+        The 'both' types is used for users with magic private groups.
+        """
+        object_type = None
+        if is_sid_valid(name_or_sid):
+            result = pysss_nss_idmap.getnamebysid(name_or_sid)
+        else:
+            result = pysss_nss_idmap.getsidbyname(name_or_sid)
+        if name_or_sid in result:
+            object_type =
If user or group not found, pysss_nss_idmap.getsidbyname() will return
empty dict and the line above will fail:
import pysss_nss_idmap

It will return {}, however, that line is prefixed by the

+        if name_or_sid in result:

condition, hence it won't get executed in this case.
Ok, and then you get conversion dict.get(None) -> None which then
wouldn't match anything in the caller.

Sounds good. The rest was fine.


/ Alexander Bokovoy

Manage your subscription for the Freeipa-devel mailing list:
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to