|
1 | 1 |
|
2 | 2 | /*
|
3 | 3 | *
|
4 |
| - * Copyright (C) 2009 Mattias Blomqvist, patr-blo at dsv dot su dot se |
| 4 | + * Copyright (C) 2010 Mattias Blomqvist, patr-blo at dsv dot su dot se |
5 | 5 | *
|
6 | 6 | * This program is free software; you can redistribute it and/or modify
|
7 | 7 | * it under the terms of the GNU General Public License as published by
|
|
39 | 39 | using System.Security.Cryptography.X509Certificates;
|
40 | 40 | using FlowLib.Containers.Security;
|
41 | 41 | using FlowLib.Enums;
|
| 42 | +using System.IO; |
42 | 43 | #endif
|
43 | 44 |
|
44 | 45 | #if COMPACT_FRAMEWORK
|
@@ -195,7 +196,10 @@ protected void CheckSecure()
|
195 | 196 | {
|
196 | 197 | SecureUpdate(this, new FmdcEventArgs(Actions.SecurityAuthenticationError, pe));
|
197 | 198 | }
|
198 |
| - |
| 199 | + catch (IOException ioe) |
| 200 | + { |
| 201 | + SecureUpdate(this, new FmdcEventArgs(Actions.SecurityAuthenticationError, ioe)); |
| 202 | + } |
199 | 203 | }
|
200 | 204 | #endif
|
201 | 205 | public bool IsDisposed
|
@@ -427,7 +431,7 @@ public virtual void Disconnect(string msg)
|
427 | 431 | }
|
428 | 432 | #endif
|
429 | 433 |
|
430 |
| - socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontLinger,new LingerOption(false, 0)); |
| 434 | + //socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontLinger,new LingerOption(false, 0)); |
431 | 435 | socket.Disconnect(true);
|
432 | 436 | }
|
433 | 437 | catch (Exception) { }
|
@@ -481,7 +485,7 @@ protected virtual void SetupRecieveCallback(Socket sock)
|
481 | 485 | {
|
482 | 486 | // Determin Protocol to use here.
|
483 | 487 | //if (Protocol != null && sock.Connected && first)
|
484 |
| - if (Protocol != null && first && !importedSocket) |
| 488 | + if (first && !importedSocket && Protocol != null) |
485 | 489 | {
|
486 | 490 | first = false;
|
487 | 491 | if (Protocol.FirstCommand != null)
|
@@ -740,9 +744,17 @@ protected bool OnRemoteCertificateValidation(
|
740 | 744 | FmdcEventArgs args = new FmdcEventArgs(Actions.SecurityValidateRemoteCertificate, info);
|
741 | 745 | SecureUpdate(this, args);
|
742 | 746 | info = args.Data as CertificateValidationInfo;
|
743 |
| - if (info == null) |
744 |
| - return false; |
745 |
| - return info.Accepted; |
| 747 | + if (args.Handled) |
| 748 | + { |
| 749 | + if (info == null) |
| 750 | + return false; |
| 751 | + return info.Accepted; |
| 752 | + } |
| 753 | + else |
| 754 | + { |
| 755 | + // If developer havnt added logic to support this. Assume Accepted. |
| 756 | + return true; |
| 757 | + } |
746 | 758 | }
|
747 | 759 |
|
748 | 760 | protected X509Certificate OnLocalCertificateSelection(
|
|
0 commit comments