mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8286526: Improve NTLM support
Reviewed-by: weijun, rhalade
This commit is contained in:
parent
c622d56a0d
commit
5a8e5ea3e2
5 changed files with 23 additions and 13 deletions
|
@ -224,23 +224,27 @@ class NTLM {
|
|||
System.arraycopy(data, 0, internal, offset, data.length);
|
||||
}
|
||||
|
||||
void writeSecurityBuffer(int offset, byte[] data) {
|
||||
void writeSecurityBuffer(int offset, byte[] data) throws NTLMException {
|
||||
if (data == null) {
|
||||
writeShort(offset+4, current);
|
||||
writeInt(offset+4, current);
|
||||
} else {
|
||||
int len = data.length;
|
||||
if (len > 65535) {
|
||||
throw new NTLMException(NTLMException.INVALID_INPUT,
|
||||
"Invalid data length " + len);
|
||||
}
|
||||
if (current + len > internal.length) {
|
||||
internal = Arrays.copyOf(internal, current + len + 256);
|
||||
}
|
||||
writeShort(offset, len);
|
||||
writeShort(offset+2, len);
|
||||
writeShort(offset+4, current);
|
||||
writeInt(offset+4, current);
|
||||
System.arraycopy(data, 0, internal, current, len);
|
||||
current += len;
|
||||
}
|
||||
}
|
||||
|
||||
void writeSecurityBuffer(int offset, String str, boolean unicode) {
|
||||
void writeSecurityBuffer(int offset, String str, boolean unicode) throws NTLMException {
|
||||
writeSecurityBuffer(offset, str == null ? null : str.getBytes(
|
||||
unicode ? StandardCharsets.UTF_16LE
|
||||
: StandardCharsets.ISO_8859_1));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue