diff options
332 files changed, 7242 insertions, 1642 deletions
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog index e0aaa445669..38f5670f638 100644 --- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog +++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog @@ -1,3 +1,13 @@ +2004-10-05 Anirban Bhattacharjee <banirban@novell.com> + * Interaction.cs: + * Strings.cs : + Few important fixes + +2004-07-22 Jambunathan K <kjambunathan@novell.com> + + * Constants.cs: Fixed definitions of vbCr, vbLf, vbCrLf and + vbNewLine + 2004-06-24 Jambunathan K <kjambunathan@novell.com> * RandomVBFile.cs: Fixed FileGet() for Date and Decimal types * FileSystem.cs: Fixed ChDir, FileCopy diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Constants.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Constants.cs index 310051ccf03..16fc0d5da8f 100644 --- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Constants.cs +++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Constants.cs @@ -1,11 +1,11 @@ -//
-// Constants.cs
-//
-// Author:
-// Chris J Breisch (cjbreisch@altavista.net)
-//
-// (C) 2002 Chris J Breisch
-//
+// +// Constants.cs +// +// Author: +// Chris J Breisch (cjbreisch@altavista.net) +// +// (C) 2002 Chris J Breisch +// // // Copyright (c) 2002-2003 Mainsoft Corporation. @@ -30,131 +30,131 @@ // 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;
-
-namespace Microsoft.VisualBasic {
- [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
- sealed public class Constants {
- // Declarations
- public const System.Int32 vbObjectError = (System.Int32)(-2147221504);
- public const System.String vbCrLf = "\n\r";
- public const System.String vbNewLine = "\n\r";
- public const System.String vbCr = "\n";
- public const System.String vbLf = "\r";
- public const System.String vbBack = "\b";
- public const System.String vbFormFeed = "\f";
- public const System.String vbTab = "\t";
- public const System.String vbVerticalTab = "\v";
- public const System.String vbNullChar = "\0";
- public const System.String vbNullString = "";
-
- public const AppWinStyle vbHide = AppWinStyle.Hide;
- public const AppWinStyle vbNormalFocus = AppWinStyle.NormalFocus;
- public const AppWinStyle vbMinimizedFocus = AppWinStyle.MinimizedFocus;
- public const AppWinStyle vbMaximizedFocus = AppWinStyle.MaximizedFocus;
- public const AppWinStyle vbNormalNoFocus = AppWinStyle.NormalNoFocus;
- public const AppWinStyle vbMinimizedNoFocus = AppWinStyle.MinimizedNoFocus;
-
- public const CallType vbMethod = CallType.Method;
- public const CallType vbGet = CallType.Get;
- public const CallType vbLet = CallType.Let;
- public const CallType vbSet = CallType.Set;
-
- public const CompareMethod vbBinaryCompare = CompareMethod.Binary;
- public const CompareMethod vbTextCompare = CompareMethod.Text;
-
- public const DateFormat vbGeneralDate = DateFormat.GeneralDate;
- public const DateFormat vbLongDate = DateFormat.LongDate;
- public const DateFormat vbShortDate = DateFormat.ShortDate;
- public const DateFormat vbLongTime = DateFormat.LongTime;
- public const DateFormat vbShortTime = DateFormat.ShortTime;
-
- public const FirstDayOfWeek vbUseSystemDayOfWeek = FirstDayOfWeek.System;
- public const FirstDayOfWeek vbSunday = FirstDayOfWeek.Sunday;
- public const FirstDayOfWeek vbMonday = FirstDayOfWeek.Monday;
- public const FirstDayOfWeek vbTuesday = FirstDayOfWeek.Tuesday;
- public const FirstDayOfWeek vbWednesday = FirstDayOfWeek.Wednesday;
- public const FirstDayOfWeek vbThursday = FirstDayOfWeek.Thursday;
- public const FirstDayOfWeek vbFriday = FirstDayOfWeek.Friday;
- public const FirstDayOfWeek vbSaturday = FirstDayOfWeek.Saturday;
-
- public const FileAttribute vbNormal = FileAttribute.Normal;
- public const FileAttribute vbReadOnly = FileAttribute.ReadOnly;
- public const FileAttribute vbHidden = FileAttribute.Hidden;
- public const FileAttribute vbSystem = FileAttribute.System;
- public const FileAttribute vbVolume = FileAttribute.Volume;
- public const FileAttribute vbDirectory = FileAttribute.Directory;
- public const FileAttribute vbArchive = FileAttribute.Archive;
-
- public const FirstWeekOfYear vbUseSystem = FirstWeekOfYear.System;
- public const FirstWeekOfYear vbFirstJan1 = FirstWeekOfYear.Jan1;
- public const FirstWeekOfYear vbFirstFourDays = FirstWeekOfYear.FirstFourDays;
- public const FirstWeekOfYear vbFirstFullWeek = FirstWeekOfYear.FirstFullWeek;
-
- public const VbStrConv vbUpperCase = VbStrConv.UpperCase;
- public const VbStrConv vbLowerCase = VbStrConv.LowerCase;
- public const VbStrConv vbProperCase = VbStrConv.ProperCase;
- public const VbStrConv vbWide = VbStrConv.Wide;
- public const VbStrConv vbNarrow = VbStrConv.Narrow;
- public const VbStrConv vbKatakana = VbStrConv.Katakana;
- public const VbStrConv vbHiragana = VbStrConv.Hiragana;
- public const VbStrConv vbSimplifiedChinese = VbStrConv.SimplifiedChinese;
- public const VbStrConv vbTraditionalChinese = VbStrConv.TraditionalChinese;
- public const VbStrConv vbLinguisticCasing = VbStrConv.LinguisticCasing;
-
- public const TriState vbUseDefault = TriState.UseDefault;
- public const TriState vbTrue = TriState.True;
- public const TriState vbFalse = TriState.False;
-
- public const VariantType vbEmpty = VariantType.Empty;
- public const VariantType vbNull = VariantType.Null;
- public const VariantType vbInteger = VariantType.Integer;
- public const VariantType vbLong = VariantType.Long;
- public const VariantType vbSingle = VariantType.Single;
- public const VariantType vbDouble = VariantType.Double;
- public const VariantType vbCurrency = VariantType.Currency;
- public const VariantType vbDate = VariantType.Date;
- public const VariantType vbString = VariantType.String;
- public const VariantType vbObject = VariantType.Object;
- public const VariantType vbBoolean = VariantType.Boolean;
- public const VariantType vbVariant = VariantType.Variant;
- public const VariantType vbDecimal = VariantType.Decimal;
- public const VariantType vbByte = VariantType.Byte;
- public const VariantType vbUserDefinedType = VariantType.UserDefinedType;
- public const VariantType vbArray = VariantType.Array;
-
- public const MsgBoxResult vbOK = MsgBoxResult.OK;
- public const MsgBoxResult vbCancel = MsgBoxResult.Cancel;
- public const MsgBoxResult vbAbort = MsgBoxResult.Abort;
- public const MsgBoxResult vbRetry = MsgBoxResult.Retry;
- public const MsgBoxResult vbIgnore = MsgBoxResult.Ignore;
- public const MsgBoxResult vbYes = MsgBoxResult.Yes;
- public const MsgBoxResult vbNo = MsgBoxResult.No;
-
- public const MsgBoxStyle vbOKOnly = MsgBoxStyle.OKOnly;
- public const MsgBoxStyle vbOKCancel = MsgBoxStyle.OKCancel;
- public const MsgBoxStyle vbAbortRetryIgnore = MsgBoxStyle.AbortRetryIgnore;
- public const MsgBoxStyle vbYesNoCancel = MsgBoxStyle.YesNoCancel;
- public const MsgBoxStyle vbYesNo = MsgBoxStyle.YesNo;
- public const MsgBoxStyle vbRetryCancel = MsgBoxStyle.RetryCancel;
- public const MsgBoxStyle vbCritical = MsgBoxStyle.Critical;
- public const MsgBoxStyle vbQuestion = MsgBoxStyle.Question;
- public const MsgBoxStyle vbExclamation = MsgBoxStyle.Exclamation;
- public const MsgBoxStyle vbInformation = MsgBoxStyle.Information;
- public const MsgBoxStyle vbDefaultButton1 = MsgBoxStyle.DefaultButton1;
- public const MsgBoxStyle vbDefaultButton2 = MsgBoxStyle.DefaultButton2;
- public const MsgBoxStyle vbDefaultButton3 = MsgBoxStyle.DefaultButton3;
- public const MsgBoxStyle vbApplicationModal = MsgBoxStyle.ApplicationModal;
- public const MsgBoxStyle vbSystemModal = MsgBoxStyle.SystemModal;
- public const MsgBoxStyle vbMsgBoxHelp = MsgBoxStyle.MsgBoxHelp;
- public const MsgBoxStyle vbMsgBoxRight = MsgBoxStyle.MsgBoxRight;
- public const MsgBoxStyle vbMsgBoxRtlReading = MsgBoxStyle.MsgBoxRtlReading;
- public const MsgBoxStyle vbMsgBoxSetForeground = MsgBoxStyle.MsgBoxSetForeground;
-
- // Constructors
- // Properties
- // Methods
- // Events
- };
-}
+ +using System; + +namespace Microsoft.VisualBasic { + [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute] + sealed public class Constants { + // Declarations + public const System.Int32 vbObjectError = (System.Int32)(-2147221504); + public const System.String vbCrLf = "\r\n"; + public const System.String vbNewLine = "\r\n"; + public const System.String vbCr = "\r"; + public const System.String vbLf = "\n"; + public const System.String vbBack = "\b"; + public const System.String vbFormFeed = "\f"; + public const System.String vbTab = "\t"; + public const System.String vbVerticalTab = "\v"; + public const System.String vbNullChar = "\0"; + public const System.String vbNullString = ""; + + public const AppWinStyle vbHide = AppWinStyle.Hide; + public const AppWinStyle vbNormalFocus = AppWinStyle.NormalFocus; + public const AppWinStyle vbMinimizedFocus = AppWinStyle.MinimizedFocus; + public const AppWinStyle vbMaximizedFocus = AppWinStyle.MaximizedFocus; + public const AppWinStyle vbNormalNoFocus = AppWinStyle.NormalNoFocus; + public const AppWinStyle vbMinimizedNoFocus = AppWinStyle.MinimizedNoFocus; + + public const CallType vbMethod = CallType.Method; + public const CallType vbGet = CallType.Get; + public const CallType vbLet = CallType.Let; + public const CallType vbSet = CallType.Set; + + public const CompareMethod vbBinaryCompare = CompareMethod.Binary; + public const CompareMethod vbTextCompare = CompareMethod.Text; + + public const DateFormat vbGeneralDate = DateFormat.GeneralDate; + public const DateFormat vbLongDate = DateFormat.LongDate; + public const DateFormat vbShortDate = DateFormat.ShortDate; + public const DateFormat vbLongTime = DateFormat.LongTime; + public const DateFormat vbShortTime = DateFormat.ShortTime; + + public const FirstDayOfWeek vbUseSystemDayOfWeek = FirstDayOfWeek.System; + public const FirstDayOfWeek vbSunday = FirstDayOfWeek.Sunday; + public const FirstDayOfWeek vbMonday = FirstDayOfWeek.Monday; + public const FirstDayOfWeek vbTuesday = FirstDayOfWeek.Tuesday; + public const FirstDayOfWeek vbWednesday = FirstDayOfWeek.Wednesday; + public const FirstDayOfWeek vbThursday = FirstDayOfWeek.Thursday; + public const FirstDayOfWeek vbFriday = FirstDayOfWeek.Friday; + public const FirstDayOfWeek vbSaturday = FirstDayOfWeek.Saturday; + + public const FileAttribute vbNormal = FileAttribute.Normal; + public const FileAttribute vbReadOnly = FileAttribute.ReadOnly; + public const FileAttribute vbHidden = FileAttribute.Hidden; + public const FileAttribute vbSystem = FileAttribute.System; + public const FileAttribute vbVolume = FileAttribute.Volume; + public const FileAttribute vbDirectory = FileAttribute.Directory; + public const FileAttribute vbArchive = FileAttribute.Archive; + + public const FirstWeekOfYear vbUseSystem = FirstWeekOfYear.System; + public const FirstWeekOfYear vbFirstJan1 = FirstWeekOfYear.Jan1; + public const FirstWeekOfYear vbFirstFourDays = FirstWeekOfYear.FirstFourDays; + public const FirstWeekOfYear vbFirstFullWeek = FirstWeekOfYear.FirstFullWeek; + + public const VbStrConv vbUpperCase = VbStrConv.UpperCase; + public const VbStrConv vbLowerCase = VbStrConv.LowerCase; + public const VbStrConv vbProperCase = VbStrConv.ProperCase; + public const VbStrConv vbWide = VbStrConv.Wide; + public const VbStrConv vbNarrow = VbStrConv.Narrow; + public const VbStrConv vbKatakana = VbStrConv.Katakana; + public const VbStrConv vbHiragana = VbStrConv.Hiragana; + public const VbStrConv vbSimplifiedChinese = VbStrConv.SimplifiedChinese; + public const VbStrConv vbTraditionalChinese = VbStrConv.TraditionalChinese; + public const VbStrConv vbLinguisticCasing = VbStrConv.LinguisticCasing; + + public const TriState vbUseDefault = TriState.UseDefault; + public const TriState vbTrue = TriState.True; + public const TriState vbFalse = TriState.False; + + public const VariantType vbEmpty = VariantType.Empty; + public const VariantType vbNull = VariantType.Null; + public const VariantType vbInteger = VariantType.Integer; + public const VariantType vbLong = VariantType.Long; + public const VariantType vbSingle = VariantType.Single; + public const VariantType vbDouble = VariantType.Double; + public const VariantType vbCurrency = VariantType.Currency; + public const VariantType vbDate = VariantType.Date; + public const VariantType vbString = VariantType.String; + public const VariantType vbObject = VariantType.Object; + public const VariantType vbBoolean = VariantType.Boolean; + public const VariantType vbVariant = VariantType.Variant; + public const VariantType vbDecimal = VariantType.Decimal; + public const VariantType vbByte = VariantType.Byte; + public const VariantType vbUserDefinedType = VariantType.UserDefinedType; + public const VariantType vbArray = VariantType.Array; + + public const MsgBoxResult vbOK = MsgBoxResult.OK; + public const MsgBoxResult vbCancel = MsgBoxResult.Cancel; + public const MsgBoxResult vbAbort = MsgBoxResult.Abort; + public const MsgBoxResult vbRetry = MsgBoxResult.Retry; + public const MsgBoxResult vbIgnore = MsgBoxResult.Ignore; + public const MsgBoxResult vbYes = MsgBoxResult.Yes; + public const MsgBoxResult vbNo = MsgBoxResult.No; + + public const MsgBoxStyle vbOKOnly = MsgBoxStyle.OKOnly; + public const MsgBoxStyle vbOKCancel = MsgBoxStyle.OKCancel; + public const MsgBoxStyle vbAbortRetryIgnore = MsgBoxStyle.AbortRetryIgnore; + public const MsgBoxStyle vbYesNoCancel = MsgBoxStyle.YesNoCancel; + public const MsgBoxStyle vbYesNo = MsgBoxStyle.YesNo; + public const MsgBoxStyle vbRetryCancel = MsgBoxStyle.RetryCancel; + public const MsgBoxStyle vbCritical = MsgBoxStyle.Critical; + public const MsgBoxStyle vbQuestion = MsgBoxStyle.Question; + public const MsgBoxStyle vbExclamation = MsgBoxStyle.Exclamation; + public const MsgBoxStyle vbInformation = MsgBoxStyle.Information; + public const MsgBoxStyle vbDefaultButton1 = MsgBoxStyle.DefaultButton1; + public const MsgBoxStyle vbDefaultButton2 = MsgBoxStyle.DefaultButton2; + public const MsgBoxStyle vbDefaultButton3 = MsgBoxStyle.DefaultButton3; + public const MsgBoxStyle vbApplicationModal = MsgBoxStyle.ApplicationModal; + public const MsgBoxStyle vbSystemModal = MsgBoxStyle.SystemModal; + public const MsgBoxStyle vbMsgBoxHelp = MsgBoxStyle.MsgBoxHelp; + public const MsgBoxStyle vbMsgBoxRight = MsgBoxStyle.MsgBoxRight; + public const MsgBoxStyle vbMsgBoxRtlReading = MsgBoxStyle.MsgBoxRtlReading; + public const MsgBoxStyle vbMsgBoxSetForeground = MsgBoxStyle.MsgBoxSetForeground; + + // Constructors + // Properties + // Methods + // Events + }; +} diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs index d042be15f78..4d2b278201b 100644 --- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs +++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs @@ -352,7 +352,7 @@ namespace Microsoft.VisualBasic { string [] args = Environment.GetCommandLineArgs (); if (args != null && args.Length > 1) { - return string.Join (" ", args, 2, args.Length - 1); + return string.Join (" ", args, 1, args.Length - 1); } else { return ""; } diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs index ae8f92d88ba..86c558eeed8 100644 --- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs +++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs @@ -401,7 +401,21 @@ namespace Microsoft.VisualBasic } break; default: - returnstr=Convert.ToDouble(expression).ToString (style); + if (style.IndexOf("X") != -1 + || style.IndexOf("x") != -1 ) { + returnstr = Microsoft.VisualBasic.Conversion.Hex(Convert.ToInt64(expression)); + } + else + try + { + returnstr=Convert.ToDouble(expression).ToString (style); + } + catch (Exception ex){ + style = "0" + style; + returnstr=Convert.ToDouble(expression).ToString (style); + } + + break; } break; @@ -694,6 +708,7 @@ namespace Microsoft.VisualBasic return InStr(1, String1, String2, Compare); } + /// <summary> /// Returns an integer specifying the start position of the first occurrence of one string within another. /// </summary> @@ -826,17 +841,22 @@ namespace Microsoft.VisualBasic [DefaultValue(" ")] string Delimiter) { + try + { + if (SourceArray == null) + throw new ArgumentException("Argument 'SourceArray' can not be null.", "SourceArray"); + if (SourceArray.Rank > 1) + throw new ArgumentException("Argument 'SourceArray' can have only one dimension.", "SourceArray"); - if (SourceArray == null) - throw new ArgumentException("Argument 'SourceArray' can not be null.", "SourceArray"); - if (SourceArray.Rank > 1) - throw new ArgumentException("Argument 'SourceArray' can have only one dimension.", "SourceArray"); - - string[] dest; - dest = new string[SourceArray.Length]; + string[] dest; + dest = new string[SourceArray.Length]; - SourceArray.CopyTo(dest, 0); - return string.Join(Delimiter, dest); + SourceArray.CopyTo(dest, 0); + return string.Join(Delimiter, dest); + } + catch (System.InvalidCastException ie){ + throw new System.ArgumentException("Invalid argument"); + } } /// <summary> @@ -854,8 +874,8 @@ namespace Microsoft.VisualBasic /// <param name="Value">Required. Any valid String or Char expression.</param> public static string LCase(string Value) { - if ((Value == null) || (Value.Length == 0)) - return String.Empty; // VB.net does this. + if ((Value == null) || (Value.Length == 0)) + return Value; // comparing nunit test results say this is an exception to the return String.Empty rule return Value.ToLower(); } @@ -865,16 +885,18 @@ namespace Microsoft.VisualBasic /// Returns a string containing a specified number of characters from the left side of a string. /// </summary> /// <param name="Str">Required. String expression from which the leftmost characters are returned.</param> - /// <param name="Length">Required. Integer expression. Numeric expression indicating how many characters to return. If 0, a zero-length string ("") is returned. If greater than or equal to the number of characters in Str, the entire string is returned.</param> - public static string Left(string Str, - int Length) + /// <param name="Length">Required. Integer expression. Numeric expression indicating how many characters to return. + /// If 0, a zero-length string ("") is returned. If greater than or equal to the number of characters in Str, + /// the entire string is returned.</param> + public static string Left(string Str, int Length) { if (Length < 0) throw new ArgumentException("Argument 'Length' must be non-negative.", "Length"); - if ((Str == null) || (Str.Length == 0)) + if ((Str == null) || (Str.Length == 0) || Length == 0) return String.Empty; // VB.net does this. - - return Str.Substring(0, Length); + if (Length < Str.Length) + return Str.Substring(0, Length); + return Str; } /// <summary> @@ -1202,16 +1224,16 @@ namespace Microsoft.VisualBasic /// </summary> /// <param name="Source">Required. String expression. Name of string variable.</param> /// <param name="Length">Required. Integer expression. Length of returned string.</param> - public static string RSet(string Source, - int Length) + public static string RSet(string Source, int Length) { if (Source == null) Source = String.Empty; if (Length < 0) throw new ArgumentOutOfRangeException("Length", "Length must be non-negative."); - - return Source.PadLeft(Length); + if (Length > Source.Length) + return Source.PadLeft(Length); + return Source.Substring(0, Length); } /// <summary> @@ -1235,7 +1257,7 @@ namespace Microsoft.VisualBasic /// <param name="Compare">Optional. Numeric value indicating the comparison to use when evaluating substrings. See Settings for values.</param> public static string[] Split(string Expression, [Optional] - [DefaultValue(" ")] + [DefaultValue("")] string Delimiter, [Optional] [DefaultValue(-1)] @@ -1245,30 +1267,37 @@ namespace Microsoft.VisualBasic [DefaultValue(CompareMethod.Binary)] CompareMethod Compare) { - - if (Expression == null) return new string[1]; - if ((Delimiter == null) || (Delimiter.Length == 0)) - { + if ((Delimiter == null) || (Delimiter.Length == 0)) { string [] ret = new string[1]; ret[0] = Expression; return ret; } if (Limit == 0) Limit = 1; - - if (Limit < -1) + else if (Limit < -1) throw new OverflowException("Arithmetic operation resulted in an overflow."); - switch (Compare) - { - case CompareMethod.Binary: - return Expression.Split(Delimiter.ToCharArray(0, 1), Limit); - case CompareMethod.Text: - return Expression.Split(Delimiter.ToCharArray(0, 1), Limit); - default: - throw new System.ArgumentException("Argument 'Compare' must be CompareMethod.Binary or CompareMethod.Text.", "Compare"); + + if (Limit != -1) { + switch (Compare){ + case CompareMethod.Binary: + return Expression.Split(Delimiter.ToCharArray(0, 1), Limit); + case CompareMethod.Text: + return Expression.Split(Delimiter.ToCharArray(0, 1), Limit); + default: + throw new System.ArgumentException("Argument 'Compare' must be CompareMethod.Binary or CompareMethod.Text.", "Compare"); + } + } else { + switch (Compare) { + case CompareMethod.Binary: + return Expression.Split(Delimiter.ToCharArray(0, 1)); + case CompareMethod.Text: + return Expression.Split(Delimiter.ToCharArray(0, 1)); + default: + throw new System.ArgumentException("Argument 'Compare' must be CompareMethod.Binary or CompareMethod.Text.", "Compare"); + } } } diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog index bcf7dd8b1f8..8b10478d15b 100644 --- a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog +++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog @@ -1,3 +1,6 @@ +2004-08-09 Sureshkumar T <tsureshkumar@novell.com> + * Tds70.cs - Prepare Method stored procedure handle read problem fixed. + 2004-04-22 Sebastien Pouliot <sebastien@ximian.com> * Tds70.cs: Updated to match changes in Mono.Security.dll. diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs index 0b55a30abe3..010283fb929 100644 --- a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs +++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs @@ -457,9 +457,9 @@ namespace Mono.Data.Tds.Protocol { parms.Add (new TdsMetaParameter ("@P3", "nvarchar", commandText)); ExecProc ("sp_prepare", parms, 0, true); - if (!NextResult () || !NextRow () || ColumnValues [0] == null || ColumnValues [0] == DBNull.Value) - throw new TdsInternalException (); SkipToEnd (); + if (ColumnValues [0] == null || ColumnValues [0] == DBNull.Value) + throw new TdsInternalException (); return ColumnValues [0].ToString (); } diff --git a/mcs/class/Mono.Posix/Mono.Posix.dll.sources b/mcs/class/Mono.Posix/Mono.Posix.dll.sources index cf4150a2efb..b426c78e14a 100644 --- a/mcs/class/Mono.Posix/Mono.Posix.dll.sources +++ b/mcs/class/Mono.Posix/Mono.Posix.dll.sources @@ -4,4 +4,5 @@ ./Mono.Posix/Syscall.cs ./Mono.Posix/MapAttribute.cs ./Mono.Posix/IncludeAttribute.cs -./Mono.Posix/Catalog.cs
\ No newline at end of file +./Mono.Posix/Catalog.cs +./Mono.Posix/PeerCred.cs diff --git a/mcs/class/Mono.Posix/Mono.Posix/ChangeLog b/mcs/class/Mono.Posix/Mono.Posix/ChangeLog index b6fd766afdc..c38db5ee850 100644 --- a/mcs/class/Mono.Posix/Mono.Posix/ChangeLog +++ b/mcs/class/Mono.Posix/Mono.Posix/ChangeLog @@ -1,3 +1,7 @@ +2004-07-09 Dick Porter <dick@ximian.com> + + * PeerCred.cs: Get the unix socket peer credentials. + 2004-05-26 Miguel de Icaza <miguel@ximian.com> * Syscall.cs: Do not let the runtime handle strings, as we do not diff --git a/mcs/class/Mono.Posix/Mono.Posix/PeerCred.cs b/mcs/class/Mono.Posix/Mono.Posix/PeerCred.cs new file mode 100644 index 00000000000..76071bcbca5 --- /dev/null +++ b/mcs/class/Mono.Posix/Mono.Posix/PeerCred.cs @@ -0,0 +1,78 @@ +// +// Mono.Posix.PeerCred: Peer credentials class for AF_UNIX sockets +// +// Authors: +// Dick Porter (dick@ximian.com) +// +// (C) 2004 Novell, Inc (http://www.novell.com) +// + +// +// 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.Net.Sockets; + +namespace Mono.Posix +{ + public class PeerCred + { + private struct PeerCredData { + public int pid; + public int uid; + public int gid; + } + + /* Make sure this doesn't clash with anything in + * SocketOptionName, and keep it synchronised with the + * runtime + */ + private const int so_peercred=10001; + private PeerCredData data; + + public PeerCred (Socket sock) { + if (sock.AddressFamily != AddressFamily.Unix) { + throw new ArgumentException ("Only Unix sockets are supported", "sock"); + } + + data = (PeerCredData)sock.GetSocketOption (SocketOptionLevel.Socket, (SocketOptionName)so_peercred); + } + + public int ProcessID { + get { + return(data.pid); + } + } + + public int UserID { + get { + return(data.uid); + } + } + + public int GroupID { + get { + return(data.gid); + } + } + } +} + diff --git a/mcs/class/Mono.Security/ChangeLog b/mcs/class/Mono.Security/ChangeLog index 236840ba508..6d00422c990 100644 --- a/mcs/class/Mono.Security/ChangeLog +++ b/mcs/class/Mono.Security/ChangeLog @@ -1,3 +1,7 @@ +2004-09-07 Sebastien Pouliot <sebastien@ximian.com> + + * Mono.Security_test.dll.sources: Merge new unit tests from HEAD. + 2004-05-11 Carlos Guzman Alvarez <carlosga@telefonica.net>
* Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs:
diff --git a/mcs/class/Mono.Security/Mono.Math/BigInteger.cs b/mcs/class/Mono.Security/Mono.Math/BigInteger.cs index 03658ef7ce2..1b976a38d02 100644 --- a/mcs/class/Mono.Security/Mono.Math/BigInteger.cs +++ b/mcs/class/Mono.Security/Mono.Math/BigInteger.cs @@ -12,7 +12,8 @@ // // Copyright (c) 2002 Chew Keong TAN // All rights reserved. - +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -169,6 +170,7 @@ namespace Mono.Math { public BigInteger () { data = new uint [DEFAULT_LEN]; + this.length = DEFAULT_LEN; } [CLSCompliant (false)] @@ -539,6 +541,9 @@ namespace Mono.Math { /// <param name="rng">A RNG.</param> public void Randomize (RandomNumberGenerator rng) { + if (this == 0) + return; + int bits = this.BitCount (); int dwords = bits >> 5; int remBits = bits & 0x1F; diff --git a/mcs/class/Mono.Security/Mono.Math/ChangeLog b/mcs/class/Mono.Security/Mono.Math/ChangeLog index c2241f882c5..08889552514 100644 --- a/mcs/class/Mono.Security/Mono.Math/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Math/ChangeLog @@ -1,3 +1,8 @@ +2004-10-25 Sebastien Pouliot <sebastien@ximian.com> + + * BigInteger.cs: Fix issue #68452 when Randomize was being called on a + 0 BigInteger (i.e. BitCount == 0). + 2005-05-07 Sebastien Pouliot <sebastien@ximian.com> * BigInteger.cs: Faster scan of smallPrimes in IsProbablePrime. diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs index 63fbab93a8c..c2d609ecec2 100755 --- a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs +++ b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs @@ -5,9 +5,7 @@ // Sebastien Pouliot <sebastien@ximian.com> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// (C) 2004 Novell (http://www.novell.com) -// - +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -58,63 +56,167 @@ namespace Mono.Security.Authenticode { public const string spcIndirectDataContext = "1.3.6.1.4.1.311.2.1.4"; - internal byte[] rawData; + private byte[] fileblock; + private FileStream fs; + private int blockNo; + private int blockLength; + private int peOffset; + private int dirSecurityOffset; + private int dirSecuritySize; public AuthenticodeBase () { + fileblock = new byte [4096]; } - protected byte[] HashFile (string fileName, string hashName) + internal void Open (string filename) { - FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read, FileShare.Read); - byte[] file = new byte [fs.Length]; - fs.Read (file, 0, file.Length); - fs.Close (); + if (fs != null) + Close (); + fs = new FileStream (filename, FileMode.Open, FileAccess.Read, FileShare.Read); + } - // MZ - DOS header - if (BitConverterLE.ToUInt16 (file, 0) != 0x5A4D) - return null; + internal void Close () + { + if (fs != null) { + fs.Close (); + fs = null; + blockNo = 0; + } + } - // find offset of PE header - int peOffset = BitConverterLE.ToInt32 (file, 60); - if (peOffset > file.Length) - return null; + internal bool ReadFirstBlock () + { + if (fs == null) + return false; + + fs.Position = 0; + // read first block - it will include (100% sure) + // the MZ header and (99.9% sure) the PE header + blockLength = fs.Read (fileblock, 0, fileblock.Length); + blockNo = 1; + if (blockLength < 64) + return false; // invalid PE file + + // 1. Validate the MZ header informations + // 1.1. Check for magic MZ at start of header + if (BitConverterLE.ToUInt16 (fileblock, 0) != 0x5A4D) + return false; + + // 1.2. Find the offset of the PE header + peOffset = BitConverterLE.ToInt32 (fileblock, 60); + if (peOffset > fileblock.Length) { + // just in case (0.1%) this can actually happen + string msg = String.Format (Locale.GetText ( + "Header size too big (> {0} bytes)."), + fileblock.Length); + throw new NotSupportedException (msg); + } + if (peOffset > fs.Length) + return false; - // PE - NT header - if (BitConverterLE.ToUInt16 (file, peOffset) != 0x4550) - return null; + // 2. Read between DOS header and first part of PE header + // 2.1. Check for magic PE at start of header + if (BitConverterLE.ToUInt16 (fileblock, peOffset) != 0x4550) + return false; - // IMAGE_DIRECTORY_ENTRY_SECURITY - int dirSecurityOffset = BitConverterLE.ToInt32 (file, peOffset + 152); - int dirSecuritySize = BitConverterLE.ToInt32 (file, peOffset + 156); + // 2.2. Locate IMAGE_DIRECTORY_ENTRY_SECURITY (offset and size) + dirSecurityOffset = BitConverterLE.ToInt32 (fileblock, peOffset + 152); + dirSecuritySize = BitConverterLE.ToInt32 (fileblock, peOffset + 156); + + return true; + } + + internal byte[] GetSecurityEntry () + { + if (blockNo < 1) + ReadFirstBlock (); if (dirSecuritySize > 8) { - rawData = new byte [dirSecuritySize - 8]; - Buffer.BlockCopy (file, dirSecurityOffset + 8, rawData, 0, rawData.Length); -/* DEBUG - FileStream debug = new FileStream (fileName + ".sig", FileMode.Create, FileAccess.Write); - debug.Write (rawData, 0, rawData.Length); - debug.Close ();*/ + // remove header from size (not ASN.1 based) + byte[] secEntry = new byte [dirSecuritySize - 8]; + // position after header and read entry + fs.Position = dirSecurityOffset + 8; + fs.Read (secEntry, 0, secEntry.Length); + return secEntry; + } + return null; + } + + // returns null if the file isn't signed + internal byte[] GetHash (HashAlgorithm hash) + { + if (blockNo < 1) + ReadFirstBlock (); + fs.Position = blockLength; + + // hash the rest of the file + long n = fs.Length - blockLength; + // minus any authenticode signature (with 8 bytes header) + if (dirSecurityOffset > 0) { + // it is also possible that the signature block + // starts within the block in memory (small EXE) + if (dirSecurityOffset < blockLength) { + blockLength = dirSecurityOffset; + n = 0; + } + else + n -= (dirSecuritySize); } - else - rawData = null; - HashAlgorithm hash = HashAlgorithm.Create (hashName); - // 0 to 215 (216) then skip 4 (checksum) + // Authenticode(r) gymnastics + // Hash from (generally) 0 to 215 (216 bytes) int pe = peOffset + 88; - hash.TransformBlock (file, 0, pe, file, 0); + hash.TransformBlock (fileblock, 0, pe, fileblock, 0); + // then skip 4 for checksum pe += 4; - // 220 to 279 (60) then skip 8 (IMAGE_DIRECTORY_ENTRY_SECURITY) - hash.TransformBlock (file, pe, 60, file, pe); + // Continue hashing from (generally) 220 to 279 (60 bytes) + hash.TransformBlock (fileblock, pe, 60, fileblock, pe); + // then skip 8 bytes for IMAGE_DIRECTORY_ENTRY_SECURITY pe += 68; - // 288 to end of file - int n = file.Length - pe; - // minus any authenticode signature (with 8 bytes header) - if (dirSecurityOffset != 0) - n -= (dirSecuritySize); - hash.TransformFinalBlock (file, pe, n); + // everything is present so start the hashing + if (n == 0) { + // hash the (only) block + hash.TransformFinalBlock (fileblock, pe, blockLength - pe); + } + else { + // hash the last part of the first (already in memory) block + hash.TransformBlock (fileblock, pe, blockLength - pe, fileblock, 0); + + // hash by blocks of 4096 bytes + long blocks = (n >> 12); + int remainder = (int)(n - (blocks << 12)); + if (remainder == 0) { + blocks--; + remainder = 4096; + } + // blocks + while (blocks-- > 0) { + fs.Read (fileblock, 0, fileblock.Length); + hash.TransformBlock (fileblock, 0, fileblock.Length, fileblock, 0); + } + // remainder + if (fs.Read (fileblock, 0, remainder) != remainder) + return null; + hash.TransformFinalBlock (fileblock, 0, remainder); + } return hash.Hash; } + + // for compatibility only + protected byte[] HashFile (string fileName, string hashName) + { + try { + Open (fileName); + HashAlgorithm hash = HashAlgorithm.Create (hashName); + byte[] result = GetHash (hash); + Close (); + return result; + } + catch { + return null; + } + } } } diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs index 4d30ea38aab..ea0bd30e242 100755 --- a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs +++ b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs @@ -5,9 +5,7 @@ // Sebastien Pouliot <sebastien@ximian.com> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// (C) 2004 Novell (http://www.novell.com) -// - +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -56,6 +54,9 @@ namespace Mono.Security.Authenticode { private DateTime timestamp; private X509Certificate signingCertificate; private int reason; + private bool trustedRoot; + private bool trustedTimestampRoot; + private byte[] entry; private X509Chain signerChain; private X509Chain timestampChain; @@ -69,17 +70,20 @@ namespace Mono.Security.Authenticode { public AuthenticodeDeformatter (string fileName) : this () { - if (!CheckSignature (fileName)) { - // invalid or no signature - if (signedHash != null) - throw new COMException ("Invalid signature"); - // no exception is thrown when there's no signature in the PE file - } + FileName = fileName; } public string FileName { get { return filename; } - set { CheckSignature (value); } + set { + Reset (); + try { + CheckSignature (value); + } + catch { + reason = 1; + } + } } public byte[] Hash { @@ -100,7 +104,7 @@ namespace Mono.Security.Authenticode { public bool IsTrusted () { - if (rawData == null) { + if (entry == null) { reason = 1; return false; } @@ -110,13 +114,13 @@ namespace Mono.Security.Authenticode { return false; } - if (signerChain.Root == null) { + if ((signerChain.Root == null) || !trustedRoot) { reason = 6; return false; } if (timestamp != DateTime.MinValue) { - if (timestampChain.Root == null) { + if ((timestampChain.Root == null) || !trustedTimestampRoot) { reason = 6; return false; } @@ -138,7 +142,11 @@ namespace Mono.Security.Authenticode { } public byte[] Signature { - get { return (byte[]) rawData.Clone (); } + get { + if (entry == null) + return null; + return (byte[]) entry.Clone (); + } } public DateTime Timestamp { @@ -156,43 +164,58 @@ namespace Mono.Security.Authenticode { private bool CheckSignature (string fileName) { filename = fileName; - - // by default we try with MD5 - string hashName = "MD5"; - // compare the signature's hash with the hash of the file - hash = HashFile (filename, hashName); - - // is a signature present ? - if (rawData == null) + base.Open (filename); + entry = base.GetSecurityEntry (); + if (entry == null) { + // no signature is present + reason = 1; + base.Close (); return false; + } - PKCS7.ContentInfo ci = new PKCS7.ContentInfo (rawData); - if (ci.ContentType != PKCS7.Oid.signedData) + PKCS7.ContentInfo ci = new PKCS7.ContentInfo (entry); + if (ci.ContentType != PKCS7.Oid.signedData) { + base.Close (); return false; + } PKCS7.SignedData sd = new PKCS7.SignedData (ci.Content); - if (sd.ContentInfo.ContentType != spcIndirectDataContext) + if (sd.ContentInfo.ContentType != spcIndirectDataContext) { + base.Close (); return false; + } coll = sd.Certificates; ASN1 spc = sd.ContentInfo.Content; signedHash = spc [0][1][1]; - if (signedHash.Length == 20) { - // seems to be SHA-1, restart hashing - hashName = "SHA1"; - hash = HashFile (filename, hashName); + + HashAlgorithm ha = null; + switch (signedHash.Length) { + case 16: + ha = HashAlgorithm.Create ("MD5"); + hash = GetHash (ha); + break; + case 20: + ha = HashAlgorithm.Create ("SHA1"); + hash = GetHash (ha); + break; + default: + reason = 5; + base.Close (); + return false; } + base.Close (); if (!signedHash.CompareValue (hash)) return false; // messageDigest is a hash of spcIndirectDataContext (which includes the file hash) byte[] spcIDC = spc [0].Value; - HashAlgorithm ha = HashAlgorithm.Create (hashName); + ha.Initialize (); // re-using hash instance byte[] messageDigest = ha.ComputeHash (spcIDC); - return VerifySignature (sd, messageDigest, hashName); + return VerifySignature (sd, messageDigest, ha); } private bool CompareIssuerSerial (string issuer, byte[] serial, X509Certificate x509) @@ -212,7 +235,7 @@ namespace Mono.Security.Authenticode { } //private bool VerifySignature (ASN1 cs, byte[] calculatedMessageDigest, string hashName) - private bool VerifySignature (PKCS7.SignedData sd, byte[] calculatedMessageDigest, string hashName) + private bool VerifySignature (PKCS7.SignedData sd, byte[] calculatedMessageDigest, HashAlgorithm ha) { string contentType = null; ASN1 messageDigest = null; @@ -241,7 +264,7 @@ namespace Mono.Security.Authenticode { case "1.3.6.1.4.1.311.2.1.12": // spcSpOpusInfo (Microsoft code signing) try { - spcSpOpusInfo = System.Text.Encoding.UTF8.GetString (attr[1][0][1][0].Value); + spcSpOpusInfo = System.Text.Encoding.UTF8.GetString (attr[1][0][0][0].Value); } catch (NullReferenceException) { spcSpOpusInfo = null; @@ -261,13 +284,13 @@ namespace Mono.Security.Authenticode { return false; // verify signature - string hashOID = CryptoConfig.MapNameToOID (hashName); + string hashOID = CryptoConfig.MapNameToOID (ha.ToString ()); // change to SET OF (not [0]) as per PKCS #7 1.5 ASN1 aa = new ASN1 (0x31); foreach (ASN1 a in sd.SignerInfo.AuthenticatedAttributes) aa.Add (a); - HashAlgorithm ha = HashAlgorithm.Create (hashName); + ha.Initialize (); byte[] p7hash = ha.ComputeHash (aa.GetBytes ()); byte[] signature = sd.SignerInfo.Signature; @@ -281,10 +304,9 @@ namespace Mono.Security.Authenticode { RSACryptoServiceProvider rsa = (RSACryptoServiceProvider) x509.RSA; if (rsa.VerifyHash (p7hash, hashOID, signature)) { signerChain.LoadCertificates (coll); - if (signerChain.Build (x509)) - signingCertificate = x509; - else - return false; + trustedRoot = signerChain.Build (x509); + signingCertificate = x509; + break; } } } @@ -300,17 +322,18 @@ namespace Mono.Security.Authenticode { // countersignature (1 2 840 113549 1 9 6) // SET { PKCS7.SignerInfo cs = new PKCS7.SignerInfo (attr [1]); - return VerifyCounterSignature (cs, signature, hashName); + trustedTimestampRoot = VerifyCounterSignature (cs, signature); + break; default: // we don't support other unauthenticated attributes break; } } - return true; + return (trustedRoot && trustedTimestampRoot); } - private bool VerifyCounterSignature (PKCS7.SignerInfo cs, byte[] signature, string hashName) + private bool VerifyCounterSignature (PKCS7.SignerInfo cs, byte[] signature) { // SEQUENCE { // INTEGER 1 @@ -357,6 +380,7 @@ namespace Mono.Security.Authenticode { if (messageDigest == null) return false; // TODO: must be read from the ASN.1 structure + string hashName = null; switch (messageDigest.Length) { case 16: hashName = "MD5"; @@ -397,5 +421,20 @@ namespace Mono.Security.Authenticode { // no certificate can verify this signature! return false; } + + private void Reset () + { + filename = null; + entry = null; + hash = null; + signedHash = null; + signingCertificate = null; + reason = -1; + trustedRoot = false; + trustedTimestampRoot = false; + signerChain.Reset (); + timestampChain.Reset (); + timestamp = DateTime.MinValue; + } } } diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeFormatter.cs b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeFormatter.cs index 9813f809be4..1c1540bae61 100755 --- a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeFormatter.cs +++ b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeFormatter.cs @@ -5,9 +5,7 @@ // Sebastien Pouliot <sebastien@ximian.com> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// (C) 2004 Novell (http://www.novell.com) -// - +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -54,6 +52,7 @@ namespace Mono.Security.Authenticode { private PKCS7.SignedData pkcs7; private string description; private Uri url; + private byte [] entry; public AuthenticodeFormatter () : base () { @@ -187,7 +186,14 @@ namespace Mono.Security.Authenticode { pkcs7.SignerInfo.Certificate = certs [0]; pkcs7.SignerInfo.Key = rsa; - pkcs7.SignerInfo.AuthenticatedAttributes.Add (Attribute (spcSpOpusInfo, Opus (description, url.ToString ()))); + + ASN1 opus = null; + if (url == null) + Attribute (spcSpOpusInfo, Opus (description, null)); + else + Attribute (spcSpOpusInfo, Opus (description, url.ToString ())); + pkcs7.SignerInfo.AuthenticatedAttributes.Add (opus); + pkcs7.SignerInfo.AuthenticatedAttributes.Add (Attribute (contentType, ASN1Convert.FromOid (spcIndirectDataContext))); pkcs7.SignerInfo.AuthenticatedAttributes.Add (Attribute (spcStatementType, new ASN1 (0x30, ASN1Convert.FromOid (commercialCodeSigning).GetBytes ()))); @@ -242,11 +248,11 @@ namespace Mono.Security.Authenticode { int dirSecuritySize = BitConverter.ToInt32 (file, peOffset + 156); if (dirSecuritySize > 8) { - rawData = new byte [dirSecuritySize - 8]; - Buffer.BlockCopy (file, dirSecurityOffset + 8, rawData, 0, rawData.Length); + entry = new byte [dirSecuritySize - 8]; + Buffer.BlockCopy (file, dirSecurityOffset + 8, entry, 0, entry.Length); } else - rawData = null; + entry = null; HashAlgorithm hash = HashAlgorithm.Create (hashAlgorithm); // 0 to 215 (216) then skip 4 (checksum) diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog b/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog index 19cc3c81335..c81a55d025d 100644 --- a/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog @@ -1,3 +1,14 @@ +2004-10-27 Sebastien Pouliot <sebastien@ximian.com> + + * AuthenticodeFormatter.cs: Fix NullReferenceException from signcode + tool when no URL is specified on the command line. + +2004-09-07 Sebastien Pouliot <sebastien@ximian.com> + + * AuthenticodeBase.cs: Merge optimizations from HEAD. + * AuthenticodeDeformatter.cs: Merge optimizations from HEAD. + * AuthenticodeFormatter.cs: Merge optimizations from HEAD. + 2004-05-11 Sebastien Pouliot <sebastien@ximian.com> * PrivateKey.cs: Better exception reporting. Added globalization to diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog b/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog index 5299183d037..6ad744e0eb0 100644 --- a/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog @@ -1,3 +1,8 @@ +2004-09-29 Sebastien Pouliot <sebastien@ximian.com> + + * RSAManaged.cs: KeySize is now always a multiple of 8 bits. + Fix #66929. + 2004-06-23 Sebastien Pouliot <sebastien@ximian.com> * SymmetricTransform.cs: Reduce by one the number of block when diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs b/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs index 79771634302..82b16f6b291 100644 --- a/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs +++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs @@ -14,6 +14,8 @@ // // +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// // 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 @@ -147,8 +149,12 @@ namespace Mono.Security.Cryptography { public override int KeySize { get { // in case keypair hasn't been (yet) generated - if (keypairGenerated) - return n.BitCount (); + if (keypairGenerated) { + int ks = n.BitCount (); + if ((ks & 7) != 0) + ks = ks + (8 - (ks & 7)); + return ks; + } else return base.KeySize; } diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ChangeLog b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ChangeLog index e55f1f5ecd8..971879f8b9a 100644 --- a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ChangeLog @@ -1,3 +1,24 @@ +2004-10-05 Sebastien Pouliot <sebastien@ximian.com> + + * SslClientStream.cs: Changed InputBuffer to internal (was protected). + +2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpsClientStream.cs: the .ctor receives a pre-read buffer now. + * SslClientStream.cs: added InputBuffer property. + +2004-07-14 Sebastien Pouliot <sebastien@ximian.com> + + * SslClientStream.cs: Changed lock to "new object()" and not + String.Empty (as the read/write locks points becomes the same). + * SslServerStream.cs: Changed lock to "new object()" and not + String.Empty (as the read/write locks points becomes the same). + +2004-07-14 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpsClientStream.cs: get an HttpWebRequest so that we can use the + ServicePoint it has. No need to get the host now. + 2004-05-09 Carlos Guzman Alvarez <carlosga@telefonica.net>
* Mono.Security.Protocol.Tls/Alert.cs:
diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs index 1da66f06849..89562c9b416 100644 --- a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs +++ b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs @@ -40,17 +40,18 @@ namespace Mono.Security.Protocol.Tls { internal class HttpsClientStream : SslClientStream { - private string _host; - private WebRequest _request; + private HttpWebRequest _request; - public HttpsClientStream (Stream stream, string targetHost, X509CertificateCollection clientCertificates, WebRequest request) - : base (stream, targetHost, false, SecurityProtocolType.Default, clientCertificates) + public HttpsClientStream (Stream stream, X509CertificateCollection clientCertificates, + HttpWebRequest request, byte [] buffer) + : base (stream, request.RequestUri.Host, false, SecurityProtocolType.Default, clientCertificates) { - _host = targetHost; // this constructor permit access to the WebRequest to call // ICertificatePolicy.CheckValidationResult _request = request; + if (buffer != null) + InputBuffer.Write (buffer, 0, buffer.Length); #if !NET_1_0 // also saved from reflection base.CheckCertRevocationStatus = ServicePointManager.CheckCertificateRevocationList; @@ -61,8 +62,7 @@ namespace Mono.Security.Protocol.Tls { { bool failed = (certificateErrors.Length > 0); if (ServicePointManager.CertificatePolicy != null) { - Uri target = new Uri ("https://" + _host); - ServicePoint sp = ServicePointManager.FindServicePoint (target); + ServicePoint sp = _request.ServicePoint; // only one problem can be reported by this interface int problem = ((failed) ? certificateErrors [0] : 0); @@ -73,3 +73,4 @@ namespace Mono.Security.Protocol.Tls { } } } + diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs index 068a24f68c7..18cc041f4a4 100644 --- a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs +++ b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs @@ -125,6 +125,10 @@ namespace Mono.Security.Protocol.Tls set { throw new NotSupportedException(); } } + // required by HttpsClientStream for proxy support + internal Stream InputBuffer { + get { return inputBuffer; } + } #endregion #region Security Properties @@ -349,8 +353,8 @@ namespace Mono.Security.Protocol.Tls this.inputBuffer = new BufferedStream(new MemoryStream()); this.innerStream = stream; this.ownsStream = ownsStream; - this.read = String.Empty; - this.write = String.Empty; + this.read = new object (); + this.write = new object (); this.protocol = new ClientRecordProtocol(innerStream, context); } @@ -821,4 +825,4 @@ namespace Mono.Security.Protocol.Tls #endregion } -}
\ No newline at end of file +} diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs index 53b3d095def..f2786f7554b 100644 --- a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs +++ b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs @@ -306,8 +306,8 @@ namespace Mono.Security.Protocol.Tls this.inputBuffer = new BufferedStream(new MemoryStream()); this.innerStream = stream; this.ownsStream = ownsStream; - this.read = String.Empty; - this.write = String.Empty; + this.read = new object (); + this.write = new object (); this.protocol = new ServerRecordProtocol(innerStream, context); } diff --git a/mcs/class/Mono.Security/Mono.Security.X509.Extensions/ChangeLog b/mcs/class/Mono.Security/Mono.Security.X509.Extensions/ChangeLog index f00dcacd041..b8d2dc9942e 100644 --- a/mcs/class/Mono.Security/Mono.Security.X509.Extensions/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security.X509.Extensions/ChangeLog @@ -1,3 +1,8 @@ +2004-07-15 Sebastien Pouliot <sebastien@ximian.com> + + * KeyUsageExtension.cs: Added Encode to extension so it can be used + by makecert. Fix bug # 61240. Patch provided by Ianier Munoz. + 2004-04-28 Sebastien Pouliot <sebastien@ximian.com> * KeyUsageExtension.cs: Added missing INSIDE_CORLIB to enum. diff --git a/mcs/class/Mono.Security/Mono.Security.X509.Extensions/KeyUsageExtension.cs b/mcs/class/Mono.Security/Mono.Security.X509.Extensions/KeyUsageExtension.cs index a8c5553ed58..0c5d3b0cf38 100644 --- a/mcs/class/Mono.Security/Mono.Security.X509.Extensions/KeyUsageExtension.cs +++ b/mcs/class/Mono.Security/Mono.Security.X509.Extensions/KeyUsageExtension.cs @@ -86,6 +86,11 @@ namespace Mono.Security.X509.Extensions { public KeyUsageExtension (X509Extension extension) : base (extension) {} + public KeyUsageExtension () : base () + { + extnOid = "2.5.29.15"; + } + protected override void Decode () { ASN1 bitString = new ASN1 (extnValue.Value); @@ -96,6 +101,18 @@ namespace Mono.Security.X509.Extensions { kubits = (kubits << 8) + bitString.Value [i++]; } + protected override void Encode () + { + if (extnValue == null) { + extnValue = new ASN1 (0x03, new byte[] { 0x00, (byte)kubits }); + } + } + + public KeyUsages KeyUsage { + get { return (KeyUsages) kubits; } + set { kubits = Convert.ToInt32 (value, CultureInfo.InvariantCulture); } + } + public override string Name { get { return "Key Usage"; } } diff --git a/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog b/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog index 14d6852db71..fc6c1b3b64b 100644 --- a/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog @@ -1,3 +1,14 @@ +2004-09-07 Sebastien Pouliot <sebastien@ximian.com> + + * X509Chain.cs: Merge bug fixes from HEAD. + * X509Store.cs: Merge enhancements from HEAD. + +2004-07-15 Sebastien Pouliot <sebastien@ximian.com> + + * X501Name.cs: Support for E (email) in FromString. + * X520Attributes.cs: Added X520.EmailAddress. + Both patches fix bug #61241 and were contributed by Ianier Munoz. + 2004-05-27 Sebastien Pouliot <sebastien@ximian.com> * X509Certificate.cs: Rethrow original exception when parsing X.509 diff --git a/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs b/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs index 515e24c0b9b..22e3ea30169 100644 --- a/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs +++ b/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs @@ -162,6 +162,8 @@ namespace Mono.Security.X509 { case "S": // Microsoft case "ST": // RFC2253 return new X520.StateOrProvinceName (); + case "E": // NOTE: Not part of RFC2253 + return new X520.EmailAddress (); case "DC": // return streetAddress; case "UID": diff --git a/mcs/class/Mono.Security/Mono.Security.X509/X509Chain.cs b/mcs/class/Mono.Security/Mono.Security.X509/X509Chain.cs index 254ff1b70fa..f8035e6c661 100755 --- a/mcs/class/Mono.Security/Mono.Security.X509/X509Chain.cs +++ b/mcs/class/Mono.Security/Mono.Security.X509/X509Chain.cs @@ -9,9 +9,7 @@ // Sebastien Pouliot <sebastien@ximian.com> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// (C) 2004 Novell (http://www.novell.com) -// - +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -134,7 +132,7 @@ namespace Mono.Security.X509 { tmp = FindCertificateParent (x); if (x != null) { _chain.Add (x); - tmp = x; // last valid + x = tmp; // last valid } } // find a trusted root @@ -191,7 +189,8 @@ namespace Mono.Security.X509 { _status = X509ChainStatusFlags.NoError; roots = null; // this force a reload certs.Clear (); - _chain.Clear (); + if (_chain != null) + _chain.Clear (); } // private stuff diff --git a/mcs/class/Mono.Security/Mono.Security.X509/X509Store.cs b/mcs/class/Mono.Security/Mono.Security.X509/X509Store.cs index 81db71b5c75..aa27a4a7dfd 100755 --- a/mcs/class/Mono.Security/Mono.Security.X509/X509Store.cs +++ b/mcs/class/Mono.Security/Mono.Security.X509/X509Store.cs @@ -4,9 +4,7 @@ // Author: // Sebastien Pouliot <sebastien@ximian.com> // -// (C) 2004 Novell (http://www.novell.com) -// - +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -106,9 +104,7 @@ namespace Mono.Security.X509 { public void Import (X509Certificate certificate) { - if (!Directory.Exists (_storePath)) { - Directory.CreateDirectory (_storePath); - } + CheckStore (_storePath, true); string filename = Path.Combine (_storePath, GetUniqueName (certificate)); if (!File.Exists (filename)) { @@ -183,14 +179,28 @@ namespace Mono.Security.X509 { return crl; } - private X509CertificateCollection BuildCertificatesCollection (string storeName) + private bool CheckStore (string path, bool throwException) { - string path = Path.Combine (_storePath, storeName); - if (!Directory.Exists (path)) { + try { + if (Directory.Exists (path)) + return true; Directory.CreateDirectory (path); + return Directory.Exists (path); + } + catch { + if (throwException) + throw; + return false; } + } + private X509CertificateCollection BuildCertificatesCollection (string storeName) + { X509CertificateCollection coll = new X509CertificateCollection (); + string path = Path.Combine (_storePath, storeName); + if (!CheckStore (path, false)) + return coll; // empty collection + string[] files = Directory.GetFiles (path, "*.cer"); if ((files != null) && (files.Length > 0)) { foreach (string file in files) { @@ -213,6 +223,9 @@ namespace Mono.Security.X509 { { ArrayList list = new ArrayList (); string path = Path.Combine (_storePath, storeName); + if (!CheckStore (path, false)) + return list; // empty list + string[] files = Directory.GetFiles (path, "*.crl"); if ((files != null) && (files.Length > 0)) { foreach (string file in files) { diff --git a/mcs/class/Mono.Security/Mono.Security.X509/X520Attributes.cs b/mcs/class/Mono.Security/Mono.Security.X509/X520Attributes.cs index 54a8af9ba23..b8feb6a2db6 100644 --- a/mcs/class/Mono.Security/Mono.Security.X509/X520Attributes.cs +++ b/mcs/class/Mono.Security/Mono.Security.X509/X520Attributes.cs @@ -101,6 +101,10 @@ namespace Mono.Security.X509 { // PRINTABLESTRING asn1.Add (new ASN1 (0x13, Encoding.ASCII.GetBytes (attrValue))); break; + case 0x16: + // IA5STRING + asn1.Add (new ASN1 (0x16, Encoding.ASCII.GetBytes (attrValue))); + break; case 0x1E: // BMPSTRING asn1.Add (new ASN1 (0x1E, Encoding.BigEndianUnicode.GetBytes (attrValue))); @@ -176,6 +180,14 @@ namespace Mono.Security.X509 { } } + // NOTE: Not part of RFC2253 + public class EmailAddress : AttributeTypeAndValue + { + public EmailAddress () : base ("1.2.840.113549.1.9.1", 128, 0x16) + { + } + } + /* -- Naming attributes of type X520Title * id-at-title AttributeType ::= { id-at 12 } * diff --git a/mcs/class/Mono.Security/Mono.Security_test.dll.sources b/mcs/class/Mono.Security/Mono.Security_test.dll.sources index 2e75e37c1e4..41e1458d054 100644 --- a/mcs/class/Mono.Security/Mono.Security_test.dll.sources +++ b/mcs/class/Mono.Security/Mono.Security_test.dll.sources @@ -9,6 +9,7 @@ Mono.Math/PrimeTestingTest.cs Mono.Math/SearchGeneratorTest.cs Mono.Security/ASN1ConvertTest.cs Mono.Security/StrongNameTest.cs +Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs Mono.Security.Authenticode/PrivateKeyTest.cs Mono.Security.Authenticode/SoftwarePublisherCertificateTest.cs Mono.Security.Cryptography/ARC4ManagedTest.cs diff --git a/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs new file mode 100644 index 00000000000..fa708c3d6a8 --- /dev/null +++ b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs @@ -0,0 +1,724 @@ +// +// AuthenticodeDeformatterTest.cs - +// NUnit Test Cases for AuthenticodeDeformatter +// +// Author: +// Sebastien Pouliot (sebastien@ximian.com) +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// 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.IO; +using System.Reflection; +using System.Security.Cryptography; + +using Mono.Security.Authenticode; +using NUnit.Framework; + +namespace MonoTests.Mono.Security.Authenticode { + + [TestFixture] + public class AuthenticodeDeformatterTest { + + static byte[] helloworld_signed = { + 0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0x00, 0x00, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x0E, 0x1F, 0xBA, 0x0E, 0x00, 0xB4, 0x09, 0xCD, + 0x21, 0xB8, 0x01, 0x4C, 0xCD, 0x21, 0x54, 0x68, 0x69, 0x73, 0x20, 0x70, + 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x20, 0x63, 0x61, 0x6E, 0x6E, 0x6F, + 0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6E, 0x20, 0x69, 0x6E, 0x20, + 0x44, 0x4F, 0x53, 0x20, 0x6D, 0x6F, 0x64, 0x65, 0x2E, 0x0D, 0x0D, 0x0A, + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x45, 0x00, 0x00, + 0x4C, 0x01, 0x03, 0x00, 0xF5, 0xE5, 0xFA, 0x3E, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x0E, 0x01, 0x0B, 0x01, 0x06, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1E, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x96, 0x96, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xC4, 0x22, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x00, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xA8, 0x11, 0x00, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x20, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2E, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, + 0x24, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x2E, 0x72, 0x73, 0x72, + 0x63, 0x00, 0x00, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, + 0x2E, 0x72, 0x65, 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x7C, 0x20, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x13, 0x30, 0x01, 0x00, 0x0B, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x72, 0x01, 0x00, 0x00, 0x70, 0x28, 0x03, 0x00, + 0x00, 0x0A, 0x2A, 0x00, 0x13, 0x30, 0x01, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x28, 0x04, 0x00, 0x00, 0x0A, 0x2A, 0x00, + 0x42, 0x53, 0x4A, 0x42, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0C, 0x00, 0x00, 0x00, 0x76, 0x31, 0x2E, 0x31, 0x2E, 0x34, 0x33, 0x32, + 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0xEC, 0x00, 0x00, 0x00, 0x23, 0x7E, 0x00, 0x00, 0x58, 0x01, 0x00, 0x00, + 0x9C, 0x00, 0x00, 0x00, 0x23, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x73, + 0x00, 0x00, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x23, 0x55, 0x53, 0x00, 0x0C, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x23, 0x47, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x1C, 0x02, 0x00, 0x00, + 0x2C, 0x00, 0x00, 0x00, 0x23, 0x42, 0x6C, 0x6F, 0x62, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x47, 0x15, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x00, 0xFA, 0x01, 0x33, 0x00, 0x02, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, + 0x25, 0x00, 0x1E, 0x00, 0x06, 0x00, 0x5C, 0x00, 0x49, 0x00, 0x06, 0x00, + 0x70, 0x00, 0x1E, 0x00, 0x06, 0x00, 0x88, 0x00, 0x1E, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x2C, 0x00, 0x33, 0x00, 0x05, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x50, 0x20, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x3E, 0x00, + 0x0A, 0x00, 0x01, 0x00, 0x68, 0x20, 0x00, 0x00, 0x00, 0x00, 0x86, 0x18, + 0x43, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x83, 0x00, + 0x11, 0x00, 0x43, 0x00, 0x14, 0x00, 0x19, 0x00, 0x43, 0x00, 0x10, 0x00, + 0x21, 0x00, 0x90, 0x00, 0x1F, 0x00, 0x09, 0x00, 0x43, 0x00, 0x10, 0x00, + 0x20, 0x00, 0x13, 0x00, 0x1A, 0x00, 0x2E, 0x00, 0x0B, 0x00, 0x24, 0x00, + 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x88, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x4D, 0x6F, + 0x64, 0x75, 0x6C, 0x65, 0x3E, 0x00, 0x43, 0x6C, 0x61, 0x73, 0x73, 0x31, + 0x2E, 0x65, 0x78, 0x65, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x6C, 0x69, + 0x62, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x00, 0x4F, 0x62, 0x6A, + 0x65, 0x63, 0x74, 0x00, 0x43, 0x6C, 0x61, 0x73, 0x73, 0x31, 0x00, 0x68, + 0x65, 0x6C, 0x6C, 0x6F, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x00, 0x4D, 0x61, + 0x69, 0x6E, 0x00, 0x2E, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x79, 0x73, + 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x69, 0x61, 0x67, 0x6E, 0x6F, 0x73, 0x74, + 0x69, 0x63, 0x73, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x61, 0x62, + 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, + 0x53, 0x54, 0x41, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x61, 0x72, 0x67, 0x73, 0x00, + 0x43, 0x6F, 0x6E, 0x73, 0x6F, 0x6C, 0x65, 0x00, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x4C, 0x69, 0x6E, 0x65, 0x00, 0x00, 0x00, 0x00, 0x15, 0x48, 0x00, + 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x77, 0x00, + 0x6F, 0x00, 0x72, 0x00, 0x64, 0x00, 0x00, 0x00, 0xA7, 0x01, 0xAB, 0x9B, + 0xF7, 0xF7, 0x3F, 0x49, 0xB9, 0x45, 0x97, 0xAF, 0x40, 0x00, 0x5D, 0x9D, + 0x00, 0x08, 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89, 0x05, 0x00, + 0x01, 0x01, 0x1D, 0x0E, 0x03, 0x20, 0x00, 0x01, 0x05, 0x20, 0x02, 0x01, + 0x02, 0x02, 0x04, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x01, 0x0E, + 0x06, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xEC, 0x22, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x23, 0x00, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x43, + 0x6F, 0x72, 0x45, 0x78, 0x65, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x6D, 0x73, + 0x63, 0x6F, 0x72, 0x65, 0x65, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0x25, 0x00, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, + 0x58, 0x40, 0x00, 0x00, 0xD4, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xD4, 0x02, 0x34, 0x00, 0x00, 0x00, 0x56, 0x00, + 0x53, 0x00, 0x5F, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, + 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, + 0x46, 0x00, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBD, 0x04, 0xEF, 0xFE, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x56, 0x00, 0x61, 0x00, 0x72, 0x00, + 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, + 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x73, 0x00, + 0x6C, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x04, 0x34, 0x02, 0x00, 0x00, + 0x01, 0x00, 0x53, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6E, 0x00, + 0x67, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, + 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, + 0x01, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, + 0x34, 0x00, 0x62, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x6D, 0x00, 0x65, 0x00, + 0x6E, 0x00, 0x74, 0x00, 0x73, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x02, 0x00, 0x01, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, + 0x70, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x79, 0x00, 0x4E, 0x00, 0x61, 0x00, + 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x2C, 0x00, 0x02, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, + 0x65, 0x00, 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, + 0x69, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x56, 0x00, + 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, + 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0B, 0x00, + 0x01, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, + 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, + 0x65, 0x00, 0x00, 0x00, 0x43, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x73, 0x00, + 0x73, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x02, 0x00, 0x01, 0x00, 0x4C, 0x00, + 0x65, 0x00, 0x67, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x43, 0x00, 0x6F, 0x00, + 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x4C, 0x00, 0x65, 0x00, 0x67, 0x00, 0x61, 0x00, 0x6C, 0x00, + 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6D, 0x00, + 0x61, 0x00, 0x72, 0x00, 0x6B, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x4F, 0x00, + 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x61, 0x00, + 0x6C, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x6E, 0x00, + 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x43, 0x00, 0x6C, 0x00, + 0x61, 0x00, 0x73, 0x00, 0x73, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x65, 0x00, + 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, + 0x63, 0x00, 0x74, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x34, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, + 0x63, 0x00, 0x74, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, + 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x30, 0x00, 0x2E, 0x00, + 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x38, 0x00, 0x08, 0x00, 0x01, 0x00, 0x41, 0x00, 0x73, 0x00, 0x73, 0x00, + 0x65, 0x00, 0x6D, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x79, 0x00, 0x20, 0x00, + 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, + 0x6E, 0x00, 0x00, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, + 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x20, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xA8, 0x11, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x30, 0x82, 0x11, 0x97, + 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x02, 0xA0, + 0x82, 0x11, 0x88, 0x30, 0x82, 0x11, 0x84, 0x02, 0x01, 0x01, 0x31, 0x0E, + 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, + 0x05, 0x00, 0x30, 0x67, 0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, + 0x37, 0x02, 0x01, 0x04, 0xA0, 0x59, 0x30, 0x57, 0x30, 0x33, 0x06, 0x0A, + 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x0F, 0x30, 0x25, + 0x03, 0x01, 0x00, 0xA0, 0x20, 0xA2, 0x1E, 0x80, 0x1C, 0x00, 0x3C, 0x00, + 0x3C, 0x00, 0x3C, 0x00, 0x4F, 0x00, 0x62, 0x00, 0x73, 0x00, 0x6F, 0x00, + 0x6C, 0x00, 0x65, 0x00, 0x74, 0x00, 0x65, 0x00, 0x3E, 0x00, 0x3E, 0x00, + 0x3E, 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7, + 0x0D, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10, 0x35, 0xA5, 0x21, 0x3B, 0xFC, + 0xFE, 0xFA, 0x40, 0x97, 0xAA, 0xBB, 0xDE, 0x3B, 0x52, 0x15, 0x6F, 0xA0, + 0x82, 0x0C, 0xF4, 0x30, 0x82, 0x02, 0xBC, 0x30, 0x82, 0x02, 0x25, 0x02, + 0x10, 0x4A, 0x19, 0xD2, 0x38, 0x8C, 0x82, 0x59, 0x1C, 0xA5, 0x5D, 0x73, + 0x5F, 0x15, 0x5D, 0xDC, 0xA3, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x81, 0x9E, 0x31, + 0x1F, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x16, 0x56, 0x65, + 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, + 0x20, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x31, 0x17, 0x30, 0x15, + 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, + 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x2C, 0x30, + 0x2A, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x23, 0x56, 0x65, 0x72, 0x69, + 0x53, 0x69, 0x67, 0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x53, 0x74, + 0x61, 0x6D, 0x70, 0x69, 0x6E, 0x67, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x34, 0x30, 0x32, 0x06, + 0x03, 0x55, 0x04, 0x0B, 0x13, 0x2B, 0x4E, 0x4F, 0x20, 0x4C, 0x49, 0x41, + 0x42, 0x49, 0x4C, 0x49, 0x54, 0x59, 0x20, 0x41, 0x43, 0x43, 0x45, 0x50, + 0x54, 0x45, 0x44, 0x2C, 0x20, 0x28, 0x63, 0x29, 0x39, 0x37, 0x20, 0x56, + 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, + 0x2E, 0x30, 0x1E, 0x17, 0x0D, 0x39, 0x37, 0x30, 0x35, 0x31, 0x32, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x5A, 0x17, 0x0D, 0x30, 0x34, 0x30, 0x31, + 0x30, 0x37, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5A, 0x30, 0x81, 0x9E, + 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x16, 0x56, + 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x54, 0x72, 0x75, 0x73, + 0x74, 0x20, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x31, 0x17, 0x30, + 0x15, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x0E, 0x56, 0x65, 0x72, 0x69, + 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x2C, + 0x30, 0x2A, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x23, 0x56, 0x65, 0x72, + 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x53, + 0x74, 0x61, 0x6D, 0x70, 0x69, 0x6E, 0x67, 0x20, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x34, 0x30, 0x32, + 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x2B, 0x4E, 0x4F, 0x20, 0x4C, 0x49, + 0x41, 0x42, 0x49, 0x4C, 0x49, 0x54, 0x59, 0x20, 0x41, 0x43, 0x43, 0x45, + 0x50, 0x54, 0x45, 0x44, 0x2C, 0x20, 0x28, 0x63, 0x29, 0x39, 0x37, 0x20, + 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, + 0x63, 0x2E, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, + 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xD3, 0x2E, 0x20, 0xF0, 0x68, + 0x7C, 0x2C, 0x2D, 0x2E, 0x81, 0x1C, 0xB1, 0x06, 0xB2, 0xA7, 0x0B, 0xB7, + 0x11, 0x0D, 0x57, 0xDA, 0x53, 0xD8, 0x75, 0xE3, 0xC9, 0x33, 0x2A, 0xB2, + 0xD4, 0xF6, 0x09, 0x5B, 0x34, 0xF3, 0xE9, 0x90, 0xFE, 0x09, 0x0C, 0xD0, + 0xDB, 0x1B, 0x5A, 0xB9, 0xCD, 0xE7, 0xF6, 0x88, 0xB1, 0x9D, 0xC0, 0x87, + 0x25, 0xEB, 0x7D, 0x58, 0x10, 0x73, 0x6A, 0x78, 0xCB, 0x71, 0x15, 0xFD, + 0xC6, 0x58, 0xF6, 0x29, 0xAB, 0x58, 0x5E, 0x96, 0x04, 0xFD, 0x2D, 0x62, + 0x11, 0x58, 0x81, 0x1C, 0xCA, 0x71, 0x94, 0xD5, 0x22, 0x58, 0x2F, 0xD5, + 0xCC, 0x14, 0x05, 0x84, 0x36, 0xBA, 0x94, 0xAA, 0xB4, 0x4D, 0x4A, 0xE9, + 0xEE, 0x3B, 0x22, 0xAD, 0x56, 0x99, 0x7E, 0x21, 0x9C, 0x6C, 0x86, 0xC0, + 0x4A, 0x47, 0x97, 0x6A, 0xB4, 0xA6, 0x36, 0xD5, 0xFC, 0x09, 0x2D, 0xD3, + 0xB4, 0x39, 0x9B, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0D, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, + 0x81, 0x81, 0x00, 0x61, 0x55, 0x0E, 0x3E, 0x7B, 0xC7, 0x92, 0x12, 0x7E, + 0x11, 0x10, 0x8E, 0x22, 0xCC, 0xD4, 0xB3, 0x13, 0x2B, 0x5B, 0xE8, 0x44, + 0xE4, 0x0B, 0x78, 0x9E, 0xA4, 0x7E, 0xF3, 0xA7, 0x07, 0x72, 0x1E, 0xE2, + 0x59, 0xEF, 0xCC, 0x84, 0xE3, 0x89, 0x94, 0x4C, 0xDB, 0x4E, 0x61, 0xEF, + 0xB3, 0xA4, 0xFB, 0x46, 0x3D, 0x50, 0x34, 0x0B, 0x9F, 0x70, 0x56, 0xF6, + 0x8E, 0x2A, 0x7F, 0x17, 0xCE, 0xE5, 0x63, 0xBF, 0x79, 0x69, 0x07, 0x73, + 0x2E, 0xB0, 0x95, 0x28, 0x8A, 0xF5, 0xED, 0xAA, 0xA9, 0xD2, 0x5D, 0xCD, + 0x0A, 0xCA, 0x10, 0x09, 0x8F, 0xCE, 0xB3, 0xAF, 0x28, 0x96, 0xC4, 0x79, + 0x29, 0x84, 0x92, 0xDC, 0xFF, 0xBA, 0x67, 0x42, 0x48, 0xA6, 0x90, 0x10, + 0xE4, 0xBF, 0x61, 0xF8, 0x9C, 0x53, 0xE5, 0x93, 0xD1, 0x73, 0x3F, 0xF8, + 0xFD, 0x9D, 0x4F, 0x84, 0xAC, 0x55, 0xD1, 0xFD, 0x11, 0x63, 0x63, 0x30, + 0x82, 0x03, 0x13, 0x30, 0x82, 0x02, 0x7C, 0xA0, 0x03, 0x02, 0x01, 0x02, + 0x02, 0x01, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, + 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x81, 0xC4, 0x31, 0x0B, 0x30, + 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x5A, 0x41, 0x31, 0x15, + 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0C, 0x57, 0x65, 0x73, + 0x74, 0x65, 0x72, 0x6E, 0x20, 0x43, 0x61, 0x70, 0x65, 0x31, 0x12, 0x30, + 0x10, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x09, 0x43, 0x61, 0x70, 0x65, + 0x20, 0x54, 0x6F, 0x77, 0x6E, 0x31, 0x1D, 0x30, 0x1B, 0x06, 0x03, 0x55, + 0x04, 0x0A, 0x13, 0x14, 0x54, 0x68, 0x61, 0x77, 0x74, 0x65, 0x20, 0x43, + 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x20, 0x63, 0x63, + 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x1F, 0x43, + 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, + 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, 0x44, 0x69, + 0x76, 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, + 0x55, 0x04, 0x03, 0x13, 0x10, 0x54, 0x68, 0x61, 0x77, 0x74, 0x65, 0x20, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, 0x31, 0x26, 0x30, + 0x24, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, + 0x16, 0x17, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2D, 0x63, 0x65, 0x72, + 0x74, 0x73, 0x40, 0x74, 0x68, 0x61, 0x77, 0x74, 0x65, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x39, 0x36, 0x30, 0x38, 0x30, 0x31, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x5A, 0x17, 0x0D, 0x32, 0x30, 0x31, 0x32, + 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5A, 0x30, 0x81, 0xC4, + 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x5A, + 0x41, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0C, + 0x57, 0x65, 0x73, 0x74, 0x65, 0x72, 0x6E, 0x20, 0x43, 0x61, 0x70, 0x65, + 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x09, 0x43, + 0x61, 0x70, 0x65, 0x20, 0x54, 0x6F, 0x77, 0x6E, 0x31, 0x1D, 0x30, 0x1B, + 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x14, 0x54, 0x68, 0x61, 0x77, 0x74, + 0x65, 0x20, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, + 0x20, 0x63, 0x63, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, 0x0B, + 0x13, 0x1F, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6F, 0x6E, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x20, 0x44, 0x69, 0x76, 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x31, 0x19, 0x30, + 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x10, 0x54, 0x68, 0x61, 0x77, + 0x74, 0x65, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, + 0x31, 0x26, 0x30, 0x24, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x17, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2D, + 0x63, 0x65, 0x72, 0x74, 0x73, 0x40, 0x74, 0x68, 0x61, 0x77, 0x74, 0x65, + 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, + 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xD3, 0xA4, 0x50, + 0x6E, 0xC8, 0xFF, 0x56, 0x6B, 0xE6, 0xCF, 0x5D, 0xB6, 0xEA, 0x0C, 0x68, + 0x75, 0x47, 0xA2, 0xAA, 0xC2, 0xDA, 0x84, 0x25, 0xFC, 0xA8, 0xF4, 0x47, + 0x51, 0xDA, 0x85, 0xB5, 0x20, 0x74, 0x94, 0x86, 0x1E, 0x0F, 0x75, 0xC9, + 0xE9, 0x08, 0x61, 0xF5, 0x06, 0x6D, 0x30, 0x6E, 0x15, 0x19, 0x02, 0xE9, + 0x52, 0xC0, 0x62, 0xDB, 0x4D, 0x99, 0x9E, 0xE2, 0x6A, 0x0C, 0x44, 0x38, + 0xCD, 0xFE, 0xBE, 0xE3, 0x64, 0x09, 0x70, 0xC5, 0xFE, 0xB1, 0x6B, 0x29, + 0xB6, 0x2F, 0x49, 0xC8, 0x3B, 0xD4, 0x27, 0x04, 0x25, 0x10, 0x97, 0x2F, + 0xE7, 0x90, 0x6D, 0xC0, 0x28, 0x42, 0x99, 0xD7, 0x4C, 0x43, 0xDE, 0xC3, + 0xF5, 0x21, 0x6D, 0x54, 0x9F, 0x5D, 0xC3, 0x58, 0xE1, 0xC0, 0xE4, 0xD9, + 0x5B, 0xB0, 0xB8, 0xDC, 0xB4, 0x7B, 0xDF, 0x36, 0x3A, 0xC2, 0xB5, 0x66, + 0x22, 0x12, 0xD6, 0x87, 0x0D, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x13, + 0x30, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, + 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, 0x81, + 0x81, 0x00, 0x07, 0xFA, 0x4C, 0x69, 0x5C, 0xFB, 0x95, 0xCC, 0x46, 0xEE, + 0x85, 0x83, 0x4D, 0x21, 0x30, 0x8E, 0xCA, 0xD9, 0xA8, 0x6F, 0x49, 0x1A, + 0xE6, 0xDA, 0x51, 0xE3, 0x60, 0x70, 0x6C, 0x84, 0x61, 0x11, 0xA1, 0x1A, + 0xC8, 0x48, 0x3E, 0x59, 0x43, 0x7D, 0x4F, 0x95, 0x3D, 0xA1, 0x8B, 0xB7, + 0x0B, 0x62, 0x98, 0x7A, 0x75, 0x8A, 0xDD, 0x88, 0x4E, 0x4E, 0x9E, 0x40, + 0xDB, 0xA8, 0xCC, 0x32, 0x74, 0xB9, 0x6F, 0x0D, 0xC6, 0xE3, 0xB3, 0x44, + 0x0B, 0xD9, 0x8A, 0x6F, 0x9A, 0x29, 0x9B, 0x99, 0x18, 0x28, 0x3B, 0xD1, + 0xE3, 0x40, 0x28, 0x9A, 0x5A, 0x3C, 0xD5, 0xB5, 0xE7, 0x20, 0x1B, 0x8B, + 0xCA, 0xA4, 0xAB, 0x8D, 0xE9, 0x51, 0xD9, 0xE2, 0x4C, 0x2C, 0x59, 0xA9, + 0xDA, 0xB9, 0xB2, 0x75, 0x1B, 0xF6, 0x42, 0xF2, 0xEF, 0xC7, 0xF2, 0x18, + 0xF9, 0x89, 0xBC, 0xA3, 0xFF, 0x8A, 0x23, 0x2E, 0x70, 0x47, 0x30, 0x82, + 0x03, 0x13, 0x30, 0x82, 0x02, 0x7C, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, + 0x03, 0x09, 0xCE, 0x15, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, + 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x81, 0xC4, 0x31, 0x0B, + 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x5A, 0x41, 0x31, + 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0C, 0x57, 0x65, + 0x73, 0x74, 0x65, 0x72, 0x6E, 0x20, 0x43, 0x61, 0x70, 0x65, 0x31, 0x12, + 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x09, 0x43, 0x61, 0x70, + 0x65, 0x20, 0x54, 0x6F, 0x77, 0x6E, 0x31, 0x1D, 0x30, 0x1B, 0x06, 0x03, + 0x55, 0x04, 0x0A, 0x13, 0x14, 0x54, 0x68, 0x61, 0x77, 0x74, 0x65, 0x20, + 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x20, 0x63, + 0x63, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x1F, + 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, + 0x6E, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, 0x44, + 0x69, 0x76, 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x31, 0x19, 0x30, 0x17, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x13, 0x10, 0x54, 0x68, 0x61, 0x77, 0x74, 0x65, + 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, 0x31, 0x26, + 0x30, 0x24, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, + 0x01, 0x16, 0x17, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2D, 0x63, 0x65, + 0x72, 0x74, 0x73, 0x40, 0x74, 0x68, 0x61, 0x77, 0x74, 0x65, 0x2E, 0x63, + 0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x30, 0x33, 0x30, 0x31, 0x31, 0x35, + 0x30, 0x36, 0x33, 0x35, 0x32, 0x37, 0x5A, 0x17, 0x0D, 0x30, 0x34, 0x30, + 0x32, 0x30, 0x38, 0x30, 0x39, 0x35, 0x30, 0x35, 0x32, 0x5A, 0x30, 0x81, + 0x9C, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, + 0x43, 0x41, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, + 0x06, 0x51, 0x75, 0x65, 0x62, 0x65, 0x63, 0x31, 0x0F, 0x30, 0x0D, 0x06, + 0x03, 0x55, 0x04, 0x07, 0x13, 0x06, 0x51, 0x75, 0x65, 0x62, 0x65, 0x63, + 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x17, 0x4D, + 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, + 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x27, + 0x30, 0x25, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x1E, 0x53, 0x65, 0x63, + 0x75, 0x72, 0x65, 0x20, 0x41, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6F, 0x6E, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6C, 0x6F, 0x70, 0x6D, + 0x65, 0x6E, 0x74, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55, 0x04, 0x03, + 0x13, 0x17, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65, 0x63, 0x68, + 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x49, 0x6E, 0x63, + 0x2E, 0x30, 0x5C, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, + 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4B, 0x00, 0x30, 0x48, 0x02, + 0x41, 0x00, 0xC5, 0x46, 0xCD, 0xDA, 0xE2, 0x72, 0xC5, 0x63, 0x5B, 0xE5, + 0xAC, 0x2A, 0x3A, 0x61, 0xFA, 0x63, 0x1F, 0xC3, 0xC9, 0x32, 0x82, 0x9D, + 0xBD, 0x83, 0x56, 0x50, 0x07, 0x66, 0x45, 0xB4, 0x6C, 0xFF, 0x4A, 0x68, + 0x37, 0xB4, 0x6B, 0xA3, 0x92, 0x1E, 0xA8, 0x35, 0xC7, 0x06, 0xCB, 0xE1, + 0x39, 0x22, 0xB5, 0x0E, 0xA1, 0x7B, 0x7B, 0x33, 0x16, 0x6F, 0xA7, 0x14, + 0xE5, 0x51, 0x1A, 0x7D, 0x41, 0xB5, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, + 0x7D, 0x30, 0x7B, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x18, + 0x30, 0x16, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, + 0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x16, + 0x30, 0x11, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x42, 0x01, + 0x01, 0x04, 0x04, 0x03, 0x02, 0x04, 0x10, 0x30, 0x1D, 0x06, 0x03, 0x55, + 0x1D, 0x04, 0x04, 0x16, 0x30, 0x14, 0x30, 0x0E, 0x30, 0x0C, 0x06, 0x0A, + 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x16, 0x03, 0x02, + 0x07, 0x80, 0x30, 0x18, 0x06, 0x03, 0x55, 0x1D, 0x11, 0x04, 0x11, 0x30, + 0x0F, 0x82, 0x0D, 0x77, 0x77, 0x77, 0x2E, 0x6D, 0x6F, 0x74, 0x75, 0x73, + 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, + 0x01, 0xFF, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, + 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, 0x81, 0x81, + 0x00, 0x6D, 0xD6, 0x83, 0xDA, 0x39, 0xA2, 0xD8, 0x81, 0x12, 0x8D, 0xA5, + 0x3E, 0xE5, 0xB7, 0xBE, 0x17, 0x42, 0x34, 0x6C, 0x34, 0xF7, 0x92, 0x89, + 0x28, 0xD0, 0xE7, 0xF2, 0xAA, 0x91, 0xAA, 0x76, 0x40, 0xE2, 0x0B, 0xC3, + 0x5A, 0x61, 0x3F, 0x00, 0x21, 0x68, 0x8E, 0xB3, 0x20, 0xCD, 0x42, 0x47, + 0x6B, 0x14, 0xB2, 0x60, 0x36, 0x28, 0xC9, 0xC6, 0x97, 0xB5, 0xC3, 0x9F, + 0x23, 0xED, 0xF6, 0x9B, 0xC9, 0x80, 0x07, 0x10, 0x0F, 0xA2, 0x54, 0x63, + 0x5E, 0x13, 0x21, 0xBC, 0xD1, 0xAB, 0xEE, 0x96, 0xB7, 0xF8, 0x4D, 0x39, + 0x8B, 0xB6, 0xDC, 0x49, 0x60, 0x3B, 0xAB, 0x7B, 0x4A, 0x38, 0x77, 0x7A, + 0x2F, 0x34, 0x26, 0xF6, 0xE7, 0x6D, 0x9A, 0x27, 0x4E, 0xF6, 0x69, 0x13, + 0xB2, 0x84, 0xEB, 0x23, 0xC3, 0x7A, 0x8C, 0x6B, 0xA2, 0xF6, 0x04, 0xDD, + 0x45, 0xF3, 0xC5, 0x76, 0x5C, 0x35, 0xF6, 0x2A, 0x3E, 0x30, 0x82, 0x04, + 0x02, 0x30, 0x82, 0x03, 0x6B, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, + 0x08, 0x7A, 0x6D, 0x5C, 0x6F, 0x62, 0x93, 0x4F, 0xBA, 0xC4, 0xFD, 0x43, + 0xE1, 0x14, 0x18, 0x9D, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, + 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x81, 0x9E, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x16, 0x56, 0x65, 0x72, + 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, + 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x31, 0x17, 0x30, 0x15, 0x06, + 0x03, 0x55, 0x04, 0x0B, 0x13, 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, + 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x2C, 0x30, 0x2A, + 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x23, 0x56, 0x65, 0x72, 0x69, 0x53, + 0x69, 0x67, 0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x53, 0x74, 0x61, + 0x6D, 0x70, 0x69, 0x6E, 0x67, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x34, 0x30, 0x32, 0x06, 0x03, + 0x55, 0x04, 0x0B, 0x13, 0x2B, 0x4E, 0x4F, 0x20, 0x4C, 0x49, 0x41, 0x42, + 0x49, 0x4C, 0x49, 0x54, 0x59, 0x20, 0x41, 0x43, 0x43, 0x45, 0x50, 0x54, + 0x45, 0x44, 0x2C, 0x20, 0x28, 0x63, 0x29, 0x39, 0x37, 0x20, 0x56, 0x65, + 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, + 0x30, 0x1E, 0x17, 0x0D, 0x30, 0x31, 0x30, 0x32, 0x32, 0x38, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x5A, 0x17, 0x0D, 0x30, 0x34, 0x30, 0x31, 0x30, + 0x36, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5A, 0x30, 0x81, 0xA0, 0x31, + 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x0E, 0x56, 0x65, + 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, + 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x16, 0x56, + 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x54, 0x72, 0x75, 0x73, + 0x74, 0x20, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x31, 0x3B, 0x30, + 0x39, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x32, 0x54, 0x65, 0x72, 0x6D, + 0x73, 0x20, 0x6F, 0x66, 0x20, 0x75, 0x73, 0x65, 0x20, 0x61, 0x74, 0x20, + 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, + 0x76, 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6E, 0x2E, 0x63, 0x6F, 0x6D, + 0x2F, 0x72, 0x70, 0x61, 0x20, 0x28, 0x63, 0x29, 0x30, 0x31, 0x31, 0x27, + 0x30, 0x25, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1E, 0x56, 0x65, 0x72, + 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x53, + 0x74, 0x61, 0x6D, 0x70, 0x69, 0x6E, 0x67, 0x20, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, + 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, + 0xC0, 0x7A, 0x61, 0x87, 0xEB, 0xB2, 0xA7, 0x03, 0x63, 0x1B, 0x2B, 0x1A, + 0x61, 0xDE, 0x80, 0xB7, 0x15, 0x1D, 0xA0, 0x8B, 0x90, 0x3D, 0xBB, 0x27, + 0x92, 0x84, 0x14, 0x39, 0xEB, 0x85, 0xCE, 0x29, 0x92, 0x06, 0x66, 0x48, + 0xA4, 0x03, 0x4F, 0x8D, 0xE8, 0x4F, 0xA7, 0xF0, 0xAF, 0x5E, 0xD1, 0x2F, + 0x19, 0xC7, 0x91, 0xF1, 0xB5, 0x9E, 0x7B, 0x91, 0x21, 0xCE, 0xE9, 0xFF, + 0xE3, 0x4E, 0xF0, 0xFC, 0xAF, 0x95, 0x58, 0xB8, 0x63, 0x2D, 0xE6, 0x8E, + 0xF6, 0x29, 0x18, 0xCD, 0x70, 0x8E, 0x50, 0xC3, 0xED, 0x96, 0xBB, 0x40, + 0xDB, 0xBE, 0x25, 0xE8, 0x42, 0x55, 0xD6, 0xF6, 0x85, 0xF2, 0x06, 0xE7, + 0x8B, 0x99, 0x1C, 0x31, 0xF3, 0x03, 0x0F, 0xD4, 0x4C, 0x9C, 0x24, 0x2A, + 0xDC, 0x1B, 0x1B, 0x8F, 0x82, 0xF3, 0xB0, 0xEF, 0xA7, 0x4D, 0xE3, 0x14, + 0xA7, 0xE0, 0x8F, 0xD6, 0xC7, 0x68, 0xC2, 0x61, 0x58, 0xA9, 0x72, 0xD4, + 0xF8, 0x30, 0x48, 0x4F, 0xD9, 0x2F, 0x6F, 0x63, 0x20, 0xD9, 0x89, 0xCA, + 0x82, 0x7B, 0xC2, 0x4B, 0xBC, 0x28, 0xC5, 0x81, 0x68, 0xE7, 0xE6, 0x82, + 0x40, 0xAC, 0x46, 0x3A, 0xA0, 0xF9, 0x3F, 0x36, 0xCD, 0x4C, 0xBB, 0x54, + 0x42, 0x5A, 0x7A, 0x65, 0x7B, 0xFE, 0x84, 0xE4, 0xC7, 0x47, 0x54, 0xAC, + 0xB9, 0x3D, 0xEC, 0x80, 0xC7, 0x1A, 0xF7, 0xC4, 0x33, 0x81, 0x81, 0xC9, + 0x2A, 0x95, 0xFB, 0x7F, 0x5E, 0x3A, 0x87, 0x90, 0x14, 0xDB, 0xCC, 0x2E, + 0x75, 0xF2, 0xEF, 0x6B, 0xE6, 0x3D, 0xA9, 0x60, 0xBE, 0x42, 0x01, 0xAA, + 0x4F, 0xAA, 0x5B, 0xA8, 0x3F, 0x22, 0x31, 0x9F, 0x12, 0x15, 0xF9, 0x73, + 0xA1, 0x1E, 0x82, 0x8B, 0x04, 0x2B, 0xEA, 0x46, 0x02, 0x4C, 0x6D, 0x8F, + 0x1F, 0x50, 0x2E, 0x95, 0x4B, 0x2A, 0x78, 0x06, 0x84, 0x74, 0x3D, 0x91, + 0x8F, 0x2C, 0x47, 0x31, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x81, 0xB8, + 0x30, 0x81, 0xB5, 0x30, 0x40, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, + 0x07, 0x01, 0x01, 0x04, 0x34, 0x30, 0x32, 0x30, 0x30, 0x06, 0x08, 0x2B, + 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x24, 0x68, 0x74, 0x74, + 0x70, 0x3A, 0x2F, 0x2F, 0x6F, 0x63, 0x73, 0x70, 0x2E, 0x76, 0x65, 0x72, + 0x69, 0x73, 0x69, 0x67, 0x6E, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x6F, 0x63, + 0x73, 0x70, 0x2F, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x30, 0x09, 0x06, + 0x03, 0x55, 0x1D, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x44, 0x06, 0x03, + 0x55, 0x1D, 0x20, 0x04, 0x3D, 0x30, 0x3B, 0x30, 0x39, 0x06, 0x0B, 0x60, + 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01, 0x07, 0x01, 0x01, 0x30, 0x2A, + 0x30, 0x28, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x01, + 0x16, 0x1C, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x77, 0x77, + 0x77, 0x2E, 0x76, 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6E, 0x2E, 0x63, + 0x6F, 0x6D, 0x2F, 0x72, 0x70, 0x61, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, + 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, + 0x07, 0x03, 0x08, 0x30, 0x0B, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x04, 0x04, + 0x03, 0x02, 0x06, 0xC0, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, + 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x2D, + 0xF3, 0x4F, 0x63, 0x60, 0x2C, 0x18, 0xDA, 0xF5, 0x24, 0x0F, 0x52, 0xB3, + 0x0C, 0xEB, 0xB3, 0xBC, 0x67, 0x85, 0xC2, 0x23, 0xED, 0x8F, 0x46, 0x0D, + 0xCF, 0x1A, 0x4D, 0xBE, 0xF3, 0x7C, 0x7A, 0x20, 0x30, 0x32, 0x18, 0x68, + 0x8B, 0x92, 0xBB, 0x32, 0x99, 0xF0, 0x93, 0xB8, 0x3B, 0x15, 0x06, 0x27, + 0x7B, 0x3E, 0x02, 0x06, 0x00, 0xA4, 0x21, 0x92, 0x84, 0x13, 0x0A, 0xC5, + 0x98, 0xE5, 0x40, 0x57, 0xC5, 0x05, 0x25, 0xE8, 0xAF, 0xAF, 0x11, 0x6A, + 0xA9, 0xE5, 0x3B, 0xCB, 0xE9, 0x23, 0xF6, 0x94, 0x29, 0x5D, 0x40, 0x55, + 0xF3, 0xA5, 0x53, 0x9D, 0xC8, 0x36, 0x3A, 0x39, 0x65, 0x08, 0x73, 0x73, + 0xA4, 0x32, 0xD2, 0xAF, 0xAC, 0xBF, 0xC7, 0x05, 0x3C, 0xFF, 0x45, 0xEC, + 0xC3, 0xE8, 0xDA, 0x24, 0xD1, 0xCE, 0x63, 0xAE, 0x09, 0xA7, 0xFB, 0xE2, + 0x1B, 0xE3, 0xFD, 0x41, 0x0A, 0x6A, 0x96, 0x31, 0x82, 0x04, 0x0C, 0x30, + 0x82, 0x04, 0x08, 0x02, 0x01, 0x01, 0x30, 0x81, 0xCC, 0x30, 0x81, 0xC4, + 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x5A, + 0x41, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0C, + 0x57, 0x65, 0x73, 0x74, 0x65, 0x72, 0x6E, 0x20, 0x43, 0x61, 0x70, 0x65, + 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x09, 0x43, + 0x61, 0x70, 0x65, 0x20, 0x54, 0x6F, 0x77, 0x6E, 0x31, 0x1D, 0x30, 0x1B, + 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x14, 0x54, 0x68, 0x61, 0x77, 0x74, + 0x65, 0x20, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, + 0x20, 0x63, 0x63, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, 0x0B, + 0x13, 0x1F, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6F, 0x6E, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x20, 0x44, 0x69, 0x76, 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x31, 0x19, 0x30, + 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x10, 0x54, 0x68, 0x61, 0x77, + 0x74, 0x65, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, + 0x31, 0x26, 0x30, 0x24, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x17, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2D, + 0x63, 0x65, 0x72, 0x74, 0x73, 0x40, 0x74, 0x68, 0x61, 0x77, 0x74, 0x65, + 0x2E, 0x63, 0x6F, 0x6D, 0x02, 0x03, 0x09, 0xCE, 0x15, 0x30, 0x0C, 0x06, + 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 0xA0, + 0x81, 0x84, 0x30, 0x19, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x03, 0x31, 0x0C, 0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, + 0x82, 0x37, 0x02, 0x01, 0x04, 0x30, 0x1C, 0x06, 0x0A, 0x2B, 0x06, 0x01, + 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x0B, 0x31, 0x0E, 0x30, 0x0C, 0x06, + 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x16, 0x30, + 0x1F, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x04, + 0x31, 0x12, 0x04, 0x10, 0x62, 0x0B, 0x26, 0x7E, 0x35, 0x1A, 0xB1, 0xE5, + 0x5E, 0xF4, 0x4F, 0x14, 0xD0, 0xC0, 0xD1, 0x90, 0x30, 0x28, 0x06, 0x0A, + 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x0C, 0x31, 0x1A, + 0x30, 0x18, 0xA1, 0x16, 0x80, 0x14, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, + 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x6D, 0x6F, 0x74, 0x75, 0x73, 0x2E, 0x63, + 0x6F, 0x6D, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x40, 0x0D, 0xBA, 0xBB, 0xB0, 0x63, + 0x33, 0x6A, 0x03, 0x20, 0xA0, 0xD4, 0xC0, 0xBD, 0xDA, 0xAB, 0xE3, 0x73, + 0xCA, 0x92, 0xB6, 0xE5, 0x75, 0x73, 0x0C, 0xD2, 0x4F, 0xB1, 0x8D, 0x96, + 0x89, 0xD8, 0x01, 0x8B, 0x9C, 0x1E, 0x9D, 0x5A, 0xF1, 0xEE, 0x05, 0x9A, + 0x59, 0xB9, 0x5A, 0xC0, 0xEC, 0x1C, 0x2B, 0x17, 0x1B, 0x8B, 0x10, 0xC7, + 0xC1, 0xF6, 0xE2, 0xF9, 0x3E, 0xCC, 0xC9, 0x3A, 0x19, 0x17, 0x51, 0xA1, + 0x82, 0x02, 0x4C, 0x30, 0x82, 0x02, 0x48, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x06, 0x31, 0x82, 0x02, 0x39, 0x30, 0x82, + 0x02, 0x35, 0x02, 0x01, 0x01, 0x30, 0x81, 0xB3, 0x30, 0x81, 0x9E, 0x31, + 0x1F, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x16, 0x56, 0x65, + 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, + 0x20, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x31, 0x17, 0x30, 0x15, + 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, + 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x2C, 0x30, + 0x2A, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x23, 0x56, 0x65, 0x72, 0x69, + 0x53, 0x69, 0x67, 0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x53, 0x74, + 0x61, 0x6D, 0x70, 0x69, 0x6E, 0x67, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x34, 0x30, 0x32, 0x06, + 0x03, 0x55, 0x04, 0x0B, 0x13, 0x2B, 0x4E, 0x4F, 0x20, 0x4C, 0x49, 0x41, + 0x42, 0x49, 0x4C, 0x49, 0x54, 0x59, 0x20, 0x41, 0x43, 0x43, 0x45, 0x50, + 0x54, 0x45, 0x44, 0x2C, 0x20, 0x28, 0x63, 0x29, 0x39, 0x37, 0x20, 0x56, + 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, + 0x2E, 0x02, 0x10, 0x08, 0x7A, 0x6D, 0x5C, 0x6F, 0x62, 0x93, 0x4F, 0xBA, + 0xC4, 0xFD, 0x43, 0xE1, 0x14, 0x18, 0x9D, 0x30, 0x0C, 0x06, 0x08, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 0xA0, 0x59, 0x30, + 0x18, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x03, + 0x31, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, + 0x01, 0x30, 0x1C, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, + 0x09, 0x05, 0x31, 0x0F, 0x17, 0x0D, 0x30, 0x33, 0x31, 0x30, 0x30, 0x37, + 0x31, 0x35, 0x32, 0x34, 0x33, 0x30, 0x5A, 0x30, 0x1F, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x04, 0x31, 0x12, 0x04, 0x10, + 0x11, 0x7B, 0x03, 0x6B, 0xAB, 0xC2, 0x07, 0x41, 0x02, 0x76, 0x9F, 0x71, + 0xBE, 0xA3, 0xD1, 0x03, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, + 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x01, 0x00, 0x58, + 0xD1, 0xF6, 0x51, 0xF0, 0x1C, 0xDB, 0x38, 0x15, 0x55, 0x6C, 0x09, 0x4A, + 0xDC, 0x14, 0x7E, 0x02, 0x7A, 0x6D, 0x8C, 0x2E, 0xB1, 0xA0, 0xDB, 0x5A, + 0x55, 0x4F, 0xFB, 0xD4, 0x4D, 0x73, 0xEB, 0xDF, 0xD5, 0xAC, 0x62, 0x80, + 0xE9, 0x4C, 0x58, 0x67, 0xD2, 0xAC, 0x6E, 0x5A, 0x71, 0x9E, 0x1F, 0xED, + 0xB0, 0x08, 0x74, 0xF7, 0xC1, 0x7B, 0xC1, 0x53, 0xD2, 0x7E, 0x41, 0x7C, + 0xF3, 0x35, 0xBF, 0x83, 0xF8, 0x30, 0xAC, 0x67, 0xC7, 0xA1, 0x34, 0xC4, + 0xB4, 0xD4, 0xB0, 0x6F, 0x36, 0x5A, 0xC3, 0xA9, 0x3E, 0x76, 0x1B, 0xB2, + 0x68, 0x99, 0x85, 0x48, 0xA5, 0x84, 0x79, 0xE2, 0x8F, 0x10, 0xE9, 0x06, + 0x20, 0xC4, 0x7A, 0x7F, 0x8A, 0x0F, 0x0A, 0x95, 0x0F, 0xD9, 0xE9, 0x02, + 0xA5, 0x6B, 0x58, 0x30, 0x75, 0x15, 0xEF, 0x31, 0xAB, 0x2A, 0x2E, 0xC1, + 0x1F, 0xB3, 0xCF, 0xD8, 0x2A, 0x60, 0xB3, 0x1E, 0x1F, 0x2E, 0x76, 0xC8, + 0x7A, 0x6B, 0x2D, 0xD6, 0x3B, 0xC8, 0xE2, 0x78, 0xB7, 0x83, 0x20, 0xA8, + 0x2C, 0x66, 0xFF, 0x30, 0xE4, 0x37, 0xEB, 0xBB, 0x03, 0x06, 0xAD, 0x31, + 0xFD, 0x18, 0x9E, 0x97, 0xD1, 0x5E, 0xB4, 0x4A, 0x5D, 0x03, 0xDA, 0x89, + 0xDB, 0xF1, 0x0B, 0xDA, 0x45, 0x14, 0x82, 0x01, 0xC0, 0x2E, 0x5B, 0x69, + 0xCF, 0xD4, 0xAB, 0xD4, 0xB2, 0x8E, 0x96, 0xBA, 0x3B, 0x58, 0x04, 0xE7, + 0x4C, 0xD9, 0x12, 0x91, 0x2B, 0x87, 0xFD, 0x0B, 0x63, 0xF1, 0x55, 0x12, + 0x3A, 0xCE, 0xF1, 0x78, 0x23, 0x4D, 0x61, 0x51, 0x90, 0x16, 0x12, 0x12, + 0xAA, 0xFF, 0xBE, 0x82, 0x0E, 0xC9, 0x81, 0x75, 0xBA, 0x20, 0x16, 0x18, + 0x12, 0xE2, 0xAC, 0x97, 0x88, 0xCB, 0xCA, 0x4C, 0x4E, 0x82, 0x09, 0x31, + 0xED, 0x42, 0xB3, 0xD8, 0xCF, 0x55, 0x10, 0x2A, 0xA3, 0x12, 0x5A, 0x3C, + 0x0A, 0xB2, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + private string WriteFile () + { + string filename = "helloworld_signed.exe"; + try { + if (File.Exists (filename)) { + File.Delete (filename); + } + using (FileStream fs = File.OpenWrite (filename)) { + fs.Write (helloworld_signed, 0, helloworld_signed.Length); + filename = Path.GetFullPath (fs.Name); + fs.Close (); + } + } + catch {} + return filename; + } + + [Test] + public void VerifySignedAssembly () + { + string filename = WriteFile (); + AuthenticodeDeformatter ad = new AuthenticodeDeformatter (filename); + // note: it's a valid signed PE file - but it doesn't + // mean it's root is trusted on the current system + Assert.IsTrue (((ad.Reason == 0) || (ad.Reason == 6)), "Reason"); + Assert.AreEqual ("35-A5-21-3B-FC-FE-FA-40-97-AA-BB-DE-3B-52-15-6F", BitConverter.ToString (ad.Hash), "Hash"); + Assert.AreEqual (632011226700000000, ad.Timestamp.Ticks, "Timestamp"); + Assert.AreEqual (4, ad.Certificates.Count, "#Certificates"); + Assert.AreEqual ("C=ZA, S=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Server CA, E=server-certs@thawte.com", ad.SigningCertificate.IssuerName, "IssuerName"); + Assert.AreEqual ("C=CA, S=Quebec, L=Quebec, O=Motus Technologies Inc., OU=Secure Application Development, CN=Motus Technologies Inc.", ad.SigningCertificate.SubjectName, "SubjectName"); + } + + [Test] + public void VerifyUnsignedAssembly () + { + string filename = Assembly.GetExecutingAssembly ().Location; + AuthenticodeDeformatter ad = new AuthenticodeDeformatter (filename); + // no digital signature + Assert.AreEqual (1, ad.Reason, "Reason"); + Assert.IsNull (ad.Hash, "Hash"); + Assert.AreEqual (DateTime.MinValue, ad.Timestamp, "Timestamp"); + Assert.IsNull (ad.Certificates, "Certificates"); + Assert.IsNull (ad.SigningCertificate, "SigningCertificate"); + } + } +} diff --git a/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/ChangeLog b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/ChangeLog index eee740f04a6..46672ff6427 100644 --- a/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/ChangeLog +++ b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/ChangeLog @@ -1,3 +1,7 @@ +2004-09-07 Sebastien Pouliot <sebastien@ximian.com> + + * AuthenticodeDeformatterTest.cs: Merge new unit tests from HEAD. + 2004-05-11 Sebastien Pouliot <sebastien@ximian.com> * PrivateKeyTest.cs: Added new unit tests for better coverage. diff --git a/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog b/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog index e4266e2d3cd..f633f97c624 100644 --- a/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog +++ b/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog @@ -1,3 +1,6 @@ +2004-07-12 Umadevi S <sumadevi@novell.com> + * Tokenizer.cs - read an Int64 from the text instead of Int32. Resolves bug 61203 + 2004-06-17 Boris Kirzner <borisk@mainsoft.com> * Comparison.cs - use 'as' to avoid NullReferenceExeption in casting. diff --git a/mcs/class/System.Data/Mono.Data.SqlExpressions/Tokenizer.cs b/mcs/class/System.Data/Mono.Data.SqlExpressions/Tokenizer.cs index a9b427d1bf0..c3b4eb1faf8 100644 --- a/mcs/class/System.Data/Mono.Data.SqlExpressions/Tokenizer.cs +++ b/mcs/class/System.Data/Mono.Data.SqlExpressions/Tokenizer.cs @@ -122,7 +122,7 @@ namespace Mono.Data.SqlExpressions { string str = sb.ToString (); if (str.IndexOf(".") == -1) - return int.Parse (str); + return Int64.Parse (str); else return double.Parse (str); } diff --git a/mcs/class/System.Data/System.Data.Common/ChangeLog b/mcs/class/System.Data/System.Data.Common/ChangeLog index 0db883a625e..6af8fca9b77 100755 --- a/mcs/class/System.Data/System.Data.Common/ChangeLog +++ b/mcs/class/System.Data/System.Data.Common/ChangeLog @@ -1,5 +1,11 @@ -2004-06-24 Atsushi Enomoto <atsushi@ximian.com> +2004-07-21 Umadevi S <sumadevi@novell.com> + * DbDataRecord.cs - Fix for bug 58163. Return DBNull instead of null + +2004-07-07 Umadevi S <sumadevi@novell.com> + * DataContainer.cs :CheckedforNull before calling the relavant setmethods in each of the + SetItemForDataRecord method for the DateTimeClass +2004-06-24 Atsushi Enomoto <atsushi@ximian.com> * DataColumnMappingCollection.cs : fixed typo. * DbDataAdapter.cs : column mappings were not filled. diff --git a/mcs/class/System.Data/System.Data.Common/DataContainer.cs b/mcs/class/System.Data/System.Data.Common/DataContainer.cs index 5b627d7d8ba..de0d64bc598 100644 --- a/mcs/class/System.Data/System.Data.Common/DataContainer.cs +++ b/mcs/class/System.Data/System.Data.Common/DataContainer.cs @@ -1098,8 +1098,8 @@ namespace System.Data.Common { // if exception thrown, it should be caught // in the caller method - base.SetValue(index,record.GetDateTime(field)); - base.SetItemFromDataRecord(index,record,field); + if (!CheckAndSetNull(index,record,field)) + base.SetValue(index,record.GetDateTime(field)); } internal override int CompareValues(int index1, int index2) diff --git a/mcs/class/System.Data/System.Data.Common/DbDataRecord.cs b/mcs/class/System.Data/System.Data.Common/DbDataRecord.cs index 0a6fa0e868d..69a2013f64d 100644 --- a/mcs/class/System.Data/System.Data.Common/DbDataRecord.cs +++ b/mcs/class/System.Data/System.Data.Common/DbDataRecord.cs @@ -340,7 +340,7 @@ namespace System.Data.Common { public bool IsDBNull (int i) { - return GetValue (i) == null; + return GetValue (i) == DBNull.Value; } #if NET_2_0 public virtual bool IsSetAsDefault (int i) diff --git a/mcs/class/System.Data/System.Data.Odbc/ChangeLog b/mcs/class/System.Data/System.Data.Odbc/ChangeLog index d8581c1975b..e633dabdd9d 100644 --- a/mcs/class/System.Data/System.Data.Odbc/ChangeLog +++ b/mcs/class/System.Data/System.Data.Odbc/ChangeLog @@ -1,3 +1,47 @@ +2004-08-31 Umadevi S (sumadevi@novell.com) + * OdbcDataReader.cs - Fixed Decimal parsing + + +2004-08-30 Umadevi S (sumadevi@novell.com) + * OdbcType.cs - removed inheritance from short. + +2004-08-27 Sureshkumar T (tsureshkumar@novell.com) + * OdbcDataReader.cs - fixed bug #63539 - TINYINT ODBC datatype is converted into System.Byte + +2004-08-26 Sureshkumar T (tsureshkumar@novell.com) + * OdbcDataReader.cs - Date & DateTime GetValue fixed. + GetBytes ordinal parameter passing fixed for BINARY in GetValue. + +2004-08-20 Sureshkumar T (tsureshkumar@novell.com) + * OdbcConnection.cs - correct handles are passed to OdbcError exception to trap the correct error + +2004-08-04 Umadevi S (sumadevi@novell.com) + * OdbcDataReader.cs - Fixed bug 61832 - Column names were not filled, due to which name based lookup of columns failed. + +2004-08-04 Umadevi S (sumadevi@novell.com) + * OdbcDataReader.cs - Fixed bug 61405 - Handling smallint column type. + +2004-07-30 Sureshkumar T (tsureshkumar@novell.com) + * OdbcCommand.cs: ExecuteNonQuery Closed statement handle to fix memory leak + * OdbcDataReader.cs: Closed statement handle to fix memory leak + Removed SQLState login in GetBytes coz OdbcError provides the same. + +2004-07-29 Umadevi S (sumadevi@novell.com) + * OdbcCommand.cs - Fixed bug 62046. ExecuteNonQuery implemented correctly + +2004-07-28 Umadevi S (sumadevi@novell.com) + * OdbcParameter.cs - fixed bug 61968. String values passed with quotes + +2004-07-07 Umadevi S (sumadevi@novell.com) + * OdbcConnection.cs - Allowed Close to be called multiple times + - Implementation of Dispose method + +2004-07-07 Umadevi S (sumadevi@novell.com) + * OdbcCommand.cs : fixed set method for Transaction + +2004-07-01 Sureshkumar T (tsureshkumar@novell.com) + * OdbcCommand.cs : fixed reader problem with ExecuteScalar + 2004-06-23 Sureshkumar T (tsureshkumar@novell.com) * OdbcConnection.cs: Fix: Moved env allocation to Open method. Disconnection & freeing handles are done in Close diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs index fe242f3bf8f..64c4fcfe661 100644 --- a/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs +++ b/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs @@ -223,7 +223,14 @@ namespace System.Data.Odbc return (IDbTransaction) Transaction;
}
set {
- throw new NotImplementedException ();
+ if (value is OdbcTransaction) + { + Transaction = (OdbcTransaction)value; + } + else + { + throw new ArgumentException (); + } }
}
@@ -285,6 +292,12 @@ namespace System.Data.Odbc public int ExecuteNonQuery ()
{
+ return ExecuteNonQuery (true); + }
+
+ private int ExecuteNonQuery (bool freeHandle) + { + int records = 0; if (connection == null)
throw new InvalidOperationException ();
if (connection.State == ConnectionState.Closed)
@@ -292,12 +305,29 @@ namespace System.Data.Odbc // FIXME: a third check is mentioned in .NET docs
ExecSQL(CommandText);
-
-// if (!prepared)
-// libodbc.SQLFreeHandle( (ushort) OdbcHandleType.Stmt, hstmt);
- return 0;
- }
-
+ + // .NET documentation says that except for INSERT, UPDATE and + // DELETE where the return value is the number of rows affected + // for the rest of the commands the return value is -1. + if ((CommandText.ToUpper().IndexOf("UPDATE")!=-1) || + (CommandText.ToUpper().IndexOf("INSERT")!=-1) || + (CommandText.ToUpper().IndexOf("DELETE")!=-1)) { + + int numrows = 0; + OdbcReturn ret = libodbc.SQLRowCount(hstmt,ref numrows); + records = numrows; + } + else + records = -1; +
+ if (freeHandle && !prepared) {
+ OdbcReturn ret = libodbc.SQLFreeHandle( (ushort) OdbcHandleType.Stmt, hstmt);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLFreeHandle",OdbcHandleType.Stmt,hstmt));
+ } + return records;
+ } + public void Prepare()
{
OdbcReturn ret=libodbc.SQLAllocHandle(OdbcHandleType.Stmt, Connection.hDbc, ref hstmt);
@@ -330,7 +360,7 @@ namespace System.Data.Odbc public OdbcDataReader ExecuteReader (CommandBehavior behavior)
{
- ExecuteNonQuery();
+ ExecuteNonQuery(false);
dataReader=new OdbcDataReader(this,behavior);
return dataReader;
}
@@ -342,11 +372,12 @@ namespace System.Data.Odbc public object ExecuteScalar ()
{
- object val;
+ object val = null;
OdbcDataReader reader=ExecuteReader();
try
{
- val=reader[0];
+ if (reader.Read ())
+ val=reader[0];
}
finally
{
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs index e6bd6ff0441..b40eb86c8d2 100644 --- a/mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs +++ b/mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs @@ -46,6 +46,7 @@ namespace System.Data.Odbc int connectionTimeout; internal OdbcTransaction transaction; IntPtr henv=IntPtr.Zero, hdbc=IntPtr.Zero; + bool disposed = false; #endregion @@ -197,27 +198,25 @@ namespace System.Data.Odbc // disconnect ret = libodbc.SQLDisconnect (hdbc); if ( (ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo)) - throw new OdbcException (new OdbcError ("SQLConnect", OdbcHandleType.Dbc,hdbc)); + throw new OdbcException (new OdbcError ("SQLDisconnect", OdbcHandleType.Dbc,hdbc)); // free handles if (hdbc != IntPtr.Zero) { ret = libodbc.SQLFreeHandle ( (ushort) OdbcHandleType.Dbc, hdbc); if ( (ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo)) - throw new OdbcException (new OdbcError ("SQLConnect", OdbcHandleType.Dbc,hdbc)); + throw new OdbcException (new OdbcError ("SQLFreeHandle", OdbcHandleType.Dbc,hdbc)); } hdbc = IntPtr.Zero; if (henv != IntPtr.Zero) { ret = libodbc.SQLFreeHandle ( (ushort) OdbcHandleType.Env, henv); if ( (ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo)) - throw new OdbcException (new OdbcError ("SQLConnect", OdbcHandleType.Dbc,hdbc)); + throw new OdbcException (new OdbcError ("SQLFreeHandle", OdbcHandleType.Env,henv)); } henv = IntPtr.Zero; transaction = null; } - else - throw new InvalidOperationException (); } public OdbcCommand CreateCommand () @@ -231,10 +230,23 @@ namespace System.Data.Odbc throw new NotImplementedException (); } - [MonoTODO] protected override void Dispose (bool disposing) - { - } + { + if (!this.disposed) { + try + { + // release the native unmananged resources + this.Close(); + this.disposed = true; + } + finally + { + // call Dispose on the base class + base.Dispose(disposing); + } + } + } + [MonoTODO] object ICloneable.Clone () diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs index 394963734f0..61b49d55481 100644 --- a/mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs +++ b/mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs @@ -167,25 +167,8 @@ namespace System.Data.Odbc return cols[ordinal]; } - private string GetSQLState (IntPtr hstmt, ushort recNo) - { - OdbcReturn ret = OdbcReturn.Error; - short bufLength=256, txtLength=0; - int nativeError = 1; - string sqlState = "", sqlMsg = ""; - byte [] msgtxtBuffer = new byte [bufLength]; - byte [] sqlStateBuffer = new byte [bufLength]; - ret = libodbc.SQLGetDiagRec (OdbcHandleType.Stmt, hstmt, recNo, - sqlStateBuffer, ref nativeError, msgtxtBuffer, - bufLength, ref txtLength); - sqlState = Encoding.Default.GetString (sqlStateBuffer).Replace ( - (char) 0, ' ').Trim (); - return sqlState; - } - public void Close () { - // libodbc.SQLFreeHandle((ushort) OdbcHandleType.Stmt, hstmt); OdbcReturn ret=libodbc.SQLCloseCursor(hstmt); if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo)) @@ -196,6 +179,9 @@ namespace System.Data.Odbc if ((behavior & CommandBehavior.CloseConnection)==CommandBehavior.CloseConnection) this.command.Connection.Close(); + ret = libodbc.SQLFreeHandle( (ushort) OdbcHandleType.Stmt, hstmt);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo)) + throw new OdbcException(new OdbcError("SQLFreeHandle",OdbcHandleType.Stmt,hstmt)); } ~OdbcDataReader () @@ -231,6 +217,10 @@ namespace System.Data.Odbc if ( (ret != OdbcReturn.Success) && (ret != OdbcReturn.SuccessWithInfo)) throw new OdbcException (new OdbcError ("SQLGetData", OdbcHandleType.Stmt, hstmt)); + OdbcError odbcErr = null; + if ( (ret == OdbcReturn.SuccessWithInfo)) + odbcErr = new OdbcError ("SQLGetData", OdbcHandleType.Stmt, hstmt); + if (buffer == null) return outsize; //if buffer is null,return length of the field @@ -241,11 +231,10 @@ namespace System.Data.Odbc copyBuffer = false; returnVal = -1; } else { - string sqlstate = GetSQLState (hstmt, 1); + string sqlstate = odbcErr.SQLState; //SQLState: String Data, Right truncated if (sqlstate != libodbc.SQLSTATE_RIGHT_TRUNC) - throw new OdbcException (new OdbcError ("SQLGetData", - OdbcHandleType.Stmt, hstmt)); + throw new OdbcException ( odbcErr); copyBuffer = true; } } else { @@ -400,7 +389,6 @@ namespace System.Data.Odbc for (int i = 0; i < cols.Length; i += 1 ) { OdbcColumn col=GetColumn(i); - //Console.WriteLine("{0}:{1}:{2}",col.ColumnName,col.DataType,col.OdbcType); schemaRow = dataTableSchema.NewRow (); dataTableSchema.Rows.Add (schemaRow); @@ -485,14 +473,23 @@ namespace System.Data.Odbc bufsize=50; buffer=new byte[bufsize]; // According to sqlext.h, use SQL_CHAR for decimal ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.Char, buffer, bufsize, ref outsize); + byte[] temp = new byte[outsize]; + for (int i=0;i<outsize;i++) + temp[i]=buffer[i]; + if (outsize!=-1) - DataValue=Decimal.Parse(System.Text.Encoding.Default.GetString(buffer)); + DataValue=Decimal.Parse(System.Text.Encoding.Default.GetString(temp)); break; case OdbcType.TinyInt: short short_data=0; ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.TinyInt, ref short_data, 0, ref outsize); - DataValue=short_data; + DataValue = System.Convert.ToByte (short_data); break; + case OdbcType.SmallInt: + short sint_data=0; + ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.SmallInt, ref sint_data, 0, ref outsize); + DataValue=sint_data; + break; case OdbcType.Int: int int_data=0; ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.Int, ref int_data, 0, ref outsize); @@ -524,8 +521,17 @@ namespace System.Data.Odbc break; case OdbcType.Timestamp: case OdbcType.DateTime: + case OdbcType.Date: + case OdbcType.Time: OdbcTimestamp ts_data=new OdbcTimestamp(); - ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.DateTime, ref ts_data, 0, ref outsize); + if (col.OdbcType == OdbcType.Timestamp) + ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.Timestamp, ref ts_data, 0, ref outsize); + else if (col.OdbcType == OdbcType.DateTime) + ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.DateTime, ref ts_data, 0, ref outsize); + else if (col.OdbcType == OdbcType.Date) + ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.Date, ref ts_data, 0, ref outsize); + else // FIXME: how to get TIME datatype ?? + ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.DateTime, ref ts_data, 0, ref outsize); if (outsize!=-1) // This means SQL_NULL_DATA DataValue=new DateTime(ts_data.year,ts_data.month,ts_data.day,ts_data.hour, ts_data.minute,ts_data.second,Convert.ToInt32(ts_data.fraction)); @@ -534,12 +540,11 @@ namespace System.Data.Odbc case OdbcType.Image : bufsize = col.MaxLength + 1; buffer = new byte [bufsize]; - long read = GetBytes (ColIndex, 0, buffer, 0, bufsize); + long read = GetBytes (ordinal, 0, buffer, 0, bufsize); ret = OdbcReturn.Success; DataValue = buffer; break; default: - //Console.WriteLine("Fetching unsupported data type as string: "+col.OdbcType.ToString()); bufsize=255; buffer=new byte[bufsize]; ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.Char, buffer, bufsize, ref outsize); @@ -612,6 +617,8 @@ namespace System.Data.Odbc currentRow=-1; else currentRow++; + GetSchemaTable(); + // Clear cached values from last record foreach (OdbcColumn col in cols) { diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcParameter.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcParameter.cs index 51df821d86f..11153197ca7 100644 --- a/mcs/class/System.Data/System.Data.Odbc/OdbcParameter.cs +++ b/mcs/class/System.Data/System.Data.Odbc/OdbcParameter.cs @@ -261,6 +261,9 @@ namespace System.Data.Odbc string paramValueString = ParamValue.ToString();
// Treat everything else as a string
// Init string buffer
+ if (ParamValue is String) + paramValueString = "\'"+paramValueString+"\'"; + if (buffer == null || buffer.Length < ((size > 20) ? size : 20))
buffer = new byte[(size > 20) ? size : 20];
else
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcType.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcType.cs index fed8035a7e6..6e7c3169bee 100644 --- a/mcs/class/System.Data/System.Data.Odbc/OdbcType.cs +++ b/mcs/class/System.Data/System.Data.Odbc/OdbcType.cs @@ -51,7 +51,7 @@ namespace System.Data.Odbc //#define SQL_INTERVAL 10
// could map to SmallDateTime?
- public enum OdbcType : short
+ public enum OdbcType {
BigInt=-5, // SQL_BIGINT
Binary=-2, // SQL_BINARY
diff --git a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog index 14efc7d3b1e..8b39fed6e74 100755 --- a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog +++ b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog @@ -1,3 +1,15 @@ +2004-09-24 Umadevi S <sumadevi@novell.com> + * SqlTransaction.cs - Dispose will not call rollback incase the transaction is not open. + + +2004-09-02 Umadevi S <sumadevi@novell.com> + * SqlCommand.cs - ExecuteNonQuery to return -1 incase of executing a storedprocedure + + +2004-08-12 Sureshkumar T <tsureshkumar@novell.com> + * SqlDataReader.cs - In Close method, the remaining resultsets are drained + out, to read output parameters & to avoid stream overlap + 2004-06-22 Atsushi Enomoto <atsushi@ximian.com> * SqlCommandBuilder.cs : Avoid cast exception caused by DbNull. diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs index 366b381b54d..a5ada9fd053 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs @@ -310,16 +310,19 @@ namespace System.Data.SqlClient { try { Execute (CommandBehavior.Default, false); - // .NET documentation says that except for INSERT, UPDATE and - // DELETE where the return value is the number of rows affected - // for the rest of the commands the return value is -1. - if ((CommandText.ToUpper().IndexOf("UPDATE")!=-1) || - (CommandText.ToUpper().IndexOf("INSERT")!=-1) || - (CommandText.ToUpper().IndexOf("DELETE")!=-1)) - result = Connection.Tds.RecordsAffected; - else + if (commandType == CommandType.StoredProcedure) result = -1; - + else { + // .NET documentation says that except for INSERT, UPDATE and + // DELETE where the return value is the number of rows affected + // for the rest of the commands the return value is -1. + if ((CommandText.ToUpper().IndexOf("UPDATE")!=-1) || + (CommandText.ToUpper().IndexOf("INSERT")!=-1) || + (CommandText.ToUpper().IndexOf("DELETE")!=-1)) + result = Connection.Tds.RecordsAffected; + else + result = -1; + } } catch (TdsTimeoutException e) { throw SqlException.FromTdsInternalException ((TdsInternalException) e); diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs index 52b6a0a589a..abe23c3aebf 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs @@ -131,6 +131,9 @@ namespace System.Data.SqlClient { public void Close () { + // skip to end & read output parameters + while (NextResult ()) + ; isClosed = true; command.Connection.DataReader = null; command.CloseDataReader (moreResults); diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs index f6c1ad13f5c..aa145d2c426 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs @@ -94,7 +94,8 @@ namespace System.Data.SqlClient { { if (!disposed) { if (disposing) { - Rollback (); + if (isOpen) + Rollback (); } disposed = true; } diff --git a/mcs/class/System.Data/System.Data/ChangeLog b/mcs/class/System.Data/System.Data/ChangeLog index 5477819e402..317caaf7d94 100644 --- a/mcs/class/System.Data/System.Data/ChangeLog +++ b/mcs/class/System.Data/System.Data/ChangeLog @@ -1,3 +1,83 @@ +2004-10-15 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : Also clear UnhandledAttributes ArrayList before + generating next attribute column schema. This fixes bug #68432. + +2004-10-13 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : clear UnhandledAttributes ArrayList before generating + next element column schema. This fixes bug #68256. + +2004-10-12 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : now xs:schema contains xmlns="". + This fixes bug #68008. + +2004-10-12 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : DBNull attribute column should not be written as + empty attribute. This fixes bug #68007. + +2004-10-12 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs, XmlConstant.cs, XmlSchemaDataImporter.cs: + DataColumn.ReadOnly was not handled. This fixes bug #68005. + Attribute defaultValue was not handled too. + +2004-10-08 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : Yesterday's fix was different and broke the build :( + +2004-10-07 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : + - When AllowDBNull is false on attribute DataColumn, its schema + should contain use="required". This fixes bug #66792. + - If MaxLength is set on attribute DataColumn, the mapped schema + type should contain maxLength facet. This fixes bug #66793. + +2004-10-04 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : For a row, when a relation is not nested, then it is + still output target since it won't be written as a child of its + parent. It fixes bug #66379. + +2004-10-03 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : Attribute constraint field XPath must be written as + @blah. This fixes bug #66366. + +2004-09-28 Umadevi S <sumadevi@novell.com> + * DataRow.cs - checked for Enforceconstraints, while using indices to search for related rows + +2004-09-24 Sureshkumar T <tsureshkumar@novell.com> + + * DataSet.cs : Don't check constraints for dataset clear + * DataRowCollection.cs : check for EnforceConstraints flag + before checking foriegn key constraints in Clear method + * DataTable.cs : Redundant checking removed in Clear method as it is + checked in DataRowCollection.Clear method. + +2004-09-21 Sureshkumar T <tsureshkumar@novell.com> + + * DataRow.cs: Added a new original row cache, if the current row happens + to be the original row. fixed bug #63097 + +2004-08-06 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : DataSet's ExtendedProperties were not XmlConverted. + +2004-08-05 Atsushi Enomoto <atsushi@ximian.com> + + * XmlConstants.cs : Added constants for "msprop" support. + * DataSet.cs : ExtendedProperties should be written in the schema. + This fixes bug #61233. + +2004-07-27 Atsushi Enomoto <atsushi@ximian.com> + + * DataSet.cs : on serialization to XmlWriter, XmlConvert should be + used. There were also some culture dependency problems to write int. + 2004-06-27 Atsushi Enomoto <atsushi@ximian.com> * XmlDataInferenceLoader.cs : It was not always filling relation diff --git a/mcs/class/System.Data/System.Data/DataRow.cs b/mcs/class/System.Data/System.Data/DataRow.cs index 382659bbcfc..49c59a922db 100644 --- a/mcs/class/System.Data/System.Data/DataRow.cs +++ b/mcs/class/System.Data/System.Data/DataRow.cs @@ -489,7 +489,9 @@ namespace System.Data { DataColumn column = _table.Columns[columnName]; _table.ChangingDataColumn (this, column, val); - if (_original < 0) { + if (_original < 0 || _original == _current) { + // really add a row cache, if _original is not there & + // make row modified _original = Table.RecordCache.NewRecord(); } CheckValue (val, column); @@ -1036,7 +1038,9 @@ namespace System.Data { int numColumn = parentColumns.Length; if (HasVersion(version)) { Index indx = relation.ParentTable.GetIndexByColumns (parentColumns); - if (indx != null) { // get the child rows from the index + if (indx != null && + (Table == null || Table.DataSet == null || + Table.DataSet.EnforceConstraints)) { // get the child rows from the index Node[] childNodes = indx.FindAllSimple(childColumns, IndexFromVersion(version)); for (int i = 0; i < childNodes.Length; i++) { rows.Add (childNodes[i].Row); diff --git a/mcs/class/System.Data/System.Data/DataRowCollection.cs b/mcs/class/System.Data/System.Data/DataRowCollection.cs index 06e94a354b3..8b1d2e20190 100644 --- a/mcs/class/System.Data/System.Data/DataRowCollection.cs +++ b/mcs/class/System.Data/System.Data/DataRowCollection.cs @@ -123,7 +123,7 @@ namespace System.Data /// </summary> public void Clear () { - if (this.table.DataSet != null) + if (this.table.DataSet != null && this.table.DataSet.EnforceConstraints) { foreach (DataTable table in this.table.DataSet.Tables) { diff --git a/mcs/class/System.Data/System.Data/DataSet.cs b/mcs/class/System.Data/System.Data/DataSet.cs index 34f9f8f4c80..db04b849b61 100644 --- a/mcs/class/System.Data/System.Data/DataSet.cs +++ b/mcs/class/System.Data/System.Data/DataSet.cs @@ -330,13 +330,19 @@ namespace System.Data { tempTable.AcceptChanges (); } + /// <summary> + /// Clears all the tables + /// </summary> public void Clear () { if (_xmlDataDocument != null) throw new NotSupportedException ("Clear function on dataset and datatable is not supported when XmlDataDocument is bound to the DataSet."); - for (int t = 0; t < tableCollection.Count; t++) { - tableCollection[t].Clear (); + bool enforceConstraints = this.EnforceConstraints; + this.EnforceConstraints = false; + for (int t = 0; t < tableCollection.Count; t++) { + tableCollection [t].Clear (); } + this.EnforceConstraints = enforceConstraints; } public virtual DataSet Clone () @@ -1188,16 +1194,22 @@ namespace System.Data { case 0: break; case 1: + if (!oneRel.Nested) + break; if (row.GetParentRow (oneRel) != null) continue; break; case 2: bool skip = false; - for (int i = 0; i < table.ParentRelations.Count; i++) - if (row.GetParentRow (table.ParentRelations [i]) != null) { + for (int i = 0; i < table.ParentRelations.Count; i++) { + DataRelation prel = table.ParentRelations [i]; + if (!prel.Nested) + continue; + if (row.GetParentRow (prel) != null) { skip = true; continue; } + } if (skip) continue; break; @@ -1270,7 +1282,8 @@ namespace System.Data { private void WriteColumnAsAttribute (XmlWriter writer, XmlWriteMode mode, DataColumn col, DataRow row, DataRowVersion version) { - WriteAttributeString (writer, mode, col.Namespace, col.Prefix, XmlConvert.EncodeLocalName (col.ColumnName), row[col, version].ToString ()); + if (!row.IsNull (col)) + WriteAttributeString (writer, mode, col.Namespace, col.Prefix, XmlConvert.EncodeLocalName (col.ColumnName), WriteObjectXml (row[col, version])); } private void WriteTableElement (XmlWriter writer, XmlWriteMode mode, DataTable table, DataRow row, DataRowVersion version) @@ -1282,7 +1295,7 @@ namespace System.Data { if (mode == XmlWriteMode.DiffGram) { WriteAttributeString (writer, mode, XmlConstants.DiffgrNamespace, XmlConstants.DiffgrPrefix, "id", table.TableName + (row.XmlRowID + 1)); - WriteAttributeString (writer, mode, XmlConstants.MsdataNamespace, XmlConstants.MsdataPrefix, "rowOrder", row.XmlRowID.ToString()); + WriteAttributeString (writer, mode, XmlConstants.MsdataNamespace, XmlConstants.MsdataPrefix, "rowOrder", XmlConvert.ToString (row.XmlRowID)); string modeName = null; if (row.RowState == DataRowState.Modified) modeName = "modified"; @@ -1384,12 +1397,17 @@ namespace System.Data { XmlAttribute attr = null; ArrayList atts = new ArrayList (); + attr = doc.CreateAttribute ("", "xmlns", xmlNSURI); + atts.Add (attr); + nsmgr.AddNamespace ("xs", XmlSchema.Namespace); nsmgr.AddNamespace (XmlConstants.MsdataPrefix, XmlConstants.MsdataNamespace); if (Namespace != "") { nsmgr.AddNamespace (XmlConstants.TnsPrefix, Namespace); nsmgr.AddNamespace (String.Empty, Namespace); } + if (CheckExtendedPropertyExists ()) + nsmgr.AddNamespace (XmlConstants.MspropPrefix, XmlConstants.MspropNamespace); if (atts.Count > 0) schema.UnhandledAttributes = atts.ToArray (typeof (XmlAttribute)) as XmlAttribute []; @@ -1416,6 +1434,8 @@ namespace System.Data { elem.UnhandledAttributes = atts.ToArray (typeof (XmlAttribute)) as XmlAttribute []; + AddExtendedPropertyAttributes (elem, ExtendedProperties, doc); + XmlSchemaComplexType complex = new XmlSchemaComplexType (); elem.SchemaType = complex; @@ -1446,7 +1466,7 @@ namespace System.Data { schema.Items.Add (elem); - AddConstraintsToSchema (elem, constraintPrefix, tables, relations); + AddConstraintsToSchema (elem, constraintPrefix, tables, relations, doc); foreach (string prefix in nsmgr) { string ns = nsmgr.LookupNamespace (nsmgr.NameTable.Get (prefix)); if (prefix != "xmlns" && prefix != "xml" && ns != null && ns != String.Empty) @@ -1455,29 +1475,48 @@ namespace System.Data { return schema; } + private bool CheckExtendedPropertyExists () + { + if (ExtendedProperties.Count > 0) + return true; + foreach (DataTable dt in Tables) { + if (dt.ExtendedProperties.Count > 0) + return true; + foreach (DataColumn col in dt.Columns) + if (col.ExtendedProperties.Count > 0) + return true; + foreach (Constraint c in dt.Constraints) + if (c.ExtendedProperties.Count > 0) + return true; + } + foreach (DataRelation rel in Relations) + if (rel.ExtendedProperties.Count > 0) + return true; + return false; + } + // Add all constraints in all tables to the schema. - private void AddConstraintsToSchema (XmlSchemaElement elem, string constraintPrefix, DataTableCollection tables, DataRelationCollection relations) + private void AddConstraintsToSchema (XmlSchemaElement elem, string constraintPrefix, DataTableCollection tables, DataRelationCollection relations, XmlDocument doc) { // first add all unique constraints. - Hashtable uniqueNames = AddUniqueConstraints (elem, constraintPrefix, tables); + Hashtable uniqueNames = AddUniqueConstraints (elem, constraintPrefix, tables, doc); // Add all foriegn key constraints. - AddForeignKeys (uniqueNames, elem, constraintPrefix, relations); + AddForeignKeys (uniqueNames, elem, constraintPrefix, relations, doc); } // Add unique constaraints to the schema. // return hashtable with the names of all XmlSchemaUnique elements we created. - private Hashtable AddUniqueConstraints (XmlSchemaElement elem, string constraintPrefix, DataTableCollection tables) + private Hashtable AddUniqueConstraints (XmlSchemaElement elem, string constraintPrefix, DataTableCollection tables, XmlDocument doc) { - XmlDocument doc = new XmlDocument(); Hashtable uniqueNames = new Hashtable(); foreach (DataTable table in tables) { - foreach (Constraint constaint in table.Constraints) { + foreach (Constraint constraint in table.Constraints) { - if (constaint is UniqueConstraint) { + if (constraint is UniqueConstraint) { ArrayList attrs = new ArrayList (); XmlAttribute attrib; - UniqueConstraint uqConst = (UniqueConstraint)constaint; + UniqueConstraint uqConst = (UniqueConstraint) constraint; XmlSchemaUnique uniq = new XmlSchemaUnique (); // if column of the constraint is hidden do not write the constraint. @@ -1516,10 +1555,13 @@ namespace System.Data { XmlSchemaXPath field; foreach (DataColumn column in uqConst.Columns) { field = new XmlSchemaXPath(); - field.XPath = constraintPrefix+column.ColumnName; + string typePrefix = column.ColumnMapping == MappingType.Attribute ? "@" : ""; + field.XPath = typePrefix + constraintPrefix + column.ColumnName; uniq.Fields.Add(field); } + AddExtendedPropertyAttributes (uniq, constraint.ExtendedProperties, doc); + elem.Constraints.Add (uniq); uniqueNames.Add (uniq.Name, null); } @@ -1529,11 +1571,10 @@ namespace System.Data { } // Add the foriegn keys to the schema. - private void AddForeignKeys (Hashtable uniqueNames, XmlSchemaElement elem, string constraintPrefix, DataRelationCollection relations) + private void AddForeignKeys (Hashtable uniqueNames, XmlSchemaElement elem, string constraintPrefix, DataRelationCollection relations, XmlDocument doc) { if (relations == null) return; - XmlDocument doc = new XmlDocument(); foreach (DataRelation rel in relations) { if (rel.ParentKeyConstraint == null || rel.ChildKeyConstraint == null) @@ -1582,10 +1623,14 @@ namespace System.Data { XmlSchemaXPath field; foreach (DataColumn column in rel.ChildColumns) { field = new XmlSchemaXPath(); - field.XPath = constraintPrefix+column.ColumnName; + string typePrefix = column.ColumnMapping == MappingType.Attribute ? "@" : ""; + field.XPath = typePrefix + constraintPrefix + column.ColumnName; keyRef.Fields.Add(field); } + keyRef.UnhandledAttributes = (XmlAttribute[])attrs.ToArray (typeof (XmlAttribute)); + AddExtendedPropertyAttributes (keyRef, rel.ExtendedProperties, doc); + elem.Constraints.Add (keyRef); } } @@ -1596,6 +1641,9 @@ namespace System.Data { ArrayList atts; DataColumn simple; + ArrayList xattrs = new ArrayList(); + XmlAttribute xattr; + SplitColumns (table, out atts, out elements, out simple); XmlSchemaElement elem = new XmlSchemaElement (); @@ -1618,7 +1666,7 @@ namespace System.Data { // add ordinal attribute xlmAttrs[1] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.Ordinal, XmlConstants.MsdataNamespace); - xlmAttrs[1].Value = simple.Ordinal.ToString(); + xlmAttrs[1].Value = XmlConvert.ToString (simple.Ordinal); simpleContent.UnhandledAttributes = xlmAttrs; @@ -1637,8 +1685,6 @@ namespace System.Data { // Add element for the column. XmlSchemaElement colElem = new XmlSchemaElement (); - ArrayList xattrs = new ArrayList(); - XmlAttribute xattr; colElem.Name = col.ColumnName; if (col.ColumnName != col.Caption && col.Caption != String.Empty) { @@ -1655,13 +1701,19 @@ namespace System.Data { if (col.AutoIncrementSeed != 0) { xattr = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.AutoIncrementSeed, XmlConstants.MsdataNamespace); - xattr.Value = col.AutoIncrementSeed.ToString(); + xattr.Value = XmlConvert.ToString (col.AutoIncrementSeed); xattrs.Add (xattr); } if (col.DefaultValue.ToString () != String.Empty) - colElem.DefaultValue = col.DefaultValue.ToString (); - + colElem.DefaultValue = WriteObjectXml (col.DefaultValue); + + if (col.ReadOnly) { + xattr = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.ReadOnly, XmlConstants.MsdataNamespace); + xattr.Value = "true"; + xattrs.Add (xattr); + } + if (col.MaxLength < 0) colElem.SchemaTypeName = MapType (col.DataType); @@ -1687,6 +1739,8 @@ namespace System.Data { } colElem.UnhandledAttributes = (XmlAttribute[])xattrs.ToArray(typeof (XmlAttribute)); + xattrs.Clear (); + AddExtendedPropertyAttributes (colElem, col.ExtendedProperties, doc); seq.Items.Add (colElem); } @@ -1725,13 +1779,58 @@ namespace System.Data { // FIXME: Handle prefix mapping correctly. schemaToAdd.Namespaces.Add (prefix, col.Namespace); } - att.SchemaTypeName = MapType (col.DataType); + if (!col.AllowDBNull) + att.Use = XmlSchemaUse.Required; + + if (col.MaxLength > -1) + att.SchemaType = GetTableSimpleType (doc, col); + else + att.SchemaTypeName = MapType (col.DataType); + // FIXME: what happens if extended properties are set on attribute columns?? + if (!col.AllowDBNull) + att.Use = XmlSchemaUse.Required; + if (col.DefaultValue.ToString () != String.Empty) + att.DefaultValue = WriteObjectXml (col.DefaultValue); + + if (col.ReadOnly) { + xattr = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.ReadOnly, XmlConstants.MsdataNamespace); + xattr.Value = "true"; + xattrs.Add (xattr); + } + + att.UnhandledAttributes = xattrs.ToArray (typeof (XmlAttribute)) as XmlAttribute []; + xattrs.Clear (); + + if (col.MaxLength > -1) + att.SchemaType = GetTableSimpleType (doc, col); + else + att.SchemaTypeName = MapType (col.DataType); schemaAttributes.Add (att); } + AddExtendedPropertyAttributes (elem, table.ExtendedProperties, doc); + return elem; } + private void AddExtendedPropertyAttributes (XmlSchemaAnnotated xsobj, PropertyCollection props, XmlDocument doc) + { + ArrayList attList = new ArrayList (); + XmlAttribute xmlAttr; + + if (xsobj.UnhandledAttributes != null) + attList.AddRange (xsobj.UnhandledAttributes); + + // add extended properties to xs:element + foreach (DictionaryEntry de in props) { + xmlAttr = doc.CreateAttribute (XmlConstants.MspropPrefix, XmlConvert.EncodeName (de.Key.ToString ()), XmlConstants.MspropNamespace); + xmlAttr.Value = de.Value != null ? WriteObjectXml (de.Value) : String.Empty; + attList.Add (xmlAttr); + } + if (attList.Count > 0) + xsobj.UnhandledAttributes = attList.ToArray (typeof (XmlAttribute)) as XmlAttribute []; + } + private string SafeNS (string ns) { return ns != null ? ns : String.Empty; diff --git a/mcs/class/System.Data/System.Data/DataTable.cs b/mcs/class/System.Data/System.Data/DataTable.cs index c8f06e7ec0b..344d928f2ec 100644 --- a/mcs/class/System.Data/System.Data/DataTable.cs +++ b/mcs/class/System.Data/System.Data/DataTable.cs @@ -677,37 +677,7 @@ namespace System.Data { /// Clears the DataTable of all data. /// </summary> public void Clear () { - // TODO: thow an exception if any rows that - // have enforced child relations - // that would result in child rows being orphaned - // now we check if any ForeignKeyConstraint is referncing 'table'. - if (DataSet != null) - { - if (DataSet._xmlDataDocument != null) - throw new NotSupportedException ("Clear function on dataset and datatable is not supported on XmlDataDocument."); - - IEnumerator tableEnumerator = DataSet.Tables.GetEnumerator(); - - // loop on all tables in dataset - while (tableEnumerator.MoveNext()) - { - IEnumerator constraintEnumerator = ((DataTable) tableEnumerator.Current).Constraints.GetEnumerator(); - // loop on all constrains in the current table - while (constraintEnumerator.MoveNext()) - { - Object o = constraintEnumerator.Current; - // we only check ForeignKeyConstraint - if (o is ForeignKeyConstraint) - { - ForeignKeyConstraint fc = (ForeignKeyConstraint) o; - if(fc.RelatedTable == this && fc.Table.Rows.Count > 0) - throw new InvalidConstraintException("Cannot clear table " + fc.RelatedTable + " because ForeignKeyConstraint " + fc.ConstraintName + " enforces constraints and there are child rows in " + fc.Table); - } - } - } - } - - + // Foriegn key constraints are checked in _rows.Clear method _rows.Clear (); } diff --git a/mcs/class/System.Data/System.Data/XmlConstants.cs b/mcs/class/System.Data/System.Data/XmlConstants.cs index b50a80bc6d5..6298bf6bfb5 100755 --- a/mcs/class/System.Data/System.Data/XmlConstants.cs +++ b/mcs/class/System.Data/System.Data/XmlConstants.cs @@ -83,6 +83,8 @@ internal class XmlConstants //ms schema objects public const string MsdataPrefix = "msdata"; public const string MsdataNamespace = "urn:schemas-microsoft-com:xml-msdata"; + public const string MspropPrefix = "msprop"; + public const string MspropNamespace = "urn:schemas-microsoft-com:xml-msprop"; public const string DiffgrPrefix = "diffgr"; public const string DiffgrNamespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; public const string TnsPrefix = "mstns"; @@ -94,6 +96,7 @@ internal class XmlConstants public const string ConstraintName = "ConstraintName"; public const string PrimaryKey = "PrimaryKey"; public const string ColumnName = "ColumnName"; + public const string ReadOnly = "ReadOnly"; public static XmlQualifiedName QnString = new XmlQualifiedName ("string", XmlSchema.Namespace); public static XmlQualifiedName QnShort = new XmlQualifiedName ("short", XmlSchema.Namespace); diff --git a/mcs/class/System.Data/System.Data/XmlSchemaDataImporter.cs b/mcs/class/System.Data/System.Data/XmlSchemaDataImporter.cs index 1e9de07d82e..898839b0b18 100755 --- a/mcs/class/System.Data/System.Data/XmlSchemaDataImporter.cs +++ b/mcs/class/System.Data/System.Data/XmlSchemaDataImporter.cs @@ -654,6 +654,9 @@ el.ElementType != schemaAnyType) case XmlConstants.AutoIncrementSeed: col.AutoIncrementSeed = int.Parse (attr.Value); break; + case XmlConstants.ReadOnly: + col.ReadOnly = XmlConvert.ToBoolean (attr.Value); + break; case XmlConstants.Ordinal: ordinal = int.Parse (attr.Value); break; diff --git a/mcs/class/System.Data/Test/ChangeLog b/mcs/class/System.Data/Test/ChangeLog index 49630c2d5d8..65c8719353a 100644 --- a/mcs/class/System.Data/Test/ChangeLog +++ b/mcs/class/System.Data/Test/ChangeLog @@ -1,3 +1,13 @@ +2004-08-26 Sureshkumar T <TSureshkumar@novell.com> + * MySqlTestBed.cs - Added few more fields for DateTime testing + +2004-08-13 Umadevi S <sumadevi@novell.com> + * Added standalone nunit testcases for datacontainer class. + * Currently will use MSSQL server + * New File + MSSqlTestBed.cs - Base class for MSSql testing + (similar to the mysqltestbed) + 2004-06-16 Sureshkumar T <TSureshkumar@novell.com> * Added standalone NUnit test cases for MySql db related tests. * Created sub-directory for System.Data.Odbc diff --git a/mcs/class/System.Data/Test/MSSqlTestBed.cs b/mcs/class/System.Data/Test/MSSqlTestBed.cs new file mode 100644 index 00000000000..bb2ed3bd160 --- /dev/null +++ b/mcs/class/System.Data/Test/MSSqlTestBed.cs @@ -0,0 +1,100 @@ +// +// MSSqlTestBed.cs : This is base class which manages the connections to +// MSSql database. This serves as a base class for all +// MSSql database dependant tests. +// +// To run : +// +// * compile using following command +// mcs /r:System.Data.dll,nunit.framework.dll /t:library /debug +// /out:MSSqlTestBed.dll MSSqlTestBed.cs System.Data.Common/*.cs +// * To run the tests +// mono /usr/local/bin/nunit-console.exe MSSqlTestBed.dll +// +// Author: +// Umadevi S (sumadevi@novell.com) +// +// Copyright (c) 2004 Novell Inc., and the individuals listed +// on the ChangeLog entries. +// +// 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.Data; +using System.Data.Common; +using System.Data.SqlClient; +using System.Collections.Specialized; + +namespace MonoTests.System.Data +{ + public class MSSqlTestClient + { + #region protected members + protected string connectionString = null; + protected SqlConnection conn = null; + protected bool isConnAlive = false; + #endregion + + public MSSqlTestClient () + { + connectionString = + "Server=164.99.168.131;" + + "Database=Northwind;" + + "User ID=sa;" + + "Password=novell"; + conn = new SqlConnection(connectionString); + } + + protected void OpenConnection () + { + conn.ConnectionString = connectionString; + conn.Open (); + // run tests only if the connection is open, + // otherwise make it fail, to setup with correct + // database settings + if (conn != null && conn.State != ConnectionState.Closed) + isConnAlive = true; + } + + protected void CloseConnection () + { + if (conn != null && conn.State != ConnectionState.Closed) { + conn.Close (); + isConnAlive = false; + } + } + + internal void ExecuteQuery (string query) + { + SqlCommand cmd = new SqlCommand (); + cmd.Connection = conn; + cmd.CommandText = query; + try { + int recordsAff = cmd.ExecuteNonQuery (); + } catch (Exception e) { + Console.WriteLine("exception"); + Console.WriteLine(e.StackTrace); + } + } + + + } +} diff --git a/mcs/class/System.Data/Test/MySqlTestBed.cs b/mcs/class/System.Data/Test/MySqlTestBed.cs index a923c0d326d..1f8fef70c89 100644 --- a/mcs/class/System.Data/Test/MySqlTestBed.cs +++ b/mcs/class/System.Data/Test/MySqlTestBed.cs @@ -95,23 +95,26 @@ namespace MonoTests.System.Data "pk_tint TINYINT NOT NULL PRIMARY KEY," + "col_char CHAR(20)," + "col_int INT," + - "col_blob TINYBLOB" + + "col_blob TINYBLOB," + + "col_datetime DATETIME," + + "col_date DATE," + + "col_time TIME" + ");"; ExecuteQuery (createQuery); createQuery = "INSERT INTO test VALUES (1, 'mono test" + - "#1', 255, 127123645917568585638457243856234985 );" ; + "#1', 255, 127123645917568585638457243856234985, '2004-08-22', '2004-08-22', '12:00:00' );" ; ExecuteQuery (createQuery); createQuery = "INSERT INTO test VALUES (2, 'mono test" + - "#2', 256, NULL );" ; + "#2', 256, NULL, NULL, NULL, NULL );"; ExecuteQuery (createQuery); createQuery = "INSERT INTO test VALUES (3, 'mono test" + - "#3', 257 , 127123645917568585638457243856234985);" ; + "#3', 257 , 127123645917568585638457243856234985, '2004-08-22', '2004-08-22', '12:00:00');" ; ExecuteQuery (createQuery); createQuery = "INSERT INTO test VALUES (4, 'mono test" + - "#4', 258 , 127123645917568585638457243856234985);" ; + "#4', 258 , 127123645917568585638457243856234985, '2004-08-22', '2004-08-22', '12:00:00');" ; ExecuteQuery (createQuery); createQuery = "INSERT INTO test VALUES (5, 'mono test" + - "#5', 259, 127123645917568585638457243856234985 );" ; + "#5', 259, 127123645917568585638457243856234985, '2004-08-22', '2004-08-22', '12:00:00' );" ; ExecuteQuery (createQuery); } diff --git a/mcs/class/System.Data/Test/System.Data.Common/ChangeLog b/mcs/class/System.Data/Test/System.Data.Common/ChangeLog index af4575be732..351489466c7 100644 --- a/mcs/class/System.Data/Test/System.Data.Common/ChangeLog +++ b/mcs/class/System.Data/Test/System.Data.Common/ChangeLog @@ -1,3 +1,6 @@ +2004-08-13 Umadevi S <sumadevi@novell.com> + * Added File DataContainerTest + 2004-06-10 Umadevi S <sumadevi@novell.com> * Corrected GetTableMappingBySchemaAction for DataTableMappingCollectionTest diff --git a/mcs/class/System.Data/Test/System.Data.Common/DataContainerTest.cs b/mcs/class/System.Data/Test/System.Data.Common/DataContainerTest.cs new file mode 100644 index 00000000000..32e6cfd878c --- /dev/null +++ b/mcs/class/System.Data/Test/System.Data.Common/DataContainerTest.cs @@ -0,0 +1,104 @@ +//
+// DataContainerTest.cs - NUnit Test Cases for testing the
+// DataContainer class
+// Author:
+// Umadevi S (sumadevi@novell.com)
+//
+// Copyright (c) 2004 Novell Inc., and the individuals listed
+// on the ChangeLog entries.
+//
+// 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.Data;
+using System.Data.Common; +using System.Data.SqlClient;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.Common
+{
+
+ [TestFixture]
+ public class DataContainerTest : MSSqlTestClient {
+
+ [SetUp]
+ public void GetReady () {
+ OpenConnection ();
+ CreateTestSetup (); // create test database & tables
+ }
+
+ [TearDown]
+ public void Clean () {
+ CleanTestSetup (); // clean test database
+ CloseConnection ();
+ } + + private void CreateTestSetup() + { + if (!isConnAlive) + return ; + // Create test database & tables + string createQuery = "DROP TABLE datetimetest;" ; + ExecuteQuery (createQuery); + createQuery = "CREATE TABLE datetimetest (" + + "col_char CHAR(20)," + + "col_date DATETIME );"; + ExecuteQuery (createQuery); + createQuery = "INSERT INTO datetimetest VALUES ('one', '4/12/2004 4:59:00');" ; + ExecuteQuery (createQuery); + createQuery = "INSERT INTO datetimetest VALUES ('two',null);" ; + ExecuteQuery (createQuery); + createQuery = "INSERT INTO datetimetest (col_char) VALUES ('three');" ; + ExecuteQuery (createQuery); + + + } + + private void CleanTestSetup() + { + if (!isConnAlive) + return; + // delete test database + string dropQuery = "DROP table datetimetest"; + ExecuteQuery(dropQuery); + + } +
+
+ [Test]
+ public void DateTimeTest () {
+ try { + + SqlDataAdapter myadapter = new SqlDataAdapter("select * from datetimetest;",conn); + + DataTable dt = new DataTable(); + myadapter.Fill(dt); + Assertion.AssertEquals ("Row count must be three", 3, dt.Rows.Count ); + }
+ + finally { // try/catch is necessary to gracefully close connections
+ CleanTestSetup (); // clean test database
+ CloseConnection ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog b/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog index bd7b77d4f19..7ecb34c9d29 100644 --- a/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog +++ b/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog @@ -1,3 +1,24 @@ +2004-08-31 Umadevi S <sumadevi@novell.com> + * OdbcDataReaderTest.cs - Added a test for Numeric Type + +2004-08-27 Sureshkumar T <tsureshkumar@novell.com> + * OdbcDataReaderTest.cs - Added a test for TinyInt + +2004-08-26 Sureshkumar T <tsureshkumar@novell.com> + * OdbcDataReaderTest.cs - Added a test for DateTime - GetDateTimeTest + * OdbcCommandTest.cs - Syntax Error Fix + +2004-07-29 Umadevi S <sumadevi@novell.com> + * OdbcCommandTest.cs - Added testcase for bug 62046. ExecuteNonQuery + +2004-07-28 Umadevi S <sumadevi@novell.com> + * OdbcCommandTest.cs - Added testcase for bug 61968. String values passed with quotes + +2004-07-01 Sureshkumar T <tsureshkumar@novell.com> + * Added test case for OdbcCommand.ExecuteScalar Method + * New files: + OdbcCommandTest.cs - test suite for OdbcCommand class. + 2004-06-23 Sureshkumar T <TSureshkumar@novell.com> * Added test to check whether the OdbcConnection.Close method closes all the handles. diff --git a/mcs/class/System.Data/Test/System.Data.Odbc/OdbcCommandTest.cs b/mcs/class/System.Data/Test/System.Data.Odbc/OdbcCommandTest.cs new file mode 100644 index 00000000000..f46cf29c6c7 --- /dev/null +++ b/mcs/class/System.Data/Test/System.Data.Odbc/OdbcCommandTest.cs @@ -0,0 +1,113 @@ +//
+// OdbcCommandTest.cs - NUnit Test Cases for testing the
+// OdbcCommand class
+//
+// Authors:
+// Sureshkumar T (TSureshkumar@novell.com)
+// Umadevi S (sumadevi@novell.com)
+//
+// Copyright (c) 2004 Novell Inc., and the individuals listed
+// on the ChangeLog entries.
+//
+// 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.Data;
+using System.Data.Odbc;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.Odbc
+{
+
+ [TestFixture]
+ public class OdbcCommandTest : MySqlOdbcBaseClient
+ {
+
+ [SetUp]
+ public void GetReady () {
+ OpenConnection ();
+ CreateTestSetup (); // create database & test tables
+ }
+
+ [TearDown]
+ public void Clean () {
+ CleanTestSetup (); // clean test database;
+ CloseConnection ();
+ }
+
+ /// <summary>
+ /// Test Execute Scalar Method
+ /// </summary>
+ [Test]
+ public void ExecuteScalarTest ()
+ {
+ OdbcCommand cmd = conn.CreateCommand ();
+ string query = "select count(*) from test order by col_int;";
+ cmd.CommandText = query;
+ object objCount = cmd.ExecuteScalar ();
+ Assertion.AssertEquals( "ExecuteScalar does not return int type", 5, Convert.ToInt32(objCount));
+ }
+
+ /// <summary>
+ /// Test String parameters to ODBC Command
+ /// </summary>
+ [Test]
+ public void ExecuteStringParameterTest()
+ {
+
+ OdbcCommand dbcmd = new OdbcCommand();
+ dbcmd.Connection = conn;
+ dbcmd.CommandType = CommandType.Text;
+ dbcmd.CommandText = "select count(*) from test where col_char=?;";
+ string colvalue = "mono test#1";
+ dbcmd.Parameters.Add("@un",colvalue);
+ Object obj = dbcmd.ExecuteScalar();
+ Assertion.AssertEquals( "String parameter not passed correctly",1,Convert.ToInt32(obj));
+
+
+ }
+
+ /// <summary>
+ /// Test ExecuteNonQuery
+ /// </summary>
+ [Test]
+ public void ExecuteNonQueryTest ()
+ {
+
+ OdbcCommand dbcmd = new OdbcCommand();
+ dbcmd.Connection = conn;
+ dbcmd.CommandType = CommandType.Text;
+ dbcmd.CommandText = "select count(*) from test where col_char=?;";
+ string colvalue = "mono test";
+ dbcmd.Parameters.Add("@un",colvalue);
+ int ret = dbcmd.ExecuteNonQuery();
+ Assertion.AssertEquals( "ExecuteNonQuery not working",-1, ret);
+ dbcmd = new OdbcCommand();
+ dbcmd.Connection = conn;
+ dbcmd.CommandType = CommandType.Text;
+ dbcmd.CommandText = "delete from test where (col_int >257);";
+ ret = dbcmd.ExecuteNonQuery();
+ Assertion.AssertEquals("ExecuteNonQuery not working", 2, ret);
+ }
+
+}
diff --git a/mcs/class/System.Data/Test/System.Data.Odbc/OdbcDataReaderTest.cs b/mcs/class/System.Data/Test/System.Data.Odbc/OdbcDataReaderTest.cs index 0017b818681..b8ceeafbbbb 100644 --- a/mcs/class/System.Data/Test/System.Data.Odbc/OdbcDataReaderTest.cs +++ b/mcs/class/System.Data/Test/System.Data.Odbc/OdbcDataReaderTest.cs @@ -231,5 +231,106 @@ namespace MonoTests.System.Data.Odbc CloseConnection ();
}
}
+
+ [Test]
+ public void GetDateTimeTest ()
+ {
+ OdbcCommand cmd = conn.CreateCommand ();
+ string sql = "SELECT * FROM test";
+ cmd.CommandText = sql;
+ OdbcDataReader reader = cmd.ExecuteReader (CommandBehavior.Default);
+ try {
+ if (reader.Read ()) {
+ object ob = reader["col_datetime"];
+ Assertion.AssertEquals ("Type of datetime column is wrong!",
+ "System.DateTime", ob.GetType ().ToString () );
+ ob = reader["col_date"];
+ Assertion.AssertEquals ("Type of date column is wrong!",
+ "System.DateTime", ob.GetType ().ToString () );
+ // FIXME : Once TIME data type is fixed, enable this check
+ //ob = reader["col_time"];
+ //Assertion.AssertEquals ("Type of time column is wrong!",
+ //"System.DateTime", ob.GetType ().ToString () );
+
+ DateTime dt = reader.GetDateTime (4);
+ Assertion.AssertEquals ("DateValue (SQL_TIMESTAMP) is wrong", new DateTime (2004, 8, 22, 0, 0, 0), dt);
+ dt = reader.GetDateTime (5);
+ Assertion.AssertEquals ("DateValue (SQL_DATE) is wrong", new DateTime (2004, 8, 22, 0, 0, 0), dt);
+ // FIXME : Once TIME data type is fixed, enable this check
+ //dt = reader.GetDateTime (7);
+ //Assertion.AssertEquals ("DateValue is wrong", "2004-08-22", dt.ToString ());
+ }
+ } finally {
+ // clean up
+ if (reader != null && !reader.IsClosed )
+ reader.Close ();
+ reader = null;
+ CleanTestSetup ();
+ CloseConnection ();
+ }
+ }
+
+
+ /// <summary>
+ /// This test for the return type & value for GetValue
+ /// in case of Odbc Data type TINYINT
+ /// </summary>
+ [Test]
+ public void TinyIntTest ()
+ {
+ OdbcCommand cmd = conn.CreateCommand ();
+ string sql = "SELECT * FROM test";
+ cmd.CommandText = sql;
+ OdbcDataReader reader = cmd.ExecuteReader (CommandBehavior.SequentialAccess);
+ try {
+ if (reader.Read ()) {
+ object ob = reader.GetValue (0);
+ Assertion.AssertEquals ("Type of tinyInt column is wrong!",
+ "System.Byte", ob.GetType ().ToString () );
+ Assertion.AssertEquals ("Value of tinyInt column is wrong!",
+ 1, System.Convert.ToInt16(ob) );
+ }
+ } finally {
+ // clean up
+ if (reader != null && !reader.IsClosed )
+ reader.Close ();
+ reader = null;
+ CleanTestSetup ();
+ CloseConnection ();
+ }
+ }
+
+ [Test]
+ public void NumericTest()
+ {
+ using(IDbConnection dbConnection = new OdbcConnection(connectionString))
+ {
+ dbConnection.Open();
+ IDbCommand dbCommand = dbConnection.CreateCommand();
+ //note this will fail if the table already exists, ie if the test has failed.
+ dbCommand.CommandText = "CREATE TABLE NumericTable (NumericField NUMERIC(10) NOT NULL)";
+ dbCommand.ExecuteNonQuery();
+ dbCommand.CommandText = "INSERT INTO NumericTable (NumericField) VALUES (125)";
+ dbCommand.ExecuteNonQuery();
+ dbCommand.CommandText = "SELECT * FROM NumericTable";
+ using(IDataReader reader = dbCommand.ExecuteReader())
+ {
+ while(reader.Read())
+ {
+ for(int index = 0; index < reader.FieldCount; index++)
+ {
+ Object dataValue = reader.GetValue(index);
+ Assert.AreEqual("System.Decimal",dataValue.GetType().ToString());
+ Assert.AreEqual("125", dataValue.ToString());
+ }
+ }
+ }
+ dbCommand.CommandText = "DROP TABLE NumericTable";
+ dbCommand.ExecuteNonQuery();
+ }
+ }
+
+
+
}
}
diff --git a/mcs/class/System.Data/Test/System.Data.SqlClient/SqlCommandTest.cs b/mcs/class/System.Data/Test/System.Data.SqlClient/SqlCommandTest.cs new file mode 100644 index 00000000000..9d58e4c977a --- /dev/null +++ b/mcs/class/System.Data/Test/System.Data.SqlClient/SqlCommandTest.cs @@ -0,0 +1,99 @@ +//
+// SqlCommandTest.cs - NUnit Test Cases for testing the
+// SqlCommand class
+// Author:
+// Umadevi S (sumadevi@novell.com)
+//
+// Copyright (c) 2004 Novell Inc., and the individuals listed
+// on the ChangeLog entries.
+//
+// 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.Data;
+using System.Data.Common; +using System.Data.SqlClient;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient +{
+
+ [TestFixture]
+ public class SqlCommandTest : MSSqlTestClient {
+
+ [SetUp]
+ public void GetReady () {
+ OpenConnection ();
+ }
+
+ [TearDown]
+ public void Clean () {
+ CloseConnection ();
+ } + + /** + This is required to be run only once, call this from the GetReady. + **/ + private void setup(){ + string createquery = "CREATE PROCEDURE sp_insert @TestPar1 varchar(50),@BirthDate datetime as insert into Employees(LastName,FirstName) VALUES('SSS','uuuu') "; + SqlCommand cmd = new SqlCommand(); + cmd.Connection = conn; + cmd.CommandText = createquery; + int ret =cmd.ExecuteNonQuery(); + } + + + [Test]
+ /** + The below test expects the stored procedure sp_insert in the database. + **/ + public void ExecuteNonQueryTest () { + try { + SqlCommand cmd = new SqlCommand(); + cmd.Connection = conn; + cmd.CommandText = "sp_insert"; + cmd.CommandType = CommandType.StoredProcedure; + Object TestPar = System.DBNull.Value; + cmd.Parameters.Add("@TestPar1",SqlDbType.Int); + cmd.Parameters["@TestPar1"].Value = TestPar; + cmd.Parameters.Add("@BirthDate",DateTime.Now); + Assert.AreEqual(-1,cmd.ExecuteNonQuery()); + }
+ catch (Exception e) { + Assert.Fail("A#01 Got an exception"); + Console.WriteLine(e.Message); + Console.WriteLine(e.StackTrace); + + } + + finally { // try/catch is necessary to gracefully close connections
+ + CloseConnection ();
+ }
+ }
+ + + + + + }
+}
diff --git a/mcs/class/System.Data/Test/System.Data.SqlClient/SqlTransactionTest.cs b/mcs/class/System.Data/Test/System.Data.SqlClient/SqlTransactionTest.cs new file mode 100644 index 00000000000..c91e27631cc --- /dev/null +++ b/mcs/class/System.Data/Test/System.Data.SqlClient/SqlTransactionTest.cs @@ -0,0 +1,85 @@ +//
+// SqlTransactionTest.cs - NUnit Test Cases for testing the
+// SqlTransaction class
+// Author:
+// Umadevi S (sumadevi@novell.com)
+//
+// Copyright (c) 2004 Novell Inc., and the individuals listed
+// on the ChangeLog entries.
+//
+// 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.Data;
+using System.Data.Common; +using System.Data.SqlClient;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient +{
+
+ [TestFixture]
+ public class SqlTransactionTest : MSSqlTestClient {
+
+ [SetUp]
+ public void GetReady () {
+ OpenConnection ();
+ }
+
+ [TearDown]
+ public void Clean () {
+ CloseConnection ();
+ } + + [Test]
+ /** + The below test expects a table table4 with a bigint column. + **/ + public void TransactionCommitTest () { + + using (SqlTransaction transaction = conn.BeginTransaction()) + { + try + { + string sSql = "Insert into Region(RegionID,RegionDescription) Values ('10112', 'NovellBangalore')"; + SqlCommand command = new SqlCommand(); + command.Connection = conn; + command.CommandText = sSql; + command.Transaction = transaction; + command.CommandType = CommandType.Text; + command.ExecuteNonQuery(); + transaction.Commit(); + } + catch (System.Exception ex) + { + transaction.Rollback(); + } + finally + { + conn.Close(); + } + + } + } + + }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/ChangeLog b/mcs/class/System.Data/Test/System.Data/ChangeLog index 48ffde727ce..bf54a190e1e 100644 --- a/mcs/class/System.Data/Test/System.Data/ChangeLog +++ b/mcs/class/System.Data/Test/System.Data/ChangeLog @@ -1,3 +1,19 @@ +2004-10-12 Atsushi Enomoto <atsushi@ximian.com> + + * DataSetTest.cs : now xs:schema contains xmlns="". + +2004-09-24 Umadevi S <sumadevi@novell.com> + * DataRowTest.cs : Added a test for EnforceConstraints with relations defined. + +2004-09-24 Sureshkumar T <tsureshkumar@novell.com> + + * DataSetTest.cs (DataSetClearTest): Added a test for DataSet.Clear. This should not + throw any exception and should override constraints. + +2004-09-21 Sureshkumar T <tsureshkumar@novell.com> + + * DataSetTest.cs : Added a test for Deserialization of dataset : DeserializeModifiedDataSet + 2004-06-23 Umadevi S <sumadevi@novell.com> * DataTableTest.cs :Corrected Testcases to .net 1.1 specifications diff --git a/mcs/class/System.Data/Test/System.Data/DataRowTest.cs b/mcs/class/System.Data/Test/System.Data/DataRowTest.cs index a82637dc9cd..2f347ddd005 100644 --- a/mcs/class/System.Data/Test/System.Data/DataRowTest.cs +++ b/mcs/class/System.Data/Test/System.Data/DataRowTest.cs @@ -756,5 +756,42 @@ namespace MonoTests.System.Data dt.Columns.Add (col);
dt.Rows [0] [0] = "test"; } + + [Test] + public void EnforceConstraint () + { + int id = 100; + // Setup stuff + DataSet ds = new DataSet(); + DataTable parent = ds.Tables.Add("parent"); + parent.Columns.Add("id", typeof(int)); + DataTable child = ds.Tables.Add("child"); + child.Columns.Add("idref", typeof(int)); + Constraint uniqueId = null; + parent.Constraints.Add(uniqueId = new UniqueConstraint("uniqueId", + new DataColumn[] {parent.Columns["id"]}, true)); + ForeignKeyConstraint fkc = new ForeignKeyConstraint("ParentChildConstraint", new DataColumn[] { parent.Columns["id"] }, + new DataColumn[] { child.Columns["idref"]}); + + child.Constraints.Add(fkc); + + DataRelation relateParentChild = new DataRelation("relateParentChild", + new DataColumn[] {parent.Columns["id"] }, + new DataColumn[] {child.Columns["idref"] }, + false); + ds.Relations.Add(relateParentChild); + + ds.EnforceConstraints = false; + DataRow parentRow = parent.Rows.Add(new object[] { id }); + DataRow childRow = child.Rows.Add(new object[] { id }); + if (parentRow == childRow.GetParentRow(relateParentChild)) { + foreach(DataColumn dc in parent.Columns) + AssertEquals(100,parentRow[dc]); + + } + + + } + } } diff --git a/mcs/class/System.Data/Test/System.Data/DataSetTest.cs b/mcs/class/System.Data/Test/System.Data/DataSetTest.cs index 766f0e86863..2dbaf879d17 100644 --- a/mcs/class/System.Data/Test/System.Data/DataSetTest.cs +++ b/mcs/class/System.Data/Test/System.Data/DataSetTest.cs @@ -195,7 +195,7 @@ namespace MonoTests.System.Data TextString = TextString.Substring (TextString.IndexOf(EOL) + EOL.Length); // FIXME: modified attributes based on XmlSchema.Write difference // AssertEquals ("test#02", "<xs:schema id=\"test_dataset\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">", substring); - AssertEquals ("test#02", "<xs:schema xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" id=\"test_dataset\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">", substring); + AssertEquals ("test#02", "<xs:schema xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" id=\"test_dataset\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">", substring); substring = TextString.Substring (0, TextString.IndexOf(EOL)); TextString = TextString.Substring (TextString.IndexOf(EOL) + EOL.Length); @@ -551,7 +551,7 @@ namespace MonoTests.System.Data TextString = TextString.Substring (TextString.IndexOf(EOL) + EOL.Length); // FIXME: modified attributes based on XmlSchema.Write difference // AssertEquals ("test#02", "<xs:schema id=\"Root\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">", substring); - AssertEquals ("test#02", "<xs:schema xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" id=\"Root\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">", substring); + AssertEquals ("test#02", "<xs:schema xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" id=\"Root\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">", substring); substring = TextString.Substring (0, TextString.IndexOf(EOL)); TextString = TextString.Substring (TextString.IndexOf(EOL) + EOL.Length); @@ -641,7 +641,7 @@ namespace MonoTests.System.Data TextString = TextString.Substring (TextString.IndexOf(EOL) + EOL.Length); // FIXME: modified attributes based on XmlSchema.Write difference // AssertEquals ("test#02", "<xs:schema id=\"NewDataSet\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">", substring); - AssertEquals ("test#02", "<xs:schema xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" id=\"NewDataSet\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">", substring); + AssertEquals ("test#02", "<xs:schema xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" id=\"NewDataSet\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">", substring); substring = TextString.Substring (0, TextString.IndexOf(EOL)); TextString = TextString.Substring (TextString.IndexOf(EOL) + EOL.Length); @@ -784,7 +784,7 @@ namespace MonoTests.System.Data // FIXME: modified attributes based on XmlSchema.Write difference // AssertEquals ("test#02", "<xs:schema id=\"Root\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">", substring); #if MS_NET // MS System.XML.dll + Mono System.Data.dll - AssertEquals ("test#02", "<xs:schema xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" id=\"Root\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">", substring); + AssertEquals ("test#02", "<xs:schema xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" id=\"Root\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">", substring); #else AssertEquals ("test#02", "<xs:schema xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" id=\"Root\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">", substring); #endif @@ -957,7 +957,7 @@ namespace MonoTests.System.Data */ #if MS_NET // MS System.XML.dll + Mono System.Data.dll string schema = @"<?xml version='1.0' encoding='utf-16'?> -<xs:schema xmlns:mstns='urn:bar' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:app1='urn:baz' xmlns:app2='urn:foo' xmlns='urn:bar' attributeFormDefault='qualified' elementFormDefault='qualified' targetNamespace='urn:bar' id='NewDataSet' xmlns:xs='http://www.w3.org/2001/XMLSchema'> +<xs:schema xmlns:mstns='urn:bar' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:app1='urn:baz' xmlns:app2='urn:foo' xmlns='urn:bar' attributeFormDefault='qualified' elementFormDefault='qualified' targetNamespace='urn:bar' id='NewDataSet' xmlns='' xmlns:xs='http://www.w3.org/2001/XMLSchema'> <xs:import schemaLocation='_app1.xsd' namespace='urn:baz' /> <xs:import schemaLocation='_app2.xsd' namespace='urn:foo' /> <xs:element msdata:IsDataSet='true' msdata:Locale='fi-FI' name='NewDataSet'> @@ -973,7 +973,7 @@ namespace MonoTests.System.Data </xs:schema>"; #else string schema = @"<?xml version='1.0' encoding='utf-16'?> -<xs:schema xmlns:app1='urn:baz' xmlns:app2='urn:foo' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:mstns='urn:bar' id='NewDataSet' elementFormDefault='qualified' attributeFormDefault='qualified' targetNamespace='urn:bar' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns='urn:bar'> +<xs:schema xmlns:app1='urn:baz' xmlns:app2='urn:foo' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:mstns='urn:bar' id='NewDataSet' elementFormDefault='qualified' attributeFormDefault='qualified' targetNamespace='urn:bar' xmlns='' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns='urn:bar'> <!--ATTENTION: This schema contains references to other imported schemas--> <xs:import namespace='urn:baz' schemaLocation='_app1.xsd' /> <xs:import namespace='urn:foo' schemaLocation='_app2.xsd' /> @@ -1037,9 +1037,9 @@ namespace MonoTests.System.Data // string xml = "<?xml version='1.0' encoding='utf-16'?><DataSet><xs:schema id='DS' xmlns='' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'><xs:element name='DS' msdata:IsDataSet='true' msdata:Locale='fi-FI'><xs:complexType><xs:choice maxOccurs='unbounded' /></xs:complexType></xs:element></xs:schema><diffgr:diffgram xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1' /></DataSet>"; // Modified attribute order from MS result #if MS_NET // MS System.XML.dll + Mono System.Data.dll - string xml = "<?xml version='1.0' encoding='utf-16'?><DataSet><xs:schema xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' id='DS' xmlns:xs='http://www.w3.org/2001/XMLSchema'><xs:element msdata:IsDataSet='true' msdata:Locale='fi-FI' name='DS'><xs:complexType><xs:choice maxOccurs='unbounded' /></xs:complexType></xs:element></xs:schema><diffgr:diffgram xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1' /></DataSet>"; + string xml = "<?xml version='1.0' encoding='utf-16'?><DataSet><xs:schema xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' id='DS' xmlns='' xmlns:xs='http://www.w3.org/2001/XMLSchema'><xs:element msdata:IsDataSet='true' msdata:Locale='fi-FI' name='DS'><xs:complexType><xs:choice maxOccurs='unbounded' /></xs:complexType></xs:element></xs:schema><diffgr:diffgram xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1' /></DataSet>"; #else - string xml = "<?xml version='1.0' encoding='utf-16'?><DataSet><xs:schema xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' id='DS' xmlns:xs='http://www.w3.org/2001/XMLSchema'><xs:element name='DS' msdata:IsDataSet='true' msdata:Locale='fi-FI'><xs:complexType><xs:choice maxOccurs='unbounded' /></xs:complexType></xs:element></xs:schema><diffgr:diffgram xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1' /></DataSet>"; + string xml = "<?xml version='1.0' encoding='utf-16'?><DataSet><xs:schema xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' id='DS' xmlns='' xmlns:xs='http://www.w3.org/2001/XMLSchema'><xs:element name='DS' msdata:IsDataSet='true' msdata:Locale='fi-FI'><xs:complexType><xs:choice maxOccurs='unbounded' /></xs:complexType></xs:element></xs:schema><diffgr:diffgram xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1' /></DataSet>"; #endif DataSet ds = new DataSet (); ds.DataSetName = "DS"; @@ -1235,5 +1235,74 @@ namespace MonoTests.System.Data ds.WriteXml (xtw); AssertEquals (xml, sw.ToString ()); } + + [Test] + public void DeserializeModifiedDataSet () + { + // Serialization begins + DataSet prevDs = new DataSet (); + DataTable dt = prevDs.Tables.Add (); + dt.Columns.Add(new DataColumn("Id", typeof(string))); + + DataRow dr = dt.NewRow(); + dr [0] = "a"; + dt.Rows.Add (dr); + prevDs.AcceptChanges (); + dr = prevDs.Tables[0].Rows[0]; + dr [0] = "b"; + + XmlSerializer serializer = new XmlSerializer (typeof (DataSet)); + StringWriter sw = new StringWriter (); + XmlTextWriter xw = new XmlTextWriter (sw); + xw.QuoteChar = '\''; + serializer.Serialize (xw, prevDs); + + // Deserialization begins + StringReader sr = new StringReader (sw.ToString ()); + XmlTextReader reader = new XmlTextReader (sr); + XmlSerializer serializer1 = new XmlSerializer (typeof (DataSet)); + DataSet ds = serializer1.Deserialize (reader) as DataSet; + AssertEquals ("deserialization after modification does not give original values", + prevDs.Tables[0].Rows [0][0,DataRowVersion.Original].ToString (), + ds.Tables[0].Rows [0][0,DataRowVersion.Original].ToString ()); + AssertEquals ("deserialization after modification does not give current values", + prevDs.Tables[0].Rows [0][0,DataRowVersion.Current].ToString (), + ds.Tables[0].Rows [0][0,DataRowVersion.Current].ToString ()); + } + + /// <summary> + /// Test for testing DataSet.Clear method with foriegn key relations + /// This is expected to clear all the related datatable rows also + /// </summary> + [Test] + public void DataSetClearTest () + { + DataSet ds = new DataSet (); + DataTable parent = ds.Tables.Add ("Parent"); + DataTable child = ds.Tables.Add ("Child"); + + parent.Columns.Add ("id", typeof (int)); + child.Columns.Add ("ref_id", typeof(int)); + + child.Constraints.Add (new ForeignKeyConstraint ("fk_constraint", parent.Columns [0], child.Columns [0])); + + DataRow dr = parent.NewRow (); + dr [0] = 1; + parent.Rows.Add (dr); + dr.AcceptChanges (); + + dr = child.NewRow (); + dr [0] = 1; + child.Rows.Add (dr); + dr.AcceptChanges (); + + try { + ds.Clear (); // this should clear all the rows in parent & child tables + } catch (Exception e) { + throw (new Exception ("Exception should not have been thrown at Clear method" + e.ToString ())); + } + Assertion.AssertEquals ("parent table rows should not exist!", 0, parent.Rows.Count); + Assertion.AssertEquals ("child table rows should not exist!", 0, child.Rows.Count); + } } } diff --git a/mcs/class/System.Design/ChangeLog b/mcs/class/System.Design/ChangeLog index 968eb46dbe3..96cbf388a3b 100755 --- a/mcs/class/System.Design/ChangeLog +++ b/mcs/class/System.Design/ChangeLog @@ -1,3 +1,8 @@ +2004-10-26 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * System.Design.dll.sources: added files in + System.Web.UI.Design.WebControls. + 2004-06-11 Gert Driesen <drieseng@users.sourceforge.net> * System.Design.dll.sources: added more stub for classes diff --git a/mcs/class/System.Design/System.Design.dll.sources b/mcs/class/System.Design/System.Design.dll.sources index 9cfd620c7c4..f4ca0cf3091 100755 --- a/mcs/class/System.Design/System.Design.dll.sources +++ b/mcs/class/System.Design/System.Design.dll.sources @@ -59,6 +59,32 @@ System.Web.UI.Design/WebControlToolboxItem.cs System.Web.UI.Design/XmlFileEditor.cs System.Web.UI.Design/XmlUrlEditor.cs System.Web.UI.Design/XslUrlEditor.cs +System.Web.UI.Design.WebControls/FormatPageInternal.cs +System.Web.UI.Design.WebControls/GeneralPageDataListInternal.cs +System.Web.UI.Design.WebControls/PanelDesigner.cs +System.Web.UI.Design.WebControls/TableDesigner.cs +System.Web.UI.Design.WebControls/HyperLinkDesigner.cs +System.Web.UI.Design.WebControls/BordersPageInternal.cs +System.Web.UI.Design.WebControls/CalendarDesigner.cs +System.Web.UI.Design.WebControls/CheckBoxDesigner.cs +System.Web.UI.Design.WebControls/LinkButtonDesigner.cs +System.Web.UI.Design.WebControls/AdRotatorDesigner.cs +System.Web.UI.Design.WebControls/TableRowsCollectionEditor.cs +System.Web.UI.Design.WebControls/RepeaterDesigner.cs +System.Web.UI.Design.WebControls/RegexTypeEditor.cs +System.Web.UI.Design.WebControls/BaseValidatorDesigner.cs +System.Web.UI.Design.WebControls/BaseDataListPageInternal.cs +System.Web.UI.Design.WebControls/BaseDataListDesigner.cs +System.Web.UI.Design.WebControls/CalendarAutoFormatDialog.cs +System.Web.UI.Design.WebControls/TODOAttribute.cs +System.Web.UI.Design.WebControls/RegexEditorDialog.cs +System.Web.UI.Design.WebControls/XmlDesigner.cs +System.Web.UI.Design.WebControls/TableCellsCollectionEditor.cs +System.Web.UI.Design.WebControls/ButtonDesigner.cs +System.Web.UI.Design.WebControls/BaseDataListComponentEditor.cs +System.Web.UI.Design.WebControls/ListControlDataBindingHandler.cs +System.Web.UI.Design.WebControls/LabelDesigner.cs +System.Web.UI.Design.WebControls/DataListComponentEditor.cs System.Windows.Forms.Design/AnchorEditor.cs System.Windows.Forms.Design/AxImporter.cs System.Windows.Forms.Design/AxParameterData.cs diff --git a/mcs/class/System.Drawing/System.Drawing/ChangeLog b/mcs/class/System.Drawing/System.Drawing/ChangeLog index 941f5db4a6c..48b2c8a2537 100644 --- a/mcs/class/System.Drawing/System.Drawing/ChangeLog +++ b/mcs/class/System.Drawing/System.Drawing/ChangeLog @@ -1,3 +1,27 @@ +2004-10-04 Ravindra <rkumar@novell.com> + + * gdipFunctioncs.cs: Backporting. Fix from Alois for bug #67383. + +2004-09-22 Ravindra <rkumar@novell.com> + + * gdipFunctions.cs: Backporting. Improved the exception message + for unsupported image formats. + +2004-09-13 Ravindra <rkumar@novell.com> + + * Graphics.cs: MSDN says that using image width and height gives + better performance, hence we are using image width and height to + avoid autoscaling in DrawImageUnscaled. DrawImageUnscaled method. + +2004-09-10 Ravindra <rkumar@novell.com> + + * Font.cs: Fixed Height property and GetHeight method. + * Graphics.cs: Fixed DrawImageUnscaled method. + +2004-07-02 Jordi Mas i Hernandez <jordi@ximian.com> + + * gdipFunctions.cs: fixes bug 61050 + 2004-06-24 Sanjay Gupta <gsanjay@novell.com> * ImageAnimator.cs: Rewrote complete implementation. diff --git a/mcs/class/System.Drawing/System.Drawing/Font.cs b/mcs/class/System.Drawing/System.Drawing/Font.cs index 31044a5b306..ee3ffdfc6c9 100644 --- a/mcs/class/System.Drawing/System.Drawing/Font.cs +++ b/mcs/class/System.Drawing/System.Drawing/Font.cs @@ -395,12 +395,10 @@ namespace System.Drawing } } - private int _height; - [Browsable (false)] public int Height { get { - return _height; + return (int) Math.Ceiling (GetHeight ()); } } @@ -511,7 +509,7 @@ namespace System.Drawing public float GetHeight () { - return (float) _height; + return GetHeight (Graphics.systemDpiY); } [MonoTODO] @@ -532,19 +530,68 @@ namespace System.Drawing throw new NotImplementedException (); } - [MonoTODO] public float GetHeight (Graphics graphics) { - if (Unit == GraphicsUnit.Pixel || Unit == GraphicsUnit.World) - return GetHeight (); + float height = GetHeight (graphics.DpiY); + + switch (graphics.PageUnit) { + case GraphicsUnit.Document: + height *= (300f / graphics.DpiY); + break; + case GraphicsUnit.Display: + height *= (75f / graphics.DpiY); + break; + case GraphicsUnit.Inch: + height /= graphics.DpiY; + break; + case GraphicsUnit.Millimeter: + height *= (25.4f / graphics.DpiY); + break; + case GraphicsUnit.Point: + height *= (72f / graphics.DpiY); + break; + + case GraphicsUnit.Pixel: + case GraphicsUnit.World: + default: + break; + } - throw new NotImplementedException (); + return height; } - [MonoTODO] public float GetHeight (float dpi) { - return GetHeight (); + float height; + int emHeight = _fontFamily.GetEmHeight (_style); + int lineSpacing = _fontFamily.GetLineSpacing (_style); + + height = lineSpacing * (_size / emHeight); + + switch (_unit) { + case GraphicsUnit.Document: + height *= (dpi / 300f); + break; + case GraphicsUnit.Display: + height *= (dpi / 75f); + break; + case GraphicsUnit.Inch: + height *= dpi; + break; + case GraphicsUnit.Millimeter: + height *= (dpi / 25.4f); + break; + case GraphicsUnit.Point: + height *= (dpi / 72f); + break; + + case GraphicsUnit.Pixel: + case GraphicsUnit.World: + default: + break; + } + + return height; } public override String ToString () diff --git a/mcs/class/System.Drawing/System.Drawing/Graphics.cs b/mcs/class/System.Drawing/System.Drawing/Graphics.cs index 54c750c03ff..a580eb2e19b 100755 --- a/mcs/class/System.Drawing/System.Drawing/Graphics.cs +++ b/mcs/class/System.Drawing/System.Drawing/Graphics.cs @@ -651,22 +651,27 @@ namespace System.Drawing public void DrawImageUnscaled (Image image, Point point) { - DrawImage(image, point.X, point.Y); + DrawImageUnscaled (image, point.X, point.Y); } public void DrawImageUnscaled (Image image, Rectangle rect) { - DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height); + DrawImageUnscaled (image, rect.X, rect.Y, rect.Width, rect.Height); } public void DrawImageUnscaled (Image image, int x, int y) { - DrawImage(image, x, y); + DrawImage (image, x, y, image.Width, image.Height); } public void DrawImageUnscaled (Image image, int x, int y, int width, int height) { - DrawImage(image, x, y, width, height); + Image tmpImg = new Bitmap (width, height); + Graphics g = FromImage (tmpImg); + g.DrawImage (image, 0, 0, image.Width, image.Height); + this.DrawImage (tmpImg, x, y, width, height); + tmpImg.Dispose (); + g.Dispose (); } public void DrawLine (Pen pen, PointF pt1, PointF pt2) diff --git a/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs b/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs index 8db7223a85c..8c408cd58fb 100644 --- a/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs +++ b/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs @@ -7,11 +7,7 @@ // Sanjay Gupta (gsanjay@novell.com) // Ravindra (rkumar@novell.com) // -// Copyright (C) 2004 Novell, Inc. http://www.novell.com -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// Copyright (C) 2004 Novell, Inc. (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -161,7 +157,7 @@ namespace System.Drawing throw new UnauthorizedAccessException ("Access denied."); case Status.UnknownImageFormat: - throw new NotSupportedException ("Unknown image format."); + throw new NotSupportedException ("Either image format is unknown or you don't have the required libraries for this format."); case Status.NotImplemented: throw new NotImplementedException ("Feature not implemented."); @@ -1418,7 +1414,12 @@ namespace System.Drawing { public Stream stream; - public GdiPlusStreamHelper (Stream s) { stream = s; } + public GdiPlusStreamHelper (Stream s) + { + stream = s; + if (stream.CanSeek) + stream.Seek (0, SeekOrigin.Begin); + } public int StreamGetBytesImpl (IntPtr buf, int bufsz, bool peek) { diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/ChangeLog b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/ChangeLog index 42d69cb17d6..a638962017f 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/ChangeLog +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/ChangeLog @@ -1,3 +1,8 @@ +2004-07-15 Lluis Sanchez Gual <lluis@novell.com> + + * TcpServerChannel.cs: Set channel name from the provided properties. + This fixes bug #61592. + 2004-05-13 Lluis Sanchez Gual <lluis@ximian.com> * TcpChannel.cs: Made Init private. diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs index 945dff1e278..6e3aba6f960 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs @@ -106,6 +106,9 @@ namespace System.Runtime.Remoting.Channels.Tcp {
switch((string)property.Key)
{
+ case "name": + name = property.Value.ToString(); + break; case "port":
port = Convert.ToInt32(property.Value); break;
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog index c2ea35962b2..47d41efa66e 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog @@ -1,3 +1,14 @@ +2004-07-26 Lluis Sanchez Gual <lluis@ximian.com> + + * SoapMessageFormater.cs: In BuildSoapMessageFromMethodResponse, add the + return value to the SoapMessage even if it is null. This fixes bug #61837. + +2004-07-06 Lluis Sanchez Gual <lluis@ximian.com> + + * SoapMessageFormatter.cs: In BuildMethodCallFromSoapMessage, set get the + parameters from the SoapMessage by position, not by name, since names + may be different. This fixes bug #60427. + 2004-06-16 Lluis Sanchez Gual <lluis@ximian.com> * SoapServerFormatterSink.cs: Removed unneded method. diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapMessageFormatter.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapMessageFormatter.cs index e0508f1cb82..2de868c9bee 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapMessageFormatter.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapMessageFormatter.cs @@ -222,21 +222,21 @@ namespace System.Runtime.Remoting.Channels { // have to add them here
_methodCallParameters = _methodCallInfo.GetParameters();
object[] args = new object[_methodCallParameters.Length];
-
- foreach(ParameterInfo paramInfo in _methodCallParameters)
+ int sn = 0;
+ for (int n=0; n<_methodCallParameters.Length; n++)
{
+ ParameterInfo paramInfo = _methodCallParameters [n];
Type paramType = (paramInfo.ParameterType.IsByRef ? paramInfo.ParameterType.GetElementType() : paramInfo.ParameterType);
if (paramInfo.IsOut && paramInfo.ParameterType.IsByRef) {
- args [paramInfo.Position] = GetNullValue (paramType);
+ args [n] = GetNullValue (paramType);
}
else{
- int index = Array.IndexOf(soapMessage.ParamNames, paramInfo.Name);
- if(soapMessage.ParamValues[index] is IConvertible)
- soapMessage.ParamValues[index] = Convert.ChangeType(
- soapMessage.ParamValues[index],
- paramType);
- args [paramInfo.Position] = soapMessage.ParamValues[index];
+ object val = soapMessage.ParamValues[sn++];
+ if(val is IConvertible)
+ args [n] = Convert.ChangeType (val, paramType);
+ else
+ args [n] = val;
}
}
@@ -267,10 +267,16 @@ namespace System.Runtime.Remoting.Channels { ArrayList paramValues = new ArrayList();
ArrayList paramTypes = new ArrayList();
soapMessage.MethodName = mrm.MethodName+"Response";
- if(mrm.ReturnValue != null && mrm.ReturnValue.GetType() != typeof(void)) {
+
+ Type retType = ((MethodInfo)mrm.MethodBase).ReturnType;
+
+ if(retType != typeof(void)) {
paramNames.Add("return");
paramValues.Add(mrm.ReturnValue);
- paramTypes.Add(mrm.ReturnValue.GetType());
+ if (mrm.ReturnValue != null)
+ paramTypes.Add(mrm.ReturnValue.GetType());
+ else
+ paramTypes.Add(retType);
}
for(int i = 0; i < mrm.OutArgCount; i++){
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog index a0b692b21d0..4fbb13a002a 100644 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog +++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog @@ -1,3 +1,8 @@ +2004-07-20 Atsushi Enomoto <atsushi@ximian.com> + + * Signature.cs : Fixed NextElementPos() that incorrectly examined + node matching. + 2004-06-17 Sebastien Pouliot <sebastien@ximian.com> * KeyInfoX509Data.cs: Removed old internal IssuerSerial for the diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs index 72e5088ed38..9aab99f8386 100644 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs +++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs @@ -192,13 +192,14 @@ namespace System.Security.Cryptography.Xml { { while (pos < nl.Count) { if (nl [pos].NodeType == XmlNodeType.Element) { - if (nl [pos].LocalName != name && nl [pos].NamespaceURI != ns) { + if (nl [pos].LocalName != name || nl [pos].NamespaceURI != ns) { if (required) throw new CryptographicException ("Malformed element " + name); else return -2; } - return pos; + else + return pos; } else pos++; diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog index 5d3bd203808..e48bd459883 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog @@ -1,3 +1,10 @@ +2004-10-26 Lluis Sanchez Gual <lluis@novell.com> + + * ProtocolImporter.cs, HttpSimpleProtocolImporter.cs, + SoapProtocolImporter.cs: When appsettingurlkey is provided, generate + code that reads the url from the config file, instead of doing it at + the moment of generation. This fixes bug #68795. + 2004-06-25 Lluis Sanchez Gual <lluis@ximian.com> * HttpSimpleProtocolImporter.cs: Added null check. The XmlTypeMapping for diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolImporter.cs index 35280c7df4c..0b068ef2a1e 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolImporter.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolImporter.cs @@ -74,13 +74,10 @@ namespace System.Web.Services.Description string location = null; HttpAddressBinding sab = (HttpAddressBinding) Port.Extensions.Find (typeof(HttpAddressBinding)); if (sab != null) location = sab.Location; - string url = GetServiceUrl (location); CodeConstructor cc = new CodeConstructor (); cc.Attributes = MemberAttributes.Public; - CodeExpression ce = new CodeFieldReferenceExpression (new CodeThisReferenceExpression(), "Url"); - CodeAssignStatement cas = new CodeAssignStatement (ce, new CodePrimitiveExpression (url)); - cc.Statements.Add (cas); + GenerateServiceUrl (location, cc.Statements); codeClass.Members.Add (cc); memberIds = new CodeIdentifiers (); diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs index 62a7ae1be88..797d7162763 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs @@ -334,21 +334,42 @@ namespace System.Web.Services.Description { else return msg.Name; } - internal string GetServiceUrl (string location) + internal void GenerateServiceUrl (string location, CodeStatementCollection stms) { - if (ImportInfo.AppSettingUrlKey == null || ImportInfo.AppSettingUrlKey == string.Empty) - return location; + if (ImportInfo.AppSettingUrlKey == null || ImportInfo.AppSettingUrlKey == string.Empty) { + if (location != null) { + CodeExpression ce = new CodeFieldReferenceExpression (new CodeThisReferenceExpression(), "Url"); + CodeAssignStatement cas = new CodeAssignStatement (ce, new CodePrimitiveExpression (location)); + stms.Add (cas); + } + } else { - string url; - if (Style == ServiceDescriptionImportStyle.Server) throw new InvalidOperationException ("Cannot set appSettingUrlKey if Style is Server"); - url = ConfigurationSettings.AppSettings [ImportInfo.AppSettingUrlKey]; - if (ImportInfo.AppSettingBaseUrl != null && ImportInfo.AppSettingBaseUrl != string.Empty) - url += "/" + ImportInfo.AppSettingBaseUrl + "/" + location; - return url; + CodeExpression prop = new CodePropertyReferenceExpression (new CodeTypeReferenceExpression ("System.Configuration.ConfigurationSettings"), "AppSettings"); + prop = new CodeIndexerExpression (prop, new CodePrimitiveExpression (ImportInfo.AppSettingUrlKey)); + stms.Add (new CodeVariableDeclarationStatement (typeof(string), "urlSetting", prop)); + + CodeExpression urlSetting = new CodeVariableReferenceExpression ("urlSetting"); + CodeExpression thisUrl = new CodeFieldReferenceExpression (new CodeThisReferenceExpression(), "Url"); + + CodeStatement[] trueStms = new CodeStatement [1]; + CodeExpression ce = urlSetting; + CodeExpression cond = new CodeBinaryOperatorExpression (urlSetting, CodeBinaryOperatorType.IdentityInequality, new CodePrimitiveExpression (null)); + + if (ImportInfo.AppSettingBaseUrl != null) + ce = new CodeMethodInvokeExpression (new CodeTypeReferenceExpression (typeof(string)), "Concat", ce, new CodePrimitiveExpression (ImportInfo.AppSettingBaseUrl)); + trueStms [0] = new CodeAssignStatement (thisUrl, ce); + + if (location != null) { + CodeStatement[] falseStms = new CodeStatement [1]; + falseStms [0] = new CodeAssignStatement (thisUrl, new CodePrimitiveExpression (location)); + stms.Add (new CodeConditionStatement (cond, trueStms, falseStms)); + } + else + stms.Add (new CodeConditionStatement (cond, trueStms)); } } - + void ClasifySchemas (ArrayList importInfo) { // I don't like this, but I could not find any other way of clasifying diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs index ff45bcf05e1..8002cbdddc3 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs @@ -110,7 +110,6 @@ namespace System.Web.Services.Description { string location = null; SoapAddressBinding sab = (SoapAddressBinding) Port.Extensions.Find (typeof(SoapAddressBinding)); if (sab != null) location = sab.Location; - string url = GetServiceUrl (location); CodeTypeReference ctr = new CodeTypeReference ("System.Web.Services.Protocols.SoapHttpClientProtocol"); codeClass.BaseTypes.Add (ctr); @@ -122,9 +121,7 @@ namespace System.Web.Services.Description { CodeConstructor cc = new CodeConstructor (); cc.Attributes = MemberAttributes.Public; - CodeExpression ce = new CodeFieldReferenceExpression (new CodeThisReferenceExpression(), "Url"); - CodeAssignStatement cas = new CodeAssignStatement (ce, new CodePrimitiveExpression (url)); - cc.Statements.Add (cas); + GenerateServiceUrl (location, cc.Statements); codeClass.Members.Add (cc); memberIds = new CodeIdentifiers (); diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog index 0ef4271cdd8..9e52d2feea5 100755 --- a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog +++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog @@ -1,3 +1,8 @@ +2004-08-24 Lluis Sanchez Gual <lluis@ximian.com> + + * ContractReference.cs, DiscoveryClientProtocol.cs: Set the url from which + documents are being read. + 2004-06-13 Gert Driesen <drieseng@users.sourceforge.net> * SchemaReference.cs: corrected namespace diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs index 54b2225e8c7..75fb86b5685 100755 --- a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs @@ -147,7 +147,7 @@ namespace System.Web.Services.Discovery { {
string contentType = null;
Stream stream = prot.Download (ref url, ref contentType);
- XmlTextReader reader = new XmlTextReader (stream);
+ XmlTextReader reader = new XmlTextReader (url, stream);
reader.MoveToContent ();
DiscoveryReference refe;
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs index e24e2f10c43..21fc58e63cb 100755 --- a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs @@ -84,7 +84,7 @@ namespace System.Web.Services.Discovery { public DiscoveryDocument Discover (string url)
{
Stream stream = Download (ref url);
- XmlTextReader reader = new XmlTextReader (stream);
+ XmlTextReader reader = new XmlTextReader (url, stream);
if (!DiscoveryDocument.CanRead (reader))
throw new InvalidOperationException ("The url '" + url + "' does not point to a valid discovery document");
@@ -131,7 +131,7 @@ namespace System.Web.Services.Discovery { stream = Download (ref url);
}
- XmlTextReader reader = new XmlTextReader (stream);
+ XmlTextReader reader = new XmlTextReader (url, stream);
reader.MoveToContent ();
DiscoveryDocument doc;
DiscoveryReference refe = null;
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog index 01f02c69e94..e1e9b152273 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog @@ -1,3 +1,23 @@ +2004-09-15 Lluis Sanchez Gual <lluis@novell.com> + + * Methods.cs: Use the service namespace as the base for the soap action. + This fixes bug #60379. + +2004-09-28 Lluis Sanchez Gual <lluis@novell.com> + + * WebServiceHelper.cs: Write the encodingStyle attribute when using the + encoded format. This fixes bug #66908. + +2004-08-25 Lluis Sanchez Gual <lluis@novell.com> + + * HttpSoapWebServiceHandler.cs, WebServiceHandler.cs: Do not assign the + context to the service. It already gets it from HttpContext.Current. + +2004-07-20 Lluis Sanchez Gual <lluis@ximian.com> + + * HttpWebClientProtocol.cs: Add received cookies to cookieContainer when + getting the response, do not wait for the next request to do it. + 2004-06-22 Lluis Sanchez Gual <lluis@ximian.com> * XmlReturnReader.cs, XmlReturnWriter.cs: Generate the serializer with diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs index eae97b4a743..6d03900b5b1 100755 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs @@ -335,11 +335,6 @@ namespace System.Web.Services.Protocols private SoapServerMessage Invoke (HttpContext ctx, SoapServerMessage requestMessage) { - WebService wsi = requestMessage.Server as WebService; - if (wsi != null) { - wsi.SetContext (ctx); - } - SoapMethodStubInfo methodInfo = requestMessage.MethodStubInfo; // Assign header values to web service members diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs index 3be915cfbc8..722f1d2a681 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs @@ -45,7 +45,6 @@ namespace System.Web.Services.Protocols { CookieContainer cookieContainer;
IWebProxy proxy;
string userAgent;
- CookieCollection prevCookies;
#if NET_1_1
bool _unsafeAuthenticated;
@@ -117,41 +116,25 @@ namespace System.Web.Services.Protocols { #region Methods
- internal virtual void AddCookies (Uri uri)
+ internal virtual void CheckForCookies (HttpWebResponse response)
{
- if (cookieContainer == null)
- cookieContainer = new CookieContainer ();
-
- if (prevCookies == null || prevCookies.Count == 0)
+ CookieCollection cookies = response.Cookies;
+ if (cookieContainer == null || cookies.Count == 0)
return;
CookieCollection coll = cookieContainer.GetCookies (uri);
- foreach (Cookie prev in prevCookies) {
- bool dont = false;
- foreach (Cookie c in coll) {
+ foreach (Cookie c in cookies) {
+ bool add = true;
+ foreach (Cookie prev in coll) {
if (c.Equals (prev)) {
- dont = true;
+ add = false;
break;
}
}
-
- if (dont == false)
- cookieContainer.Add (prev);
+ if (add)
+ cookieContainer.Add (c);
}
}
-
- internal virtual void CheckForCookies (HttpWebResponse response)
- {
- CookieCollection cookies = response.Cookies;
- if (cookies.Count == 0)
- return;
-
- if (prevCookies == null)
- prevCookies = new CookieCollection ();
-
- foreach (Cookie c in cookies)
- prevCookies.Add (c);
- }
protected override WebRequest GetWebRequest (Uri uri)
{
@@ -164,7 +147,6 @@ namespace System.Web.Services.Protocols { if (clientCertificates != null)
request.ClientCertificates.AddRange (clientCertificates);
- AddCookies (uri);
request.CookieContainer = cookieContainer;
if (proxy != null)
request.Proxy = proxy;
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs index 993c50c7f8a..30dd40bcde9 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs @@ -156,7 +156,7 @@ namespace System.Web.Services.Protocols { if (RequestName == "") RequestName = Name; if (ResponseName == "") ResponseName = Name + "Response"; if (Action == null || Action == "") - Action = RequestNamespace.EndsWith("/") ? (RequestNamespace + Name) : (RequestNamespace + "/" + Name); + Action = serviceNamespace.EndsWith("/") ? (serviceNamespace + Name) : (serviceNamespace + "/" + Name); bool hasWrappingElem = (ParameterStyle == SoapParameterStyle.Wrapped); bool writeAccessors = (SoapBindingStyle == SoapBindingStyle.Rpc); diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs index a3b82b8eb1a..8727e6f2724 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs @@ -78,13 +78,7 @@ namespace System.Web.Services.Protocols protected object CreateServerInstance () { - object ws = Activator.CreateInstance (ServiceType); - WebService wsi = ws as WebService; - if (wsi != null) { - wsi.SetContext (_context); - } - - return ws; + return Activator.CreateInstance (ServiceType); } } } diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs index 309cdccf7c4..3c2efcfbfc1 100755 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs @@ -118,6 +118,10 @@ namespace System.Web.Services.Protocols // Serialize body xtw.WriteStartElement ("soap", "Body", WebServiceHelper.SoapEnvelopeNamespace); + + if (methodUse == SoapBindingUse.Encoded) + xtw.WriteAttributeString ("encodingStyle", WebServiceHelper.SoapEnvelopeNamespace, "http://schemas.xmlsoap.org/soap/encoding/"); + bodySerializer.Serialize (xtw, bodyContent); xtw.WriteEndElement (); diff --git a/mcs/class/System.Web.Services/System.Web.Services/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services/ChangeLog index 5bf15ba35e5..019a79b25a1 100644 --- a/mcs/class/System.Web.Services/System.Web.Services/ChangeLog +++ b/mcs/class/System.Web.Services/System.Web.Services/ChangeLog @@ -1,3 +1,9 @@ +2004-08-25 Lluis Sanchez Gual <lluis@novell.com> + + * WebService.cs: Get the HttpContext from the HttpContext.Current, do not + wait to be set with SetContext. In this way the context is available + in the web service constructor. + 2004-05-12 Lluis Sanchez Gual <lluis@ximian.com> * WebService.cs: Take the session from the context. diff --git a/mcs/class/System.Web.Services/System.Web.Services/WebService.cs b/mcs/class/System.Web.Services/System.Web.Services/WebService.cs index e6d0db150d1..b6fc1313056 100644 --- a/mcs/class/System.Web.Services/System.Web.Services/WebService.cs +++ b/mcs/class/System.Web.Services/System.Web.Services/WebService.cs @@ -46,17 +46,13 @@ namespace System.Web.Services { public WebService ()
{
+ _context = HttpContext.Current;
}
#endregion // Constructors
#region Properties
- internal void SetContext (HttpContext context)
- {
- _context = context;
- }
-
[Browsable (false)]
[Description ("The ASP.NET application object for the current request.")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
diff --git a/mcs/class/System.Web.Services/Test/standalone/ChangeLog b/mcs/class/System.Web.Services/Test/standalone/ChangeLog index 0622988e0fb..c05f9a58129 100644 --- a/mcs/class/System.Web.Services/Test/standalone/ChangeLog +++ b/mcs/class/System.Web.Services/Test/standalone/ChangeLog @@ -1,3 +1,7 @@ +2004-08-25 Lluis Sanchez Gual <lluis@novell.com> + + * server/SessionCounter.asmx: Check that Context != null in the constructor. + 2004-06-22 Lluis Sanchez Gual <lluis@ximian.com> * proxies.net.xml.gz: Updated. diff --git a/mcs/class/System.Web.Services/Test/standalone/server/SessionCounter.asmx b/mcs/class/System.Web.Services/Test/standalone/server/SessionCounter.asmx index 640f1bdf044..50c8befc415 100644 --- a/mcs/class/System.Web.Services/Test/standalone/server/SessionCounter.asmx +++ b/mcs/class/System.Web.Services/Test/standalone/server/SessionCounter.asmx @@ -8,6 +8,12 @@ { public class SessionCounter: System.Web.Services.WebService { + public SessionCounter () + { + if (Context == null) + throw new Exception ("Context not set in constructor"); + } + [ WebMethod(EnableSession=true) ] public void Reset() { diff --git a/mcs/class/System.Web/System.Web.Caching/Cache.cs b/mcs/class/System.Web/System.Web.Caching/Cache.cs index b8ecda5dd90..720d86c71ca 100644 --- a/mcs/class/System.Web/System.Web.Caching/Cache.cs +++ b/mcs/class/System.Web/System.Web.Caching/Cache.cs @@ -209,7 +209,7 @@ namespace System.Web.Caching { // If we have any kind of expiration add into the CacheExpires class if (objEntry.HasSlidingExpiration || objEntry.HasAbsoluteExpiration) { if (objEntry.HasSlidingExpiration) - objEntry.Expires = DateTime.Now.Ticks + objEntry.SlidingExpiration; + objEntry.Expires = DateTime.UtcNow.Ticks + objEntry.SlidingExpiration; _objExpires.Add (objEntry); } @@ -392,7 +392,7 @@ namespace System.Web.Caching { internal CacheEntry GetEntry (string strKey) { CacheEntry objEntry = null; - long ticksNow = DateTime.Now.Ticks; + long ticksNow = DateTime.UtcNow.Ticks; if (strKey == null) throw new ArgumentNullException ("strKey"); diff --git a/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs index 0e07353dc56..10e0f7c57a0 100644 --- a/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs +++ b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs @@ -100,7 +100,7 @@ namespace System.Web.Caching { // moved after each period, and the absolute expiration is the value used
// for all expiration calculations.
if (tsSpan.Ticks != Cache.NoSlidingExpiration.Ticks)
- _ticksExpires = System.DateTime.Now.AddTicks(_ticksSlidingExpiration).Ticks;
+ _ticksExpires = System.DateTime.UtcNow.AddTicks(_ticksSlidingExpiration).Ticks;
_objDependency = objDependency;
if (_objDependency != null)
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs index 673468ae209..11e2377e3c1 100644 --- a/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs +++ b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs @@ -71,7 +71,7 @@ namespace System.Web.Caching { } while (bytePos < 60);
// GC Bucket controller
- _intFlush = System.DateTime.Now.Minute - 1;
+ _intFlush = System.DateTime.UtcNow.Minute - 1;
_objTimer = new System.Threading.Timer (new System.Threading.TimerCallback (GarbageCleanup), null, 10000, 60000);
}
@@ -80,7 +80,7 @@ namespace System.Web.Caching { /// </summary>
/// <param name="objEntry">Cache entry to add.</param>
internal void Add (CacheEntry objEntry) {
- long now = DateTime.Now.Ticks;
+ long now = DateTime.UtcNow.Ticks;
if (objEntry.Expires < now)
objEntry.Expires = now;
diff --git a/mcs/class/System.Web/System.Web.Caching/ChangeLog b/mcs/class/System.Web/System.Web.Caching/ChangeLog index 3b09664543a..1b19523286f 100644 --- a/mcs/class/System.Web/System.Web.Caching/ChangeLog +++ b/mcs/class/System.Web/System.Web.Caching/ChangeLog @@ -1,3 +1,8 @@ +2004-10-03 Ben Maurer <bmaurer@ximian.com> + + * Cache.cs, CacheEntry.cs, CacheExpires.cs, ExpiresBuckets.cs: + use UtcNow rather than Now. + 2004-05-27 Patrik Torstensson <totte@hiddenpeaks.com> * ExpiresBucket.cs (FlushExpiredItems): fix csc and a typo bug diff --git a/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs index e32194c836c..7b8c139afeb 100644 --- a/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs +++ b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs @@ -231,7 +231,7 @@ namespace System.Web.Caching { int intPos;
long ticksNow;
- ticksNow = DateTime.Now.Ticks;
+ ticksNow = DateTime.UtcNow.Ticks;
intPos = 0;
// Lookup all items that needs to be removed, this is done in a two part
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs index 4a2cb6502af..d21312dd433 100644 --- a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs +++ b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs @@ -34,6 +34,7 @@ using System.IO; using System.Text; using System.Web.Caching; using System.Web.UI; +using System.Web.UI.HtmlControls; using System.Web.Util; namespace System.Web.Compilation @@ -49,7 +50,7 @@ namespace System.Web.Compilation this.Location = location; } } - + class BuilderLocationStack : Stack { public override void Push (object o) @@ -127,7 +128,46 @@ namespace System.Web.Compilation get { return current.Filename; } } } - + + class TagStack + { + Stack tags; + + public TagStack () + { + tags = new Stack (); + } + + public void Push (string tagid) + { + tags.Push (tagid); + } + + public string Pop () + { + if (tags.Count == 0) + return null; + + return (string) tags.Pop (); + } + + public bool CompareTo (string tagid) + { + if (tags.Count == 0) + return false; + + return 0 == String.Compare (tagid, (string) tags.Peek (), true); + } + + public int Count { + get { return tags.Count; } + } + + public string Current { + get { return (string) tags.Peek (); } + } + } + class AspGenerator { ParserStack pstack; @@ -138,7 +178,10 @@ namespace System.Web.Compilation bool inScript, javascript; ILocation location; bool isApplication; + StringBuilder tagInnerText = new StringBuilder (); static Hashtable emptyHash = new Hashtable (); + bool inForm; + TagStack formTags; public AspGenerator (TemplateParser tparser) { @@ -283,12 +326,22 @@ namespace System.Web.Compilation tparser.AddDirective (tagid, attributes.GetDictionary (null)); break; case TagType.Tag: - if (!ProcessTag (tagid, attributes, tagtype)) - TextParsed (location, location.PlainText); + if (ProcessTag (tagid, attributes, tagtype)) + break; + + if (inForm) { + stack.Builder.EnsureOtherTags (); + stack.Builder.OtherTags.Add (tagid); + } + + TextParsed (location, location.PlainText); break; case TagType.Close: - if (!CloseControl (tagid)) - TextParsed (location, location.PlainText); + bool notServer = (inForm && TryRemoveTag (tagid, stack.Builder.OtherTags)); + if (!notServer && CloseControl (tagid)) + break; + + TextParsed (location, location.PlainText); break; case TagType.SelfClosing: int count = stack.Count; @@ -319,8 +372,8 @@ namespace System.Web.Compilation if (isvirtual) { file = tparser.MapPath (file); - } else if (!Path.IsPathRooted (file)) { - file = UrlUtils.Combine (tparser.BaseVirtualDir, file); + } else { + file = GetIncludeFilePath (tparser.BaseDir, file); } InitParser (file); @@ -332,6 +385,28 @@ namespace System.Web.Compilation //PrintLocation (location); } + static bool TryRemoveTag (string tagid, ArrayList otags) + { + if (otags == null || otags.Count == 0) + return false; + + int idx = otags.Count - 1; + string otagid = (string) otags [idx]; + if (0 != String.Compare (tagid, otagid, true)) + return false; + + otags.RemoveAt (idx); + return true; + } + + static string GetIncludeFilePath (string basedir, string filename) + { + if (Path.DirectorySeparatorChar == '/') + filename = filename.Replace ("\\", "/"); + + return Path.GetFullPath (Path.Combine (basedir, filename)); + } + void TextParsed (ILocation location, string text) { if (text.IndexOf ("<%") != -1 && !inScript) { @@ -359,7 +434,11 @@ namespace System.Web.Compilation if (tparser.DefaultDirectiveName == "application" && t.Trim () != "") throw new ParseException (location, "Content not valid for application file."); - stack.Builder.AppendLiteralString (t); + ControlBuilder current = stack.Builder; + current.AppendLiteralString (t); + if (current.NeedsTagInnerText ()) { + tagInnerText.Append (t); + } } bool ProcessTag (string tagid, TagAttributes atts, TagType tagtype) @@ -409,6 +488,14 @@ namespace System.Web.Compilation builder.location = location; builder.ID = htable ["id"] as string; + if (typeof (HtmlForm).IsAssignableFrom (builder.ControlType)) { + if (inForm) + throw new ParseException (location, "Only one <form> allowed."); + + inForm = true; + formTags = new TagStack (); + } + if (builder.HasBody () && !(builder is ObjectTagBuilder)) { if (builder is TemplateBuilder) { // push the id list @@ -446,8 +533,10 @@ namespace System.Web.Compilation return true; } else { - Parser.VerbatimID = "script"; - javascript = true; + if (tagtype != TagType.SelfClosing) { + Parser.VerbatimID = "script"; + javascript = true; + } TextParsed (location, location.PlainText); return true; } @@ -485,6 +574,20 @@ namespace System.Web.Compilation // if (current is TemplateBuilder) // pop from the id list + if (current.NeedsTagInnerText ()) { + try { + current.SetTagInnerText (tagInnerText.ToString ()); + } catch (Exception e) { + throw new ParseException (current.location, e.Message, e); + } + + tagInnerText.Length = 0; + } + + if (typeof (HtmlForm).IsAssignableFrom (current.ControlType)) { + inForm = false; + } + current.CloseControl (); stack.Pop (); stack.Builder.AppendSubBuilder (current); diff --git a/mcs/class/System.Web/System.Web.Compilation/AspParser.cs b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs index 8f199c12de8..7922b830d20 100644 --- a/mcs/class/System.Web/System.Web.Compilation/AspParser.cs +++ b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs @@ -184,12 +184,15 @@ namespace System.Web.Compilation str = str.Substring (2).Trim (); int len = str.Length; int lastQuote = str.LastIndexOf ('"'); - if (len < 10 || lastQuote != len - 1 || !str.StartsWith ("#include ")) + if (len < 10 || lastQuote != len - 1) + return false; + + if (!str.ToLower ().StartsWith ("#include ")) return false; str = str.Substring (9).Trim (); - bool isfile = (str.StartsWith ("file")); - if (!isfile && !str.StartsWith ("virtual")) + bool isfile = (str.ToLower ().StartsWith ("file")); + if (!isfile && !str.ToLower ().StartsWith ("virtual")) return false; pathType = (isfile) ? "file" : "virtual"; @@ -379,8 +382,11 @@ namespace System.Web.Compilation void GetServerTag (out TagType tagtype, out string id, out TagAttributes attributes) { string inside_tags; + bool old = tokenizer.ExpectAttrValue; + tokenizer.ExpectAttrValue = false; if (Eat ('@')){ + tokenizer.ExpectAttrValue = old; tagtype = TagType.Directive; id = ""; if (Eat (Token.DIRECTIVE)) @@ -394,6 +400,7 @@ namespace System.Web.Compilation } if (Eat (Token.DOUBLEDASH)) { + tokenizer.ExpectAttrValue = old; tokenizer.Verbatim = true; inside_tags = GetVerbatim (tokenizer.get_token (), "--%>"); tokenizer.Verbatim = false; @@ -403,6 +410,7 @@ namespace System.Web.Compilation return; } + tokenizer.ExpectAttrValue = old; bool varname; bool databinding; varname = Eat ('='); diff --git a/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs b/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs index d04074fe780..231c7236a84 100644 --- a/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs +++ b/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs @@ -55,6 +55,7 @@ namespace System.Web.Compilation int begcol, begline; int position; bool inTag; + bool expectAttrValue; bool hasPutBack; bool verbatim; bool have_value; @@ -210,7 +211,7 @@ namespace System.Web.Compilation return c; } - if (inTag && (c == '"' || c == '\'')) + if (inTag && expectAttrValue && (c == '"' || c == '\'')) return ReadAttValue (c); if (c == '<'){ @@ -298,6 +299,12 @@ namespace System.Web.Compilation get { return inTag; } set { inTag = value; } } + + // Hack for preventing confusion with VB comments (see bug #63451) + public bool ExpectAttrValue { + get { return expectAttrValue; } + set { expectAttrValue = value; } + } public int BeginLine { get { return begline; } diff --git a/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs index 5036f5db094..07578009be5 100644 --- a/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs +++ b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs @@ -284,7 +284,7 @@ namespace System.Web.Compilation public virtual Type GetCompiledType () { - Type type = CachingCompiler.GetTypeFromCache (parser.InputFile, parser.ClassName); + Type type = CachingCompiler.GetTypeFromCache (parser.InputFile); if (type != null) return type; @@ -309,7 +309,7 @@ namespace System.Web.Compilation bool keepFiles = (Environment.GetEnvironmentVariable ("MONO_ASPNET_NODELETE") != null); TempFileCollection tempcoll = new TempFileCollection (config.TempDirectory, keepFiles); compilerParameters.TempFiles = tempcoll; - string dllfilename = tempcoll.AddExtension ("dll", true); + string dllfilename = Path.GetFileName (tempcoll.AddExtension ("dll", true)); if (!Directory.Exists (dynamicBase)) Directory.CreateDirectory (dynamicBase); diff --git a/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs index bda584c306b..2e469984335 100644 --- a/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs +++ b/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs @@ -32,6 +32,7 @@ using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Specialized; +using System.IO; using System.Reflection; using System.Web.UI; using System.Web.Caching; @@ -43,21 +44,20 @@ namespace System.Web.Compilation { static object compilationLock = new object (); const string cachePrefix = "@@Assembly"; + const string cacheTypePrefix = "@@@Type"; - public static Type GetTypeFromCache (string filename, string typename) + public static void InsertType (Type type, string filename) { - string key = CachingCompiler.cachePrefix + filename; - CompilerResults results = (CompilerResults) HttpRuntime.Cache [key]; - if (results == null) - return null; - - Assembly a = results.CompiledAssembly; - if (a == null) - return null; + string [] cacheKeys = new string [] { cachePrefix + filename }; + CacheDependency dep = new CacheDependency (null, cacheKeys); + HttpRuntime.Cache.Insert (cacheTypePrefix + filename, type, dep); + } - return a.GetType (typename, false); + public static Type GetTypeFromCache (string filename) + { + return (Type) HttpRuntime.Cache [cacheTypePrefix + filename]; } - + public static CompilerResults Compile (BaseCompiler compiler) { Cache cache = HttpRuntime.Cache; @@ -139,12 +139,40 @@ namespace System.Web.Compilation ICodeCompiler compiler = provider.CreateCompiler (); CompilerParameters options = GetOptions (assemblies); results = compiler.CompileAssemblyFromFile (options, file); - string [] deps = (string []) assemblies.ToArray (typeof (string)); + ArrayList realdeps = new ArrayList (assemblies.Count + 1); + realdeps.Add (file); + for (int i = assemblies.Count - 1; i >= 0; i--) { + string current = (string) assemblies [i]; + if (Path.IsPathRooted (current)) + realdeps.Add (current); + } + + string [] deps = (string []) realdeps.ToArray (typeof (string)); cache.Insert (cachePrefix + key, results, new CacheDependency (deps)); } return results; } + + public static Type CompileAndGetType (string typename, string language, string key, + string file, ArrayList assemblies) + { + CompilerResults result = CachingCompiler.Compile (language, key, file, assemblies); + if (result.NativeCompilerReturnValue != 0) { + StreamReader reader = new StreamReader (file); + throw new CompilationException (file, result.Errors, reader.ReadToEnd ()); + } + + Assembly assembly = result.CompiledAssembly; + if (assembly == null) { + StreamReader reader = new StreamReader (file); + throw new CompilationException (file, result.Errors, reader.ReadToEnd ()); + } + + Type type = assembly.GetType (typename, true); + InsertType (type, file); + return type; + } } } diff --git a/mcs/class/System.Web/System.Web.Compilation/ChangeLog b/mcs/class/System.Web/System.Web.Compilation/ChangeLog index 1bd493966e2..7dbcbfba4b2 100644 --- a/mcs/class/System.Web/System.Web.Compilation/ChangeLog +++ b/mcs/class/System.Web/System.Web.Compilation/ChangeLog @@ -1,3 +1,57 @@ +2004-10-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AspGenerator.cs: correctly process script tags that self-closing. + Fixes bug #69657. + +2004-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * CachingCompiler.cs: when compiling a single .cs file, add the file + itself to dependencies. Fixes bug #68788. + +2004-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * ControlBuilder.cs: don't close server tags when we get to a closing + tag that is not applied to a server control. Fixes bug #60323. + +2004-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * WebServiceCompiler.cs: fix buglet in my last commit. + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * BaseCompiler.cs: + * CachingCompiler.cs: + * WebServiceCompiler.cs: correctly cache Type instead of the assembly + for ashx/asmx. Otherwise we need to open the file and check for the + class name in there. Thanks to Ben for pointing this out. + +2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * CachingCompiler.cs: don't try to watch for changes in system + assemblies. Fixes bug #64871. + +2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AspGenerator.cs: handle builders that need to process inner text + with tags. + + * Location.cs: added setters for the properties. + +2004-07-21 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AspGenerator.cs: the path for file was treated as virtual, but it's + physical. Fixes bug #61524. + +2004-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AspParser.cs: fixed case-sensitivity issues with #include and its + attributes. Closes #61429. + +2004-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * BaseCompiler.cs: + * WebServiceCompiler.cs: really create the dlls under DynamicBase + 2004-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TemplateControlCompiler.cs: for system colors, use SystemColors class diff --git a/mcs/class/System.Web/System.Web.Compilation/Location.cs b/mcs/class/System.Web/System.Web.Compilation/Location.cs index e4a0cb775a1..4a57b8055ac 100644 --- a/mcs/class/System.Web/System.Web.Compilation/Location.cs +++ b/mcs/class/System.Web/System.Web.Compilation/Location.cs @@ -65,22 +65,27 @@ namespace System.Web.Compilation public int BeginLine { get { return beginLine; } + set { beginLine = value; } } public int EndLine { get { return endLine; } + set { endLine = value; } } public int BeginColumn { get { return beginColumn; } + set { beginColumn = value; } } public int EndColumn { get { return endColumn; } + set { endColumn = value; } } public string PlainText { get { return plainText; } + set { plainText = value; } } } } diff --git a/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs index 20b87415730..4df2b6b9a94 100644 --- a/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs +++ b/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs @@ -59,12 +59,15 @@ namespace System.Web.Compilation public override Type GetCompiledType () { - Type type = CachingCompiler.GetTypeFromCache (parser.PhysicalPath, parser.ClassName); + Type type = CachingCompiler.GetTypeFromCache (parser.PhysicalPath); if (type != null) return type; - if (parser.Program.Trim () == "") - return parser.GetTypeFromBin (parser.ClassName); + if (parser.Program.Trim () == "") { + type = parser.GetTypeFromBin (parser.ClassName); + CachingCompiler.InsertType (type, parser.PhysicalPath); + return type; + } string lang = parser.Language; CompilationConfiguration config; @@ -93,7 +96,7 @@ namespace System.Web.Compilation sw.WriteLine (parser.Program); sw.Close (); - string dllfilename = tempcoll.AddExtension ("dll", true); + string dllfilename = Path.GetFileName (tempcoll.AddExtension ("dll", true)); if (!Directory.Exists (dynamicBase)) Directory.CreateDirectory (dynamicBase); @@ -106,7 +109,9 @@ namespace System.Web.Compilation "No assembly returned after compilation!?"); results.TempFiles.Delete (); - return results.CompiledAssembly.GetType (parser.ClassName, true); + type = results.CompiledAssembly.GetType (parser.ClassName, true); + CachingCompiler.InsertType (type, parser.PhysicalPath); + return type; } void CheckCompilerErrors (CompilerResults results) diff --git a/mcs/class/System.Web/System.Web.Configuration/ChangeLog b/mcs/class/System.Web/System.Web.Configuration/ChangeLog index 2f67b0fee83..97f76d47021 100644 --- a/mcs/class/System.Web/System.Web.Configuration/ChangeLog +++ b/mcs/class/System.Web/System.Web.Configuration/ChangeLog @@ -1,3 +1,13 @@ +2004-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * WebConfigurationSettings.cs: use CurrentExecutionFilePath instead of + FilePath. Fixes bug #67982. + +2004-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * WebConfigurationSettings.cs: fix bug when processing empty location + tags. Closes bug #63001. + 2004-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com> * AuthorizationConfig.cs: really fix bug #60482. Thanks David! diff --git a/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs b/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs index e00c1921978..0d212d76cc1 100644 --- a/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs +++ b/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs @@ -148,7 +148,7 @@ namespace System.Web.Configuration if (context == null) return null; - ConfigurationData config = GetConfigFromFileName (context.Request.FilePath, context); + ConfigurationData config = GetConfigFromFileName (context.Request.CurrentExecutionFilePath, context); if (config == null) return null; @@ -213,6 +213,9 @@ namespace System.Web.Configuration public void Init (HttpContext context) { + if (initCalled) + return; + lock (this) { if (initCalled) return; @@ -251,7 +254,7 @@ namespace System.Web.Configuration public FileWatcherCache (ConfigurationData data) { this.data = data; - cacheTable = Hashtable.Synchronized (new Hashtable ()); + cacheTable = new Hashtable (); this.path = Path.GetDirectoryName (data.FileName); this.filename = Path.GetFileName (data.FileName); if (!Directory.Exists (path)) @@ -539,7 +542,7 @@ namespace System.Web.Configuration public object GetConfig (string sectionName, HttpContext context) { if (locations != null && dirname != null) { - string reduced = UrlUtils.MakeRelative (context.Request.FilePath, dirname); + string reduced = UrlUtils.MakeRelative (context.Request.CurrentExecutionFilePath, dirname); string [] parts = reduced.Split ('/'); Location location = null; int length = parts.Length; @@ -791,16 +794,13 @@ namespace System.Web.Configuration void StoreLocation (string name, XmlTextReader reader) { - if (locations == null) { - locations = new Hashtable (); - } - string path = null; bool haveAllow = false; bool allowOverride = true; + string att = null; while (reader.MoveToNextAttribute ()) { - string att = reader.Name; + att = reader.Name; if (att == "path") { if (path != null) @@ -830,8 +830,13 @@ namespace System.Web.Configuration ThrowException ("Unrecognized attribute.", reader); } + if (att == null) + return; // empty location tag + Location loc = new Location (this, path, allowOverride); - if (locations.ContainsKey (loc.Path)) + if (locations == null) + locations = new Hashtable (); + else if (locations.ContainsKey (loc.Path)) ThrowException ("Duplicated location path: " + loc.Path, reader); reader.MoveToElement (); diff --git a/mcs/class/System.Web/System.Web.Handlers/ChangeLog b/mcs/class/System.Web/System.Web.Handlers/ChangeLog index ebddbc1e4ba..4f3e185e220 100644 --- a/mcs/class/System.Web/System.Web.Handlers/ChangeLog +++ b/mcs/class/System.Web/System.Web.Handlers/ChangeLog @@ -1,3 +1,12 @@ +2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TraceHandler.cs: error code is 403 and the message different when + trace is enabled but not for remote clients. + +2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TraceHandler.cs: check that trace is enabled or throw. + 2004-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TraceHandler.cs: Added protected missing members and attributes. diff --git a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs index 33385dbf5fb..23e35288f80 100644 --- a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs +++ b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs @@ -39,17 +39,37 @@ using System.Web.UI.WebControls; namespace System.Web.Handlers { +#if NET_2_0 + [Serializable] +#endif + class TraceNotAvailableException : HttpException + { + bool notLocal; + + public TraceNotAvailableException (bool notLocal) : + base (notLocal ? 403 : 500, "Trace Error") + { + this.notLocal = notLocal; + } + + internal override string Description { + get { + if (notLocal) + return "Trace is not enabled for remote clients."; + + return "Trace.axd is not enabled in the configuration file for this application."; + } + } + } + public class TraceHandler : IHttpHandler { void IHttpHandler.ProcessRequest (HttpContext context) { TraceManager manager = HttpRuntime.TraceManager; - if (manager.LocalOnly && !context.Request.IsLocal) { - // Need to figure out the error message that goes here - // but I only have cassini for testing - return; - } + if (!manager.Enabled || manager.LocalOnly && !context.Request.IsLocal) + throw new TraceNotAvailableException (manager.Enabled); HtmlTextWriter output = new HtmlTextWriter (context.Response.Output); diff --git a/mcs/class/System.Web/System.Web.Mail/ChangeLog b/mcs/class/System.Web/System.Web.Mail/ChangeLog index 21478e29bdf..ffd6523aa3a 100644 --- a/mcs/class/System.Web/System.Web.Mail/ChangeLog +++ b/mcs/class/System.Web/System.Web.Mail/ChangeLog @@ -1,3 +1,20 @@ +2004-10-28 Sanjay Gupta <gsanjay@novell.com> + + * SmtpClient.cs: Backported fix for bug 68829. + +2004-08-30 Sanjay Gupta <gsanjay@novell.com> + + * MailMessage.cs: + * MailMessageWrapper.cs: + * SmtpClient.cs: Fields property of MailMessage from .Net 1.1 was not + handled completely. + +2004-08-10 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * SmtpClient.cs: multipart mails default body format is now the same as + the one used for single part mails instead of being forced to + "text/plain". + 2004-02-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> * MailMessage.cs: patch by John Luke that initialized the fields in diff --git a/mcs/class/System.Web/System.Web.Mail/MailMessage.cs b/mcs/class/System.Web/System.Web.Mail/MailMessage.cs index 6531a6d6156..fea1d167846 100644 --- a/mcs/class/System.Web/System.Web.Mail/MailMessage.cs +++ b/mcs/class/System.Web/System.Web.Mail/MailMessage.cs @@ -51,7 +51,6 @@ namespace System.Web.Mail private string to;
private string urlContentBase;
private string urlContentLocation; - private Hashtable fields;
// Constructor
public MailMessage ()
@@ -59,7 +58,9 @@ namespace System.Web.Mail attachments = new ArrayList (8);
headers = new ListDictionary ();
bodyEncoding = Encoding.Default; +#if NET_1_1 fields = new Hashtable ();
+#endif }
// Properties
@@ -127,6 +128,8 @@ namespace System.Web.Mail }
#if NET_1_1
+ private Hashtable fields;
+ public IDictionary Fields {
get { return (IDictionary) fields; diff --git a/mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs b/mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs index 17bd581675b..270892aab93 100644 --- a/mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs +++ b/mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs @@ -227,6 +227,19 @@ namespace System.Web.Mail { public string UrlContentLocation { get { return message.UrlContentLocation; } } + +#if NET_1_1 + public MailHeader Fields { + get { + MailHeader bodyHeaders = new MailHeader(); + // Add Fields to MailHeader Object + foreach( string key in message.Fields.Keys ) + bodyHeaders.Data[ key ] = (string)this.message.Fields[ key ]; + return bodyHeaders; + } + } +#endif + } } diff --git a/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs b/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs index 25569cfc074..931274dbd68 100644 --- a/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs +++ b/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs @@ -140,6 +140,7 @@ namespace System.Web.Mail { string boundary = MailUtil.GenerateBoundary(); // set the Content-Type header to multipart/mixed + string bodyContentType = msg.Header.ContentType; msg.Header.ContentType = String.Format( "multipart/mixed;\r\n boundary={0}" , boundary ); @@ -151,7 +152,23 @@ namespace System.Web.Mail { smtp.WriteBoundary( boundary ); MailHeader partHeader = new MailHeader(); - partHeader.ContentType = "text/plain"; + partHeader.ContentType = bodyContentType; + +#if NET_1_1 + // Add all the custom headers to body part as specified in + //Fields property of MailMessageWrapper + + //Remove fields specific for authenticating to SMTP server. + + if (msg.Fields.Data ["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] != null) + msg.Fields.Data.Remove ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"); + if (msg.Fields.Data ["http://schemas.microsoft.com/cdo/configuration/sendusername"] != null) + msg.Fields.Data.Remove ("http://schemas.microsoft.com/cdo/configuration/sendusername"); + if (msg.Fields.Data ["http://schemas.microsoft.com/cdo/configuration/sendpassword"] != null) + msg.Fields.Data.Remove ("http://schemas.microsoft.com/cdo/configuration/sendpassword"); + + partHeader.Data.Add(msg.Fields.Data); +#endif smtp.WriteHeader( partHeader ); diff --git a/mcs/class/System.Web/System.Web.Security/ChangeLog b/mcs/class/System.Web/System.Web.Security/ChangeLog index cf7612e3ae3..17865abd5bc 100644 --- a/mcs/class/System.Web/System.Web.Security/ChangeLog +++ b/mcs/class/System.Web/System.Web.Security/ChangeLog @@ -1,3 +1,12 @@ +2004-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * FormsAuthentication.cs: patch by Jim Pease to fix the date on renewal. + +2004-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * FormsAuthenticationModule.cs: don't renew expired cookies. Only renew + the cookie if SlidingExpiration is set. Thanks to Jim Pease. + 2004-06-12 Pedro Martínez Juliá <yoros@wanadoo.es> * FormsAuthentication.cs: Undo last change. diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs index bee8998e76a..451cb0dc260 100644 --- a/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs +++ b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs @@ -311,7 +311,7 @@ namespace System.Web.Security return tOld; FormsAuthenticationTicket tNew = tOld.Clone (); - tNew.SetDates (now, now - toExpiration + toIssue); + tNew.SetDates (now, now + (tOld.Expiration - tOld.IssueDate)); return tNew; } diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs index f46923ad5b8..ac9f3c31327 100644 --- a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs +++ b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs @@ -82,7 +82,12 @@ namespace System.Web.Security return; FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt (cookie.Value); - ticket = FormsAuthentication.RenewTicketIfOld (ticket); + if (ticket == null || ticket.Expired) + return; + + if (config.SlidingExpiration) + ticket = FormsAuthentication.RenewTicketIfOld (ticket); + context.User = new GenericPrincipal (new FormsIdentity (ticket), new string [0]); cookie.Value = FormsAuthentication.Encrypt (ticket); diff --git a/mcs/class/System.Web/System.Web.SessionState/ChangeLog b/mcs/class/System.Web/System.Web.SessionState/ChangeLog index 58135e9f7d0..65d40fbe0bc 100644 --- a/mcs/class/System.Web/System.Web.SessionState/ChangeLog +++ b/mcs/class/System.Web/System.Web.SessionState/ChangeLog @@ -1,3 +1,18 @@ +2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * SessionStateModule.cs: use SetCurrentExePath instead of SetFilePath. + +2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpSessionState.cs: don't share static session objects declared in + the application file across the application, but on a per-session + basis. Fixes bug #65446. + +2004-07-07 Juraj Skripsky <juraj@hotfeet.ch> + + * SessionStateModule.cs: set path in session cookie to application + path. + 2004-06-18 Gert Driesen <drieseng@users.sourceforge.net> * IStateRuntime.cs: added missing marshalling attributes diff --git a/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs index 0e92660cbc1..03fcacbb118 100644 --- a/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs +++ b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs @@ -59,7 +59,7 @@ public sealed class HttpSessionState : ICollection, IEnumerable { _id = id; _dict = dict; - _staticObjects = staticObjects; + _staticObjects = staticObjects.Clone (); _timeout = timeout; _newSession = newSession; _isCookieless = isCookieless; diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs index 70c4a566129..c909e2a4086 100644 --- a/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs +++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs @@ -109,7 +109,7 @@ namespace System.Web.SessionState if (id == null) return; - context.Request.SetFilePath (UrlUtils.RemoveSessionId (base_path, + context.Request.SetCurrentExePath (UrlUtils.RemoveSessionId (base_path, context.Request.FilePath)); context.Request.SetHeader (HeaderName, id); } @@ -158,7 +158,7 @@ namespace System.Web.SessionState } else if (isNew) { string id = context.Session.SessionID; HttpCookie cookie = new HttpCookie (CookieName, id); - cookie.Path = UrlUtils.GetDirectory (context.Request.Path); + cookie.Path = UrlUtils.GetDirectory (context.Request.ApplicationPath); context.Response.AppendCookie (cookie); } } diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs index 0777e266fc4..de46e7d14ac 100755 --- a/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs @@ -217,7 +217,7 @@ namespace System.Web.UI.WebControls [Bindable(true)] [DefaultValue("")] [Editor ("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("AdRotator_AdvertisementFile")] public string AdvertisementFile { get { return ((advertisementFile != null) ? advertisementFile : ""); } @@ -232,7 +232,7 @@ namespace System.Web.UI.WebControls [Bindable(true)] [DefaultValue("")] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("AdRotator_KeywordFilter")] public string KeywordFilter { get { @@ -251,7 +251,7 @@ namespace System.Web.UI.WebControls [Bindable(true)] [DefaultValue("")] [TypeConverter(typeof(TargetConverter))] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("AdRotator_Target")] public string Target { get { diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs index 86de6a314f5..83ac1c850cc 100755 --- a/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs @@ -56,7 +56,7 @@ namespace System.Web.UI.WebControls } [DefaultValue(ValidationDataType.String)] - [WebCategory("Behaviour")] + [WebCategory("Behavior")] [WebSysDescription("RangeValidator_Type")] public ValidationDataType Type { diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs index 26a081dc3e0..b003e315524 100755 --- a/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs @@ -192,7 +192,9 @@ namespace System.Web.UI.WebControls if(!Visible || (Visible && !Enabled)) { IsValid = true; + return; } + Control ctrl = Parent; while(ctrl != null) { diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog index cb282d6377a..e0e553dc284 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog @@ -1,6 +1,41 @@ +2004-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * ListItemCollection.cs: fixed bug when indexing changed elements in + LoadViewState. Patch from Alois BÄ›laÅ¡ka. + +2004-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TableStyle.cs: don't render empty 'rules' attribute (again). + +2004-09-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * RadioButton.cs: fix GroupName when the control is inside a + NamingContainer different from Page. Closes bug #65586. + +2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Xml.cs: fixed get_DocumentContent (it was returning "" always!) and + don't call MapPathSecure on the content itself. + + * XmlBuilder.cs: handle XML documents written inside asp:xml. The + document is checked at parse time and will be checked again at run time. + + Fixes bug #63828. + +2004-08-10 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Xml.cs: use MapPath in DocumentSource and documentContent. Fixes + bug #62726. + +2004-07-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * BaseValidator.cs: in Validate(), when the control is not visible or + enabled, return inmediately after setting IsValid to true. Fixes bug + #61831. + 2004-06-10 Alon Gazit <along@mainsoft.com> - * WebControl.cs: fixed LoadViewState(). - Creates new attributes state bag only when the current is null. + * WebControl.cs: fixed LoadViewState(). + Creates new attributes state bag only when the current is null. 2004-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs index acaa33be15b..7a9237bea09 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs @@ -272,7 +272,7 @@ namespace System.Web.UI.WebControls end = indices.Count;
for (i = 0; i < end; i++) {
if ((int) indices [i] < Count ) {
- this [i].LoadViewState (states [i]);
+ this [(int) indices [i]].LoadViewState (states [i]);
} else {
ListItem temp = new ListItem ();
temp.LoadViewState (states [i]);
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs index 27bfa2c99a3..becb19787bc 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs @@ -99,19 +99,23 @@ namespace System.Web.UI.WebControls writer.RenderBeginTag (System.Web.UI.HtmlTextWriterTag.Input);
writer.RenderEndTag ();
}
-
- private string UniqueGroupNamePrivate
- {
- get {
- string retVal = GroupName;
- int unique = UniqueID.LastIndexOf (':');
- if (unique >= 0)
- retVal += UniqueID.Substring (unique + 1);
-
- return retVal;
- }
- }
-
+ + private string UniqueGroupNamePrivate + { + get { + string retVal; + string uid = UniqueID; + int unique = uid.LastIndexOf (':'); + if (unique == -1) { + retVal = GroupName; + } else { + retVal = uid.Substring (0, unique + 1) + GroupName; + } + + return retVal; + } + } + private string ValueAttributePrivate
{
get {
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs index 413b8a0745c..a1653a11928 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs @@ -171,7 +171,7 @@ namespace System.Web.UI.WebControls {
writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(HorizontalAlign), HorizontalAlign, "G"));
}
- string gd = String.Empty; + string gd = null; switch(GridLines)
{
case GridLines.None: break; @@ -182,6 +182,8 @@ namespace System.Web.UI.WebControls case GridLines.Both: gd = "all";
break;
} + + if (gd != null) writer.AddAttribute(HtmlTextWriterAttribute.Rules, gd); } diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs index 7cdb7e4fea8..e2bca533f8f 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs @@ -116,7 +116,7 @@ namespace System.Web.UI.WebControls [WebSysDescription ("The XML content that is transformed for the XML Webcontrol.")] public string DocumentContent { get { - return String.Empty; + return documentContent; } set { document = null; @@ -189,7 +189,6 @@ namespace System.Web.UI.WebControls GetType().Name)); } - [MonoTODO("security")] private void LoadXpathDoc () { if (documentContent != null && documentContent.Length > 0) { @@ -198,12 +197,11 @@ namespace System.Web.UI.WebControls } if (documentSource != null && documentSource.Length != 0) { - xpathDoc = new XPathDocument (documentSource); + xpathDoc = new XPathDocument (MapPathSecure (documentSource)); return; } } - [MonoTODO("security")] private void LoadTransform () { if (transform != null) diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs index 4aaa88a7580..445e87143d2 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/XmlBuilder.cs @@ -2,8 +2,10 @@ // System.Web.UI.WebControls.XmlBuilder.cs // // Author: -// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Gonzalo Paniagua Javier (gonzalo@novell.com) // +// Copyright (c) 2004 Novell, Inc. (http://www.novell.com) // // @@ -29,14 +31,16 @@ using System; using System.Collections; +using System.Web.Compilation; using System.Web.UI; +using System.Xml; namespace System.Web.UI.WebControls { - internal class XmlBuilder : ControlBuilder + class XmlBuilder : ControlBuilder { public override void AppendLiteralString (string s) - { + { } public override Type GetChildControlType (string tagName, IDictionary attribs) @@ -49,10 +53,26 @@ namespace System.Web.UI.WebControls return true; } - [MonoTODO ("find out what this does and implement")] public override void SetTagInnerText (string text) { - throw new NotImplementedException (); + string trimmed = text.Trim (); + if (trimmed == "") + return; + + XmlDocument doc = new XmlDocument (); + try { + doc.LoadXml (text); + } catch (XmlException xmle) { + Location newloc = new Location (location); + if (xmle.LineNumber >= 0) + newloc.BeginLine += xmle.LineNumber - 1; + + location = newloc; + throw; + } + + base.AppendLiteralString (trimmed); } } } + diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog index 07d62fd2c33..f9bfb626918 100644 --- a/mcs/class/System.Web/System.Web.UI/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI/ChangeLog @@ -1,3 +1,49 @@ +2004-10-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * ControlBuilder.cs: from HEAD. + +2004-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Control.cs: even if the control has no children the naming container + may contain the control we're looking for. Fixes bug #67304. + +2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TemplateParser.cs: ensure bin directory exists before trying to access + it. Fixes bug #65446 (not closed yet due to dependencies). + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * SimpleWebHandlerParser.cs: correctly cache Type instead of the + assembly for ashx/asmx. Otherwise we need to open the file and check + for the class name in there. Thanks to Ben for pointing this out. + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TemplateParser.cs: removed creation of StringWriter. It's not used. + * Control.cs: don't create the EventHandlerList until requested. + +2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * LiteralControl.cs: stylized. This control has EnableViewState disabled + by default and doesn't get an automatic ID. When text is null -> "". + +2004-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TemplateControl.cs: don't include private methods of base classes when + auto-attaching events. Fixes bug 61569. + +2004-07-08 Pablo Baena <pbaena@gmail.com> + + * Page.cs: added workaround for __doPostBack script on Netscape 4.xx + +2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Page.cs: added additional checks for saving/displaying trace data. + + * PageParser.cs: removed checks for trace enabled in configuration + files. + 2004-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> * ControlCollection.cs: when clearing the control collection, tell the diff --git a/mcs/class/System.Web/System.Web.UI/Control.cs b/mcs/class/System.Web/System.Web.UI/Control.cs index 97ec7f757fc..da9aac46dc8 100644 --- a/mcs/class/System.Web/System.Web.UI/Control.cs +++ b/mcs/class/System.Web/System.Web.UI/Control.cs @@ -70,7 +70,7 @@ namespace System.Web.UI private bool _childControlsCreated; private StateBag _viewState; private bool _trackViewState; - private EventHandlerList _events = new EventHandlerList(); + private EventHandlerList _events; private RenderMethod _renderMethodDelegate; private bool autoID = true; private bool creatingControls; @@ -501,9 +501,6 @@ namespace System.Web.UI protected virtual Control FindControl (string id, int pathOffset)
{
EnsureChildControls ();
- if (_controls == null)
- return null;
-
Control namingContainer = null;
if (!_isNamingContainer) {
namingContainer = NamingContainer;
@@ -512,7 +509,10 @@ namespace System.Web.UI return namingContainer.FindControl (id, pathOffset);
}
-
+ + if (!HasControls ()) + return null; + int colon = id.IndexOf (':', pathOffset);
if (colon == -1)
return LookForControlByName (id.Substring (pathOffset));
diff --git a/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs b/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs index 77ff7d773c8..4c9abedd44d 100755 --- a/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs +++ b/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs @@ -66,6 +66,7 @@ namespace System.Web.UI { internal int renderIndex; internal bool isProperty; internal ILocation location; + ArrayList otherTags; public ControlBuilder () { @@ -91,6 +92,16 @@ namespace System.Web.UI { this.fileName = sourceFileName; } + internal void EnsureOtherTags () + { + if (otherTags == null) + otherTags = new ArrayList (); + } + + internal ArrayList OtherTags { + get { return otherTags; } + } + public Type ControlType { get { return type; } } diff --git a/mcs/class/System.Web/System.Web.UI/LiteralControl.cs b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs index 9d469ee5f10..93002f71467 100644 --- a/mcs/class/System.Web/System.Web.UI/LiteralControl.cs +++ b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs @@ -1,11 +1,13 @@ -//
-// System.Web.UI.LiteralControl.cs
-//
-// Author:
-// Bob Smith <bob@thestuff.net>
-//
-// (C) Bob Smith
-//
+// +// System.Web.UI.LiteralControl.cs +// +// Author: +// Bob Smith <bob@thestuff.net> +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) Bob Smith +// Copyright (c) 2002-2004 Novell, Inc. (http://www.novell.com) +// // // Permission is hereby granted, free of charge, to any person obtaining @@ -27,41 +29,43 @@ // 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.ComponentModel;
-using System.Web;
-
-namespace System.Web.UI
-{
- [ToolboxItem(false)]
- public class LiteralControl : Control
- {
- private string _text = String.Empty;
- public LiteralControl() {}
- public LiteralControl(string text)
- {
- _text = text;
- }
- public virtual string Text
- {
- get
- {
- return _text;
- }
- set
- {
- _text = value;
- }
- }
- protected override void Render(HtmlTextWriter writer)
- {
- writer.Write(_text);
- }
-
- protected override ControlCollection CreateControlCollection ()
- {
- return new EmptyControlCollection (this);
- }
- }
-}
+ +using System; +using System.ComponentModel; +using System.Web; + +namespace System.Web.UI +{ + [ToolboxItem(false)] + public class LiteralControl : Control + { + string _text; + + public LiteralControl () : this (null) {} + + public LiteralControl (string text) + { + EnableViewState = false; + PreventAutoID (); + _text = (text == null) ? "" : text; // Text property is not called for this. + } + + public virtual string Text { + get { return _text; } + set { + _text = (value == null) ? "" : value; + } + } + + protected override void Render (HtmlTextWriter writer) + { + writer.Write (_text); + } + + protected override ControlCollection CreateControlCollection () + { + return new EmptyControlCollection (this); + } + } +} + diff --git a/mcs/class/System.Web/System.Web.UI/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs index 3887c9c35e0..53b89d28854 100755 --- a/mcs/class/System.Web/System.Web.UI/Page.cs +++ b/mcs/class/System.Web/System.Web.UI/Page.cs @@ -526,7 +526,12 @@ public class Page : TemplateControl, IHttpHandler writer.WriteLine ("<script language=\"javascript\">"); writer.WriteLine ("<!--"); writer.WriteLine ("\tfunction __doPostBack(eventTarget, eventArgument) {"); - writer.WriteLine ("\t\tvar theform = document.getElementById ('{0}');", formUniqueID); + + if (Request.Browser.Browser == ("Netscape") && Request.Browser.MajorVersion == 4) + writer.WriteLine ("\t\tvar theform = document.{0};", formUniqueID); + else + writer.WriteLine ("\t\tvar theform = document.getElementById ('{0}');", formUniqueID); + writer.WriteLine ("\t\ttheform.{0}.value = eventTarget;", postEventSourceID); writer.WriteLine ("\t\ttheform.{0}.value = eventArgument;", postEventArgumentID); writer.WriteLine ("\t\ttheform.submit();"); @@ -769,11 +774,18 @@ public class Page : TemplateControl, IHttpHandler private void RenderTrace (HtmlTextWriter output) { - if (!Trace.IsEnabled) + TraceManager traceManager = HttpRuntime.TraceManager; + + if (Trace.HaveTrace && !Trace.IsEnabled || !Trace.HaveTrace && !traceManager.Enabled) return; Trace.SaveData (); - Trace.Render (output); + + if (!Trace.HaveTrace && traceManager.Enabled && !traceManager.PageOutput) + return; + + if (!traceManager.LocalOnly || Context.Request.IsLocal) + Trace.Render (output); } internal void RaisePostBackEvents () diff --git a/mcs/class/System.Web/System.Web.UI/PageParser.cs b/mcs/class/System.Web/System.Web.UI/PageParser.cs index 816d83c0bc8..571edf2997a 100644 --- a/mcs/class/System.Web/System.Web.UI/PageParser.cs +++ b/mcs/class/System.Web/System.Web.UI/PageParser.cs @@ -199,13 +199,6 @@ namespace System.Web.UI } } - TraceConfig traceConfig = (TraceConfig) Context.GetConfig ("system.web/trace"); - if (traceConfig != null) { - trace = traceConfig.Enabled; - if (trace) - haveTrace = true; - } - string tracestr = GetString (atts, "Trace", null); if (tracestr != null) { haveTrace = true; @@ -227,13 +220,6 @@ namespace System.Web.UI "one of the following values: SortByTime, SortByCategory."); } - if (traceConfig != null) { - if (traceConfig.LocalOnly && !Context.Request.IsLocal) { - haveTrace = false; - trace = false; - } - } - errorPage = GetString (atts, "ErrorPage", null); validateRequest = GetBool (atts, "ValidateRequest", PagesConfig.ValidateRequest); clientTarget = GetString (atts, "ClientTarget", null); diff --git a/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs index 4c200a93568..d075d404a5c 100644 --- a/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs +++ b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs @@ -64,6 +64,10 @@ namespace System.Web.UI protected SimpleWebHandlerParser (HttpContext context, string virtualPath, string physicalPath) { + cachedType = CachingCompiler.GetTypeFromCache (physicalPath); + if (cachedType != null) + return; // We don't need anything else. + this.context = context; this.vPath = virtualPath; this.physPath = physicalPath; @@ -104,8 +108,7 @@ namespace System.Web.UI ParseDirective (trimmed); directiveFound = true; if (gotDefault) { - cachedType = CachingCompiler.GetTypeFromCache (physPath, - className); + cachedType = CachingCompiler.GetTypeFromCache (physPath); if (cachedType != null) break; } diff --git a/mcs/class/System.Web/System.Web.UI/TemplateControl.cs b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs index 7b1e85f94fb..1014c3792f9 100755 --- a/mcs/class/System.Web/System.Web.UI/TemplateControl.cs +++ b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs @@ -106,6 +106,12 @@ namespace System.Web.UI { if (method == null) continue; + if (method.DeclaringType != type) { + if (!method.IsPublic && !method.IsFamilyOrAssembly && + !method.IsFamilyAndAssembly && !method.IsFamily) + continue; + } + if (method.ReturnType != typeof (void)) continue; diff --git a/mcs/class/System.Web/System.Web.UI/TemplateParser.cs b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs index ebceb6394fe..6402b7f84f8 100755 --- a/mcs/class/System.Web/System.Web.UI/TemplateParser.cs +++ b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs @@ -276,6 +276,9 @@ namespace System.Web.UI return null; // Load from bin + if (!Directory.Exists (PrivateBinPath)) + return null; + string [] binDlls = Directory.GetFiles (PrivateBinPath, "*.dll"); foreach (string s in binDlls) { Assembly binA = Assembly.LoadFrom (s); @@ -435,7 +438,6 @@ namespace System.Web.UI CompilerResults result = CachingCompiler.Compile (language, realPath, realPath, assemblies); if (result.NativeCompilerReturnValue != 0) { - StringWriter writer = new StringWriter(); StreamReader reader = new StreamReader (realPath); throw new CompilationException (realPath, result.Errors, reader.ReadToEnd ()); } diff --git a/mcs/class/System.Web/System.Web.Util/ChangeLog b/mcs/class/System.Web/System.Web.Util/ChangeLog index 4d57c166561..f293a48cb13 100644 --- a/mcs/class/System.Web/System.Web.Util/ChangeLog +++ b/mcs/class/System.Web/System.Web.Util/ChangeLog @@ -1,3 +1,8 @@ +2004-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * UrlUtils.cs: don't pass double slash when the path begins with a + tilde. Fixes bug #61654. + 2004-05-26 Gonzalo Paniagua Javier <gonzalo@ximian.com> * UrlUtils.cs: diff --git a/mcs/class/System.Web/System.Web.Util/UrlUtils.cs b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs index 955c8d9a17b..a8f60ff3159 100644 --- a/mcs/class/System.Web/System.Web.Util/UrlUtils.cs +++ b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs @@ -154,7 +154,11 @@ namespace System.Web.Util slash = "/"; } - return Reduce (HttpRuntime.AppDomainAppVirtualPath + slash + relPath); + string appvpath = HttpRuntime.AppDomainAppVirtualPath; + if (appvpath.EndsWith ("/")) + slash = ""; + + return Reduce (appvpath + slash + relPath); } return Reduce (basePath + slash + relPath); diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog index 93cc846bb86..9b793b3aafc 100644 --- a/mcs/class/System.Web/System.Web/ChangeLog +++ b/mcs/class/System.Web/System.Web/ChangeLog @@ -1,3 +1,125 @@ +2004-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TraceContext.cs: don't cast to Page is the handler it's not a page. + +2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpRequest.cs: CurrentExecutionFilePath is the one that + changes when Transfer or Execute are used, not FilePath. + + * HttpServerUtility.cs: moved form saving/restoring from + Transfer to Execute, as it's needed there too. the query string is + correctly set now. Fixes bug #67388. + + * HttpContext.cs: use SetCurrentExePath instead of SetFilePath. + +2004-10-03 Ben Maurer <bmaurer@ximian.com> + + * HttpResponse.cs: use UtcNow + +2004-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpResponse.cs: SuppressContent does not throw and clears all the + buffered output. Fixes bug #67213. + +2004-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpUtility.cs: UrlPathEncode is static. Fixes bug #67155. + +2004-09-29 Ben Maurer <bmaurer@ximian.com> + + * HttpContext.cs, TimeoutManager: Use DateTime.UtcNow. + +2004-09-25 Ben Maurer <bmaurer@ximian.com> + + * HttpApplication.cs: Make sure requests are removed from + the timeout manager. Fixes a major leak. #66751. + +2004-09-24 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpApplicationFactory.cs: + * HttpRuntime.cs: implemented UnloadAppDomain and be ready for domain + unloading. + +2004-09-12 Ben Maurer <bmaurer@ximian.com> + + * HttpContext.cs: use CallContext. It is a little bit faster. + +2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpStaticObjectsCollection.cs: don't share static session objects + declared in the application file across the application, but on a + per-session basis. Fixes bug #65446. + +2004-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpServerUtility.cs: in Transfer(path), don't keep form data if + the transfer is done from inside a page that received a postback. + Fixes bug #65613. + +2004-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpValueCollection.cs: fixed signature of ToString (). Closes bug + #65392. + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpApplication.cs: only add/remove to/from the timeout + manager when we're in a interruptible step. + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TraceContext.cs: when IsEnabled has not been set, return the value + from the TraceManager. Fixes bug #63469. + +2004-08-31 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpRuntime.cs: initialize the response writer when finishing a + request because it cannot be queued. Under heavy load we made new + requests be processed before the ones that might be queued. This is + no longer the case. + + * QueueManager.cs: instead of queueing/dequeuing separately, we now + have a single method that does everything needed to decide which one + will be the next request processed. + +2004-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpRuntime.cs: removed initializations to null in .cctor. Prevent + other requests from avoiding the lock if they are received before the + configuration system is inited. Ensure that the queue manager is not + null before using it (it can be null while the first request is being + processed). + +2004-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpServerUtility.cs: ensure we have a full virtual path for the + request being executed. + +2004-07-21 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpApplication.cs: the file not found might be a dependency. + +2004-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpCookie.cs: use invariant when formatting expires date. Fixes bug + #61690. + +2004-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpApplication.cs: don't keep the session around if we got it from + the context. Fixes bug #61232. + +2004-07-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpUtility.cs: fixed stupid bug in UrlDecode from bytes. Closes bug + #61181. + +2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TraceContext.cs: added internal HaveTrace property whose + value is true when the page has a Trace attribute. + 2004-06-15 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TraceData.cs: fixed <br> output. Closes bug #60181. diff --git a/mcs/class/System.Web/System.Web/HttpApplication.cs b/mcs/class/System.Web/System.Web/HttpApplication.cs index 0f8aaa3759b..91dfda2ae8d 100644 --- a/mcs/class/System.Web/System.Web/HttpApplication.cs +++ b/mcs/class/System.Web/System.Web/HttpApplication.cs @@ -639,6 +639,7 @@ namespace System.Web { bool ready_sync = false; IStateHandler handler; + bool timeoutPossible = false; lock (_app) { _app.OnStateExecuteEnter (); @@ -662,14 +663,25 @@ namespace System.Web handler = _handlers [_currentStateIdx]; _countSteps++; - lasterror = ExecuteState (handler, ref ready_sync); - if (ready_sync) - _countSyncSteps++; + timeoutPossible = handler.PossibleToTimeout; + try { + if (timeoutPossible) + HttpRuntime.TimeoutManager.Add (_app.Context); + + lasterror = ExecuteState (handler, ref ready_sync); + if (ready_sync) + _countSyncSteps++; + } finally { + if (timeoutPossible) + HttpRuntime.TimeoutManager.Remove (_app.Context); + } } while (ready_sync && _currentStateIdx < _endStateIdx); if (null != lasterror) _app.HandleError (lasterror); } finally { + + _app.OnStateExecuteLeave (); } } @@ -805,7 +817,12 @@ namespace System.Web return ret; } catch (DirectoryNotFoundException) { throw new HttpException (404, "Cannot find '" + file + "'."); - } catch (FileNotFoundException) { + } catch (FileNotFoundException fnf) { + string fname = fnf.FileName; + if (fname != null && fname != "") { + file = Path.GetFileName (fname); + } + throw new HttpException (404, "Cannot find '" + file + "'."); } } @@ -888,14 +905,12 @@ namespace System.Web SaveThreadCulture (); _savedContext = HttpContext.Context; HttpContext.Context = _Context; - HttpRuntime.TimeoutManager.Add (_Context); SetPrincipal (Context.User); } internal void OnStateExecuteLeave () { RestoreThreadCulture (); - HttpRuntime.TimeoutManager.Remove (_Context); HttpContext.Context = _savedContext; RestorePrincipal (); } @@ -1145,10 +1160,8 @@ namespace System.Web if (null != _Session) return _Session; - if (null != _Context && null != _Context.Session) { - _Session = _Context.Session; - return _Session; - } + if (null != _Context && null != _Context.Session) + return _Context.Session; throw new HttpException ("Failed to get session object"); } diff --git a/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs b/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs index 65ce0a9f9e1..5882982564c 100644 --- a/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs +++ b/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs @@ -142,43 +142,39 @@ namespace System.Web { return appTypeEventHandlers;
}
-
- static bool FireEvents (string method_name, object target, object [] args)
- {
- Hashtable possibleEvents = GetApplicationTypeEvents ((HttpApplication) target);
- MethodInfo method = possibleEvents [method_name] as MethodInfo;
- if (method == null)
- return false;
-
- if (method.GetParameters ().Length == 0)
- method.Invoke (target, null);
- else
- method.Invoke (target, args);
-
- return true;
- }
-
+ + static bool FireEvent (string method_name, object target, object [] args) + { + Hashtable possibleEvents = GetApplicationTypeEvents ((HttpApplication) target); + MethodInfo method = possibleEvents [method_name] as MethodInfo; + if (method == null) + return false; + + if (method.GetParameters ().Length == 0) + method.Invoke (target, null); + else + method.Invoke (target, args); + + return true; + } + internal static void FireOnAppStart (HttpApplication app)
- {
+ { object [] args = new object [] {app, EventArgs.Empty};
- FireEvents ("Application_Start", app, args);
- }
-
- void FireOnAppEnd ()
- {
- // FireEvents ("Application_End", this, new object [] {this, EventArgs.Empty});
- }
-
- void FireOnSessionStart (HttpSessionState state, object source, EventArgs args)
- {
- // FireEvents ("Session_Start", state, new object [] {source, EventArgs.Empty});
- }
-
- void FireOnSessionEnd (HttpSessionState state, object source, EventArgs args)
- {
- // FireEvents ("Session_End", state, new object [] {source, args});
- }
-
+ FireEvent ("Application_Start", app, args);
+ } + + void FireOnAppEnd () + { + if (_appType == null) + return; // we didn't even get an application + + HttpApplication app = (HttpApplication) HttpRuntime.CreateInternalObject (_appType); + AttachEvents (app); + FireEvent ("Application_End", app, new object [] {this, EventArgs.Empty}); + app.Dispose (); + } + private void InitializeFactory (HttpContext context)
{
_appFilename = GetAppFilename (context);
diff --git a/mcs/class/System.Web/System.Web/HttpContext.cs b/mcs/class/System.Web/System.Web/HttpContext.cs index 8ffb184383e..4d28af400ad 100644 --- a/mcs/class/System.Web/System.Web/HttpContext.cs +++ b/mcs/class/System.Web/System.Web/HttpContext.cs @@ -38,6 +38,7 @@ using System.Web.Configuration; using System.Web.Util; using System.Web.SessionState; using System.Threading; +using System.Runtime.Remoting.Messaging; namespace System.Web { @@ -96,15 +97,14 @@ namespace System.Web } } - [MonoTODO("Context - Use System.Remoting.Messaging.CallContext instead of Thread storage")] internal static HttpContext Context { get { - return (HttpContext) Thread.GetData (Thread.GetNamedDataSlot ("Context")); + return (HttpContext) CallContext.GetData ("Context"); } set { - Thread.SetData (Thread.GetNamedDataSlot ("Context"), value); + CallContext.SetData ("Context", value); } } @@ -287,7 +287,7 @@ namespace System.Web internal void BeginTimeoutPossible () { timeoutPossible = 1; - timeoutBegin = DateTime.Now.Ticks; + timeoutBegin = DateTime.UtcNow.Ticks; } internal void EndTimeoutPossible () @@ -403,7 +403,7 @@ namespace System.Web throw new HttpException (404, "The virtual path '" + path + "' maps to another application."); - Request.SetFilePath (path); + Request.SetCurrentExePath (path); Request.QueryStringRaw = query; } diff --git a/mcs/class/System.Web/System.Web/HttpCookie.cs b/mcs/class/System.Web/System.Web/HttpCookie.cs index 32fdf84261b..c121772be1b 100644 --- a/mcs/class/System.Web/System.Web/HttpCookie.cs +++ b/mcs/class/System.Web/System.Web/HttpCookie.cs @@ -26,6 +26,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; +using System.Globalization; using System.Text; using System.Web; using System.Collections.Specialized; @@ -98,7 +99,9 @@ namespace System.Web if (_ExpiresSet && _Expires != DateTime.MinValue) { oSetCookie.Append ("; expires="); - oSetCookie.Append (_Expires.ToUniversalTime ().ToString ("ddd, dd-MMM-yyyy HH':'mm':'ss '+0000'")); + DateTime ut = _Expires.ToUniversalTime (); + oSetCookie.Append (ut.ToString ("ddd, dd-MMM-yyyy HH':'mm':'ss 'GMT'", + DateTimeFormatInfo.InvariantInfo)); } if (_Secure) diff --git a/mcs/class/System.Web/System.Web/HttpRequest.cs b/mcs/class/System.Web/System.Web/HttpRequest.cs index 5b1cbef349c..48140d4c1f9 100644 --- a/mcs/class/System.Web/System.Web/HttpRequest.cs +++ b/mcs/class/System.Web/System.Web/HttpRequest.cs @@ -88,6 +88,7 @@ namespace System.Web { Stream userFilter; HttpRequestStream requestFilter; string clientTarget; + string currentExePath; #if NET_1_1 bool validateCookies; bool validateForm; @@ -503,6 +504,9 @@ namespace System.Web { public string CurrentExecutionFilePath { get { + if (currentExePath != null) + return currentExePath; + return FilePath; } } @@ -1139,9 +1143,9 @@ namespace System.Web { } #endif - internal void SetFilePath (string filePath) + internal void SetCurrentExePath (string filePath) { - _sFilePath = filePath; + currentExePath = filePath; _sRequestRootVirtualDir = null; baseVirtualDir = null; } diff --git a/mcs/class/System.Web/System.Web/HttpResponse.cs b/mcs/class/System.Web/System.Web/HttpResponse.cs index 45128ce4415..fa8c2892af8 100644 --- a/mcs/class/System.Web/System.Web/HttpResponse.cs +++ b/mcs/class/System.Web/System.Web/HttpResponse.cs @@ -190,7 +190,7 @@ namespace System.Web CultureInfo oSavedInfo = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; - string date = DateTime.Now.ToUniversalTime ().ToString ("ddd, d MMM yyyy HH:mm:ss "); + string date = DateTime.UtcNow.ToString ("ddd, d MMM yyyy HH:mm:ss "); HttpResponseHeader date_header = new HttpResponseHeader ("Date", date + "GMT"); oHeaders.Add (date_header); @@ -618,9 +618,6 @@ namespace System.Web } set { - if (_bHeadersSent) - throw new HttpException ("Headers has been sent to the client"); - _bSuppressContent = true; } } @@ -846,6 +843,9 @@ namespace System.Web if (!_bSuppressContent && Request.HttpMethod == "HEAD") _bSuppressContent = true; + if (_bSuppressContent) + _Writer.Clear (); + if (!_bSuppressContent) { _bClientDisconnected = false; if (_bChunked) { diff --git a/mcs/class/System.Web/System.Web/HttpRuntime.cs b/mcs/class/System.Web/System.Web/HttpRuntime.cs index f48797c3815..da23b53407b 100644 --- a/mcs/class/System.Web/System.Web/HttpRuntime.cs +++ b/mcs/class/System.Web/System.Web/HttpRuntime.cs @@ -61,11 +61,10 @@ namespace System.Web { private int _activeRequests; private HttpWorkerRequest.EndOfSendNotification _endOfSendCallback; private AsyncCallback _handlerCallback; - private WaitCallback _appDomainCallback; + private WaitCallback unloadDomainCallback; private bool _firstRequestStarted; private bool _firstRequestExecuted; - private DateTime _firstRequestStartTime; private Exception _initError; private TimeoutManager timeoutManager; @@ -76,12 +75,6 @@ namespace System.Web { static HttpRuntime () { - appPathDiscoveryStackWalk = null; - ctrlPrincipalStackWalk = null; - sensitiveInfoStackWalk = null; - unmgdCodeStackWalk = null; - unrestrictedStackWalk = null; - _runtime = new HttpRuntime (); _runtime.Init(); } @@ -101,9 +94,10 @@ namespace System.Web { _cache = new Cache (); timeoutManager = new TimeoutManager (); - _endOfSendCallback = new HttpWorkerRequest.EndOfSendNotification(OnEndOfSend); - _handlerCallback = new AsyncCallback(OnHandlerReady); - _appDomainCallback = new WaitCallback(OnAppDomainUnload); + _endOfSendCallback = new HttpWorkerRequest.EndOfSendNotification (OnEndOfSend); + _handlerCallback = new AsyncCallback (OnHandlerReady); + unloadDomainCallback = new WaitCallback (DoUnload); + AppDomain.CurrentDomain.DomainUnload += new EventHandler (OnDomainUnload); } catch (Exception error) { _initError = error; @@ -185,6 +179,8 @@ namespace System.Web { context.Response.FinalFlush (); } + /* + * This is not being used. OnFirstRequestEnd is empty. if (!_firstRequestExecuted) { lock (this) { if (!_firstRequestExecuted) { @@ -193,6 +189,7 @@ namespace System.Web { } } } + */ Interlocked.Decrement(ref _activeRequests); @@ -237,20 +234,33 @@ namespace System.Web { HttpContext context = new HttpContext (wr); HttpException exception = new HttpException (503, "Service unavailable"); Interlocked.Increment (ref _runtime._activeRequests); + context.Response.InitializeWriter (); _runtime.FinishRequest (context, exception); } - private void OnAppDomainUnload(object state) { - Dispose(); + void DoUnload (object state) + { + AppDomain.Unload (AppDomain.CurrentDomain); } internal void Dispose() { - WaitForRequests(5000); + WaitForRequests (2000); queueManager.Dispose (); // Send a 503 to all queued requests queueManager = null; _cache = null; - HttpApplicationFactory.EndApplication(); + HttpApplicationFactory.EndApplication (); + } + + void OnDomainUnload (object o, EventArgs args) + { + HttpApplicationFactory.EndApplication (); + } + + internal void ByeByeDomain () + { + HttpApplicationFactory.EndApplication (); + ThreadPool.QueueUserWorkItem (unloadDomainCallback); } internal void WaitForRequests(int ms) { @@ -279,10 +289,9 @@ namespace System.Web { if (!_firstRequestStarted) { lock (this) { if (!_firstRequestStarted) { - _firstRequestStarted = true; - _firstRequestStartTime = DateTime.Now; OnFirstRequestStart(context); - } + _firstRequestStarted = true; + } } } @@ -317,44 +326,38 @@ namespace System.Web { void TryExecuteQueuedRequests () { // Wait for pending jobs to start - if (Interlocked.CompareExchange (ref pendingCallbacks, 3, 3) == 3) { + if (Interlocked.CompareExchange (ref pendingCallbacks, 3, 3) >= 3) return; - } - - if (queueManager == null) - return; - - if (!queueManager.CanExecuteRequest (false)) { - return; - } - HttpWorkerRequest wr = queueManager.Dequeue (); - if (wr == null) { + HttpWorkerRequest wr = queueManager.GetNextRequest (null); + if (wr == null) return; - } Interlocked.Increment (ref pendingCallbacks); ThreadPool.QueueUserWorkItem (doRequestCallback, wr); TryExecuteQueuedRequests (); } - public static void ProcessRequest (HttpWorkerRequest Request) + public static void ProcessRequest (HttpWorkerRequest request) { - if (Request == null) - throw new ArgumentNullException ("Request"); - - if (!_runtime._firstRequestExecuted || _runtime.queueManager.CanExecuteRequest (false)) { - _runtime.InternalExecuteRequest (Request); - } else { - _runtime.queueManager.Queue (Request); + if (request == null) + throw new ArgumentNullException ("request"); + + QueueManager mgr = _runtime.queueManager; + if (_runtime._firstRequestStarted && mgr != null) { + request = mgr.GetNextRequest (request); + // We're busy, return immediately + if (request == null) + return; } + + _runtime.InternalExecuteRequest (request); } #if NET_1_1 - [MonoTODO] - public void UnloadAppDomain () + public static void UnloadAppDomain () { - throw new NotImplementedException (); + _runtime.ByeByeDomain (); } #endif public static Cache Cache { @@ -451,7 +454,7 @@ namespace System.Web { public static void Close () { - _runtime.Dispose(); + _runtime.Dispose (); } internal static string FormatResourceString (string key) @@ -507,7 +510,7 @@ namespace System.Web { [MonoTODO ("GetResourceStringFromResourceManager (string)")] private string GetResourceStringFromResourceManager (string key) { - return "String returned by HttpRuntime.GetResourceStringFromResourceManager"; + return key; } #region Security Internal Methods (not impl) diff --git a/mcs/class/System.Web/System.Web/HttpServerUtility.cs b/mcs/class/System.Web/System.Web/HttpServerUtility.cs index 5fb510baf46..86c925de04b 100644 --- a/mcs/class/System.Web/System.Web/HttpServerUtility.cs +++ b/mcs/class/System.Web/System.Web/HttpServerUtility.cs @@ -46,6 +46,8 @@ using System.Collections.Specialized; using System.IO; using System.Text; using System.Web.Hosting; +using System.Web.UI; +using System.Web.Util; namespace System.Web { @@ -190,19 +192,26 @@ namespace System.Web } else { query = ""; } - - string filePath = _Context.Request.MapPath (path); + + HttpRequest request = _Context.Request; HttpResponse response = _Context.Response; + + string oldQuery = request.QueryStringRaw; + request.QueryStringRaw = query; + + HttpValueCollection oldForm = null; + if (!preserveQuery) { + oldForm = _Context.Request.Form as HttpValueCollection; + _Context.Request.SetForm (new HttpValueCollection ()); + } + + string filePath = _Context.Request.MapPath (path); TextWriter output = writer; if (output == null) output = response.Output; - HttpRequest request = _Context.Request; string oldFilePath = request.FilePath; - request.SetFilePath (path); - string oldQuery = request.QueryStringRaw; - - if (!preserveQuery) request.QueryStringRaw = query; + request.SetCurrentExePath (UrlUtils.Combine (_Context.Request.BaseVirtualDir, path)); IHttpHandler handler = _Context.ApplicationInstance.CreateHttpHandler (_Context, request.RequestType, path, @@ -219,9 +228,11 @@ namespace System.Web asyncHandler.EndProcessRequest (ar); } } finally { - request.SetFilePath (oldFilePath); + request.SetCurrentExePath (oldFilePath); request.QueryStringRaw = oldQuery; response.SetTextWriter (previous); + if (!preserveQuery) + _Context.Request.SetForm (oldForm); } } @@ -302,7 +313,15 @@ namespace System.Web /// <param name="path">The URL path of the new page on the server to execute. </param> public void Transfer (string path) { - Transfer (path, true); + // If it's a page and a postback, don't pass form data + // See bug #65613. + bool preserveForm = true; + if (_Context.Handler is Page) { + Page page = (Page) _Context.Handler; + preserveForm = !page.IsPostBack; + } + + Transfer (path, preserveForm); } /// <summary> @@ -314,16 +333,7 @@ namespace System.Web /// they are cleared. The default is false. </param> public void Transfer (string path, bool preserveForm) { - HttpValueCollection oldForm = null; - if (!preserveForm) { - oldForm = _Context.Request.Form as HttpValueCollection; - _Context.Request.SetForm (new HttpValueCollection ()); - } - Execute (path, null, preserveForm); - if (!preserveForm) - _Context.Request.SetForm (oldForm); - _Context.Response.End (); } diff --git a/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs b/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs index 46d7c129396..873da72de7c 100644 --- a/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs +++ b/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs @@ -37,6 +37,11 @@ namespace System.Web { this.type = type; } + public StaticItem (StaticItem item) + { + this.type = item.type; + } + public object Instance { get { lock (this) { @@ -101,6 +106,18 @@ namespace System.Web { get { return this; } } + internal HttpStaticObjectsCollection Clone () + { + HttpStaticObjectsCollection coll = new HttpStaticObjectsCollection (); + coll._Objects = new Hashtable (); + foreach (string key in _Objects.Keys) { + StaticItem item = new StaticItem ((StaticItem) _Objects [key]); + coll._Objects [key] = item; + } + + return coll; + } + internal void Add (ObjectTagBuilder tag) { _Objects.Add (tag.ObjectID, new StaticItem (tag.Type)); diff --git a/mcs/class/System.Web/System.Web/HttpUtility.cs b/mcs/class/System.Web/System.Web/HttpUtility.cs index d70b32d8f92..c7f3fecf63b 100644 --- a/mcs/class/System.Web/System.Web/HttpUtility.cs +++ b/mcs/class/System.Web/System.Web/HttpUtility.cs @@ -444,7 +444,7 @@ namespace System.Web { int value = 0;
int end = length + offset;
for (int i = offset; i < end; i++)
- value = (value << 4) + GetInt (bytes [offset]);
+ value = (value << 4) + GetInt (bytes [i]);
return (char) value;
}
@@ -474,10 +474,10 @@ namespace System.Web { output.Append (GetChars (acc, e));
acc.SetLength (0);
}
- output.Append (GetChar (bytes, offset + 2, 4));
+ output.Append (GetChar (bytes, i + 2, 4));
i += 5;
} else {
- acc.WriteByte ((byte) GetChar (bytes, offset + 1, 2));
+ acc.WriteByte ((byte) GetChar (bytes, i + 1, 2));
i += 2;
}
continue;
@@ -829,7 +829,7 @@ namespace System.Web { }
#if NET_1_1
- public string UrlPathEncode (string s)
+ public static string UrlPathEncode (string s)
{
if (s == null)
return null;
diff --git a/mcs/class/System.Web/System.Web/HttpValueCollection.cs b/mcs/class/System.Web/System.Web/HttpValueCollection.cs index 946b8542d46..e8ba4e3a0db 100644 --- a/mcs/class/System.Web/System.Web/HttpValueCollection.cs +++ b/mcs/class/System.Web/System.Web/HttpValueCollection.cs @@ -211,7 +211,7 @@ namespace System.Web return result.ToString (); } - virtual new public string ToString () + public override string ToString () { return ToString (false); } diff --git a/mcs/class/System.Web/System.Web/QueueManager.cs b/mcs/class/System.Web/System.Web/QueueManager.cs index a3f8f621d90..29ec8a91cc4 100644 --- a/mcs/class/System.Web/System.Web/QueueManager.cs +++ b/mcs/class/System.Web/System.Web/QueueManager.cs @@ -4,7 +4,7 @@ // Authors: // Gonzalo Paniagua Javier (gonzalo@ximian.com) // -// (C) 2003 Novell, Inc (http://www.novell.com) +// (C) 2003,2004 Novell, Inc (http://www.novell.com) // // @@ -53,35 +53,57 @@ namespace System.Web queue = new Queue (queueLimit); } - // TODO: handle local connections - public bool CanExecuteRequest (bool local) + // TODO: handle local connections, just check for 127.0.0.1 + bool CanExecuteRequest () { if (disposing) return false; int threads, cports; ThreadPool.GetAvailableThreads (out threads, out cports); - return (threads > minFree) || (local && threads > minLocalFree); + return (threads > minFree); // || (local && threads > minLocalFree); } - - public void Queue (HttpWorkerRequest wr) + + public HttpWorkerRequest GetNextRequest (HttpWorkerRequest req) { + if (!CanExecuteRequest ()) { + if (req != null) { + lock (queue) { + Queue (req); + } + } + + return null; + } + + HttpWorkerRequest result; lock (queue) { - if (queue.Count < queueLimit) { - queue.Enqueue (wr); - return; + result = Dequeue (); + if (result != null) { + if (req != null) + Queue (req); + } else { + result = req; } } + return result; + } + + void Queue (HttpWorkerRequest wr) + { + if (queue.Count < queueLimit) { + queue.Enqueue (wr); + return; + } + HttpRuntime.FinishUnavailable (wr); } - public HttpWorkerRequest Dequeue () + HttpWorkerRequest Dequeue () { - lock (queue) { - if (queue.Count > 0) - return (HttpWorkerRequest) queue.Dequeue (); - } + if (queue.Count > 0) + return (HttpWorkerRequest) queue.Dequeue (); return null; } @@ -93,7 +115,7 @@ namespace System.Web disposing = true; HttpWorkerRequest wr; - while ((wr = Dequeue ()) != null) + while ((wr = GetNextRequest (null)) != null) HttpRuntime.FinishUnavailable (wr); queue = null; diff --git a/mcs/class/System.Web/System.Web/TimeoutManager.cs b/mcs/class/System.Web/System.Web/TimeoutManager.cs index d686568cc88..2fbdd35e3f6 100644 --- a/mcs/class/System.Web/System.Web/TimeoutManager.cs +++ b/mcs/class/System.Web/System.Web/TimeoutManager.cs @@ -106,7 +106,7 @@ namespace System.Web return; } - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; ArrayList clist = new ArrayList (); lock (this) { // The lock prevents Keys enumerator from being out of synch diff --git a/mcs/class/System.Web/System.Web/TraceContext.cs b/mcs/class/System.Web/System.Web/TraceContext.cs index 6d7a7c68608..efa37b06471 100644 --- a/mcs/class/System.Web/System.Web/TraceContext.cs +++ b/mcs/class/System.Web/System.Web/TraceContext.cs @@ -42,20 +42,31 @@ namespace System.Web { private TraceMode _Mode;
private TraceData data;
private bool data_saved;
+ private bool _haveTrace; public TraceContext(HttpContext Context) {
_Context = Context;
_Enabled = false;
}
+ + + internal bool HaveTrace { + get { + return _haveTrace; + } + } public bool IsEnabled {
get {
+ if (!_haveTrace) + return HttpRuntime.TraceManager.Enabled; return _Enabled;
}
set {
if (value && data == null)
data = new TraceData ();
+ _haveTrace = true; _Enabled = value;
}
}
@@ -95,7 +106,7 @@ namespace System.Web { }
private void Write(string category, string msg, Exception error, bool Warning) {
- if (!_Enabled)
+ if (!IsEnabled)
return;
if (data == null)
data = new TraceData ();
@@ -107,7 +118,9 @@ namespace System.Web { if (data == null)
data = new TraceData ();
SetRequestDetails ();
- data.AddControlTree ((Page) _Context.Handler);
+ if (_Context.Handler is Page) + data.AddControlTree ((Page) _Context.Handler); + AddCookies ();
AddHeaders ();
AddServerVars ();
diff --git a/mcs/class/System.Windows.Forms/ChangeLog b/mcs/class/System.Windows.Forms/ChangeLog index 0dddc0e9a17..98e2445145e 100644 --- a/mcs/class/System.Windows.Forms/ChangeLog +++ b/mcs/class/System.Windows.Forms/ChangeLog @@ -1,3 +1,9 @@ + +Wed Oct 13 15:12:17 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * System.Resources/ResXResourceReader.cs: patch by + joel.reed@ddiworld.com (joel) to handle CDATA sections. + 2004-05-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> * System.Resources/ResXResourceWriter.cs: implemented. diff --git a/mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs b/mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs index b1a18329fed..7b68b646f79 100644 --- a/mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs +++ b/mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs @@ -87,7 +87,7 @@ namespace System.Resources if (!gotelement) return null; while (reader.Read ()) { - if (reader.NodeType == XmlNodeType.Text) { + if (reader.NodeType == XmlNodeType.Text || reader.NodeType == XmlNodeType.CDATA) { string v = reader.Value; return v; } diff --git a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog index 053dc02ede2..c7d9e126328 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog @@ -1,3 +1,10 @@ +2004-07-30 Atsushi Enomoto <atsushi@ximian.com> + + * DTMXPathNavigator.cs : + Fixed IsSamePosition(). currentAttr is not always the same as + that of other when current is not attribute. Ditto for currentNS + (when current is not namespace). + 2004-06-06 Atsushi Enomoto <atsushi@ximian.com> * DTMXPathDocumentBuilder.cs : Close XmlTextReader strictly. It might diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs index abd904bc987..6bd8a339a0e 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs +++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs @@ -366,11 +366,16 @@ namespace Mono.Xml.XPath if (another == null || another.document != this.document) return false; - return this.currentNode == another.currentNode && - this.currentAttr == another.currentAttr && - this.currentIsAttr == another.currentIsAttr && - this.currentIsNode == another.currentIsNode && - this.currentNs == another.currentNs; + if (this.currentNode != another.currentNode || + this.currentIsAttr != another.currentIsAttr || + this.currentIsNode != another.currentIsNode) + return false; + + if (currentIsAttr) + return this.currentAttr == another.currentAttr; + else if (!currentIsNode) + return this.currentNs == another.currentNs; + return true; } public override bool MoveTo (XPathNavigator other) diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog index ece4b875d31..bb78351e9de 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog @@ -1,3 +1,12 @@ +2004-10-04 Atsushi Enomoto <atsushi@ximian.com> + + * HtmlEmitter.cs : TH tag is not regarded as HTML tag. + This fixes bug #67390. + +Thu Sep 9 07:09:11 PDT 2004 Paolo Molaro <lupus@ximian.com> + + * ScriptCompilerInfo.cs: avoid using a .cctor and fix precomp. + 2004-06-18 Atsushi Enomoto <atsushi@ximian.com> * Debug.cs, HtmlEmitter.cs, MSXslScriptManager.cs, diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs index 39839561219..ad5872c3c9a 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs @@ -226,9 +226,8 @@ namespace Mono.Xml.Xsl case "SMALL": case "SPAN": case "STRIKE": case "STRONG": case "STYLE": case "SUB": case "SUP": case "TABLE": case "TBODY": case "TD": case "TEXTAREA": - case "TFOOT": case "THEAD": case "TITLE": case "TR": case "TT": - case "U": case "UL": - case "VAR": + case "TFOOT": case "TH": case "THEAD": case "TITLE": + case "TR": case "TT": case "U": case "UL": case "VAR": return true; } return false; diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/ScriptCompilerInfo.cs b/mcs/class/System.XML/Mono.Xml.Xsl/ScriptCompilerInfo.cs index 0a5d72ed4cb..87438fa2bb0 100755 --- a/mcs/class/System.XML/Mono.Xml.Xsl/ScriptCompilerInfo.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl/ScriptCompilerInfo.cs @@ -216,12 +216,6 @@ end namespace { static Type providerType; - static JScriptCompilerInfo () - { - Assembly jsasm = Assembly.LoadWithPartialName ("Microsoft.JScript", null); - providerType = jsasm.GetType ("Microsoft.JScript.JScriptCodeProvider"); - } - public JScriptCompilerInfo () { this.CompilerCommand = "mjs"; @@ -231,9 +225,17 @@ end namespace this.DefaultCompilerOptions = "/t:library /r:Microsoft.VisualBasic.dll"; } - public override CodeDomProvider CodeDomProvider {
- get { return (CodeDomProvider) Activator.CreateInstance (providerType); }
- }
+ public override CodeDomProvider CodeDomProvider { + get { + // no need for locking + if (providerType == null) { + Assembly jsasm = Assembly.LoadWithPartialName ("Microsoft.JScript", null); + if (jsasm != null) + providerType = jsasm.GetType ("Microsoft.JScript.JScriptCodeProvider"); + } + return (CodeDomProvider) Activator.CreateInstance (providerType); + } + } public override string Extension { get { return ".js"; } diff --git a/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs b/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs index 8402f2d8004..4587f204179 100644 --- a/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs +++ b/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs @@ -1370,15 +1370,61 @@ namespace Mono.Xml.Schema public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
- return ParseValueType (s, nameTable, nsmgr);
+ return new XmlSchemaUri (Normalize (s));
}
internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
- return new UriValueType (Normalize (s));
+ return new UriValueType ((XmlSchemaUri) ParseValue (s, nameTable, nsmgr));
}
}
-
+
+ internal class XmlSchemaUri : Uri
+ {
+ public string value;
+
+ // LAMESPEC: In this way, some strings that contain ':' might
+ // result in exception (MS.NET looks implemented as such).
+ public XmlSchemaUri (string src)
+ : this (src, src.IndexOf (':') > 0)
+ {
+ }
+
+ private XmlSchemaUri (string src, bool formal)
+ : base (formal ? src : "anyuri:" + src, !formal)
+ {
+ value = src;
+ }
+
+ public static bool operator == (XmlSchemaUri v1, XmlSchemaUri v2)
+ {
+ return v1.value == v2.value;
+ }
+
+ public static bool operator != (XmlSchemaUri v1, XmlSchemaUri v2)
+ {
+ return v1.value != v2.value;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is XmlSchemaUri)
+ return (XmlSchemaUri) obj == this;
+ else
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return value;
+ }
+ }
+
// xs:duration
internal class XsdDuration : XsdAnySimpleType
{
diff --git a/mcs/class/System.XML/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/System.Xml.Schema/ChangeLog index 14dd692e892..e3dc9a5679f 100755 --- a/mcs/class/System.XML/System.Xml.Schema/ChangeLog +++ b/mcs/class/System.XML/System.Xml.Schema/ChangeLog @@ -1,3 +1,14 @@ +2004-09-16 Atsushi Enomoto <atsushi@ximian.com> + + * BuiltInDatatype.cs, SchemaDataValueType.cs : + ParseValue() for xs:AnyURI should return System.Uri. MS.NET returns + XmlSchemaUri, but it is derived from System.Uri, while ours was not. + +2004-09-03 Atsushi Enomoto <atsushi@ximian.com> + + * XmlSchema.cs : When schema inclusion results in a recursion, just + skip recursed schema. + 2004-06-18 Atsushi Enomoto <atsushi@ximian.com> * CustomSerializer.cs, XmlSchemaException.cs, diff --git a/mcs/class/System.XML/System.Xml.Schema/SchemaDataValueType.cs b/mcs/class/System.XML/System.Xml.Schema/SchemaDataValueType.cs index c2b9305fcad..ff4031f2806 100755 --- a/mcs/class/System.XML/System.Xml.Schema/SchemaDataValueType.cs +++ b/mcs/class/System.XML/System.Xml.Schema/SchemaDataValueType.cs @@ -19,6 +19,8 @@ // 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 Mono.Xml.Schema;
+
namespace System.Xml.Schema
{
internal struct QNameValueType
@@ -97,14 +99,14 @@ namespace System.Xml.Schema internal struct UriValueType
{
- string value;
+ XmlSchemaUri value;
- public UriValueType (string value)
+ public UriValueType (XmlSchemaUri value)
{
this.value = value;
}
- public string Value {
+ public XmlSchemaUri Value {
get { return value; }
}
@@ -133,7 +135,7 @@ namespace System.Xml.Schema public override string ToString ()
{
- return value;
+ return value.ToString ();
}
}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs index 59e28520089..6e37d9f3be6 100755 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs @@ -369,7 +369,10 @@ namespace System.Xml.Schema if (resolver != null) {
url = GetResolvedUri (resolver, ext.SchemaLocation);
if (schemaLocationStack.Contains (url)) {
- error(handler, "Nested inclusion was found: " + url);
+ // Just skip nested inclusion.
+ // The spec is "carefully written"
+ // not to handle it as an error.
+ // error (handler, "Nested inclusion was found: " + url);
// must skip this inclusion
continue;
}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog index f98edd97e7f..f25f9c759bd 100755 --- a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog +++ b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog @@ -1,3 +1,25 @@ +2004-10-19 Atsushi Enomoto <atsushi@ximian.com> + + * XmlSerializationWriter.cs : When namespace is an empty string, + XmlTextWriter.LookupPrefix() will raise an error. Just skip it in + such case. + +2004-09-28 Lluis Sanchez Gual <lluis@novell.com> + + * CodeIdentifier.cs: MakeValid now returns "Item" for an empty string. + This fixes bug #66877. + +2004-09-03 Lluis Sanchez Gual <lluis@novell.com> + + * XmlSerializer.cs: When the XmlReader is created by XmlSerializer, use + Normalization==true by default. + +2004-07-15 Lluis Sanchez Gual <lluis@novell.com> + + * TypeTranslator.cs, XmlCustomFormatter.cs: Added support for base64. This + xsd type is not part of the last schema specification, but the google api + uses it and ms.net accepts it. + 2004-06-22 Lluis Sanchez Gual <lluis@ximian.com> * ReflectionHelper.cs: Correctly detect private types. diff --git a/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs index 93d78b2f69f..54c0b6bee87 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs @@ -55,7 +55,7 @@ namespace System.Xml.Serialization { if (identifier == null) throw new NullReferenceException (); if (identifier.Length == 0) - return identifier; + return "Item"; string output = ""; diff --git a/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs b/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs index cffcb1567a1..fc71eeea981 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs @@ -106,6 +106,7 @@ namespace System.Xml.Serialization primitiveTypes.Add ("token", new TypeData (typeof (string), "token", true)); primitiveTypes.Add ("normalizedString", new TypeData (typeof (string), "normalizedString", true)); primitiveTypes.Add ("anyURI", new TypeData (typeof (string), "anyURI", true)); + primitiveTypes.Add ("base64", new TypeData (typeof (byte[]), "base64", true)); } public static TypeData GetTypeData (Type type) diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs index 17514268a90..60b4f282cab 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs @@ -195,6 +195,7 @@ namespace System.Xml.Serialization { case "unsignedInt": return XmlConvert.ToString ((UInt32)value); case "unsignedLong": return XmlConvert.ToString ((UInt64)value); case "guid": return XmlConvert.ToString ((Guid)value); + case "base64": case "base64Binary": return Convert.ToBase64String ((byte[])value); default: return value is IFormattable ? ((IFormattable) value).ToString (null, CultureInfo.InvariantCulture) : value.ToString (); } @@ -223,6 +224,7 @@ namespace System.Xml.Serialization { case "unsignedInt": return XmlConvert.ToUInt32 (value); case "unsignedLong": return XmlConvert.ToUInt64 (value); case "guid": return XmlConvert.ToGuid (value); + case "base64": case "base64Binary": return Convert.FromBase64String (value); default: if (type.Type != null) @@ -253,6 +255,7 @@ namespace System.Xml.Serialization { case "unsignedInt": return value + ".ToString(CultureInfo.InvariantCulture)"; case "unsignedLong": return value + ".ToString(CultureInfo.InvariantCulture)"; case "guid": return "XmlConvert.ToString (" + value + ")"; + case "base64": case "base64Binary": return "Convert.ToBase64String (" + value + ")"; case "NMTOKEN": case "Name": @@ -290,6 +293,7 @@ namespace System.Xml.Serialization { case "unsignedInt": return "UInt32.Parse (" + value + ", CultureInfo.InvariantCulture)"; case "unsignedLong": return "UInt64.Parse (" + value + ", CultureInfo.InvariantCulture)"; case "guid": return "XmlConvert.ToGuid (" + value + ")"; + case "base64:": case "base64Binary": return "Convert.FromBase64String (" + value + ")"; default: return value; } diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs index 0394202fdd4..bccbce7a9c9 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs @@ -479,7 +479,7 @@ namespace System.Xml.Serialization { ICollection namespaces = ns.Namespaces.Values; foreach (XmlQualifiedName qn in namespaces) { - if (Writer.LookupPrefix (qn.Namespace) == null) + if (qn.Namespace != String.Empty && Writer.LookupPrefix (qn.Namespace) == null) WriteAttribute ("xmlns", qn.Name, xmlNamespace, qn.Namespace); } } diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs index d5efa65c1d3..aa57189fb34 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs @@ -251,12 +251,14 @@ namespace System.Xml.Serialization public object Deserialize (Stream stream) { XmlTextReader xmlReader = new XmlTextReader(stream); + xmlReader.Normalization = true; return Deserialize(xmlReader); } public object Deserialize (TextReader textReader) { XmlTextReader xmlReader = new XmlTextReader(textReader); + xmlReader.Normalization = true; return Deserialize(xmlReader); } diff --git a/mcs/class/System.XML/System.Xml.XPath/ChangeLog b/mcs/class/System.XML/System.Xml.XPath/ChangeLog index cc6687cd08e..a98346ff044 100644 --- a/mcs/class/System.XML/System.Xml.XPath/ChangeLog +++ b/mcs/class/System.XML/System.Xml.XPath/ChangeLog @@ -1,3 +1,15 @@ +2004-10-14 Atsushi Enomoto <atsushi@ximian.com> + + * Iterator.cs : + - Added WrapperIterator to return BaseIterator in such case that + variable reference is resolved to XPathNodeIterator. This fixes + bug #68267. + - Path ".." is reverse axis (actually no effect). + - Fixed DescendantIterator.Clone() that missed "_finished" field. + * Expression.cs : + In ExprVariable.Evaluate(), use WrapperIterator() for custom + XPathNodeIterator. + 2004-06-18 Atsushi Enomoto <atsushi@ximian.com> * DefaultContext.cs : Globalization. diff --git a/mcs/class/System.XML/System.Xml.XPath/Expression.cs b/mcs/class/System.XML/System.Xml.XPath/Expression.cs index 802a8c3006b..d959cd4146e 100644 --- a/mcs/class/System.XML/System.Xml.XPath/Expression.cs +++ b/mcs/class/System.XML/System.Xml.XPath/Expression.cs @@ -1443,7 +1443,7 @@ namespace System.Xml.XPath object objResult = var.Evaluate (context); XPathNodeIterator iterResult = objResult as XPathNodeIterator; if (iterResult != null) - return iterResult.Clone (); + return new WrapperIterator (iterResult.Clone (), iter.NamespaceManager); return objResult; } } diff --git a/mcs/class/System.XML/System.Xml.XPath/Iterator.cs b/mcs/class/System.XML/System.Xml.XPath/Iterator.cs index 6494e7c0b87..5884c5156a4 100644 --- a/mcs/class/System.XML/System.Xml.XPath/Iterator.cs +++ b/mcs/class/System.XML/System.Xml.XPath/Iterator.cs @@ -84,6 +84,39 @@ namespace System.Xml.XPath } } + internal class WrapperIterator : BaseIterator + { + XPathNodeIterator iter; + + public WrapperIterator (XPathNodeIterator iter, XmlNamespaceManager nsm) + : base (nsm) + { + this.iter = iter; + } + + public override XPathNodeIterator Clone () + { + return new WrapperIterator (iter.Clone (), NamespaceManager); + } + + public override bool MoveNext () + { + return iter.MoveNext (); + } + + public override XPathNavigator Current { + get { return iter.Current; } + } + + public override int CurrentPosition { + get { return iter.CurrentPosition; } + } + + public override bool RequireSorting { + get { return true; } + } + } + internal abstract class SimpleIterator : BaseIterator { protected readonly BaseIterator _iter; @@ -191,6 +224,8 @@ namespace System.Xml.XPath return false; } + public override bool ReverseAxis { get { return true; } } + public override bool RequireSorting { get { return true; } } } @@ -479,6 +514,7 @@ namespace System.Xml.XPath protected DescendantIterator (DescendantIterator other) : base (other) { _depth = other._depth; + _finished = other._finished; _current = other._current.Clone (); } diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog index 04516da68e3..eec144fe8b8 100644 --- a/mcs/class/System.XML/System.Xml/ChangeLog +++ b/mcs/class/System.XML/System.Xml/ChangeLog @@ -1,3 +1,74 @@ +2004-10-18 Atsushi Enomoto <atsushi@ximian.com> + + * XmlTextReader.cs : + Normalization check is also required for ReadText(). This fixes + bug #68449. + +2004-10-15 Atsushi Enomoto <atsushi@ximian.com> + + * XmlTextReader.cs : Inside DTD, '<' character inside XML comment + is regatded as invalid. This fixes bug #68410. (Error message was + also not correct.) + +2004-09-06 Atsushi Enomoto <atsushi@ximian.com> + + * XmlNode.cs : GetEnumerator() does not have to create ChildNodes + every time. Removed unused StringBuilder field. + +2004-09-06 Atsushi Enomoto <atsushi@ximian.com> + + * XmlWriter.cs : on reader.NodeType is None, WriteNode() still tries + to read more (and might result in an error). + +2004-09-03 Atsushi Enomoto <atsushi@ximian.com> + + * XmlTextReader.cs : When Normalization is true, CRLF and CR should + be converted to single LF. This should fix part of bug #62076. + +2004-08-27 Atsushi Enomoto <atsushi@ximian.com> + + * XmlAttribute.cs : some property getters threw NullReferenceException + when the attribute is not added to an element. + * XmlNode.cs : When a node is not appended to another node, BaseURI + is empty. Bug #64120 is fixed. + +2004-08-26 Atsushi Enomoto <atsushi@ximian.com> + + * XmlTextWriter.cs : In CheckState(), don't create indentation string + at every time. WriteIndent() now handles the indentation without + recomputation. + +2004-08-21 Atsushi Enomoto <atsushi@ximian.com> + + * XmlElement.cs : set_InnerText was removing children incompletely. + This fixes bug #63574. + +2004-08-20 Atsushi Enomoto <atsushi@ximian.com> + + ResetState() now throws InvalidOperationException() as MS.NET does. + +2004-08-20 Atsushi Enomoto <atsushi@ximian.com> + + * XmlTextReader.cs : Fixed EOF not to return true when it is just + closed. Element and EndElement location is now adjusted to be the + same as MS.NET does. This fixes bug #63505 and #63507. + +2004-07-28 Lluis Sanchez Gual <lluis@novell.com> + + * XmlTextReader.cs: Stop parsing when a null character is found. + +2004-07-20 Atsushi Enomoto <atsushi@ximian.com> + + * XmlNode.cs : When the argument node being inserted is the existing + document element, it should not result in an error (since it should + be first removed from document, thus no error should happen). + +2004-07-16 Atsushi Enomoto <atsushi@ximian.com> + + * XmlTextReader.cs : Fixed several problems on ReadBase64(); + Whitespaces should be ignored, and '=' was not skipped correctly. + It caused "unexpected end of document" error at immediate close tag. + 2004-06-18 Atsushi Enomoto <atsushi@ximian.com> * DTDObjectModel.cs, DTDReader.cs, XmlConvert.cs, XmlDocument.cs, diff --git a/mcs/class/System.XML/System.Xml/XmlAttribute.cs b/mcs/class/System.XML/System.Xml/XmlAttribute.cs index f5bfcc958a0..d02dee88e5c 100644 --- a/mcs/class/System.XML/System.Xml/XmlAttribute.cs +++ b/mcs/class/System.XML/System.Xml/XmlAttribute.cs @@ -104,9 +104,7 @@ namespace System.Xml #region Properties public override string BaseURI { - get { - return OwnerElement.BaseURI; - } + get { return OwnerElement != null ? OwnerElement.BaseURI : String.Empty; } } public override string InnerText { @@ -175,9 +173,7 @@ namespace System.Xml } public virtual XmlElement OwnerElement { - get { - return ownerElement; - } + get { return ownerElement; } } public override XmlNode ParentNode { @@ -248,11 +244,11 @@ namespace System.Xml } internal override string XmlLang { - get { return OwnerElement.XmlLang; } + get { return OwnerElement != null ? OwnerElement.XmlLang : String.Empty; } } internal override XmlSpace XmlSpace { - get { return OwnerElement.XmlSpace; } + get { return OwnerElement != null ? OwnerElement.XmlSpace : XmlSpace.None; } } #endregion @@ -298,6 +294,9 @@ namespace System.Xml internal DTDAttributeDefinition GetAttributeDefinition () { + if (OwnerElement == null) + return null; + // If it is default, then directly create new attribute. DTDAttListDeclaration attList = OwnerDocument.DocumentType != null ? OwnerDocument.DocumentType.DTD.AttListDecls [OwnerElement.Name] : null; return attList != null ? attList [Name] : null; diff --git a/mcs/class/System.XML/System.Xml/XmlElement.cs b/mcs/class/System.XML/System.Xml/XmlElement.cs index a74d801671c..f506853124d 100644 --- a/mcs/class/System.XML/System.Xml/XmlElement.cs +++ b/mcs/class/System.XML/System.Xml/XmlElement.cs @@ -115,13 +115,11 @@ namespace System.Xml } set { // Why its behavior (of MS FCL) is different from InnerXml...? - if (FirstChild != null && FirstChild.NodeType == XmlNodeType.Text) + if (ChildNodes != null && ChildNodes.Count == 1 && FirstChild.NodeType == XmlNodeType.Text) FirstChild.Value = value; else { - if (FirstChild != null) { - for (int i = 0; i < ChildNodes.Count; i++) - this.RemoveChild (ChildNodes [i]); - } + while (FirstChild != null) + this.RemoveChild (FirstChild); // creates new Text node AppendChild (OwnerDocument.CreateTextNode (value)); } diff --git a/mcs/class/System.XML/System.Xml/XmlNode.cs b/mcs/class/System.XML/System.Xml/XmlNode.cs index 52c6b21c794..d58654685b6 100644 --- a/mcs/class/System.XML/System.Xml/XmlNode.cs +++ b/mcs/class/System.XML/System.Xml/XmlNode.cs @@ -45,7 +45,6 @@ namespace System.Xml XmlDocument ownerDocument; XmlNode parentNode; - StringBuilder tmpBuilder; XmlLinkedNode lastLinkedChild; XmlNodeListChildren childNodes; bool isReadOnly; @@ -71,7 +70,7 @@ namespace System.Xml get { // Isn't it conformant to W3C XML Base Recommendation? // As far as I tested, there are not... - return (ParentNode != null) ? ParentNode.BaseURI : OwnerDocument.BaseURI; + return (ParentNode != null) ? ParentNode.BaseURI : String.Empty; } } @@ -295,7 +294,7 @@ namespace System.Xml public IEnumerator GetEnumerator () { - return new XmlNodeListChildren (this).GetEnumerator (); + return ChildNodes.GetEnumerator (); } public virtual string GetNamespaceOfPrefix (string prefix) @@ -524,7 +523,7 @@ namespace System.Xml throw new ArgumentException ("The reference node is not a child of this node."); } - if(this == ownerDoc && ownerDoc.DocumentElement != null && (newChild is XmlElement)) + if(this == ownerDoc && ownerDoc.DocumentElement != null && (newChild is XmlElement) && newChild != ownerDoc.DocumentElement) throw new XmlException ("multiple document element not allowed."); // checking validity finished. then appending... diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader.cs b/mcs/class/System.XML/System.Xml/XmlTextReader.cs index ea3b4e9cd51..c3ae95c72fd 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextReader.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextReader.cs @@ -176,14 +176,8 @@ namespace System.Xml } #endif - public override bool EOF - { - get - { - return - readState == ReadState.EndOfFile || - readState == ReadState.Closed; - } + public override bool EOF { + get { return readState == ReadState.EndOfFile; } } #if NET_2_0 @@ -531,6 +525,14 @@ namespace System.Xml return false; } + private int SkipIgnorableBase64Chars (char [] chars, int charsLength, int i) + { + while (chars [i] == '=' || XmlChar.IsWhitespace (chars [i])) + if (charsLength == ++i) + break; + return i; + } + public int ReadBase64 (byte [] buffer, int offset, int length) { if (offset < 0) @@ -567,7 +569,9 @@ namespace System.Xml byte b = 0; byte work = 0; - for (int i = 0; i < charsLength - 3; i += 4) { + for (int i = 0; i < charsLength - 3; i++) { + if ((i = SkipIgnorableBase64Chars (chars, charsLength, i)) == charsLength) + break; b = (byte) (GetBase64Byte (chars [i]) << 2); if (bufIndex < bufLast) buffer [bufIndex] = b; @@ -577,9 +581,11 @@ namespace System.Xml base64Cache [0] = b; } // charsLength mod 4 might not equals to 0. - if (i + 1 == charsLength) + if (++i == charsLength) + break; + if ((i = SkipIgnorableBase64Chars (chars, charsLength, i)) == charsLength) break; - b = GetBase64Byte (chars [i + 1]); + b = GetBase64Byte (chars [i]); work = (byte) (b >> 4); if (bufIndex < bufLast) { buffer [bufIndex] += work; @@ -598,9 +604,11 @@ namespace System.Xml base64Cache [1] = work; } - if (i + 2 == charsLength) + if (++i == charsLength) break; - b = GetBase64Byte (chars [i + 2]); + if ((i = SkipIgnorableBase64Chars (chars, charsLength, i)) == charsLength) + break; + b = GetBase64Byte (chars [i]); work = (byte) (b >> 2); if (bufIndex < bufLast) { buffer [bufIndex] += work; @@ -617,9 +625,11 @@ namespace System.Xml base64CacheStartsAt = 2; base64Cache [2] = work; } - if (i + 3 == charsLength) + if (++i == charsLength) + break; + if ((i = SkipIgnorableBase64Chars (chars, charsLength, i)) == charsLength) break; - work = GetBase64Byte (chars [i + 3]); + work = GetBase64Byte (chars [i]); if (bufIndex < bufLast) { buffer [bufIndex] += work; bufIndex++; @@ -672,7 +682,7 @@ namespace System.Xml public void ResetState () { - Init (); + throw new InvalidOperationException ("Cannot call ResetState when parsing an XML fragment."); } public override void ResolveEntity () @@ -1130,8 +1140,11 @@ namespace System.Xml return -1; return PeekChar (); } - else - return peekChars [peekCharsIndex]; + else { + char c = peekChars [peekCharsIndex]; + if (c != 0) return c; + else return -1; + } } private int ReadChar () @@ -1148,6 +1161,8 @@ namespace System.Xml if (ch == '\n') { line++; column = 1; + } else if (ch == 0) { + return -1; } else { column++; } @@ -1283,6 +1298,9 @@ namespace System.Xml "Multiple document element was detected."); currentState = XmlNodeType.Element; + currentLinkedNodeLineNumber = line; + currentLinkedNodeLinePosition = column; + parserContext.NamespaceManager.PushScope (); string name = ReadName (); @@ -1385,6 +1403,9 @@ namespace System.Xml throw new XmlException (this as IXmlLineInfo, "End tag cannot appear in this state."); + currentLinkedNodeLineNumber = line; + currentLinkedNodeLinePosition = column; + string name = ReadName (); if (elementNameStackPos == 0) throw new XmlException (this as IXmlLineInfo,"closing element without matching opening element"); @@ -1527,9 +1548,15 @@ namespace System.Xml ch = ReadReference (false); if (returnEntityReference) // Returns -1 if char validation should not be done break; - } - else { - if (XmlChar.IsInvalid (ch)) + } else if (normalization && ch == '\r') { + ReadChar (); + ch = ReadChar (); + if (ch != '\n') + // append '\n' instead of '\r'. + AppendValueChar ('\n'); + // and in case of "\r\n", discard '\r'. + } else { + if (normalization && XmlChar.IsInvalid (ch)) throw new XmlException (this, "Not allowed character was found."); ch = ReadChar (); } @@ -2121,8 +2148,18 @@ namespace System.Xml skip = true; } } - if (normalization && XmlChar.IsInvalid (ch)) - throw new XmlException (this, "Invalid character was found."); + if (normalization) { + if (ch == '\r') { + ch = PeekChar (); + if (ch != '\n') + // append '\n' instead of '\r'. + AppendValueChar ('\n'); + // otherwise, discard '\r'. + continue; + } + else if (XmlChar.IsInvalid (ch)) + throw new XmlException (this, "Invalid character was found."); + } AppendValueChar (ch); } @@ -2312,10 +2349,14 @@ namespace System.Xml case -1: throw new XmlException (this as IXmlLineInfo,"unexpected end of file at DTD."); case '<': - if (State == DtdInputState.InsideDoubleQuoted || - State == DtdInputState.InsideSingleQuoted) + switch (State) { + case DtdInputState.InsideDoubleQuoted: + case DtdInputState.InsideSingleQuoted: + case DtdInputState.Comment: continue; // well-formed - switch (ReadChar ()) { + } + int c = ReadChar (); + switch (c) { case '?': stateStack.Push (DtdInputState.PI); break; @@ -2350,7 +2391,7 @@ namespace System.Xml } break; default: - throw new XmlException (this as IXmlLineInfo,"unexpected '>'."); + throw new XmlException (this as IXmlLineInfo, String.Format ("unexpected '<{0}'.", (char) c)); } break; case '\'': @@ -2377,9 +2418,7 @@ namespace System.Xml stateStack.Pop (); break; case DtdInputState.InsideDoubleQuoted: - continue; case DtdInputState.InsideSingleQuoted: - continue; // well-formed case DtdInputState.Comment: continue; default: @@ -2548,6 +2587,8 @@ namespace System.Xml return; } + // Since ReadBase64() is processed for every 4 chars, it does + // not handle '=' here. private byte GetBase64Byte (char ch) { switch (ch) { @@ -2555,8 +2596,6 @@ namespace System.Xml return 62; case '/': return 63; - case '=': - return 0; default: if (ch >= 'A' && ch <= 'Z') return (byte) (ch - 'A'); @@ -2577,8 +2616,6 @@ namespace System.Xml return 0; } - shouldSkipUntilEndTag = true; - if (offset < 0) throw new ArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer."); else if (length < 0) @@ -2589,6 +2626,8 @@ namespace System.Xml if (NodeType != XmlNodeType.Element) return 0; + shouldSkipUntilEndTag = true; + int bufIndex = offset; for (int i = 0; i < length; i++) { int c = PeekChar (); @@ -2607,9 +2646,9 @@ namespace System.Xml depth++; depthUp = false; } - ReadEndTag(); + ReadEndTag (); shouldSkipUntilEndTag = false; - Read (); + Read (); // move to the next node return i; default: ReadChar (); diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs index af19e18dc6b..8e10329bf68 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs @@ -277,13 +277,9 @@ openElements [openElementCount - 1]).IndentingOverriden; } if ((documentStarted == true) && (formatting == Formatting.Indented) && (!IndentingOverriden)) { indentFormatting = w.NewLine; - if (indentLevel > 0) { - for (int i = 0; i < indentLevel; i++) - indentFormatting += indentChars; - } } else - indentFormatting = ""; + indentFormatting = null; documentStarted = true; } @@ -341,9 +337,7 @@ openElements [openElementCount - 1]).IndentingOverriden; private void UpdateIndentChars () { - indentChars = ""; - for (int i = 0; i < indentation; i++) - indentChars += indentChar; + indentChars = new string (indentChar, indentation); } public override void WriteBase64 (byte[] buffer, int index, int count) @@ -535,6 +529,15 @@ openElements [openElementCount - 1]).IndentingOverriden; WriteEndElementInternal (false); } + private void WriteIndent () + { + if (indentFormatting == null) + return; + w.Write (w.NewLine); + for (int i = 0; i < indentLevel; i++) + w.Write (indentChars); + } + private void WriteEndElementInternal (bool fullEndElement) { if (openElementCount == 0) @@ -553,7 +556,7 @@ openElements [openElementCount - 1]).IndentingOverriden; if (fullEndElement) { w.Write ('>'); if (!ParentIndentingOverriden) - w.Write (indentFormatting); + WriteIndent (); w.Write ("</"); XmlTextWriterOpenElement el = (XmlTextWriterOpenElement) openElements [openElementCount - 1]; if (el.Prefix != String.Empty) { @@ -568,7 +571,7 @@ openElements [openElementCount - 1]).IndentingOverriden; openElementCount--; openStartElement = false; } else { - w.Write (indentFormatting); + WriteIndent (); w.Write ("</"); XmlTextWriterOpenElement el = (XmlTextWriterOpenElement) openElements [openElementCount - 1]; openElementCount--; @@ -626,7 +629,7 @@ openElements [openElementCount - 1]).IndentingOverriden; CheckState (); CloseStartElement (); - w.Write (indentFormatting); + WriteIndent (); w.Write ("<?"); w.Write (name); w.Write (' '); @@ -834,7 +837,7 @@ openElements [openElementCount - 1]).IndentingOverriden; if (prefix == null) prefix = String.Empty; - w.Write (indentFormatting); + WriteIndent (); w.Write ('<'); if (prefix != String.Empty) { w.Write (prefix); diff --git a/mcs/class/System.XML/System.Xml/XmlWriter.cs b/mcs/class/System.XML/System.Xml/XmlWriter.cs index 4f69abaf378..7e4fb8d6b28 100644 --- a/mcs/class/System.XML/System.Xml/XmlWriter.cs +++ b/mcs/class/System.XML/System.Xml/XmlWriter.cs @@ -273,7 +273,7 @@ namespace System.Xml case XmlNodeType.EndEntity: break; case XmlNodeType.None: - return; // Do nothing, nor reporting errors. + break; // Do nothing, nor reporting errors. default: throw new XmlException ("Unexpected node " + reader.Name + " of type " + reader.NodeType); } diff --git a/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs b/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs index a09a812bedc..edc8da68872 100644 --- a/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs +++ b/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs @@ -97,7 +97,7 @@ namespace Mono.CSharp StringCollection assemblies = options.ReferencedAssemblies; foreach (CodeCompileUnit e in ea) { - fileNames [i] = GetTempFileNameWithExtension (options.TempFiles, "cs"); + fileNames [i] = GetTempFileNameWithExtension (options.TempFiles, i.ToString () + ".cs"); FileStream f=new FileStream(fileNames[i],FileMode.OpenOrCreate); StreamWriter s=new StreamWriter(f, Encoding.UTF8); if (e.ReferencedAssemblies != null) { @@ -183,7 +183,7 @@ namespace Mono.CSharp string[] fileNames=new string[sources.Length]; int i=0; foreach (string source in sources) { - fileNames [i] = GetTempFileNameWithExtension (options.TempFiles, "cs"); + fileNames [i] = GetTempFileNameWithExtension (options.TempFiles, i.ToString () + ".cs"); FileStream f=new FileStream(fileNames[i],FileMode.OpenOrCreate); StreamWriter s=new StreamWriter(f); s.Write(source); diff --git a/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs b/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs index 4be6da4cf77..c22c8fc653d 100644 --- a/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs +++ b/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs @@ -503,7 +503,10 @@ namespace Mono.CSharp OutputMemberAccessModifier( attributes ); OutputFieldScopeModifier( attributes ); - OutputTypeNamePair( field.Type, GetSafeName (field.Name) ); + if (IsCurrentEnum) + Output.Write(field.Name); + else + OutputTypeNamePair( field.Type, GetSafeName (field.Name) ); CodeExpression initExpression = field.InitExpression; if ( initExpression != null ) { diff --git a/mcs/class/System/Microsoft.CSharp/ChangeLog b/mcs/class/System/Microsoft.CSharp/ChangeLog index b9e06652430..6fbed3e9cc0 100644 --- a/mcs/class/System/Microsoft.CSharp/ChangeLog +++ b/mcs/class/System/Microsoft.CSharp/ChangeLog @@ -1,3 +1,13 @@ +2004-07-13 Peter Williams <peter@newton.cx> + + * CSharpCodeCompiler.cs (CompileAssemblyFromDomBatch): Include + counter in the extension so that batch compilations work. + (CompileAssemblyFromSourceBatch): Same. + +2004-07-12 Fawad Halim <fawad@fawad.net> + + * CSharpCodeGenerator.cs : Have GenerateField generate field sans the type for enums. + 2004-06-28 Atsushi Enomoto <atsushi@ximian.com> * CSharpCodeCompiler.cs : (only for windows) First check mcs.bat, then diff --git a/mcs/class/System/System.CodeDom.Compiler/ChangeLog b/mcs/class/System/System.CodeDom.Compiler/ChangeLog index a91f5c6b3f9..a2f6ee391a4 100755 --- a/mcs/class/System/System.CodeDom.Compiler/ChangeLog +++ b/mcs/class/System/System.CodeDom.Compiler/ChangeLog @@ -1,3 +1,14 @@ +2004-08-09 Atsushi Enomoto <atsushi@ximian.com> + + * CodeGenerator.cs : + Don't initialize output more than once. TextWriter is wrapped twice. + +2004-07-15 Peter Williams <peter@newton.cx> + + * CodeGenerator.cs: Have the basic generator create line pragmas + for NamespaceImports, SnippetCompileUnits, and TypeMembers, all of + which had LinePragma members which were going unused. + 2004-06-17 Jackson Harper <jackson@ximian.com> * CompilerError.cs: diff --git a/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs b/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs index 7d42931b6d1..b3f563211bb 100755 --- a/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs +++ b/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs @@ -392,9 +392,16 @@ namespace System.CodeDom.Compiler { GenerateNamespaceStart (ns); - foreach (CodeNamespaceImport import in ns.Imports) + foreach (CodeNamespaceImport import in ns.Imports) { + if (import.LinePragma != null) + GenerateLinePragmaStart (import.LinePragma); + GenerateNamespaceImport (import); + if (import.LinePragma != null) + GenerateLinePragmaEnd (import.LinePragma); + } + output.WriteLine(); foreach (CodeTypeDeclaration type in ns.Types) { @@ -410,8 +417,15 @@ namespace System.CodeDom.Compiler { protected abstract void GenerateNamespaceImport (CodeNamespaceImport i); protected void GenerateNamespaceImports (CodeNamespace e) { - foreach (CodeNamespaceImport import in e.Imports) + foreach (CodeNamespaceImport import in e.Imports) { + if (import.LinePragma != null) + GenerateLinePragmaStart (import.LinePragma); + GenerateNamespaceImport (import); + + if (import.LinePragma != null) + GenerateLinePragmaEnd (import.LinePragma); + } } protected void GenerateNamespaces (CodeCompileUnit e) @@ -472,7 +486,14 @@ namespace System.CodeDom.Compiler { protected virtual void GenerateSnippetCompileUnit (CodeSnippetCompileUnit e) { + if (e.LinePragma != null) + GenerateLinePragmaStart (e.LinePragma); + output.WriteLine (e.Value); + + if (e.LinePragma != null) + GenerateLinePragmaEnd (e.LinePragma); + } protected abstract void GenerateSnippetExpression (CodeSnippetExpression e); @@ -969,11 +990,17 @@ namespace System.CodeDom.Compiler { private void GenerateType (CodeTypeDeclaration type) { + if (type.LinePragma != null) + GenerateLinePragmaStart (type.LinePragma); + CodeTypeDelegate del = type as CodeTypeDelegate; if (del != null) GenerateDelegate (del); else GenerateNonDelegateType (type); + + if (type.LinePragma != null) + GenerateLinePragmaEnd (type.LinePragma); } private void GenerateDelegate (CodeTypeDelegate type) @@ -981,8 +1008,6 @@ namespace System.CodeDom.Compiler { CodeTypeDeclaration prevType = this.currentType; this.currentType = type; - InitOutput (output, options); - foreach (CodeCommentStatement statement in type.Comments) GenerateCommentStatement (statement); @@ -999,8 +1024,6 @@ namespace System.CodeDom.Compiler { CodeTypeDeclaration prevType = this.currentType; this.currentType = type; - InitOutput (output, options); - foreach (CodeCommentStatement statement in type.Comments) GenerateCommentStatement (statement); @@ -1024,12 +1047,18 @@ namespace System.CodeDom.Compiler { CodeTypeMember prevMember = this.currentMember; this.currentMember = member; + if (prevMember != null && prevMember.LinePragma != null) + GenerateLinePragmaEnd (prevMember.LinePragma); + if (options.BlankLinesBetweenMembers) output.WriteLine (); foreach (CodeCommentStatement statement in member.Comments) GenerateCommentStatement (statement); + if (member.LinePragma != null) + GenerateLinePragmaStart (member.LinePragma); + CodeMemberEvent eventm = member as CodeMemberEvent; if (eventm != null) { @@ -1087,6 +1116,9 @@ namespace System.CodeDom.Compiler { this.currentMember = prevMember; } + + if (currentMember != null && currentMember.LinePragma != null) + GenerateLinePragmaEnd (currentMember.LinePragma); GenerateTypeEnd (type); this.currentType = prevType; diff --git a/mcs/class/System/System.CodeDom/ChangeLog b/mcs/class/System/System.CodeDom/ChangeLog index 2c818373f8c..4db765c3319 100644 --- a/mcs/class/System/System.CodeDom/ChangeLog +++ b/mcs/class/System/System.CodeDom/ChangeLog @@ -1,3 +1,8 @@ +2004-08-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * CodeEntryPointMethod.cs: patch by Fawad Halim that makes the entry + point method public. + 2004-02-04 Jackson Harper <jackson@ximian.com> * CodeTypeMember.cs: Name is String.Empty if not set. diff --git a/mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs b/mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs index 4b3b477eb7e..5a46d2a2a08 100644 --- a/mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs +++ b/mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs @@ -38,5 +38,9 @@ namespace System.CodeDom public class CodeEntryPointMethod : CodeMemberMethod { + public CodeEntryPointMethod () + { + Attributes = MemberAttributes.Public | MemberAttributes.Static; + } } } diff --git a/mcs/class/System/System.ComponentModel/AttributeCollection.cs b/mcs/class/System/System.ComponentModel/AttributeCollection.cs index 2c5c6d840e0..1221270f082 100644 --- a/mcs/class/System/System.ComponentModel/AttributeCollection.cs +++ b/mcs/class/System/System.ComponentModel/AttributeCollection.cs @@ -138,7 +138,7 @@ namespace System.ComponentModel get { Attribute attr = null; foreach (Attribute a in attrList) { - if (a.GetType () == type){ + if (type.IsAssignableFrom (a.GetType ())) { attr = a; break; } diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog index 290fc659e98..13a43c1d05a 100644 --- a/mcs/class/System/System.ComponentModel/ChangeLog +++ b/mcs/class/System/System.ComponentModel/ChangeLog @@ -1,3 +1,8 @@ +2004-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AttributeCollection.cs: support attributes inherited from the one + we want. Fixes bug #67088. Thanks to Sander Rijken. + 2004-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TypeDescriptor.cs: when a component in componentTable is Disposed, diff --git a/mcs/class/System/System.Diagnostics/ChangeLog b/mcs/class/System/System.Diagnostics/ChangeLog index 392c500d5fc..7496fda092e 100644 --- a/mcs/class/System/System.Diagnostics/ChangeLog +++ b/mcs/class/System/System.Diagnostics/ChangeLog @@ -1,3 +1,17 @@ +2004-09-07 Dick Porter <dick@ximian.com> + + * Process.cs: Throw documented exceptions when getting stdin, + stdout or stderr and they haven't been redirected. Check that + CreatePipe didn't fail, throw exceptions if it did. Close + redirected streams when the process is disposed, rather than rely + on the GC disposing them later. Makes timeline much happier, + because it could run out of file descriptors between GC + collections. + +2004-09-06 Dick Porter <dick@ximian.com> + + * Process.cs: Make Dispose() actually dispose things. + 2004-06-24 Atsushi Enomoto <atsushi@ximian.com> * Process.cs : quick fix for UseShellExecute=false on windows. See diff --git a/mcs/class/System/System.Diagnostics/Process.cs b/mcs/class/System/System.Diagnostics/Process.cs index 66e22f14b75..e46ab5b0730 100755 --- a/mcs/class/System/System.Diagnostics/Process.cs +++ b/mcs/class/System/System.Diagnostics/Process.cs @@ -50,6 +50,11 @@ namespace System.Diagnostics { private struct ProcInfo { public IntPtr process_handle; + /* If thread_handle is ever needed for + * something, take out the CloseHandle() in + * the Start_internal icall in + * mono/metadata/process.c + */ public IntPtr thread_handle; public int pid; // Contains -GetLastError () on failure. public int tid; @@ -455,6 +460,10 @@ namespace System.Diagnostics { [MonitoringDescription ("The standard error stream of this process.")] public StreamReader StandardError { get { + if (error_stream == null) { + throw new InvalidOperationException("Standard error has not been redirected"); + } + return(error_stream); } } @@ -465,6 +474,10 @@ namespace System.Diagnostics { [MonitoringDescription ("The standard input stream of this process.")] public StreamWriter StandardInput { get { + if (input_stream == null) { + throw new InvalidOperationException("Standard input has not been redirected"); + } + return(input_stream); } } @@ -475,6 +488,10 @@ namespace System.Diagnostics { [MonitoringDescription ("The standard output stream of this process.")] public StreamReader StandardOutput { get { + if (output_stream == null) { + throw new InvalidOperationException("Standard output has not been redirected"); + } + return(output_stream); } } @@ -734,6 +751,9 @@ namespace System.Diagnostics { if(startInfo.RedirectStandardInput==true) { ret=MonoIO.CreatePipe(out stdin_rd, out stdin_wr); + if (ret == false) { + throw new IOException("Error creating standard input pipe"); + } } else { stdin_rd=MonoIO.ConsoleInput; /* This is required to stop the @@ -746,6 +766,9 @@ namespace System.Diagnostics { if(startInfo.RedirectStandardOutput==true) { ret=MonoIO.CreatePipe(out stdout_rd, out stdout_wr); + if (ret == false) { + throw new IOException("Error creating standard output pipe"); + } } else { stdout_rd=(IntPtr)0; stdout_wr=MonoIO.ConsoleOutput; @@ -754,6 +777,9 @@ namespace System.Diagnostics { if(startInfo.RedirectStandardError==true) { ret=MonoIO.CreatePipe(out stderr_rd, out stderr_wr); + if (ret == false) { + throw new IOException("Error creating standard error pipe"); + } } else { stderr_rd=(IntPtr)0; stderr_wr=MonoIO.ConsoleError; @@ -901,7 +927,7 @@ namespace System.Diagnostics { protected override void Dispose(bool disposing) { // Check to see if Dispose has already been called. - if(this.disposed) { + if(this.disposed == false) { this.disposed=true; // If this is a call to Dispose, // dispose all managed resources. @@ -917,6 +943,21 @@ namespace System.Diagnostics { Process_free_internal(process_handle); process_handle=IntPtr.Zero; } + + if (input_stream != null) { + input_stream.Close(); + input_stream = null; + } + + if (output_stream != null) { + output_stream.Close(); + output_stream = null; + } + + if (error_stream != null) { + error_stream.Close(); + error_stream = null; + } } } base.Dispose (disposing); diff --git a/mcs/class/System/System.IO/ChangeLog b/mcs/class/System/System.IO/ChangeLog index 085d366180a..014914f20ca 100755 --- a/mcs/class/System/System.IO/ChangeLog +++ b/mcs/class/System/System.IO/ChangeLog @@ -1,3 +1,24 @@ +2004-10-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * DefaultWatcher.cs: if the file is removed between reading the + directory and filling the file info, catch the exception and ignore the + file. Fixes bug #59482. + +2004-10-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * DefaultWatcher.cs: don't use Directory.GetFileSystemEntries when the + pattern has no wildcards. Fixes bug #67447. + +2004-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * FAMWatcher.cs: s/fam/libfam.so.0/ so that g_module finds it even + when the development package is not installed. + +2004-08-06 Geoff Norton <gnorton@customerdna.com> + + * FileSystemWatcher.cs: Use the new KeventWatcher if its supported + * KeventWatcher.cs: Added to cvs + 2004-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com> * DefaultWatcher.cs: fixed subdirectories notifications and don't diff --git a/mcs/class/System/System.IO/DefaultWatcher.cs b/mcs/class/System/System.IO/DefaultWatcher.cs index 36d6d939f4e..b68149c4ca3 100644 --- a/mcs/class/System/System.IO/DefaultWatcher.cs +++ b/mcs/class/System/System.IO/DefaultWatcher.cs @@ -37,9 +37,10 @@ namespace System.IO { class DefaultWatcherData { public FileSystemWatcher FSW; public string Directory; - public string FileMask; + public string FileMask; // If NoWildcards, contains the full path to the file. public bool IncludeSubdirs; public bool Enabled; + public bool NoWildcards; public DateTime DisabledTime; public Hashtable Files; } @@ -100,7 +101,12 @@ namespace System.IO { data.FSW = fsw; data.Directory = fsw.FullPath; - data.FileMask = fsw.MangledFilter; + data.NoWildcards = !fsw.Pattern.HasWildcard; + if (data.NoWildcards) + data.FileMask = Path.Combine (data.Directory, fsw.MangledFilter); + else + data.FileMask = fsw.MangledFilter; + data.IncludeSubdirs = fsw.IncludeSubdirectories; data.Enabled = true; data.DisabledTime = DateTime.MaxValue; @@ -185,6 +191,7 @@ namespace System.IO { } } + static string [] NoStringsArray = new string [0]; void DoFiles (DefaultWatcherData data, string directory, bool dispatch) { bool direxists = Directory.Exists (directory); @@ -194,10 +201,16 @@ namespace System.IO { } string [] files = null; - if (direxists) { + if (!direxists) { + files = NoStringsArray; + } else if (!data.NoWildcards) { files = Directory.GetFileSystemEntries (directory, data.FileMask); } else { - files = new string [0]; + // The pattern does not have wildcards + if (File.Exists (data.FileMask)) + files = new string [] { data.FileMask }; + else + files = NoStringsArray; } /* Set all as untested */ @@ -211,7 +224,14 @@ namespace System.IO { foreach (string filename in files) { FileData fd = (FileData) data.Files [filename]; if (fd == null) { - data.Files.Add (filename, CreateFileData (directory, filename)); + try { + data.Files.Add (filename, CreateFileData (directory, filename)); + } catch { + // The file might have been removed in the meanwhile + data.Files.Remove (filename); + continue; + } + if (dispatch) DispatchEvents (data.FSW, FileAction.Added, filename); } else if (fd.Directory == directory) { diff --git a/mcs/class/System/System.IO/FAMWatcher.cs b/mcs/class/System/System.IO/FAMWatcher.cs index 21e9bfeaff6..146411b8e91 100644 --- a/mcs/class/System/System.IO/FAMWatcher.cs +++ b/mcs/class/System/System.IO/FAMWatcher.cs @@ -320,24 +320,24 @@ namespace System.IO { } } - [DllImport ("fam")] + [DllImport ("libfam.so.0")] extern static int FAMOpen (out FAMConnection fc); - [DllImport ("fam")] + [DllImport ("libfam.so.0")] extern static int FAMClose (ref FAMConnection fc); - [DllImport ("fam")] + [DllImport ("libfam.so.0")] extern static int FAMMonitorDirectory (ref FAMConnection fc, string filename, out FAMRequest fr, IntPtr user_data); - [DllImport ("fam")] + [DllImport ("libfam.so.0")] extern static int FAMCancelMonitor (ref FAMConnection fc, ref FAMRequest fr); [MethodImplAttribute(MethodImplOptions.InternalCall)] extern static int InternalFAMNextEvent (ref FAMConnection fc, out string filename, out int code, out int reqnum); - [DllImport ("fam")] + [DllImport ("libfam.so.0")] extern static int FAMPending (ref FAMConnection fc); } } diff --git a/mcs/class/System/System.IO/KeventWatcher.cs b/mcs/class/System/System.IO/KeventWatcher.cs new file mode 100644 index 00000000000..56eab5a1eef --- /dev/null +++ b/mcs/class/System/System.IO/KeventWatcher.cs @@ -0,0 +1,351 @@ +// +// System.IO.KeventWatcher.cs: interface with osx kevent +// +// Authors: +// Geoff Norton (gnorton@customerdna.com) +// +// (c) 2004 Geoff Norton + +// +// 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.Collections; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; + +namespace System.IO { + + struct kevent { + public int ident; + public short filter; + public ushort flags; + public uint fflags; + public int data; + public string udata; + } + + struct timespec { + public int tv_sec; + public int tv_usec; + } + + class KeventFileData { + public FileSystemInfo fsi; + public DateTime LastAccessTime; + public DateTime LastWriteTime; + + public KeventFileData(FileSystemInfo fsi, DateTime LastAccessTime, DateTime LastWriteTime) { + this.fsi = fsi; + this.LastAccessTime = LastAccessTime; + this.LastWriteTime = LastWriteTime; + } + } + + class KeventData { + public FileSystemWatcher FSW; + public string Directory; + public string FileMask; + public bool IncludeSubdirs; + public bool Enabled; + public Hashtable DirEntries; + public kevent ev; + } + + class KeventWatcher : IFileWatcher + { + static bool failed; + static KeventWatcher instance; + static Hashtable watches; + static Hashtable requests; + static Thread thread; + static int conn; + static bool stop; + + private KeventWatcher () + { + } + + public static bool GetInstance (out IFileWatcher watcher) + { + lock (typeof (KeventWatcher)) { + if (failed == true) { + watcher = null; + return false; + } + + if (instance != null) { + watcher = instance; + return true; + } + + watches = Hashtable.Synchronized (new Hashtable ()); + requests = Hashtable.Synchronized (new Hashtable ()); + conn = kqueue(); + if (conn == -1) { + failed = true; + watcher = null; + return false; + } + + instance = new KeventWatcher (); + watcher = instance; + return true; + } + } + + public void StartDispatching (FileSystemWatcher fsw) + { + KeventData data; + lock (this) { + if (thread == null) { + thread = new Thread (new ThreadStart (Monitor)); + thread.IsBackground = true; + thread.Start (); + } + + data = (KeventData) watches [fsw]; + } + + if (data == null) { + data = new KeventData (); + data.FSW = fsw; + data.Directory = fsw.FullPath; + data.FileMask = fsw.MangledFilter; + data.IncludeSubdirs = fsw.IncludeSubdirectories; + + data.Enabled = true; + lock (this) { + StartMonitoringDirectory (data); + watches [fsw] = data; + stop = false; + } + } + } + + static void StartMonitoringDirectory (KeventData data) + { + DirectoryInfo dir = new DirectoryInfo (data.Directory); + if(data.DirEntries == null) { + data.DirEntries = new Hashtable(); + foreach (FileSystemInfo fsi in dir.GetFileSystemInfos() ) + data.DirEntries.Add(fsi.FullName, new KeventFileData(fsi, fsi.LastAccessTime, fsi.LastWriteTime)); + } + + int fd = open(data.Directory, 0, 0); + kevent ev = new kevent(); + timespec nullts = new timespec(); + nullts.tv_sec = 0; + nullts.tv_usec = 0; + if (fd > 0) { + ev.ident = fd; + ev.filter = -4; + ev.flags = 1 | 4 | 20; + ev.fflags = 20 | 2 | 1 | 8; + ev.data = 0; + ev.udata = data.Directory; + kevent outev = new kevent(); + outev.udata = ""; + kevent (conn, ref ev, 1, ref outev, 0, ref nullts); + data.ev = ev; + requests [fd] = data; + } + + if (!data.IncludeSubdirs) + return; + + } + + public void StopDispatching (FileSystemWatcher fsw) + { + KeventData data; + lock (this) { + data = (KeventData) watches [fsw]; + if (data == null) + return; + + StopMonitoringDirectory (data); + watches.Remove (fsw); + if (watches.Count == 0) + stop = true; + + if (!data.IncludeSubdirs) + return; + + } + } + + static void StopMonitoringDirectory (KeventData data) + { + close(data.ev.ident); + } + + void Monitor () + { + + while (!stop) { + kevent ev = new kevent(); + ev.udata = ""; + kevent nullev = new kevent(); + nullev.udata = ""; + timespec ts = new timespec(); + ts.tv_sec = 0; + ts.tv_usec = 0; + int haveEvents; + lock (this) { + haveEvents = kevent (conn, ref nullev, 0, ref ev, 1, ref ts); + } + + if (haveEvents > 0) { + // Restart monitoring + KeventData data = (KeventData) requests [ev.ident]; + StartMonitoringDirectory(data); + ProcessEvent (ev); + } else { + System.Threading.Thread.Sleep (500); + } + } + + lock (this) { + thread = null; + stop = false; + } + } + + void ProcessEvent (kevent ev) + { + lock (this) { + KeventData data = (KeventData) requests [ev.ident]; + if (!data.Enabled) + return; + + FileSystemWatcher fsw; + string filename = ""; + + fsw = data.FSW; + FileAction fa = 0; + DirectoryInfo dir = new DirectoryInfo (data.Directory); + FileSystemInfo changedFsi = null; + + try { + foreach (FileSystemInfo fsi in dir.GetFileSystemInfos() ) + if (data.DirEntries.ContainsKey (fsi.FullName) && (fsi is FileInfo)) { + KeventFileData entry = (KeventFileData) data.DirEntries [fsi.FullName]; + if ( (entry.LastWriteTime != fsi.LastWriteTime) || (entry.LastAccessTime != fsi.LastAccessTime) ) { + filename = fsi.FullName; + fa = FileAction.Modified; + data.DirEntries [fsi.FullName] = new KeventFileData(fsi, fsi.LastAccessTime, fsi.LastWriteTime); + if (fsw.IncludeSubdirectories && fsi is DirectoryInfo) { + data.Directory = filename; + requests [ev.ident] = data; + ProcessEvent(ev); + } + PostEvent(filename, fsw, fa, changedFsi); + } + } + } catch (Exception) { + // The file system infos were changed while we processed them + } + // Deleted + try { + bool deleteMatched = true; + while(deleteMatched) { + foreach (KeventFileData entry in data.DirEntries.Values) { + if (!File.Exists (entry.fsi.FullName) && !Directory.Exists (entry.fsi.FullName)) { + filename = entry.fsi.FullName; + fa = FileAction.Removed; + data.DirEntries.Remove (entry.fsi.FullName); + PostEvent(filename, fsw, fa, changedFsi); + break; + } + } + deleteMatched = false; + } + } catch (Exception) { + // The file system infos were changed while we processed them + } + // Added + try { + foreach (FileSystemInfo fsi in dir.GetFileSystemInfos()) + if (!data.DirEntries.ContainsKey (fsi.FullName)) { + changedFsi = fsi; + filename = fsi.FullName; + fa = FileAction.Added; + data.DirEntries [fsi.FullName] = new KeventFileData(fsi, fsi.LastAccessTime, fsi.LastWriteTime); + PostEvent(filename, fsw, fa, changedFsi); + } + } catch (Exception) { + // The file system infos were changed while we processed them + } + + + } + } + + private void PostEvent (string filename, FileSystemWatcher fsw, FileAction fa, FileSystemInfo changedFsi) { + RenamedEventArgs renamed = null; + if (fa == 0) + return; + + if (fsw.IncludeSubdirectories && fa == FileAction.Added) { + if (changedFsi is DirectoryInfo) { + KeventData newdirdata = new KeventData (); + newdirdata.FSW = fsw; + newdirdata.Directory = changedFsi.FullName; + newdirdata.FileMask = fsw.MangledFilter; + newdirdata.IncludeSubdirs = fsw.IncludeSubdirectories; + + newdirdata.Enabled = true; + lock (this) { + StartMonitoringDirectory (newdirdata); + } + } + } + + if (!fsw.Pattern.IsMatch(filename)) + return; + + lock (fsw) { + fsw.DispatchEvents (fa, filename, ref renamed); + if (fsw.Waiting) { + fsw.Waiting = false; + System.Threading.Monitor.PulseAll (fsw); + } + } + } + + [DllImport ("libc")] + extern static int open(string path, int flags, int mode_t); + + [DllImport ("libc")] + extern static int close(int fd); + + [DllImport ("libc")] + extern static int kqueue(); + + [DllImport ("libc")] + extern static int kevent(int kqueue, ref kevent ev, int nchanges, ref kevent evtlist, int nevents, ref timespec ts); + } +} + diff --git a/mcs/class/System/System.Net.Sockets/ChangeLog b/mcs/class/System/System.Net.Sockets/ChangeLog index 3b7aeaf5da9..3760b959630 100644 --- a/mcs/class/System/System.Net.Sockets/ChangeLog +++ b/mcs/class/System/System.Net.Sockets/ChangeLog @@ -1,3 +1,34 @@ +2004-10-14 Dick Porter <dick@ximian.com> + + * Socket.cs (Sockets ): Set Accept()ed socket blocking status to + be the same as the listening socket. This follows MS behaviour. + +2004-08-04 Dick Porter <dick@ximian.com> + + * Socket.cs: Update Connected state in Select and Poll; this is + when we find out that non-blocking Connects succeed. Fixes bug + 62398. + +2004-07-28 Dick Porter <dick@ximian.com> + + * Socket.cs: ReceiveFrom might not return a valid EndPoint. Patch + by Nick Vaughan (dev@6wardlaw.freeserve.co.uk), fixes bug 61608. + +2004-07-15 Dick Porter <dick@ximian.com> + + * Socket.cs: Don't try and dereference a null array in Select() + (possible if a descriptor list of length 0 was passed.) Patch by + Nick Vaughan (dev@6wardlaw.freeserve.co.uk), fixes bug 61595. + +2004-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Socket.cs: if'ed RemoveReferences calls. + +2004-07-09 Dick Porter <dick@ximian.com> + + * Socket.cs: Slight tweak to allow unknown objects to be returned + by GetSocketOption(). + 2004-06-28 Gonzalo Paniagua Javier <gonzalo@ximian.com> * Socket.cs: connect on non-blocking sockets returns EINPROGRESS. Fixes diff --git a/mcs/class/System/System.Net.Sockets/Socket.cs b/mcs/class/System/System.Net.Sockets/Socket.cs index a7fa184ccae..78151c928d6 100644 --- a/mcs/class/System/System.Net.Sockets/Socket.cs +++ b/mcs/class/System/System.Net.Sockets/Socket.cs @@ -422,24 +422,39 @@ namespace System.Net.Sockets throw new SocketException (error); } + /* Make sure the connected state is updated + * for each socket returned from the select; + * for non blocking Connect()s, this is when + * we find out that the connect succeeded. + */ + if(read_list!=null) { read_list.Clear(); - for(i=0; i<read_arr.Length; i++) { - read_list.Add(read_arr[i]); + if (read_arr != null) { + for(i=0; i<read_arr.Length; i++) { + read_list.Add(read_arr[i]); + read_arr[i].connected = true; + } } } if(write_list!=null) { write_list.Clear(); - for(i=0; i<write_arr.Length; i++) { - write_list.Add(write_arr[i]); + if (write_arr != null) { + for(i=0; i<write_arr.Length; i++) { + write_list.Add(write_arr[i]); + write_arr[i].connected = true; + } } } if(err_list!=null) { err_list.Clear(); - for(i=0; i<err_arr.Length; i++) { - err_list.Add(err_arr[i]); + if (err_arr != null) { + for(i=0; i<err_arr.Length; i++) { + err_list.Add(err_arr[i]); + err_arr[i].connected = true; + } } } } @@ -724,8 +739,16 @@ namespace System.Net.Sockets throw new SocketException (error); } - return(new Socket(this.AddressFamily, this.SocketType, - this.ProtocolType, sock)); + Socket accepted = new Socket(this.AddressFamily, + this.SocketType, + this.ProtocolType, sock); + + // The MS runtime (really the OS, we suspect) + // sets newly accepted sockets to have the + // same Blocking status as the listening + // socket + accepted.Blocking = this.Blocking; + return(accepted); } public IAsyncResult BeginAccept(AsyncCallback callback, @@ -1020,7 +1043,9 @@ namespace System.Net.Sockets if (req == null) throw new ArgumentException ("Invalid IAsyncResult", "result"); - RemoveReference (req); + if (supportsAsync && socket_type == SocketType.Stream) + RemoveReference (req); + if (!result.IsCompleted) result.AsyncWaitHandle.WaitOne(); @@ -1063,7 +1088,9 @@ namespace System.Net.Sockets if (req == null) throw new ArgumentException ("Invalid IAsyncResult", "result"); - RemoveReference (req); + if (supportsAsync && socket_type == SocketType.Stream) + RemoveReference (req); + if (!result.IsCompleted) result.AsyncWaitHandle.WaitOne(); @@ -1131,8 +1158,10 @@ namespace System.Net.Sockets } else if (name==SocketOptionName.AddMembership || name==SocketOptionName.DropMembership) { return((MulticastOption)obj_val); - } else { + } else if (obj_val is int) { return((int)obj_val); + } else { + return(obj_val); } } @@ -1224,6 +1253,15 @@ namespace System.Net.Sockets if (error != 0) throw new SocketException (error); + if (result == true) { + /* Update the connected state; for + * non-blocking Connect()s this is + * when we can find out that the + * connect succeeded. + */ + connected = true; + } + return result; } @@ -1372,10 +1410,17 @@ namespace System.Net.Sockets } connected = true; + + // If sockaddr is null then we're a connection + // oriented protocol and should ignore the + // remote_end parameter (see MSDN + // documentation for Socket.ReceiveFrom(...) ) - // Stupidly, EndPoint.Create() is an - // instance method - remote_end = remote_end.Create (sockaddr); + if ( sockaddr != null ) { + // Stupidly, EndPoint.Create() is an + // instance method + remote_end = remote_end.Create (sockaddr); + } return cnt; } diff --git a/mcs/class/System/System.Net/ChangeLog b/mcs/class/System/System.Net/ChangeLog index 2b470e6423b..c6955062812 100644 --- a/mcs/class/System/System.Net/ChangeLog +++ b/mcs/class/System/System.Net/ChangeLog @@ -1,3 +1,105 @@ +2004-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpWebRequest.cs: don't fail if the request has already been sent + when accessing ContentType setter. Fixes bug #68848. + +2004-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * ChunkStream.cs: + (WantMore): we're not done until we get a 0 chunk size and the trailer. + The 0 can be expressed as more than one character too (ie, 000000). + + * HttpWebRequest.cs: new argument in SetResponseError. + * WebConnection.cs: added argument to HandleError as a hint for + debugging. + (Connect): make the chunked stream be in the expected state when + reusing. + + * WebConnectionStream.cs: removed unused method (ResetWriteBuffer). + +2004-10-11 David Sheldon <dave-mono@earth.li> + + * HttpWebRequest.cs: Use RemoveAndAdd for AddRange. Fixes unittest. + +2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpWebRequest.cs: ProxyQuery returns true when we use a proxy without + tunneling a secure connection. + + * ServicePoint.cs: added UseConnect property. + + * ServicePointManager.cs: set the UseConnect property when we use a http + proxy for a https connection. + + * WebConnection.cs: setup the tunnled connection when using a proxy and + https. + +2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpWebRequest.cs: ProxyQuery returns true when we use a proxy without + tunneling a secure connection. + + * ServicePoint.cs: added UseConnect property. + + * ServicePointManager.cs: set the UseConnect property when we use a http + proxy for a https connection. + + * WebConnection.cs: setup the tunnled connection when using a proxy and + https. + +2004-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpWebResponse.cs: remove unused SplitValue method. + +2004-08-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Cookie.cs: don't fail when using default constructor. Fixes bug + #62890. + +2004-08-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpWebResponse.cs: set-cookie and set-cookie2 can be present more + than once and have multiple values. Don't rely on string.split when + parsing cookie values. + + * WebHeaderCollection.cs: same thing for set-cookie and set-cookie2. + Fixed GetValues (it was splitting values that contained a comma) and + changed SetInternal to handle multi-value headers. + + Fixes bug #62744. + +2004-07-26 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * WebProxy.cs: fix scheme detection. Patch by Konstantin Triger + (kostat@mainsoft.com). + +2004-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpWebRequest.cs: detect changes in scheme or port when redirecting. + Fixes las take on bug 61218. + +2004-07-14 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * WebConnection.cs: moved loading of the ssl stream Type to its own + method. Don't create a new ssl stream if we're reusing the connection. + + * WebConnectionStream.cs: ensure the number of bytes copied in ReadAll + is the expected even if the dta from the server has extra bytes. + +2004-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * WebConnection.cs: + * WebConnectionStream.cs: when the status code is 1xx, 204 or 304, + "responses MUST NOT include a message-body". We tried to read the + stream even when getting those codes and considered the 0 length + read as a failure. + +2004-07-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpWebRequest.cs: removed bogus Monitor.Exit. + * WebConnection.cs: use Address instead of RequestUri when checking for + the scheme in order to select the stream type. Fixes bug #61218. + 2004-06-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> * ChunkStream.cs: added ChunkLeft property. diff --git a/mcs/class/System/System.Net/ChunkStream.cs b/mcs/class/System/System.Net/ChunkStream.cs index 16d2b291f25..49f2a97983c 100644 --- a/mcs/class/System/System.Net/ChunkStream.cs +++ b/mcs/class/System/System.Net/ChunkStream.cs @@ -167,7 +167,7 @@ namespace System.Net } public bool WantMore { - get { return (chunkRead != chunkSize || chunkSize != 0); } + get { return (chunkRead != chunkSize || chunkSize != 0 || (chunkSize == 0 && state != State.None)); } } public int ChunkLeft { diff --git a/mcs/class/System/System.Net/Cookie.cs b/mcs/class/System/System.Net/Cookie.cs index c0235be1f1e..30ee979fef1 100644 --- a/mcs/class/System/System.Net/Cookie.cs +++ b/mcs/class/System/System.Net/Cookie.cs @@ -57,24 +57,23 @@ namespace System.Net { private static char [] reservedCharsValue = new char [] {';', ','};
private static char [] portSeparators = new char [] {'"', ','};
private static string tspecials = "()<>@,;:\\\"/[]?={} \t"; // from RFC 2965, 2068
-
- public Cookie ()
- : this (String.Empty, String.Empty) {}
-
- public Cookie (string name, string value)
- {
- Name = name;
- Value = value;
-
- discard = false;
- expired = false;
- secure = false;
- expires = DateTime.MinValue;
- timestamp = DateTime.Now;
- version = 0;
- domain = "";
- }
-
+ + public Cookie () + { + expires = DateTime.MinValue; + timestamp = DateTime.Now; + domain = ""; + name = ""; + val = ""; + } + + public Cookie (string name, string value) + : this () + { + Name = name; + Value = value; + } + public Cookie (string name, string value, string path)
: this (name, value)
{
diff --git a/mcs/class/System/System.Net/HttpWebRequest.cs b/mcs/class/System/System.Net/HttpWebRequest.cs index 40dfe26a546..b2f67dfcf99 100644 --- a/mcs/class/System/System.Net/HttpWebRequest.cs +++ b/mcs/class/System/System.Net/HttpWebRequest.cs @@ -147,7 +147,7 @@ namespace System.Net get { return webHeaders ["Accept"]; } set { CheckRequestStarted (); - webHeaders.SetInternal ("Accept", value); + webHeaders.RemoveAndAdd ("Accept", value); } } @@ -199,7 +199,7 @@ namespace System.Net if (keepAlive && val.IndexOf ("keep-alive") == -1) value = value + ", Keep-Alive"; - webHeaders.SetInternal ("Connection", value); + webHeaders.RemoveAndAdd ("Connection", value); } } @@ -226,12 +226,11 @@ namespace System.Net public override string ContentType { get { return webHeaders ["Content-Type"]; } set { - CheckRequestStarted (); if (value == null || value.Trim().Length == 0) { webHeaders.RemoveInternal ("Content-Type"); return; } - webHeaders.SetInternal ("Content-Type", value); + webHeaders.RemoveAndAdd ("Content-Type", value); } } @@ -266,7 +265,7 @@ namespace System.Net if (val == "100-continue") throw new ArgumentException ("100-Continue cannot be set with this property.", "value"); - webHeaders.SetInternal ("Expect", value); + webHeaders.RemoveAndAdd ("Expect", value); } } @@ -452,7 +451,7 @@ namespace System.Net if (!sendChunked) throw new ArgumentException ("SendChunked must be True", "value"); - webHeaders.SetInternal ("Transfer-Encoding", value); + webHeaders.RemoveAndAdd ("Transfer-Encoding", value); } } @@ -484,7 +483,7 @@ namespace System.Net } internal bool ProxyQuery { - get { return servicePoint.UsesProxy; } + get { return servicePoint.UsesProxy && !servicePoint.UseConnect; } } // Methods @@ -525,7 +524,7 @@ namespace System.Net value += ","; else throw new InvalidOperationException ("rangeSpecifier"); - webHeaders.SetInternal ("Range", value + range + "-"); + webHeaders.RemoveAndAdd ("Range", value + range + "-"); } public void AddRange (string rangeSpecifier, int from, int to) @@ -541,7 +540,7 @@ namespace System.Net value += ","; else throw new InvalidOperationException ("rangeSpecifier"); - webHeaders.SetInternal ("Range", value + from + "-" + to); + webHeaders.RemoveAndAdd ("Range", value + from + "-" + to); } public override int GetHashCode () @@ -584,7 +583,6 @@ namespace System.Net initialMethod = method; if (haveRequest) { if (writeStream != null) { - Monitor.Exit (this); asyncWrite.SetCompleted (true, writeStream); asyncWrite.DoCallback (); return asyncWrite; @@ -830,7 +828,7 @@ namespace System.Net throw new WebException ("No Location header found for " + (int) code, WebExceptionStatus.ProtocolError); - string host = actualUri.Host; + Uri prev = actualUri; try { actualUri = new Uri (actualUri, uriString); } catch (Exception) { @@ -839,7 +837,8 @@ namespace System.Net WebExceptionStatus.ProtocolError); } - hostChanged = (actualUri.Host != host); + hostChanged = (actualUri.Scheme != prev.Scheme || actualUri.Host != prev.Host || + actualUri.Port != prev.Port); return true; } @@ -852,13 +851,13 @@ namespace System.Net webHeaders.RemoveInternal ("Transfer-Encoding"); } else if (sendChunked) { continue100 = true; - webHeaders.SetInternal ("Transfer-Encoding", "chunked"); + webHeaders.RemoveAndAdd ("Transfer-Encoding", "chunked"); webHeaders.RemoveInternal ("Content-Length"); } if (actualVersion == HttpVersion.Version11 && continue100 && servicePoint.SendContinue) { // RFC2616 8.2.3 - webHeaders.SetInternal ("Expect" , "100-continue"); + webHeaders.RemoveAndAdd ("Expect" , "100-continue"); expectContinue = true; } else { webHeaders.RemoveInternal ("Expect"); @@ -871,9 +870,9 @@ namespace System.Net servicePoint.ProtocolVersion == HttpVersion.Version10); if (keepAlive && (version == HttpVersion.Version10 || spoint10)) { - webHeaders.SetInternal (connectionHeader, "keep-alive"); + webHeaders.RemoveAndAdd (connectionHeader, "keep-alive"); } else if (!keepAlive && version == HttpVersion.Version11) { - webHeaders.SetInternal (connectionHeader, "close"); + webHeaders.RemoveAndAdd (connectionHeader, "close"); } webHeaders.SetInternal ("Host", actualUri.Authority); @@ -883,9 +882,9 @@ namespace System.Net webHeaders.SetInternal ("Cookie", cookieHeader); } - if (!usedPreAuth && preAuthenticate) { + if (!usedPreAuth && preAuthenticate) DoPreAuthenticate (); - } + return webHeaders.ToString (); } @@ -981,14 +980,15 @@ namespace System.Net } } - internal void SetResponseError (WebExceptionStatus status, Exception e) + internal void SetResponseError (WebExceptionStatus status, Exception e, string where) { WebAsyncResult r = asyncRead; if (r == null) r = asyncWrite; if (r != null) { - WebException wexc = new WebException ("Error getting response stream: " + status, e, status, null); + string msg = String.Format ("Error getting response stream ({0}): {1}", where, status); + WebException wexc = new WebException (msg, e, status, null); r.SetCompleted (false, wexc); r.DoCallback (); asyncRead = null; diff --git a/mcs/class/System/System.Net/HttpWebResponse.cs b/mcs/class/System/System.Net/HttpWebResponse.cs index b38108a1597..459749e7c14 100644 --- a/mcs/class/System/System.Net/HttpWebResponse.cs +++ b/mcs/class/System/System.Net/HttpWebResponse.cs @@ -31,6 +31,7 @@ // using System; +using System.Globalization; using System.IO; using System.Net.Sockets; using System.Runtime.Serialization; @@ -315,88 +316,89 @@ namespace System.Net if (webHeaders == null) return; - string val = webHeaders ["Set-Cookie"]; - if (val != null && val.Trim () != "") - SetCookie (val); + string [] values = webHeaders.GetValues ("Set-Cookie"); + if (values != null) { + foreach (string va in values) + SetCookie (va); + } - val = webHeaders ["Set-Cookie2"]; - if (val != null && val.Trim () != "") - SetCookie2 (val); - } - - static string [] SplitValue (string input) - { - string [] result = new string [2]; - int eq = input.IndexOf ('='); - if (eq == -1) { - result [0] = "invalid"; - } else { - result [0] = input.Substring (0, eq).Trim ().ToUpper (); - result [1] = input.Substring (eq + 1); + values = webHeaders.GetValues ("Set-Cookie2"); + if (values != null) { + foreach (string va in values) + SetCookie2 (va); } - - return result; } - [MonoTODO ("Parse dates")] - void SetCookie (string cookie_str) + void SetCookie (string header) { - string[] parts = null; - Collections.Queue options = null; + string [] name_values = header.Trim ().Split (';'); + int length = name_values.Length; Cookie cookie = null; + int pos; + for (int i = 0; i < length; i++) { + pos = 0; + string name_value = name_values [i].Trim (); + string name = GetCookieName (name_value, name_value.Length, ref pos); + string value = GetCookieValue (name_value, name_value.Length, ref pos); + if (cookie == null) { + cookie = new Cookie (name, value); + continue; + } - options = new Collections.Queue (cookie_str.Split (';')); - parts = SplitValue ((string) options.Dequeue()); // NAME=VALUE must be first - - cookie = new Cookie (parts[0], parts[1]); - - while (options.Count > 0) { - parts = SplitValue ((string) options.Dequeue()); - switch (parts [0]) { - case "COMMENT": - if (cookie.Comment == null) - cookie.Comment = parts[1]; + name = name.ToUpper (); + switch (name) { + case "COMMENT": + if (cookie.Comment == null) + cookie.Comment = value; break; - case "COMMENTURL": - if (cookie.CommentUri == null) - cookie.CommentUri = new Uri(parts[1]); + case "COMMENTURL": + if (cookie.CommentUri == null) + cookie.CommentUri = new Uri (value); break; - case "DISCARD": - cookie.Discard = true; + case "DISCARD": + cookie.Discard = true; break; - case "DOMAIN": - if (cookie.Domain == "") - cookie.Domain = parts[1]; + case "DOMAIN": + if (cookie.Domain == "") + cookie.Domain = value; break; - case "MAX-AGE": // RFC Style Set-Cookie2 - if (cookie.Expires == DateTime.MinValue) - cookie.Expires = cookie.TimeStamp.AddSeconds (Int32.Parse (parts[1])); + case "MAX-AGE": // RFC Style Set-Cookie2 + if (cookie.Expires == DateTime.MinValue) + cookie.Expires = cookie.TimeStamp.AddSeconds (Int32.Parse (value)); break; - case "EXPIRES": // Netscape Style Set-Cookie - if (cookie.Expires == DateTime.MinValue) { - //FIXME: Does DateTime parse something like: "Sun, 17-Jan-2038 19:14:07 GMT"? - //cookie.Expires = DateTime.ParseExact (parts[1]); + case "EXPIRES": // Netscape Style Set-Cookie + if (cookie.Expires != DateTime.MinValue) + break; + try { + cookie.Expires = DateTime.ParseExact (value, "r", CultureInfo.InvariantCulture); + } catch { + try { + cookie.Expires = DateTime.ParseExact (value, + "ddd, dd'-'MMM'-'yyyy HH':'mm':'ss 'GMT'", + CultureInfo.InvariantCulture); + } catch { cookie.Expires = DateTime.Now.AddDays (1); } + } break; - case "PATH": - cookie.Path = parts[1]; + case "PATH": + cookie.Path = value; break; - case "PORT": - if (cookie.Port == null) - cookie.Port = parts[1]; + case "PORT": + if (cookie.Port == null) + cookie.Port = value; break; - case "SECURE": - cookie.Secure = true; + case "SECURE": + cookie.Secure = true; break; - case "VERSION": - cookie.Version = Int32.Parse (parts[1]); + case "VERSION": + cookie.Version = Int32.Parse (value); break; - } // switch - } // while + } + } if (cookieCollection == null) - cookieCollection = new CookieCollection(); + cookieCollection = new CookieCollection (); if (cookie.Domain == "") cookie.Domain = uri.Host; @@ -411,6 +413,40 @@ namespace System.Net foreach (string cookie_str in cookies) SetCookie (cookie_str); } + + static string GetCookieValue (string str, int length, ref int i) + { + if (i >= length) + return null; + + int k = i; + while (k < length && Char.IsWhiteSpace (str [k])) + k++; + + int begin = k; + while (k < length && str [k] != ';') + k++; + + i = k; + return str.Substring (begin, i - begin).Trim (); + } + + static string GetCookieName (string str, int length, ref int i) + { + if (i >= length) + return null; + + int k = i; + while (k < length && Char.IsWhiteSpace (str [k])) + k++; + + int begin = k; + while (k < length && str [k] != ';' && str [k] != '=') + k++; + + i = k + 1; + return str.Substring (begin, k - begin).Trim (); + } } } diff --git a/mcs/class/System/System.Net/ServicePoint.cs b/mcs/class/System/System.Net/ServicePoint.cs index a22ca44aefd..09a1f61d609 100644 --- a/mcs/class/System/System.Net/ServicePoint.cs +++ b/mcs/class/System/System.Net/ServicePoint.cs @@ -52,6 +52,7 @@ namespace System.Net bool usesProxy; Hashtable groups; bool sendContinue = true; + bool useConnect; #if NET_1_1 bool useNagle; #endif @@ -160,6 +161,11 @@ namespace System.Net set { usesProxy = value; } } + internal bool UseConnect { + get { return useConnect; } + set { useConnect = value; } + } + internal bool AvailableForRecycling { get { return CurrentConnections == 0 diff --git a/mcs/class/System/System.Net/ServicePointManager.cs b/mcs/class/System/System.Net/ServicePointManager.cs index ca176694532..06a7284777e 100644 --- a/mcs/class/System/System.Net/ServicePointManager.cs +++ b/mcs/class/System/System.Net/ServicePointManager.cs @@ -186,11 +186,16 @@ namespace System.Net RecycleServicePoints (); bool usesProxy = false; + bool useConnect = false; if (proxy != null && !proxy.IsBypassed(address)) { usesProxy = true; + bool isSecure = address.Scheme == "https"; address = proxy.GetProxy (address); - if (address.Scheme != "http" && address.Scheme != "https") + if (address.Scheme != "http" && !isSecure) throw new NotSupportedException ("Proxy scheme not supported."); + + if (isSecure && address.Scheme == "http") + useConnect = true; } address = new Uri (address.Scheme + "://" + address.Authority); @@ -212,6 +217,7 @@ namespace System.Net sp.UseNagleAlgorithm = useNagle; #endif sp.UsesProxy = usesProxy; + sp.UseConnect = useConnect; servicePoints.Add (address, sp); } diff --git a/mcs/class/System/System.Net/WebConnection.cs b/mcs/class/System/System.Net/WebConnection.cs index c4b08a363d1..44240239d6e 100644 --- a/mcs/class/System/System.Net/WebConnection.cs +++ b/mcs/class/System/System.Net/WebConnection.cs @@ -71,7 +71,7 @@ namespace System.Net bool ssl; bool certsAvailable; - static bool sslCheck; + static object classLock = new object (); static Type sslStream; static PropertyInfo piClient; static PropertyInfo piServer; @@ -89,10 +89,12 @@ namespace System.Net queue = group.Queue; } - public void Connect () + void Connect () { lock (this) { if (socket != null && socket.Connected && status == WebExceptionStatus.Success) { + // Take the chunked stream to the expected state (State.None) + while (chunkedRead && chunkStream.WantMore && Read (buffer, 0, buffer.Length) > 0); reused = true; return; } @@ -127,36 +129,119 @@ namespace System.Net } } + static void EnsureSSLStreamAvailable () + { + lock (classLock) { + if (sslStream != null) + return; + + // HttpsClientStream is an internal glue class in Mono.Security.dll + sslStream = Type.GetType ("Mono.Security.Protocol.Tls.HttpsClientStream, " + + Consts.AssemblyMono_Security, false); + + if (sslStream == null) { + string msg = "Missing Mono.Security.dll assembly. " + + "Support for SSL/TLS is unavailable."; + + throw new NotSupportedException (msg); + } + piClient = sslStream.GetProperty ("SelectedClientCertificate"); + piServer = sslStream.GetProperty ("ServerCertificate"); + } + } + + bool CreateTunnel (HttpWebRequest request, Stream stream, out byte [] buffer) + { + StringBuilder sb = new StringBuilder (); + sb.Append ("CONNECT "); + sb.Append (request.Address.Host); + sb.Append (':'); + sb.Append (request.Address.Port); + sb.Append (" HTTP/"); + if (request.ServicePoint.ProtocolVersion == HttpVersion.Version11) + sb.Append ("1.1"); + else + sb.Append ("1.0"); + + sb.Append ("\r\nHost: "); + sb.Append (request.Address.Authority); + if (request.Headers ["Proxy-Authorization"] != null) { + sb.Append ("\r\nProxy-Authorization: "); + sb.Append (request.Headers ["Proxy-Authorization"]); + } + + sb.Append ("\r\n\r\n"); + byte [] connectBytes = Encoding.Default.GetBytes (sb.ToString ()); + stream.Write (connectBytes, 0, connectBytes.Length); + return ReadHeaders (request, stream, out buffer); + } + + bool ReadHeaders (HttpWebRequest request, Stream stream, out byte [] retBuffer) + { + retBuffer = null; + + byte [] buffer = new byte [256]; + MemoryStream ms = new MemoryStream (); + bool gotStatus = false; + + while (true) { + int n = stream.Read (buffer, 0, 256); + ms.Write (buffer, 0, n); + int start = 0; + string str = null; + while (ReadLine (ms.GetBuffer (), ref start, (int) ms.Length, ref str)) { + if (str == null) { + if (ms.Length - start > 0) { + retBuffer = new byte [ms.Length - start]; + Buffer.BlockCopy (ms.GetBuffer (), start, retBuffer, 0, retBuffer.Length); + } + return true; + } + + if (gotStatus) + continue; + + int spaceidx = str.IndexOf (' '); + if (spaceidx == -1) + throw new Exception (); + + int resultCode = Int32.Parse (str.Substring (spaceidx + 1, 3)); + if (resultCode != 200) + throw new Exception (); + + gotStatus = true; + } + } + } + bool CreateStream (HttpWebRequest request) { try { NetworkStream serverStream = new NetworkStream (socket, false); - if (request.RequestUri.Scheme == Uri.UriSchemeHttps) { + if (request.Address.Scheme == Uri.UriSchemeHttps) { ssl = true; - if (!sslCheck) { - lock (typeof (WebConnection)) { - sslCheck = true; - // HttpsClientStream is an internal glue class in Mono.Security.dll - sslStream = Type.GetType ("Mono.Security.Protocol.Tls.HttpsClientStream, " + Consts.AssemblyMono_Security, false); - if (sslStream != null) { - piClient = sslStream.GetProperty ("SelectedClientCertificate"); - piServer = sslStream.GetProperty ("ServerCertificate"); - } + EnsureSSLStreamAvailable (); + if (!reused || nstream == null || nstream.GetType () != sslStream) { + byte [] buffer = null; + if (sPoint.UseConnect) { + bool ok = CreateTunnel (request, serverStream, out buffer); + if (!ok) + return false; } - } - if (sslStream == null) - throw new NotSupportedException ("Missing Mono.Security.dll assembly. Support for SSL/TLS is unavailable."); - - object[] args = new object [4] { serverStream, request.RequestUri.Host, request.ClientCertificates, request }; - nstream = (Stream) Activator.CreateInstance (sslStream, args); + object[] args = new object [4] { serverStream, + request.ClientCertificates, + request, buffer}; + nstream = (Stream) Activator.CreateInstance (sslStream, args); + } // we also need to set ServicePoint.Certificate // and ServicePoint.ClientCertificate but this can // only be done later (after handshake - which is // done only after a read operation). - } - else + } else { + ssl = false; nstream = serverStream; + } } catch (Exception) { status = WebExceptionStatus.ConnectFailure; return false; @@ -165,15 +250,13 @@ namespace System.Net return true; } - void HandleError (WebExceptionStatus st, Exception e) + void HandleError (WebExceptionStatus st, Exception e, string where) { status = st; lock (this) { busy = false; if (st == WebExceptionStatus.RequestCanceled) Data = new WebConnectionData (); - - status = st; } if (e == null) { // At least we now where it comes from @@ -185,7 +268,7 @@ namespace System.Net } if (Data != null && Data.request != null) - Data.request.SetResponseError (st, e); + Data.request.SetResponseError (st, e, where); Close (true); } @@ -204,19 +287,17 @@ namespace System.Net try { nread = ns.EndRead (result); } catch (Exception e) { - cnc.status = WebExceptionStatus.ReceiveFailure; - cnc.HandleError (cnc.status, e); + cnc.HandleError (WebExceptionStatus.ReceiveFailure, e, "ReadDone1"); return; } if (nread == 0) { - cnc.status = WebExceptionStatus.ReceiveFailure; - cnc.HandleError (cnc.status, null); + cnc.HandleError (WebExceptionStatus.ReceiveFailure, null, "ReadDone2"); return; } if (nread < 0) { - cnc.HandleError (WebExceptionStatus.ServerProtocolViolation, null); + cnc.HandleError (WebExceptionStatus.ServerProtocolViolation, null, "ReadDone3"); return; } @@ -232,7 +313,7 @@ namespace System.Net } if (exc != null) { - cnc.HandleError (WebExceptionStatus.ServerProtocolViolation, exc); + cnc.HandleError (WebExceptionStatus.ServerProtocolViolation, exc, "ReadDone4"); return; } } @@ -268,6 +349,9 @@ namespace System.Net data.stream = stream; + if (!ExpectContent (data.StatusCode)) + stream.ForceCompletion (); + lock (cnc) { lock (cnc.queue) { if (cnc.queue.Count > 0) { @@ -282,6 +366,11 @@ namespace System.Net data.request.SetResponseData (data); } + static bool ExpectContent (int statusCode) + { + return (statusCode >= 200 && statusCode != 204 && statusCode != 304); + } + internal void GetCertificates () { // here the SSL negotiation have been done @@ -300,7 +389,7 @@ namespace System.Net int size = cnc.buffer.Length - cnc.position; ns.BeginRead (cnc.buffer, cnc.position, size, readDoneDelegate, cnc); } catch (Exception e) { - cnc.HandleError (WebExceptionStatus.ReceiveFailure, e); + cnc.HandleError (WebExceptionStatus.ReceiveFailure, e, "InitRead"); } } @@ -533,6 +622,7 @@ namespace System.Net return true; } + internal IAsyncResult BeginRead (byte [] buffer, int offset, int size, AsyncCallback cb, object state) { if (nstream == null) @@ -623,8 +713,7 @@ namespace System.Net if (chunkedRead) chunkStream.WriteAndReadBack (buffer, offset, size, ref result); } catch (Exception e) { - status = WebExceptionStatus.ReceiveFailure; - HandleError (status, e); + HandleError (WebExceptionStatus.ReceiveFailure, e, "Read"); } return result; @@ -649,7 +738,7 @@ namespace System.Net { lock (this) { if (!reused) { - HandleError (WebExceptionStatus.SendFailure, null); + HandleError (WebExceptionStatus.SendFailure, null, "TryReconnect"); return false; } @@ -657,12 +746,12 @@ namespace System.Net reused = false; Connect (); if (status != WebExceptionStatus.Success) { - HandleError (WebExceptionStatus.SendFailure, null); + HandleError (WebExceptionStatus.SendFailure, null, "TryReconnect2"); return false; } if (!CreateStream (Data.request)) { - HandleError (WebExceptionStatus.SendFailure, null); + HandleError (WebExceptionStatus.SendFailure, null, "TryReconnect3"); return false; } } @@ -696,7 +785,7 @@ namespace System.Net void Abort (object sender, EventArgs args) { - HandleError (WebExceptionStatus.RequestCanceled, null); + HandleError (WebExceptionStatus.RequestCanceled, null, "Abort"); } internal bool Busy { diff --git a/mcs/class/System/System.Net/WebConnectionStream.cs b/mcs/class/System/System.Net/WebConnectionStream.cs index 703f35d42b4..8b083736148 100644 --- a/mcs/class/System/System.Net/WebConnectionStream.cs +++ b/mcs/class/System/System.Net/WebConnectionStream.cs @@ -57,6 +57,7 @@ namespace System.Net byte [] headers; bool disposed; bool headersSent; + bool forceCompletion; public WebConnectionStream (WebConnection cnc) { @@ -113,9 +114,15 @@ namespace System.Net get { return (int) writeBuffer.Length; } } + internal void ForceCompletion () + { + forceCompletion = true; + } + internal void CheckComplete () { - if (!nextReadCalled && readBufferSize - readBufferOffset == contentLength) { + bool nrc = nextReadCalled; + if (forceCompletion || (!nrc && readBufferSize - readBufferOffset == contentLength)) { nextReadCalled = true; cnc.NextRead (); } @@ -151,8 +158,12 @@ namespace System.Net } else { new_size = contentLength - totalRead; b = new byte [new_size]; - if (readBuffer != null && diff > 0) + if (readBuffer != null && diff > 0) { + if (diff > new_size) + diff = new_size; + Buffer.BlockCopy (readBuffer, readBufferOffset, b, 0, diff); + } int remaining = new_size - diff; int r = -1; @@ -460,16 +471,6 @@ namespace System.Net WriteRequest (); } - internal void ResetWriteBuffer () - { - if (!allowBuffering) - return; - - writeBuffer = new MemoryStream (); - requestWritten = false; - headersSent = false; - } - public override long Seek (long a, SeekOrigin b) { throw new NotSupportedException (); diff --git a/mcs/class/System/System.Net/WebHeaderCollection.cs b/mcs/class/System/System.Net/WebHeaderCollection.cs index e4ea21688c6..4d3c29db3cd 100644 --- a/mcs/class/System/System.Net/WebHeaderCollection.cs +++ b/mcs/class/System/System.Net/WebHeaderCollection.cs @@ -96,6 +96,10 @@ namespace System.Net multiValue.Add ("vary", true);
multiValue.Add ("via", true);
multiValue.Add ("warning", true);
+ + // Extra + multiValue.Add ("set-cookie", true);
+ multiValue.Add ("set-cookie2", true);
}
// Constructors
@@ -151,28 +155,19 @@ namespace System.Net throw new ArgumentException ("invalid header value: " + headerValue, "headerValue");
base.Add (headerName, headerValue);
}
-
- public override string [] GetValues (string header)
- {
- if (header == null)
- throw new ArgumentNullException ("header");
- string [] values = base.GetValues (header);
- if (values == null || values.Length == 0)
- return null;
- if (!IsMultiValue (header))
- return values;
- StringCollection col = new StringCollection ();
- for (int i = 0; i < values.Length; i++) {
- string [] s = values [i].Split (new char [] {','});
- for (int j = 0; j < s.Length; j++)
- s [j] = s [j].Trim ();
- col.AddRange (s);
- }
- values = new string [col.Count];
- col.CopyTo (values, 0);
- return values;
- }
-
+ + public override string [] GetValues (string header) + { + if (header == null) + throw new ArgumentNullException ("header"); + + string [] values = base.GetValues (header); + if (values == null || values.Length == 0) + return null; + + return values; + } + public static bool IsRestricted (string headerName)
{
if (headerName == null)
@@ -265,10 +260,25 @@ namespace System.Net if (!IsHeaderValue (value))
throw new ArgumentException ("invalid header value");
- base.Remove (name);
- base.Set (name, value);
+ if (IsMultiValue (name)) { + base.Add (name, value); + } else { + base.Remove (name);
+ base.Set (name, value);
+ } }
-
+ + internal void RemoveAndAdd (string name, string value) + { + if (value == null) + value = String.Empty; + else + value = value.Trim (); + + base.Remove (name); + base.Set (name, value); + } + internal void RemoveInternal (string name)
{
if (name == null)
diff --git a/mcs/class/System/System.Net/WebProxy.cs b/mcs/class/System/System.Net/WebProxy.cs index b0299575f60..df8976c6966 100644 --- a/mcs/class/System/System.Net/WebProxy.cs +++ b/mcs/class/System/System.Net/WebProxy.cs @@ -208,7 +208,7 @@ namespace System.Net if (address == null)
return null;
- if (address.IndexOf (':') == -1)
+ if (address.IndexOf ("://") == -1)
address = "http://" + address;
return new Uri (address);
diff --git a/mcs/class/System/System.Text.RegularExpressions/ChangeLog b/mcs/class/System/System.Text.RegularExpressions/ChangeLog index 1dc633af4f4..95ee772a930 100644 --- a/mcs/class/System/System.Text.RegularExpressions/ChangeLog +++ b/mcs/class/System/System.Text.RegularExpressions/ChangeLog @@ -1,3 +1,16 @@ +2004-10-21 Joerg Rosenkranz <joergr@voelcker.com>
+
+ * regex.cs: Fixed a bug introduced with the last patch which
+ prevented any replacements when a postive count is given.
+ This also happens in all overloads without count parameter. +
+2004-10-18 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * regex.cs: in Replace, when count is negative, replacement continues + to the end of the string. + + Fixes bug #68398. Patch by Jon Larimer. + 2004-06-10 Gert Driesen <drieseng@users.sourceforge.net> * RegexRunner.cs: fixed case mismatch of methods diff --git a/mcs/class/System/System.Text.RegularExpressions/regex.cs b/mcs/class/System/System.Text.RegularExpressions/regex.cs index d9523564ff5..25b10204240 100644 --- a/mcs/class/System/System.Text.RegularExpressions/regex.cs +++ b/mcs/class/System/System.Text.RegularExpressions/regex.cs @@ -354,9 +354,15 @@ namespace System.Text.RegularExpressions { {
StringBuilder result = new StringBuilder ();
int ptr = startat;
+ int counter = count; + + result.Append (input.Substring (0, ptr)); Match m = Match (input, startat);
- while (m.Success && count -- > 0) {
+ while (m.Success) {
+ if (count != -1) + if(counter -- <= 0) + break; result.Append (input.Substring (ptr, m.Index - ptr));
result.Append (evaluator (m));
diff --git a/mcs/class/System/Test/System.Net.Sockets/ChangeLog b/mcs/class/System/Test/System.Net.Sockets/ChangeLog index 977b0aded7b..a726ad1413f 100644 --- a/mcs/class/System/Test/System.Net.Sockets/ChangeLog +++ b/mcs/class/System/Test/System.Net.Sockets/ChangeLog @@ -1,3 +1,7 @@ +2004-10-14 Dick Porter <dick@ximian.com> + + * SocketTest.cs: Test the blocking status of accepted sockets + 2004-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> * SocketTest.cs: added test for Select with empty lists. Changed the diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs index e506f0688e5..32048e14014 100644 --- a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs @@ -43,6 +43,45 @@ namespace MonoTests.System.Net.Sockets Socket.Select (list, list, list, 1000); } + private bool BlockingConnect (bool block) + { + IPEndPoint ep = new IPEndPoint(IPAddress.Any, 1234); + Socket server = new Socket(AddressFamily.InterNetwork, + SocketType.Stream, + ProtocolType.Tcp); + server.Bind(ep); + server.Blocking=block; + + server.Listen(0); + + Socket conn = new Socket (AddressFamily.InterNetwork, + SocketType.Stream, + ProtocolType.Tcp); + conn.Connect (ep); + + Socket client = server.Accept(); + bool client_block = client.Blocking; + + client.Close(); + conn.Close(); + server.Close(); + + return(client_block); + } + + [Test] + public void AcceptBlockingStatus() + { + bool block; + + block = BlockingConnect(true); + Assertion.AssertEquals ("BlockingStatus01", + block, true); + + block = BlockingConnect(false); + Assertion.AssertEquals ("BlockingStatus02", + block, false); + } } } diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog b/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog index 1ca3f9f8a8c..902f7b572d0 100644 --- a/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog +++ b/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog @@ -1,3 +1,8 @@ +2004-10-18 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * System.Text.RegularExpressions/RegexBugs.cs: added test for bug + #68398. + 2004-06-06 Jambunathan K <kjambunathan@novell.com> * RegexTest.cs: diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs b/mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs index acd73dae1f1..26c8f2baf47 100644 --- a/mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs +++ b/mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs @@ -211,6 +211,15 @@ namespace MonoTests.System.Text.RegularExpressions text = re.Replace(text, " "); AssertEquals("#01", "Go, \bNo Go", text); } + + [Test] + public void ReplaceNegOneAndStartat () + { + string text = "abcdeeee"; + Regex re = new Regex("e+"); + text = re.Replace(text, "e", -1, 4); + AssertEquals("#01", "abcde", text); + } } } diff --git a/mcs/class/corlib/Mono.Math/BigInteger.cs b/mcs/class/corlib/Mono.Math/BigInteger.cs index 4535e1a6ef2..3da9e27471f 100644 --- a/mcs/class/corlib/Mono.Math/BigInteger.cs +++ b/mcs/class/corlib/Mono.Math/BigInteger.cs @@ -171,6 +171,7 @@ namespace Mono.Math { public BigInteger () { data = new uint [DEFAULT_LEN]; + this.length = DEFAULT_LEN; } #if !INSIDE_CORLIB @@ -559,6 +560,9 @@ namespace Mono.Math { /// <param name="rng">A RNG.</param> public void Randomize (RandomNumberGenerator rng) { + if (this == 0) + return; + int bits = this.BitCount (); int dwords = bits >> 5; int remBits = bits & 0x1F; diff --git a/mcs/class/corlib/Mono.Math/ChangeLog b/mcs/class/corlib/Mono.Math/ChangeLog index 23e02357ffb..f31519cfcda 100644 --- a/mcs/class/corlib/Mono.Math/ChangeLog +++ b/mcs/class/corlib/Mono.Math/ChangeLog @@ -1,3 +1,8 @@ +2004-10-25 Sebastien Pouliot <sebastien@ximian.com> + + * BigInteger.cs: Fix issue #68452 when Randomize was being called on a + 0 BigInteger (i.e. BitCount == 0). + 2004-05-14 Marek Safar <marek.safar@seznam.cz> * BigInteger.cs: Removed useless [CLSCompliant (false)] diff --git a/mcs/class/corlib/Mono.Security.Authenticode/AuthenticodeBase.cs b/mcs/class/corlib/Mono.Security.Authenticode/AuthenticodeBase.cs index 9e5923667b5..c2d609ecec2 100755 --- a/mcs/class/corlib/Mono.Security.Authenticode/AuthenticodeBase.cs +++ b/mcs/class/corlib/Mono.Security.Authenticode/AuthenticodeBase.cs @@ -5,10 +5,6 @@ // Sebastien Pouliot <sebastien@ximian.com> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// (C) 2004 Novell (http://www.novell.com) -// - -// // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining @@ -60,63 +56,167 @@ namespace Mono.Security.Authenticode { public const string spcIndirectDataContext = "1.3.6.1.4.1.311.2.1.4"; - internal byte[] rawData; + private byte[] fileblock; + private FileStream fs; + private int blockNo; + private int blockLength; + private int peOffset; + private int dirSecurityOffset; + private int dirSecuritySize; public AuthenticodeBase () { + fileblock = new byte [4096]; } - protected byte[] HashFile (string fileName, string hashName) + internal void Open (string filename) { - FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read, FileShare.Read); - byte[] file = new byte [fs.Length]; - fs.Read (file, 0, file.Length); - fs.Close (); + if (fs != null) + Close (); + fs = new FileStream (filename, FileMode.Open, FileAccess.Read, FileShare.Read); + } - // MZ - DOS header - if (BitConverterLE.ToUInt16 (file, 0) != 0x5A4D) - return null; + internal void Close () + { + if (fs != null) { + fs.Close (); + fs = null; + blockNo = 0; + } + } - // find offset of PE header - int peOffset = BitConverterLE.ToInt32 (file, 60); - if (peOffset > file.Length) - return null; + internal bool ReadFirstBlock () + { + if (fs == null) + return false; + + fs.Position = 0; + // read first block - it will include (100% sure) + // the MZ header and (99.9% sure) the PE header + blockLength = fs.Read (fileblock, 0, fileblock.Length); + blockNo = 1; + if (blockLength < 64) + return false; // invalid PE file + + // 1. Validate the MZ header informations + // 1.1. Check for magic MZ at start of header + if (BitConverterLE.ToUInt16 (fileblock, 0) != 0x5A4D) + return false; + + // 1.2. Find the offset of the PE header + peOffset = BitConverterLE.ToInt32 (fileblock, 60); + if (peOffset > fileblock.Length) { + // just in case (0.1%) this can actually happen + string msg = String.Format (Locale.GetText ( + "Header size too big (> {0} bytes)."), + fileblock.Length); + throw new NotSupportedException (msg); + } + if (peOffset > fs.Length) + return false; - // PE - NT header - if (BitConverterLE.ToUInt16 (file, peOffset) != 0x4550) - return null; + // 2. Read between DOS header and first part of PE header + // 2.1. Check for magic PE at start of header + if (BitConverterLE.ToUInt16 (fileblock, peOffset) != 0x4550) + return false; - // IMAGE_DIRECTORY_ENTRY_SECURITY - int dirSecurityOffset = BitConverterLE.ToInt32 (file, peOffset + 152); - int dirSecuritySize = BitConverterLE.ToInt32 (file, peOffset + 156); + // 2.2. Locate IMAGE_DIRECTORY_ENTRY_SECURITY (offset and size) + dirSecurityOffset = BitConverterLE.ToInt32 (fileblock, peOffset + 152); + dirSecuritySize = BitConverterLE.ToInt32 (fileblock, peOffset + 156); + + return true; + } + + internal byte[] GetSecurityEntry () + { + if (blockNo < 1) + ReadFirstBlock (); if (dirSecuritySize > 8) { - rawData = new byte [dirSecuritySize - 8]; - Buffer.BlockCopy (file, dirSecurityOffset + 8, rawData, 0, rawData.Length); -/* DEBUG - FileStream debug = new FileStream (fileName + ".sig", FileMode.Create, FileAccess.Write); - debug.Write (rawData, 0, rawData.Length); - debug.Close ();*/ + // remove header from size (not ASN.1 based) + byte[] secEntry = new byte [dirSecuritySize - 8]; + // position after header and read entry + fs.Position = dirSecurityOffset + 8; + fs.Read (secEntry, 0, secEntry.Length); + return secEntry; + } + return null; + } + + // returns null if the file isn't signed + internal byte[] GetHash (HashAlgorithm hash) + { + if (blockNo < 1) + ReadFirstBlock (); + fs.Position = blockLength; + + // hash the rest of the file + long n = fs.Length - blockLength; + // minus any authenticode signature (with 8 bytes header) + if (dirSecurityOffset > 0) { + // it is also possible that the signature block + // starts within the block in memory (small EXE) + if (dirSecurityOffset < blockLength) { + blockLength = dirSecurityOffset; + n = 0; + } + else + n -= (dirSecuritySize); } - else - rawData = null; - HashAlgorithm hash = HashAlgorithm.Create (hashName); - // 0 to 215 (216) then skip 4 (checksum) + // Authenticode(r) gymnastics + // Hash from (generally) 0 to 215 (216 bytes) int pe = peOffset + 88; - hash.TransformBlock (file, 0, pe, file, 0); + hash.TransformBlock (fileblock, 0, pe, fileblock, 0); + // then skip 4 for checksum pe += 4; - // 220 to 279 (60) then skip 8 (IMAGE_DIRECTORY_ENTRY_SECURITY) - hash.TransformBlock (file, pe, 60, file, pe); + // Continue hashing from (generally) 220 to 279 (60 bytes) + hash.TransformBlock (fileblock, pe, 60, fileblock, pe); + // then skip 8 bytes for IMAGE_DIRECTORY_ENTRY_SECURITY pe += 68; - // 288 to end of file - int n = file.Length - pe; - // minus any authenticode signature (with 8 bytes header) - if (dirSecurityOffset != 0) - n -= (dirSecuritySize); - hash.TransformFinalBlock (file, pe, n); + // everything is present so start the hashing + if (n == 0) { + // hash the (only) block + hash.TransformFinalBlock (fileblock, pe, blockLength - pe); + } + else { + // hash the last part of the first (already in memory) block + hash.TransformBlock (fileblock, pe, blockLength - pe, fileblock, 0); + + // hash by blocks of 4096 bytes + long blocks = (n >> 12); + int remainder = (int)(n - (blocks << 12)); + if (remainder == 0) { + blocks--; + remainder = 4096; + } + // blocks + while (blocks-- > 0) { + fs.Read (fileblock, 0, fileblock.Length); + hash.TransformBlock (fileblock, 0, fileblock.Length, fileblock, 0); + } + // remainder + if (fs.Read (fileblock, 0, remainder) != remainder) + return null; + hash.TransformFinalBlock (fileblock, 0, remainder); + } return hash.Hash; } + + // for compatibility only + protected byte[] HashFile (string fileName, string hashName) + { + try { + Open (fileName); + HashAlgorithm hash = HashAlgorithm.Create (hashName); + byte[] result = GetHash (hash); + Close (); + return result; + } + catch { + return null; + } + } } } diff --git a/mcs/class/corlib/Mono.Security.Authenticode/AuthenticodeDeformatter.cs b/mcs/class/corlib/Mono.Security.Authenticode/AuthenticodeDeformatter.cs index 803781954f7..ea0bd30e242 100755 --- a/mcs/class/corlib/Mono.Security.Authenticode/AuthenticodeDeformatter.cs +++ b/mcs/class/corlib/Mono.Security.Authenticode/AuthenticodeDeformatter.cs @@ -2,12 +2,9 @@ // AuthenticodeDeformatter.cs: Authenticode signature validator // // Author: -// Sebastien Pouliot (spouliot@motus.com) +// Sebastien Pouliot <sebastien@ximian.com> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -// // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining @@ -57,6 +54,9 @@ namespace Mono.Security.Authenticode { private DateTime timestamp; private X509Certificate signingCertificate; private int reason; + private bool trustedRoot; + private bool trustedTimestampRoot; + private byte[] entry; private X509Chain signerChain; private X509Chain timestampChain; @@ -70,17 +70,20 @@ namespace Mono.Security.Authenticode { public AuthenticodeDeformatter (string fileName) : this () { - if (!CheckSignature (fileName)) { - // invalid or no signature - if (signedHash != null) - throw new COMException ("Invalid signature"); - // no exception is thrown when there's no signature in the PE file - } + FileName = fileName; } public string FileName { get { return filename; } - set { CheckSignature (value); } + set { + Reset (); + try { + CheckSignature (value); + } + catch { + reason = 1; + } + } } public byte[] Hash { @@ -101,7 +104,7 @@ namespace Mono.Security.Authenticode { public bool IsTrusted () { - if (rawData == null) { + if (entry == null) { reason = 1; return false; } @@ -111,13 +114,13 @@ namespace Mono.Security.Authenticode { return false; } - if (signerChain.Root == null) { + if ((signerChain.Root == null) || !trustedRoot) { reason = 6; return false; } if (timestamp != DateTime.MinValue) { - if (timestampChain.Root == null) { + if ((timestampChain.Root == null) || !trustedTimestampRoot) { reason = 6; return false; } @@ -139,7 +142,11 @@ namespace Mono.Security.Authenticode { } public byte[] Signature { - get { return (byte[]) rawData.Clone (); } + get { + if (entry == null) + return null; + return (byte[]) entry.Clone (); + } } public DateTime Timestamp { @@ -157,43 +164,58 @@ namespace Mono.Security.Authenticode { private bool CheckSignature (string fileName) { filename = fileName; - - // by default we try with MD5 - string hashName = "MD5"; - // compare the signature's hash with the hash of the file - hash = HashFile (filename, hashName); - - // is a signature present ? - if (rawData == null) + base.Open (filename); + entry = base.GetSecurityEntry (); + if (entry == null) { + // no signature is present + reason = 1; + base.Close (); return false; + } - PKCS7.ContentInfo ci = new PKCS7.ContentInfo (rawData); - if (ci.ContentType != PKCS7.Oid.signedData) + PKCS7.ContentInfo ci = new PKCS7.ContentInfo (entry); + if (ci.ContentType != PKCS7.Oid.signedData) { + base.Close (); return false; + } PKCS7.SignedData sd = new PKCS7.SignedData (ci.Content); - if (sd.ContentInfo.ContentType != spcIndirectDataContext) + if (sd.ContentInfo.ContentType != spcIndirectDataContext) { + base.Close (); return false; + } coll = sd.Certificates; ASN1 spc = sd.ContentInfo.Content; signedHash = spc [0][1][1]; - if (signedHash.Length == 20) { - // seems to be SHA-1, restart hashing - hashName = "SHA1"; - hash = HashFile (filename, hashName); + + HashAlgorithm ha = null; + switch (signedHash.Length) { + case 16: + ha = HashAlgorithm.Create ("MD5"); + hash = GetHash (ha); + break; + case 20: + ha = HashAlgorithm.Create ("SHA1"); + hash = GetHash (ha); + break; + default: + reason = 5; + base.Close (); + return false; } + base.Close (); if (!signedHash.CompareValue (hash)) return false; // messageDigest is a hash of spcIndirectDataContext (which includes the file hash) byte[] spcIDC = spc [0].Value; - HashAlgorithm ha = HashAlgorithm.Create (hashName); + ha.Initialize (); // re-using hash instance byte[] messageDigest = ha.ComputeHash (spcIDC); - return VerifySignature (sd, messageDigest, hashName); + return VerifySignature (sd, messageDigest, ha); } private bool CompareIssuerSerial (string issuer, byte[] serial, X509Certificate x509) @@ -213,7 +235,7 @@ namespace Mono.Security.Authenticode { } //private bool VerifySignature (ASN1 cs, byte[] calculatedMessageDigest, string hashName) - private bool VerifySignature (PKCS7.SignedData sd, byte[] calculatedMessageDigest, string hashName) + private bool VerifySignature (PKCS7.SignedData sd, byte[] calculatedMessageDigest, HashAlgorithm ha) { string contentType = null; ASN1 messageDigest = null; @@ -242,7 +264,7 @@ namespace Mono.Security.Authenticode { case "1.3.6.1.4.1.311.2.1.12": // spcSpOpusInfo (Microsoft code signing) try { - spcSpOpusInfo = System.Text.Encoding.UTF8.GetString (attr[1][0][1][0].Value); + spcSpOpusInfo = System.Text.Encoding.UTF8.GetString (attr[1][0][0][0].Value); } catch (NullReferenceException) { spcSpOpusInfo = null; @@ -262,13 +284,13 @@ namespace Mono.Security.Authenticode { return false; // verify signature - string hashOID = CryptoConfig.MapNameToOID (hashName); + string hashOID = CryptoConfig.MapNameToOID (ha.ToString ()); // change to SET OF (not [0]) as per PKCS #7 1.5 ASN1 aa = new ASN1 (0x31); foreach (ASN1 a in sd.SignerInfo.AuthenticatedAttributes) aa.Add (a); - HashAlgorithm ha = HashAlgorithm.Create (hashName); + ha.Initialize (); byte[] p7hash = ha.ComputeHash (aa.GetBytes ()); byte[] signature = sd.SignerInfo.Signature; @@ -282,10 +304,9 @@ namespace Mono.Security.Authenticode { RSACryptoServiceProvider rsa = (RSACryptoServiceProvider) x509.RSA; if (rsa.VerifyHash (p7hash, hashOID, signature)) { signerChain.LoadCertificates (coll); - if (signerChain.Build (x509)) - signingCertificate = x509; - else - return false; + trustedRoot = signerChain.Build (x509); + signingCertificate = x509; + break; } } } @@ -301,17 +322,18 @@ namespace Mono.Security.Authenticode { // countersignature (1 2 840 113549 1 9 6) // SET { PKCS7.SignerInfo cs = new PKCS7.SignerInfo (attr [1]); - return VerifyCounterSignature (cs, signature, hashName); + trustedTimestampRoot = VerifyCounterSignature (cs, signature); + break; default: // we don't support other unauthenticated attributes break; } } - return true; + return (trustedRoot && trustedTimestampRoot); } - private bool VerifyCounterSignature (PKCS7.SignerInfo cs, byte[] signature, string hashName) + private bool VerifyCounterSignature (PKCS7.SignerInfo cs, byte[] signature) { // SEQUENCE { // INTEGER 1 @@ -358,6 +380,7 @@ namespace Mono.Security.Authenticode { if (messageDigest == null) return false; // TODO: must be read from the ASN.1 structure + string hashName = null; switch (messageDigest.Length) { case 16: hashName = "MD5"; @@ -398,5 +421,20 @@ namespace Mono.Security.Authenticode { // no certificate can verify this signature! return false; } + + private void Reset () + { + filename = null; + entry = null; + hash = null; + signedHash = null; + signingCertificate = null; + reason = -1; + trustedRoot = false; + trustedTimestampRoot = false; + signerChain.Reset (); + timestampChain.Reset (); + timestamp = DateTime.MinValue; + } } } diff --git a/mcs/class/corlib/Mono.Security.Authenticode/ChangeLog b/mcs/class/corlib/Mono.Security.Authenticode/ChangeLog index 7f9398815f2..da0e586a096 100755 --- a/mcs/class/corlib/Mono.Security.Authenticode/ChangeLog +++ b/mcs/class/corlib/Mono.Security.Authenticode/ChangeLog @@ -1,3 +1,8 @@ +2004-09-07 Sebastien Pouliot <sebastien@ximian.com> + + * AuthenticodeBase.cs: Merge optimizations from HEAD. + * AuthenticodeDeformatter.cs: Merge optimizations from HEAD. + 2004-04-28 Sebastien Pouliot <sebastien@ximian.com> * AuthenticodeBase.cs: In sync with Mono.Security.dll version. diff --git a/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog b/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog index 4162be45b05..1515435dce9 100644 --- a/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog +++ b/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog @@ -1,3 +1,8 @@ +2004-09-29 Sebastien Pouliot <sebastien@ximian.com> + + * RSAManaged.cs: KeySize is now always a multiple of 8 bits. + Fix #66929. + 2004-06-23 Sebastien Pouliot <sebastien@ximian.com> * SymmetricTransform.cs: Reduce by one the number of block when diff --git a/mcs/class/corlib/Mono.Security.Cryptography/RSAManaged.cs b/mcs/class/corlib/Mono.Security.Cryptography/RSAManaged.cs index 40f58801dce..82b16f6b291 100644 --- a/mcs/class/corlib/Mono.Security.Cryptography/RSAManaged.cs +++ b/mcs/class/corlib/Mono.Security.Cryptography/RSAManaged.cs @@ -149,8 +149,12 @@ namespace Mono.Security.Cryptography { public override int KeySize { get { // in case keypair hasn't been (yet) generated - if (keypairGenerated) - return n.BitCount (); + if (keypairGenerated) { + int ks = n.BitCount (); + if ((ks & 7) != 0) + ks = ks + (8 - (ks & 7)); + return ks; + } else return base.KeySize; } diff --git a/mcs/class/corlib/Mono.Security.X509/ChangeLog b/mcs/class/corlib/Mono.Security.X509/ChangeLog index 5cfdfbd7a78..add41ab01a7 100644 --- a/mcs/class/corlib/Mono.Security.X509/ChangeLog +++ b/mcs/class/corlib/Mono.Security.X509/ChangeLog @@ -1,3 +1,7 @@ +2004-09-07 Sebastien Pouliot <sebastien@ximian.com> + + * X509Chain.cs: Merge bug fixes from HEAD. + 2004-05-27 Sebastien Pouliot <sebastien@ximian.com> * X509Certificate.cs: Rethrow original exception when parsing X.509 diff --git a/mcs/class/corlib/Mono.Security.X509/X509Chain.cs b/mcs/class/corlib/Mono.Security.X509/X509Chain.cs index 0ff5d875ac5..f8035e6c661 100755 --- a/mcs/class/corlib/Mono.Security.X509/X509Chain.cs +++ b/mcs/class/corlib/Mono.Security.X509/X509Chain.cs @@ -9,10 +9,6 @@ // Sebastien Pouliot <sebastien@ximian.com> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// (C) 2004 Novell (http://www.novell.com) -// - -// // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining @@ -136,7 +132,7 @@ namespace Mono.Security.X509 { tmp = FindCertificateParent (x); if (x != null) { _chain.Add (x); - tmp = x; // last valid + x = tmp; // last valid } } // find a trusted root @@ -193,7 +189,8 @@ namespace Mono.Security.X509 { _status = X509ChainStatusFlags.NoError; roots = null; // this force a reload certs.Clear (); - _chain.Clear (); + if (_chain != null) + _chain.Clear (); } // private stuff diff --git a/mcs/class/corlib/System.Collections/ChangeLog b/mcs/class/corlib/System.Collections/ChangeLog index 8782bc457f8..f269e646470 100644 --- a/mcs/class/corlib/System.Collections/ChangeLog +++ b/mcs/class/corlib/System.Collections/ChangeLog @@ -1,3 +1,13 @@ +2004-07-21 Geoff Norton <gnorton@customerdna.com> + + * Hashtable.cs: lock the SyncRoot when Cloning a Synchronized hashtable to avoid + a snapshot out of sync error. + +2004-07-21 Duncan Mak <duncan@ximian.com> + + * DictionaryBase.cs: Rename the dictionary field to hashtable, + which causes a serialization interop bug. Fixes bug #61721. + 2004-06-18 Ben Maurer <bmaurer@ximian.com> * IKeyComparer.cs: v2 class diff --git a/mcs/class/corlib/System.Collections/DictionaryBase.cs b/mcs/class/corlib/System.Collections/DictionaryBase.cs index af6b19f2617..9e814d1fab9 100755 --- a/mcs/class/corlib/System.Collections/DictionaryBase.cs +++ b/mcs/class/corlib/System.Collections/DictionaryBase.cs @@ -51,11 +51,11 @@ namespace System.Collections { [Serializable] public abstract class DictionaryBase : IDictionary, ICollection, IEnumerable { - Hashtable dictionary; + Hashtable hashtable; protected DictionaryBase () { - dictionary = new Hashtable (); + hashtable = new Hashtable (); } /// <summary> @@ -64,7 +64,7 @@ namespace System.Collections { public void Clear () { OnClear (); - dictionary.Clear (); + hashtable.Clear (); OnClearComplete (); } @@ -73,7 +73,7 @@ namespace System.Collections { /// </summary> public int Count { get { - return dictionary.Count; + return hashtable.Count; } } @@ -91,7 +91,7 @@ namespace System.Collections { /// </summary> protected Hashtable InnerHashtable { get { - return dictionary; + return hashtable; } } @@ -129,7 +129,7 @@ namespace System.Collections { /// </summary> private void DoCopy (Array array, int index) { - foreach (DictionaryEntry de in dictionary) + foreach (DictionaryEntry de in hashtable) array.SetValue (de, index++); } @@ -138,7 +138,7 @@ namespace System.Collections { /// </summary> public IDictionaryEnumerator GetEnumerator () { - return dictionary.GetEnumerator (); + return hashtable.GetEnumerator (); } /// <summary> @@ -311,20 +311,20 @@ namespace System.Collections { object IDictionary.this [object key] { get { - OnGet (key, dictionary[key]); - object value = dictionary [key]; + OnGet (key, hashtable [key]); + object value = hashtable [key]; return value; } set { OnValidate (key, value); - object current_value = dictionary [key]; + object current_value = hashtable [key]; OnSet (key, current_value, value); - dictionary [key] = value; + hashtable [key] = value; try { OnSetComplete (key, current_value, value); } catch { - dictionary [key] = current_value; + hashtable [key] = current_value; throw; } } @@ -332,13 +332,13 @@ namespace System.Collections { ICollection IDictionary.Keys { get { - return dictionary.Keys; + return hashtable.Keys; } } ICollection IDictionary.Values { get { - return dictionary.Values; + return hashtable.Values; } } @@ -349,11 +349,11 @@ namespace System.Collections { { OnValidate (key, value); OnInsert (key, value); - dictionary.Add (key, value); + hashtable.Add (key, value); try { OnInsertComplete (key, value); } catch { - dictionary.Remove(key); + hashtable.Remove (key); throw; } } @@ -363,10 +363,10 @@ namespace System.Collections { /// </summary> void IDictionary.Remove (object key) { - object value = dictionary [key]; + object value = hashtable [key]; OnValidate (key, value); OnRemove (key, value); - dictionary.Remove (key); + hashtable.Remove (key); OnRemoveComplete (key, value); } @@ -375,24 +375,24 @@ namespace System.Collections { /// </summary> bool IDictionary.Contains (object key) { - return dictionary.Contains (key); + return hashtable.Contains (key); } bool ICollection.IsSynchronized { get { - return dictionary.IsSynchronized; + return hashtable.IsSynchronized; } } object ICollection.SyncRoot { get { - return dictionary.SyncRoot; + return hashtable.SyncRoot; } } IEnumerator IEnumerable.GetEnumerator () { - return dictionary.GetEnumerator (); + return hashtable.GetEnumerator (); } } } diff --git a/mcs/class/corlib/System.Collections/Hashtable.cs b/mcs/class/corlib/System.Collections/Hashtable.cs index 36575c8e024..270bbef13ca 100644 --- a/mcs/class/corlib/System.Collections/Hashtable.cs +++ b/mcs/class/corlib/System.Collections/Hashtable.cs @@ -1114,8 +1114,9 @@ namespace System.Collections { public override object Clone () { - Hashtable ht = (Hashtable) host.Clone (); - return new SyncHashtable (ht); + lock(host.SyncRoot) { + return new SyncHashtable( (Hashtable) host.Clone () ); + } } } // SyncHashtable diff --git a/mcs/class/corlib/System.Globalization/ChangeLog b/mcs/class/corlib/System.Globalization/ChangeLog index 95392d51e96..576127cba91 100644 --- a/mcs/class/corlib/System.Globalization/ChangeLog +++ b/mcs/class/corlib/System.Globalization/ChangeLog @@ -1,3 +1,8 @@ +2004-10-14 Miguel de Icaza <miguel@ximian.com> + + * TextInfo.cs: Fix ToTitleCase to do title case for each word on + the string per the spec. + 2004-06-17 Atsushi Enomoto <atsushi@ximian.com> * DateTimeFormatInfo.cs : check if pattern array is empty or not. Now diff --git a/mcs/class/corlib/System.Globalization/TextInfo.cs b/mcs/class/corlib/System.Globalization/TextInfo.cs index 7e1d8cc7a1f..43b0da08610 100755 --- a/mcs/class/corlib/System.Globalization/TextInfo.cs +++ b/mcs/class/corlib/System.Globalization/TextInfo.cs @@ -137,11 +137,22 @@ namespace System.Globalization { throw new ArgumentNullException("string is null"); Text.StringBuilder s = new Text.StringBuilder (); - - s.Append (Char.ToUpper (str [0])); - - for (int i = 1; i < str.Length; i ++) - s.Append (str [i]); + bool space_seen = true; + + for (int i = 0; i < str.Length; i ++){ + char c = str [i]; + if (Char.IsLetter (c)){ + if (space_seen) + s.Append (Char.ToUpper (c)); + else + s.Append (Char.ToLower (c)); + space_seen = false; + } else { + s.Append (c); + if (Char.IsWhiteSpace (c)) + space_seen = true; + } + } return s.ToString (); } diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog b/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog index 2b295ce72fa..c27c01f582e 100644 --- a/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog +++ b/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog @@ -1,3 +1,7 @@ +2004-07-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * IsolatedStorageInfo.cs: useGetFolderPath instead of getting "HOME". + 2004-06-13 Gert Driesen <drieseng@users.sourceforge.net> * IsolatedStorage.cs: really mark the storage_scope field private diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageInfo.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageInfo.cs index a3a1ae0e8a3..d1107269a1b 100644 --- a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageInfo.cs +++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageInfo.cs @@ -37,7 +37,7 @@ namespace System.IO.IsolatedStorage { [MonoTODO("Unix Specific; generalize for Win32")] internal static string GetIsolatedStorageDirectory () { - string home = Environment.GetEnvironmentVariable ("HOME"); + string home = Environment.GetFolderPath (Environment.SpecialFolder.Personal); if (home == null) home = "~"; diff --git a/mcs/class/corlib/System.IO/ChangeLog b/mcs/class/corlib/System.IO/ChangeLog index 6818c37ad82..2a98da3be31 100644 --- a/mcs/class/corlib/System.IO/ChangeLog +++ b/mcs/class/corlib/System.IO/ChangeLog @@ -1,3 +1,51 @@ +2004-09-19 Dick Porter <dick@ximian.com> + + * UnexceptionalStreamWriter.cs: + * UnexceptionalStreamReader.cs: Wrappers around StreamWriter and + StreamReader that catch IOException. Used by System.Console so + that graphical applications dont get IO errors when their + stdin/out/err vanishes (ie when they spew debug output.) + +2004-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Stream.cs: Close() does not call Flush(). Fixes bug #65340. + +2004-08-26 Ben Maurer <bmaurer@users.sourceforge.net> + + * StreamWriter.cs: avoid String.ToCharArray for perf. + +2004-08-18 Dick Porter <dick@ximian.com> + + * StreamWriter.cs: Flush the buffer if AutoFlush is set to true. + Fixes bug 63063, patch by Laurent Debacker (debackerl@yahoo.com). + +2004-08-13 Dick Porter <dick@ximian.com> + + * StreamWriter.cs: Allow FileShare.Read access to the underlying + FileStream, to be compatible with MS. Fixes bug 62152. + +2004-07-06 Dick Porter <dick@ximian.com> + + * MonoIO.cs: Add ERROR_INVALID_PARAMETER to the exception list. + Don't blow away the SetFileTime() error before the caller gets to + see it. Part of the bug fix to 60970. + +2004-07-05 Dick Porter <dick@ximian.com> + + * CheckPermission.cs: + * File.cs: + * FileInfo.cs: + * MonoIO.cs: + * FileStream.cs: Give the filename when throwing + FileNotFoundException. Fixes bug 61120, based on patch from + Carlos Alberto Cesario <carloscesario@gmail.com>. + +2004-07-05 Dick Porter <dick@ximian.com> + + * File.cs: File.Move() should check that the destination doesn't + already exist. Fixes bug 60915, patch based on one from Carlos + Alberto Cesario <carloscesario@gmail.com>. + 2004-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com> * Directory.cs: implemented GetLogicalDrives. diff --git a/mcs/class/corlib/System.IO/CheckPermission.cs b/mcs/class/corlib/System.IO/CheckPermission.cs index 2b31cab7e01..232b1350af4 100644 --- a/mcs/class/corlib/System.IO/CheckPermission.cs +++ b/mcs/class/corlib/System.IO/CheckPermission.cs @@ -102,7 +102,7 @@ namespace System.IO } else { - throw new FileNotFoundException(); + throw new FileNotFoundException("File not found", path); } #endif } diff --git a/mcs/class/corlib/System.IO/File.cs b/mcs/class/corlib/System.IO/File.cs index c45dea6aecb..3dcf8213759 100644 --- a/mcs/class/corlib/System.IO/File.cs +++ b/mcs/class/corlib/System.IO/File.cs @@ -70,7 +70,7 @@ namespace System.IO if (dest.Trim () == "" || dest.IndexOfAny (Path.InvalidPathChars) != -1) throw new ArgumentException ("dest"); if (!Exists (src)) - throw new FileNotFoundException (src + " does not exist"); + throw new FileNotFoundException (src + " does not exist", src); if ((GetAttributes(src) & FileAttributes.Directory) == FileAttributes.Directory){ throw new ArgumentException(src + " is a directory"); @@ -261,9 +261,11 @@ namespace System.IO if (dest.Trim () == "" || dest.IndexOfAny (Path.InvalidPathChars) != -1) throw new ArgumentException ("dest"); if (!MonoIO.Exists (src, out error)) - throw new FileNotFoundException (src + " does not exist"); + throw new FileNotFoundException (src + " does not exist", src); if (MonoIO.ExistsDirectory (dest, out error)) throw new IOException (dest + " is a directory"); + if (MonoIO.Exists (dest, out error)) + throw new IOException (dest + " already exists"); string DirName; DirName = Path.GetDirectoryName(src); diff --git a/mcs/class/corlib/System.IO/FileInfo.cs b/mcs/class/corlib/System.IO/FileInfo.cs index c98cf6feaec..3345f61dc79 100644 --- a/mcs/class/corlib/System.IO/FileInfo.cs +++ b/mcs/class/corlib/System.IO/FileInfo.cs @@ -81,7 +81,7 @@ namespace System.IO { public long Length {
get {
if (!Exists)
- throw new FileNotFoundException ("Could not find file \"" + OriginalPath + "\".");
+ throw new FileNotFoundException ("Could not find file \"" + OriginalPath + "\".", OriginalPath);
return stat.Length;
}
diff --git a/mcs/class/corlib/System.IO/FileStream.cs b/mcs/class/corlib/System.IO/FileStream.cs index 3024bf35d04..01b726a0b92 100644 --- a/mcs/class/corlib/System.IO/FileStream.cs +++ b/mcs/class/corlib/System.IO/FileStream.cs @@ -155,7 +155,7 @@ namespace System.IO if (access == FileAccess.Read && mode != FileMode.Create && mode != FileMode.OpenOrCreate && mode != FileMode.CreateNew && !File.Exists (name)) - throw new FileNotFoundException ("Could not find file \"" + name + "\"."); + throw new FileNotFoundException ("Could not find file \"" + name + "\".", name); if (mode == FileMode.CreateNew) { string dname = Path.GetDirectoryName (name); diff --git a/mcs/class/corlib/System.IO/MonoIO.cs b/mcs/class/corlib/System.IO/MonoIO.cs index 47fd104fdc3..a32e6ed5408 100644 --- a/mcs/class/corlib/System.IO/MonoIO.cs +++ b/mcs/class/corlib/System.IO/MonoIO.cs @@ -63,7 +63,8 @@ namespace System.IO // FIXME: add more exception mappings here case MonoIOError.ERROR_FILE_NOT_FOUND: message = String.Format ("Could not find file \"{0}\"", path); - return new FileNotFoundException (message); + return new FileNotFoundException (message, + path); case MonoIOError.ERROR_PATH_NOT_FOUND: message = String.Format ("Could not find a part of the path \"{0}\"", path); @@ -81,6 +82,10 @@ namespace System.IO message = String.Format ("Path is too long. Path: {0}", path); return new PathTooLongException (message); + case MonoIOError.ERROR_INVALID_PARAMETER: + message = String.Format ("Invalid parameter"); + return new IOException (message); + default: message = String.Format ("Win32 IO returned {0}. Path: {1}", error, path); return new IOException (message); @@ -304,7 +309,9 @@ namespace System.IO result = SetFileTime (handle, creation_time, last_access_time, last_write_time, out error); - Close (handle, out error); + + MonoIOError ignore_error; + Close (handle, out ignore_error); return result; } diff --git a/mcs/class/corlib/System.IO/Stream.cs b/mcs/class/corlib/System.IO/Stream.cs index 04884fb5e3d..6623da319a1 100755 --- a/mcs/class/corlib/System.IO/Stream.cs +++ b/mcs/class/corlib/System.IO/Stream.cs @@ -77,7 +77,6 @@ namespace System.IO public virtual void Close () { - Flush (); } void IDisposable.Dispose () diff --git a/mcs/class/corlib/System.IO/StreamWriter.cs b/mcs/class/corlib/System.IO/StreamWriter.cs index 4c51d0269be..1799d74e6e6 100644 --- a/mcs/class/corlib/System.IO/StreamWriter.cs +++ b/mcs/class/corlib/System.IO/StreamWriter.cs @@ -123,7 +123,7 @@ namespace System.IO { else
mode = FileMode.Create;
- internalStream = new FileStream (path, mode, FileAccess.Write);
+ internalStream = new FileStream (path, mode, FileAccess.Write, FileShare.Read);
if (append)
internalStream.Position = internalStream.Length;
@@ -137,12 +137,16 @@ namespace System.IO { get {
return iflush;
}
- set {
- if (DisposedAlready)
- throw new ObjectDisposedException("StreamWriter");
- iflush = value;
- }
- }
+ set { + if (DisposedAlready) + throw new ObjectDisposedException("StreamWriter"); + iflush = value; + + if (iflush) { + Flush (); + } + } + } public virtual Stream BaseStream {
get {
@@ -245,6 +249,28 @@ namespace System.IO { index += todo;
decode_pos += todo;
}
+ } + + void LowLevelWrite (string s) + { + int count = s.Length; + int index = 0; + while (count > 0) { + int todo = decode_buf.Length - decode_pos; + if (todo == 0) { + Decode (); + todo = decode_buf.Length; + } + if (todo > count) + todo = count; + + for (int i = 0; i < todo; i ++) + decode_buf [i + decode_pos] = s [i + index]; + + count -= todo; + index += todo; + decode_pos += todo; + } }
public override void Write (char value)
@@ -278,7 +304,8 @@ namespace System.IO { throw new ObjectDisposedException("StreamWriter");
if (value != null)
- LowLevelWrite (value.ToCharArray (), 0, value.Length);
+ LowLevelWrite (value); +
if (iflush)
Flush ();
}
diff --git a/mcs/class/corlib/System.IO/UnexceptionalStreamReader.cs b/mcs/class/corlib/System.IO/UnexceptionalStreamReader.cs new file mode 100644 index 00000000000..7c527459204 --- /dev/null +++ b/mcs/class/corlib/System.IO/UnexceptionalStreamReader.cs @@ -0,0 +1,149 @@ +// +// System.IO.UnexceptionalStreamReader.cs +// +// Authors: +// Dietmar Maurer (dietmar@ximian.com) +// Miguel de Icaza (miguel@ximian.com) +// Dick Porter (dick@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004 Novell (http://www.novell.com) +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// 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. +// + + +// This is a wrapper around StreamReader used by System.Console that +// catches IOException so that graphical applications don't suddenly +// get IO errors when their terminal vanishes. See +// UnexceptionalStreamWriter too. + +using System; +using System.Text; +using System.Runtime.InteropServices; + +namespace System.IO { + internal class UnexceptionalStreamReader : StreamReader { + public UnexceptionalStreamReader(Stream stream) + : base (stream) + { + } + + public UnexceptionalStreamReader(Stream stream, bool detect_encoding_from_bytemarks) + : base (stream, detect_encoding_from_bytemarks) + { + } + + public UnexceptionalStreamReader(Stream stream, Encoding encoding) + : base (stream, encoding) + { + } + + public UnexceptionalStreamReader(Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks) + : base (stream, encoding, detect_encoding_from_bytemarks) + { + } + + public UnexceptionalStreamReader(Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks, int buffer_size) + : base (stream, encoding, detect_encoding_from_bytemarks, buffer_size) + { + } + + public UnexceptionalStreamReader(string path) + : base (path) + { + } + + public UnexceptionalStreamReader(string path, bool detect_encoding_from_bytemarks) + : base (path, detect_encoding_from_bytemarks) + { + } + + public UnexceptionalStreamReader(string path, Encoding encoding) + : base (path, encoding) + { + } + + public UnexceptionalStreamReader(string path, Encoding encoding, bool detect_encoding_from_bytemarks) + : base (path, encoding, detect_encoding_from_bytemarks) + { + } + + public UnexceptionalStreamReader(string path, Encoding encoding, bool detect_encoding_from_bytemarks, int buffer_size) + : base (path, encoding, detect_encoding_from_bytemarks, buffer_size) + { + } + + public override int Peek () + { + try { + return(base.Peek ()); + } catch (IOException) { + } + + return(-1); + } + + public override int Read () + { + try { + return(base.Read ()); + } catch (IOException) { + } + + return(-1); + } + + public override int Read ([In, Out] char[] dest_buffer, + int index, int count) + { + try { + return(base.Read (dest_buffer, index, count)); + } catch (IOException) { + } + + return(0); + } + + public override string ReadLine() + { + try { + return(base.ReadLine ()); + } catch (IOException) { + } + + return(null); + } + + public override string ReadToEnd() + { + try { + return(base.ReadToEnd ()); + } catch (IOException) { + } + + return(null); + } + } +} diff --git a/mcs/class/corlib/System.IO/UnexceptionalStreamWriter.cs b/mcs/class/corlib/System.IO/UnexceptionalStreamWriter.cs new file mode 100644 index 00000000000..db9fd5842e7 --- /dev/null +++ b/mcs/class/corlib/System.IO/UnexceptionalStreamWriter.cs @@ -0,0 +1,128 @@ +// +// System.IO.StreamWriter.cs +// +// Authors: +// Dietmar Maurer (dietmar@ximian.com) +// Paolo Molaro (lupus@ximian.com) +// Dick Porter (dick@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// 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. +// + + +// This is a wrapper around StreamWriter used by System.Console that +// catches IOException so that graphical applications don't suddenly +// get IO errors when their terminal vanishes (ie when they spew debug +// output.) See UnexceptionalStreamReader too. + +using System.Text; +using System; + +namespace System.IO { + internal class UnexceptionalStreamWriter: StreamWriter { + public UnexceptionalStreamWriter (Stream stream) + : base (stream) + { + } + + public UnexceptionalStreamWriter (Stream stream, + Encoding encoding) + : base (stream, encoding) + { + } + + public UnexceptionalStreamWriter (Stream stream, + Encoding encoding, + int bufferSize) + : base (stream, encoding, bufferSize) + { + } + + public UnexceptionalStreamWriter (string path) + : base (path) + { + } + + public UnexceptionalStreamWriter (string path, bool append) + : base (path, append) + { + } + + public UnexceptionalStreamWriter (string path, bool append, + Encoding encoding) + : base (path, append, encoding) + { + } + + public UnexceptionalStreamWriter (string path, bool append, + Encoding encoding, + int bufferSize) + : base (path, append, encoding, bufferSize) + { + } + + public override void Flush () + { + try { + base.Flush (); + } catch (IOException) { + } + } + + public override void Write (char[] buffer, int index, + int count) + { + try { + base.Write (buffer, index, count); + } catch (IOException) { + } + } + + public override void Write (char value) + { + try { + base.Write (value); + } catch (IOException) { + } + } + + public override void Write (char[] value) + { + try { + base.Write (value); + } catch (IOException) { + } + } + + public override void Write (string value) + { + try { + base.Write (value); + } catch (IOException) { + } + } + } +} diff --git a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs index ebe86410469..344395be1a3 100755 --- a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs @@ -131,8 +131,16 @@ namespace System.Reflection.Emit { } if (n.KeyPair != null) { + // full keypair is available (for signing) sn = n.KeyPair.StrongName (); } + else { + // public key is available (for delay-signing) + byte[] pk = n.GetPublicKey (); + if ((pk != null) && (pk.Length > 0)) { + sn = new Mono.Security.StrongName (pk); + } + } basic_init (this); } diff --git a/mcs/class/corlib/System.Reflection.Emit/ChangeLog b/mcs/class/corlib/System.Reflection.Emit/ChangeLog index 5aeec6cdae4..0ecc28b55ff 100644 --- a/mcs/class/corlib/System.Reflection.Emit/ChangeLog +++ b/mcs/class/corlib/System.Reflection.Emit/ChangeLog @@ -1,3 +1,33 @@ +2004-10-06 Zoltan Varga <vargaz@freemail.hu> + + * ModuleBuilder.cs (GetTypes): Fix length of returned array. Fixes + #65931. + +2004-10-04 Zoltan Varga <vargaz@freemail.hu> + + * ModuleBuilder.cs (DefineType): Check for duplicate type names. Fixes + #65988. + +2004-09-17 Zoltan Varga <vargaz@freemail.hu> + + * CustomAttributeBuilder.cs: Applied patch from Marcus Urban (mathpup@mylinuxisp.com). Add support for defining custom marshallers by calling SetCustomAttribute. + +2004-09-09 Zoltan Varga <vargaz@freemail.hu> + + * TypeBuilder.cs: Set the table_idx of the global type to 1. + + * ModuleBuilder.cs: Save the main module of the assembly even if it is + transient. + +2004-08-13 Sebastien Pouliot <sebastien@ximian.com> + + * AssemblyBuilder.cs: (Partly) Fix delay-signing issue (#56621) when + MCS is used on the MS runtime (other part of the fix is for MCS). + +2004-07-24 Martin Baulig <martin@ximian.com> + + * TypeBuilder.cs (TypeBuilder.UnspecifiedTypeSize): Set this to 0 + and initialize it to 0 everywhere. Thu Jun 24 15:33:04 CEST 2004 Paolo Molaro <lupus@ximian.com> diff --git a/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs index e85e67022bc..daadb065ed3 100755 --- a/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs @@ -198,6 +198,8 @@ namespace System.Reflection.Emit { int sizeConst = 0; int value; int utype; /* the (stupid) ctor takes a short or an enum ... */ + Type marshalTypeRef = null; + string marshalCookie = String.Empty; utype = (int)data [2]; utype |= ((int)data [3]) << 8; @@ -231,7 +233,21 @@ namespace System.Reflection.Emit { value |= ((int)data [pos++]) << 24; sizeConst = value; break; + case "MarshalTypeRef": + case "MarshalType": + len = decode_len (data, pos, out pos); + marshalTypeRef = Type.GetType (string_from_bytes (data, pos, len)); + pos += len; + break; + case "MarshalCookie": + len = decode_len (data, pos, out pos); + marshalCookie = string_from_bytes (data, pos, len); + pos += len; + break; default: + len = decode_len(data, pos, out pos); + string v = string_from_bytes (data, pos, len); + pos += len; break; } } @@ -245,6 +261,8 @@ namespace System.Reflection.Emit { return UnmanagedMarshal.DefineByValArray (sizeConst); case UnmanagedType.ByValTStr: return UnmanagedMarshal.DefineByValTStr (sizeConst); + case UnmanagedType.CustomMarshaler: + return UnmanagedMarshal.DefineCustom ( marshalTypeRef, marshalCookie, marshalTypeRef.ToString (), Guid.Empty); default: return UnmanagedMarshal.DefineUnmanagedMarshal ((UnmanagedType)utype); } diff --git a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs index a7d4888d6d7..eabb8f84fb9 100644 --- a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs @@ -252,6 +252,8 @@ namespace System.Reflection.Emit { } private TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, Type[] interfaces, PackingSize packsize, int typesize) { + if (name_cache.Contains (name)) + throw new ArgumentException ("Duplicate type name within an assembly."); TypeBuilder res = new TypeBuilder (this, name, attr, parent, interfaces, packsize, typesize, null); if (types != null) { if (types.Length == num_types) { @@ -433,7 +435,7 @@ namespace System.Reflection.Emit { if (types == null) return new TypeBuilder [0]; - int n = types.Length; + int n = num_types; TypeBuilder [] copy = new TypeBuilder [n]; Array.Copy (types, copy, n); @@ -624,9 +626,8 @@ namespace System.Reflection.Emit { internal void Save () { - if (transient) + if (transient && !is_main) return; - if ((global_type != null) && (global_type_created == null)) global_type_created = global_type.CreateType (); diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs index 1f6884bdc12..edcf429d9cc 100644 --- a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs @@ -95,8 +95,9 @@ namespace System.Reflection.Emit { internal TypeBuilder (ModuleBuilder mb, TypeAttributes attr) { this.parent = null; this.attrs = attr; - this.class_size = -1; + this.class_size = 0; fullname = this.tname = "<Module>"; + this.table_idx = 1; this.nspace = ""; pmodule = mb; setup_internal_class (this); @@ -987,7 +988,7 @@ namespace System.Reflection.Emit { public override Type[] GetNestedTypes (BindingFlags bindingAttr) { bool match; ArrayList result = new ArrayList (); - + if (subtypes == null) return Type.EmptyTypes; foreach (TypeBuilder t in subtypes) { diff --git a/mcs/class/corlib/System.Reflection/ChangeLog b/mcs/class/corlib/System.Reflection/ChangeLog index 8a7945e688e..2ceab253beb 100644 --- a/mcs/class/corlib/System.Reflection/ChangeLog +++ b/mcs/class/corlib/System.Reflection/ChangeLog @@ -1,3 +1,12 @@ + +Sat Jul 10 15:48:34 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * Modulec.s: return just name in ToString (bug #61287). + +2004-07-03 Zoltan Varga <vargaz@freemail.hu> + + * Module.cs: Initialize FilterTypeName[IgnoreCase]. Fixes #61048. + 2004-06-17 Gert Driesen <drieseng@users.sourceforge.net> * Pointer.cs: remove serializable attribute to match MS.NET diff --git a/mcs/class/corlib/System.Reflection/Module.cs b/mcs/class/corlib/System.Reflection/Module.cs index 01dc55f9be6..876967a50c0 100644 --- a/mcs/class/corlib/System.Reflection/Module.cs +++ b/mcs/class/corlib/System.Reflection/Module.cs @@ -55,6 +55,11 @@ namespace System.Reflection { const BindingFlags defaultBindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance; + static Module () { + FilterTypeName = new TypeFilter (filter_by_type_name); + FilterTypeNameIgnoreCase = new TypeFilter (filter_by_type_name_ignore_case); + } + internal Module () { } ~Module () { @@ -206,7 +211,7 @@ namespace System.Reflection { public override string ToString () { - return "Reflection.Module: " + name; + return name; } // Mono Extension: returns the GUID of this module @@ -215,6 +220,22 @@ namespace System.Reflection { return new Guid (GetGuidInternal ()); } + private static bool filter_by_type_name (Type m, object filterCriteria) { + string s = (string)filterCriteria; + if (s.EndsWith ("*")) + return m.Name.StartsWith (s.Substring (0, s.Length - 1)); + else + return m.Name == s; + } + + private static bool filter_by_type_name_ignore_case (Type m, object filterCriteria) { + string s = (string)filterCriteria; + if (s.EndsWith ("*")) + return m.Name.ToLower ().StartsWith (s.Substring (0, s.Length - 1).ToLower ()); + else + return String.Compare (m.Name, s, true) == 0; + } + [MethodImplAttribute (MethodImplOptions.InternalCall)] private extern string GetGuidInternal (); diff --git a/mcs/class/corlib/System.Reflection/common.src b/mcs/class/corlib/System.Reflection/common.src deleted file mode 100644 index 022b6768fcc..00000000000 --- a/mcs/class/corlib/System.Reflection/common.src +++ /dev/null @@ -1,25 +0,0 @@ -Assembly.cs -AssemblyNameFlags.cs -BindingFlags.cs -CallingConventions.cs -ConstructorInfo.cs -DefaultMemberAttribute.cs -EventAttributes.cs -EventInfo.cs -FieldAttributes.cs -FieldInfo.cs -ICustomAttributeProvider.cs -MemberFilter.cs -MemberInfo.cs -MemberTypes.cs -MethodAttributes.cs -MethodBase.cs -MethodImplAttributes.cs -MethodInfo.cs -Module.cs -ParameterAttributes.cs -PropertyAttributes.cs -PropertyInfo.cs -ResourceAttributes.cs -ResourceLocation.cs -TypeAttributes.cs diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog b/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog index 3eab4fba987..b74738d5faf 100644 --- a/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog +++ b/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog @@ -1,3 +1,9 @@ +2004-09-10 Raja R Harinath <rharinath@novell.com> + + Fix bootstrap with mcs 1.1.x. + * UnmanagedType.cs (UnmanagedType.__mono_bootstrap_NativeTypeMax): + Mark as non-compliant to CLS. + 2004-06-22 Raja R Harinath <rharinath@novell.com> Fix bootstrap with mcs 0.31. diff --git a/mcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs b/mcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs index 6502e1f90f6..1b5f3363c24 100755 --- a/mcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs +++ b/mcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs @@ -188,6 +188,7 @@ namespace System.Runtime.InteropServices { #if BOOTSTRAP_WITH_OLDLIB /// <summary> /// </summary> + [CLSCompliant(false)] __mono_bootstrap_NativeTypeMax = 80, #endif } // UnmanagedType diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog index aafa83f9899..35352b211ea 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog +++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog @@ -1,3 +1,8 @@ +2004-07-02 Lluis Sanchez Gual <lluis@novell.com> + + * ChannelServices.cs: In RegisterChannel, ignore name colisions if the + channel name is "". This fixes bug #61592. + 2004-06-15 Gert Driesen <drieseng@users.sourceforge.net> * TransportHeaders.cs: added TODO for serialization diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs index 98629c496f4..f2f21baf53e 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs @@ -254,7 +254,7 @@ namespace System.Runtime.Remoting.Channels { IChannel regc = (IChannel) registeredChannels[n]; - if (regc.ChannelName == chnl.ChannelName) + if (regc.ChannelName == chnl.ChannelName && chnl.ChannelName != "") throw new RemotingException ("Channel " + regc.ChannelName + " already registered"); if (regc.ChannelPriority < chnl.ChannelPriority && pos==-1) diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog index 87e4e0902e6..31b0acd440c 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog @@ -1,3 +1,8 @@ +2004-07-22 Lluis Sanchez Gual <lluis@novell.com> + + * MethodCall.cs: Use RemotingServices.GetMethodBaseFromName to get the + MethodBase from the method name. This fixes bug #61774. + 2004-06-18 Sebastien Pouliot <sebastien@ximian.com> * ReturnMessage.cs: Added IMessage interface to class definition. diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs index 9313d3aa0cb..47dbb9d0beb 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs @@ -288,11 +288,8 @@ namespace System.Runtime.Remoting.Messaging { Type type = RemotingServices.GetServerTypeForUri (_uri); if (type == null) throw new RemotingException ("Requested service not found. No receiver for uri " + _uri); - if (CanCastTo (_typeName, type)) - { - BindingFlags bflags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; - if (_methodSignature == null) _methodBase = type.GetMethod (_methodName, bflags); - else _methodBase = type.GetMethod (_methodName, bflags, null, _methodSignature, null); + if (CanCastTo (_typeName, type)) { + _methodBase = RemotingServices.GetMethodBaseFromName (type, _methodName, _methodSignature); return; } else diff --git a/mcs/class/corlib/System.Runtime.Remoting/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting/ChangeLog index 1fc62be042d..14aa52173f9 100755 --- a/mcs/class/corlib/System.Runtime.Remoting/ChangeLog +++ b/mcs/class/corlib/System.Runtime.Remoting/ChangeLog @@ -1,3 +1,21 @@ +2004-07-22 Lluis Sanchez Gual <lluis@novell.com> + + * ObjRef.cs: Fixed type check in in ObjRef constructor. The requested class + must be the object class or a base class. This fixes bug #61249. + +2004-07-22 Lluis Sanchez Gual <lluis@novell.com> + + * RemotingServices.cs: Changed GetMethodBaseFromMethodMessage so its code + can be reused internally. Also fixed bug when gettting a method from an + interface. + +2004-07-02 Lluis Sanchez Gual <lluis@ximian.com> + + * RemotingConfiguration.cs: Avoid adding "id" and "type" as custom + properties of providers. This fixes bug #60934. + * ServerIdentity.cs, RemotingServices.cs: When disposing an identity, detach + the identity from the object, so it can be safely marshalled again. + 2004-06-15 Gert Driesen <drieseng@users.sourceforge.net> * RemotingTimeoutException.cs: added missing serialization ctor diff --git a/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs b/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs index 90db146c267..30234367827 100644 --- a/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs +++ b/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs @@ -92,7 +92,7 @@ namespace System.Runtime.Remoting { uri = RemotingServices.GetObjectUri(mbr); typeInfo = new TypeInfo(type); - if (!typeInfo.CanCastTo(mbr.GetType(), mbr)) + if (!type.IsAssignableFrom (mbr.GetType())) throw new RemotingException ("The server object type cannot be cast to the requested type " + type.FullName + "."); UpdateChannelInfo(); diff --git a/mcs/class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs b/mcs/class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs index 204bc6b4368..2cbe62dff51 100644 --- a/mcs/class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs +++ b/mcs/class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs @@ -721,9 +721,9 @@ namespace System.Runtime.Remoting if (at == "id" && isTemplate) prov.Id = val; - if (at == "type") + else if (at == "type") prov.Type = val; - if (at == "ref" && !isTemplate) + else if (at == "ref" && !isTemplate) prov.Ref = val; else prov.CustomProperties.Add (at, val); diff --git a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs index aa694cbb3b6..6d4b810ed13 100644 --- a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs +++ b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs @@ -57,6 +57,7 @@ namespace System.Runtime.Remoting internal static string app_id; static int next_id = 1; + static readonly BindingFlags methodBindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; static RemotingServices () { @@ -159,8 +160,10 @@ namespace System.Runtime.Remoting else throw new ArgumentException ("The obj parameter is a proxy."); } - else + else { identity = obj.ObjectIdentity; + obj.ObjectIdentity = null; + } if (identity == null || !identity.IsConnected) return false; @@ -288,22 +291,49 @@ namespace System.Runtime.Remoting Type type = Type.GetType (msg.TypeName); if (type == null) throw new RemotingException ("Type '" + msg.TypeName + "' not found."); - - BindingFlags bflags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; + + return GetMethodBaseFromName (type, msg.MethodName, (Type[]) msg.MethodSignature); + } + + internal static MethodBase GetMethodBaseFromName (Type type, string methodName, Type[] signature) + { + if (type.IsInterface) { + return FindInterfaceMethod (type, methodName, signature); + } + else { + MethodBase method = null; + if (signature == null) + method = type.GetMethod (methodName, methodBindings); + else + method = type.GetMethod (methodName, methodBindings, null, (Type[]) signature, null); + + if (method != null) + return method; + + if (signature == null) + return type.GetConstructor (methodBindings, null, Type.EmptyTypes, null); + else + return type.GetConstructor (methodBindings, null, signature, null); + } + } + + static MethodBase FindInterfaceMethod (Type type, string methodName, Type[] signature) + { + MethodBase method = null; - MethodBase method; - if (msg.MethodSignature == null) - method = type.GetMethod (msg.MethodName, bflags); + if (signature == null) + method = type.GetMethod (methodName, methodBindings); else - method = type.GetMethod (msg.MethodName, bflags, null, (Type[]) msg.MethodSignature, null); + method = type.GetMethod (methodName, methodBindings, null, signature, null); + + if (method != null) return method; - if (method != null) - return method; + foreach (Type t in type.GetInterfaces ()) { + method = FindInterfaceMethod (t, methodName, signature); + if (method != null) return method; + } - if (msg.MethodSignature == null) - return type.GetConstructor (bflags, null, Type.EmptyTypes, null); - else - return type.GetConstructor (bflags, null, (Type[]) msg.MethodSignature, null); + return null; } public static void GetObjectData(object obj, SerializationInfo info, StreamingContext context) diff --git a/mcs/class/corlib/System.Runtime.Remoting/ServerIdentity.cs b/mcs/class/corlib/System.Runtime.Remoting/ServerIdentity.cs index f5ed96a066b..72c025121d0 100644 --- a/mcs/class/corlib/System.Runtime.Remoting/ServerIdentity.cs +++ b/mcs/class/corlib/System.Runtime.Remoting/ServerIdentity.cs @@ -136,7 +136,13 @@ namespace System.Runtime.Remoting protected void DisposeServerObject() { - _serverObject = null; + // Detach identity from server object to avoid problems if the + // object is marshalled again. + + if (_serverObject != null) { + _serverObject.ObjectIdentity = null; + _serverObject = null; + } } } diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog index b5a036af423..86be09eef0a 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog +++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog @@ -1,3 +1,7 @@ +2004-09-07 Sebastien Pouliot <sebastien@ximian.com> + + * X509Certificate.cs: Merge changes from HEAD. + 2003-12-15 Sebastien Pouliot <spouliot@videotron.ca> * X509Certificate.cs: Removed old (commented) Authenticode stuff. diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs index af5722f601d..5d3f9dd8177 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs +++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs @@ -116,15 +116,26 @@ namespace System.Security.Cryptography.X509Certificates { [MonoTODO ("Incomplete - minimal validation in this version")] public static X509Certificate CreateFromSignedFile (string filename) { - AuthenticodeDeformatter a = new AuthenticodeDeformatter (filename); - if (a.SigningCertificate != null) { - return new X509Certificate (a.SigningCertificate.RawData); - } - else { + try { + AuthenticodeDeformatter a = new AuthenticodeDeformatter (filename); + if (a.SigningCertificate != null) { + if (a.Reason != 0) { + string msg = String.Format (Locale.GetText ( + "Invalid digital signature on {0}, reason #{1}."), + filename, a.Reason); + throw new COMException (msg); + } + return new X509Certificate (a.SigningCertificate.RawData); + } + // if no signature is present return an empty certificate byte[] cert = null; // must not confuse compiler about null ;) return new X509Certificate (cert); } + catch (Exception e) { + string msg = String.Format (Locale.GetText ("Couldn't extract digital signature from {0}."), filename); + throw new COMException (msg, e); + } } // constructors @@ -410,4 +421,4 @@ namespace System.Security.Cryptography.X509Certificates { } #endif } -}
\ No newline at end of file +} diff --git a/mcs/class/corlib/System.Security.Cryptography/ChangeLog b/mcs/class/corlib/System.Security.Cryptography/ChangeLog index 59642bc66bc..f087b452504 100644 --- a/mcs/class/corlib/System.Security.Cryptography/ChangeLog +++ b/mcs/class/corlib/System.Security.Cryptography/ChangeLog @@ -1,3 +1,9 @@ +2004-07-15 Sebastien Pouliot <sebastien@ximian.com> + + * DES.cs: Fixed FeedbackSizeValue to 8. + * RC2.cs: Fixed FeedbackSizeValue to 8. + * TripleDES.cs: Fixed FeedbackSizeValue to 8. + 2004-06-23 Sebastien Pouliot <sebastien@ximian.com> * CryptoStream.cs: Removed the block reduction. This seems to be done diff --git a/mcs/class/corlib/System.Security.Cryptography/DES.cs b/mcs/class/corlib/System.Security.Cryptography/DES.cs index a775477b436..cb678113d6c 100644 --- a/mcs/class/corlib/System.Security.Cryptography/DES.cs +++ b/mcs/class/corlib/System.Security.Cryptography/DES.cs @@ -6,10 +6,6 @@ // Sebastien Pouliot <sebastien@ximian.com> // // Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com) -// (C) 2004 Novell (http://www.novell.com) -// - -// // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining @@ -50,7 +46,7 @@ public abstract class DES : SymmetricAlgorithm { { KeySizeValue = 64; BlockSizeValue = 64; - FeedbackSizeValue = 64; + FeedbackSizeValue = 8; LegalKeySizesValue = new KeySizes[1]; LegalKeySizesValue[0] = new KeySizes(64, 64, 0); diff --git a/mcs/class/corlib/System.Security.Cryptography/RC2.cs b/mcs/class/corlib/System.Security.Cryptography/RC2.cs index 58566078d5f..70119078722 100644 --- a/mcs/class/corlib/System.Security.Cryptography/RC2.cs +++ b/mcs/class/corlib/System.Security.Cryptography/RC2.cs @@ -5,10 +5,6 @@ // Andrew Birkett (andy@nobugs.org) // Sebastien Pouliot (sebastien@ximian.com) // -// (C) 2004 Novell (http://www.novell.com) -// - -// // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining @@ -77,7 +73,7 @@ namespace System.Security.Cryptography { { KeySizeValue = 128; BlockSizeValue = 64; - FeedbackSizeValue = 64; + FeedbackSizeValue = 8; // The RFC allows keys of 1 to 128 bytes, but MS impl only supports // 40 to 128 bits, sigh. diff --git a/mcs/class/corlib/System.Security.Cryptography/TripleDES.cs b/mcs/class/corlib/System.Security.Cryptography/TripleDES.cs index 54969879d16..add883b6ce8 100644 --- a/mcs/class/corlib/System.Security.Cryptography/TripleDES.cs +++ b/mcs/class/corlib/System.Security.Cryptography/TripleDES.cs @@ -5,10 +5,6 @@ // Sebastien Pouliot <sebastien@ximian.com> // // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// (C) 2004 Novell (http://www.novell.com) -// - -// // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining @@ -51,7 +47,7 @@ public abstract class TripleDES : SymmetricAlgorithm { // from SymmetricAlgorithm KeySizeValue = 192; BlockSizeValue = 64; - FeedbackSizeValue = 64; + FeedbackSizeValue = 8; LegalKeySizesValue = new KeySizes [1]; LegalKeySizesValue [0] = new KeySizes (128, 192, 64); diff --git a/mcs/class/corlib/System.Security.Permissions/ChangeLog b/mcs/class/corlib/System.Security.Permissions/ChangeLog index 219a8c199ea..63e95738285 100644 --- a/mcs/class/corlib/System.Security.Permissions/ChangeLog +++ b/mcs/class/corlib/System.Security.Permissions/ChangeLog @@ -1,3 +1,9 @@ +2004-10-05 Sebastien Pouliot <sebastien@ximian.com> + + * PrincipalPermission.cs: Fixed bug where a change to a permission + (e.g. Copy, Union) could affect multiple instances. Fixed FromXml + to clear existing entries. + 2004-06-10 Gert Driesen <drieseng@users.sourceforge.net> * StrongNameIdentityPermission.cs: removed extra useless finalizer diff --git a/mcs/class/corlib/System.Security.Permissions/PrincipalPermission.cs b/mcs/class/corlib/System.Security.Permissions/PrincipalPermission.cs index d1f23c091a5..17235490015 100644 --- a/mcs/class/corlib/System.Security.Permissions/PrincipalPermission.cs +++ b/mcs/class/corlib/System.Security.Permissions/PrincipalPermission.cs @@ -98,7 +98,7 @@ namespace System.Security.Permissions { internal PrincipalPermission (ArrayList principals) { - this.principals = principals; + this.principals = (ArrayList) principals.Clone (); } // Properties @@ -147,6 +147,7 @@ namespace System.Security.Permissions { if ((esd.Attributes ["version"] as string) != "1") throw new ArgumentException ("wrong version"); + principals.Clear (); // Children is null, not empty, when no child is present if (esd.Children != null) { foreach (SecurityElement se in esd.Children) { @@ -273,7 +274,7 @@ namespace System.Security.Permissions { PrincipalPermission union = new PrincipalPermission (principals); foreach (PrincipalInfo pi in o.principals) - principals.Add (pi); + union.principals.Add (pi); return union; } @@ -284,4 +285,4 @@ namespace System.Security.Permissions { return 8; } } -}
\ No newline at end of file +} diff --git a/mcs/class/corlib/System.Threading/ChangeLog b/mcs/class/corlib/System.Threading/ChangeLog index ba1a9664f98..d441965fb9b 100644 --- a/mcs/class/corlib/System.Threading/ChangeLog +++ b/mcs/class/corlib/System.Threading/ChangeLog @@ -1,3 +1,20 @@ +2004-09-16 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Timer.cs: don't invoke the callback twice when the timer changes. + Fixes bug #66116. + +2004-08-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Timer.cs: don't invoke the callback if the period changes before the + due time. Fixes bug #62421. + +2004-07-15 Dick Porter <dick@ximian.com> + + * Thread.cs: Hold a lock in GetNamedDataSlot. Fixes bug 61582, + based on patch by Sébastien Robitaille + (sebastien.robitaille@croesus.com). Also fix instances of + lock(typeof(Thread)) to lock a private object instead. + 2004-06-24 Dick Porter <dick@ximian.com> * Mutex.cs: Implement the createdNew parameter diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs index 66826e12d40..911fb1dbe12 100755 --- a/mcs/class/corlib/System.Threading/Thread.cs +++ b/mcs/class/corlib/System.Threading/Thread.cs @@ -157,9 +157,10 @@ namespace System.Threading // Stores a hash keyed by strings of LocalDataStoreSlot objects static Hashtable datastorehash; - + private static object datastore_lock = new object (); + private static void InitDataStoreHash () { - lock (typeof (Thread)) { + lock (datastore_lock) { if (datastorehash == null) { datastorehash = Hashtable.Synchronized(new Hashtable()); } @@ -167,7 +168,7 @@ namespace System.Threading } public static LocalDataStoreSlot AllocateNamedDataSlot(string name) { - lock (typeof (Thread)) { + lock (datastore_lock) { if (datastorehash == null) InitDataStoreHash (); LocalDataStoreSlot slot = (LocalDataStoreSlot)datastorehash[name]; @@ -186,7 +187,7 @@ namespace System.Threading } public static void FreeNamedDataSlot(string name) { - lock (typeof (Thread)) { + lock (datastore_lock) { if (datastorehash == null) InitDataStoreHash (); LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name]; @@ -210,15 +211,17 @@ namespace System.Threading public extern static int GetDomainID(); public static LocalDataStoreSlot GetNamedDataSlot(string name) { - if (datastorehash == null) - InitDataStoreHash (); - LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name]; + lock (datastore_lock) { + if (datastorehash == null) + InitDataStoreHash (); + LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name]; - if(slot==null) { - slot=AllocateNamedDataSlot(name); - } + if(slot==null) { + slot=AllocateNamedDataSlot(name); + } - return(slot); + return(slot); + } } [MethodImplAttribute(MethodImplOptions.InternalCall)] diff --git a/mcs/class/corlib/System.Threading/Timer.cs b/mcs/class/corlib/System.Threading/Timer.cs index 164c60ef2ca..1bba6fa581e 100755 --- a/mcs/class/corlib/System.Threading/Timer.cs +++ b/mcs/class/corlib/System.Threading/Timer.cs @@ -128,6 +128,9 @@ namespace System.Threading wait.Reset (); signaled = wait.WaitOne (period, false); + if (aborted) + break; + if (!signaled) { callback (state); } else if (!WaitForDueTime ()) { @@ -195,10 +198,11 @@ namespace System.Threading if (runner == null) return false; - + + start_event.Reset (); + runner.Abort (); runner.DueTime = dueTime; runner.Period = period; - runner.Abort (); start_event.Set (); return true; } diff --git a/mcs/class/corlib/System/Activator.cs b/mcs/class/corlib/System/Activator.cs index 4727251d9e6..6cb4c24b262 100644 --- a/mcs/class/corlib/System/Activator.cs +++ b/mcs/class/corlib/System/Activator.cs @@ -168,9 +168,10 @@ namespace System length = args.Length; Type [] atypes = new Type [length]; - for (int i = 0; i < length; ++i) { - atypes [i] = args [i].GetType (); - } + for (int i = 0; i < length; ++i) + if (args [i] != null) + atypes [i] = args [i].GetType (); + ConstructorInfo ctor = type.GetConstructor (atypes); if (ctor == null) { if (type.IsValueType && atypes.Length == 0) @@ -213,9 +214,10 @@ namespace System length = args.Length; Type[] atypes = new Type [length]; - for (int i = 0; i < length; ++i) { - atypes [i] = args [i].GetType (); - } + for (int i = 0; i < length; ++i) + if (args [i] != null) + atypes [i] = args [i].GetType (); + ConstructorInfo ctor = type.GetConstructor (bindingAttr, binder, atypes, null); if (ctor == null) { // Not sure about this diff --git a/mcs/class/corlib/System/AppDomain.cs b/mcs/class/corlib/System/AppDomain.cs index 06ab7351c93..fe8e9ae877d 100755 --- a/mcs/class/corlib/System/AppDomain.cs +++ b/mcs/class/corlib/System/AppDomain.cs @@ -10,10 +10,6 @@ // Sebastien Pouliot (sebastien@ximian.com) // // (C) 2001, 2002 Ximian, Inc. http://www.ximian.com -// (C) 2004 Novell (http://www.novell.com) -// - -// // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining @@ -63,12 +59,10 @@ namespace System static string _process_guid; [ThreadStatic] - Hashtable type_resolve_in_progress; + static Hashtable type_resolve_in_progress; [ThreadStatic] - Hashtable assembly_resolve_in_progress; - - // Evidence evidence; + static Hashtable assembly_resolve_in_progress; private PrincipalPolicy _principalPolicy; @@ -82,34 +76,40 @@ namespace System [MethodImplAttribute (MethodImplOptions.InternalCall)] private extern AppDomainSetup getSetup (); + AppDomainSetup SetupInformationNoCopy { + get { return getSetup (); } + } + public AppDomainSetup SetupInformation { get { - return getSetup (); + AppDomainSetup setup = getSetup (); + return new AppDomainSetup (setup); } } public string BaseDirectory { get { - return SetupInformation.ApplicationBase; + return SetupInformationNoCopy.ApplicationBase; } } public string RelativeSearchPath { get { - return SetupInformation.PrivateBinPath; + return SetupInformationNoCopy.PrivateBinPath; } } public string DynamicDirectory { get { - if (SetupInformation.DynamicBase == null) return null; - return Path.Combine (SetupInformation.DynamicBase, SetupInformation.ApplicationName); + AppDomainSetup setup = SetupInformationNoCopy; + if (setup.DynamicBase == null) return null; + return Path.Combine (setup.DynamicBase, setup.ApplicationName); } } public bool ShadowCopyFiles { get { - return (SetupInformation.ShadowCopyFiles == "true"); + return (SetupInformationNoCopy.ShadowCopyFiles == "true"); } } @@ -126,7 +126,6 @@ namespace System public Evidence Evidence { get { return null; - //return evidence; } } @@ -161,7 +160,7 @@ namespace System if (path == null || path.Length == 0) return; - AppDomainSetup setup = SetupInformation; + AppDomainSetup setup = SetupInformationNoCopy; string pp = setup.PrivateBinPath; if (pp == null || pp.Length == 0) { @@ -178,12 +177,12 @@ namespace System public void ClearPrivatePath () { - SetupInformation.PrivateBinPath = String.Empty; + SetupInformationNoCopy.PrivateBinPath = String.Empty; } public void ClearShadowCopyPath () { - SetupInformation.ShadowCopyDirectories = String.Empty; + SetupInformationNoCopy.ShadowCopyDirectories = String.Empty; } public ObjectHandle CreateComInstanceFrom (string assemblyName, string typeName) @@ -321,38 +320,38 @@ namespace System public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, PermissionSet requiredPermissions, PermissionSet optionalPermissions, - PermissionSet refusedPersmissions) + PermissionSet refusedPermissions) { return DefineDynamicAssembly (name, access, null, null, requiredPermissions, optionalPermissions, - refusedPersmissions, false); + refusedPermissions, false); } public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, - PermissionSet refusedPersmissions) + PermissionSet refusedPermissions) { return DefineDynamicAssembly (name, access, null, evidence, requiredPermissions, optionalPermissions, - refusedPersmissions, false); + refusedPermissions, false); } public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir, PermissionSet requiredPermissions, PermissionSet optionalPermissions, - PermissionSet refusedPersmissions) + PermissionSet refusedPermissions) { return DefineDynamicAssembly (name, access, dir, null, requiredPermissions, optionalPermissions, - refusedPersmissions, false); + refusedPermissions, false); } public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, - PermissionSet refusedPersmissions) + PermissionSet refusedPermissions) { return DefineDynamicAssembly (name, access, dir, evidence, requiredPermissions, optionalPermissions, - refusedPersmissions, false); + refusedPermissions, false); } [MonoTODO ("FIXME: examine all other parameters")] @@ -360,7 +359,7 @@ namespace System Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, - PermissionSet refusedPersmissions, bool isSynchronized) + PermissionSet refusedPermissions, bool isSynchronized) { // FIXME: examine all other parameters @@ -477,7 +476,7 @@ namespace System public void SetCachePath (string path) { - SetupInformation.CachePath = path; + SetupInformationNoCopy.CachePath = path; } public void SetPrincipalPolicy (PrincipalPolicy policy) @@ -492,12 +491,12 @@ namespace System public void SetShadowCopyFiles() { - SetupInformation.ShadowCopyFiles = "true"; + SetupInformationNoCopy.ShadowCopyFiles = "true"; } public void SetShadowCopyPath (string path) { - SetupInformation.ShadowCopyDirectories = path; + SetupInformationNoCopy.ShadowCopyDirectories = path; } public void SetThreadPrincipal (IPrincipal principal) @@ -595,28 +594,28 @@ namespace System public static AppDomain CreateDomain (string friendlyName) { - return CreateDomain (friendlyName, new Evidence (), new AppDomainSetup ()); + return CreateDomain (friendlyName, null, null); } public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo) { - return CreateDomain (friendlyName, securityInfo, new AppDomainSetup ()); + return CreateDomain (friendlyName, securityInfo, null); } [MethodImplAttribute (MethodImplOptions.InternalCall)] private static extern AppDomain createDomain (string friendlyName, AppDomainSetup info); - [MonoTODO] + [MonoTODO ("allow setup in the other domain")] public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo, AppDomainSetup info) { - //TODO: treat securityInfo (can be null) if (friendlyName == null) throw new System.ArgumentNullException ("friendlyName"); if (info == null) - throw new System.ArgumentNullException ("info"); + throw new ArgumentNullException ("info"); // todo: allow setup in the other domain + return (AppDomain) RemotingServices.GetDomainProxy (createDomain (friendlyName, info)); } @@ -667,9 +666,12 @@ namespace System public void SetDynamicBase (string path) { - SetupInformation.DynamicBase = path; + SetupInformationNoCopy.DynamicBase = path; } +#if NET_2_0 + [Obsolete ("")] +#endif public static int GetCurrentThreadId () { return Thread.CurrentThreadId; diff --git a/mcs/class/corlib/System/AppDomainSetup.cs b/mcs/class/corlib/System/AppDomainSetup.cs index 8f7e8c9517e..4347032808c 100755 --- a/mcs/class/corlib/System/AppDomainSetup.cs +++ b/mcs/class/corlib/System/AppDomainSetup.cs @@ -61,6 +61,25 @@ namespace System { } + internal AppDomainSetup (AppDomainSetup setup) + { + application_base = setup.application_base; + application_name = setup.application_name; + cache_path = setup.cache_path; + configuration_file = setup.configuration_file; + dynamic_base = setup.dynamic_base; + license_file = setup.license_file; + private_bin_path = setup.private_bin_path; + private_bin_path_probe = setup.private_bin_path_probe; + shadow_copy_directories = setup.shadow_copy_directories; + shadow_copy_files = setup.shadow_copy_files; + publisher_policy = setup.publisher_policy; + path_changed = setup.path_changed; + loader_optimization = setup.loader_optimization; + disallow_binding_redirects = setup.disallow_binding_redirects; + disallow_code_downloads = setup.disallow_code_downloads; + } + static string GetAppBase (string appBase) { if (appBase == null) return null; diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog index b345b93f069..e46b702c1d4 100644 --- a/mcs/class/corlib/System/ChangeLog +++ b/mcs/class/corlib/System/ChangeLog @@ -1,3 +1,87 @@ +2004-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AppDomain.cs: backported fixes related to SetupInformation in HEAD. + Closes bug #68859. + * AppDomainSetup.cs: added copy constructor. + +2004-10-24 Fawad Halim <fawad@fawad.net> + * Environment.cs: If an Environment variable value isn't found, leave + the trailing % of the reference for further matches. + Add text between end of current lookup window and next % match if we + just got a match, or add all text to the end if there are no further % + matches. + This fixes bug #64995. + +2004-10-19 Lluis Sanchez <lluis@novell.com> + + * MarshalByRefObject.cs: Field _identity is not serializable. + This fixes bug #68567. + +2004-10-08 Zoltan Varga <vargaz@freemail.hu> + + * Convert.cs (ToType): Throw an exception when converting null to a + valuetype. Fixes #67780. + +2004-10-08 Atsushi Enomoto <atsushi@ximian.com> + + * DateTime.cs : Removed incorrectly injected HEAD fix. + +2004-10-08 Atsushi Enomoto <atsushi@ximian.com> + + * DateTime.cs : When it it not exact parse, 'Z' is allowed as a suffix + of m/s/t/z. This fixes bug 66723. + +2004-10-04 Zoltan Varga <vargaz@freemail.hu> + + * AppDomain.cs: Make ThreadStatic variables static. Fixes #56614. + +2004-09-30 Geoff Norton <gnorton@customerdna.com> + + * Convert.cs: ConvertToBase* was not endian aware. Implemented EndianSwap + and swapping of all values before going into the BitConverter so that values + are returned with proper endianess. + +2004-09-23 Martin Garton <martin@wrasse.demon.co.uk> + + * Convert.cs: ToType was returning unconverted object when it should + fail with an ArgumentException. + +2004-09-19 Dick Porter <dick@ximian.com> + + * Console.cs: Use the internal wrappers for StreamReader and + StreamWriter that catch IOException. + +2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net> + + * Activator.cs (CreateInstance): If an argument is null, + do not call GetType () on it. #63852 + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Environment.cs: (ExpandEnvironmentVariables) don't nullify the case + insensitive environment variables hashtable once we create it. + +2004-08-19 Atsushi Enomoto <atsushi@ximian.com> + + * DateTime.cs : When hour format is "hh", MS.NET (maybe incorrectly) + allows 12, that should not be accepted (13 is rejected) and + interpreted as 0. This fixes bug 63376. + +2004-08-17 Sebastien Pouliot <sebastien@ximian.com> + + * Version.cs: Fixed Clone so we can use it on versions with only + major/minor or major/minor/build. + +2004-07-07 Geoff Norton <gnorton@customerdna.com> + + * Monotype.cs: Patch for bug #58844. Dont throw exceptions right away; + pass through all the possibly BindingInfo's and keep a bool value as to the type + of exception we might need to throw; + +2004-07-07 Geoff Norton <gnorton@customerdna.com> + + * Patch to fix bug #58973 + 2004-06-25 Ben Maurer <bmaurer@ximian.com> * Environment.cs: GetFolderPath has new behavior. r=miguel diff --git a/mcs/class/corlib/System/Console.cs b/mcs/class/corlib/System/Console.cs index 8a0830a7328..f71b4069c43 100644 --- a/mcs/class/corlib/System/Console.cs +++ b/mcs/class/corlib/System/Console.cs @@ -63,15 +63,15 @@ namespace System encoding = Encoding.Default; } - stderr = new StreamWriter (OpenStandardError (0), encoding); + stderr = new UnexceptionalStreamWriter (OpenStandardError (0), encoding); ((StreamWriter)stderr).AutoFlush = true; stderr = TextWriter.Synchronized (stderr, true); - stdout = new StreamWriter (OpenStandardOutput (0), encoding); + stdout = new UnexceptionalStreamWriter (OpenStandardOutput (0), encoding); ((StreamWriter)stdout).AutoFlush = true; stdout = TextWriter.Synchronized (stdout, true); - stdin = new StreamReader (OpenStandardInput (0), encoding); + stdin = new UnexceptionalStreamReader (OpenStandardInput (0), encoding); stdin = TextReader.Synchronized (stdin); } diff --git a/mcs/class/corlib/System/Convert.cs b/mcs/class/corlib/System/Convert.cs index f63481831c5..5e15d578704 100644 --- a/mcs/class/corlib/System/Convert.cs +++ b/mcs/class/corlib/System/Convert.cs @@ -2559,8 +2559,18 @@ namespace System { return (long) result;
}
+ private static void EndianSwap (ref byte[] value) + { + byte[] buf = new byte[value.Length]; + for (int i = 0; i < value.Length; i++) + buf[i] = value[value.Length-1-i]; + value = buf; + } + private static string ConvertToBase2 (byte[] value) { + if (!BitConverter.IsLittleEndian) + EndianSwap (ref value); StringBuilder sb = new StringBuilder (); for (int i = value.Length - 1; i >= 0; i--) { byte b = value [i]; @@ -2580,6 +2590,8 @@ namespace System { private static string ConvertToBase8 (byte[] value)
{ + if (!BitConverter.IsLittleEndian) + EndianSwap (ref value); ulong l = 0; switch (value.Length) { case 1: @@ -2612,6 +2624,8 @@ namespace System { private static string ConvertToBase16 (byte[] value) { + if (!BitConverter.IsLittleEndian) + EndianSwap (ref value); StringBuilder sb = new StringBuilder (); for (int i = value.Length - 1; i >= 0; i--) { char high = (char)((value[i] >> 4) & 0x0f); @@ -2672,8 +2686,12 @@ namespace System { internal static object ToType (object value, Type conversionType,
IFormatProvider provider)
{
- if (value == null)
- return null;
+ if (value == null) { + if ((conversionType != null) && conversionType.IsValueType) + throw new InvalidCastException ("Null object can not be converted to a value type."); + else + return null; + } if (conversionType == null)
throw new InvalidCastException ("Cannot cast to destination type.");
@@ -2739,12 +2757,7 @@ namespace System { else if (conversionType == conversionTable[18]) // 18 TypeCode.String
return (object) convertValue.ToString (provider);
else {
- try {
- return (object) convertValue;
- }
- catch {
- throw new ArgumentException (Locale.GetText ("Unknown target conversion type"));
- }
+ throw new ArgumentException (Locale.GetText ("Unknown target conversion type"));
}
} else
// Not in the conversion table
diff --git a/mcs/class/corlib/System/DateTime.cs b/mcs/class/corlib/System/DateTime.cs index cb90d719a98..188d0d27bd4 100644 --- a/mcs/class/corlib/System/DateTime.cs +++ b/mcs/class/corlib/System/DateTime.cs @@ -1007,8 +1007,10 @@ namespace System num = 1; } - if (hour >= 12) + if (hour > 12) return false; + if (hour == 12) + hour = 0; break; case 'H': @@ -1188,6 +1190,22 @@ namespace System s = s.Substring (num_parsed); + if (!exact) { + switch (chars [pos]) { + case 'm': + case 's': + case 'f': + case 'z': + if (s.Length > 0 && s [0] == 'Z' + && (pos + 1 == chars.Length + || chars [pos + 1] != 'Z')) { + useutc = true; + s = s.Substring (1); + } + break; + } + } + pos = pos + num + 1; num = 0; } diff --git a/mcs/class/corlib/System/Double.cs b/mcs/class/corlib/System/Double.cs index a52c482792a..47f0d406531 100644 --- a/mcs/class/corlib/System/Double.cs +++ b/mcs/class/corlib/System/Double.cs @@ -207,6 +207,10 @@ namespace System { for (; sidx < len; sidx++){ c = s [sidx]; + if (c == '\0') { + sidx = len; + continue; + } switch (state){ case State_AllowSign: if ((style & NumberStyles.AllowLeadingSign) != 0){ diff --git a/mcs/class/corlib/System/Environment.cs b/mcs/class/corlib/System/Environment.cs index bf213ff4cb7..ce47f09ee6e 100644 --- a/mcs/class/corlib/System/Environment.cs +++ b/mcs/class/corlib/System/Environment.cs @@ -290,8 +290,8 @@ namespace System PlatformID platform = Platform; StringBuilder result = new StringBuilder (); result.Append (name, 0, off1); + Hashtable tbl = null; do { - Hashtable tbl = null; string var = name.Substring (off1 + 1, off2 - off1 - 1); string value = GetEnvironmentVariable (var); if (value == null && (int) platform != 128) { @@ -301,29 +301,40 @@ namespace System value = tbl [var] as string; } - + + // If value not found, add %FOO to stream, + // and use the closing % for the next iteration. + // If value found, expand it in place of %FOO% if (value == null) { result.Append ('%'); result.Append (var); - result.Append ('%'); + off2--; } else { result.Append (value); } - - if (off2 + 1 == len) { - off1 = off2; - off2 = -1; - } else { - off1 = off2 + 1; - off2 = (off1 + 1 == len) ? -1 : name.IndexOf ('%', off1 + 1); - } - - } while (off2 != -1); - - if (off1 + 1 < len) - result.Append (name.Substring (off1)); - + int oldOff2 = off2; + off1 = name.IndexOf ('%', off2 + 1); + // If no % found for off1, don't look for one for off2 + off2 = (off1 == -1 || off2 > len-1)? -1 :name.IndexOf ('%', off1 + 1); + // textLen is the length of text between the closing % of current iteration + // and the starting % of the next iteration if any. This text is added to output + int textLen; + // If no new % found, use all the remaining text + if (off1 == -1 || off2 == -1) + textLen = len - oldOff2 - 1; + // If value found in current iteration, use text after current closing % and next % + else if(value != null) + textLen = off1 - oldOff2 - 1; + // If value not found in current iteration, but a % was found for next iteration, + // use text from current closing % to the next %. + else + textLen = off1 - oldOff2; + if(off1 >= oldOff2 || off1 == -1) + result.Append (name.Substring (oldOff2+1, textLen)); + } while (off2 > -1 && off2 < len); + return result.ToString (); + } /// <summary> diff --git a/mcs/class/corlib/System/MarshalByRefObject.cs b/mcs/class/corlib/System/MarshalByRefObject.cs index baad6647011..ea6ef411f5a 100644 --- a/mcs/class/corlib/System/MarshalByRefObject.cs +++ b/mcs/class/corlib/System/MarshalByRefObject.cs @@ -40,6 +40,7 @@ namespace System [Serializable] public abstract class MarshalByRefObject { + [NonSerialized] private ServerIdentity _identity; // Holds marshalling iformation of the object protected MarshalByRefObject () diff --git a/mcs/class/corlib/System/MonoType.cs b/mcs/class/corlib/System/MonoType.cs index a04eeb93877..395332cf459 100644 --- a/mcs/class/corlib/System/MonoType.cs +++ b/mcs/class/corlib/System/MonoType.cs @@ -340,22 +340,26 @@ namespace System name = attr.MemberName; } bool ignoreCase = (invokeAttr & BindingFlags.IgnoreCase) != 0; + bool throwMissingMethodException = false; + bool throwMissingFieldException = false; if ((invokeAttr & BindingFlags.InvokeMethod) != 0) { MethodInfo[] methods = GetMethodsByName (name, invokeAttr, ignoreCase, this); object state = null; MethodBase m = binder.BindToMethod (invokeAttr, methods, ref args, modifiers, culture, namedParameters, out state); - if (m == null) - throw new MissingMethodException (); - object result = m.Invoke (target, invokeAttr, binder, args, culture); - binder.ReorderArgumentArray (ref args, state); - return result; + if (m == null) { + throwMissingMethodException = true; + } else { + object result = m.Invoke (target, invokeAttr, binder, args, culture); + binder.ReorderArgumentArray (ref args, state); + return result; + } } if ((invokeAttr & BindingFlags.GetField) != 0) { FieldInfo f = GetField (name, invokeAttr); if (f != null) { return f.GetValue (target); } else if ((invokeAttr & BindingFlags.GetProperty) == 0) { - throw new MissingFieldException (); + throwMissingFieldException = true; } /* try GetProperty */ } else if ((invokeAttr & BindingFlags.SetField) != 0) { @@ -364,7 +368,7 @@ namespace System f.SetValue (target, args [0]); return null; } else if ((invokeAttr & BindingFlags.SetProperty) == 0) { - throw new MissingFieldException (); + throwMissingFieldException = true; } /* try SetProperty */ } @@ -384,11 +388,13 @@ namespace System smethods [count++] = mb; } MethodBase m = binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state); - if (m == null) - throw new MissingFieldException (); - object result = m.Invoke (target, invokeAttr, binder, args, culture); - binder.ReorderArgumentArray (ref args, state); - return result; + if (m == null) { + throwMissingFieldException = true; + } else { + object result = m.Invoke (target, invokeAttr, binder, args, culture); + binder.ReorderArgumentArray (ref args, state); + return result; + } } else if ((invokeAttr & BindingFlags.SetProperty) != 0) { PropertyInfo[] properties = GetPropertiesByName (name, invokeAttr, ignoreCase, this); object state = null; @@ -405,12 +411,19 @@ namespace System smethods [count++] = mb; } MethodBase m = binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state); - if (m == null) - throw new MissingFieldException (); - object result = m.Invoke (target, invokeAttr, binder, args, culture); - binder.ReorderArgumentArray (ref args, state); - return result; + if (m == null) { + throwMissingFieldException = true; + } else { + object result = m.Invoke (target, invokeAttr, binder, args, culture); + binder.ReorderArgumentArray (ref args, state); + return result; + } } + if (throwMissingMethodException) + throw new MissingMethodException(); + if (throwMissingFieldException) + throw new MissingFieldException(); + return null; } diff --git a/mcs/class/corlib/System/Random.cs b/mcs/class/corlib/System/Random.cs index 3bc3e23498b..e730865d76e 100644 --- a/mcs/class/corlib/System/Random.cs +++ b/mcs/class/corlib/System/Random.cs @@ -74,7 +74,7 @@ namespace System } } inext = 0; - inextp = 21; + inextp = 31; } protected virtual double Sample () diff --git a/mcs/class/corlib/System/Version.cs b/mcs/class/corlib/System/Version.cs index ea64cde7080..adc86fa5568 100644 --- a/mcs/class/corlib/System/Version.cs +++ b/mcs/class/corlib/System/Version.cs @@ -152,7 +152,12 @@ namespace System public object Clone () { - return new Version (_Major, _Minor, _Build, _Revision); + if (_Build == -1) + return new Version (_Major, _Minor); + else if (_Revision == -1) + return new Version (_Major, _Minor, _Build); + else + return new Version (_Major, _Minor, _Build, _Revision); } public int CompareTo (object version) diff --git a/mcs/class/corlib/Test/System.Collections/ChangeLog b/mcs/class/corlib/Test/System.Collections/ChangeLog index 5e7760f0fad..885360ab080 100644 --- a/mcs/class/corlib/Test/System.Collections/ChangeLog +++ b/mcs/class/corlib/Test/System.Collections/ChangeLog @@ -1,3 +1,7 @@ +2004-07-28 Dick Porter <dick@ximian.com> + + * ComparerTest.cs: Test for invariant compares (bug 61458.) + 2004-06-14 Sebastien Pouliot <sebastien@ximian.com> * HashtableTest.cs: Added new case to CopyTo(Array,int) an empty diff --git a/mcs/class/corlib/Test/System.Collections/ComparerTest.cs b/mcs/class/corlib/Test/System.Collections/ComparerTest.cs index c6353f4ec6a..c1591fc3402 100644 --- a/mcs/class/corlib/Test/System.Collections/ComparerTest.cs +++ b/mcs/class/corlib/Test/System.Collections/ComparerTest.cs @@ -42,7 +42,16 @@ namespace MonoTests.System.Collections { Assert(c.Compare (3, 2) > 0);
}
-
+ + [Test] + public void Invariant () + { + Comparer c = Comparer.DefaultInvariant; + + Assert (c.Compare ("a", "A") > 0); + } + + }
}
diff --git a/mcs/class/corlib/Test/System.Reflection/ChangeLog b/mcs/class/corlib/Test/System.Reflection/ChangeLog index 2c5110a6ee3..fd367c75537 100644 --- a/mcs/class/corlib/Test/System.Reflection/ChangeLog +++ b/mcs/class/corlib/Test/System.Reflection/ChangeLog @@ -1,3 +1,7 @@ +2004-07-03 Zoltan Varga <vargaz@freemail.hu> + + * ModuleTest.cs: New tests for FindTypes. + 2004-06-10 Lluis Sanchez <lluis@ximian.com> * AssemblyNameTest.cs: AssertEqualsByteArrays(): don't crash if arrays are diff --git a/mcs/class/corlib/Test/System/ChangeLog b/mcs/class/corlib/Test/System/ChangeLog index b271ba154f9..6d419bfee33 100644 --- a/mcs/class/corlib/Test/System/ChangeLog +++ b/mcs/class/corlib/Test/System/ChangeLog @@ -1,3 +1,13 @@ +2004-09-23 Martin Garton <martin@wrasse.demon.co.uk> + + * ConvertTest.cs: Ensure ToType() fails with an ArgumentException in + a case where is cannot convert. + +2004-08-17 Sebastien Pouliot <sebastien@ximian.com> + + * VersionTest.cs: Added tests when cloning a version with no build and + no revision numbers (-1). + 2004-06-23 Sebastien Pouliot <sebastien@ximian.com> * DoubleFormatterTest.cs: Added a new test for a negative roundtrip diff --git a/mcs/class/corlib/Test/System/ConvertTest.cs b/mcs/class/corlib/Test/System/ConvertTest.cs index bafdffdb566..44e5f547567 100755 --- a/mcs/class/corlib/Test/System/ConvertTest.cs +++ b/mcs/class/corlib/Test/System/ConvertTest.cs @@ -189,7 +189,17 @@ namespace MonoTests.System { } catch (Exception e) { AssertEquals("#A33", typeof(ArgumentNullException), e.GetType()); - } + } + + try { + /* should fail to convert string to any enumeration type. */ + Convert.ChangeType("random string", typeof(DayOfWeek)); + Fail(); + } + catch (Exception e) { + AssertEquals("#A34", typeof(ArgumentException), e.GetType()); + } + } public void TestGetTypeCode() { diff --git a/mcs/class/corlib/Test/System/VersionTest.cs b/mcs/class/corlib/Test/System/VersionTest.cs index 635a485cadc..2467d963a48 100644 --- a/mcs/class/corlib/Test/System/VersionTest.cs +++ b/mcs/class/corlib/Test/System/VersionTest.cs @@ -135,6 +135,12 @@ public class VersionTest : TestCase Assert ("A1", v1.Equals (v2)); Assert ("A2", !ReferenceEquals (v1, v2)); + + Version v3 = new Version (); // 0.0 + v2 = (Version) v3.Clone (); + + Assert ("A3", v3.Equals (v2)); + Assert ("A4", !ReferenceEquals (v3, v2)); } public void TestCompareTo () diff --git a/mcs/class/corlib/corlib.dll.sources b/mcs/class/corlib/corlib.dll.sources index 4a49234f3f2..c1a958a1308 100755 --- a/mcs/class/corlib/corlib.dll.sources +++ b/mcs/class/corlib/corlib.dll.sources @@ -307,6 +307,8 @@ System.IO/StringReader.cs System.IO/StringWriter.cs System.IO/TextReader.cs System.IO/TextWriter.cs +System.IO/UnexceptionalStreamReader.cs +System.IO/UnexceptionalStreamWriter.cs System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs System.IO.IsolatedStorage/IsolatedStorage.cs System.IO.IsolatedStorage/IsolatedStorageException.cs diff --git a/mcs/ilasm/AssemblyInfo.cs b/mcs/ilasm/AssemblyInfo.cs index f3025174070..8a90ef2489c 100644 --- a/mcs/ilasm/AssemblyInfo.cs +++ b/mcs/ilasm/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; -[assembly: AssemblyVersion("0.28.0")] +[assembly: AssemblyVersion("1.0.4")] [assembly: AssemblyTitle ("Mono ILasm Compiler")] [assembly: AssemblyDescription ("Mono ILasm Compiler")] [assembly: AssemblyCopyright ("Sergey Chaban and Jackson Harper")] diff --git a/mcs/mcs/AssemblyInfo.cs b/mcs/mcs/AssemblyInfo.cs index b96fc0ad63f..4615e826ee0 100644 --- a/mcs/mcs/AssemblyInfo.cs +++ b/mcs/mcs/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; -[assembly: AssemblyVersion("0.96")] +[assembly: AssemblyVersion("1.0.4")] [assembly: AssemblyTitle ("Mono C# Compiler")] [assembly: AssemblyDescription ("Mono C# Compiler")] [assembly: AssemblyCopyright ("2001, 2002, 2003 Ximian, Inc.")] diff --git a/mcs/mcs/ChangeLog b/mcs/mcs/ChangeLog index 0e090e70feb..f6eee2c2074 100755 --- a/mcs/mcs/ChangeLog +++ b/mcs/mcs/ChangeLog @@ -1,3 +1,153 @@ +2004-10-04 Juraj Skripsky <js@hotfeet.ch> + + * namespace.cs (NamespaceEntry.Using): No matter which warning + level is set, check if this namespace name has already been added. + +2004-10-03 Ben Maurer <bmaurer@ximian.com> + + * expression.cs: reftype [!=]= null should always use br[true,false]. + # 67410 + +2004-09-19 Miguel de Icaza <miguel@ximian.com> + + * cs-parser.jay: Do not report the stack trace, it is useless + anyways for the production compiler. + +2004-09-15 Raja R Harinath <rharinath@novell.com> + + * cs-parser.jay (fixed_statement): Introduce a scope for the + declaration in a 'fixed' statement. + +2004-09-10 Raja R Harinath <rharinath@novell.com> + + Fix test-290.cs. + * cs-parser.jay (delegate_declaration): Record a delegate + declaration as a type declaration. + +2004-09-07 Miguel de Icaza <miguel@ximian.com> + + * expression.cs: Return false if we fail to resolve the inner + expression. + +2004-09-06 Miguel de Icaza <miguel@ximian.com> + + * expression.cs: Report errors with unsafe pointers, fixes #64896 + + +2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net> + + * expression.cs: Pointer arith always needs to do a conv.i + if the operand is a long. fix 65320 + +2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net> + + * PointerArithmetic (Resolve): make sure we are not doing + pointer arith on void*. Also, make sure we are resolved + by not setting eclass until resolve. + + All callers: Make sure that PointerArithmetic gets resolved. + +2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net> + + * ArrayCreation (LookupType): If the type does not resolve + to an array, give an error. + +2004-08-04 Miguel de Icaza <miguel@ximian.com> + + * cfold.cs: Synchronize the folding with the code in expression.cs + Binary.DoNumericPromotions for uint operands. + + +2004-08-03 Ben Maurer <bmaurer@ximian.com> + + * ecore.cs (MethodGroupExpr): new IsBase property. + + * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr. + + * delegate.cs (DelegateCreation): store a MethodGroupExpr + rather than an instance expr. + + (DelegateCreation.Emit): Use the method group rather than + the instance expression. Also, if you have base.Foo as the + method for a delegate, make sure to emit ldftn, not ldftnvirt. + + (ResolveMethodGroupExpr): Use the MethodGroupExpr. + + (NewDelegate.DoResolve): Only check for the existance of Invoke + if the method is going to be needed. Use MethodGroupExpr. + + (NewDelegate.Emit): Remove, DelegateCreation implements this. + + * expression.cs: For pointer arith., make sure to use + the size of the type, not the size of the pointer to + the type. + +2004-08-03 Martin Baulig <martin@ximian.com> + + * expression.cs (Binary.ResolveOperator): Don't abort if we can't + use a user-defined operator; we still need to do numeric + promotions in case one argument is a builtin type and the other + one has an implicit conversion to that type. Fixes #62322. + +2004-07-19 Miguel de Icaza <miguel@ximian.com> + + * expression.cs: Resolve the constant expression before returning + it. Fixes: 61702 + +2004-07-17 Miguel de Icaza <miguel@ximian.com> + + * cs-tokenizer.cs (handle_preprocessing_directive): Do not return + `true' for preprocessing directives that we parse. The return + value indicates whether we should return to regular tokenizing or + not, not whether it was parsed successfully. + + In the past if we were in: #if false ... #line #endif, we would + resume parsing after `#line'. See bug 61604. + * typemanager.cs: Removed an old hack from Gonzalo to get corlib + building: IsEnumType should return true only for enums, not for + enums or System.Enum itself. This fixes #61593. + + Likely what happened is that corlib was wrong: mcs depended on + this bug in some places. The bug got fixed, we had to add the + hack, which caused bug 61593. + + * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack + that was a workaround for the older conditions. + +2004-07-14 Martin Baulig <martin@ximian.com> + + * iterators.cs: Use real error numbers. + +2004-07-14 Martin Baulig <martin@ximian.com> + + * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly + requires this to be a System.Collection.IEnumerable and not a + class implementing that interface. + (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator. + +2004-07-13 Marek Safar <marek.safar@seznam.cz> + + * class.cs: Fixed previous fix, it broke some error tests. + +2004-07-12 Martin Baulig <martin@ximian.com> + + * enum.cs (Enum.Define): Call Emit() to emit the attributes. + Fixes #61293. + +2004-07-09 Miguel de Icaza <miguel@ximian.com> + + * assign.cs (LocalTemporary): Add new argument: is_address,If + `is_address' is true, then the value that we store is the address + to the real value, and not the value itself. + + * ecore.cs (PropertyExpr): use the new local temporary + stuff to allow us to handle X.Y += z (where X is a struct) + +2004-07-08 Martin Baulig <martin@ximian.com> + + * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do + not always return, just like we're doing in Using.Resolve(). + 2004-06-24 Raja R Harinath <rharinath@novell.com> * expression.cs (BetterConversion): Remove buggy special-case @@ -98,12 +248,6 @@ * cs-parser.jay: Added error CS1669 test for indexers. -2004-06-13 Martin Baulig <martin@ximian.com> - - Merged latest changes into gmcs. Please keep this comment in - here, it makes it easier for me to see what changed in MCS since - the last time I merged. - 2004-06-11 Martin Baulig <martin@ximian.com> * expression.cs (Invocation.IsParamsMethodApplicable): We need to diff --git a/mcs/mcs/assign.cs b/mcs/mcs/assign.cs index ecabbcad461..94467b2cabb 100755 --- a/mcs/mcs/assign.cs +++ b/mcs/mcs/assign.cs @@ -55,24 +55,34 @@ namespace Mono.CSharp { /// The local temporary is used to alter the normal flow of code generation /// basically it creates a local variable, and its emit instruction generates /// code to access this value, return its address or save its value. + /// + /// If `is_address' is true, then the value that we store is the address to the + /// real value, and not the value itself. + /// + /// This is needed for a value type, because otherwise you just end up making a + /// copy of the value on the stack and modifying it. You really need a pointer + /// to the origional value so that you can modify it in that location. This + /// Does not happen with a class because a class is a pointer -- so you always + /// get the indirection. + /// + /// The `is_address' stuff is really just a hack. We need to come up with a better + /// way to handle it. /// </remarks> public class LocalTemporary : Expression, IMemoryLocation { LocalBuilder builder; + bool is_address; - public LocalTemporary (EmitContext ec, Type t) + public LocalTemporary (EmitContext ec, Type t) : this (ec, t, false) {} + + public LocalTemporary (EmitContext ec, Type t, bool is_address) { type = t; eclass = ExprClass.Value; loc = Location.Null; - builder = ec.GetTemporaryLocal (t); + builder = ec.GetTemporaryLocal (is_address ? TypeManager.GetReferenceType (t): t); + this.is_address = is_address; } - public void Release (EmitContext ec) - { - ec.FreeTemporaryLocal (builder, type); - builder = null; - } - public LocalTemporary (LocalBuilder b, Type t) { type = t; @@ -80,6 +90,12 @@ namespace Mono.CSharp { loc = Location.Null; builder = b; } + + public void Release (EmitContext ec) + { + ec.FreeTemporaryLocal (builder, type); + builder = null; + } public override Expression DoResolve (EmitContext ec) { @@ -88,17 +104,39 @@ namespace Mono.CSharp { public override void Emit (EmitContext ec) { - ec.ig.Emit (OpCodes.Ldloc, builder); + ILGenerator ig = ec.ig; + + ig.Emit (OpCodes.Ldloc, builder); + // we need to copy from the pointer + if (is_address) + LoadFromPtr (ig, type); } + // NB: if you have `is_address' on the stack there must + // be a managed pointer. Otherwise, it is the type from + // the ctor. public void Store (EmitContext ec) { - ec.ig.Emit (OpCodes.Stloc, builder); + ILGenerator ig = ec.ig; + ig.Emit (OpCodes.Stloc, builder); } public void AddressOf (EmitContext ec, AddressOp mode) { - ec.ig.Emit (OpCodes.Ldloca, builder); + // if is_address, than this is just the address anyways, + // so we just return this. + ILGenerator ig = ec.ig; + + if (is_address) + ig.Emit (OpCodes.Ldloc, builder); + else + ig.Emit (OpCodes.Ldloca, builder); + } + + public bool PointsToAddress { + get { + return is_address; + } } } @@ -386,7 +424,7 @@ namespace Mono.CSharp { // just use `dup' to propagate the result // IAssignMethod am = (IAssignMethod) target; - + if (this is CompoundAssign) am.CacheTemporaries (ec); diff --git a/mcs/mcs/cfold.cs b/mcs/mcs/cfold.cs index 8ffdfb75030..12999eccdd8 100755 --- a/mcs/mcs/cfold.cs +++ b/mcs/mcs/cfold.cs @@ -128,6 +128,9 @@ namespace Mono.CSharp { if (other is SByteConstant || other is ShortConstant || ic != null){ left = left.ToLong (loc); right = right.ToLong (loc); + } else { + left = left.ToUInt (loc); + right = left.ToUInt (loc); } return; diff --git a/mcs/mcs/class.cs b/mcs/mcs/class.cs index ef925659b3d..213b3d671c1 100755 --- a/mcs/mcs/class.cs +++ b/mcs/mcs/class.cs @@ -1835,6 +1835,12 @@ namespace Mono.CSharp { } } + if (enums != null) { + foreach (Enum e in enums) { + e.Emit (this); + } + } + if (Pending != null) if (Pending.VerifyPendingMethods ()) return; diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay index deebef3ae69..347869796dd 100755 --- a/mcs/mcs/cs-parser.jay +++ b/mcs/mcs/cs-parser.jay @@ -1929,11 +1929,12 @@ delegate_declaration SEMICOLON { Location l = lexer.Location; + string name = MakeName ((string) $5); Delegate del = new Delegate (current_namespace, current_container, (Expression) $4, - (int) $2, MakeName ((string) $5), (Parameters) $7, - (Attributes) $1, l); + (int) $2, name, (Parameters) $7, (Attributes) $1, l); CheckDef (current_container.AddDelegate (del), del.Name, l); + RootContext.Tree.RecordDecl (name, del); } | opt_attributes opt_modifiers @@ -1944,12 +1945,14 @@ delegate_declaration SEMICOLON { Location l = lexer.Location; + string name = MakeName ((string) $5); Delegate del = new Delegate ( current_namespace, current_container, - TypeManager.system_void_expr, (int) $2, MakeName ((string) $5), + TypeManager.system_void_expr, (int) $2, name, (Parameters) $7, (Attributes) $1, l); CheckDef (current_container.AddDelegate (del), del.Name, l); + RootContext.Tree.RecordDecl (name, del); } ; @@ -3818,12 +3821,14 @@ fixed_statement type fixed_pointer_declarators CLOSE_PARENS { - Block assign_block = new Block (current_block, Block.Flags.Implicit); ArrayList list = (ArrayList) $4; Expression type = (Expression) $3; Location l = lexer.Location; int top = list.Count; + Block assign_block = new Block (current_block); + current_block = assign_block; + for (int i = 0; i < top; i++){ Pair p = (Pair) list [i]; LocalInfo v; @@ -3835,17 +3840,25 @@ fixed_statement p.First = v; list [i] = p; } - current_block.AddStatement (assign_block); - current_block = assign_block; - oob_stack.Push (assign_block); + oob_stack.Push (l); } embedded_statement { Location l = (Location) oob_stack.Pop (); - oob_stack.Pop (); - $$ = new Fixed ((Expression) $3, (ArrayList) $4, (Statement) $7, l); + Fixed f = new Fixed ((Expression) $3, (ArrayList) $4, (Statement) $7, l); + + if (RootContext.WarningLevel >= 3){ + if ($7 == EmptyStatement.Value) + Report.Warning (642, lexer.Location, "Possible mistaken empty statement"); + } + + current_block.AddStatement (f); + while (current_block.Implicit) + current_block = current_block.Parent; + $$ = current_block; + current_block = current_block.Parent; } ; @@ -4337,7 +4350,7 @@ public override void parse () // Please do not remove this, it is used during debugging // of the grammar // - Console.WriteLine (e); + // Console.WriteLine (e); Report.Error (-25, lexer.Location, "Parsing error"); if (Driver.parser_verbose) Console.WriteLine (e); diff --git a/mcs/mcs/cs-tokenizer.cs b/mcs/mcs/cs-tokenizer.cs index 5191948f407..c3a116bc835 100755 --- a/mcs/mcs/cs-tokenizer.cs +++ b/mcs/mcs/cs-tokenizer.cs @@ -1461,7 +1461,7 @@ namespace Mono.CSharp switch (cmd){
case "pragma":
if (RootContext.V2)
- return true;
+ return caller_is_taking;
break;
case "line":
@@ -1469,7 +1469,7 @@ namespace Mono.CSharp Report.Error (
1576, Location,
"Argument to #line directive is missing or invalid");
- return true;
+ return caller_is_taking;
case "region":
region_directive = true;
diff --git a/mcs/mcs/delegate.cs b/mcs/mcs/delegate.cs index 0965c498f79..8ecc5fb2740 100644 --- a/mcs/mcs/delegate.cs +++ b/mcs/mcs/delegate.cs @@ -644,7 +644,7 @@ namespace Mono.CSharp { public abstract class DelegateCreation : Expression { protected MethodBase constructor_method; protected MethodBase delegate_method; - protected Expression delegate_instance_expr; + protected MethodGroupExpr method_group; public DelegateCreation () {} @@ -670,13 +670,13 @@ namespace Mono.CSharp { public override void Emit (EmitContext ec) { - if (delegate_instance_expr == null || + if (method_group.InstanceExpression == null || delegate_method.IsStatic) ec.ig.Emit (OpCodes.Ldnull); else - delegate_instance_expr.Emit (ec); + method_group.InstanceExpression.Emit (ec); - if (delegate_method.IsVirtual) { + if (delegate_method.IsVirtual && !method_group.IsBase) { ec.ig.Emit (OpCodes.Dup); ec.ig.Emit (OpCodes.Ldvirtftn, (MethodInfo) delegate_method); } else @@ -742,24 +742,22 @@ namespace Mono.CSharp { } if (mg.InstanceExpression != null) - delegate_instance_expr = mg.InstanceExpression.Resolve (ec); - else { - if (ec.IsStatic){ - if (!delegate_method.IsStatic){ - Report.Error (120, loc, - "An object reference is required for the non-static method " + - delegate_method.Name); - return null; - } - delegate_instance_expr = null; - } else - delegate_instance_expr = ec.GetThis (loc); - } + mg.InstanceExpression = mg.InstanceExpression.Resolve (ec); + else if (ec.IsStatic) { + if (!delegate_method.IsStatic) { + Report.Error (120, loc, + "An object reference is required for the non-static method " + + delegate_method.Name); + return null; + } + mg.InstanceExpression = null; + } else + mg.InstanceExpression = ec.GetThis (loc); - if (delegate_instance_expr != null) - if (delegate_instance_expr.Type.IsValueType) - delegate_instance_expr = new BoxedCast (delegate_instance_expr); + if (mg.InstanceExpression != null && mg.InstanceExpression.Type.IsValueType) + mg.InstanceExpression = new BoxedCast (mg.InstanceExpression); + method_group = mg; eclass = ExprClass.Value; return this; } @@ -819,15 +817,6 @@ namespace Mono.CSharp { return null; Argument a = (Argument) Arguments [0]; - - Expression invoke_method = Expression.MemberLookup ( - ec, type, "Invoke", MemberTypes.Method, - Expression.AllBindingFlags, loc); - - if (invoke_method == null) { - Report.Error (-200, loc, "Internal error ! Could not find Invoke method!"); - return null; - } if (!a.ResolveMethodGroup (ec, loc)) return null; @@ -845,36 +834,29 @@ namespace Mono.CSharp { return null; } + method_group = Expression.MemberLookup ( + ec, type, "Invoke", MemberTypes.Method, + Expression.AllBindingFlags, loc) as MethodGroupExpr; + + if (method_group == null) { + Report.Error (-200, loc, "Internal error ! Could not find Invoke method!"); + return null; + } + // This is what MS' compiler reports. We could always choose - // to be more verbose and actually give delegate-level specifics - + // to be more verbose and actually give delegate-level specifics if (!Delegate.VerifyDelegate (ec, type, e_type, loc)) { Report.Error (29, loc, "Cannot implicitly convert type '" + e_type + "' " + "to type '" + type + "'"); return null; } - delegate_instance_expr = e; - delegate_method = ((MethodGroupExpr) invoke_method).Methods [0]; + method_group.InstanceExpression = e; + delegate_method = method_group.Methods [0]; eclass = ExprClass.Value; return this; } - - public override void Emit (EmitContext ec) - { - if (delegate_instance_expr == null || delegate_method.IsStatic) - ec.ig.Emit (OpCodes.Ldnull); - else - delegate_instance_expr.Emit (ec); - - if (delegate_method.IsVirtual) { - ec.ig.Emit (OpCodes.Dup); - ec.ig.Emit (OpCodes.Ldvirtftn, (MethodInfo) delegate_method); - } else - ec.ig.Emit (OpCodes.Ldftn, (MethodInfo) delegate_method); - ec.ig.Emit (OpCodes.Newobj, (ConstructorInfo) constructor_method); - } } public class DelegateInvocation : ExpressionStatement { diff --git a/mcs/mcs/ecore.cs b/mcs/mcs/ecore.cs index f9ef75c6fc1..c78d201fab3 100755 --- a/mcs/mcs/ecore.cs +++ b/mcs/mcs/ecore.cs @@ -2390,6 +2390,7 @@ namespace Mono.CSharp { Expression instance_expression = null; bool is_explicit_impl = false; bool identical_type_name = false; + bool is_base; public MethodGroupExpr (MemberInfo [] mi, Location l) { @@ -2463,6 +2464,15 @@ namespace Mono.CSharp { identical_type_name = value; } } + + public bool IsBase { + get { + return is_base; + } + set { + is_base = value; + } + } public string Name { get { @@ -3226,21 +3236,40 @@ namespace Mono.CSharp { PropertyInfo.DeclaringType + "." +PropertyInfo.Name); return null; } + + // + // Check that we are not making changes to a temporary memory location + // + if (instance_expr != null && instance_expr.Type.IsValueType && !(instance_expr is IMemoryLocation)) { + // FIXME: Provide better error reporting. + Error (1612, "Cannot modify expression because it is not a variable."); + return null; + } + return this; } public override void CacheTemporaries (EmitContext ec) { - if (!is_static) - temporary = new LocalTemporary (ec, instance_expr.Type); + if (!is_static){ + // we need to do indirection on the pointer + bool need_address = instance_expr.Type.IsValueType; + temporary = new LocalTemporary (ec, instance_expr.Type, need_address); + } } Expression EmitInstance (EmitContext ec) { if (temporary != null){ if (!have_temporary){ - instance_expr.Emit (ec); + if (temporary.PointsToAddress){ + // must store the managed pointer + IMemoryLocation loc = instance_expr as IMemoryLocation; + loc.AddressOf (ec, AddressOp.LoadStore); + } else + instance_expr.Emit (ec); temporary.Store (ec); + have_temporary = true; } return temporary; diff --git a/mcs/mcs/enum.cs b/mcs/mcs/enum.cs index ac9ef2b4305..bc84775ad94 100755 --- a/mcs/mcs/enum.cs +++ b/mcs/mcs/enum.cs @@ -685,6 +685,7 @@ namespace Mono.CSharp { default_value = GetNextDefaultValue (default_value); } + return true; } diff --git a/mcs/mcs/expression.cs b/mcs/mcs/expression.cs index 8d2ff2b3aeb..314578e9e9e 100755 --- a/mcs/mcs/expression.cs +++ b/mcs/mcs/expression.cs @@ -2309,14 +2309,12 @@ namespace Mono.CSharp { Type l = left.Type; Type r = right.Type; - bool overload_failed = false; - // // Special cases: string comapred to null // if (oper == Operator.Equality || oper == Operator.Inequality){ - if ((l == TypeManager.string_type && (right is NullLiteral)) || - (r == TypeManager.string_type && (left is NullLiteral))){ + if ((!TypeManager.IsValueType (l) && (right is NullLiteral)) || + (!TypeManager.IsValueType (r) && (left is NullLiteral))) { Type = TypeManager.bool_type; return this; @@ -2361,8 +2359,6 @@ namespace Mono.CSharp { MethodInfo mi = (MethodInfo) method; return new BinaryMethod (mi.ReturnType, method, args); - } else { - overload_failed = true; } } } @@ -2541,16 +2537,16 @@ namespace Mono.CSharp { if (r == l) return new PointerArithmetic ( false, left, right, TypeManager.int64_type, - loc); + loc).Resolve (ec); } else { Expression t = Make32or64 (ec, right); if (t != null) - return new PointerArithmetic (oper == Operator.Addition, left, t, l, loc); + return new PointerArithmetic (oper == Operator.Addition, left, t, l, loc).Resolve (ec); } } else if (r.IsPointer && oper == Operator.Addition){ Expression t = Make32or64 (ec, left); if (t != null) - return new PointerArithmetic (true, right, t, r, loc); + return new PointerArithmetic (true, right, t, r, loc).Resolve (ec); } } @@ -2688,14 +2684,6 @@ namespace Mono.CSharp { } // - // We are dealing with numbers - // - if (overload_failed){ - Error_OperatorCannotBeApplied (); - return null; - } - - // // This will leave left or right set to null if there is an error // bool check_user_conv = is_user_defined (l) && is_user_defined (r); @@ -3422,7 +3410,6 @@ namespace Mono.CSharp { public PointerArithmetic (bool is_addition, Expression l, Expression r, Type t, Location loc) { type = t; - eclass = ExprClass.Variable; this.loc = loc; left = l; right = r; @@ -3431,9 +3418,13 @@ namespace Mono.CSharp { public override Expression DoResolve (EmitContext ec) { - // - // We are born fully resolved - // + eclass = ExprClass.Variable; + + if (left.Type == TypeManager.void_ptr_type) { + Error (242, "The operation in question is undefined on void pointers"); + return null; + } + return this; } @@ -3441,7 +3432,8 @@ namespace Mono.CSharp { { Type op_type = left.Type; ILGenerator ig = ec.ig; - int size = GetTypeSize (TypeManager.GetElementType (op_type)); + Type element = TypeManager.GetElementType (op_type); + int size = GetTypeSize (element); Type rtype = right.Type; if (rtype.IsPointer){ @@ -3454,7 +3446,7 @@ namespace Mono.CSharp { if (size != 1){ if (size == 0) - ig.Emit (OpCodes.Sizeof, op_type); + ig.Emit (OpCodes.Sizeof, element); else IntLiteral.EmitInt (ig, size); ig.Emit (OpCodes.Div); @@ -3469,7 +3461,7 @@ namespace Mono.CSharp { right.Emit (ec); if (size != 1){ if (size == 0) - ig.Emit (OpCodes.Sizeof, op_type); + ig.Emit (OpCodes.Sizeof, element); else IntLiteral.EmitInt (ig, size); if (rtype == TypeManager.int64_type) @@ -3477,8 +3469,11 @@ namespace Mono.CSharp { else if (rtype == TypeManager.uint64_type) ig.Emit (OpCodes.Conv_U8); ig.Emit (OpCodes.Mul); - ig.Emit (OpCodes.Conv_I); } + + if (rtype == TypeManager.int64_type || rtype == TypeManager.uint64_type) + ig.Emit (OpCodes.Conv_I); + if (is_add) ig.Emit (OpCodes.Add); else @@ -3672,7 +3667,7 @@ namespace Mono.CSharp { if (e != null) { local_info.Used = true; eclass = ExprClass.Value; - return e; + return e.Resolve (ec); } VariableInfo variable_info = local_info.VariableInfo; @@ -5846,7 +5841,7 @@ namespace Mono.CSharp { Expression tmp = (Expression) o; tmp = tmp.Resolve (ec); if (tmp == null) - continue; + return false; // Console.WriteLine ("I got: " + tmp); // Handle initialization from vars, fields etc. @@ -6020,10 +6015,12 @@ namespace Mono.CSharp { if (type == null) return false; - - underlying_type = type; - if (underlying_type.IsArray) - underlying_type = TypeManager.GetElementType (underlying_type); + + if (!type.IsArray) { + Error (622, "Can only use array initializer expressions to assign to array types. Try using a new expression instead."); + return false; + } + underlying_type = TypeManager.GetElementType (type); dimensions = type.GetArrayRank (); return true; @@ -6727,6 +6724,10 @@ namespace Mono.CSharp { return null; } + if (typearg.IsPointer && !ec.InUnsafe){ + UnsafeError (loc); + return null; + } CheckObsoleteAttribute (typearg); type = TypeManager.type_type; @@ -7361,7 +7362,7 @@ namespace Mono.CSharp { return true; } - Expression MakePointerAccess () + Expression MakePointerAccess (EmitContext ec) { Type t = Expr.Type; @@ -7375,8 +7376,10 @@ namespace Mono.CSharp { } Expression p; - p = new PointerArithmetic (true, Expr, ((Argument)Arguments [0]).Expr, t, loc); - return new Indirection (p, loc); + p = new PointerArithmetic (true, Expr, ((Argument)Arguments [0]).Expr, t, loc).Resolve (ec); + if (p == null) + return null; + return new Indirection (p, loc).Resolve (ec); } public override Expression DoResolve (EmitContext ec) @@ -7400,7 +7403,7 @@ namespace Mono.CSharp { if (t.IsArray) return (new ArrayAccess (this, loc)).Resolve (ec); else if (t.IsPointer) - return MakePointerAccess (); + return MakePointerAccess (ec); else return (new IndexerAccess (this, loc)).Resolve (ec); } @@ -7414,7 +7417,7 @@ namespace Mono.CSharp { if (t.IsArray) return (new ArrayAccess (this, loc)).ResolveLValue (ec, right_side); else if (t.IsPointer) - return MakePointerAccess (); + return MakePointerAccess (ec); else return (new IndexerAccess (this, loc)).ResolveLValue (ec, right_side); } @@ -7556,7 +7559,7 @@ namespace Mono.CSharp { //Console.WriteLine (new System.Diagnostics.StackTrace ()); is_stobj = false; t = TypeManager.TypeToCoreType (t); - if (TypeManager.IsEnumType (t) && t != TypeManager.enum_type) + if (TypeManager.IsEnumType (t)) t = TypeManager.EnumToUnderlying (t); if (t == TypeManager.byte_type || t == TypeManager.sbyte_type || t == TypeManager.bool_type) @@ -8136,6 +8139,9 @@ namespace Mono.CSharp { pe.IsBase = true; } + + if (e is MethodGroupExpr) + ((MethodGroupExpr) e).IsBase = true; return e; } diff --git a/mcs/mcs/iterators.cs b/mcs/mcs/iterators.cs index 6f2d32ab29e..0b44fd57350 100644 --- a/mcs/mcs/iterators.cs +++ b/mcs/mcs/iterators.cs @@ -42,15 +42,18 @@ namespace Mono.CSharp { public static bool CheckContext (EmitContext ec, Location loc) { if (ec.CurrentBranching.InFinally (true)){ - Report.Error (-208, loc, "yield statement can not appear in finally clause"); + Report.Error (1625, loc, "Cannot yield in the body of a " + + "finally clause"); return false; } if (ec.CurrentBranching.InCatch ()){ - Report.Error (-209, loc, "yield statement can not appear in the catch clause"); + Report.Error (1631, loc, "Cannot yield in the body of a " + + "catch clause"); return false; } if (ec.InAnonymousMethod){ - Report.Error (-209, loc, "yield statement can not appear inside an anonymoud method"); + Report.Error (1621, loc, "yield statement can not appear " + + "inside an anonymoud method"); return false; } @@ -651,12 +654,12 @@ namespace Mono.CSharp { static bool IsIEnumerable (Type t) { - return t == TypeManager.ienumerable_type || TypeManager.ImplementsInterface (t, TypeManager.ienumerable_type); + return t == TypeManager.ienumerable_type; } static bool IsIEnumerator (Type t) { - return t == TypeManager.ienumerator_type || TypeManager.ImplementsInterface (t, TypeManager.ienumerator_type); + return t == TypeManager.ienumerator_type; } // @@ -666,18 +669,17 @@ namespace Mono.CSharp { { if (!(IsIEnumerator (return_type) || IsIEnumerable (return_type))){ Report.Error ( - -205, loc, String.Format ( - "The method `{0}' contains a yield statement, but has an invalid return type for an iterator `{1}'", - name, TypeManager.CSharpName (return_type))); + 1624, loc, "The body of `{0}' cannot be an iterator " + + "block because '{1}' is not an iterator interface type", + name, TypeManager.CSharpName (return_type)); return null; } for (int i = 0; i < parameters.Count; i++){ Parameter.Modifier mod = parameters.ParameterModifier (i); if ((mod & (Parameter.Modifier.REF | Parameter.Modifier.OUT)) != 0){ - Report.Error (-207, loc, String.Format ( - "Parameter {0} of `{1}' is {2} and not allowed for an iterator method", - i+1, name, parameters.ParameterDesc (i))); + Report.Error (1623, loc, "Iterators cannot have ref " + + "or out parameters"); return null; } } diff --git a/mcs/mcs/namespace.cs b/mcs/mcs/namespace.cs index f7f10d3c0f9..ae1317bccd5 100755 --- a/mcs/mcs/namespace.cs +++ b/mcs/mcs/namespace.cs @@ -335,10 +335,10 @@ namespace Mono.CSharp { if (using_clauses == null) using_clauses = new ArrayList (); - foreach (UsingEntry old_entry in using_clauses){ - if (old_entry.Name == ns){ - Report.Warning (105, loc, "The using directive for '" + ns + - "' appeared previously in this namespace"); + foreach (UsingEntry old_entry in using_clauses) { + if (old_entry.Name == ns) { + if (RootContext.WarningLevel >= 3) + Report.Warning (105, loc, "The using directive for '{0}' appeared previously in this namespace", ns); return; } } diff --git a/mcs/mcs/statement.cs b/mcs/mcs/statement.cs index 7b0bcca47ea..8b0db129f82 100755 --- a/mcs/mcs/statement.cs +++ b/mcs/mcs/statement.cs @@ -2734,9 +2734,22 @@ namespace Mono.CSharp { ec.StartFlowBranching (FlowBranching.BranchingType.Exception, loc); bool ok = Statement.Resolve (ec); - ec.EndFlowBranching (); + if (!ok) { + ec.KillFlowBranching (); + return false; + } - return ok; + FlowBranching.Reachability reachability = ec.EndFlowBranching (); + if (reachability.Returns != FlowBranching.FlowReturns.Always) { + // Unfortunately, System.Reflection.Emit automatically emits + // a leave to the end of the finally block. + // This is a problem if `returns' is true since we may jump + // to a point after the end of the method. + // As a workaround, emit an explicit ret here. + ec.NeedReturnLabel (); + } + + return true; } protected override void DoEmit (EmitContext ec) diff --git a/mcs/mcs/typemanager.cs b/mcs/mcs/typemanager.cs index 2c2cb05b669..d488979601f 100755 --- a/mcs/mcs/typemanager.cs +++ b/mcs/mcs/typemanager.cs @@ -1495,7 +1495,7 @@ public class TypeManager { public static bool IsEnumType (Type t) { - if (t == TypeManager.enum_type || t.IsSubclassOf (TypeManager.enum_type)) + if (t.IsSubclassOf (TypeManager.enum_type)) return true; else return false; diff --git a/mcs/nunit20/core/Makefile b/mcs/nunit20/core/Makefile index 4714607c8cd..575e4f0652a 100644 --- a/mcs/nunit20/core/Makefile +++ b/mcs/nunit20/core/Makefile @@ -5,7 +5,7 @@ include ../../build/rules.make LIBRARY = nunit.core.dll LIBRARY_SNK = $(topdir)/nunit.key -LOCAL_MCS_FLAGS= -r:nunit.framework.dll -r:System.dll /d:StronglyNamedAssembly +LOCAL_MCS_FLAGS= -debug -r:nunit.framework.dll -r:System.dll /d:StronglyNamedAssembly NO_TEST = yo EXTRA_DISTFILES = nunit.core.dll.csproj diff --git a/mcs/nunit20/framework/Makefile b/mcs/nunit20/framework/Makefile index 928299815be..2538dc968d2 100644 --- a/mcs/nunit20/framework/Makefile +++ b/mcs/nunit20/framework/Makefile @@ -6,7 +6,7 @@ LIBRARY = NUnit.Framework.dll LIBRARY_NAME = nunit.framework.dll LIBRARY_SNK = $(topdir)/nunit.key -LIB_MCS_FLAGS = /r:System.Xml.dll /r:System.dll /d:StronglyNamedAssembly +LIB_MCS_FLAGS = -debug /r:System.Xml.dll /r:System.dll /d:StronglyNamedAssembly NO_TEST = yo EXTRA_DISTFILES = \ diff --git a/mcs/nunit20/util/Makefile b/mcs/nunit20/util/Makefile index bae83a0198d..8c058cd7a69 100644 --- a/mcs/nunit20/util/Makefile +++ b/mcs/nunit20/util/Makefile @@ -9,7 +9,7 @@ LIBRARY_SNK = $(topdir)/nunit.key LOCAL_MCS_FLAGS= \ /resource:Transform.resources,NUnit.Util.Transform.resources \ -r:nunit.framework.dll -r:nunit.core.dll -r:System.dll \ - -r:System.Xml.dll /d:MONO /d:StronglyNamedAssembly + -r:System.Xml.dll /d:MONO /d:StronglyNamedAssembly -debug NO_TEST = yo EXTRA_DISTFILES = \ diff --git a/mcs/tests/ChangeLog b/mcs/tests/ChangeLog index 0d97986bf11..196e11c13db 100755 --- a/mcs/tests/ChangeLog +++ b/mcs/tests/ChangeLog @@ -1,3 +1,23 @@ +2004-09-15 Raja R Harinath <rharinath@novell.com> + + * test-280.cs: Backport fix from HEAD. + * test-292.cs: New test for #64330. + +2004-09-10 Raja R Harinath <rharinath@novell.com> + + * test-290.cs: New test. + * Makefile (TEST_SOURCES): Add test-290.cs. + +2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net> + + * unsafe-10.cs: new test + +2004-08-03 Ben Maurer <bmaurer@ximian.com> + + * test-283.cs: for 62275. + + * unsafe-9.cs: new test for #62263. + 2004-06-24 Raja R Harinath <rharinath@novell.com> * test-252.cs: Avoid reference to System.dll. diff --git a/mcs/tests/Makefile b/mcs/tests/Makefile index 2ccfb9d1614..79fe1a6aed4 100644 --- a/mcs/tests/Makefile +++ b/mcs/tests/Makefile @@ -43,7 +43,9 @@ TEST_SOURCES = \ test-241 test-242 test-243 test-244 test-245 test-246 test-247 test-248 test-249 test-250 \ test-251 test-252 test-253 test-254 test-255 test-256 test-257 test-258 test-259 test-260 \ test-261 test-262 test-263 test-264 test-265 test-266 test-267 test-268 test-269 test-270 \ - test-271 test-272 test-273 test-274 test-275 test-276 test-277 \ + test-271 test-272 test-273 test-274 test-275 test-276 test-277 test-280 \ + test-283 test-284 test-290 \ + test-292 \ cls-test-0 cls-test-1 cls-test-2 cls-test-3 cls-test-5 cls-test-6 cls-test-7 cls-test-10 \ cls-test-11 cls-test-14 cls-test-15 cls-test-16 @@ -54,7 +56,7 @@ TEST2_SOURCES = \ 2test-1 2test-2 2test-3 2test-4 2test-5 2test-6 UNSAFE_SOURCES = \ - unsafe-1 unsafe-2 unsafe-3 test-58 test-171 unsafe-5 unsafe-6 unsafe-7 unsafe-8 + unsafe-1 unsafe-2 unsafe-3 test-58 test-171 unsafe-5 unsafe-6 unsafe-7 unsafe-8 unsafe-9 unsafe-10 WINDOWS_SOURCES = \ test-50 test-67 diff --git a/mcs/tests/test-280.cs b/mcs/tests/test-280.cs new file mode 100644 index 00000000000..aff2fbb5994 --- /dev/null +++ b/mcs/tests/test-280.cs @@ -0,0 +1,23 @@ +// +// Thisis just a compilation test for bug 61593 +using System; +namespace AppFramework.Util +{ + public class Logic + { + static public bool EnumInSet(Enum anEnum, Enum[] checkSet) + { + foreach(Enum aVal in checkSet) + { + if (aVal == anEnum) + { + return true; + } + } + return false; + } + + static void Main () {} + } +} + diff --git a/mcs/tests/test-283.cs b/mcs/tests/test-283.cs new file mode 100644 index 00000000000..f4b0bc8d06f --- /dev/null +++ b/mcs/tests/test-283.cs @@ -0,0 +1,33 @@ +class X { + public virtual int Foo () { + return 1; + } +} + +class Y : X { + + delegate int D(); + + + D GetIt () { + return new D (base.Foo); + } + + D GetIt2 () { + return base.Foo; + } + + public override int Foo () { + return 0; + } + + static int Main () + { + if (new Y ().GetIt () () == 1 && new Y ().GetIt2 () () == 1) { + System.Console.WriteLine ("good"); + return 0; + } + + return 1; + } +}
\ No newline at end of file diff --git a/mcs/tests/test-284.cs b/mcs/tests/test-284.cs new file mode 100644 index 00000000000..a4830a5c8c2 --- /dev/null +++ b/mcs/tests/test-284.cs @@ -0,0 +1,7 @@ +public class App +{ + public static void Main() + { + object a = uint.MaxValue - ushort.MaxValue; + } +} diff --git a/mcs/tests/test-290.cs b/mcs/tests/test-290.cs new file mode 100644 index 00000000000..905fc6a706f --- /dev/null +++ b/mcs/tests/test-290.cs @@ -0,0 +1,14 @@ +// Distilled from report in http://lists.ximian.com/archives/public/mono-devel-list/2004-September/007777.html + +using System; + +class EntryPoint { + delegate void EventHandler (object sender); + static event EventHandler FooEvent; + static void bar_f (object sender) {} + static void Main () { + if (FooEvent != null) + FooEvent (null); + object bar = new EventHandler (bar_f); + } +} diff --git a/mcs/tests/test-292.cs b/mcs/tests/test-292.cs new file mode 100644 index 00000000000..c67fec01e29 --- /dev/null +++ b/mcs/tests/test-292.cs @@ -0,0 +1,11 @@ +// Compiler options: -unsafe +// Test for bug #64330: A 'fixed' statement should introduce a scope + +unsafe class X { + static int x = 0; + static void Main () { + fixed (void* p = &x) {} + fixed (void* p = &x) {} + } +} + diff --git a/mcs/tools/mono-rpm-helpers/ChangeLog b/mcs/tools/mono-rpm-helpers/ChangeLog index bd401e7ec2a..62229ef09ac 100644 --- a/mcs/tools/mono-rpm-helpers/ChangeLog +++ b/mcs/tools/mono-rpm-helpers/ChangeLog @@ -1,3 +1,19 @@ +2004-09-02 Duncan Mak <duncan@ximian.com> + + * mono-find-provides/mono-find-provides.cs (PrintProvides): Fix + the handling of 2.0 mscorlib. + +2004-08-10 Duncan Mak <duncan@ximian.com> + + * mono-find-requires/mono-find-requires.cs (PrintRequires): Since + assembly versions are not changing with releases, use "=" instead + of ">=" to ensure that 2.0 packages will not be picked over 1.0 packages. + +2004-08-04 Duncan Mak <duncan@ximian.com> + + * mono-find-provides/mono-find-provides.cs: Add a hack to work + around the issue with a 2.0 corlib. + 2004-06-01 Todd Berman <tberman@sevenl.net> * all: move stuff around so that it builds properly. diff --git a/mcs/tools/mono-rpm-helpers/mono-find-provides/mono-find-provides.cs b/mcs/tools/mono-rpm-helpers/mono-find-provides/mono-find-provides.cs index 399ec4eac11..64c29701d60 100644 --- a/mcs/tools/mono-rpm-helpers/mono-find-provides/mono-find-provides.cs +++ b/mcs/tools/mono-rpm-helpers/mono-find-provides/mono-find-provides.cs @@ -29,12 +29,17 @@ class FindProvides { } static void PrintProvides (string s) - { + { try { Assembly a = Assembly.LoadFrom (s); AssemblyName an = a.GetName (); - Console.WriteLine ("mono({0}) = {1}", an.Name, an.Version); + // hack to work around the issue with a 2.0 corlib + if (s.Trim ().EndsWith ("2.0/mscorlib.dll")) + Console.WriteLine ("mono({0}) = {1}", "mscorlib", "2.0.3600.0"); + else + Console.WriteLine ("mono({0}) = {1}", an.Name, an.Version); + } catch {} } } diff --git a/mcs/tools/mono-rpm-helpers/mono-find-requires/mono-find-requires.cs b/mcs/tools/mono-rpm-helpers/mono-find-requires/mono-find-requires.cs index 1e43b45cc68..002d109e397 100644 --- a/mcs/tools/mono-rpm-helpers/mono-find-requires/mono-find-requires.cs +++ b/mcs/tools/mono-rpm-helpers/mono-find-requires/mono-find-requires.cs @@ -33,8 +33,8 @@ class FindRequires { try { Assembly a = Assembly.LoadFrom (s); - foreach (AssemblyName an in a.GetReferencedAssemblies ()) - Console.WriteLine ("mono({0}) >= {1}", an.Name, an.Version); + foreach (AssemblyName an in a.GetReferencedAssemblies ()) + Console.WriteLine ("mono({0}) = {1}", an.Name, an.Version); } catch {} } diff --git a/mcs/tools/mono-xsd/ChangeLog b/mcs/tools/mono-xsd/ChangeLog index af9eaa1f82c..9db45c35ea3 100644 --- a/mcs/tools/mono-xsd/ChangeLog +++ b/mcs/tools/mono-xsd/ChangeLog @@ -1,3 +1,18 @@ +2004-08-16 Atsushi Enomoto <atsushi@ximian.com> + + * NewMonoXSD.cs : /language should support custom assembly qualified + name specification. This fixes bug #63081. + Also fixed usage message. "VB" is considered as valid. + +2004-08-07 Atsushi Enomoto <atsushi@ximian.com> + + * NewMonoXSD.cs : /generator (/g) option didn't work, since it usually + ends with .dll (or .exe) and regarded as mere assembly filename. + +2004-07-12 Lluis Sanchez Gual <lluis@novell.com> + + * NewMonoXSD.cs: Accept files with absolute paths. + 2004-05-07 Atsushi Enomoto <atsushi@ximian.com> * NewMonoXSD.cs : Previous change broke default C# code generation. diff --git a/mcs/tools/mono-xsd/NewMonoXSD.cs b/mcs/tools/mono-xsd/NewMonoXSD.cs index 0ba6ac69584..9c5628c9d00 100755 --- a/mcs/tools/mono-xsd/NewMonoXSD.cs +++ b/mcs/tools/mono-xsd/NewMonoXSD.cs @@ -40,8 +40,10 @@ namespace Mono.Util { " /e /element:NAME Element from schema to generate code for.\n" +
" Multiple elements can be specified.\n" +
" /u /uri:NAME Namespace uri of the elements to generate code for.\n" +
- " /l /language:NAME The language to use for the generated code.\n" +
- " Currently, the only supported language is CS (C#).\n" +
+ " /l /language:NAME The language, or type name of custom CodeDomProvider\n" +
+ " to use for the generated code.\n" +
+ " Shorthand specifiers are: \"CS\" (C#) and \"VB\" (VB.NET).\n" +
+ " For type name, assembly qualified name is required.\n" +
" /g /generator:TYPE Code Generator type name, followed by ','\n" +
" and assembly file name.\n" +
" /o /outputdir:PATH The directory where to generate the code or schemas.\n" +
@@ -110,8 +112,11 @@ namespace Mono.Util { foreach (string arg in args)
{
- if (!arg.StartsWith ("--") && !arg.StartsWith ("/")) {
- if (arg.EndsWith (".dll") || arg.EndsWith (".exe"))
+ if (!arg.StartsWith ("--") && !arg.StartsWith ("/") ||
+ (arg.StartsWith ("/") && arg.IndexOfAny (Path.InvalidPathChars) == -1)
+ )
+ {
+ if ((arg.EndsWith (".dll") || arg.EndsWith (".exe")) && !arg.Substring (1).StartsWith ("generator:") && !arg.Substring (1).StartsWith ("g:"))
{
if (!readingFiles) throw new Exception (incorrectOrder);
assemblies.Add (arg);
@@ -132,7 +137,7 @@ namespace Mono.Util { inference = true;
continue;
}
- else //if (!arg.StartsWith ("/") && !arg.StartsWith ("-"))
+ else if (!arg.StartsWith ("/"))
{
if (!readingFiles) Error (incorrectOrder);
unknownFiles.Add (arg);
@@ -217,6 +222,9 @@ namespace Mono.Util { if (outputDir == null) outputDir = ".";
+ string typename = null;
+ Type generatorType = null;
+
if (language != null) {
switch (language) {
case "CS":
@@ -226,18 +234,20 @@ namespace Mono.Util { provider = new VBCodeProvider ();
break;
default:
- Error (languageNotSupported, language);
+ typename = StripQuot (language);
+
+ generatorType = Type.GetType (typename);
+ if (generatorType == null)
+ Error (generatorTypeNotFound, typename);
break;
}
}
if (providerOption != null) {
string param = providerOption;
- string typename;
- Type generatorType;
int comma = param.IndexOf (',');
if (comma < 0) {
- typename = param;
+ typename = StripQuot (param);
generatorType = Type.GetType (param);
} else {
typename = param.Substring (0, comma);
@@ -253,14 +263,16 @@ namespace Mono.Util { }
if (generatorType == null)
Error (generatorTypeNotFound, typename);
+ }
+ if (generatorType != null) {
if (!generatorType.IsSubclassOf (typeof (CodeDomProvider)))
Error (generatorTypeIsNotCodeGenerator, typename);
try {
provider = (CodeDomProvider) Activator.CreateInstance (generatorType, null);
} catch (Exception ex) {
- Error (generatorThrewException, param);
+ Error (generatorThrewException, generatorType.AssemblyQualifiedName.ToString () + " --> " + ex.Message);
}
- Console.WriteLine ("Loaded custom generator type " + param + " .");
+ Console.WriteLine ("Loaded custom generator type " + generatorType + " .");
}
if (provider == null)
provider = new CSharpCodeProvider ();
@@ -469,5 +481,16 @@ namespace Mono.Util { {
throw new Exception (string.Format(msg,param));
}
+
+ private string StripQuot (string input)
+ {
+ if (input.Length < 2)
+ return input;
+ if (input [0] == '"' && input [input.Length -1] == '"' ||
+ input [0] == '\'' && input [input.Length - 1] == '\'')
+ return input.Substring (1, input.Length - 2);
+ else
+ return language;
+ }
}
}
diff --git a/mcs/tools/security/AssemblyInfo.cs b/mcs/tools/security/AssemblyInfo.cs index c1827893cea..4a98018e772 100644 --- a/mcs/tools/security/AssemblyInfo.cs +++ b/mcs/tools/security/AssemblyInfo.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCompany("Motus Technologies, Novell")] [assembly: AssemblyProduct("Mono Security Tools")] [assembly: AssemblyCopyright("Copyright 2002, 2003 Motus Technologies. Copyright 2004 Novell. BSD licensed.")] -[assembly: AssemblyVersion("0.95.99.0")] +[assembly: AssemblyVersion("1.0.3.0")] //[assembly: AssemblyConfiguration("")] //[assembly: AssemblyTrademark("")] //[assembly: AssemblyCulture("")] diff --git a/mcs/tools/security/ChangeLog b/mcs/tools/security/ChangeLog index f8bbaed6dfd..bc3303e9063 100644 --- a/mcs/tools/security/ChangeLog +++ b/mcs/tools/security/ChangeLog @@ -1,3 +1,22 @@ +2004-10-27 Sebastien Pouliot <sebastien@ximian.com> + + * signcode.cs: -i (url) and -n (description) parameters were inverted. + +2004-09-23 Sebastien Pouliot <sebastien@ximian.com> + + * AssemblyInfo.cs: Updated version to 1.0.3 for next stable release. + * MakeCert.cs: Hack for date parsing problem with Mono. + +2004-09-07 Sebastien Pouliot <sebastien@ximian.com> + + * certmgr.cs: Merge enhancements from HEAD. Now allows users to + manipulate the machine's cert store (not just the user's store). + +2004-08-02 Sebastien Pouliot <sebastien@ximian.com> + + * AssemblyInfo.cs: Update version number for Mono 1.0.1. + * sn.cs: Warn for missing machine.config (if quiet isn't specified). + 2004-06-21 Raja R Harinath <rharinath@novell.com> * sn.cs (ReSign): Return a bool indicating success or failure. diff --git a/mcs/tools/security/MakeCert.cs b/mcs/tools/security/MakeCert.cs index 485608213e7..f55e628717d 100644 --- a/mcs/tools/security/MakeCert.cs +++ b/mcs/tools/security/MakeCert.cs @@ -2,12 +2,14 @@ // MakeCert.cs: makecert clone tool // // Author: -// Sebastien Pouliot (spouliot@motus.com) +// Sebastien Pouliot <sebastien@ximian.com> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) // using System; +using System.Globalization; using System.IO; using System.Reflection; using System.Security.Cryptography; @@ -100,7 +102,6 @@ namespace Mono.Tools { return -1; } - System.IFormatProvider format = new System.Globalization.CultureInfo("en-US", true); string fileName = args [args.Length - 1]; // default values @@ -108,7 +109,7 @@ namespace Mono.Tools { string subject = defaultSubject; string issuer = defaultIssuer; DateTime notBefore = DateTime.Now; - DateTime notAfter = DateTime.Parse ("12/31/2039 23:59:59Z", format); + DateTime notAfter = new DateTime (643445675990000000); // 12/31/2039 23:59:59Z RSA issuerKey = (RSA)RSA.Create (); issuerKey.FromXmlString (MonoTestRootAgency); @@ -169,7 +170,7 @@ namespace Mono.Tools { break; case "-b": // Validity / notBefore - notBefore = DateTime.Parse (args [i++] + " 23:59:59", format); + notBefore = DateTime.Parse (args [i++] + " 23:59:59", CultureInfo.InvariantCulture); break; case "-cy": // basic constraints - autority or end-entity @@ -197,7 +198,7 @@ namespace Mono.Tools { break; case "-e": // Validity / notAfter - notAfter = DateTime.Parse (args [i++] + " 23:59:59", format); + notAfter = DateTime.Parse (args [i++] + " 23:59:59", CultureInfo.InvariantCulture); break; case "-eku": // extendedKeyUsage extension diff --git a/mcs/tools/security/certmgr.cs b/mcs/tools/security/certmgr.cs index af59cc720c4..53bb97d28f5 100755 --- a/mcs/tools/security/certmgr.cs +++ b/mcs/tools/security/certmgr.cs @@ -4,7 +4,7 @@ // Author: // Sebastien Pouliot <sebastien@ximian.com> // -// (C) 2004 Novell (http://www.novell.com) +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) // using System; @@ -51,6 +51,7 @@ namespace Mono.Tools { Console.WriteLine ("\t-crl\tadd/del/put certificate revocation lists"); Console.WriteLine ("\t-ctl\tadd/del/put certificate trust lists [unsupported]"); Console.WriteLine ("other options"); + Console.WriteLine ("\t-m\tuse the machine certificate store (default to user)"); Console.WriteLine ("\t-v\tverbose mode (display status for every steps)"); Console.WriteLine ("\t-?\th[elp]\tDisplay this help message"); } @@ -246,7 +247,8 @@ namespace Mono.Tools { static void Delete (ObjectType type, X509Store store, string file, bool verbose) { - switch (type) { + throw new NotImplementedException ("Delete not yet supported"); +/* switch (type) { case ObjectType.Certificate: break; case ObjectType.CRL: @@ -254,12 +256,13 @@ namespace Mono.Tools { break; default: throw new NotSupportedException (type.ToString ()); - } + }*/ } static void Put (ObjectType type, X509Store store, string file, bool verbose) { - switch (type) { + throw new NotImplementedException ("Put not yet supported"); +/* switch (type) { case ObjectType.Certificate: break; case ObjectType.CRL: @@ -267,7 +270,7 @@ namespace Mono.Tools { break; default: throw new NotSupportedException (type.ToString ()); - } + }*/ } [STAThread] @@ -295,9 +298,12 @@ namespace Mono.Tools { bool verbose = (GetCommand (args [n]) == "V"); if (verbose) n++; + bool machine = (GetCommand (args [n]) == "M"); + if (machine) + n++; string storeName = args [n++]; - X509Store store = GetStoreFromName (storeName, false); + X509Store store = GetStoreFromName (storeName, machine); if (store == null) { Console.WriteLine ("Invalid Store: {0}", storeName); Console.WriteLine ("Valid stores are: {0}, {1}, {2}, {3} and {4}", @@ -312,18 +318,24 @@ namespace Mono.Tools { string file = args [n]; // now action! - switch (action) { + try { + switch (action) { case Action.Add: Add (type, store, file, verbose); break; case Action.Delete: - throw new NotImplementedException ("Delete not yet supported"); - //Delete (type, store, file, verbose); + Delete (type, store, file, verbose); break; case Action.Put: - throw new NotImplementedException ("Put not yet supported"); - //Put (type, store, file, verbose); + Put (type, store, file, verbose); break; + default: + throw new NotSupportedException (action.ToString ()); + } + } + catch (UnauthorizedAccessException) { + Console.WriteLine ("Access to the {0} '{1}' certificate store has been denied.", + (machine ? "machine" : "user"), storeName); } } } diff --git a/mcs/tools/security/signcode.cs b/mcs/tools/security/signcode.cs index 3a8d26693fe..be526f65fce 100755 --- a/mcs/tools/security/signcode.cs +++ b/mcs/tools/security/signcode.cs @@ -108,10 +108,10 @@ namespace Mono.Tools { return 1; } break; - case "-i": + case "-n": af.Description = args [i++]; break; - case "-n": + case "-i": af.Url = new Uri (args [i++]); break; // timestamp options diff --git a/mcs/tools/security/sn.cs b/mcs/tools/security/sn.cs index 7ea5cabd9b1..5127b713790 100644 --- a/mcs/tools/security/sn.cs +++ b/mcs/tools/security/sn.cs @@ -41,7 +41,7 @@ namespace Mono.Tools { static string defaultCSP; - static bool LoadConfig () + static bool LoadConfig (bool quiet) { MethodInfo config = typeof (System.Environment).GetMethod ("GetMachineConfigPath", BindingFlags.Static|BindingFlags.NonPublic); @@ -49,9 +49,15 @@ namespace Mono.Tools { if (config != null) { string path = (string) config.Invoke (null, null); + bool exist = File.Exists (path); + if (!quiet && !exist) + Console.WriteLine ("Couldn't find machine.config"); + StrongNameManager.LoadConfig (path); - return true; + return exist; } + else if (!quiet) + Console.WriteLine ("Couldn't resolve machine.config location (corlib issue)"); // default CSP return false; @@ -294,7 +300,7 @@ namespace Mono.Tools { else Header(); - bool config = LoadConfig (); + bool config = LoadConfig (quiet); StrongName sn = null; AssemblyName an = null; |