diff options
author | jdennis <jdennis@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2010-09-10 13:20:48 +0000 |
---|---|---|
committer | jdennis <jdennis@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2010-09-10 13:20:48 +0000 |
commit | cf90cc33edee40478d97f369dc9e6ef62c8a26ea (patch) | |
tree | 0b45b037cf72332cb8900d64fa5a24e35988d69a /pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java | |
parent | 32b1e7d836c5128c53023d22977adb916a1ee4b5 (diff) | |
download | pki-cf90cc33edee40478d97f369dc9e6ef62c8a26ea.tar.gz pki-cf90cc33edee40478d97f369dc9e6ef62c8a26ea.tar.xz pki-cf90cc33edee40478d97f369dc9e6ef62c8a26ea.zip |
Related: bug #632425
fix password & CryptoManger initialization
These are a couple of simple issues which I discovered during the tomcat
porting. Since they are mostly independent of the tomcat changes I'd like to
keep them separate and get them in first.
The changes are:
1) Make CMSEngine.getPasswordStore() a synchronized method.
During testing I had discovered two threads were both calling this
method at essentially the same time trashing the state which lead to
password failures.
2) Remove redundant duplicated code for initializing the password store,
now CMSEngine.getPasswordStore() is the sole owner of the logic to
perform this action.
3) Initialize CryptoManager before first use. We had been relying on a
side effect in tomcat 5 for CryptoManager initialization where tomcatjss
was doing the CryptoManager initialization prior to our first use of the
CryptoManager. Tomcat 6 has modified when the connection objects first
get created (which was what was kicking off the CryptoManager
initialization). The patch adds the same code for initializing the
CryptoManger as is in tomcatjss. We now check for CryptoManager
initialization *prior* to our first use of it and if and only if it
hasn't been initialized yet we do so.
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@1279 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java')
-rw-r--r-- | pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java b/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java index 10c2fca5c..1debdb8db 100644 --- a/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java +++ b/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java @@ -213,7 +213,7 @@ public class CMSEngine implements ICMSEngine { return instanceDir; } - public IPasswordStore getPasswordStore() { + public synchronized IPasswordStore getPasswordStore() { // initialize the PasswordReader and PasswordWriter try { String pwdPath = mConfig.getString("passwordFile"); @@ -275,20 +275,6 @@ public class CMSEngine implements ICMSEngine { mSDTimer.schedule(timertask, 5, (new Long(secdomain_check_interval)).longValue()); } - // initialize the PasswordReader and PasswordWriter - String pwdPath = config.getString("passwordFile"); - String pwdClass = config.getString("passwordClass"); - - if (pwdClass != null) { - try { - mPasswordStore = (IPasswordStore)Class.forName(pwdClass).newInstance(); - mPasswordStore.init(pwdPath); - CMS.debug("CMSEngine: init(): password store initialized for "+ - pwdClass); - } catch (Exception e) { - } - } - String tsClass = config.getString("timeSourceClass", null); if (tsClass != null) { |