Skip to content

Commit d559d41

Browse files
author
Rory Winston
committed
NET-158: Try to handle intermediate return code during authentication
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/net/branches/JDK_1_5_BRANCH@544992 13f79535-47bb-0310-9956-ffa450edef68
1 parent 55bfc95 commit d559d41

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/org/apache/commons/net/ftp/FTPClient.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,16 @@ public boolean login(String username, String password) throws IOException
664664
if (!FTPReply.isPositiveIntermediate(_replyCode))
665665
return false;
666666

667-
return FTPReply.isPositiveCompletion(pass(password));
667+
int replyCode = pass(password);
668+
boolean replyOk = FTPReply.isPositiveCompletion(replyCode);
669+
670+
// Work around stupid servers that send a 451 here
671+
if (!replyOk && (replyCode == FTPReply.ACTION_ABORTED)) {
672+
replyCode = getReply();
673+
replyOk = FTPReply.isPositiveCompletion(replyCode);
674+
}
675+
676+
return replyOk;
668677
}
669678

670679

0 commit comments

Comments
 (0)