From 5cf28bc2ebfbed7e3b85edfa71aa547e9ccaa213 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Fri, 13 Feb 2009 17:25:14 +0000 Subject: [PATCH] Proactively work around bug 6276483 by removing SunPKCS11-Solaris security provider. See http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6276483 and http://hudson.gotdns.com/wiki/display/HUDSON/Solaris+Issue+6276483 git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15292 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/WebAppMain.java | 7 +++++++ .../src/main/java/hudson/slaves/SlaveComputer.java | 14 +++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/hudson/WebAppMain.java b/core/src/main/java/hudson/WebAppMain.java index 0a890cf9c4..ef377f4441 100644 --- a/core/src/main/java/hudson/WebAppMain.java +++ b/core/src/main/java/hudson/WebAppMain.java @@ -61,6 +61,7 @@ import java.net.URLClassLoader; import java.util.Locale; import java.util.logging.Level; import java.util.logging.Logger; +import java.security.Security; /** * Entry point when Hudson is used as a webapp. @@ -101,6 +102,12 @@ public final class WebAppMain implements ServletContextListener { return; } + try {// remove Sun PKCS11 provider if present. See http://hudson.gotdns.com/wiki/display/HUDSON/Solaris+Issue+6276483 + Security.removeProvider("SunPKCS11-Solaris"); + } catch (SecurityException e) { + // ignore this error. + } + installLogger(); final File home = getHomeDir(event).getAbsoluteFile(); diff --git a/core/src/main/java/hudson/slaves/SlaveComputer.java b/core/src/main/java/hudson/slaves/SlaveComputer.java index b060764da6..ed1de7439c 100644 --- a/core/src/main/java/hudson/slaves/SlaveComputer.java +++ b/core/src/main/java/hudson/slaves/SlaveComputer.java @@ -52,8 +52,8 @@ import java.util.List; import java.util.Collections; import java.util.ArrayList; import java.nio.charset.Charset; -import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.Future; +import java.security.Security; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; @@ -297,7 +297,7 @@ public class SlaveComputer extends Computer { copyJar(log, dst, PluginManagerInterceptor.class, "maven-interceptor"); } - channel.call(new LogInstaller()); + channel.call(new SlaveInitializer()); channel.call(new WindowsSlaveInstaller(remoteFs)); // update the data structure atomically to prevent others from seeing a channel that's not properly initialized yet @@ -491,12 +491,20 @@ public class SlaveComputer extends Computer { */ private static final RingBufferLogHandler SLAVE_LOG_HANDLER = new RingBufferLogHandler(); - private static class LogInstaller implements Callable { + private static class SlaveInitializer implements Callable { public Void call() { // avoid double installation of the handler Logger logger = Logger.getLogger("hudson"); logger.removeHandler(SLAVE_LOG_HANDLER); logger.addHandler(SLAVE_LOG_HANDLER); + + // remove Sun PKCS11 provider if present. See http://hudson.gotdns.com/wiki/display/HUDSON/Solaris+Issue+6276483 + try { + Security.removeProvider("SunPKCS11-Solaris"); + } catch (SecurityException e) { + // ignore this error. + } + return null; } private static final long serialVersionUID = 1L;