summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-08-03 14:23:39 +0200
committerLukas Slebodnik <lslebodn@redhat.com>2016-08-05 12:55:38 +0200
commiteb92441b65e0db9e64c88a57eb74358640e85d56 (patch)
tree97f3d488c4bed6766a93f8002ae700b09188089d /src/db
parent31fdda9759a8a03081b5ab6307a5e8ce4cbe50d2 (diff)
downloadsssd-eb92441b65e0db9e64c88a57eb74358640e85d56.tar.gz
sssd-eb92441b65e0db9e64c88a57eb74358640e85d56.tar.xz
sssd-eb92441b65e0db9e64c88a57eb74358640e85d56.zip
SYSDB: Fix setting dataExpireTimestamp if sysdb is supposed to set the current time
sysdb is already able to retrieve the current timestamp if the caller doesn't specify it. However, for the timestamp cache this came too late and the timestamp cache used zero as the 'now' time. Resolves: https://fedorahosted.org/sssd/ticket/3064 Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb_ops.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 342e16fb2..67006c155 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -2465,6 +2465,11 @@ int sysdb_store_user(struct sss_domain_info *domain,
errno_t sret = EOK;
bool in_transaction = false;
+ /* get transaction timestamp */
+ if (now == 0) {
+ now = time(NULL);
+ }
+
ret = sysdb_check_and_update_ts_usr(domain, name, attrs,
cache_timeout, now);
if (ret == EOK) {
@@ -2508,11 +2513,6 @@ int sysdb_store_user(struct sss_domain_info *domain,
DEBUG(SSSDBG_TRACE_LIBS, "User %s does not exist.\n", name);
}
- /* get transaction timestamp */
- if (!now) {
- now = time(NULL);
- }
-
if (ret == ENOENT) {
/* the user doesn't exist, turn into adding a user */
ret = sysdb_store_new_user(domain, name, uid, gid, gecos, homedir,
@@ -2700,6 +2700,11 @@ int sysdb_store_group(struct sss_domain_info *domain,
errno_t sret = EOK;
bool in_transaction = false;
+ /* get transaction timestamp */
+ if (!now) {
+ now = time(NULL);
+ }
+
ret = sysdb_check_and_update_ts_grp(domain, name, attrs,
cache_timeout, now);
if (ret == EOK) {
@@ -2741,11 +2746,6 @@ int sysdb_store_group(struct sss_domain_info *domain,
}
}
- /* get transaction timestamp */
- if (!now) {
- now = time(NULL);
- }
-
if (new_group) {
ret = sysdb_store_new_group(domain, name, gid, attrs,
cache_timeout, now);