summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb.h21
-rw-r--r--src/db/sysdb_ops.c66
-rw-r--r--src/providers/ldap/sdap_async_groups.c34
-rw-r--r--src/providers/ldap/sdap_async_initgroups.c6
-rw-r--r--src/providers/ldap/sdap_async_netgroups.c10
-rw-r--r--src/providers/ldap/sdap_async_private.h3
-rw-r--r--src/providers/ldap/sdap_async_users.c9
-rw-r--r--src/providers/proxy/proxy_id.c30
-rw-r--r--src/providers/proxy/proxy_netgroup.c2
-rw-r--r--src/tests/sysdb-tests.c22
-rw-r--r--src/tools/sss_sync_ops.c4
11 files changed, 130 insertions, 77 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 2985a1a0c..88767d3cf 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -473,11 +473,13 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
const char *homedir,
const char *shell,
struct sysdb_attrs *attrs,
- int cache_timeout);
+ int cache_timeout,
+ time_t now);
int sysdb_add_fake_user(struct sysdb_ctx *sysdb,
const char *name,
- const char *original_dn);
+ const char *original_dn,
+ time_t now);
/* Add group (only basic attrs and w/o checks) */
int sysdb_add_basic_group(struct sysdb_ctx *sysdb,
@@ -487,12 +489,14 @@ int sysdb_add_basic_group(struct sysdb_ctx *sysdb,
int sysdb_add_group(struct sysdb_ctx *sysdb,
const char *name, gid_t gid,
struct sysdb_attrs *attrs,
- int cache_timeout);
+ int cache_timeout,
+ time_t now);
int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb,
const char *name,
gid_t gid,
- const char *original_dn, bool posix);
+ const char *original_dn, bool posix,
+ time_t now);
/* Add netgroup (only basic attrs and w/o checks) */
int sysdb_add_basic_netgroup(struct sysdb_ctx *sysdb,
@@ -502,7 +506,8 @@ int sysdb_add_netgroup(struct sysdb_ctx *sysdb,
const char *name,
const char *description,
struct sysdb_attrs *attrs,
- int cache_timeout);
+ int cache_timeout,
+ time_t now);
/* mod_op must be either LDB_FLAG_MOD_ADD or LDB_FLAG_MOD_DELETE */
int sysdb_mod_group_member(struct sysdb_ctx *sysdb,
@@ -519,13 +524,15 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
const char *shell,
struct sysdb_attrs *attrs,
char **remove_attrs,
- uint64_t cache_timeout);
+ uint64_t cache_timeout,
+ time_t now);
int sysdb_store_group(struct sysdb_ctx *sysdb,
const char *name,
gid_t gid,
struct sysdb_attrs *attrs,
- uint64_t cache_timeout);
+ uint64_t cache_timeout,
+ time_t now);
enum sysdb_member_type {
SYSDB_MEMBER_USER,
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index f4418e4ef..457370f2b 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -811,13 +811,13 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
const char *homedir,
const char *shell,
struct sysdb_attrs *attrs,
- int cache_timeout)
+ int cache_timeout,
+ time_t now)
{
TALLOC_CTX *tmp_ctx;
struct ldb_message *msg;
struct sysdb_attrs *id_attrs;
uint32_t id;
- time_t now;
int ret;
struct sss_domain_info *domain = sysdb->domain;
@@ -913,7 +913,9 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
}
}
- now = time(NULL);
+ if (!now) {
+ now = time(NULL);
+ }
ret = sysdb_attrs_add_time_t(attrs, SYSDB_LAST_UPDATE, now);
if (ret) goto done;
@@ -939,11 +941,11 @@ done:
int sysdb_add_fake_user(struct sysdb_ctx *sysdb,
const char *name,
- const char *original_dn)
+ const char *original_dn,
+ time_t now)
{
TALLOC_CTX *tmp_ctx;
struct ldb_message *msg;
- time_t now;
int ret;
tmp_ctx = talloc_new(NULL);
@@ -968,7 +970,9 @@ int sysdb_add_fake_user(struct sysdb_ctx *sysdb,
ret = add_string(msg, LDB_FLAG_MOD_ADD, SYSDB_NAME, name);
if (ret) goto done;
- now = time(NULL);
+ if (!now) {
+ now = time(NULL);
+ }
ret = add_ulong(msg, LDB_FLAG_MOD_ADD, SYSDB_CREATE_TIME,
(unsigned long) now);
@@ -1061,12 +1065,12 @@ done:
int sysdb_add_group(struct sysdb_ctx *sysdb,
const char *name, gid_t gid,
struct sysdb_attrs *attrs,
- int cache_timeout)
+ int cache_timeout,
+ time_t now)
{
TALLOC_CTX *tmp_ctx;
struct ldb_message *msg;
uint32_t id;
- time_t now;
int ret;
bool posix;
@@ -1144,7 +1148,9 @@ int sysdb_add_group(struct sysdb_ctx *sysdb,
if (ret) goto done;
}
- now = time(NULL);
+ if (!now) {
+ now = time(NULL);
+ }
ret = sysdb_attrs_add_time_t(attrs, SYSDB_LAST_UPDATE, now);
if (ret) goto done;
@@ -1172,10 +1178,10 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb,
const char *name,
gid_t gid,
const char *original_dn,
- bool posix)
+ bool posix,
+ time_t now)
{
TALLOC_CTX *tmp_ctx;
- time_t now;
int ret;
struct sysdb_attrs *attrs;
@@ -1194,7 +1200,9 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb,
goto done;
}
- now = time(NULL);
+ if (!now) {
+ now = time(NULL);
+ }
ret = sysdb_attrs_add_time_t(attrs, SYSDB_LAST_UPDATE, now);
if (ret) goto done;
@@ -1320,10 +1328,10 @@ int sysdb_add_netgroup(struct sysdb_ctx *sysdb,
const char *name,
const char *description,
struct sysdb_attrs *attrs,
- int cache_timeout)
+ int cache_timeout,
+ time_t now)
{
TALLOC_CTX *tmp_ctx;
- time_t now;
int ret;
tmp_ctx = talloc_new(NULL);
@@ -1350,7 +1358,9 @@ int sysdb_add_netgroup(struct sysdb_ctx *sysdb,
}
}
- now = time(NULL);
+ if (!now) {
+ now = time(NULL);
+ }
ret = sysdb_attrs_add_time_t(attrs, SYSDB_LAST_UPDATE, now);
if (ret) goto done;
@@ -1390,11 +1400,11 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
const char *shell,
struct sysdb_attrs *attrs,
char **remove_attrs,
- uint64_t cache_timeout)
+ uint64_t cache_timeout,
+ time_t now)
{
TALLOC_CTX *tmp_ctx;
struct ldb_message *msg;
- time_t now;
int ret;
errno_t sret = EOK;
bool in_transaction = false;
@@ -1428,10 +1438,15 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
goto done;
}
+ /* get transaction timestamp */
+ if (!now) {
+ now = time(NULL);
+ }
+
if (ret == ENOENT) {
/* users doesn't exist, turn into adding a user */
ret = sysdb_add_user(sysdb, name, uid, gid,
- gecos, homedir, shell, attrs, cache_timeout);
+ gecos, homedir, shell, attrs, cache_timeout, now);
goto done;
}
@@ -1466,8 +1481,6 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
if (ret) goto done;
}
- now = time(NULL);
-
ret = sysdb_attrs_add_time_t(attrs, SYSDB_LAST_UPDATE, now);
if (ret) goto done;
@@ -1519,14 +1532,14 @@ int sysdb_store_group(struct sysdb_ctx *sysdb,
const char *name,
gid_t gid,
struct sysdb_attrs *attrs,
- uint64_t cache_timeout)
+ uint64_t cache_timeout,
+ time_t now)
{
TALLOC_CTX *tmp_ctx;
static const char *src_attrs[] = { SYSDB_NAME, SYSDB_GIDNUM,
SYSDB_ORIG_MODSTAMP, NULL };
struct ldb_message *msg;
bool new_group = false;
- time_t now;
int ret;
tmp_ctx = talloc_new(NULL);
@@ -1551,12 +1564,17 @@ int sysdb_store_group(struct sysdb_ctx *sysdb,
}
}
+ /* get transaction timestamp */
+ if (!now) {
+ now = time(NULL);
+ }
+
/* FIXME: use the remote modification timestamp to know if the
* group needs any update */
if (new_group) {
/* group doesn't exist, turn into adding a group */
- ret = sysdb_add_group(sysdb, name, gid, attrs, cache_timeout);
+ ret = sysdb_add_group(sysdb, name, gid, attrs, cache_timeout, now);
goto done;
}
@@ -1566,8 +1584,6 @@ int sysdb_store_group(struct sysdb_ctx *sysdb,
if (ret) goto done;
}
- now = time(NULL);
-
ret = sysdb_attrs_add_time_t(attrs, SYSDB_LAST_UPDATE, now);
if (ret) goto done;
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index 1e8e4b3d8..535c38338 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -185,7 +185,8 @@ sdap_store_group_with_gid(TALLOC_CTX *mem_ctx,
gid_t gid,
struct sysdb_attrs *group_attrs,
uint64_t cache_timeout,
- bool posix_group)
+ bool posix_group,
+ time_t now)
{
errno_t ret;
@@ -199,7 +200,7 @@ sdap_store_group_with_gid(TALLOC_CTX *mem_ctx,
}
}
- ret = sysdb_store_group(ctx, name, gid, group_attrs, cache_timeout);
+ ret = sysdb_store_group(ctx, name, gid, group_attrs, cache_timeout, now);
if (ret) {
DEBUG(2, ("Could not store group %s\n", name));
return ret;
@@ -215,7 +216,8 @@ static int sdap_save_group(TALLOC_CTX *memctx,
struct sysdb_attrs *attrs,
bool store_members,
bool populate_members,
- char **_usn_value)
+ char **_usn_value,
+ time_t now)
{
struct ldb_message_element *el;
struct sysdb_attrs *group_attrs;
@@ -389,7 +391,7 @@ static int sdap_save_group(TALLOC_CTX *memctx,
name, gid, group_attrs,
dp_opt_get_int(opts->basic,
SDAP_ENTRY_CACHE_TIMEOUT),
- posix_group);
+ posix_group, now);
if (ret) goto fail;
if (_usn_value) {
@@ -417,7 +419,8 @@ static int sdap_save_grpmem(TALLOC_CTX *memctx,
struct sysdb_ctx *ctx,
struct sdap_options *opts,
struct sss_domain_info *dom,
- struct sysdb_attrs *attrs)
+ struct sysdb_attrs *attrs,
+ time_t now)
{
struct ldb_message_element *el;
struct sysdb_attrs *group_attrs = NULL;
@@ -459,7 +462,7 @@ static int sdap_save_grpmem(TALLOC_CTX *memctx,
ret = sysdb_store_group(ctx, name, 0, group_attrs,
dp_opt_get_int(opts->basic,
- SDAP_ENTRY_CACHE_TIMEOUT));
+ SDAP_ENTRY_CACHE_TIMEOUT), now);
if (ret) goto fail;
return EOK;
@@ -489,6 +492,7 @@ static int sdap_save_groups(TALLOC_CTX *memctx,
int i;
struct sysdb_attrs **saved_groups = NULL;
int nsaved_groups = 0;
+ time_t now;
switch (opts->schema_type) {
case SDAP_SCHEMA_RFC2307:
@@ -524,13 +528,14 @@ static int sdap_save_groups(TALLOC_CTX *memctx,
}
}
+ now = time(NULL);
for (i = 0; i < num_groups; i++) {
usn_value = NULL;
/* if 2 pass savemembers = false */
ret = sdap_save_group(tmpctx, sysdb,
opts, dom, groups[i],
- (!twopass), populate_members, &usn_value);
+ (!twopass), populate_members, &usn_value, now);
/* Do not fail completely on errors.
* Just report the failure to save and go on */
@@ -563,7 +568,7 @@ static int sdap_save_groups(TALLOC_CTX *memctx,
for (i = 0; i < nsaved_groups; i++) {
- ret = sdap_save_grpmem(tmpctx, sysdb, opts, dom, saved_groups[i]);
+ ret = sdap_save_grpmem(tmpctx, sysdb, opts, dom, saved_groups[i], now);
/* Do not fail completely on errors.
* Just report the failure to save and go on */
if (ret) {
@@ -891,7 +896,8 @@ sdap_add_group_member_2307(struct sdap_process_group_state *state,
static int
sdap_process_missing_member_2307(struct sdap_process_group_state *state,
- char *member_name, bool *in_transaction)
+ char *member_name, bool *in_transaction,
+ time_t now)
{
int ret, sret;
TALLOC_CTX *tmp_ctx;
@@ -946,7 +952,7 @@ sdap_process_missing_member_2307(struct sdap_process_group_state *state,
*in_transaction = true;
}
- ret = sysdb_add_fake_user(state->sysdb, username, NULL);
+ ret = sysdb_add_fake_user(state->sysdb, username, NULL, now);
if (ret != EOK) {
DEBUG(1, ("Cannot store fake user entry: [%d]: %s\n",
ret, strerror(ret)));
@@ -989,8 +995,10 @@ sdap_process_group_members_2307(struct sdap_process_group_state *state,
char *member_name;
int ret;
errno_t sret;
+ time_t now;
int i;
+ now = time(NULL);
for (i=0; i < memberel->num_values; i++) {
member_name = (char *)memberel->values[i].data;
@@ -1017,7 +1025,7 @@ sdap_process_group_members_2307(struct sdap_process_group_state *state,
i, member_name));
ret = sdap_process_missing_member_2307(state, member_name,
- &in_transaction);
+ &in_transaction, now);
if (ret != EOK) {
DEBUG(1, ("Error processing missing member #%d (%s):\n",
i, member_name));
@@ -1529,6 +1537,7 @@ static errno_t sdap_nested_group_populate_users(struct sysdb_ctx *sysdb,
struct sysdb_attrs *attrs;
static const char *search_attrs[] = { SYSDB_NAME, NULL };
size_t count;
+ time_t now;
if (num_users == 0) {
/* Nothing to do if there are no users */
@@ -1544,6 +1553,7 @@ static errno_t sdap_nested_group_populate_users(struct sysdb_ctx *sysdb,
goto done;
}
+ now = time(NULL);
for (i = 0; i < num_users; i++) {
ret = sysdb_attrs_primary_name(sysdb, users[i],
opts->user_map[SDAP_AT_USER_NAME].name,
@@ -1613,7 +1623,7 @@ static errno_t sdap_nested_group_populate_users(struct sysdb_ctx *sysdb,
}
/* If the entry does not exist add a fake user record */
- ret = sysdb_add_fake_user(sysdb, username, original_dn);
+ ret = sysdb_add_fake_user(sysdb, username, original_dn, now);
if (ret != EOK) {
DEBUG(1, ("Cannot store fake user entry, ignoring: [%d]: %s\n",
ret, strerror(ret)));
diff --git a/src/providers/ldap/sdap_async_initgroups.c b/src/providers/ldap/sdap_async_initgroups.c
index 4cf5a53bb..65ff86cd0 100644
--- a/src/providers/ldap/sdap_async_initgroups.c
+++ b/src/providers/ldap/sdap_async_initgroups.c
@@ -44,6 +44,7 @@ static errno_t sdap_add_incomplete_groups(struct sysdb_ctx *sysdb,
int ret;
bool in_transaction = false;
bool posix;
+ time_t now;
/* There are no groups in LDAP but we should add user to groups ?? */
if (ldap_groups_count == 0) return EOK;
@@ -90,6 +91,7 @@ static errno_t sdap_add_incomplete_groups(struct sysdb_ctx *sysdb,
goto done;
}
+ now = time(NULL);
for (i=0; missing[i]; i++) {
/* The group is not in sysdb, need to add a fake entry */
for (ai=0; ai < ldap_groups_count; ai++) {
@@ -127,7 +129,7 @@ static errno_t sdap_add_incomplete_groups(struct sysdb_ctx *sysdb,
DEBUG(8, ("Adding fake group %s to sysdb\n", name));
ret = sysdb_add_incomplete_group(sysdb, name, gid, original_dn,
- posix);
+ posix, now);
if (ret != EOK) {
goto fail;
}
@@ -1832,7 +1834,7 @@ static void sdap_get_initgr_user(struct tevent_req *subreq)
ret = sdap_save_user(state, state->sysdb,
state->opts, state->dom,
state->orig_user, state->ldap_attrs,
- true, NULL);
+ true, NULL, 0);
if (ret) {
sysdb_transaction_cancel(state->sysdb);
tevent_req_error(req, ret);
diff --git a/src/providers/ldap/sdap_async_netgroups.c b/src/providers/ldap/sdap_async_netgroups.c
index 6f884bc52..586d079e7 100644
--- a/src/providers/ldap/sdap_async_netgroups.c
+++ b/src/providers/ldap/sdap_async_netgroups.c
@@ -40,7 +40,8 @@ static errno_t sdap_save_netgroup(TALLOC_CTX *memctx,
struct sdap_options *opts,
struct sss_domain_info *dom,
struct sysdb_attrs *attrs,
- char **_timestamp)
+ char **_timestamp,
+ time_t now)
{
struct ldb_message_element *el;
struct sysdb_attrs *netgroup_attrs;
@@ -167,7 +168,7 @@ static errno_t sdap_save_netgroup(TALLOC_CTX *memctx,
ret = sysdb_add_netgroup(ctx, name, NULL, netgroup_attrs,
dp_opt_get_int(opts->basic,
- SDAP_ENTRY_CACHE_TIMEOUT));
+ SDAP_ENTRY_CACHE_TIMEOUT), now);
if (ret) goto fail;
if (_timestamp) {
@@ -666,6 +667,7 @@ static void netgr_translate_members_done(struct tevent_req *subreq)
struct sdap_get_netgroups_state);
int ret;
size_t c;
+ time_t now;
ret = netgroup_translate_ldap_members_recv(subreq, state, &state->count,
&state->netgroups);
@@ -675,11 +677,13 @@ static void netgr_translate_members_done(struct tevent_req *subreq)
return;
}
+ now = time(NULL);
for (c = 0; c < state->count; c++) {
ret = sdap_save_netgroup(state, state->sysdb,
state->opts, state->dom,
state->netgroups[c],
- &state->higher_timestamp);
+ &state->higher_timestamp,
+ now);
if (ret) {
DEBUG(2, ("Failed to store netgroups.\n"));
tevent_req_error(req, ret);
diff --git a/src/providers/ldap/sdap_async_private.h b/src/providers/ldap/sdap_async_private.h
index 5b0417163..fa7844e72 100644
--- a/src/providers/ldap/sdap_async_private.h
+++ b/src/providers/ldap/sdap_async_private.h
@@ -81,7 +81,8 @@ int sdap_save_user(TALLOC_CTX *memctx,
struct sysdb_attrs *attrs,
const char **ldap_attrs,
bool is_initgr,
- char **_usn_value);
+ char **_usn_value,
+ time_t now);
int sdap_save_users(TALLOC_CTX *memctx,
struct sysdb_ctx *sysdb,
diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c
index adf3cf4ef..949cc0268 100644
--- a/src/providers/ldap/sdap_async_users.c
+++ b/src/providers/ldap/sdap_async_users.c
@@ -37,7 +37,8 @@ int sdap_save_user(TALLOC_CTX *memctx,
struct sysdb_attrs *attrs,
const char **ldap_attrs,
bool is_initgr,
- char **_usn_value)
+ char **_usn_value,
+ time_t now)
{
struct ldb_message_element *el;
int ret;
@@ -315,7 +316,7 @@ int sdap_save_user(TALLOC_CTX *memctx,
DEBUG(6, ("Storing info for user %s\n", name));
ret = sysdb_store_user(ctx, name, pwd, uid, gid, gecos, homedir, shell,
- user_attrs, missing, cache_timeout);
+ user_attrs, missing, cache_timeout, now);
if (ret) goto fail;
if (_usn_value) {
@@ -350,6 +351,7 @@ int sdap_save_users(TALLOC_CTX *memctx,
char *usn_value;
int ret;
int i;
+ time_t now;
if (num_users == 0) {
/* Nothing to do if there are no users */
@@ -366,12 +368,13 @@ int sdap_save_users(TALLOC_CTX *memctx,
goto done;
}
+ now = time(NULL);
for (i = 0; i < num_users; i++) {
usn_value = NULL;
ret = sdap_save_user(tmpctx, sysdb, opts, dom,
users[i], attrs, false,
- &usn_value);
+ &usn_value, now);
/* Do not fail completely on errors.
* Just report the failure to save and go on */
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 242847594..54f71426b 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -106,7 +106,8 @@ static int get_pw_name(TALLOC_CTX *mem_ctx,
pwd->pw_dir,
pwd->pw_shell,
NULL, NULL,
- ctx->entry_cache_timeout);
+ ctx->entry_cache_timeout,
+ 0);
if (ret) {
goto done;
}
@@ -221,7 +222,8 @@ static int get_pw_uid(TALLOC_CTX *mem_ctx,
pwd->pw_dir,
pwd->pw_shell,
NULL, NULL,
- ctx->entry_cache_timeout);
+ ctx->entry_cache_timeout,
+ 0);
if (ret) {
goto done;
}
@@ -361,7 +363,8 @@ again:
pwd->pw_dir,
pwd->pw_shell,
NULL, NULL,
- ctx->entry_cache_timeout);
+ ctx->entry_cache_timeout,
+ 0);
if (ret) {
/* Do not fail completely on errors.
* Just report the failure to save and go on */
@@ -519,7 +522,8 @@ again:
grp->gr_name,
grp->gr_gid,
members,
- ctx->entry_cache_timeout);
+ ctx->entry_cache_timeout,
+ 0);
if (ret) {
goto done;
}
@@ -568,7 +572,8 @@ static int get_gr_gid(TALLOC_CTX *mem_ctx,
struct proxy_id_ctx *ctx,
struct sysdb_ctx *sysdb,
struct sss_domain_info *dom,
- gid_t gid)
+ gid_t gid,
+ time_t now)
{
TALLOC_CTX *tmpctx;
struct group *grp;
@@ -670,7 +675,8 @@ again:
grp->gr_name,
grp->gr_gid,
members,
- ctx->entry_cache_timeout);
+ ctx->entry_cache_timeout,
+ now);
if (ret) {
goto done;
}
@@ -825,7 +831,8 @@ again:
grp->gr_name,
grp->gr_gid,
members,
- ctx->entry_cache_timeout);
+ ctx->entry_cache_timeout,
+ 0);
if (ret) {
/* Do not fail completely on errors.
* Just report the failure to save and go on */
@@ -937,7 +944,8 @@ static int get_initgr(TALLOC_CTX *mem_ctx,
pwd->pw_dir,
pwd->pw_shell,
NULL, NULL,
- ctx->entry_cache_timeout);
+ ctx->entry_cache_timeout,
+ 0);
if (ret) {
goto done;
}
@@ -983,6 +991,7 @@ static int get_initgr_groups_process(TALLOC_CTX *memctx,
gid_t *gids;
int ret;
int i;
+ time_t now;
num_gids = 0;
limit = 4096;
@@ -1020,8 +1029,9 @@ again:
DEBUG(4, ("User [%s] appears to be member of %lu groups\n",
pwd->pw_name, num_gids));
+ now = time(NULL);
for (i = 0; i < num_gids; i++) {
- ret = get_gr_gid(memctx, ctx, sysdb, dom, gids[i]);
+ ret = get_gr_gid(memctx, ctx, sysdb, dom, gids[i], now);
if (ret) {
return ret;
}
@@ -1107,7 +1117,7 @@ void proxy_get_account_info(struct be_req *breq)
return proxy_reply(breq, DP_ERR_FATAL,
EINVAL, "Invalid attr type");
}
- ret = get_gr_gid(breq, ctx, sysdb, domain, gid);
+ ret = get_gr_gid(breq, ctx, sysdb, domain, gid, 0);
break;
default:
return proxy_reply(breq, DP_ERR_FATAL,
diff --git a/src/providers/proxy/proxy_netgroup.c b/src/providers/proxy/proxy_netgroup.c
index 5af32ac70..bad0ee450 100644
--- a/src/providers/proxy/proxy_netgroup.c
+++ b/src/providers/proxy/proxy_netgroup.c
@@ -119,7 +119,7 @@ errno_t get_netgroup(struct proxy_id_ctx *ctx,
}
ret = sysdb_add_netgroup(sysdb, name, NULL, attrs,
- ctx->entry_cache_timeout);
+ ctx->entry_cache_timeout, 0);
if (ret != EOK) {
DEBUG(1, ("sysdb_add_netgroup failed.\n"));
goto done;
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index c27658288..9c080c9e2 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -192,7 +192,7 @@ static int test_add_user(struct test_data *data)
ret = sysdb_add_user(data->ctx->sysdb, data->username,
data->uid, 0, gecos, homedir, "/bin/bash",
- NULL, 0);
+ NULL, 0, 0);
return ret;
}
@@ -208,7 +208,7 @@ static int test_store_user(struct test_data *data)
ret = sysdb_store_user(data->ctx->sysdb, data->username, "x",
data->uid, 0, gecos, homedir,
data->shell ? data->shell : "/bin/bash",
- NULL, NULL, -1);
+ NULL, NULL, -1, 0);
return ret;
}
@@ -253,7 +253,7 @@ static int test_add_group(struct test_data *data)
int ret;
ret = sysdb_add_group(data->ctx->sysdb, data->groupname,
- data->gid, NULL, 0);
+ data->gid, NULL, 0, 0);
return ret;
}
@@ -262,7 +262,7 @@ static int test_add_incomplete_group(struct test_data *data)
int ret;
ret = sysdb_add_incomplete_group(data->ctx->sysdb, data->groupname,
- data->gid, NULL, true);
+ data->gid, NULL, true, 0);
return ret;
}
@@ -271,7 +271,7 @@ static int test_store_group(struct test_data *data)
int ret;
ret = sysdb_store_group(data->ctx->sysdb, data->groupname,
- data->gid, NULL, -1);
+ data->gid, NULL, -1, 0);
return ret;
}
@@ -420,7 +420,7 @@ static int test_memberof_store_group(struct test_data *data)
}
ret = sysdb_store_group(data->ctx->sysdb, data->groupname,
- data->gid, attrs, -1);
+ data->gid, attrs, -1, 0);
return ret;
}
@@ -474,7 +474,7 @@ static int test_set_netgroup_attr(struct test_data *data)
return ret;
}
- ret = sysdb_set_netgroup_attr(data->ctx->sysdb,
+ ret = sysdb_set_netgroup_attr(data->ctx->sysdb,
data->netgrname, attrs, SYSDB_MOD_REP);
return ret;
}
@@ -2701,7 +2701,7 @@ START_TEST(test_odd_characters)
/* Add */
ret = sysdb_add_incomplete_group(test_ctx->sysdb,
- odd_groupname, 20000, NULL, true);
+ odd_groupname, 20000, NULL, true, 0);
fail_unless(ret == EOK, "sysdb_add_incomplete_group error [%d][%s]",
ret, strerror(ret));
@@ -2784,7 +2784,7 @@ START_TEST(test_odd_characters)
/* Add */
ret = sysdb_add_netgroup(test_ctx->sysdb,
odd_netgroupname, "No description",
- NULL, 30);
+ NULL, 30, 0);
fail_unless(ret == EOK, "sysdb_add_netgroup error [%d][%s]",
ret, strerror(ret));
@@ -2861,14 +2861,14 @@ START_TEST(test_sysdb_original_dn_case_insensitive)
ret = sysdb_add_incomplete_group(test_ctx->sysdb,
"case_sensitive_group1", 29000,
"cn=case_sensitive_group1,cn=example,cn=com",
- true);
+ true, 0);
fail_unless(ret == EOK, "sysdb_add_incomplete_group error [%d][%s]",
ret, strerror(ret));
ret = sysdb_add_incomplete_group(test_ctx->sysdb,
"case_sensitive_group2", 29001,
"cn=CASE_SENSITIVE_GROUP1,cn=EXAMPLE,cn=COM",
- true);
+ true, 0);
fail_unless(ret == EOK, "sysdb_add_incomplete_group error [%d][%s]",
ret, strerror(ret));
diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c
index 49c6c58e6..717227029 100644
--- a/src/tools/sss_sync_ops.c
+++ b/src/tools/sss_sync_ops.c
@@ -472,7 +472,7 @@ int useradd(TALLOC_CTX *mem_ctx,
int ret;
ret = sysdb_add_user(sysdb, data->name, data->uid, data->gid,
- data->gecos, data->home, data->shell, NULL, 0);
+ data->gecos, data->home, data->shell, NULL, 0, 0);
if (ret) {
goto done;
}
@@ -537,7 +537,7 @@ int groupadd(TALLOC_CTX *mem_ctx,
{
int ret;
- ret = sysdb_add_group(sysdb, data->name, data->gid, NULL, 0);
+ ret = sysdb_add_group(sysdb, data->name, data->gid, NULL, 0, 0);
if (ret == EOK) {
flush_nscd_cache(mem_ctx, NSCD_DB_GROUP);
}