[ARTEMIS-1552] differenciate empty frame from no frame such that a null response is accepted when valid

This commit is contained in:
gtully 2018-01-19 14:19:54 +00:00
parent 4977042cd9
commit b6612c9505
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()));
}