olegk 2004/01/21 13:10:44
Modified: httpclient/src/java/org/apache/commons/httpclient/auth
NTLMScheme.java
Log:
Fixes the problem with NTLM authentication scheme failing to properly handle
authentication failures caused by invalid credentials which results in an infinite
loop in HttpMethodDirector
Contributed by Oleg Kalnichevski
Revision Changes Path
1.17 +10 -5
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/NTLMScheme.java
Index: NTLMScheme.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/NTLMScheme.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- NTLMScheme.java 14 Jan 2004 20:48:43 -0000 1.16
+++ NTLMScheme.java 21 Jan 2004 21:10:44 -0000 1.17
@@ -95,6 +95,7 @@
private static final int TYPE1_MSG_GENERATED = 2;
private static final int TYPE2_MSG_RECEIVED = 3;
private static final int TYPE3_MSG_GENERATED = 4;
+ private static final int FAILED = Integer.MAX_VALUE;
/** Authentication process state */
private int state;
@@ -140,7 +141,11 @@
this.state = TYPE2_MSG_RECEIVED;
} else {
this.ntlmchallenge = "";
- this.state = INITIATED;
+ if (this.state == UNINITIATED) {
+ this.state = INITIATED;
+ } else {
+ this.state = FAILED;
+ }
}
}
@@ -151,7 +156,7 @@
* <tt>false</tt> otherwise.
*/
public boolean isComplete() {
- return this.state == TYPE3_MSG_GENERATED;
+ return this.state == TYPE3_MSG_GENERATED || this.state == FAILED;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]