Blame SOURCES/0082-SYSDB-Avoid-optimisation-with-modifyTimestamp-for-us.patch

b2d430
From d3925525068798e92cee1da95dbee0f838b2f36f Mon Sep 17 00:00:00 2001
b2d430
From: Lukas Slebodnik <lslebodn@redhat.com>
b2d430
Date: Wed, 3 Aug 2016 18:48:04 +0200
b2d430
Subject: [PATCH 82/82] SYSDB: Avoid optimisation with modifyTimestamp for
b2d430
 users
b2d430
b2d430
The usage of modifyTimestamp needn't be a reliable way
b2d430
for detecting of changes in user entry in LDAP.
b2d430
The authorisation need to rely current data from LDAP
b2d430
and therefore we will temporary disable optimisation with
b2d430
modifyTimestamp and we will rather rely on deep comparison
b2d430
of attributes. In he future, it might be changed and
b2d430
responders might control the optimization level.
b2d430
b2d430
Resolves:
b2d430
https://fedorahosted.org/sssd/ticket/3110
b2d430
b2d430
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
b2d430
(cherry picked from commit 00f3c5cd03625357e226552084e499965512bf53)
b2d430
---
b2d430
 src/db/sysdb_ops.c                     | 19 -------------------
b2d430
 src/tests/cmocka/test_sysdb_ts_cache.c | 14 --------------
b2d430
 2 files changed, 33 deletions(-)
b2d430
b2d430
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
b2d430
index 67006c155098b9fde00a01d424014852c383a325..44fb5b70e6d33fffbca5824f831a3229254ecb57 100644
b2d430
--- a/src/db/sysdb_ops.c
b2d430
+++ b/src/db/sysdb_ops.c
b2d430
@@ -1101,16 +1101,6 @@ done:
b2d430
     return ret;
b2d430
 }
b2d430
 
b2d430
-static errno_t sysdb_check_and_update_ts_usr(struct sss_domain_info *domain,
b2d430
-                                             const char *grp_name,
b2d430
-                                             struct sysdb_attrs *attrs,
b2d430
-                                             uint64_t cache_timeout,
b2d430
-                                             time_t now)
b2d430
-{
b2d430
-    return sysdb_check_and_update_ts_obj(domain, SYSDB_USER, grp_name,
b2d430
-                                         attrs, cache_timeout, now);
b2d430
-}
b2d430
-
b2d430
 static errno_t sysdb_check_and_update_ts_grp(struct sss_domain_info *domain,
b2d430
                                              const char *grp_name,
b2d430
                                              struct sysdb_attrs *attrs,
b2d430
@@ -2470,15 +2460,6 @@ int sysdb_store_user(struct sss_domain_info *domain,
b2d430
         now = time(NULL);
b2d430
     }
b2d430
 
b2d430
-    ret = sysdb_check_and_update_ts_usr(domain, name, attrs,
b2d430
-                                        cache_timeout, now);
b2d430
-    if (ret == EOK) {
b2d430
-        DEBUG(SSSDBG_TRACE_LIBS,
b2d430
-              "The user record of %s did not change, only updated "
b2d430
-              "the timestamp cache\n", name);
b2d430
-        return EOK;
b2d430
-    }
b2d430
-
b2d430
     tmp_ctx = talloc_new(NULL);
b2d430
     if (!tmp_ctx) {
b2d430
         return ENOMEM;
b2d430
diff --git a/src/tests/cmocka/test_sysdb_ts_cache.c b/src/tests/cmocka/test_sysdb_ts_cache.c
b2d430
index aa857e7e4823d2d8ba1e1a794b3e2474876e9ab0..e950f88631e4c78573bbb7290edfe94b5ced57cd 100644
b2d430
--- a/src/tests/cmocka/test_sysdb_ts_cache.c
b2d430
+++ b/src/tests/cmocka/test_sysdb_ts_cache.c
b2d430
@@ -980,20 +980,6 @@ static void test_sysdb_user_update(void **state)
b2d430
     assert_int_equal(cache_expire_sysdb, TEST_CACHE_TIMEOUT + TEST_NOW_2);
b2d430
     assert_int_equal(cache_expire_ts, TEST_CACHE_TIMEOUT + TEST_NOW_2);
b2d430
 
b2d430
-    /* Update the same attrs and the same modifyTimestamp.
b2d430
-     * Only the timestamp cache must be bumped */
b2d430
-    ret = sysdb_store_user(test_ctx->tctx->dom, TEST_USER_NAME, NULL,
b2d430
-                           TEST_USER_UID, TEST_USER_GID, TEST_USER_NAME,
b2d430
-                           "/home/"TEST_USER_NAME, "/bin/bash", NULL,
b2d430
-                           user_attrs, NULL, TEST_CACHE_TIMEOUT,
b2d430
-                           TEST_NOW_3);
b2d430
-    assert_int_equal(ret, EOK);
b2d430
-
b2d430
-    get_pw_timestamp_attrs(test_ctx, TEST_USER_NAME,
b2d430
-                           &cache_expire_sysdb, &cache_expire_ts);
b2d430
-    assert_int_equal(cache_expire_sysdb, TEST_CACHE_TIMEOUT + TEST_NOW_2);
b2d430
-    assert_int_equal(cache_expire_ts, TEST_CACHE_TIMEOUT + TEST_NOW_3);
b2d430
-
b2d430
     /* Update with different modifyTimestamp but same attrs as previously
b2d430
      * saved to the timestamp cache. We should detect the 'real' attributes
b2d430
      * are the same and only bump the timestamp cache
b2d430
-- 
b2d430
2.4.11
b2d430