When SPNEGO request non-Mutual
# HG changeset patch
# User weijun
# Date 1217836772 -28800
# Node ID 180e36528bfded24fde6f3b3ecfb7becbf4746df
# Parent 84a15da396df6316844f28e1d8c148eae636d6f3
9999999: When SPNEGO request non-Mutual etc
Reviewed-by: nobody
--- a/src/share/classes/sun/security/jgss/GSSContextImpl.java Sat Aug 02 11:46:10 2008 +0800
+++ b/src/share/classes/sun/security/jgss/GSSContextImpl.java Mon Aug 04 15:59:32 2008 +0800
@@ -284,7 +284,9 @@
ByteArrayOutputStream bos = new ByteArrayOutputStream(100);
acceptSecContext(new ByteArrayInputStream(inTok, offset, len),
bos);
- return bos.toByteArray();
+ byte[] out = bos.toByteArray();
+ if (out.length == 0) return null;
+ else return out;
}
public void acceptSecContext(InputStream inStream,
--- a/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java Sat Aug 02 11:46:10 2008 +0800
+++ b/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java Mon Aug 04 15:59:32 2008 +0800
@@ -413,13 +413,14 @@
// pull out the mechanism token
byte[] accept_token = targToken.getResponseToken();
if (accept_token == null) {
- // return wth failure
- throw new GSSException(errorCode, -1,
- "mechansim token from server is null");
+ if (!isMechContextEstablished()) {
+ // return wth failure
+ throw new GSSException(errorCode, -1,
+ "mechansim token from server is null");
+ }
+ } else {
+ mechToken = GSS_initSecContext(accept_token);
}
-
- mechToken = GSS_initSecContext(accept_token);
-
// verify MIC
if (!GSSUtil.useMSInterop()) {
byte[] micToken = targToken.getMechListMIC();
@@ -428,7 +429,6 @@
"verification of MIC on MechList Failed!");
}
}
-
if (isMechContextEstablished()) {
state = STATE_DONE;
retVal = mechToken;
@@ -556,9 +556,6 @@
// get the token for mechanism
byte[] accept_token = GSS_acceptSecContext(mechToken);
- if (accept_token == null) {
- valid = false;
- }
// verify MIC
if (!GSSUtil.useMSInterop() && valid) {