You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by lm...@apache.org on 2017/12/06 16:29:32 UTC
knox git commit: KNOX-1132 - Address Coverity Defects in
gateway-service-remoteconfig (Phil Zampino via lmccay)
Repository: knox
Updated Branches:
refs/heads/master 19362b9dd -> bfb556c91
KNOX-1132 - Address Coverity Defects in gateway-service-remoteconfig (Phil Zampino via lmccay)
Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/bfb556c9
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/bfb556c9
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/bfb556c9
Branch: refs/heads/master
Commit: bfb556c91c8722d42db1895a2a2e71fa7466baea
Parents: 19362b9
Author: Larry McCay <lm...@hortonworks.com>
Authored: Wed Dec 6 11:29:09 2017 -0500
Committer: Larry McCay <lm...@hortonworks.com>
Committed: Wed Dec 6 11:29:28 2017 -0500
----------------------------------------------------------------------
.../config/remote/zk/CuratorClientService.java | 7 +++---
.../RemoteConfigurationRegistryJAASConfig.java | 24 ++++++++++++++------
2 files changed, 21 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/knox/blob/bfb556c9/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/zk/CuratorClientService.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/zk/CuratorClientService.java b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/zk/CuratorClientService.java
index 0000f48..f9b5ab3 100644
--- a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/zk/CuratorClientService.java
+++ b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/zk/CuratorClientService.java
@@ -366,9 +366,10 @@ class CuratorClientService implements ZooKeeperClientService {
throws Exception {
ChildData childData = pathChildrenCacheEvent.getData();
if (childData != null) {
- delegate.childEvent(client,
- adaptType(pathChildrenCacheEvent.getType()),
- childData.getPath());
+ ChildEntryListener.Type eventType = adaptType(pathChildrenCacheEvent.getType());
+ if (eventType != null) {
+ delegate.childEvent(client, eventType, childData.getPath());
+ }
}
}
http://git-wip-us.apache.org/repos/asf/knox/blob/bfb556c9/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/zk/RemoteConfigurationRegistryJAASConfig.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/zk/RemoteConfigurationRegistryJAASConfig.java b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/zk/RemoteConfigurationRegistryJAASConfig.java
index d51d7d5..0b5a693 100644
--- a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/zk/RemoteConfigurationRegistryJAASConfig.java
+++ b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/zk/RemoteConfigurationRegistryJAASConfig.java
@@ -36,6 +36,7 @@ class RemoteConfigurationRegistryJAASConfig extends Configuration {
// Underlying SASL mechanisms supported
enum SASLMechanism {
+ Unsupported,
Kerberos,
Digest
}
@@ -92,9 +93,16 @@ class RemoteConfigurationRegistryJAASConfig extends Configuration {
}
private AppConfigurationEntry[] createEntries(RemoteConfigurationRegistryConfig config) {
- // Only supporting a single app config entry per configuration/context
- AppConfigurationEntry[] result = new AppConfigurationEntry[1];
- result[0] = createEntry(config);
+ AppConfigurationEntry[] result = null;
+
+ AppConfigurationEntry entry = createEntry(config);
+ if (entry != null) {
+ // Only supporting a single app config entry per configuration/context
+ result = new AppConfigurationEntry[1];
+ result[0] = createEntry(config);
+ } else {
+ result = new AppConfigurationEntry[0];
+ }
return result;
}
@@ -130,9 +138,11 @@ class RemoteConfigurationRegistryJAASConfig extends Configuration {
opts.put("principal", config.getPrincipal());
}
- entry = new AppConfigurationEntry(getLoginModuleName(config.getRegistryType(), saslMechanism),
- AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
- opts);
+ if (!opts.isEmpty()) {
+ entry = new AppConfigurationEntry(getLoginModuleName(config.getRegistryType(), saslMechanism),
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
+ opts);
+ }
return entry;
}
@@ -155,7 +165,7 @@ class RemoteConfigurationRegistryJAASConfig extends Configuration {
}
private static SASLMechanism getSASLMechanism(String authType) {
- SASLMechanism result = null;
+ SASLMechanism result = SASLMechanism.Unsupported;
for (SASLMechanism at : SASLMechanism.values()) {
if (at.name().equalsIgnoreCase(authType)) {
result = at;