Author: atsushi
Date: 2007-08-22 06:36:47 -0400 (Wed, 22 Aug 2007)
New Revision: 84605
Added:
trunk/mcs/class/corlib/Test/System.Runtime.Remoting.Channels/
trunk/mcs/class/corlib/Test/System.Runtime.Remoting.Channels/ChangeLog
trunk/mcs/class/corlib/Test/System.Runtime.Remoting.Channels/ChannelServicesTest.cs
Modified:
trunk/mcs/class/corlib/ChangeLog
trunk/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog
trunk/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs
trunk/mcs/class/corlib/corlib_test.dll.sources
Log:
2007-08-22 Atsushi Enomoto <[EMAIL PROTECTED]>
* ChannelServices.cs : implement ensureSecurity support in
RegisterChannel(IChannel,bool). Note that we don't have secure
channels in Sys.Runtime.Remoting.dll yet.
* ChannelServicesTest.cs : new test fixture.
* corlib_test.dll.sources : added ChannelServicesTest.cs.
Modified: trunk/mcs/class/corlib/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/ChangeLog 2007-08-22 09:39:44 UTC (rev 84604)
+++ trunk/mcs/class/corlib/ChangeLog 2007-08-22 10:36:47 UTC (rev 84605)
@@ -1,3 +1,7 @@
+2007-08-22 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * corlib_test.dll.sources : added ChannelServicesTest.cs.
+
2007-08-15 Atsushi Enomoto <[EMAIL PROTECTED]>
* corlib.dll.sources : added CustomErrorsModes.cs.
Modified: trunk/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog
2007-08-22 09:39:44 UTC (rev 84604)
+++ trunk/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog
2007-08-22 10:36:47 UTC (rev 84605)
@@ -1,3 +1,9 @@
+2007-08-22 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * ChannelServices.cs : implement ensureSecurity support in
+ RegisterChannel(IChannel,bool). Note that we don't have secure
+ channels in Sys.Runtime.Remoting.dll yet.
+
2007-08-15 Atsushi Enomoto <[EMAIL PROTECTED]>
* ChannelServices.cs BaseChannelObjectWithProperties.cs
Modified:
trunk/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs
===================================================================
--- trunk/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs
2007-08-22 09:39:44 UTC (rev 84604)
+++ trunk/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs
2007-08-22 10:36:47 UTC (rev 84605)
@@ -265,13 +265,22 @@
}
#if NET_2_0
- [MonoTODO ("Implement ensureSecurity")]
public
#else
internal
#endif
static void RegisterChannel (IChannel chnl, bool ensureSecurity)
{
+ if (chnl == null)
+ throw new ArgumentNullException ("chnl");
+#if NET_2_0
+ if (ensureSecurity) {
+ ISecurableChannel securable = chnl as
ISecurableChannel;
+ if (securable == null)
+ throw new RemotingException
(String.Format ("Channel {0} is not securable while ensureSecurity is specified
as true", chnl.ChannelName));
+ securable.IsSecured = true;
+ }
+#endif
// Put the channel in the correct place according to
its priority.
// Since there are not many channels, a linear search
is ok.
Added: trunk/mcs/class/corlib/Test/System.Runtime.Remoting.Channels/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Runtime.Remoting.Channels/ChangeLog
2007-08-22 09:39:44 UTC (rev 84604)
+++ trunk/mcs/class/corlib/Test/System.Runtime.Remoting.Channels/ChangeLog
2007-08-22 10:36:47 UTC (rev 84605)
@@ -0,0 +1,3 @@
+2007-08-22 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * ChannelServicesTest.cs : new test fixture.
Added:
trunk/mcs/class/corlib/Test/System.Runtime.Remoting.Channels/ChannelServicesTest.cs
===================================================================
---
trunk/mcs/class/corlib/Test/System.Runtime.Remoting.Channels/ChannelServicesTest.cs
2007-08-22 09:39:44 UTC (rev 84604)
+++
trunk/mcs/class/corlib/Test/System.Runtime.Remoting.Channels/ChannelServicesTest.cs
2007-08-22 10:36:47 UTC (rev 84605)
@@ -0,0 +1,87 @@
+//
+// ChannelServicesTest.cs
+//
+// Author:
+// Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Threading;
+using System.Collections;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using NUnit.Framework;
+
+namespace MonoTests.System.Runtime.Remoting.Channels
+{
+
+ [TestFixture]
+ public class ChannelServicesTest
+ {
+#if NET_2_0
+ [Test]
+ [ExpectedException (typeof (RemotingException))]
+ public void ConstructorEnsureSecurity ()
+ {
+ IChannel ch = new NonSecureChannel ();
+ ChannelServices.RegisterChannel (ch, true);
+ // in case it happened to successfully register the
channel...
+ ChannelServices.UnregisterChannel (ch);
+ }
+
+ [Test]
+ public void ConstructorEnsureSecurity2 ()
+ {
+ IChannel ch = new SecureChannel ();
+ ChannelServices.RegisterChannel (ch, true);
+ ChannelServices.UnregisterChannel (ch);
+ }
+
+ class NonSecureChannel : IChannel
+ {
+ public string Parse (string url, out string objectURI)
+ {
+ objectURI = "my:foo";
+ return "foo";
+ }
+
+ public string ChannelName {
+ get { return "my"; }
+ }
+
+ public int ChannelPriority {
+ get { return 0; }
+ }
+ }
+
+ class SecureChannel : NonSecureChannel, ISecurableChannel
+ {
+ public bool IsSecured {
+ get { return false; }
+ set { }
+ }
+ }
+#endif
+ }
+}
Property changes on:
trunk/mcs/class/corlib/Test/System.Runtime.Remoting.Channels/ChannelServicesTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/mcs/class/corlib/corlib_test.dll.sources
===================================================================
--- trunk/mcs/class/corlib/corlib_test.dll.sources 2007-08-22 09:39:44 UTC
(rev 84604)
+++ trunk/mcs/class/corlib/corlib_test.dll.sources 2007-08-22 10:36:47 UTC
(rev 84605)
@@ -147,6 +147,7 @@
System.Runtime.Remoting/ContextTest.cs
System.Runtime.Remoting/SoapServicesTest.cs
System.Runtime.Remoting/SynchronizationAttributeTest.cs
+System.Runtime.Remoting.Channels/ChannelServicesTest.cs
System.Runtime.Remoting.Contexts/SynchronizationAttributeTest.cs
System.Runtime.Serialization/FormatterServicesTests.cs
System.Runtime.Serialization/ObjectIDGeneratorTests.cs
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches