Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: Unmanaged exception in MailBee.NET? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
vachooho
Newbie
Newbie


Joined: 17 November 2009
Location: United States
Online Status: Offline
Posts: 18
Posted: 05 March 2010 at 10:37am | IP Logged Quote vachooho

Unhandled exception at 0x77416cd2 in ConsoleApplication1.exe: 0xC0000374: A heap has been corrupted.

This happens on Login call to Exchange 2010 using IMAP or POP3 component.

Here is sample program for you:

    class Program
    {
        static void Main(string[] args)
        {
             MailBee.ImapMail.Imap.LicenseKey = Keys.LicenseKey;

             MailBee.ImapMail.Imap imap = new MailBee.ImapMail.Imap();
             imap.Connect("172.20.32.65", 993);
             imap.Login(Keys.username, Keys.password, MailBee.AuthenticationMethods.Auto);

             imap.Disconnect();
        }
    }

Exchange 2010 no longer use NTLM auth and lists GSSAPI as the first auth method in CAPABILITY response. attempt to login using GSSAPI causes the crash.
If I remove GSSAPI from Login call - it works.
imap.Login(Keys.username, Keys.password, MailBee.AuthenticationMethods.Auto & ~MaillBee.AuthenticationMethods.SaslKerberosGssApi);

More from Windows 7 error screen:

Problem Event Name:     APPCRASH
Application Name:     ConsoleApplication1.vshos t.exe
Application Version:     8.0.50727.42
Application Timestamp:     4333d898
Fault Module Name:     StackHash_c138
Fault Module Version:     6.1.7600.16385
Fault Module Timestamp:     4a5be02b
Exception Code:     c0000374
Exception Offset:     00000000000c6cd2
OS Version:     6.1.7600.2.0.0.256.48
Locale ID:     1033
Additional Information 1:     c138
Additional Information 2:     c138bbc35ea203c198d4de2aa260 ef83
Additional Information 3:     ec24
Additional Information 4:     ec2478ce089e7f9a69c198bd32c2 60d8


Back to Top View vachooho's Profile Search for other posts by vachooho
 
vachooho
Newbie
Newbie


Joined: 17 November 2009
Location: United States
Online Status: Offline
Posts: 18
Posted: 05 March 2010 at 11:01am | IP Logged Quote vachooho

also when I use
Login(xxx,xxx, AuthMethods.Auto, AutoOptions.PreferSimpleMethods, null)
login does not succeed

here is the log
[03/05/2010 10:56:42.25] [INFO] [0006] [IMAP-00................] Assembly version: 5.8.2.180.
[03/05/2010 10:56:42.25] [INFO] [0006] [IMAP-00................] Will resolve host "172.20.32.65".
[03/05/2010 10:56:42.25] [INFO] [0006] [IMAP-00................] Host "172.20.32.65" resolved to IP address(es) 172.20.32.65.
[03/05/2010 10:56:42.26] [INFO] [0006] [IMAP-00................] Will connect to host "172.20.32.65" on port 993.
[03/05/2010 10:56:42.26] [INFO] [0006] [IMAP-00................] Socket connected to IP address 172.20.32.65 on port 993.
[03/05/2010 10:56:42.27] [INFO] [0006] [IMAP-00................] Will login as "vachik".
[03/05/2010 10:56:42.27] [INFO] [0006] [IMAP-00................] Will try regular LOGIN authentication.
[03/05/2010 10:56:42.27] [INFO] [0006] [IMAP-00................] Error: IOException occurred. InnerException message follows: The handshake failed due to an unexpected packet format.
[03/05/2010 10:56:47.27] [INFO] [0006] [IMAP-00................] Will login as "vachik".
[03/05/2010 10:56:47.28] [INFO] [0006] [IMAP-00................] Will try regular LOGIN authentication.
[03/05/2010 10:56:47.28] [INFO] [0006] [IMAP-00................] Error: IOException occurred. InnerException message follows: The handshake failed due to an unexpected packet format.
[03/05/2010 10:56:47.28] [INFO] [0006] [IMAP-00................] Error: IOException occurred. InnerException message follows: The handshake failed due to an unexpected packet format.
[03/05/2010 10:56:47.28] [INFO] [0006] [IMAP-00................] Error: IOException occurred. InnerException message follows: The handshake failed due to an unexpected packet format.
[03/05/2010 10:56:47.29] [INFO] [0006] [IMAP-00................] Will disconnect from host "172.20.32.65".
[03/05/2010 10:56:47.29] [INFO] [0006] [IMAP-00................] Disconnected from host "172.20.32.65".
Back to Top View vachooho's Profile Search for other posts by vachooho
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 05 March 2010 at 11:09am | IP Logged Quote Alex

