summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-11-11 21:28:22 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-11-18 17:35:08 -0500
commit5a6520fc7bf4bc5dcbb71339d6f9e133c4ebd9a3 (patch)
treec1d466849b4e2f54839b85d66aee7dc66332b7aa
parent23af8a7e77f44d271d81ca69d6477c3598f348c0 (diff)
downloadsssd-5a6520fc7bf4bc5dcbb71339d6f9e133c4ebd9a3.tar.gz
sssd-5a6520fc7bf4bc5dcbb71339d6f9e133c4ebd9a3.tar.bz2
sssd-5a6520fc7bf4bc5dcbb71339d6f9e133c4ebd9a3.zip
Store initgr expire time on initgr call
-rw-r--r--server/providers/ldap/sdap_async_accounts.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/server/providers/ldap/sdap_async_accounts.c b/server/providers/ldap/sdap_async_accounts.c
index bf6f852c..292c85f0 100644
--- a/server/providers/ldap/sdap_async_accounts.c
+++ b/server/providers/ldap/sdap_async_accounts.c
@@ -46,7 +46,8 @@ static struct tevent_req *sdap_save_user_send(TALLOC_CTX *memctx,
struct sysdb_handle *handle,
struct sdap_options *opts,
struct sss_domain_info *dom,
- struct sysdb_attrs *attrs)
+ struct sysdb_attrs *attrs,
+ bool is_initgr)
{
struct tevent_req *req, *subreq;
struct sdap_save_user_state *state;
@@ -63,6 +64,7 @@ static struct tevent_req *sdap_save_user_send(TALLOC_CTX *memctx,
char *upn = NULL;
int i;
char *val = NULL;
+ int cache_timeout;
DEBUG(9, ("Save user\n"));
@@ -253,14 +255,23 @@ static struct tevent_req *sdap_save_user_send(TALLOC_CTX *memctx,
}
}
+ cache_timeout = dp_opt_get_int(opts->basic, SDAP_ENTRY_CACHE_TIMEOUT);
+
+ if (is_initgr) {
+ ret = sysdb_attrs_add_time_t(user_attrs, SYSDB_INITGR_EXPIRE,
+ (cache_timeout ?
+ (time(NULL) + cache_timeout) : 0));
+ if (ret) {
+ goto fail;
+ }
+ }
+
DEBUG(6, ("Storing info for user %s\n", state->name));
subreq = sysdb_store_user_send(state, state->ev, state->handle,
state->dom, state->name, pwd,
uid, gid, gecos, homedir, shell,
- user_attrs,
- dp_opt_get_int(opts->basic,
- SDAP_ENTRY_CACHE_TIMEOUT));
+ user_attrs, cache_timeout);
if (!subreq) {
ret = ENOMEM;
goto fail;
@@ -393,7 +404,7 @@ static void sdap_save_users_store(struct tevent_req *req)
subreq = sdap_save_user_send(state, state->ev, state->handle,
state->opts, state->dom,
- state->users[state->cur]);
+ state->users[state->cur], false);
if (!subreq) {
tevent_req_error(req, ENOMEM);
return;
@@ -1955,7 +1966,7 @@ static void sdap_get_initgr_store(struct tevent_req *subreq)
subreq = sdap_save_user_send(state, state->ev, state->handle,
state->opts, state->dom,
- state->orig_user);
+ state->orig_user, true);
if (!subreq) {
tevent_req_error(req, ENOMEM);
return;