summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorAbhishek Koneru <akoneru@redhat.com>2012-06-27 14:27:55 -0400
committerEndi Sukma Dewata <edewata@redhat.com>2012-07-02 12:43:57 -0500
commit10502e34a10fb3b672aef1161cc271003c7806ba (patch)
tree4c3c5e8fc8c99759953b52518f78e8ba3100aa17 /base
parentd2b06ee1f9fcc42be83f04f64559cfa6317bda67 (diff)
downloadpki-10502e34a10fb3b672aef1161cc271003c7806ba.tar.gz
pki-10502e34a10fb3b672aef1161cc271003c7806ba.tar.xz
pki-10502e34a10fb3b672aef1161cc271003c7806ba.zip
Fixes for Guarded_By_Violation issues shown in Coverity
Diffstat (limited to 'base')
-rw-r--r--base/ca/src/com/netscape/ca/CRLIssuingPoint.java9
-rw-r--r--base/common/src/com/netscape/certsrv/request/ARequestNotifier.java4
-rw-r--r--base/common/src/com/netscape/cmscore/authentication/VerifiedCerts.java4
-rw-r--r--base/common/src/com/netscape/cmscore/cert/CrossCertPairSubsystem.java6
-rw-r--r--base/common/src/com/netscape/cmscore/cert/OidLoaderSubsystem.java2
-rw-r--r--base/common/src/com/netscape/cmscore/cert/X500NameSubsystem.java2
-rw-r--r--base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java8
-rw-r--r--base/common/src/com/netscape/cmscore/dbs/DBVirtualList.java6
-rw-r--r--base/common/src/com/netscape/cmscore/dbs/KeyRepository.java5
-rw-r--r--base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java2
-rw-r--r--base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java2
-rw-r--r--base/common/src/com/netscape/cmscore/util/ProfileSubsystem.java4
-rw-r--r--base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java2
-rw-r--r--base/silent/src/com/netscape/pkisilent/common/ComCrypto.java4
-rw-r--r--base/util/src/netscape/security/acl/AclImpl.java8
-rw-r--r--base/util/src/netscape/security/provider/MD5.java4
16 files changed, 42 insertions, 30 deletions
diff --git a/base/ca/src/com/netscape/ca/CRLIssuingPoint.java b/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
index 46891fd6b..c29bc326d 100644
--- a/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
+++ b/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
@@ -1297,7 +1297,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable {
return mSigningAlgorithm;
}
- public String getLastSigningAlgorithm() {
+ public synchronized String getLastSigningAlgorithm() {
return mLastSigningAlgorithm;
}
@@ -1773,7 +1773,6 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable {
}
}
} catch (EBaseException e1) {
- // TODO Auto-generated catch block
e1.printStackTrace();
}
mUpdateThread = null;
@@ -2307,7 +2306,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable {
return revocationDate;
}
- public Vector<Long> getSplitTimes() {
+ public synchronized Vector<Long> getSplitTimes() {
Vector<Long> splits = new Vector<Long>();
for (int i = 0; i < mSplits.length; i++) {
@@ -2316,7 +2315,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable {
return splits;
}
- public int isCRLUpdateInProgress() {
+ public synchronized int isCRLUpdateInProgress() {
return mUpdatingCRL;
}
@@ -2884,7 +2883,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable {
}
}
- protected void log(int level, String msg) {
+ protected synchronized void log(int level, String msg) {
mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_CA, level,
"CRLIssuingPoint " + mId + " - " + msg);
}
diff --git a/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java b/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java
index f8f7588a7..4a6e3260b 100644
--- a/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java
+++ b/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java
@@ -459,7 +459,9 @@ public class ARequestNotifier implements IRequestNotifier {
CMS.debug("recoverPublishingQueue extended buffer to " + mRequests.size() + "(" + mMaxRequests + ")" +
" requests by adding request " + id);
if (morePublishingThreads()) {
- mSearchForRequests = true;
+ synchronized (this) {
+ mSearchForRequests = true;
+ }
try {
Thread notifierThread = new Thread(new RunListeners(this));
if (notifierThread != null) {
diff --git a/base/common/src/com/netscape/cmscore/authentication/VerifiedCerts.java b/base/common/src/com/netscape/cmscore/authentication/VerifiedCerts.java
index 01c455464..ccefe5b21 100644
--- a/base/common/src/com/netscape/cmscore/authentication/VerifiedCerts.java
+++ b/base/common/src/com/netscape/cmscore/authentication/VerifiedCerts.java
@@ -53,7 +53,7 @@ public class VerifiedCerts {
mUnknownStateInterval = unknownStateInterval;
}
- public void update(X509CertImpl cert, int status) {
+ public synchronized void update(X509CertImpl cert, int status) {
if (cert != null) {
byte[] certEncoded = null;
@@ -90,7 +90,7 @@ public class VerifiedCerts {
}
}
- public int check(X509CertImpl cert) {
+ public synchronized int check(X509CertImpl cert) {
int status = VerifiedCert.UNKNOWN;
if (mLast != mNext && mInterval > 0) { // if not empty and
diff --git a/base/common/src/com/netscape/cmscore/cert/CrossCertPairSubsystem.java b/base/common/src/com/netscape/cmscore/cert/CrossCertPairSubsystem.java
index dd7918bd5..4db850d2e 100644
--- a/base/common/src/com/netscape/cmscore/cert/CrossCertPairSubsystem.java
+++ b/base/common/src/com/netscape/cmscore/cert/CrossCertPairSubsystem.java
@@ -101,8 +101,10 @@ public class CrossCertPairSubsystem implements ICrossCertPairSubsystem {
try {
mConfig = config;
mLogger = CMS.getLogger();
- mCa = (ICertificateAuthority) CMS.getSubsystem("ca");
- mPublisherProcessor = mCa.getPublisherProcessor();
+ synchronized (this) {
+ mCa = (ICertificateAuthority) CMS.getSubsystem("ca");
+ mPublisherProcessor = mCa.getPublisherProcessor();
+ }
// initialize LDAP connection factory
IConfigStore ldapConfig = mConfig.getSubStore(PROP_LDAP);
diff --git a/base/common/src/com/netscape/cmscore/cert/OidLoaderSubsystem.java b/base/common/src/com/netscape/cmscore/cert/OidLoaderSubsystem.java
index 0feebb7ec..95bbd98e7 100644
--- a/base/common/src/com/netscape/cmscore/cert/OidLoaderSubsystem.java
+++ b/base/common/src/com/netscape/cmscore/cert/OidLoaderSubsystem.java
@@ -182,7 +182,7 @@ public class OidLoaderSubsystem implements ISubsystem {
*
* @return configuration store of this subsystem
*/
- public IConfigStore getConfigStore() {
+ public synchronized IConfigStore getConfigStore() {
return mConfig;
}
diff --git a/base/common/src/com/netscape/cmscore/cert/X500NameSubsystem.java b/base/common/src/com/netscape/cmscore/cert/X500NameSubsystem.java
index 96dc64e57..7accf2b4f 100644
--- a/base/common/src/com/netscape/cmscore/cert/X500NameSubsystem.java
+++ b/base/common/src/com/netscape/cmscore/cert/X500NameSubsystem.java
@@ -277,7 +277,7 @@ public class X500NameSubsystem implements ISubsystem {
protected ILogger mLogger = null;
- protected void log(int level, String msg) {
+ protected synchronized void log(int level, String msg) {
mLogger.log(ILogger.EV_SYSTEM,
ILogger.S_ADMIN, level, msg);
}
diff --git a/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java b/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java
index 0872d1f40..14e06aeb3 100644
--- a/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java
+++ b/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java
@@ -226,11 +226,13 @@ public class CertificateRepository extends Repository
* 0 - disable
* >0 - enable
*/
- public void setCertStatusUpdateInterval(IRepository requestRepository, int interval, boolean listenToCloneModifications) {
+ public void setCertStatusUpdateInterval(IRepository requestRepository, int interval,
+ boolean listenToCloneModifications) {
CMS.debug("In setCertStatusUpdateInterval " + interval);
-
- this.requestRepository = requestRepository;
+ synchronized (this) {
+ this.requestRepository = requestRepository;
+ }
// stop running tasks
if (certStatusUpdateTask != null) {
diff --git a/base/common/src/com/netscape/cmscore/dbs/DBVirtualList.java b/base/common/src/com/netscape/cmscore/dbs/DBVirtualList.java
index 854a92e15..51a9230ac 100644
--- a/base/common/src/com/netscape/cmscore/dbs/DBVirtualList.java
+++ b/base/common/src/com/netscape/cmscore/dbs/DBVirtualList.java
@@ -308,9 +308,11 @@ public class DBVirtualList<E> implements IDBVirtualList<E> {
if (sortKeys == null)
throw new EBaseException("sort keys cannot be null");
try {
-
mKeys = new LDAPSortKey[sortKeys.length];
- String la[] = mRegistry.getLDAPAttributes(sortKeys);
+ String la[] = null;
+ synchronized (this) {
+ la = mRegistry.getLDAPAttributes(sortKeys);
+ }
for (int j = 0; j < sortKeys.length; j++) {
mKeys[j] = new LDAPSortKey(la[j]);
diff --git a/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java b/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java
index 0fbff688a..fb3b9b24a 100644
--- a/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java
+++ b/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java
@@ -154,8 +154,9 @@ public class KeyRepository extends Repository implements IKeyRepository {
public void setKeyStatusUpdateInterval(IRepository requestRepo, int interval) {
CMS.debug("In setKeyStatusUpdateInterval " + interval);
-
- this.requestRepository = requestRepo;
+ synchronized (this) {
+ this.requestRepository = requestRepo;
+ }
// stop running task
if (mKeyStatusUpdateTask != null) {
diff --git a/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java b/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java
index c3e84f136..5be645b56 100644
--- a/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java
+++ b/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java
@@ -82,7 +82,7 @@ public class LdapBoundConnFactory implements ILdapBoundConnFactory {
return mTotal;
}
- public int freeConn() {
+ public synchronized int freeConn() {
return mNumConns;
}
diff --git a/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java b/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java
index d717d9732..7b3eac274 100644
--- a/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java
+++ b/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java
@@ -129,7 +129,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor {
*
* @return configuration store
*/
- public IConfigStore getConfigStore() {
+ public synchronized IConfigStore getConfigStore() {
return mConfig;
}
diff --git a/base/common/src/com/netscape/cmscore/util/ProfileSubsystem.java b/base/common/src/com/netscape/cmscore/util/ProfileSubsystem.java
index 5822542a3..40499577e 100644
--- a/base/common/src/com/netscape/cmscore/util/ProfileSubsystem.java
+++ b/base/common/src/com/netscape/cmscore/util/ProfileSubsystem.java
@@ -144,7 +144,7 @@ public class ProfileSubsystem extends Frame implements ISubsystem, Runnable {
return null;
}
- public void updateGeneralPanel() {
+ public synchronized void updateGeneralPanel() {
Runtime.getRuntime().gc();
String text =
"JDK VM Information " + "\n" +
@@ -161,7 +161,7 @@ public class ProfileSubsystem extends Frame implements ISubsystem, Runnable {
mTextArea.setText(text);
}
- public void updateThreadPanel() {
+ public synchronized void updateThreadPanel() {
Thread currentThread = Thread.currentThread();
Vector<Vector<String>> data = new Vector<Vector<String>>();
Thread threads[] = new Thread[100];
diff --git a/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java b/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java
index 2d53552a0..36f698fcf 100644
--- a/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java
+++ b/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java
@@ -194,7 +194,7 @@ public class TokenKeyRecoveryService implements IService {
* @return operation success or not
* @exception EBaseException failed to serve
*/
- public boolean serviceRequest(IRequest request) throws EBaseException {
+ public synchronized boolean serviceRequest(IRequest request) throws EBaseException {
String auditMessage = null;
String auditSubjectID = null;
String auditRecoveryID = ILogger.UNIDENTIFIED;
diff --git a/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java b/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java
index 48b364349..7abe775a3 100644
--- a/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java
+++ b/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java
@@ -141,7 +141,7 @@ public class ComCrypto {
certpackage = cd;
}
- public void setGenerateRequest(boolean c) {
+ public synchronized void setGenerateRequest(boolean c) {
generaterequest = c;
}
@@ -167,7 +167,7 @@ public class ComCrypto {
dualkey = dkey;
}
- public String getPkcs10Request() {
+ public synchronized String getPkcs10Request() {
return pkcs10request;
}
diff --git a/base/util/src/netscape/security/acl/AclImpl.java b/base/util/src/netscape/security/acl/AclImpl.java
index 884304301..9ccb0fc1f 100644
--- a/base/util/src/netscape/security/acl/AclImpl.java
+++ b/base/util/src/netscape/security/acl/AclImpl.java
@@ -370,9 +370,11 @@ final class AclEnumerator implements Enumeration<AclEntry> {
}
public boolean hasMoreElements() {
- return (u1.hasMoreElements() ||
- u2.hasMoreElements() ||
- g1.hasMoreElements() || g2.hasMoreElements());
+ synchronized (acl) {
+ return (u1.hasMoreElements() ||
+ u2.hasMoreElements() ||
+ g1.hasMoreElements() || g2.hasMoreElements());
+ }
}
public AclEntry nextElement() {
diff --git a/base/util/src/netscape/security/provider/MD5.java b/base/util/src/netscape/security/provider/MD5.java
index e64873942..85f9da12d 100644
--- a/base/util/src/netscape/security/provider/MD5.java
+++ b/base/util/src/netscape/security/provider/MD5.java
@@ -230,7 +230,9 @@ public final class MD5 extends MessageDigestSpi implements Cloneable {
public void init() {
state = new int[4];
transformBuffer = new int[16];
- buffer = new byte[64];
+ synchronized (this) {
+ buffer = new byte[64];
+ }
digestBits = new byte[16];
count = 0;
// Load magic initialization constants.