News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Security Library Forum
 
Implement FTPS - problems closing command channel  
by Lee Gillie [Lee at odp dot com]
posted on 2005/08/12

I think I said the last post was a DATA channel problem. Obviously it is not.

When the FTPS client wants to end his session he issues a QUIT command. I process this by providing a sign off command, and then procede to close the upgraded SSL channel. By the way, this all works perfectly if the channel had NOT be upgraded to SSL.

Anyway, my code looks like this:
Private Function EndSession(ByVal WithSignoffMessage As Boolean) As Boolean
AcceptingCommands = False
If WithSignoffMessage Then
If config.SignOff.Length > 0 Then
Dim Line As String
Dim Lines() As String = Split(config.SignOff, vbCr)
For Each Line In Lines
SendLine(1000, "230-" & Line)
Next
End If
SendLine(1000, "221 Logged off.")
End If
PLog("Shutdown session socket...")
CommandSocket.Shutdown(SocketShutdown.Both)
PLog("Close session socket...")
CommandSocket.Close()
PLog("QUIT action completed.")
Return True
End Function

The call to CommandSocket.Shutdown is line 1441, where the exception occurs. Here is a stack dump of the exception:

09:13:54.57 <- 226 Transfer complete. Data Connection Closed.
09:15:15.50 -> QUIT
09:15:15.50 <- 221 Logged off.
09:15:15.50 Shutdown session socket...
09:15:15.55 CommandSessionThread: Org.Mentalis.Security.Ssl.Shared.SslException: An exception occurred ---> System.ObjectDisposedException: Cannot access a disposed object named "Org.Mentalis.Security.Cryptography.HMAC".
09:15:15.55 Object name: "Org.Mentalis.Security.Cryptography.HMAC".
09:15:15.55 at Org.Mentalis.Security.Cryptography.HMAC.Initialize() in D:\ODP\Core\seclib-1.0\seclib\Security\Cryptography\HMAC.cs:line 79
09:15:15.55 at Org.Mentalis.Security.Ssl.Shared.RecordLayer.WrapMessage(RecordMessage message) in D:\ODP\Core\seclib-1.0\seclib\Security\Ssl\Shared\RecordLayer.cs:line 188
09:15:15.55 --- End of inner exception stack trace ---
09:15:15.55 at Org.Mentalis.Security.Ssl.Shared.RecordLayer.WrapMessage(RecordMessage message) in D:\ODP\Core\seclib-1.0\seclib\Security\Ssl\Shared\RecordLayer.cs:line 228
09:15:15.55 at Org.Mentalis.Security.Ssl.Shared.RecordLayer.InternalEncryptBytes(Byte[] buffer, Int32 offset, Int32 size, ContentType type) in D:\ODP\Core\seclib-1.0\seclib\Security\Ssl\Shared\RecordLayer.cs:line 171
09:15:15.55 at Org.Mentalis.Security.Ssl.Shared.RecordLayer.EncryptBytes(Byte[] buffer, Int32 offset, Int32 size, ContentType type) in D:\ODP\Core\seclib-1.0\seclib\Security\Ssl\Shared\RecordLayer.cs:line 329
09:15:15.55 at Org.Mentalis.Security.Ssl.Shared.HandshakeLayer.GetControlBytes(ControlType type) in D:\ODP\Core\seclib-1.0\seclib\Security\Ssl\Shared\HandshakeLayer.cs:line 314
09:15:15.55 at Org.Mentalis.Security.Ssl.Shared.RecordLayer.GetControlBytes(ControlType type) in D:\ODP\Core\seclib-1.0\seclib\Security\Ssl\Shared\RecordLayer.cs:line 403
09:15:15.55 at Org.Mentalis.Security.Ssl.Shared.SocketController.BeginShutdown(AsyncCallback callback, Object state) in D:\ODP\Core\seclib-1.0\seclib\Security\Ssl\Shared\SocketController.cs:line 351
09:15:15.55 at Org.Mentalis.Security.Ssl.SecureSocket.BeginShutdown(AsyncCallback callback, Object state) in d:\odp\core\seclib-1.0\seclib\security\ssl\securesocket.cs:line 528
09:15:15.55 at Org.Mentalis.Security.Ssl.SecureSocket.Shutdown(SocketShutdown how) in d:\odp\core\seclib-1.0\seclib\security\ssl\securesocket.cs:line 507
09:15:15.55 at ODP.NMServe.CommandChannelSession.EndSession(Boolean WithSignoffMessage) in D:\ODP\Core\NetMover.NET\NMServe\CommandChannelSession.vb:line 1441
09:15:15.55 at ODP.NMServe.CommandChannelSession.Cmd_QUIT(Command CMD) in D:\ODP\Core\NetMover.NET\NMServe\CommandChannelSession.vb:line 783
09:15:15.55 at ODP.NMServe.CommandChannelSession.ProcessCommand(Command CMD) in D:\ODP\Core\NetMover.NET\NMServe\CommandChannelSession.vb:line 519
09:15:15.55 at ODP.NMServe.CommandChannelSession.CommandSessionThread() in D:\ODP\Core\NetMover.NET\NMServe\CommandChannelSession.vb:line 273
09:15:15.55 <- 221 Logged off due to catastrophic failure.

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.