diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-15 12:35:58 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-15 20:16:04 +0100 |
commit | 2bb2eadf2b1b7854f430e37689b3e7a25bedfebd (patch) | |
tree | 9191e7e9593208aeb4fde154cc26b220c5bf46e4 | |
parent | 543676afec3c08fdc0a5a794976adc8dfdca974b (diff) | |
download | sssd-2bb2eadf2b1b7854f430e37689b3e7a25bedfebd.tar.gz sssd-2bb2eadf2b1b7854f430e37689b3e7a25bedfebd.tar.bz2 sssd-2bb2eadf2b1b7854f430e37689b3e7a25bedfebd.zip |
TOOLS: Provide a convenience function to refresh a list of groups
-rw-r--r-- | src/tools/tools_mc_util.c | 21 | ||||
-rw-r--r-- | src/tools/tools_util.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/tools/tools_mc_util.c b/src/tools/tools_mc_util.c index a33dfb97..45b145d2 100644 --- a/src/tools/tools_mc_util.c +++ b/src/tools/tools_mc_util.c @@ -240,3 +240,24 @@ errno_t sss_mc_refresh_group(const char *groupname) { return sss_mc_refresh_ent(groupname, SSS_TOOLS_GROUP); } + +errno_t sss_mc_refresh_grouplist(char **groupnames) +{ + int i; + errno_t ret; + bool failed = false; + + if (!groupnames) return EOK; + + for (i = 0; groupnames[i]; i++) { + ret = sss_mc_refresh_group(groupnames[i]); + if (ret != EOK) { + DEBUG(SSSDBG_MINOR_FAILURE, + ("Cannot refresh group %s from memory cache\n")); + failed = true; + continue; + } + } + + return failed ? EIO : EOK; +} diff --git a/src/tools/tools_util.h b/src/tools/tools_util.h index 0ca52efd..3554a182 100644 --- a/src/tools/tools_util.h +++ b/src/tools/tools_util.h @@ -111,6 +111,7 @@ errno_t sss_memcache_clear_all(void); errno_t sss_mc_refresh_user(const char *username); errno_t sss_mc_refresh_group(const char *groupname); +errno_t sss_mc_refresh_grouplist(char **groupnames); /* from files.c */ int remove_tree(const char *root); |