From 1e9930690691360d8963eecea4918b36b6d51013 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Thu, 1 Aug 2013 12:40:24 +0200 Subject: PAC: if user entry already exists keep it Currently the PAC responder deletes a user entry and recreates it if some attributes seems to be different. Two of the attributes where the home directory and the shell of the user. Those two attributes are not available from the PAC but where generates by the PAC responder. The corresponding ID provider might have better means to determine those attributes, e.g. read them from LDAP, so we shouldn't change them here. The third attribute is the user name. Since the PAC responder does lookups only based on the UID we can wait until the ID provider updates the entry. Fixes https://fedorahosted.org/sssd/ticket/1996 --- src/responder/pac/pacsrv_utils.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'src/responder/pac/pacsrv_utils.c') diff --git a/src/responder/pac/pacsrv_utils.c b/src/responder/pac/pacsrv_utils.c index f70438b6..a52282c7 100644 --- a/src/responder/pac/pacsrv_utils.c +++ b/src/responder/pac/pacsrv_utils.c @@ -506,42 +506,3 @@ done: return ret; } - -static bool compare_string_with_attr(const char *val, struct ldb_message *msg, - const char *attr) -{ - const char *str; - - str = ldb_msg_find_attr_as_string(msg, attr, NULL); - if ((str == NULL && val == NULL) || - (str != NULL && val != NULL && strcmp(str, val) == 0)) { - return true; - } - - return false; -} - -bool new_and_cached_user_differs(struct passwd *pwd, struct ldb_message *msg) -{ - if (pwd == NULL || msg == NULL) { - return true; - } - - if (!compare_string_with_attr(pwd->pw_name, msg, SYSDB_NAME) && - !compare_string_with_attr(pwd->pw_name, msg, SYSDB_NAME_ALIAS)) { - DEBUG(SSSDBG_TRACE_FUNC, ("Names differ.")); - return true; - } - - if (!compare_string_with_attr(pwd->pw_dir, msg, SYSDB_HOMEDIR)) { - DEBUG(SSSDBG_TRACE_FUNC, ("Home directories differ.")); - return true; - } - - if (!compare_string_with_attr(pwd->pw_shell, msg, SYSDB_SHELL)) { - DEBUG(SSSDBG_TRACE_FUNC, ("Shells differ.")); - return true; - } - - return false; -} -- cgit