Bug 808058

Summary: Inspect usage of sysdb_search_user_by_name() ba various parts of code
Product: Red Hat Enterprise Linux 6 Reporter: Dmitri Pal <dpal>
Component: sssdAssignee: Stephen Gallagher <sgallagh>
Status: CLOSED NOTABUG QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: grajaiya, jgalipea, prc
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-14 17:35:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Dmitri Pal 2012-03-29 13:07:38 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/sssd/ticket/1275

I stumbled upon this when inspecting usage of sysdb_search_user_by_name(). This routine only fetches user by his primary name. The problem is that some parts of the code don't need to fetch user just by his primary name, but also by any of his aliases.

Some parts of the code work ok with this. For example sdap_process_group_members_2307() calls first sysdb_search_user_by_name() and if it doesn't find anything, it calls sdap_process_missing_member_2307() which then searches for all users with that name as alias.

In particular I found three occurrences of sysdb_search_user_by_name() which I'm a bit concerned about and I think they need closer inspection:
* '''MPG domains''': sysdb_ops.c:1149 (group should not have the same name as any user's alias)
* '''sysdb_store_user''' - although it might a valid solution to check for aliases on all places where this routine is called, I'd prefer the check to be performed in it. Otherwise we might ending up with two users with the same name in the database (one as alias and one as the primary name). It is questionable what should be the right behaviour (update user with that alias, drop the alias or stop adding the user?).
* '''sysdb_delete_user''' - this is called on two places which I'm particularly concerned about: users_get_done() and groups_by_user_done()

Comment 1 Jenny Severance 2012-03-29 17:53:22 UTC
Please add steps to reproduce this issue