Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 270CC200BC2 for ; Thu, 3 Nov 2016 00:50:10 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 25AC1160B0A; Wed, 2 Nov 2016 23:50:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 69EC0160AFB for ; Thu, 3 Nov 2016 00:50:09 +0100 (CET) Received: (qmail 13007 invoked by uid 500); 2 Nov 2016 23:50:08 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 12994 invoked by uid 99); 2 Nov 2016 23:50:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Nov 2016 23:50:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2BAD1E09DE; Wed, 2 Nov 2016 23:50:08 +0000 (UTC) From: sudheeshkatkam To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #578: DRILL-4280: Kerberos Authentication Content-Type: text/plain Message-Id: <20161102235008.2BAD1E09DE@git1-us-west.apache.org> Date: Wed, 2 Nov 2016 23:50:08 +0000 (UTC) archived-at: Wed, 02 Nov 2016 23:50:10 -0000 Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/578#discussion_r86267130 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java --- @@ -308,33 +312,57 @@ public BitToUserHandshake getHandshakeResponse(UserToBitHandshake inbound) throw connection.setHandshake(inbound); try { + // TODO(SUDHEESH): MUST FIX THIS VERSION CHECK FIRST BEFORE THE CHECK BELOW if (inbound.getRpcVersion() != UserRpcConfig.RPC_VERSION) { final String errMsg = String.format("Invalid rpc version. Expected %d, actual %d.", UserRpcConfig.RPC_VERSION, inbound.getRpcVersion()); return handleFailure(respBuilder, HandshakeStatus.RPC_VERSION_MISMATCH, errMsg, null); } - if (authenticator != null) { - try { - String password = ""; - final UserProperties props = inbound.getProperties(); - for (int i = 0; i < props.getPropertiesCount(); i++) { - Property prop = props.getProperties(i); - if (UserSession.PASSWORD.equalsIgnoreCase(prop.getKey())) { - password = prop.getValue(); - break; + connection.setHandshake(inbound); + + if (authFactory != null) { + if (inbound.getRpcVersion() <= 5) { // for backward compatibility <= 1.8 + final String userName = inbound.getCredentials().getUserName(); + if (logger.isTraceEnabled()) { + logger.trace("User {} on connection {} is using an older client (Drill version <= 1.8).", + userName, connection.getRemoteAddress()); + } + try { + String password = ""; + final UserProperties props = inbound.getProperties(); + for (int i = 0; i < props.getPropertiesCount(); i++) { + Property prop = props.getProperties(i); + if (UserSession.PASSWORD.equalsIgnoreCase(prop.getKey())) { + password = prop.getValue(); + break; + } + } + final PlainMechanism plainMechanism = authFactory.getPlainMechanism(); + if (plainMechanism == null) { + throw new UserAuthenticationException("The server no longer supports username/password" + + " based authentication. Please talk to your system administrator."); } + plainMechanism.getAuthenticator().authenticate(userName, password); + connection.changeHandlerTo(handler); + connection.finalizeSession(userName); + respBuilder.setStatus(HandshakeStatus.SUCCESS); --- End diff -- Successful auth is logged elsewhere. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---