| Author |  | 
      
        | vachooho Newbie
 
  
 
 Joined: 17 November 2009
 Location: United States
 Online Status: Offline
 Posts: 18
 | 
          Unhandled exception at 0x77416cd2 in ConsoleApplication1.exe: 0xC0000374: A heap has been corrupted.
           | Posted: 05 March 2010 at 10:37am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | vachooho Newbie
 
  
 
 Joined: 17 November 2009
 Location: United States
 Online Status: Offline
 Posts: 18
 | 
          also when I use
           | Posted: 05 March 2010 at 11:01am | IP Logged |   |  
           | 
 |  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 |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          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.
           | Posted: 05 March 2010 at 11:09am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | vachooho Newbie
 
  
 
 Joined: 17 November 2009
 Location: United States
 Online Status: Offline
 Posts: 18
 | 
          Please ignore regular login issue - it was server's fault.
           | Posted: 05 March 2010 at 11:44am | IP Logged |   |  
           | 
 |  
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | vachooho Newbie
 
  
 
 Joined: 17 November 2009
 Location: United States
 Online Status: Offline
 Posts: 18
 | 
          I have tried login(xx, xxx, AuthMethods.SaslKerberosGssApi) against Exchange 2007
           | Posted: 05 March 2010 at 11:49am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          OK, thanks for the point. Will forward this to the developers now. We'll let you know when the fix is available.
           | Posted: 05 March 2010 at 12:11pm | IP Logged |   |  
           | 
 |  
 BTW, do you mean the problem does not occur with 32-bit Windows clients?
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | vachooho Newbie
 
  
 
 Joined: 17 November 2009
 Location: United States
 Online Status: Offline
 Posts: 18
 | 
          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).
           | Posted: 05 March 2010 at 6:17pm | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          To conclude:
           | Posted: 09 March 2010 at 10:54am | IP Logged |   |  
           | 
 |  - "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 |     | 
       
       
        |  | 
        | vachooho Newbie
 
  
 
 Joined: 17 November 2009
 Location: United States
 Online Status: Offline
 Posts: 18
 | 
          Thanks, that's mostly correct
           | Posted: 09 March 2010 at 9:26pm | IP Logged |   |  
           | 
 |  
 
| 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 |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          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?
           | Posted: 10 March 2010 at 6:52am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          One more thing. From google search it looks like exchange 2010 is fine with plain auth if you're using ssl:
           | Posted: 10 March 2010 at 10:02am | IP Logged |   |  
           | 
 |  
 imap.Connect(...)
 imap.StartTls()
 imap.Login(user, pass, AuthenticationMethods.Regular)
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | vachooho Newbie
 
  
 
 Joined: 17 November 2009
 Location: United States
 Online Status: Offline
 Posts: 18
 | 
          
           | Posted: 10 March 2010 at 3:00pm | IP Logged |   |  
           | 
 |  
| 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 |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          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.
           | Posted: 11 March 2010 at 9:55am | IP Logged |   |  
           | 
 |  
 We'll still work on the general GSSAPI fix as well.
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          Please try the updated version of MailBee.NET.dll found at:
           | Posted: 12 March 2010 at 3:31am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | vachooho Newbie
 
  
 
 Joined: 17 November 2009
 Location: United States
 Online Status: Offline
 Posts: 18
 | 
          Thanks, this dll does not crash.
           | Posted: 12 March 2010 at 1:28pm | IP Logged |   |  
           | 
 |  We will also grab the latest binary when you release it.
 Thanks
 V
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | josh24 Newbie
 
  
 
 Joined: 13 July 2010
 Online Status: Offline
 Posts: 2
 | 
          me too, i still have to work in GSSAPI. Hope it will release soon so that we have an option.
           | Posted: 13 July 2010 at 6:15pm | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | james27 Newbie
 
  
  
 Joined: 03 August 2010
 Online Status: Offline
 Posts: 1
 | 
          Ok Thanks for the point. We'll definitely forward this to the developers.It works if you force using Plain authentication method.
           | Posted: 03 August 2010 at 6:47pm | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | shoshanna00 Newbie
 
  
  
 Joined: 14 September 2011
 Location: United States
 Online Status: Offline
 Posts: 2
 | 
          Thanks a million!!!!!
           | Posted: 18 September 2011 at 11:58pm | IP Logged |   |  
           | 
 |  This thread is still very useful, the provided infirmation helped me a lot!!
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | Betsie Newbie
 
  
  
 Joined: 28 September 2011
 Location: United States
 Online Status: Offline
 Posts: 1
 | 
          Please ignore regular login issue - it was server's fault.
           | Posted: 28 September 2011 at 2:42am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  |