From 53aefebdca2ec9151aff87ae21ee4203eaa9a03a Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 15 Jan 2013 11:40:19 +0100 Subject: TOOLS: Split querying nss responder into a separate function The tools query the responder in order to sync the memcache after performing changes to the local database. The functions will be reused by other tools so I split them into a separate functions. --- src/tools/sss_groupdel.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/tools/sss_groupdel.c') diff --git a/src/tools/sss_groupdel.c b/src/tools/sss_groupdel.c index 5ab85fc89..a8db03632 100644 --- a/src/tools/sss_groupdel.c +++ b/src/tools/sss_groupdel.c @@ -29,7 +29,6 @@ #include "util/util.h" #include "tools/tools_util.h" #include "tools/sss_sync_ops.h" -#include "sss_client/sss_cli.h" int main(int argc, const char **argv) { @@ -37,10 +36,6 @@ int main(int argc, const char **argv) int pc_debug = SSSDBG_DEFAULT; const char *pc_groupname = NULL; struct tools_ctx *tctx = NULL; - struct sss_cli_req_data rd; - uint8_t *repbuf = NULL; - size_t replen; - enum nss_status nret; poptContext pc = NULL; struct poptOption long_options[] = { @@ -116,17 +111,12 @@ int main(int argc, const char **argv) goto done; } - rd.data = pc_groupname; - rd.len = strlen(pc_groupname) + 1; - - sss_nss_lock(); - nret = sss_nss_make_request(SSS_NSS_GETGRNAM, &rd, - &repbuf, &replen, &ret); - sss_nss_unlock(); - free(repbuf); - if (nret != NSS_STATUS_SUCCESS && nret != NSS_STATUS_NOTFOUND) { - ERROR("NSS request failed (%1$d). Entry might remain in memory" - " cache.\n",nret); + /* Delete group from memory cache */ + ret = sss_mc_refresh_group(pc_groupname); + if (ret != EOK) { + ERROR("NSS request failed (%1$d). Entry might remain in memory " + "cache.\n", ret); + /* Nothing we can do about it */ } ret = EOK; -- cgit