summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-12-15 13:20:30 +0100
committerJakub Hrozek <jhrozek@redhat.com>2012-12-18 17:25:34 +0100
commit06cb67c391dd8c2b1542a7d87fb5568fdad448cb (patch)
tree2364cf07bc30ccc374732c813b098ed74bd44209
parentba153306e0e551731a3ee2c31c26cd1d63052ff8 (diff)
downloadsssd-06cb67c391dd8c2b1542a7d87fb5568fdad448cb.tar.gz
sssd-06cb67c391dd8c2b1542a7d87fb5568fdad448cb.tar.bz2
sssd-06cb67c391dd8c2b1542a7d87fb5568fdad448cb.zip
DP: invalidate all cached maps if a request for auto.master comes in
If the Data Provider receives a request for the auto.master map, it passes on a flag to let the actual provider let know he should invalidate the existing maps
-rw-r--r--src/providers/data_provider_be.c7
-rw-r--r--src/providers/dp_backend.h1
-rw-r--r--src/providers/ldap/sdap_autofs.c8
3 files changed, 16 insertions, 0 deletions
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
index da319ffa..5208b48c 100644
--- a/src/providers/data_provider_be.c
+++ b/src/providers/data_provider_be.c
@@ -1491,6 +1491,13 @@ static int be_autofs_handler(DBusMessage *message, struct sbus_connection *conn)
goto done;
}
+ /* If a request for auto.master comes in, the automounter deamon
+ * has been reloaded. Expire all autofs maps to force reload
+ */
+ if (strcmp(be_autofs_req->mapname, "auto.master") == 0) {
+ be_autofs_req->invalidate = true;
+ }
+
be_req->req_data = be_autofs_req;
if (!be_cli->bectx->bet_info[BET_AUTOFS].bet_ops) {
diff --git a/src/providers/dp_backend.h b/src/providers/dp_backend.h
index 357d5891..58a9b749 100644
--- a/src/providers/dp_backend.h
+++ b/src/providers/dp_backend.h
@@ -169,6 +169,7 @@ struct be_sudo_req {
struct be_autofs_req {
char *mapname;
+ bool invalidate;
};
struct be_subdom_req {
diff --git a/src/providers/ldap/sdap_autofs.c b/src/providers/ldap/sdap_autofs.c
index 5e3e3320..7e6f3ecf 100644
--- a/src/providers/ldap/sdap_autofs.c
+++ b/src/providers/ldap/sdap_autofs.c
@@ -97,6 +97,14 @@ void sdap_autofs_handler(struct be_req *be_req)
DEBUG(SSSDBG_FUNC_DATA, ("Requested refresh for: %s\n",
autofs_req->mapname ? autofs_req->mapname : "<ALL>\n"));
+ if (autofs_req->invalidate) {
+ ret = sysdb_invalidate_autofs_maps(id_ctx->be->sysdb);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_MINOR_FAILURE, ("Could not invalidate autofs maps, "
+ "backend might return stale entries\n"));
+ }
+ }
+
req = sdap_autofs_get_map_send(be_req, be_req->be_ctx->ev,
id_ctx, autofs_req->mapname);
if (!req) {