From 1bec3e76c57bf4748a4eaf53aee560331d416b79 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 13 Nov 2021 17:05:11 -0800 Subject: [PATCH] GUACAMOLE-957: Clear out cached ldap-servers.yml if it is deleted. --- .../guacamole/auth/ldap/conf/ConfigurationService.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/conf/ConfigurationService.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/conf/ConfigurationService.java index 545c03b85..15bd0026c 100644 --- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/conf/ConfigurationService.java +++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/conf/ConfigurationService.java @@ -130,6 +130,15 @@ public class ConfigurationService { } + // Clear cached YAML if it no longer exists + else if (cachedConfigurations != null) { + long oldLastModified = lastModified.get(); + if (lastModified.compareAndSet(oldLastModified, 0)) { + logger.debug("Clearing cached LDAP configuration from \"{}\" (file no longer exists).", ldapServers); + cachedConfigurations = null; + } + } + // Use guacamole.properties if not using YAML if (cachedConfigurations == null) { logger.debug("Reading LDAP configuration from guacamole.properties...");