From 10bfd01ca80d7df4f3988782ac9a08fc621d5cd1 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Dec 18 2012 16:29:59 +0000 Subject: AUTOFS: Clear enum cache if a request comes in from the sss_cache In order for sss_cache to work correctly, we must also signal the autofs responder to invalidate the hash table requests. --- diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index 19de768..8612524 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -761,6 +761,10 @@ static int service_signal_clear_memcache(struct mt_svc *svc) { return service_signal(svc, MON_CLI_METHOD_CLEAR_MEMCACHE); } +static int service_signal_clear_enum_cache(struct mt_svc *svc) +{ + return service_signal(svc, MON_CLI_METHOD_CLEAR_ENUM_CACHE); +} static int check_domain_ranges(struct sss_domain_info *domains) { @@ -1346,6 +1350,10 @@ static void monitor_hup(struct tevent_context *ev, if (!strcmp(NSS_SBUS_SERVICE_NAME, cur_svc->name)) { service_signal_clear_memcache(cur_svc); } + + if (!strcmp(SSS_AUTOFS_SBUS_SERVICE_NAME, cur_svc->name)) { + service_signal_clear_enum_cache(cur_svc); + } } } diff --git a/src/monitor/monitor_interfaces.h b/src/monitor/monitor_interfaces.h index abe9050..f27c7d0 100644 --- a/src/monitor/monitor_interfaces.h +++ b/src/monitor/monitor_interfaces.h @@ -46,6 +46,7 @@ #define MON_CLI_METHOD_RESET_OFFLINE "resetOffline" /* Applicable only to providers */ #define MON_CLI_METHOD_ROTATE "rotateLogs" #define MON_CLI_METHOD_CLEAR_MEMCACHE "clearMemcache" +#define MON_CLI_METHOD_CLEAR_ENUM_CACHE "clearEnumCache" #define SSSD_SERVICE_PIPE "private/sbus-monitor" diff --git a/src/responder/autofs/autofssrv.c b/src/responder/autofs/autofssrv.c index 0558969..228a8ed 100644 --- a/src/responder/autofs/autofssrv.c +++ b/src/responder/autofs/autofssrv.c @@ -29,10 +29,14 @@ #include "providers/data_provider.h" #include "responder/autofs/autofs_private.h" +static int autofs_clean_hash_table(DBusMessage *message, + struct sbus_connection *conn); + struct sbus_method monitor_autofs_methods[] = { { MON_CLI_METHOD_PING, monitor_common_pong }, { MON_CLI_METHOD_RES_INIT, monitor_common_res_init }, { MON_CLI_METHOD_ROTATE, responder_logrotate }, + { MON_CLI_METHOD_CLEAR_ENUM_CACHE, autofs_clean_hash_table }, { NULL, NULL } }; @@ -101,6 +105,24 @@ autofs_dp_reconnect_init(struct sbus_connection *conn, be_conn->domain->name)); } +static int autofs_clean_hash_table(DBusMessage *message, + struct sbus_connection *conn) +{ + struct resp_ctx *rctx = talloc_get_type(sbus_conn_get_private_data(conn), + struct resp_ctx); + struct autofs_ctx *actx = + talloc_get_type(rctx->pvt_ctx, struct autofs_ctx); + errno_t ret; + + ret = autofs_orphan_maps(actx); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, ("Could not invalidate maps\n")); + return ret; + } + + return monitor_common_pong(message, conn); +} + static int autofs_process_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev,