From commits-return-17-apmail-logging-commits-archive=logging.apache.org@logging.apache.org Mon Sep 5 15:49:18 2011 Return-Path: X-Original-To: apmail-logging-commits-archive@minotaur.apache.org Delivered-To: apmail-logging-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 901508187 for ; Mon, 5 Sep 2011 15:49:18 +0000 (UTC) Received: (qmail 17157 invoked by uid 500); 5 Sep 2011 15:49:18 -0000 Delivered-To: apmail-logging-commits-archive@logging.apache.org Received: (qmail 17137 invoked by uid 500); 5 Sep 2011 15:49:18 -0000 Mailing-List: contact commits-help@logging.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@logging.apache.org Delivered-To: mailing list commits@logging.apache.org Received: (qmail 17130 invoked by uid 99); 5 Sep 2011 15:49:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Sep 2011 15:49:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Sep 2011 15:49:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5C55823889B3; Mon, 5 Sep 2011 15:48:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1165341 - in /logging/log4net/trunk/src: Appender/ Config/ Core/ Plugin/ Util/ Util/PatternStringConverters/ Date: Mon, 05 Sep 2011 15:48:51 -0000 To: commits@logging.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110905154852.5C55823889B3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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. /// /// - 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. /// /// - 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 /// - and . /// /// +#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 /// must be called again. /// /// - 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. /// /// - 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 /// /// - 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. /// /// - 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 /// /// - 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 /// must be called again. /// /// - 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 class. /// /// - 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 /// /// Release the handles held by the watcher and timer. /// +#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. /// /// +#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. /// /// - 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 null. /// /// - 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. /// - 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. /// - 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 FormatMessage function. /// /// - 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 FormatMessage function. /// /// - 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 . /// /// - 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 provided. /// /// +#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. /// /// - 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.