The regular login fails due to using SSL. Try to specify another SslProtocol (by default it's auto) or no SSL at all. Looks like Exchange 2010 changed the protocols.

As for heap corrupted error, can't you reproduce it with earlier version of Exchange? I assume you have migrated from 2007 version, correct? If so and you still have access to that version, can you check if GSSAPI works there (explicitly specifying it in AuthMethods)?

We do not yet have Exchange 2010 so it might take some time to test MailBee with the newer version.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
vachooho
Newbie
Newbie


Joined: 17 November 2009
Location: United States
Online Status: Offline
Posts: 18
Posted: 05 March 2010 at 11:44am | IP Logged Quote vachooho

Please ignore regular login issue - it was server's fault.

Back to Top View vachooho's Profile Search for other posts by vachooho
 
vachooho
Newbie
Newbie


Joined: 17 November 2009
Location: United States
Online Status: Offline
Posts: 18
Posted: 05 March 2010 at 11:49am | IP Logged Quote vachooho

I have tried login(xx, xxx, AuthMethods.SaslKerberosGssApi) against Exchange 2007

I got an exception first time I run the application.

MailBee.MailBeeLoginWin32Exception: Win32 function related to Windows Integrated authentication returned an error. See NativeErrorCode property value for more information. The Win32 error code is: -2146893053. The Win32 description is: The specified target is unknown or unreachable.
   at aj.g()
   at aj.l()
   at g5.a(SaslMethod A_0, String A_1, String A_2, String A_3, String A_4)
   at g5.a(AuthenticationMethods A_0, AuthenticationMethods A_1, SaslMethod A_2, AuthenticationOptions A_3, String A_4, String A_5, String A_6)
   at bc.a(AuthenticationMethods A_0, AuthenticationMethods A_1, SaslMethod A_2, AuthenticationOptions A_3, String A_4, String A_5, String A_6)
   at bc.c()
   at dk.a(Boolean A_0, String A_1, String A_2, AuthenticationMethods A_3, AuthenticationOptions A_4, SaslMethod A_5)
   at dk.a(Boolean A_0, String A_1, String A_2, AuthenticationMethods A_3)
   at MailBee.ImapMail.Imap.Login(String accountName, String password, AuthenticationMethods authMethods)
   at ConsoleApplication1.Program.Main(String[] args) in C:\TEMP\ConsoleApplication1\ConsoleApplication1\Program.cs:l ine 24
Press any key to continue . . .

Any subsequent runs crash the same way as with Exchange 2010.

The problem manifests itself on Windows 7 and Vista 64-bit.

Back to Top View vachooho's Profile Search for other posts by vachooho
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 05 March 2010 at 12:11pm | IP Logged Quote Alex

OK, thanks for the point. Will forward this to the developers now. We'll let you know when the fix is available.

BTW, do you mean the problem does not occur with 32-bit Windows clients?

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
vachooho
Newbie
Newbie


Joined: 17 November 2009
Location: United States
Online Status: Offline
Posts: 18
Posted: 05 March 2010 at 6:17pm | IP Logged Quote vachooho

Yeah, looks like crash is specific to 64-bit platform only (client behaves the same regardless of whether it is "x86" or "Any CPU" application).

Crash does not occur on Win32 XP and Vista.
Though "The specified target is unknown or unreachable" exception does (which is fine since it will fail back to PLAIN?).

Back to Top View vachooho's Profile Search for other posts by vachooho
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 09 March 2010 at 10:54am | IP Logged Quote Alex

To conclude:
- "The specified target is unknown or unreachable" occurs on Win32 as well
- crash occurs only when client is 64-bit windows machine (but it's not important if the client app itself is 64-bit app)
- it works if you force using Plain authentication method (and you can live with that for a while)

Is that correct?

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
vachooho
Newbie
Newbie


Joined: 17 November 2009
Location: United States
Online Status: Offline
Posts: 18
Posted: 09 March 2010 at 9:26pm | IP Logged Quote vachooho

Thanks, that's mostly correct
Alex wrote:
- it works if you force using Plain authentication method (and you can live with that for a while)

it works in plain auth and I am OK if mailbee component fall back to plain auth in auto auth mode without crash.
Right now I have GSSAPI auth method disabled because of the crash. I will need to enable it again before our software release (for Exchange 2010 IMAP/POP3 it is the only! secure auth method)
Back to Top View vachooho's Profile Search for other posts by vachooho
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 10 March 2010 at 6:52am | IP Logged Quote Alex

Thanks. One more thing, though. Are you aware of the fact that GSSAPI works only in Windows Integrated mode, you won't be able to specify credentials explicitly even if we fix x64 crash?

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 10 March 2010 at 10:02am | IP Logged Quote Alex

One more thing. From google search it looks like exchange 2010 is fine with plain auth if you're using ssl:

imap.Connect(...)
imap.StartTls()
imap.Login(user, pass, AuthenticationMethods.Regular)

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
vachooho
Newbie
Newbie


Joined: 17 November 2009
Location: United States
Online Status: Offline
Posts: 18
Posted: 10 March 2010 at 3:00pm | IP Logged Quote vachooho

Alex wrote:
Are you aware of the fact that GSSAPI works only in Windows Integrated mode, you won't be able to specify credentials explicitly even if we fix x64 crash?


Thanks, crash is the only thing I want to be fixed. so when I do
imap|pop.Login(user, pass, AuthenticationMethods.Auto) it connects rather than crash.

right now I have GSSAPI disabled like this
imap.Login(user, pass, AuthenticationMethods.Auto & ~AuthenticationMethods.SaslKerberosGssApi) because of the crash. I want to remove this limitation as soon as crash is fixed.
I don't care if GssApi auth fails (but no crash) as long as it is transparent to the user and authentication falls back to regular/plain.
Back to Top View vachooho's Profile Search for other posts by vachooho
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 11 March 2010 at 9:55am | IP Logged Quote Alex

OK, we'll quickly make a fix not to use GSSAPI if the username/password is set (because GSSAPI makes sense only with empty username, it takes it from OS). So, it won't crash unless you indeed want to use Windows Integrated authentication and leave username empty. This fix will be released very soon.

We'll still work on the general GSSAPI fix as well.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6094
Posted: 12 March 2010 at 3:31am | IP Logged Quote Igor

Please try the updated version of MailBee.NET.dll found at:

MailBee.NET.dll for .NET 1.1 and above
MailBee.NET.dll for .NET 2.0 and above

With this assembly, GSSAPI will not be used if username is set.

Hope this helps!

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
vachooho
Newbie
Newbie


Joined: 17 November 2009
Location: United States
Online Status: Offline
Posts: 18
Posted: 12 March 2010 at 1:28pm | IP Logged Quote vachooho

Thanks, this dll does not crash.
We will also grab the latest binary when you release it.
Thanks
V
Back to Top View vachooho's Profile Search for other posts by vachooho
 
josh24
Newbie
Newbie


Joined: 13 July 2010
Online Status: Offline
Posts: 2
Posted: 13 July 2010 at 6:15pm | IP Logged Quote josh24

me too, i still have to work in GSSAPI. Hope it will release soon so that we have an option.
Back to Top View josh24's Profile Search for other posts by josh24
 
james27
Newbie
Newbie
Avatar

Joined: 03 August 2010
Online Status: Offline
Posts: 1
Posted: 03 August 2010 at 6:47pm | IP Logged Quote james27

Ok Thanks for the point. We'll definitely forward this to the developers.It works if you force using Plain authentication method.
Back to Top View james27's Profile Search for other posts by james27
 
shoshanna00
Newbie
Newbie
Avatar

Joined: 14 September 2011
Location: United States
Online Status: Offline
Posts: 2
Posted: 18 September 2011 at 11:58pm | IP Logged Quote shoshanna00

Thanks a million!!!!!
This thread is still very useful, the provided infirmation helped me a lot!!
Back to Top View shoshanna00's Profile Search for other posts by shoshanna00 Visit shoshanna00's Homepage
 
Betsie
Newbie
Newbie
Avatar

Joined: 28 September 2011
Location: United States
Online Status: Offline
Posts: 1
Posted: 28 September 2011 at 2:42am | IP Logged Quote Betsie

Please ignore regular login issue - it was server's fault.
Back to Top View Betsie's Profile Search for other posts by Betsie
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide