logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1165341 - in /logging/log4net/trunk/src: Appender/ Config/ Core/ Plugin/ Util/ Util/PatternStringConverters/
Date Mon, 05 Sep 2011 15:48:51 GMT
Author: bodewig
Date: Mon Sep  5 15:48:51 2011
New Revision: 1165341

URL: http://svn.apache.org/viewvc?rev=1165341&view=rev
Log:
Throw in a bunch of Security(Safe)Critical attributes to hopefully satisfy the security transparency
system of .NET 4.0

Modified:
    logging/log4net/trunk/src/Appender/ColoredConsoleAppender.cs
    logging/log4net/trunk/src/Appender/FileAppender.cs
    logging/log4net/trunk/src/Appender/LocalSyslogAppender.cs
    logging/log4net/trunk/src/Appender/NetSendAppender.cs
    logging/log4net/trunk/src/Appender/OutputDebugStringAppender.cs
    logging/log4net/trunk/src/Appender/RemotingAppender.cs
    logging/log4net/trunk/src/Config/XmlConfigurator.cs
    logging/log4net/trunk/src/Core/LoggingEvent.cs
    logging/log4net/trunk/src/Plugin/RemoteLoggingServerPlugin.cs
    logging/log4net/trunk/src/Util/LogicalThreadContextProperties.cs
    logging/log4net/trunk/src/Util/NativeError.cs
    logging/log4net/trunk/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs
    logging/log4net/trunk/src/Util/ReadOnlyPropertiesDictionary.cs
    logging/log4net/trunk/src/Util/WindowsSecurityContext.cs

Modified: logging/log4net/trunk/src/Appender/ColoredConsoleAppender.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Appender/ColoredConsoleAppender.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Appender/ColoredConsoleAppender.cs (original)
+++ logging/log4net/trunk/src/Appender/ColoredConsoleAppender.cs Mon Sep  5 15:48:51 2011
@@ -265,7 +265,11 @@ namespace log4net.Appender
 		/// The format of the output will depend on the appender's layout.
 		/// </para>
 		/// </remarks>
-		override protected void Append(log4net.Core.LoggingEvent loggingEvent) 
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand,
UnmanagedCode = true)]
+        override protected void Append(log4net.Core.LoggingEvent loggingEvent) 
 		{
 			if (m_consoleOutputWriter != null)
 			{
@@ -430,7 +434,11 @@ namespace log4net.Appender
 		/// Initialize the level to color mappings set on this appender.
 		/// </para>
 		/// </remarks>
-		public override void ActivateOptions()
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand,
UnmanagedCode=true)]
+        public override void ActivateOptions()
 		{
 			base.ActivateOptions();
 			m_levelMapping.ActivateOptions();

Modified: logging/log4net/trunk/src/Appender/FileAppender.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Appender/FileAppender.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Appender/FileAppender.cs (original)
+++ logging/log4net/trunk/src/Appender/FileAppender.cs Mon Sep  5 15:48:51 2011
@@ -607,6 +607,9 @@ namespace log4net.Appender
             /// -<see cref="ReleaseLock"/> and <see cref="CloseFile"/>.
             /// </para>
             /// </remarks>
+#if NET_4_0
+            [System.Security.SecuritySafeCritical]
+#endif
             public override void OpenFile(string filename, bool append, Encoding encoding)
             {
                 try

Modified: logging/log4net/trunk/src/Appender/LocalSyslogAppender.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Appender/LocalSyslogAppender.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Appender/LocalSyslogAppender.cs (original)
+++ logging/log4net/trunk/src/Appender/LocalSyslogAppender.cs Mon Sep  5 15:48:51 2011
@@ -337,7 +337,10 @@ namespace log4net.Appender 
 		/// <see cref="ActivateOptions"/> must be called again.
 		/// </para>
 		/// </remarks>
-		public override void ActivateOptions()
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        public override void ActivateOptions()
 		{
 			base.ActivateOptions();
 			
@@ -375,7 +378,11 @@ namespace log4net.Appender 
 		/// The format of the output will depend on the appender's layout.
 		/// </para>
 		/// </remarks>
-		protected override void Append(LoggingEvent loggingEvent) 
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand,
UnmanagedCode = true)]
+        protected override void Append(LoggingEvent loggingEvent) 
 		{
 			int priority = GeneratePriority(m_facility, GetSeverity(loggingEvent.Level));
 			string message = RenderLoggingEvent(loggingEvent);
@@ -393,7 +400,10 @@ namespace log4net.Appender 
 		/// Close the syslog when the appender is closed
 		/// </para>
 		/// </remarks>
-		protected override void OnClose()
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        protected override void OnClose()
 		{
 			base.OnClose();
 

Modified: logging/log4net/trunk/src/Appender/NetSendAppender.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Appender/NetSendAppender.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Appender/NetSendAppender.cs (original)
+++ logging/log4net/trunk/src/Appender/NetSendAppender.cs Mon Sep  5 15:48:51 2011
@@ -304,7 +304,11 @@ namespace log4net.Appender 
 		/// Sends the event using a network message.
 		/// </para>
 		/// </remarks>
-		protected override void Append(LoggingEvent loggingEvent) 
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand,
UnmanagedCode = true)]
+        protected override void Append(LoggingEvent loggingEvent) 
 		{
 			NativeError nativeError = null;
 

Modified: logging/log4net/trunk/src/Appender/OutputDebugStringAppender.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Appender/OutputDebugStringAppender.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Appender/OutputDebugStringAppender.cs (original)
+++ logging/log4net/trunk/src/Appender/OutputDebugStringAppender.cs Mon Sep  5 15:48:51 2011
@@ -75,7 +75,11 @@ namespace log4net.Appender
 		/// Write the logging event to the output debug string API
 		/// </para>
 		/// </remarks>
-		override protected void Append(LoggingEvent loggingEvent) 
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand,
UnmanagedCode = true)]
+        override protected void Append(LoggingEvent loggingEvent) 
 		{
 			OutputDebugString(RenderLoggingEvent(loggingEvent));
 		} 

