Github user tgravescs commented on a diff in the pull request: https://github.com/apache/incubator-spark/pull/332#discussion_r9918847 --- Diff: core/src/main/scala/org/apache/spark/network/ConnectionManager.scala --- @@ -533,10 +667,65 @@ private[spark] class ConnectionManager(port: Int, conf: SparkConf) extends Loggi } } + private def checkSendAuthFirst(connManagerId: ConnectionManagerId, conn: SendingConnection) { + // see if we need to do sasl before writing + // this should only be the first negotiation as the Client!!! + if (!conn.isSaslComplete()) { + conn.synchronized { + if (conn.sparkSaslClient == null) { + conn.sparkSaslClient = new SparkSaslClient(securityManager) + var firstResponse: Array[Byte] = null + try { + firstResponse = conn.sparkSaslClient.firstToken() + var securityMsg = SecurityMessage.fromResponse(firstResponse, conn.connectionId.id) + var message = securityMsg.toBufferMessage + if (message == null) throw new Exception("Error creating security message") + sendSecurityMessage(connManagerId, message) + logDebug("adding connectionsAwaitingSasl id: " + conn.connectionId) + connectionsAwaitingSasl += ((conn.connectionId, conn)) + } catch { --- End diff -- Good catch, I'll move it up.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. To do so, please top-post your response. 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---