You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by ka...@apache.org on 2016/08/31 08:05:25 UTC
[3/5] storm git commit: STORM-2064: refactor/clean up
STORM-2064: refactor/clean up
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/b5c6b6ae
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/b5c6b6ae
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/b5c6b6ae
Branch: refs/heads/1.x-branch
Commit: b5c6b6ae15eb3df2f9a3bf547eb470b3d16b90ba
Parents: 3e96924
Author: Alessandro Bellina <ab...@yahoo-inc.com>
Authored: Mon Aug 29 11:48:20 2016 -0500
Committer: Alessandro Bellina <ab...@yahoo-inc.com>
Committed: Mon Aug 29 11:48:20 2016 -0500
----------------------------------------------------------------------
.../src/clj/org/apache/storm/daemon/drpc.clj | 2 +-
storm-core/src/clj/org/apache/storm/util.clj | 32 +++++++++++++-------
2 files changed, 22 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/b5c6b6ae/storm-core/src/clj/org/apache/storm/daemon/drpc.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/org/apache/storm/daemon/drpc.clj b/storm-core/src/clj/org/apache/storm/daemon/drpc.clj
index 107ff30..5284454 100644
--- a/storm-core/src/clj/org/apache/storm/daemon/drpc.clj
+++ b/storm-core/src/clj/org/apache/storm/daemon/drpc.clj
@@ -57,7 +57,7 @@
(defn check-authorization
([aclHandler mapping operation context function]
(if (not-nil? context)
- (log-thrift-access (.requestID context) (.remoteAddress context) (.principal context) operation nil function))
+ (log-thrift-access-function (.requestID context) (.remoteAddress context) (.principal context) operation function))
(if aclHandler
(let [context (or context (ReqContext/context))]
(if-not (.permit aclHandler context operation mapping)
http://git-wip-us.apache.org/repos/asf/storm/blob/b5c6b6ae/storm-core/src/clj/org/apache/storm/util.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/org/apache/storm/util.clj b/storm-core/src/clj/org/apache/storm/util.clj
index ab7670f..221a65f 100644
--- a/storm-core/src/clj/org/apache/storm/util.clj
+++ b/storm-core/src/clj/org/apache/storm/util.clj
@@ -1096,20 +1096,30 @@
(assoc coll k (apply str (repeat (count (coll k)) "#")))
coll))
+(defn- log-thrift-access-base
+ [request-id remoteAddress principal operation]
+ (str "Request ID: " request-id
+ " access from: " remoteAddress
+ " principal: " principal
+ " operation: " operation))
+
(defn log-thrift-access
- [request-id remoteAddress principal operation storm-name arg]
+ [request-id remoteAddress principal operation storm-name access-result]
+ (doto
+ (ThriftAccessLogger.)
+ (.log (str (log-thrift-access-base request-id remoteAddress principal operation)
+ (if storm-name
+ (str " storm-name: " storm-name) "")
+ (if access-result
+ (str " access result: " access-result) "")))))
+
+(defn log-thrift-access-function
+ [request-id remoteAddress principal operation function]
(doto
(ThriftAccessLogger.)
- (.log (str "Request ID: " request-id
- " access from: " remoteAddress
- " principal: " principal
- " operation: " operation
- (if storm-name
- (str " storm-name: " storm-name) "")
- (if (and (not-nil? arg)
- (.startsWith arg "access"))
- (str " access result: " arg)
- (str " function: " arg))))))
+ (.log (str (log-thrift-access-base request-id remoteAddress principal operation)
+ (if function
+ (str " function: " function) "")))))
(def DISALLOWED-KEY-NAME-STRS #{"/" "." ":" "\\"})