Modified: logging/log4net/trunk/src/Appender/RemotingAppender.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Appender/RemotingAppender.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Appender/RemotingAppender.cs (original)
+++ logging/log4net/trunk/src/Appender/RemotingAppender.cs Mon Sep  5 15:48:51 2011
@@ -138,7 +138,10 @@ namespace log4net.Appender
 		/// <see cref="ActivateOptions"/> must be called again.
 		/// </para>
 		/// </remarks>
-		override public void ActivateOptions() 
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        override public void ActivateOptions() 
 		{
 			base.ActivateOptions();
 

Modified: logging/log4net/trunk/src/Config/XmlConfigurator.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Config/XmlConfigurator.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Config/XmlConfigurator.cs (original)
+++ logging/log4net/trunk/src/Config/XmlConfigurator.cs Mon Sep  5 15:48:51 2011
@@ -963,7 +963,10 @@ namespace log4net.Config
 			/// Initializes a new instance of the <see cref="ConfigureAndWatchHandler" /> class.
 			/// </para>
 			/// </remarks>
-			public ConfigureAndWatchHandler(ILoggerRepository repository, FileInfo configFile)
+#if NET_4_0
+            [System.Security.SecuritySafeCritical]
+#endif
+            public ConfigureAndWatchHandler(ILoggerRepository repository, FileInfo configFile)
 			{
 				m_repository = repository;
 				m_configFile = configFile;
@@ -1040,6 +1043,9 @@ namespace log4net.Config
             /// <summary>
             /// Release the handles held by the watcher and timer.
             /// </summary>
+#if NET_4_0
+            [System.Security.SecuritySafeCritical]
+#endif
             public void Dispose()
             {
                 m_watcher.EnableRaisingEvents = false;

Modified: logging/log4net/trunk/src/Core/LoggingEvent.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Core/LoggingEvent.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Core/LoggingEvent.cs (original)
+++ logging/log4net/trunk/src/Core/LoggingEvent.cs Mon Sep  5 15:48:51 2011
@@ -1013,7 +1013,11 @@ namespace log4net.Core
 		/// is to be used outside that method.
 		/// </para>
 		/// </remarks>
+#if NET_4_0
+        [System.Security.SecurityCritical]
+#else
 		[System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand,
SerializationFormatter=true)]
+#endif
 		public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
 		{
 			// The caller must call FixVolatileData before this object

Modified: logging/log4net/trunk/src/Plugin/RemoteLoggingServerPlugin.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Plugin/RemoteLoggingServerPlugin.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Plugin/RemoteLoggingServerPlugin.cs (original)
+++ logging/log4net/trunk/src/Plugin/RemoteLoggingServerPlugin.cs Mon Sep  5 15:48:51 2011
@@ -145,7 +145,10 @@ namespace log4net.Plugin
 		/// sink is disconnected.
 		/// </para>
 		/// </remarks>
-		override public void Shutdown()
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        override public void Shutdown()
 		{
 			// Stops the sink from receiving messages
 			RemotingServices.Disconnect(m_sink);
@@ -247,7 +250,10 @@ namespace log4net.Plugin
 			/// therefore this implementation returns <c>null</c>.
 			/// </para>
 			/// </remarks>
-			public override object InitializeLifetimeService()
+#if NET_4_0
+            [System.Security.SecurityCritical]
+#endif
+            public override object InitializeLifetimeService()
 			{
 				return null;
 			}

Modified: logging/log4net/trunk/src/Util/LogicalThreadContextProperties.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/LogicalThreadContextProperties.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/LogicalThreadContextProperties.cs (original)
+++ logging/log4net/trunk/src/Util/LogicalThreadContextProperties.cs Mon Sep  5 15:48:51 2011
@@ -203,7 +203,10 @@ namespace log4net.Util
 		/// security link demand, therfore we must put the method call in a seperate method
 		/// that we can wrap in an exception handler.
 		/// </remarks>
-		private static PropertiesDictionary GetCallContextData()
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        private static PropertiesDictionary GetCallContextData()
 		{
 			return CallContext.GetData(c_SlotName) as PropertiesDictionary;
 		}
@@ -217,7 +220,10 @@ namespace log4net.Util
 		/// security link demand, therfore we must put the method call in a seperate method
 		/// that we can wrap in an exception handler.
 		/// </remarks>
-		private static void SetCallContextData(PropertiesDictionary properties)
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        private static void SetCallContextData(PropertiesDictionary properties)
 		{
 			CallContext.SetData(c_SlotName, properties);
         }

Modified: logging/log4net/trunk/src/Util/NativeError.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/NativeError.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/NativeError.cs (original)
+++ logging/log4net/trunk/src/Util/NativeError.cs Mon Sep  5 15:48:51 2011
@@ -114,7 +114,11 @@ namespace log4net.Util 
 		/// native Win32 <c>FormatMessage</c> function.
 		/// </para>
 		/// </remarks>
-		public static NativeError GetLastError() 
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand,
UnmanagedCode=true)]
+        public static NativeError GetLastError() 
 		{
 			int number = Marshal.GetLastWin32Error();
 			return new NativeError(number, NativeError.GetErrorMessage(number));
@@ -152,7 +156,11 @@ namespace log4net.Util 
 		/// using the native <c>FormatMessage</c> function.
 		/// </para>
 		/// </remarks>
-		public static string GetErrorMessage(int messageId) 
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand,
UnmanagedCode = true)]
+        public static string GetErrorMessage(int messageId) 
 		{
 			// Win32 constants
 			int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100;	// The function should allocates a buffer
large enough to hold the formatted message

Modified: logging/log4net/trunk/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs (original)
+++ logging/log4net/trunk/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs Mon
Sep  5 15:48:51 2011
@@ -46,7 +46,10 @@ namespace log4net.Util.PatternStringConv
 		/// Write the current process ID to the output <paramref name="writer"/>.
 		/// </para>
 		/// </remarks>
-		override protected void Convert(TextWriter writer, object state) 
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        override protected void Convert(TextWriter writer, object state) 
 		{
 #if (NETCF || SSCLI)
 			// On compact framework there is no System.Diagnostics.Process class

Modified: logging/log4net/trunk/src/Util/ReadOnlyPropertiesDictionary.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/ReadOnlyPropertiesDictionary.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/ReadOnlyPropertiesDictionary.cs (original)
+++ logging/log4net/trunk/src/Util/ReadOnlyPropertiesDictionary.cs Mon Sep  5 15:48:51 2011
@@ -203,8 +203,12 @@ namespace log4net.Util
 		/// Serializes this object into the <see cref="SerializationInfo" /> provided.
 		/// </para>
 		/// </remarks>
+#if NET_4_0
+        [System.Security.SecurityCritical]
+#else
 		[System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand,
SerializationFormatter=true)]
-		public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
+#endif
+        public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
 		{
 			foreach(DictionaryEntry entry in InnerHashtable)
 			{

Modified: logging/log4net/trunk/src/Util/WindowsSecurityContext.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/WindowsSecurityContext.cs?rev=1165341&r1=1165340&r2=1165341&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/WindowsSecurityContext.cs (original)
+++ logging/log4net/trunk/src/Util/WindowsSecurityContext.cs Mon Sep  5 15:48:51 2011
@@ -275,7 +275,11 @@ namespace log4net.Util
 		/// token is used to initialize the WindowsIdentity.
 		/// </para>
 		/// </remarks>
-		private static WindowsIdentity LogonUser(string userName, string domainName, string password)
+#if NET_4_0
+        [System.Security.SecuritySafeCritical]
+#endif
+        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand,
UnmanagedCode = true)]
+        private static WindowsIdentity LogonUser(string userName, string domainName, string
password)
 		{
 			const int LOGON32_PROVIDER_DEFAULT = 0;
 			//This parameter causes LogonUser to create a primary token.



Mime
View raw message