summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/cmscore
diff options
context:
space:
mode:
authorAbhishek Koneru <akoneru@redhat.com>2012-06-06 16:55:54 -0400
committerEndi Sukma Dewata <edewata@redhat.com>2012-06-14 17:14:19 -0500
commitc53ca291e21761f1de5417ef596afba395a7f5d1 (patch)
tree47a0cd8ecd9d36d414d9230282704e9f784d0a71 /base/common/src/com/netscape/cmscore
parent084a8cd360c7508febde06415d727d7d247b16ad (diff)
downloadpki-c53ca291e21761f1de5417ef596afba395a7f5d1.tar.gz
pki-c53ca291e21761f1de5417ef596afba395a7f5d1.tar.xz
pki-c53ca291e21761f1de5417ef596afba395a7f5d1.zip
Fixes for NULL_RETURNS Coverity Issues - Part 2
Diffstat (limited to 'base/common/src/com/netscape/cmscore')
-rw-r--r--base/common/src/com/netscape/cmscore/authentication/AuthSubsystem.java4
-rw-r--r--base/common/src/com/netscape/cmscore/authentication/PasswdUserDBAuthentication.java6
-rw-r--r--base/common/src/com/netscape/cmscore/dbs/DBSubsystem.java3
-rw-r--r--base/common/src/com/netscape/cmscore/dbs/KeyRepository.java6
-rw-r--r--base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java3
5 files changed, 19 insertions, 3 deletions
diff --git a/base/common/src/com/netscape/cmscore/authentication/AuthSubsystem.java b/base/common/src/com/netscape/cmscore/authentication/AuthSubsystem.java
index fbb589376..c5b09a7d7 100644
--- a/base/common/src/com/netscape/cmscore/authentication/AuthSubsystem.java
+++ b/base/common/src/com/netscape/cmscore/authentication/AuthSubsystem.java
@@ -458,9 +458,9 @@ public class AuthSubsystem implements IAuthSubsystem {
* <P>
*/
public void shutdown() {
- for (Enumeration<String> e = mAuthMgrInsts.keys(); e.hasMoreElements();) {
+ for (AuthManagerProxy proxy : mAuthMgrInsts.values()) {
- IAuthManager mgr = get(e.nextElement());
+ IAuthManager mgr = proxy.getAuthManager();
log(ILogger.LL_INFO, CMS.getLogMessage("CMSCORE_AUTH_INSTANCE_SHUTDOWN", mgr.getName()));
diff --git a/base/common/src/com/netscape/cmscore/authentication/PasswdUserDBAuthentication.java b/base/common/src/com/netscape/cmscore/authentication/PasswdUserDBAuthentication.java
index 5b6418c00..fa8696c1d 100644
--- a/base/common/src/com/netscape/cmscore/authentication/PasswdUserDBAuthentication.java
+++ b/base/common/src/com/netscape/cmscore/authentication/PasswdUserDBAuthentication.java
@@ -191,7 +191,11 @@ public class PasswdUserDBAuthentication implements IAuthManager {
e.printStackTrace();
// not a user in our user/group database.
log(ILogger.LL_SECURITY, CMS.getLogMessage("CMSCORE_AUTH_UID_NOT_FOUND", uid, e.toString()));
- throw new EInvalidCredentials(CMS.getUserMessage("CMS_AUTHENTICATION_INVALID_CREDENTIAL"));
+ throw new EInvalidCredentials(CMS.getUserMessage("CMS_AUTHENTICATION_INVALID_CREDENTIAL") + " " + e.getMessage());
+ }
+ if (user == null) {
+ throw new EInvalidCredentials(CMS.getUserMessage("CMS_AUTHENTICATION_INTERNAL_ERROR",
+ "Failure in User Group subsystem."));
}
authToken.set(TOKEN_USERDN, user.getUserDN());
authToken.set(TOKEN_USERID, user.getUserID());
diff --git a/base/common/src/com/netscape/cmscore/dbs/DBSubsystem.java b/base/common/src/com/netscape/cmscore/dbs/DBSubsystem.java
index 304f5aa94..c0bb627c2 100644
--- a/base/common/src/com/netscape/cmscore/dbs/DBSubsystem.java
+++ b/base/common/src/com/netscape/cmscore/dbs/DBSubsystem.java
@@ -408,6 +408,9 @@ public class DBSubsystem implements IDBSubsystem {
LDAPEntry entry = conn.read(dn);
LDAPAttribute attr = entry.getAttribute(PROP_NEXT_RANGE);
+ if (attr == null) {
+ throw new Exception("Missing Attribute" + PROP_NEXT_RANGE + "in Entry " + dn);
+ }
nextRange = (String) attr.getStringValues().nextElement();
BigInteger nextRangeNo = new BigInteger(nextRange);
diff --git a/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java b/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java
index 726746627..0fbff688a 100644
--- a/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java
+++ b/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java
@@ -251,6 +251,9 @@ public class KeyRepository extends Repository implements IKeyRepository {
*/
public IKeyRecord readKeyRecord(BigInteger serialNo)
throws EBaseException {
+ if (serialNo == null) {
+ throw new EBaseException("Invalid Serial Number.");
+ }
IDBSSession s = mDBService.createSession();
KeyRecord rec = null;
@@ -264,6 +267,9 @@ public class KeyRepository extends Repository implements IKeyRepository {
if (s != null)
s.close();
}
+ if (rec == null) {
+ throw new EBaseException("Failed to recover Key for Serial Number " + serialNo);
+ }
return rec;
}
diff --git a/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java b/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java
index 53d4fa14a..7da1cc332 100644
--- a/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java
+++ b/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java
@@ -96,6 +96,9 @@ public class ProfileSubsystem implements IProfileSubsystem {
IConfigStore subStore = config.getSubStore(id);
String classid = subStore.getString(PROP_CLASS_ID);
IPluginInfo info = registry.getPluginInfo("profile", classid);
+ if (info == null) {
+ throw new EBaseException("No plugins for type : profile with id " + classid);
+ }
String configPath = subStore.getString(PROP_CONFIG);
CMS.debug("Start Profile Creation - " + id + " " + classid + " " + info.getClassName());