|
24 | 24 | namespace nebula {
|
25 | 25 | namespace graph {
|
26 | 26 |
|
27 |
| -// The default value is 28800 seconds |
28 |
| -const int64_t clientAddrTimeout = FLAGS_client_idle_timeout_secs; |
29 |
| - |
30 | 27 | Status GraphService::init(std::shared_ptr<folly::IOThreadPoolExecutor> ioExecutor,
|
31 | 28 | const HostAddr& hostAddr) {
|
32 | 29 | auto addrs = network::NetworkUtils::toHosts(FLAGS_meta_server_addrs);
|
@@ -72,10 +69,9 @@ folly::Future<AuthResponse> GraphService::future_authenticate(const std::string&
|
72 | 69 |
|
73 | 70 | auto ctx = std::make_unique<RequestContext<AuthResponse>>();
|
74 | 71 | auto future = ctx->future();
|
75 |
| - // Check username and password failed |
76 |
| - // Check whether the client has called verifyClientVersion() |
77 |
| - auto clientAddr = HostAddr(peer->getAddressStr(), peer->getPort()); |
78 |
| - auto authResult = auth(username, password, clientAddr); |
| 72 | + |
| 73 | + // check username and password failed |
| 74 | + auto authResult = auth(username, password); |
79 | 75 | if (!authResult.ok()) {
|
80 | 76 | ctx->resp().errorCode = ErrorCode::E_BAD_USERNAME_PASSWORD;
|
81 | 77 | ctx->resp().errorMsg.reset(new std::string(authResult.toString()));
|
@@ -207,24 +203,9 @@ folly::Future<std::string> GraphService::future_executeJsonWithParameter(
|
207 | 203 | });
|
208 | 204 | }
|
209 | 205 |
|
210 |
| -Status GraphService::auth(const std::string& username, |
211 |
| - const std::string& password, |
212 |
| - const HostAddr& clientIp) { |
| 206 | +Status GraphService::auth(const std::string& username, const std::string& password) { |
213 | 207 | auto metaClient = queryEngine_->metaClient();
|
214 | 208 |
|
215 |
| - // TODO(Aiee) This is a walkaround to address the problem that using a lower version(< v2.6.0) |
216 |
| - // client to connect with higher version(>= v3.0.0) Nebula service will cause a crash. |
217 |
| - // |
218 |
| - // Only the clients since v2.6.0 will call verifyVersion(), thus we could determine whether the |
219 |
| - // client version is lower than v2.6.0 |
220 |
| - auto clientAddrIt = metaClient->getClientAddrMap().find(clientIp); |
221 |
| - if (clientAddrIt == metaClient->getClientAddrMap().end()) { |
222 |
| - return Status::Error( |
223 |
| - folly::sformat("The version of the client sending request from {} is too old, " |
224 |
| - "please update the client.", |
225 |
| - clientIp.toString())); |
226 |
| - } |
227 |
| - |
228 | 209 | // Skip authentication if FLAGS_enable_authorize is false
|
229 | 210 | if (!FLAGS_enable_authorize) {
|
230 | 211 | return Status::OK();
|
@@ -270,13 +251,6 @@ folly::Future<cpp2::VerifyClientVersionResp> GraphService::future_verifyClientVe
|
270 | 251 | resp.error_code_ref() = nebula::cpp2::ErrorCode::SUCCEEDED;
|
271 | 252 | }
|
272 | 253 |
|
273 |
| - // The client sent request has a version >= v2.6.0, mark the address as valid |
274 |
| - auto* peer = getRequestContext()->getPeerAddress(); |
275 |
| - auto clientAddr = HostAddr(peer->getAddressStr(), peer->getPort()); |
276 |
| - |
277 |
| - auto ttlTimestamp = time::WallClock::fastNowInSec() + clientAddrTimeout; |
278 |
| - auto clientAddrMap = &metaClient_->getClientAddrMap(); |
279 |
| - clientAddrMap->insert_or_assign(clientAddr, ttlTimestamp); |
280 | 254 | return folly::makeFuture<cpp2::VerifyClientVersionResp>(std::move(resp));
|
281 | 255 | }
|
282 | 256 | } // namespace graph
|
|
0 commit comments