This closes #1794 [ARTEMIS-1552] differenciate empty frame from no frame

This commit is contained in:
Andy Taylor 2018-01-22 10:11:58 +00:00
commit 6428a897c3
2 changed files with 7 additions and 8 deletions

View File

@ -306,13 +306,15 @@ public class ProtonHandler extends ProtonInitializable {
if (chosenMechanism != null) {
byte[] dataSASL = new byte[sasl.pending()];
sasl.recv(dataSASL, 0, dataSASL.length);
int received = sasl.recv(dataSASL, 0, dataSASL.length);
if (log.isTraceEnabled()) {
log.trace("Working on sasl::" + (dataSASL != null && dataSASL.length > 0 ? ByteUtil.bytesToHex(dataSASL, 2) : "Anonymous"));
log.trace("Working on sasl ::" + (received > 0 ? ByteUtil.bytesToHex(dataSASL, 2) : "recv:" + received));
}
byte[] response = chosenMechanism.processSASL(dataSASL);
byte[] response = null;
if (received != -1) {
response = chosenMechanism.processSASL(dataSASL);
}
if (response != null) {
sasl.send(response, 0, response.length);
}

View File

@ -74,10 +74,7 @@ public class GSSAPIServerSASL implements ServerSASL {
}));
}
byte[] challenge = null;
if (bytes.length > 0) {
challenge = Subject.doAs(jaasId, (PrivilegedExceptionAction<byte[]>) () -> saslServer.evaluateResponse(bytes));
}
byte[] challenge = Subject.doAs(jaasId, (PrivilegedExceptionAction<byte[]>) () -> saslServer.evaluateResponse(bytes));
if (saslServer.isComplete()) {
result = new GSSAPISASLResult(true, new KerberosPrincipal(saslServer.getAuthorizationID()));
}