Hi Gary, all,

following up to my post last week...

I managed to discount the OAuth2 part being the culprit.

The simplest code I can write that FAILS under commons net 3.11.0 but WORKS with 3.10.0, 3.9.0 and 3.8.0 is this

AuthenticatingIMAPClient aic = new AuthenticatingIMAPClient(true);
String server = "imap-mail.outlook.com";
try {
     aic.connect( server );
} catch( Exception e ) {
     e.printStackTrace();
}

When binding to the 3.11.0 commons net jar, the code above produces this on my (Linux) terminal:

org.apache.commons.net.MalformedServerReplyException: Received unexpected IMAP protocol response from server: '* OK The Microsoft Exchange IMAP4 service is ready. [TQBXADQAUABSADAAMwBDAEEAMAAyADkAMwAuAG4AYQBtAHAAcgBkADAAMwAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A]'.     at org.apache.commons.net.imap.IMAPReply.getReplyCode(IMAPReply.java:119)     at org.apache.commons.net.imap.IMAPReply.getUntaggedReplyCode(IMAPReply.java:130)
    at org.apache.commons.net.imap.IMAP.getReply(IMAP.java:288)
    at org.apache.commons.net.imap.IMAP._connectAction_(IMAP.java:152)
    at org.apache.commons.net.imap.IMAPSClient._connectAction_(IMAPSClient.java:176)
    at org.apache.commons.net.SocketClient._connect(SocketClient.java:142)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:308)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:290)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:275)

Under all earlier versions of the commons net jar mentioned, the connect() routine succeeds and no stack trace is printed.

In my previous post, I had subbed in 'xxxxxxxxx' for the long string TQB... above, since I thought it might leak OAuth2 info. Given the above code doesn't get as far as offering any OAuth credentials, I can't see how the string above can be sensitive (famous last words!)

I am running my code via 'mvn test'. My mvn set up is

$ mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/stuart/Downloads/apache-maven-3.6.3
Java version: 11.0.22, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-107-generic", arch: "amd64", family: "unix"

If I drive mvn with a Java 8 VM I get same results.

Stuart


On 5/31/24 13:39, Gary Gregory wrote:
Hello Stu,

Thank you for your report.

Does the issue occur using 3.9.0?

What about 3.10.0?

Do you have a way we can reproduce this issue?

If not, you could run your test in a debugger and extract a reproducible
and a failing unit test.

You could also use git bisect to find the first offending commit.

TY!
Gary

On Fri, May 31, 2024, 3:13 PM Stuart Maclean <macl...@mrvsys.com.invalid>
wrote:

I have an app that uses Commons Net. It talks IMAP, via OAuth2, to a MS
Exchange Server.  With Commons Net 3.8.0 and 3.10.0, it works fine. I
just saw 3.11.0 was released, and wanted to try it. I was alarmed to see
it fail with my app. The ONLY change made to the build was in my
pom.xml, from this

      <dependency>
        <groupId>commons-net</groupId>
        <artifactId>commons-net</artifactId>
        <version>3.8.0</version>
      </dependency>

      <dependency>
        <groupId>commons-net</groupId>
        <artifactId>commons-net</artifactId>
        <version>3.11.0</version>
      </dependency>

With 3.11.0, the app reports

$ ./mailRetriever -e

org.apache.commons.net.MalformedServerReplyException: Received
unexpected IMAP protocol response from server: '* OK The Microsoft
Exchange IMAP4 service is ready. [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]'.
      at
org.apache.commons.net.imap.IMAPReply.getReplyCode(IMAPReply.java:119)
      at

org.apache.commons.net.imap.IMAPReply.getUntaggedReplyCode(IMAPReply.java:130)
      at org.apache.commons.net.imap.IMAP.getReply(IMAP.java:288)
      at org.apache.commons.net.imap.IMAP._connectAction_(IMAP.java:152)

The app is trying to do an 'INBOX EXAMINE' request.

I do see mention made of IMAPReply in the 3.11.0 release notes. Maybe I
need to change my own code to use the IMAP objects differently?? Or
maybe the flaw is the server end??

Stu


On 5/31/24 10:35, Gary Gregory wrote:
The Apache Commons Net team is pleased to announce the release of
Apache Commons Net 3.11.0.

Apache Commons Net library contains a collection of network utilities
and protocol implementations. Supported protocols include Echo,
Finger, FTP, NNTP, NTP, POP3(S), SMTP(S), Telnet, and Whois.

Maintenance and bug fix release (Java 8 or above).

For complete information on Apache Commons Net, including instructions
on how to submit bug reports, patches, or suggestions for improvement,
see the Apache Commons Net website:

https://commons.apache.org/proper/commons-net/

Download page:
https://commons.apache.org/proper/commons-net/download_net.cgi
Historical list of changes:
https://commons.apache.org/proper/commons-net/changes-report.html

Enjoy!
Gary Gregory
-Apache Commons Net team

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to