summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-01-15 12:35:58 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 20:16:04 +0100
commit2bb2eadf2b1b7854f430e37689b3e7a25bedfebd (patch)
tree9191e7e9593208aeb4fde154cc26b220c5bf46e4 /src/tools
parent543676afec3c08fdc0a5a794976adc8dfdca974b (diff)
downloadsssd-2bb2eadf2b1b7854f430e37689b3e7a25bedfebd.tar.gz
sssd-2bb2eadf2b1b7854f430e37689b3e7a25bedfebd.tar.xz
sssd-2bb2eadf2b1b7854f430e37689b3e7a25bedfebd.zip
TOOLS: Provide a convenience function to refresh a list of groups
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/tools_mc_util.c21
-rw-r--r--src/tools/tools_util.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/src/tools/tools_mc_util.c b/src/tools/tools_mc_util.c
index a33dfb97c..45b145d21 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 0ca52efdf..3554a182d 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);