This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch libhdfs3
in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git


The following commit(s) were added to refs/heads/libhdfs3 by this push:
     new 9bc4aa0  [fix] skip unsupported auth method (#38)
9bc4aa0 is described below

commit 9bc4aa0fc7c48236f40e0986d95c85c19a3e6cb7
Author: Mingyu Chen <[email protected]>
AuthorDate: Sat Feb 18 13:02:32 2023 +0800

    [fix] skip unsupported auth method (#38)
    
    sometimes the auths may contain unsupported auth method,
    such as OAUTHBEARER. should skip it and try next method.
---
 src/rpc/RpcChannel.cpp | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/src/rpc/RpcChannel.cpp b/src/rpc/RpcChannel.cpp
index 7f9ef5d..400a042 100644
--- a/src/rpc/RpcChannel.cpp
+++ b/src/rpc/RpcChannel.cpp
@@ -112,19 +112,26 @@ const RpcSaslProto_SaslAuth * 
RpcChannelImpl::createSaslClient(
 
     for (int i = 0; i < auths->size(); ++i) {
         auth = &auths->Get(i);
-        RpcAuth method(RpcAuth::ParseMethod(auth->method()));
-
-        if (method.getMethod() == AuthMethod::TOKEN && key.hasToken()) {
-            token = key.getToken();
-            break;
-        } else if (method.getMethod() == AuthMethod::KERBEROS) {
-            break;
-        } else if (method.getMethod() == AuthMethod::SIMPLE) {
-            return auth;
-        } else if (method.getMethod() == AuthMethod::UNSURENESS) {
-            return auth;
-        } else {
-            auth = NULL;
+        try {
+            RpcAuth method(RpcAuth::ParseMethod(auth->method()));
+            if (method.getMethod() == AuthMethod::TOKEN && key.hasToken()) {
+                token = key.getToken();
+                break;
+            } else if (method.getMethod() == AuthMethod::KERBEROS) {
+                break;
+            } else if (method.getMethod() == AuthMethod::SIMPLE) {
+                return auth;
+            } else if (method.getMethod() == AuthMethod::UNSURENESS) {
+                return auth;
+            } else {
+                auth = NULL;
+            }
+        } catch (const HdfsException & e) {
+            // sometimes the auths may contain unsupported auth method,
+            // such as OAUTHBEARER. should skip it and try next method.
+            LOG(LOG_ERROR,
+                "Failed to parse auth method \"%s\", skip it",
+                auth->method().c_str());
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to