From: <car...@us...> - 2006-03-13 12:39:20
|
Revision: 12 Author: carlosga_fb Date: 2006-03-13 04:39:07 -0800 (Mon, 13 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=12&view=rev Log Message: ----------- Modified Paths: -------------- pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.sln pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.sln =================================================================== --- pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.sln 2006-03-13 12:36:17 UTC (rev 11) +++ pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.sln 2006-03-13 12:39:07 UTC (rev 12) @@ -3,8 +3,6 @@ # Visual Studio 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostgreSql.Data.PostgreSqlClient", "PostgreSql\Data\PostgreSql.Data.PostgreSqlClient.csproj", "{9E572C05-CC26-410B-9D2D-8ABCF0E359DA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.csproj", "{69E10F35-093A-4969-A5AA-474ACCBDAD95}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureSocketLayer", "SecureSocketLayer\SecureSocketLayer.csproj", "{8CA6C4CF-1737-4680-8AC7-4D34E3CC35DE}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureSocketLayerTest", "SecureSocketLayerTest\SecureSocketLayerTest.csproj", "{7AFCAB88-9EA7-4263-B339-AB9A05C1C600}" @@ -19,10 +17,6 @@ {9E572C05-CC26-410B-9D2D-8ABCF0E359DA}.Debug|Any CPU.Build.0 = Debug|Any CPU {9E572C05-CC26-410B-9D2D-8ABCF0E359DA}.Release|Any CPU.ActiveCfg = Release|Any CPU {9E572C05-CC26-410B-9D2D-8ABCF0E359DA}.Release|Any CPU.Build.0 = Release|Any CPU - {69E10F35-093A-4969-A5AA-474ACCBDAD95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {69E10F35-093A-4969-A5AA-474ACCBDAD95}.Debug|Any CPU.Build.0 = Debug|Any CPU - {69E10F35-093A-4969-A5AA-474ACCBDAD95}.Release|Any CPU.ActiveCfg = Release|Any CPU - {69E10F35-093A-4969-A5AA-474ACCBDAD95}.Release|Any CPU.Build.0 = Release|Any CPU {8CA6C4CF-1737-4680-8AC7-4D34E3CC35DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8CA6C4CF-1737-4680-8AC7-4D34E3CC35DE}.Debug|Any CPU.Build.0 = Debug|Any CPU {8CA6C4CF-1737-4680-8AC7-4D34E3CC35DE}.Release|Any CPU.ActiveCfg = Release|Any CPU Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-03-13 13:04:18
|
Revision: 13 Author: carlosga_fb Date: 2006-03-13 05:03:54 -0800 (Mon, 13 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=13&view=rev Log Message: ----------- Bring sources to a buildable state Modified Paths: -------------- pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/X509ChainValidator.cs pgsqlclient/source/SecureSocketLayer/Net/Security/SslStream.cs pgsqlclient/source/SecureSocketLayerTest/SecureSocketLayerTest.csproj Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/X509ChainValidator.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/X509ChainValidator.cs 2006-03-13 12:39:07 UTC (rev 12) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/X509ChainValidator.cs 2006-03-13 13:03:54 UTC (rev 13) @@ -26,6 +26,7 @@ using System.Collections; using System.Globalization; using System.Security.Authentication; +using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Text.RegularExpressions; @@ -115,68 +116,84 @@ return true; } - KeyUsages ku = KeyUsages.none; + X509KeyUsageFlags ku = X509KeyUsageFlags.None; switch (cipherSuite.ExchangeAlgorithmType) { case ExchangeAlgorithmType.RsaSign: - ku = KeyUsages.digitalSignature; + ku = X509KeyUsageFlags.DigitalSignature; break; case ExchangeAlgorithmType.RsaKeyX: - ku = KeyUsages.keyEncipherment; + ku = X509KeyUsageFlags.KeyEncipherment; break; case ExchangeAlgorithmType.DiffieHellman: - ku = KeyUsages.keyAgreement; + ku = X509KeyUsageFlags.KeyAgreement; break; } - KeyUsageExtension kux = null; - ExtendedKeyUsageExtension eku = null; + X509KeyUsageExtension kux = null; + X509EnhancedKeyUsageExtension eku = null; - X509Extension xtn = cert.Extensions ["2.5.29.15"]; + X509Extension xtn = cert.Extensions["2.5.29.15"]; if (xtn != null) { - kux = new KeyUsageExtension(xtn); - } + kux = new X509KeyUsageExtension(xtn, xtn.Critical); + } - xtn = cert.Extensions ["2.5.29.37"]; + xtn = cert.Extensions["2.5.29.37"]; if (xtn != null) { - eku = new ExtendedKeyUsageExtension(xtn); + eku = new X509EnhancedKeyUsageExtension(xtn, xtn.Critical); } - if ((kux != null) && (eku != null)) + if (kux != null && eku != null) { // RFC3280 states that when both KeyUsageExtension and // ExtendedKeyUsageExtension are present then BOTH should // be valid - return(kux.Support(ku) && - eku.KeyPurpose.Contains("1.3.6.1.5.5.7.3.1")); + return ((kux.KeyUsages & ku) == ku && this.CheckEnhacedKeyUsage(eku, "1.3.6.1.5.5.7.3.1")); } else if (kux != null) { - return kux.Support(ku); + return ((kux.KeyUsages & ku) == ku); } else if (eku != null) { // Server Authentication(1.3.6.1.5.5.7.3.1) - return eku.KeyPurpose.Contains("1.3.6.1.5.5.7.3.1"); + // return eku.EnhancedKeyUsages.Contains("1.3.6.1.5.5.7.3.1"); + return this.CheckEnhacedKeyUsage(eku, "1.3.6.1.5.5.7.3.1"); } // last chance - try with older(deprecated) Netscape extensions xtn = cert.Extensions ["2.16.840.1.113730.1.1"]; if (xtn != null) { +#warning Change this + /* NetscapeCertTypeExtension ct = new NetscapeCertTypeExtension(xtn); return ct.Support(NetscapeCertTypeExtension.CertTypes.SslServer); + */ } // certificate isn't valid for SSL server usage return false; } + private bool CheckEnhacedKeyUsage(X509EnhancedKeyUsageExtension extension, string oid) + { + foreach (Oid keyUsage in extension.EnhancedKeyUsages) + { + if (keyUsage.FriendlyName == oid) + { + return true; + } + } + + return false; + } + // RFC2818 - HTTP Over TLS, Section 3.1 // http://www.ietf.org/rfc/rfc2818.txt // @@ -189,32 +206,42 @@ // 3.1 Existing practice but DEPRECATED private bool CheckServerIdentity(X509Certificate cert, string targetHost) { - X509Extension ext = cert.Extensions ["2.5.29.17"]; + X509Extension ext = ((X509Certificate2)cert).Extensions["2.5.29.17"]; // 1. subjectAltName if (ext != null) { - SubjectAltNameExtension subjectAltName = new SubjectAltNameExtension(ext); + X500DistinguishedName subjectName = new X500DistinguishedName(ext.RawData); + X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension(ext, ext.Critical); - // 1.1 - multiple dNSName - foreach (string dns in subjectAltName.DNSNames) +#warning Fix this + /* + SubjectAltNameExtension subjectAltName = new SubjectAltNameExtension(); + + // 1.1 - multiple DNSName + foreach (string dns in subjectName.DNSNames) { // 1.2 TODO - wildcard support - if (dns == targetHost) - return true; + if (dns == targetHost) + { + return true; + } } // 2. ipAddress foreach (string ip in subjectAltName.IPAddresses) { // 2.1. Exact match required - if (ip == targetHost) - return true; + if (ip == targetHost) + { + return true; + } } + */ } // 3. Common Name(CN=) - return this.CheckDomainName(cert.SubjectName, targetHost); + return this.CheckDomainName(cert.Subject, targetHost); } private bool CheckDomainName(string subjectName, string targetHost) Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/SslStream.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/SslStream.cs 2006-03-13 12:39:07 UTC (rev 12) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/SslStream.cs 2006-03-13 13:03:54 UTC (rev 13) @@ -367,7 +367,6 @@ clientCertificateRequired, sslProtocolType, checkCertificateRevocation); - this.session.InputStream = this.recordStream; } } @@ -474,6 +473,7 @@ { try { + /* // If actual buffer is full readed reset it if (this.inputBuffer.Position == this.inputBuffer.Length && this.inputBuffer.Length > 0) @@ -502,6 +502,7 @@ // return the record(s) to the caller asyncResult = rd.BeginInvoke(buffer, offset, count, callback, state); + */ } catch (SecureException) { @@ -584,11 +585,9 @@ throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginRead."); } - recordEvent.Reset(); + return this.InnerStream.EndRead(asyncResult); + } - return this.rd.EndInvoke(asyncResult); - } - public override void EndWrite(IAsyncResult asyncResult) { this.CheckDisposed(); @@ -598,7 +597,7 @@ throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginRead."); } - this.innerStream.EndWrite(asyncResult); + this.InnerStream.EndWrite(asyncResult); } #endregion Modified: pgsqlclient/source/SecureSocketLayerTest/SecureSocketLayerTest.csproj =================================================================== --- pgsqlclient/source/SecureSocketLayerTest/SecureSocketLayerTest.csproj 2006-03-13 12:39:07 UTC (rev 12) +++ pgsqlclient/source/SecureSocketLayerTest/SecureSocketLayerTest.csproj 2006-03-13 13:03:54 UTC (rev 13) @@ -9,6 +9,7 @@ <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>SecureSocketLayerTest</RootNamespace> <AssemblyName>SecureSocketLayerTest</AssemblyName> + <StartupObject>SecureSocketsLayer.Test.Class1</StartupObject> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-03-13 13:11:49
|
Revision: 14 Author: carlosga_fb Date: 2006-03-13 05:11:23 -0800 (Mon, 13 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=14&view=rev Log Message: ----------- More changes to build correctly Modified Paths: -------------- pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj pgsqlclient/source/SecureSocketLayerTest/Program.cs pgsqlclient/source/SecureSocketLayerTest/SecureSocketLayerTest.csproj Modified: pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-03-13 13:03:54 UTC (rev 13) +++ pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-03-13 13:11:23 UTC (rev 14) @@ -132,4 +132,10 @@ <ItemGroup> <Content Include="Schema\TextFile1.txt" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\SecureSocketLayer\SecureSocketLayer.csproj"> + <Project>{8CA6C4CF-1737-4680-8AC7-4D34E3CC35DE}</Project> + <Name>SecureSocketLayer</Name> + </ProjectReference> + </ItemGroup> </Project> \ No newline at end of file Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) Modified: pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj =================================================================== --- pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj 2006-03-13 13:03:54 UTC (rev 13) +++ pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj 2006-03-13 13:11:23 UTC (rev 14) @@ -17,7 +17,7 @@ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> <DefaultTargetSchema>IE50</DefaultTargetSchema> <DelaySign>false</DelaySign> - <OutputType>Exe</OutputType> + <OutputType>Library</OutputType> <RootNamespace>SecureSocketLayer</RootNamespace> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> <StartupObject> Modified: pgsqlclient/source/SecureSocketLayerTest/Program.cs =================================================================== --- pgsqlclient/source/SecureSocketLayerTest/Program.cs 2006-03-13 13:03:54 UTC (rev 13) +++ pgsqlclient/source/SecureSocketLayerTest/Program.cs 2006-03-13 13:11:23 UTC (rev 14) @@ -6,9 +6,8 @@ namespace SecureSocketsLayer.Test { - class Class1 + class Program { - [STAThread] static void Main(string[] args) { IPAddress hostadd = Dns.GetHostEntry("localhost").AddressList[0]; Modified: pgsqlclient/source/SecureSocketLayerTest/SecureSocketLayerTest.csproj =================================================================== --- pgsqlclient/source/SecureSocketLayerTest/SecureSocketLayerTest.csproj 2006-03-13 13:03:54 UTC (rev 13) +++ pgsqlclient/source/SecureSocketLayerTest/SecureSocketLayerTest.csproj 2006-03-13 13:11:23 UTC (rev 14) @@ -9,7 +9,7 @@ <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>SecureSocketLayerTest</RootNamespace> <AssemblyName>SecureSocketLayerTest</AssemblyName> - <StartupObject>SecureSocketsLayer.Test.Class1</StartupObject> + <StartupObject>SecureSocketsLayer.Test.Program</StartupObject> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-03-13 13:24:58
|
Revision: 17 Author: carlosga_fb Date: 2006-03-13 05:24:41 -0800 (Mon, 13 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=17&view=rev Log Message: ----------- Modified Paths: -------------- pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user Removed Paths: ------------- pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509CRL.cs pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Store.cs pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509StoreManager.cs pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Stores.cs Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) Deleted: pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509CRL.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509CRL.cs 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509CRL.cs 2006-03-13 13:24:41 UTC (rev 17) @@ -1,405 +0,0 @@ -// -// X509CRL.cs: Handles X.509 certificates revocation lists. -// -// Author: -// Sebastien Pouliot <seb...@xi...> -// -// (C) 2004 Novell (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.Collections; -using System.Globalization; -using System.IO; -using System.Security.Cryptography; - -using Mono.Security.X509.Extensions; - -namespace Mono.Security.X509 { - /* - * CertificateList ::= SEQUENCE { - * tbsCertList TBSCertList, - * signatureAlgorithm AlgorithmIdentifier, - * signature BIT STRING - * } - * - * TBSCertList ::= SEQUENCE { - * version Version OPTIONAL, - * -- if present, MUST be v2 - * signature AlgorithmIdentifier, - * issuer Name, - * thisUpdate Time, - * nextUpdate Time OPTIONAL, - * revokedCertificates SEQUENCE OF SEQUENCE { - * userCertificate CertificateSerialNumber, - * revocationDate Time, - * crlEntryExtensions Extensions OPTIONAL - * -- if present, MUST be v2 - * } OPTIONAL, - * crlExtensions [0] Extensions OPTIONAL } - * -- if present, MUST be v2 - */ -#if INSIDE_CORLIB - internal -#else - public -#endif - class X509Crl { - - public class X509CrlEntry { - - private byte[] sn; - private DateTime revocationDate; - private X509ExtensionCollection extensions; - - internal X509CrlEntry (byte[] serialNumber, DateTime revocationDate, X509ExtensionCollection extensions) - { - sn = serialNumber; - this.revocationDate = revocationDate; - if (extensions == null) - this.extensions = new X509ExtensionCollection (); - else - this.extensions = extensions; - } - - internal X509CrlEntry (ASN1 entry) - { - sn = entry [0].Value; - Array.Reverse (sn); - revocationDate = ASN1Convert.ToDateTime (entry [1]); - extensions = new X509ExtensionCollection (entry [2]); - } - - public byte[] SerialNumber { - get { return (byte[]) sn.Clone (); } - } - - public DateTime RevocationDate { - get { return revocationDate; } - } - - public X509ExtensionCollection Extensions { - get { return extensions; } - } - - public byte[] GetBytes () - { - ASN1 sequence = new ASN1 (0x30); - sequence.Add (new ASN1 (0x02, sn)); - sequence.Add (ASN1Convert.FromDateTime (revocationDate)); - if (extensions.Count > 0) - sequence.Add (new ASN1 (extensions.GetBytes ())); - return sequence.GetBytes (); - } - } - - private string issuer; - private byte version; - private DateTime thisUpdate; - private DateTime nextUpdate; - private ArrayList entries; - private string signatureOID; - private byte[] signature; - private X509ExtensionCollection extensions; - private byte[] encoded; - - public X509Crl (byte[] crl) - { - if (crl == null) - throw new ArgumentNullException ("crl"); - encoded = (byte[]) crl.Clone (); - Parse (encoded); - } - - private void Parse (byte[] crl) - { - string e = "Input data cannot be coded as a valid CRL."; - try { - // CertificateList ::= SEQUENCE { - ASN1 encodedCRL = new ASN1 (encoded); - if ((encodedCRL.Tag != 0x30) || (encodedCRL.Count != 3)) - throw new CryptographicException (e); - - // CertificateList / TBSCertList, - ASN1 toBeSigned = encodedCRL [0]; - if ((toBeSigned.Tag != 0x30) || (toBeSigned.Count < 3)) - throw new CryptographicException (e); - - int n = 0; - // CertificateList / TBSCertList / Version OPTIONAL, -- if present, MUST be v2 - if (toBeSigned [n].Tag == 0x02) { - version = (byte) (toBeSigned [n++].Value [0] + 1); - } - else - version = 1; // DEFAULT - // CertificateList / TBSCertList / AlgorithmIdentifier, - signatureOID = ASN1Convert.ToOid (toBeSigned [n++][0]); - // CertificateList / TBSCertList / Name, - issuer = X501.ToString (toBeSigned [n++]); - // CertificateList / TBSCertList / Time, - thisUpdate = ASN1Convert.ToDateTime (toBeSigned [n++]); - // CertificateList / TBSCertList / Time OPTIONAL, - ASN1 next = toBeSigned [n++]; - if ((next.Tag == 0x17) || (next.Tag == 0x18)) { - nextUpdate = ASN1Convert.ToDateTime (next); - next = toBeSigned [n++]; - } - // CertificateList / TBSCertList / revokedCertificates SEQUENCE OF SEQUENCE { - entries = new ArrayList (); - ASN1 revokedCertificates = next; - for (int i=0; i < revokedCertificates.Count; i++) { - entries.Add (new X509CrlEntry (revokedCertificates [i])); - } - // CertificateList / TBSCertList / crlExtensions [0] Extensions OPTIONAL } - ASN1 extns = toBeSigned [n]; - if ((extns != null) && (extns.Tag == 0xA0) && (extns.Count == 1)) - extensions = new X509ExtensionCollection (extns [0]); - else - extensions = new X509ExtensionCollection (null); // result in a read only object - // CertificateList / AlgorithmIdentifier - string signatureAlgorithm = ASN1Convert.ToOid (encodedCRL [1][0]); - if (signatureOID != signatureAlgorithm) - throw new CryptographicException (e + " [Non-matching signature algorithms in CRL]"); - - // CertificateList / BIT STRING - byte[] bitstring = encodedCRL [2].Value; - // first byte contains unused bits in first byte - signature = new byte [bitstring.Length - 1]; - Buffer.BlockCopy (bitstring, 1, signature, 0, signature.Length); - } - catch { - throw new CryptographicException (e); - } - } - - public ArrayList Entries { - get { return ArrayList.ReadOnly (entries); } - } - - public X509CrlEntry this [int index] { - get { return (X509CrlEntry) entries [index]; } - } - - public X509CrlEntry this [byte[] serialNumber] { - get { return GetCrlEntry (serialNumber); } - } - - public X509ExtensionCollection Extensions { - get { return extensions; } - } - - public string IssuerName { - get { return issuer; } - } - - public DateTime NextUpdate { - get { return nextUpdate; } - } - - public DateTime ThisUpdate { - get { return thisUpdate; } - } - - public string SignatureAlgorithm { - get { return signatureOID; } - } - - public byte[] Signature { - get { - if (signature == null) - return null; - return (byte[]) signature.Clone (); - } - } - - public byte Version { - get { return version; } - } - - public bool IsCurrent { - get { return WasCurrent (DateTime.UtcNow); } - } - - public bool WasCurrent (DateTime instant) - { - if (nextUpdate == DateTime.MinValue) - return (instant >= thisUpdate); - else - return ((instant >= thisUpdate) && (instant <= nextUpdate)); - } - - public byte[] GetBytes () - { - return (byte[]) encoded.Clone (); - } - - private bool Compare (byte[] array1, byte[] array2) - { - if ((array1 == null) && (array2 == null)) - return true; - if ((array1 == null) || (array2 == null)) - return false; - if (array1.Length != array2.Length) - return false; - for (int i=0; i < array1.Length; i++) { - if (array1 [i] != array2 [i]) - return false; - } - return true; - } - - public X509CrlEntry GetCrlEntry (X509Certificate x509) - { - if (x509 == null) - throw new ArgumentNullException ("x509"); - - return GetCrlEntry (x509.SerialNumber); - } - - public X509CrlEntry GetCrlEntry (byte[] serialNumber) - { - if (serialNumber == null) - throw new ArgumentNullException ("serialNumber"); - - for (int i=0; i < entries.Count; i++) { - X509CrlEntry entry = (X509CrlEntry) entries [i]; - if (Compare (serialNumber, entry.SerialNumber)) - return entry; - } - return null; - } - - public bool VerifySignature (X509Certificate x509) - { - if (x509 == null) - throw new ArgumentNullException ("x509"); - - // 1. x509 certificate must be a CA certificate (unknown for v1 or v2 certs) - if (x509.Version >= 3) { - // 1.1. Check for "cRLSign" bit in KeyUsage extension - X509Extension ext = x509.Extensions ["2.5.29.15"]; - if (ext != null) { - KeyUsageExtension keyUsage = new KeyUsageExtension (ext); - if (!keyUsage.Support (KeyUsages.cRLSign)) - return false; - } - // 1.2. Check for ca = true in BasicConstraint - ext = x509.Extensions ["2.5.29.19"]; - if (ext != null) { - BasicConstraintsExtension basicConstraints = new BasicConstraintsExtension (ext); - if (!basicConstraints.CertificateAuthority) - return false; - } - } - // 2. CRL issuer must match CA subject name - if (issuer != x509.SubjectName) - return false; - // 3. Check the CRL signature with the CA certificate public key - switch (signatureOID) { - case "1.2.840.10040.4.3": - return VerifySignature (x509.DSA); - default: - return VerifySignature (x509.RSA); - } - } - - private byte[] GetHash (string hashName) - { - ASN1 encodedCRL = new ASN1 (encoded); - byte[] toBeSigned = encodedCRL [0].GetBytes (); - HashAlgorithm ha = HashAlgorithm.Create (hashName); - return ha.ComputeHash (toBeSigned); - } - - internal bool VerifySignature (DSA dsa) - { - if (signatureOID != "1.2.840.10040.4.3") - throw new CryptographicException ("Unsupported hash algorithm: " + signatureOID); - DSASignatureDeformatter v = new DSASignatureDeformatter (dsa); - // only SHA-1 is supported - string hashName = "SHA1"; - v.SetHashAlgorithm (hashName); - ASN1 sign = new ASN1 (signature); - if ((sign == null) || (sign.Count != 2)) - return false; - // parts may be less than 20 bytes (i.e. first bytes were 0x00) - byte[] part1 = sign [0].Value; - byte[] part2 = sign [1].Value; - byte[] sig = new byte [40]; - Buffer.BlockCopy (part1, 0, sig, (20 - part1.Length), part1.Length); - Buffer.BlockCopy (part2, 0, sig, (40 - part2.Length), part2.Length); - return v.VerifySignature (GetHash (hashName), sig); - } - - internal bool VerifySignature (RSA rsa) - { - RSAPKCS1SignatureDeformatter v = new RSAPKCS1SignatureDeformatter (rsa); - string hashName = null; - switch (signatureOID) { - // MD2 with RSA encryption - case "1.2.840.113549.1.1.2": - // maybe someone installed MD2 ? - hashName = "MD2"; - break; - // MD5 with RSA encryption - case "1.2.840.113549.1.1.4": - hashName = "MD5"; - break; - // SHA-1 with RSA Encryption - case "1.2.840.113549.1.1.5": - hashName = "SHA1"; - break; - default: - throw new CryptographicException ("Unsupported hash algorithm: " + signatureOID); - } - v.SetHashAlgorithm (hashName); - return v.VerifySignature (GetHash (hashName), signature); - } - - public bool VerifySignature (AsymmetricAlgorithm aa) - { - if (aa == null) - throw new ArgumentNullException ("aa"); - - // only validate the signature (in case we don't have the CA certificate) - if (aa is RSA) - return VerifySignature (aa as RSA); - else if (aa is DSA) - return VerifySignature (aa as DSA); - else - throw new NotSupportedException ("Unknown Asymmetric Algorithm " + aa.ToString ()); - } - - static public X509Crl CreateFromFile (string filename) - { - byte[] crl = null; - using (FileStream fs = File.Open (filename, FileMode.Open, FileAccess.Read, FileShare.Read)) { - crl = new byte [fs.Length]; - fs.Read (crl, 0, crl.Length); - fs.Close (); - } - return new X509Crl (crl); - } - } -} Deleted: pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Store.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Store.cs 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Store.cs 2006-03-13 13:24:41 UTC (rev 17) @@ -1,244 +0,0 @@ -// -// X509Store.cs: Handles a X.509 certificates/CRLs store -// -// Author: -// Sebastien Pouliot <seb...@xi...> -// -// 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.Collections; -using System.Globalization; -using System.IO; -using System.Text; - -using Mono.Security.X509.Extensions; - -namespace Mono.Security.X509 { - -#if INSIDE_CORLIB - internal -#else - public -#endif - class X509Store { - - private string _storePath; - private X509CertificateCollection _certificates; - private ArrayList _crls; - private bool _crl; - private string _name; - - internal X509Store (string path, bool crl) - { - _storePath = path; - _crl = crl; - } - - // properties - - public X509CertificateCollection Certificates { - get { - if (_certificates == null) { - _certificates = BuildCertificatesCollection (_storePath); - } - return _certificates; - } - } - - public ArrayList Crls { - get { - // CRL aren't applicable to all stores - // but returning null is a little rude - if (!_crl) { - _crls = new ArrayList (); - } - if (_crls == null) { - _crls = BuildCrlsCollection (_storePath); - } - return _crls; - } - } - - public string Name { - get { - if (_name == null) { - int n = _storePath.LastIndexOf (Path.DirectorySeparatorChar); - _name = _storePath.Substring (n+1); - } - return _name; - } - } - - // methods - - public void Clear () - { - if (_certificates != null) - _certificates.Clear (); - _certificates = null; - if (_crls != null) - _crls.Clear (); - _crls = null; - } - - public void Import (X509Certificate certificate) - { - CheckStore (_storePath, true); - - string filename = Path.Combine (_storePath, GetUniqueName (certificate)); - if (!File.Exists (filename)) { - using (FileStream fs = File.OpenWrite (filename)) { - byte[] data = certificate.RawData; - fs.Write (data, 0, data.Length); - fs.Close (); - } - } - } - - public void Remove (X509Certificate certificate) - { - string filename = Path.Combine (_storePath, GetUniqueName (certificate)); - if (File.Exists (filename)) { - File.Delete (filename); - } - } - - // private stuff - - private string GetUniqueName (X509Certificate certificate) - { - string method = null; - byte[] name = null; - - // We prefer Subject Key Identifier as the unique name - // as it will provide faster lookups - X509Extension ext = certificate.Extensions ["2.5.29.14"]; - if (ext != null) { - SubjectKeyIdentifierExtension ski = new SubjectKeyIdentifierExtension (ext); - name = ski.Identifier; - method = "ski"; - } - else { - method = "tbp"; // thumbprint - name = certificate.Hash; - } - - StringBuilder sb = new StringBuilder (method); - sb.Append ("-"); - foreach (byte b in name) { - sb.Append (b.ToString ("X2", CultureInfo.InvariantCulture)); - } - sb.Append (".cer"); - - return sb.ToString (); - } - - private byte[] Load (string filename) - { - byte[] data = null; - using (FileStream fs = File.OpenRead (filename)) { - data = new byte [fs.Length]; - fs.Read (data, 0, data.Length); - fs.Close (); - } - return data; - } - - private X509Certificate LoadCertificate (string filename) - { - byte[] data = Load (filename); - X509Certificate cert = new X509Certificate (data); - return cert; - } - - private X509Crl LoadCrl (string filename) - { - byte[] data = Load (filename); - X509Crl crl = new X509Crl (data); - return crl; - } - - private bool CheckStore (string path, bool throwException) - { - 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) { - try { - X509Certificate cert = LoadCertificate (file); - coll.Add (cert); - } - catch { - // in case someone is dumb enough - // (like me) to include a base64 - // encoded certs (or other junk - // into the store). - } - } - } - return coll; - } - - private ArrayList BuildCrlsCollection (string storeName) - { - 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) { - try { - X509Crl crl = LoadCrl (file); - list.Add (crl); - } - catch { - // junk catcher - } - } - } - return list; - } - } -} Deleted: pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509StoreManager.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509StoreManager.cs 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509StoreManager.cs 2006-03-13 13:24:41 UTC (rev 17) @@ -1,130 +0,0 @@ -// -// X509StoreManager.cs: X.509 store manager. -// -// Author: -// Sebastien Pouliot <seb...@xi...> -// -// (C) 2004 Novell (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.Collections; -using System.IO; - -using Mono.Security.X509.Extensions; - -namespace Mono.Security.X509 { - -#if INSIDE_CORLIB - internal -#else - public -#endif - sealed class X509StoreManager { - - static private X509Stores _userStore; - static private X509Stores _machineStore; - - private X509StoreManager () - { - } - - static public X509Stores CurrentUser { - get { - if (_userStore == null) { - string _userPath = Path.Combine ( - Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), - ".mono"); - _userPath = Path.Combine (_userPath, "certs"); - - _userStore = new X509Stores (_userPath); - } - return _userStore; - } - } - - static public X509Stores LocalMachine { - get { - if (_machineStore == null) { - string _machinePath = Path.Combine ( - Environment.GetFolderPath (Environment.SpecialFolder.CommonApplicationData), - ".mono"); - _machinePath = Path.Combine (_machinePath, "certs"); - - _machineStore = new X509Stores (_machinePath); - } - return _machineStore; - } - } - - // Merged stores collections - // we need to look at both the user and the machine (entreprise) - // certificates/CRLs when building/validating a chain - - static public X509CertificateCollection IntermediateCACertificates { - get { - X509CertificateCollection intermediateCerts = new X509CertificateCollection (); - intermediateCerts.AddRange (CurrentUser.IntermediateCA.Certificates); - intermediateCerts.AddRange (LocalMachine.IntermediateCA.Certificates); - return intermediateCerts; - } - } - - static public ArrayList IntermediateCACrls { - get { - ArrayList intermediateCRLs = new ArrayList (); - intermediateCRLs.AddRange (CurrentUser.IntermediateCA.Crls); - intermediateCRLs.AddRange (LocalMachine.IntermediateCA.Crls); - return intermediateCRLs; - } - } - - static public X509CertificateCollection TrustedRootCertificates { - get { - X509CertificateCollection trustedCerts = new X509CertificateCollection (); - trustedCerts.AddRange (CurrentUser.TrustedRoot.Certificates); - trustedCerts.AddRange (LocalMachine.TrustedRoot.Certificates); - return trustedCerts; - } - } - - static public ArrayList TrustedRootCACrls { - get { - ArrayList trustedCRLs = new ArrayList (); - trustedCRLs.AddRange (CurrentUser.TrustedRoot.Crls); - trustedCRLs.AddRange (LocalMachine.TrustedRoot.Crls); - return trustedCRLs; - } - } - - static public X509CertificateCollection UntrustedCertificates { - get { - X509CertificateCollection untrustedCerts = new X509CertificateCollection (); - untrustedCerts.AddRange (CurrentUser.Untrusted.Certificates); - untrustedCerts.AddRange (LocalMachine.Untrusted.Certificates); - return untrustedCerts; - } - } - } -} Deleted: pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Stores.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Stores.cs 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Stores.cs 2006-03-13 13:24:41 UTC (rev 17) @@ -1,146 +0,0 @@ -// -// X509Stores.cs: Handles X.509 certificates/CRLs stores group. -// -// Author: -// Sebastien Pouliot <seb...@xi...> -// -// (C) 2004 Novell (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.Collections; -using System.IO; - -using Mono.Security.X509.Extensions; - -namespace Mono.Security.X509 { - -#if INSIDE_CORLIB - internal -#else - public -#endif - class X509Stores { - - private string _storePath; - private X509Store _personal; - private X509Store _other; - private X509Store _intermediate; - private X509Store _trusted; - private X509Store _untrusted; - - internal X509Stores (string path) - { - _storePath = path; - } - - // properties - - public X509Store Personal { - get { - if (_personal == null) { - string path = Path.Combine (_storePath, Names.Personal); - _personal = new X509Store (path, false); - } - return _personal; - } - } - - public X509Store OtherPeople { - get { - if (_other == null) { - string path = Path.Combine (_storePath, Names.OtherPeople); - _other = new X509Store (path, false); - } - return _other; - } - } - - public X509Store IntermediateCA { - get { - if (_intermediate == null) { - string path = Path.Combine (_storePath, Names.IntermediateCA); - _intermediate = new X509Store (path, true); - } - return _intermediate; - } - } - - public X509Store TrustedRoot { - get { - if (_trusted == null) { - string path = Path.Combine (_storePath, Names.TrustedRoot); - _trusted = new X509Store (path, true); - } - return _trusted; - } - } - - public X509Store Untrusted { - get { - if (_untrusted == null) { - string path = Path.Combine (_storePath, Names.Untrusted); - _untrusted = new X509Store (path, false); - } - return _untrusted; - } - } - - // methods - - public void Clear () - { - // this will force a reload of all stores - if (_personal != null) - _personal.Clear (); - _personal = null; - if (_other != null) - _other.Clear (); - _other = null; - if (_intermediate != null) - _intermediate.Clear (); - _intermediate = null; - if (_trusted != null) - _trusted.Clear (); - _trusted = null; - if (_untrusted != null) - _untrusted.Clear (); - _untrusted = null; - } - - // names - - public class Names { - - // do not translate - public const string Personal = "My"; - public const string OtherPeople = "AddressBook"; - public const string IntermediateCA = "CA"; - public const string TrustedRoot = "Trust"; - public const string Untrusted = "Disallowed"; - - public Names () {} - } - } -} Modified: pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj =================================================================== --- pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj 2006-03-13 13:24:41 UTC (rev 17) @@ -140,42 +140,6 @@ <SubType>Code</SubType> </Compile> <Compile Include="Mono\Security\StrongName.cs" /> - <Compile Include="Mono\Security\X509\Extensions\AuthorityKeyIdentifierExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\BasicConstraintsExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\CertificatePoliciesExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\CRLDistributionPointsExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\ExtendedKeyUsageExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\GeneralNames.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\KeyAttributesExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\KeyUsageExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\NetscapeCertTypeExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\PrivateKeyUsagePeriodExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\SubjectAltNameExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\SubjectKeyIdentifierExtension.cs"> - <SubType>Code</SubType> - </Compile> <Compile Include="Mono\Security\X509\ITrustAnchors.cs"> <SubType>Code</SubType> </Compile> @@ -200,24 +164,12 @@ <Compile Include="Mono\Security\X509\X509CertificateCollection.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Mono\Security\X509\X509CRL.cs"> - <SubType>Code</SubType> - </Compile> <Compile Include="Mono\Security\X509\X509Extension.cs"> <SubType>Code</SubType> </Compile> <Compile Include="Mono\Security\X509\X509Extensions.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Mono\Security\X509\X509Store.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\X509StoreManager.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\X509Stores.cs"> - <SubType>Code</SubType> - </Compile> <Compile Include="Mono\Security\X509\X520Attributes.cs"> <SubType>Code</SubType> </Compile> Modified: pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user =================================================================== --- pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user 2006-03-13 13:24:41 UTC (rev 17) @@ -12,5 +12,6 @@ <ApplicationRevision>0</ApplicationRevision> <FallbackCulture>en-US</FallbackCulture> <VerifyUploadedFiles>false</VerifyUploadedFiles> + <ProjectView>ShowAllFiles</ProjectView> </PropertyGroup> </Project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-03-13 13:25:53
|
Revision: 18 Author: carlosga_fb Date: 2006-03-13 05:25:41 -0800 (Mon, 13 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=18&view=rev Log Message: ----------- Modified Paths: -------------- pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo Removed Paths: ------------- pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.sln Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) Deleted: pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.sln =================================================================== --- pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.sln 2006-03-13 13:24:41 UTC (rev 17) +++ pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.sln 2006-03-13 13:25:41 UTC (rev 18) @@ -1,19 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureSocketLayer", "SecureSocketLayer.csproj", "{8CA6C4CF-1737-4680-8AC7-4D34E3CC35DE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8CA6C4CF-1737-4680-8AC7-4D34E3CC35DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8CA6C4CF-1737-4680-8AC7-4D34E3CC35DE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8CA6C4CF-1737-4680-8AC7-4D34E3CC35DE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8CA6C4CF-1737-4680-8AC7-4D34E3CC35DE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-03-13 15:33:40
|
Revision: 19 Author: carlosga_fb Date: 2006-03-13 07:33:13 -0800 (Mon, 13 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=19&view=rev Log Message: ----------- Changes on the Secure Socket Layer implementation for better handling of Server Certificates. Implementation of Server Certificate Validation Callback and Client Certificate Selection Callback Modified Paths: -------------- pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo pgsqlclient/source/SecureSocketLayer/Net/Security/LocalCertificateSelectionCallback.cs pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/ISecureFactory.cs pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/IX509ChainValidator.cs pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/SecureSession.cs pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/X509ChainValidator.cs pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Ssl/Client/SslClientFactory.cs pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Tls/Client/TlsClientFactory.cs pgsqlclient/source/SecureSocketLayer/Net/Security/RemoteCertificateValidationCallback.cs pgsqlclient/source/SecureSocketLayer/Net/Security/SslStream.cs pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user pgsqlclient/source/SecureSocketLayerTest/Program.cs Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/LocalCertificateSelectionCallback.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/LocalCertificateSelectionCallback.cs 2006-03-13 13:25:41 UTC (rev 18) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/LocalCertificateSelectionCallback.cs 2006-03-13 15:33:13 UTC (rev 19) @@ -32,8 +32,8 @@ public delegate X509Certificate LocalCertificateSelectionCallback( object sender, string targetHost, - X509CertificateCollection localCertificates, - X509Certificate localCertificate, + X509CertificateCollection localCertificates, + X509Certificate remoteCertificate, string[] acceptableIssuers); } Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/ISecureFactory.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/ISecureFactory.cs 2006-03-13 13:25:41 UTC (rev 18) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/ISecureFactory.cs 2006-03-13 15:33:13 UTC (rev 19) @@ -25,6 +25,8 @@ #if NET_2_0 using System; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; namespace SecureSocketLayer.Net.Security.Providers.Common { @@ -48,7 +50,7 @@ IRecordEncryptor CreateRecordEncryptor(SecureSession session); IRecordDecryptor CreateRecordDecryptor(SecureSession session); IRecordMACManager CreateMACManager(SecureSession session); - IX509ChainValidator CreateX509ChainValidator(); + IX509ChainValidator CreateX509ChainValidator(X509Chain chain, ExchangeAlgorithmType exchangeAlgorithmType); #endregion } Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/IX509ChainValidator.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/IX509ChainValidator.cs 2006-03-13 13:25:41 UTC (rev 18) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/IX509ChainValidator.cs 2006-03-13 15:33:13 UTC (rev 19) @@ -33,7 +33,7 @@ { #region \xB7 Methods \xB7 - SslPolicyErrors Validate(X509CertificateCollection certificates, CipherSuite cipherSuite, string targetHost); + SslPolicyErrors Validate(X509CertificateCollection certificates, string targetHost); #endregion } Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/SecureSession.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/SecureSession.cs 2006-03-13 13:25:41 UTC (rev 18) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/SecureSession.cs 2006-03-13 15:33:13 UTC (rev 19) @@ -36,23 +36,23 @@ { #region \xB7 Callback Fields \xB7 - private RemoteCertificateValidationCallback serverCertValidation; - private LocalCertificateSelectionCallback clientCertSelection; + private RemoteCertificateValidationCallback userCertificateValidationCallback; + private LocalCertificateSelectionCallback userCertificateSelectionCallback; #endregion #region \xB7 Callback Properties \xB7 - public RemoteCertificateValidationCallback ServerCertValidation + public RemoteCertificateValidationCallback UserCertificateValidationCallback { - get { return this.serverCertValidation; } - set { this.serverCertValidation = value; } + get { return this.userCertificateValidationCallback; } + set { this.userCertificateValidationCallback = value; } } - public LocalCertificateSelectionCallback ClientCertSelection + public LocalCertificateSelectionCallback UserCertificateSelectionCallback { - get { return this.clientCertSelection; } - set { this.clientCertSelection = value; } + get { return this.userCertificateSelectionCallback; } + set { this.userCertificateSelectionCallback = value; } } #endregion @@ -81,7 +81,8 @@ private Stream outputStream; private X509CertificateCollection remoteCertificates; private X509CertificateCollection localCertificates; - private X509Certificate clientCertificate; + private X509Certificate clientCertificate; + private X509Chain remoteCertificateChain; private RSAParameters rsaParameters; private MemoryStreamEx handshakeMessages; @@ -503,33 +504,60 @@ private void RemoteCertificateReceived(X509Certificate certificate) { + if (this.remoteCertificateChain == null) + { + this.remoteCertificateChain = new X509Chain(); + + try + { + this.remoteCertificateChain.Build(new X509Certificate2(certificate)); + } + catch + { + this.remoteCertificateChain.Reset(); + } + } + this.RemoteCertificates.Add(certificate); } private void ReceivedRemoteCertificateChain() { - IX509ChainValidator validator = this.secureFactory.CreateX509ChainValidator(); + SslPolicyErrors errors = SslPolicyErrors.None; - SslPolicyErrors errors = validator.Validate(this.RemoteCertificates, this.CipherSuite, this.TargetHost); + if (this.remoteCertificateChain.ChainElements.Count > 0) + { + IX509ChainValidator validator = this.secureFactory.CreateX509ChainValidator( + this.remoteCertificateChain, + this.CipherSuite.ExchangeAlgorithmType); -#warning Build the X509Chain + errors |= validator.Validate(this.RemoteCertificates, this.TargetHost); + } + else + { + errors |= SslPolicyErrors.RemoteCertificateChainErrors; + } - if (!this.ServerCertValidation(this, this.RemoteCertificates[0], null, errors)) - { - throw new SecureException("Invalid certificate received form server."); - } + if (this.UserCertificateValidationCallback != null) + { + if (!this.UserCertificateValidationCallback(this, this.RemoteCertificates[0], this.remoteCertificateChain, errors)) + { + throw new SecureException("The remote certificate is invalid according to the validation procedure."); + } + } + else + { + if (errors != SslPolicyErrors.None) + { + throw new SecureException("The remote certificate is invalid according to the validation procedure."); + } + } } private void ClientCertificateSelected(X509Certificate certificate) - { - this.clientCertificate = certificate; - - this.clientCertificate = this.ClientCertSelection( - this, - this.TargetHost, - this.LocalCertificates, - this.ClientCertificate, - null); + { + this.clientCertificate = this.UserCertificateSelectionCallback( + this, this.TargetHost, this.LocalCertificates, this.RemoteCertificates[0], null); if (this.clientCertificate == null) { Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/X509ChainValidator.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/X509ChainValidator.cs 2006-03-13 13:25:41 UTC (rev 18) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Common/X509ChainValidator.cs 2006-03-13 15:33:13 UTC (rev 19) @@ -33,18 +33,27 @@ namespace SecureSocketLayer.Net.Security.Providers.Common { internal sealed class X509ChainValidator : IX509ChainValidator - { - #region \xB7 Constructors \xB7 + { + #region \xB7 Fields \xB7 - public X509ChainValidator() + private X509Chain certificateChain; + private ExchangeAlgorithmType exchangeAlgorithmType; + + #endregion + + #region \xB7 Constructors \xB7 + + public X509ChainValidator(X509Chain certificateChain, ExchangeAlgorithmType exchangeAlgorithmType) { + this.certificateChain = certificateChain; + this.exchangeAlgorithmType = exchangeAlgorithmType; } #endregion #region \xB7 IX509ChainValidator Methods \xB7 - public SslPolicyErrors Validate(X509CertificateCollection certificates, CipherSuite cipherSuite, string targetHost) + public SslPolicyErrors Validate(X509CertificateCollection certificates, string targetHost) { SslPolicyErrors errors = SslPolicyErrors.None; @@ -54,7 +63,7 @@ // SSL specific check - not all certificates can be // used to server-side SSL some rules applies after // all ;-) - if (!this.CheckCertificateUsage(leaf, cipherSuite)) + if (!this.CheckCertificateUsage(leaf)) { // WinError.h CERT_E_PURPOSE 0x800B0106 errors |= SslPolicyErrors.RemoteCertificateChainErrors; @@ -68,36 +77,6 @@ errors |= SslPolicyErrors.RemoteCertificateNameMismatch; } - // Note: building and verifying a chain can take much time - // so we do it last(letting simple things fails first) - - // Note: In TLS the certificates MUST be in order(and - // optionally include the root certificate) so we're not - // building the chain using LoadCertificate(it's faster) - - // Note: IIS doesn't seem to send the whole certificate chain - // but only the server certificate :- ( it's assuming that you - // already have this chain installed on your computer. duh! - // http://groups.google.ca/groups?q=IIS+server+certificate+chain&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=85058s%24avd%241%40nnrp1.deja.com&rnum=3 - - X509Chain certificateChain = new X509Chain(); - - bool result = false; - - try - { - certificateChain.Build(leaf); - } - catch (Exception) - { - result = false; - } - - if (!result) - { - errors |= SslPolicyErrors.RemoteCertificateChainErrors; - } - return errors; } @@ -107,7 +86,7 @@ // Note: this method only works for RSA certificates // DH certificates requires some changes - does anyone use one ? - private bool CheckCertificateUsage(X509Certificate2 cert, CipherSuite cipherSuite) + private bool CheckCertificateUsage(X509Certificate2 cert) { // certificate extensions are required for this // we "must" accept older certificates without proofs @@ -118,7 +97,7 @@ X509KeyUsageFlags ku = X509KeyUsageFlags.None; - switch (cipherSuite.ExchangeAlgorithmType) + switch (this.exchangeAlgorithmType) { case ExchangeAlgorithmType.RsaSign: ku = X509KeyUsageFlags.DigitalSignature; Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Ssl/Client/SslClientFactory.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Ssl/Client/SslClientFactory.cs 2006-03-13 13:25:41 UTC (rev 18) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Ssl/Client/SslClientFactory.cs 2006-03-13 15:33:13 UTC (rev 19) @@ -25,9 +25,10 @@ #if NET_2_0 using System; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; using SecureSocketLayer.Net.Security.Providers.Common; using SecureSocketLayer.Net.Security.Providers.Common.Client; -using System.Security.Authentication; namespace SecureSocketLayer.Net.Security.Providers.Ssl.Client { @@ -120,9 +121,9 @@ return new SslClientRecordMACManager(session); } - public IX509ChainValidator CreateX509ChainValidator() + public IX509ChainValidator CreateX509ChainValidator(X509Chain cerficateChain, ExchangeAlgorithmType exchangeAlgorithmType) { - return new X509ChainValidator(); + return new X509ChainValidator(cerficateChain, exchangeAlgorithmType); } #endregion Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Tls/Client/TlsClientFactory.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Tls/Client/TlsClientFactory.cs 2006-03-13 13:25:41 UTC (rev 18) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/Providers/Tls/Client/TlsClientFactory.cs 2006-03-13 15:33:13 UTC (rev 19) @@ -25,9 +25,10 @@ #if NET_2_0 using System; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; using SecureSocketLayer.Net.Security.Providers.Common; using SecureSocketLayer.Net.Security.Providers.Common.Client; -using System.Security.Authentication; namespace SecureSocketLayer.Net.Security.Providers.Tls.Client { @@ -120,9 +121,9 @@ return new TlsClientRecordMACManager(session); } - public IX509ChainValidator CreateX509ChainValidator() + public IX509ChainValidator CreateX509ChainValidator(X509Chain cerficateChain, ExchangeAlgorithmType exchangeAlgorithmType) { - return new X509ChainValidator(); + return new X509ChainValidator(cerficateChain, exchangeAlgorithmType); } #endregion Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/RemoteCertificateValidationCallback.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/RemoteCertificateValidationCallback.cs 2006-03-13 13:25:41 UTC (rev 18) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/RemoteCertificateValidationCallback.cs 2006-03-13 15:33:13 UTC (rev 19) @@ -30,10 +30,7 @@ namespace SecureSocketLayer.Net.Security { public delegate bool RemoteCertificateValidationCallback( - object sender, - X509Certificate certificate, - System.Security.Cryptography.X509Certificates.X509Chain chain, - SslPolicyErrors sslPolicyErrors); + object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors); } #endif Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/SslStream.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/SslStream.cs 2006-03-13 13:25:41 UTC (rev 18) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/SslStream.cs 2006-03-13 15:33:13 UTC (rev 19) @@ -38,8 +38,8 @@ { #region · Callback Fields · - private RemoteCertificateValidationCallback certValidationCallback; - private LocalCertificateSelectionCallback certSelectionCallback; + private RemoteCertificateValidationCallback userCertificateValidationCallback; + private LocalCertificateSelectionCallback userCertificateSelectionCallback; #endregion @@ -51,7 +51,7 @@ private object read; private object write; private bool disposed; - private object negotiate; + private object syncObject; #endregion @@ -289,12 +289,19 @@ { } - public SslStream(Stream innerStream, bool leaveStreamOpen, RemoteCertificateValidationCallback certValidationCallback) - : this(innerStream, leaveStreamOpen, certValidationCallback, null) + public SslStream( + Stream innerStream, + bool leaveStreamOpen, + RemoteCertificateValidationCallback userCertificateValidationCallback) + : this(innerStream, leaveStreamOpen, userCertificateValidationCallback, null) { } - public SslStream(Stream innerStream, bool leaveStreamOpen, RemoteCertificateValidationCallback certValidationCallback, LocalCertificateSelectionCallback certSelectionCallback) + public SslStream( + Stream innerStream, + bool leaveStreamOpen, + RemoteCertificateValidationCallback userCertificateValidationCallback, + LocalCertificateSelectionCallback userCertificateSelectionCallback) : base(innerStream, leaveStreamOpen) { if (innerStream == null) @@ -307,11 +314,13 @@ throw new ArgumentNullException("stream is not both readable and writable."); } - this.innerStream = innerStream; - this.certValidationCallback = certValidationCallback; - this.certSelectionCallback = certSelectionCallback; - this.read = new object(); - this.write = new object(); + this.userCertificateValidationCallback = userCertificateValidationCallback; + this.userCertificateSelectionCallback = userCertificateSelectionCallback; + + this.innerStream = innerStream; + this.read = new object(); + this.write = new object(); + this.syncObject = new object(); } #endregion @@ -330,9 +339,11 @@ // Note: Async code may have problem if they can't ensure that // the Negotiate phase isn't done during a read operation. // System.Net.HttpWebRequest protects itself from that problem - lock (this.negotiate) + lock (this.syncObject) { this.session = new SecureSession(this.innerStream); + this.session.UserCertificateValidationCallback = this.userCertificateValidationCallback; + this.session.UserCertificateSelectionCallback = this.userCertificateSelectionCallback; this.session.AuthenticateAsClient( targetHost, clientCertificates, @@ -359,7 +370,7 @@ // Note: Async code may have problem if they can't ensure that // the Negotiate phase isn't done during a read operation. // System.Net.HttpWebRequest protects itself from that problem - lock (this.negotiate) + lock (this.syncObject) { this.session = new SecureSession(this.innerStream); this.session.AuthenticateAsServer( @@ -669,26 +680,6 @@ } #endregion - - #region · Event Handlers · - - private bool ServerCertificateValidation( - X509Certificate certificate, - int[] certificateErrors) - { - throw new NotImplementedException(); - } - - private X509Certificate ClientCertificateSelection( - X509CertificateCollection clientCertificates, - X509Certificate serverCertificate, - string targetHost, - X509CertificateCollection serverRequestedCertificates) - { - throw new NotImplementedException(); - } - - #endregion } } Modified: pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user =================================================================== --- pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user 2006-03-13 13:25:41 UTC (rev 18) +++ pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user 2006-03-13 15:33:13 UTC (rev 19) @@ -12,6 +12,6 @@ <ApplicationRevision>0</ApplicationRevision> <FallbackCulture>en-US</FallbackCulture> <VerifyUploadedFiles>false</VerifyUploadedFiles> - <ProjectView>ShowAllFiles</ProjectView> + <ProjectView>ProjectFiles</ProjectView> </PropertyGroup> </Project> \ No newline at end of file Modified: pgsqlclient/source/SecureSocketLayerTest/Program.cs =================================================================== --- pgsqlclient/source/SecureSocketLayerTest/Program.cs 2006-03-13 13:25:41 UTC (rev 18) +++ pgsqlclient/source/SecureSocketLayerTest/Program.cs 2006-03-13 15:33:13 UTC (rev 19) @@ -1,8 +1,7 @@ using System; using System.Net; using System.Net.Sockets; -using System.Net.Security; -using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; namespace SecureSocketsLayer.Test { @@ -10,19 +9,62 @@ { static void Main(string[] args) { + try + { + // MicrosoftSslStreamTest(); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } + + try + { + CustomSslStreamTest(); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } + } + + static void MicrosoftSslStreamTest() + { IPAddress hostadd = Dns.GetHostEntry("localhost").AddressList[0]; IPEndPoint endPoint = new IPEndPoint(hostadd, 4433); - Socket socket = new Socket( - AddressFamily.InterNetwork, - SocketType.Stream, - ProtocolType.Tcp); + Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Connect(endPoint); - SslStream ssl = new SslStream(new NetworkStream(socket, true)); + System.Net.Security.SslStream ssl = new System.Net.Security.SslStream(new NetworkStream(socket, true)); ssl.AuthenticateAsClient("localhost"); ssl.Close(); } + + static void CustomSslStreamTest() + { + IPAddress hostadd = Dns.GetHostEntry("localhost").AddressList[0]; + IPEndPoint endPoint = new IPEndPoint(hostadd, 4433); + + Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + + socket.Connect(endPoint); + + SecureSocketLayer.Net.Security.RemoteCertificateValidationCallback serverCallback = new SecureSocketLayer.Net.Security.RemoteCertificateValidationCallback(CertificateValidation); + + SecureSocketLayer.Net.Security.SslStream ssl = new SecureSocketLayer.Net.Security.SslStream(new NetworkStream(socket, true), false, serverCallback); + ssl.AuthenticateAsClient("localhost"); + ssl.Close(); + } + + static bool CertificateValidation( + object sender, + X509Certificate certificate, + X509Chain chain, + SecureSocketLayer.Net.Security.SslPolicyErrors sslPolicyErrors) + { + return true; + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-03-13 21:45:35
|
Revision: 23 Author: carlosga_fb Date: 2006-03-13 13:45:11 -0800 (Mon, 13 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=23&view=rev Log Message: ----------- Modified Paths: -------------- pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgParameter.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgStatement.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgType.cs pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj Added Paths: ----------- pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs Removed Paths: ------------- pgsqlclient/source/PostgreSql/Data/Protocol/PgDbClient.cs Modified: pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-03-13 21:42:55 UTC (rev 22) +++ pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-03-13 21:45:11 UTC (rev 23) @@ -12,13 +12,15 @@ <AssemblyName>PostgreSql.Data.PgSqlClient</AssemblyName> <StartupObject> </StartupObject> + <SignAssembly>true</SignAssembly> + <AssemblyOriginatorKeyFile>PostgreSql.Data.PostgreSqlClient.snk</AssemblyOriginatorKeyFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> + <DefineConstants>TRACE;DEBUG;CUSTOM_SSL</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> @@ -32,7 +34,6 @@ </PropertyGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ItemGroup> - <Compile Include="AssemblyInfo.cs" /> <Compile Include="Design\ParameterCollection\PgParameterCollectionEditor.cs" /> <Compile Include="Design\ParameterCollection\PgParameterConverter.cs" /> <Compile Include="PostgreSqlClient\PgCommand.cs"> @@ -67,6 +68,17 @@ <Compile Include="PostgreSqlClient\PgRowUpdatingEventHandler.cs" /> <Compile Include="PostgreSqlClient\PgTransaction.cs" /> <Compile Include="PostgreSqlClient\PostgreSqlClientFactory.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + <DependentUpon>Settings.settings</DependentUpon> + </Compile> <Compile Include="Protocol\InfoMessageCallback.cs" /> <Compile Include="Protocol\NotificationCallback.cs" /> <Compile Include="Protocol\PgAuthMethods.cs" /> @@ -127,6 +139,11 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <EmbeddedResource Include="Properties\Resources.resx"> + <SubType>Designer</SubType> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> <EmbeddedResource Include="Schema\MetaData.xml" /> </ItemGroup> <ItemGroup> @@ -138,4 +155,11 @@ <Name>SecureSocketLayer</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <None Include="PostgreSql.Data.PostgreSqlClient.snk" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> </Project> \ No newline at end of file Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs 2006-03-13 21:42:55 UTC (rev 22) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs 2006-03-13 21:45:11 UTC (rev 23) @@ -353,7 +353,7 @@ { lock (this.connectionInternal) { - PgDbClient database = this.connectionInternal.Database; + PgDatabase database = this.connectionInternal.Database; // Remove info message callback this.connectionInternal.Database.InfoMessage = null; Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs 2006-03-13 21:42:55 UTC (rev 22) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs 2006-03-13 21:45:11 UTC (rev 23) @@ -28,7 +28,7 @@ #region \xB7 Fields \xB7 private PgConnection owningConnection; - private PgDbClient database; + private PgDatabase database; private PgConnectionOptions options; private PgTransaction activeTransaction; private ArrayList preparedCommands; @@ -39,7 +39,7 @@ #region \xB7 Properties \xB7 - public PgDbClient Database + public PgDatabase Database { get { return this.database; } } @@ -113,7 +113,7 @@ { try { - this.database = new PgDbClient(this.options); + this.database = new PgDatabase(this.options); this.database.Connect(); } catch (PgClientException ex) Copied: pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs (from rev 11, pgsqlclient/source/PostgreSql/Data/Protocol/PgDbClient.cs) =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs (rev 0) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-03-13 21:45:11 UTC (rev 23) @@ -0,0 +1,863 @@ +/* + * PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * All Rights Reserved. + */ + +using System; +using System.Data; +using System.IO; +using System.Collections; +using System.Text; +using System.Net; +using System.Net.Sockets; + +#if (CUSTOM_SSL) +using SecureSocketLayer.Net.Security; +#else +using System.Net.Security; +#endif + +namespace PostgreSql.Data.Protocol +{ + internal class PgDatabase + { + #region \xB7 Static Properties \xB7 + + public static readonly PgTypeCollection DataTypes = new PgTypeCollection(); + public static readonly PgCharactersetCollection Charactersets = new PgCharactersetCollection(); + + #endregion + + #region \xB7 Static Methods \xB7 + + public static void InitializeTypes() + { + if (DataTypes.Count > 0) + { + return; + } + + DataTypes.Add(16 , "bool" , PgDataType.Boolean , 0, PgTypeFormat.Binary, 1); + DataTypes.Add(17 , "bytea" , PgDataType.Binary , 0, PgTypeFormat.Binary, 0); + DataTypes.Add(18 , "char" , PgDataType.Char , 0, PgTypeFormat.Text, 0); + DataTypes.Add(19 , "name" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); + DataTypes.Add(20 , "int8" , PgDataType.Int8 , 0, PgTypeFormat.Binary, 8); + DataTypes.Add(21 , "int2" , PgDataType.Int2 , 0, PgTypeFormat.Binary, 2); + DataTypes.Add(22 , "int2vector" , PgDataType.Vector , 21, PgTypeFormat.Binary, 2); + DataTypes.Add(23 , "int4" , PgDataType.Int4 , 0, PgTypeFormat.Binary, 4); + DataTypes.Add(24 , "regproc" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); + DataTypes.Add(25 , "text" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); + DataTypes.Add(26 , "oid" , PgDataType.Int4 , 0, PgTypeFormat.Binary, 4); + DataTypes.Add(30 , "oidvector" , PgDataType.Vector , 26, PgTypeFormat.Binary, 4); + DataTypes.Add(600 , "point" , PgDataType.Point , 701, PgTypeFormat.Binary, 16); + DataTypes.Add(601 , "lseg" , PgDataType.LSeg , 600, PgTypeFormat.Binary, 32); + DataTypes.Add(602 , "path" , PgDataType.Path , 0, PgTypeFormat.Binary, 16); + DataTypes.Add(603 , "box" , PgDataType.Box , 600, PgTypeFormat.Binary, 32); + DataTypes.Add(604 , "polygon" , PgDataType.Polygon , 0, PgTypeFormat.Binary, 16); + DataTypes.Add(628 , "line" , PgDataType.Line , 701, PgTypeFormat.Binary, 32); + DataTypes.Add(629 , "_line" , PgDataType.Array , 628, PgTypeFormat.Binary, 32); + DataTypes.Add(718 , "circle" , PgDataType.Circle , 0, PgTypeFormat.Binary, 24); + DataTypes.Add(719 , "_circle" , PgDataType.Array , 718, PgTypeFormat.Binary, 24); + DataTypes.Add(700 , "float4" , PgDataType.Float , 0, PgTypeFormat.Binary, 4); + DataTypes.Add(701 , "float8" , PgDataType.Double , 0, PgTypeFormat.Binary, 8); + DataTypes.Add(705 , "unknown" , PgDataType.Binary , 0, PgTypeFormat.Binary, 0); + DataTypes.Add(790 , "money" , PgDataType.Currency , 0, PgTypeFormat.Binary, 4); + DataTypes.Add(829 , "macaddr" , PgDataType.VarChar , 0, PgTypeFormat.Text, 6); + DataTypes.Add(869 , "inet" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); + DataTypes.Add(1000 , "_bool" , PgDataType.Array , 16, PgTypeFormat.Binary, 1); + DataTypes.Add(1005 , "_int2" , PgDataType.Array , 21, PgTypeFormat.Binary, 2); + DataTypes.Add(1007 , "_int4" , PgDataType.Array , 23, PgTypeFormat.Binary, 4); + DataTypes.Add(1009 , "_text" , PgDataType.Array , 25, PgTypeFormat.Binary, 0); + DataTypes.Add(1016 , "_int8" , PgDataType.Array , 20, PgTypeFormat.Binary, 8); + DataTypes.Add(1017 , "_point" , PgDataType.Array , 600, PgTypeFormat.Binary, 16); + DataTypes.Add(1018 , "_lseg" , PgDataType.Array , 601, PgTypeFormat.Binary, 32); + DataTypes.Add(1019 , "_path" , PgDataType.Array , 602, PgTypeFormat.Binary, -1); + DataTypes.Add(1020 , "_box" , PgDataType.Array , 603, PgTypeFormat.Binary, 32); + DataTypes.Add(1021 , "_float4" , PgDataType.Array , 700, PgTypeFormat.Binary, 4); + DataTypes.Add(1027 , "_polygon" , PgDataType.Array , 604, PgTypeFormat.Binary, 16); + DataTypes.Add(1033 , "aclitem" , PgDataType.VarChar , 0, PgTypeFormat.Text, 12); + DataTypes.Add(1034 , "_aclitem" , PgDataType.Array , 1033, PgTypeFormat.Text, 0); + DataTypes.Add(1042 , "bpchar" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); + DataTypes.Add(1043 , "varchar" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); + DataTypes.Add(1082 , "date" , PgDataType.Date , 0, PgTypeFormat.Binary, 4); + DataTypes.Add(1083 , "time" , PgDataType.Time , 0, PgTypeFormat.Text, 8); + DataTypes.Add(1114 , "timestamp" , PgDataType.Timestamp , 0, PgTypeFormat.Text, 8); + DataTypes.Add(1184 , "timestamptz" , PgDataType.TimestampWithTZ, 0, PgTypeFormat.Binary, 8); + DataTypes.Add(1186 , "interval" , PgDataType.Interval , 0, PgTypeFormat.Binary, 12); + DataTypes.Add(1266 , "timetz" , PgDataType.TimeWithTZ , 0, PgTypeFormat.Binary, 12); + DataTypes.Add(1560 , "bit" , PgDataType.Byte , 0, PgTypeFormat.Text, 1); + DataTypes.Add(1562 , "varbit" , PgDataType.Byte , 0, PgTypeFormat.Binary, 0); + DataTypes.Add(1700 , "numeric" , PgDataType.Decimal , 0, PgTypeFormat.Text, 8); + DataTypes.Add(1790 , "refcursor" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); + DataTypes.Add(2277 , "anyarray" , PgDataType.Array , 0, PgTypeFormat.Binary, 8); + } + + public static void InitializeCharSets() + { + if (Charactersets.Count > 0) + { + return; + } + + Charactersets.Add("SQL_ASCII" , "ascii"); // ASCII + Charactersets.Add("EUC_JP" , "euc-jp"); // Japanese EUC + Charactersets.Add("EUC_CN" , "euc-cn"); // Chinese EUC + Charactersets.Add("UNICODE" , "UTF-8"); // Unicode (UTF-8) + Charactersets.Add("LATIN1" , "iso-8859-1"); // ISO 8859-1/ECMA 94 (Latin alphabet no.1) + Charactersets.Add("LATIN2" , "iso-8859-2"); // ISO 8859-2/ECMA 94 (Latin alphabet no.2) + Charactersets.Add("LATIN4" , 1257); // ISO 8859-4/ECMA 94 (Latin alphabet no.4) + Charactersets.Add("ISO_8859_7" , 1253); // ISO 8859-7/ECMA 118 (Latin/Greek) + Charactersets.Add("LATIN9" , "iso-8859-15"); // ISO 8859-15 (Latin alphabet no.9) + Charactersets.Add("KOI8" , "koi8-r"); // KOI8-R(U) + Charactersets.Add("WIN" , "windows-1251"); // Windows CP1251 + Charactersets.Add("WIN1256" , "windows-1256"); // Windows CP1256 (Arabic) + Charactersets.Add("WIN1256" , "windows-1256"); // Windows CP1256 (Arabic) + Charactersets.Add("WIN1256" , "windows-1258"); // TCVN-5712/Windows CP1258 (Vietnamese) + Charactersets.Add("WIN1256" , "windows-874"); // Windows CP874 (Thai) + } + + #endregion + + #region \xB7 Callbacks \xB7 + + public NotificationCallback Notification + { + get { return this.notification; } + set { this.notification = value; } + } + + public InfoMessageCallback InfoMessage + { + get { return this.infoMessage; } + set { this.infoMessage = value; } + } + + #endregion + + #region \xB7 Fields \xB7 + + private NotificationCallback notification; + private InfoMessageCallback infoMessage; + + private int handle; + private int secretKey; + private Hashtable parameterStatus; + private Socket socket; + private NetworkStream networkStream; + private SslStream secureStream; + private BinaryReader receive; + private BinaryWriter send; + private PgConnectionOptions options; + private Encoding encoding; + private char transactionStatus; + + #endregion + + #region \xB7 Properties \xB7 + + public int Handle + { + get { return this.handle; } + } + + public int SecretKey + { + get { return this.secretKey; } + } + + public Hashtable ParameterStatus + { + get + { + if (this.parameterStatus == null) + { + this.parameterStatus = Hashtable.Synchronized(new Hashtable()); + } + return this.parameterStatus; + } + } + + public PgConnectionOptions Options + { + get { return this.options; } + } + + public Encoding Encoding + { + get { return this.encoding; } + } + + #endregion + + #region \xB7 Internal Properties \xB7 + + internal SslStream SecureStream + { + get { return this.secureStream; } + } + + internal BinaryReader Receive + { + get { return this.receive; } + } + + internal BinaryWriter Send + { + get { return this.send; } + } + + #endregion + + #region \xB7 Constructors \xB7 + + public PgDatabase(string connectionString) + : this(new PgConnectionOptions(connectionString)) + { + } + + public PgDatabase(PgConnectionOptions options) + { + this.options = options; + this.encoding = Encoding.Default; + + GC.SuppressFinalize(this); + } + + #endregion + + #region \xB7 Database Methods \xB7 + + public void Connect() + { + try + { + PgDatabase.InitializeTypes(); + PgDatabase.InitializeCharSets(); + + this.InitializeSocket(); + + lock (this) + { + if (this.options.SSL) + { + // Send SSL request message + if (this.SslRequest()) + { + this.secureStream = new SslStream(this.networkStream, false); + + this.SecureStream.AuthenticateAsClient(this.options.DataSource); + + this.receive = new BinaryReader(this.SecureStream); + this.send = new BinaryWriter(this.SecureStream); + } + } + + // Send Startup message + PgOutputPacket packet = new PgOutputPacket(this.Encoding); + + packet.Write(PgCodes.PROTOCOL_VERSION3); + packet.WriteNullString("user"); + packet.WriteNullString(this.options.UserID); + + if (this.options.Database != null && this.options.Database.Length > 0) + { + packet.WriteNullString("database"); + packet.WriteNullString(this.options.Database); + } + + packet.WriteNullString("DateStyle"); + packet.WriteNullString(PgCodes.DATE_STYLE); + packet.Write((byte)0); // Terminator + + this.SendSimplePacket(packet); + + PgResponsePacket response = null; + + do + { + response = this.ReceiveResponsePacket(); + this.ProcessResponsePacket(response); + } + while (!response.IsReadyForQuery); + } + } + catch (IOException ex) + { + this.Detach(); + throw new PgClientException(ex.Message); + } + catch (PgClientException) + { + this.Detach(); + throw; + } + } + + public void Disconnect() + { + try + { + // Send packet to the server + PgOutputPacket packet = new PgOutputPacket(); + this.SendPacket(packet, PgFrontEndCodes.TERMINATE); + + this.Detach(); + } + catch (IOException ex) + { + throw new PgClientException(ex.Message); + } + catch (PgClientException) + { + throw; + } + } + + #endregion + + #region \xB7 Send Methods \xB7 + + internal void SendPacket(PgOutputPacket packet, char type) + { + this.Write(packet.GetPacketBytes(type)); + } + + internal void SendSimplePacket(PgOutputPacket packet) + { + this.Write(packet.GetSimplePacketBytes()); + } + + private void Write(byte[] buffer) + { + this.Write(buffer, 0, buffer.Length); + } + + private void Write(byte[] buffer, int index, int count) + { + try + { + this.send.Write(buffer, index, count); + this.send.Flush(); + } + catch (IOException) + { + throw; + } + } + + #endregion + + #region \xB7 Response Methods \xB7 + + public PgResponsePacket ReceiveResponsePacket() + { + PgResponsePacket responsePacket = null; + + lock (this) + { + responsePacket = this.ReceiveStandardPacket(); + + switch (responsePacket.Message) + { + case PgBackendCodes.ERROR_RESPONSE: + // Read the error message and trow the exception + PgClientException ex = this.ProcessErrorPacket(responsePacket); + + // Perform a sync + this.Sync(); + + // Throw the PostgreSQL exception + throw ex; + + case PgBackendCodes.NOTICE_RESPONSE: + // Read the notice message and raise an InfoMessage event + this.InfoMessage(this.ProcessErrorPacket(responsePacket)); + break; + + case PgBackendCodes.NOTIFICATION_RESPONSE: + this.ProcessNotificationResponse(responsePacket); + break; + } + } + + return responsePacket; + } + + private PgResponsePacket ReceiveStandardPacket() + { + PgResponsePacket responsePacket = null; + + try + { + char type = this.receive.ReadChar(); + int length = IPAddress.HostToNetworkOrder(this.receive.ReadInt32()) - 4; + + // Read the message data + byte[] buffer = new byte[length]; + int received = 0; + + while (received < length) + { + received += this.receive.Read(buffer, received, length - received); + } + + responsePacket = new PgResponsePacket(type, this.Encoding, buffer); + } + catch (IOException) + { + throw; + } + + return responsePacket; + } + + private void ProcessResponsePacket(PgResponsePacket packet) + { + switch (packet.Message) + { + case PgBackendCodes.AUTHENTICATION: + this.ProcessAuthPacket(packet); + break; + + case PgBackendCodes.PARAMETER_STATUS: + this.ProcessParameterStatus(packet); + break; + + case PgBackendCodes.READY_FOR_QUERY: + this.transactionStatus = packet.ReadChar(); + break; + + case PgBackendCodes.BACKEND_KEY_DATA: + // BackendKeyData + this.handle = packet.ReadInt32(); + this.secretKey = packet.ReadInt32(); + break; + } + } + + private void ProcessParameterStatus(PgResponsePacket packet) + { + string parameterName = packet.ReadNullString(); + string parameterValue = packet.ReadNullString(); + + this.ParameterStatus.Add(parameterName, parameterValue); + + switch (parameterName) + { + case "client_encoding": + this.encoding = Charactersets[parameterValue].Encoding; + break; + } + } + + private void ProcessAuthPacket(PgResponsePacket packet) + { + // Authentication response + int authType = packet.ReadInt32(); + + PgOutputPacket outPacket = new PgOutputPacket(this.Encoding); + + switch (authType) + { + case PgCodes.AUTH_OK: + // Authentication successful + return; + + case PgCodes.AUTH_KERBEROS_V4: + // Kerberos V4 authentication is required + break; + + case PgCodes.AUTH_KERBEROS_V5: + // Kerberos V5 authentication is required + break; + + case PgCodes.AUTH_CLEARTEXT_PASSWORD: + // Cleartext password is required + outPacket.WriteNullString(this.options.Password); + break; + + case PgCodes.AUTH_CRYPT_PASSWORD: + // crypt()-encrypted password is required + break; + + case PgCodes.AUTH_MD5_PASSWORD: + // MD5-encrypted password is required + + // First read salt to use when encrypting the password + byte[] salt = packet.ReadBytes(4); + + // Second calculate md5 of password + user + string userHash = MD5Authentication.GetMD5Hash( + this.Encoding.GetBytes(this.options.UserID), this.options.Password); + + // Third calculate real MD5 hash + string hash = MD5Authentication.GetMD5Hash(salt, userHash); + + // Finally write the md5 hash to the packet + outPacket.WriteNullString(PgCodes.MD5_PREFIX + hash); + break; + + case PgCodes.AUTH_SCM_CREDENTIAL: + // SCM credentials message is required + break; + } + + // Send the packet to the server + this.SendPacket(outPacket, PgFrontEndCodes.PASSWORD_MESSAGE); + } + + private PgClientException ProcessErrorPacket(PgResponsePacket packet) + { + char type = ' '; + PgClientError error = new PgClientError(); + + while (type != PgErrorCodes.END) + { + type = packet.ReadChar(); + switch (type) + { + case PgErrorCodes.SEVERITY: + error.Severity = packet.ReadNullString(); + break; + + case PgErrorCodes.CODE: + error.Code = packet.ReadNullString(); + break; + + case PgErrorCodes.MESSAGE: + error.Message = packet.ReadNullString(); + break; + + case PgErrorCodes.DETAIL: + error.Detail = packet.ReadNullString(); + break; + + case PgErrorCodes.HINT: + error.Hint = packet.ReadNullString(); + break; + + case PgErrorCodes.POSITION: + error.Position = packet.ReadNullString(); + break; + + case PgErrorCodes.WHERE: + error.Where = packet.ReadNullString(); + break; + + case PgErrorCodes.FILE: + error.File = packet.ReadNullString(); + break; + + case PgErrorCodes.LINE: + error.Line = Convert.ToInt32(packet.ReadNullString()); + break; + + case PgErrorCodes.ROUTINE: + error.Routine = packet.ReadNullString(); + break; + } + } + + PgClientException exception = new PgClientException(error.Message); + + exception.Errors.Add(error); + + return exception; + } + + private void ProcessNotificationResponse(PgResponsePacket packet) + { + int processID = packet.ReadInt32(); + string condition = packet.ReadNullString(); + string additional = packet.ReadNullString(); + + if (this.Notification != null) + { + this.Notification(processID, condition, additional); + } + } + + #endregion + + #region \xB7 Transaction Methods \xB7 + + public void BeginTransaction(IsolationLevel isolationLevel) + { + string sql = "START TRANSACTION ISOLATION LEVEL "; + + switch (isolationLevel) + { + case IsolationLevel.ReadCommitted: + sql += "READ COMMITTED"; + break; + + case IsolationLevel.ReadUncommitted: + throw new NotSupportedException("Read uncommitted transaction isolation is not supported"); + + case IsolationLevel.RepeatableRead: + throw new NotSupportedException("Repeatable read transaction isolation is not supported"); + + case IsolationLevel.Serializable: + sql += "SERIALIZABLE"; + break; + } + + PgStatement stmt = CreateStatement(sql); + stmt.Query(); + + if (stmt.Tag != "START TRANSACTION") + { + throw new PgClientException("A transaction is currently active. Parallel transactions are not supported."); + } + + this.transactionStatus = stmt.TransactionStatus; + } + + public void CommitTransaction() + { + PgStatement stmt = CreateStatement("COMMIT TRANSACTION"); + stmt.Query(); + + if (stmt.Tag != "COMMIT") + { + throw new PgClientException("There are no transaction for commit."); + } + + this.transactionStatus = stmt.TransactionStatus; + } + + public void RollbackTransction() + { + PgStatement stmt = CreateStatement("ROLLBACK TRANSACTION"); + stmt.Query(); + + if (stmt.Tag != "ROLLBACK") + { + throw new PgClientException("There are no transaction for rollback."); + } + + this.transactionStatus = stmt.TransactionStatus; + } + + #endregion + + #region \xB7 Client Methods \xB7 + + public void Flush() + { + lock (this) + { + try + { + PgOutputPacket packet = new PgOutputPacket(this.Encoding); + + // Send packet to the server + this.SendPacket(packet, PgFrontEndCodes.FLUSH); + } + catch (Exception) + { + throw; + } + } + } + + public void Sync() + { + lock (this) + { + try + { + PgOutputPacket packet = new PgOutputPacket(this.Encoding); + + // Send packet to the server + this.SendPacket(packet, PgFrontEndCodes.SYNC); + + // Receive response + PgResponsePacket response = null; + + do + { + response = this.ReceiveResponsePacket(); + this.ProcessResponsePacket(response); + } + while (!response.IsReadyForQuery); + } + catch + { + PgResponsePacket response = null; + + do + { + response = this.ReceiveResponsePacket(); + this.ProcessResponsePacket(response); + } + while (!response.IsReadyForQuery); + + throw; + } + } + } + + public void CancelRequest() + { + lock (this) + { + try + { + PgOutputPacket packet = new PgOutputPacket(); + + packet.Write((int)16); + packet.Write(PgCodes.CANCEL_REQUEST); + packet.Write(this.Handle); + packet.Write(this.SecretKey); + + // Send packet to the server + this.SendSimplePacket(packet); + } + catch (Exception) + { + throw; + } + } + } + + public bool SslRequest() + { + bool sslAvailable = false; + + lock (this) + { + try + { + PgOutputPacket packet = new PgOutputPacket(); + + packet.Write(PgCodes.SSL_REQUEST); + + // Send packet to the server + this.SendSimplePacket(packet); + + // Receive server response + switch (Convert.ToChar(this.networkStream.ReadByte())) + { + case 'S': + sslAvailable = true; + break; + + default: + sslAvailable = false; + break; + } + } + catch + { + throw; + } + } + + return sslAvailable; + } + + #endregion + + #region \xB7 Methods \xB7 + + public void SendInfoMessage(PgClientException exception) + { + if (this.InfoMessage != null) + { + this.InfoMessage(exception); + } + } + + public PgStatement CreateStatement() + { + return new PgStatement(this); + } + + public PgStatement CreateStatement(string stmtText) + { + return new PgStatement(this, stmtText); + } + + public PgStatement CreateStatement(string parseName, string portalName) + { + return new PgStatement(this, parseName, portalName); + } + + public PgStatement CreateStatement(string parseName, string portalName, string stmtText) + { + return new PgStatement(this, parseName, portalName, stmtText); + } + + #endregion + + #region \xB7 Private Methods \xB7 + + private void InitializeSocket() + { + IPAddress hostadd = Dns.GetHostEntry(this.options.DataSource).AddressList[0]; + + this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + + // Set Receive Buffer size. + this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, this.options.PacketSize); + + // Set Send Buffer size. + this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, this.options.PacketSize); + + // Disables the Nagle algorithm for send coalescing. + this.socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1); + + // Make the socket to connect to the Server + this.socket.Connect(new IPEndPoint(hostadd, this.options.PortNumber)); + this.networkStream = new NetworkStream(socket, true); + + // Create objects for read & write + this.receive = new BinaryReader(new BufferedStream(this.networkStream)); + this.send = new BinaryWriter(new BufferedStream(this.networkStream)); + + // The socket and stream shouldn't be automatically collected by the GC + GC.SuppressFinalize(this.socket); + GC.SuppressFinalize(this.networkStream); + GC.SuppressFinalize(this.receive); + GC.SuppressFinalize(this.send); + } + + private void Detach() + { + // Close streams + if (this.secureStream != null) + { + try + { + this.secureStream.Close(); + } + catch + { + } + } + if (this.networkStream != null) + { + this.networkStream.Close(); + } + if (this.socket != null) + { + this.socket.Close(); + } + } + + #endregion + } +} Deleted: pgsqlclient/source/PostgreSql/Data/Protocol/PgDbClient.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgDbClient.cs 2006-03-13 21:42:55 UTC (rev 22) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgDbClient.cs 2006-03-13 21:45:11 UTC (rev 23) @@ -1,858 +0,0 @@ -/* - * PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ - * - * The contents of this file are subject to the Initial - * Developer's Public License Version 1.0 (the "License"); - * you may not use this file except in compliance with the - * License. - * - * Software distributed under the License is distributed on - * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either - * express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez - * All Rights Reserved. - */ - -using System; -using System.Data; -using System.IO; -using System.Collections; -using System.Text; -using System.Net; -using System.Net.Sockets; -using System.Net.Security; - -namespace PostgreSql.Data.Protocol -{ - internal class PgDbClient - { - #region \xB7 Static Properties \xB7 - - public static readonly PgTypeCollection DataTypes = new PgTypeCollection(); - public static readonly PgCharactersetCollection Charactersets = new PgCharactersetCollection(); - - #endregion - - #region \xB7 Static Methods \xB7 - - public static void InitializeTypes() - { - if (DataTypes.Count > 0) - { - return; - } - - DataTypes.Add(16 , "bool" , PgDataType.Boolean , 0, PgTypeFormat.Binary, 1); - DataTypes.Add(17 , "bytea" , PgDataType.Binary , 0, PgTypeFormat.Binary, 0); - DataTypes.Add(18 , "char" , PgDataType.Char , 0, PgTypeFormat.Text, 0); - DataTypes.Add(19 , "name" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); - DataTypes.Add(20 , "int8" , PgDataType.Int8 , 0, PgTypeFormat.Binary, 8); - DataTypes.Add(21 , "int2" , PgDataType.Int2 , 0, PgTypeFormat.Binary, 2); - DataTypes.Add(22 , "int2vector" , PgDataType.Vector , 21, PgTypeFormat.Binary, 2); - DataTypes.Add(23 , "int4" , PgDataType.Int4 , 0, PgTypeFormat.Binary, 4); - DataTypes.Add(24 , "regproc" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); - DataTypes.Add(25 , "text" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); - DataTypes.Add(26 , "oid" , PgDataType.Int4 , 0, PgTypeFormat.Binary, 4); - DataTypes.Add(30 , "oidvector" , PgDataType.Vector , 26, PgTypeFormat.Binary, 4); - DataTypes.Add(600 , "point" , PgDataType.Point , 701, PgTypeFormat.Binary, 16); - DataTypes.Add(601 , "lseg" , PgDataType.LSeg , 600, PgTypeFormat.Binary, 32); - DataTypes.Add(602 , "path" , PgDataType.Path , 0, PgTypeFormat.Binary, 16); - DataTypes.Add(603 , "box" , PgDataType.Box , 600, PgTypeFormat.Binary, 32); - DataTypes.Add(604 , "polygon" , PgDataType.Polygon , 0, PgTypeFormat.Binary, 16); - DataTypes.Add(628 , "line" , PgDataType.Line , 701, PgTypeFormat.Binary, 32); - DataTypes.Add(629 , "_line" , PgDataType.Array , 628, PgTypeFormat.Binary, 32); - DataTypes.Add(718 , "circle" , PgDataType.Circle , 0, PgTypeFormat.Binary, 24); - DataTypes.Add(719 , "_circle" , PgDataType.Array , 718, PgTypeFormat.Binary, 24); - DataTypes.Add(700 , "float4" , PgDataType.Float , 0, PgTypeFormat.Binary, 4); - DataTypes.Add(701 , "float8" , PgDataType.Double , 0, PgTypeFormat.Binary, 8); - DataTypes.Add(705 , "unknown" , PgDataType.Binary , 0, PgTypeFormat.Binary, 0); - DataTypes.Add(790 , "money" , PgDataType.Currency , 0, PgTypeFormat.Binary, 4); - DataTypes.Add(829 , "macaddr" , PgDataType.VarChar , 0, PgTypeFormat.Text, 6); - DataTypes.Add(869 , "inet" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); - DataTypes.Add(1000 , "_bool" , PgDataType.Array , 16, PgTypeFormat.Binary, 1); - DataTypes.Add(1005 , "_int2" , PgDataType.Array , 21, PgTypeFormat.Binary, 2); - DataTypes.Add(1007 , "_int4" , PgDataType.Array , 23, PgTypeFormat.Binary, 4); - DataTypes.Add(1009 , "_text" , PgDataType.Array , 25, PgTypeFormat.Binary, 0); - DataTypes.Add(1016 , "_int8" , PgDataType.Array , 20, PgTypeFormat.Binary, 8); - DataTypes.Add(1017 , "_point" , PgDataType.Array , 600, PgTypeFormat.Binary, 16); - DataTypes.Add(1018 , "_lseg" , PgDataType.Array , 601, PgTypeFormat.Binary, 32); - DataTypes.Add(1019 , "_path" , PgDataType.Array , 602, PgTypeFormat.Binary, -1); - DataTypes.Add(1020 , "_box" , PgDataType.Array , 603, PgTypeFormat.Binary, 32); - DataTypes.Add(1021 , "_float4" , PgDataType.Array , 700, PgTypeFormat.Binary, 4); - DataTypes.Add(1027 , "_polygon" , PgDataType.Array , 604, PgTypeFormat.Binary, 16); - DataTypes.Add(1033 , "aclitem" , PgDataType.VarChar , 0, PgTypeFormat.Text, 12); - DataTypes.Add(1034 , "_aclitem" , PgDataType.Array , 1033, PgTypeFormat.Text, 0); - DataTypes.Add(1042 , "bpchar" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); - DataTypes.Add(1043 , "varchar" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); - DataTypes.Add(1082 , "date" , PgDataType.Date , 0, PgTypeFormat.Binary, 4); - DataTypes.Add(1083 , "time" , PgDataType.Time , 0, PgTypeFormat.Text, 8); - DataTypes.Add(1114 , "timestamp" , PgDataType.Timestamp , 0, PgTypeFormat.Text, 8); - DataTypes.Add(1184 , "timestamptz" , PgDataType.TimestampWithTZ, 0, PgTypeFormat.Binary, 8); - DataTypes.Add(1186 , "interval" , PgDataType.Interval , 0, PgTypeFormat.Binary, 12); - DataTypes.Add(1266 , "timetz" , PgDataType.TimeWithTZ , 0, PgTypeFormat.Binary, 12); - DataTypes.Add(1560 , "bit" , PgDataType.Byte , 0, PgTypeFormat.Text, 1); - DataTypes.Add(1562 , "varbit" , PgDataType.Byte , 0, PgTypeFormat.Binary, 0); - DataTypes.Add(1700 , "numeric" , PgDataType.Decimal , 0, PgTypeFormat.Text, 8); - DataTypes.Add(1790 , "refcursor" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); - DataTypes.Add(2277 , "anyarray" , PgDataType.Array , 0, PgTypeFormat.Binary, 8); - } - - public static void InitializeCharSets() - { - if (Charactersets.Count > 0) - { - return; - } - - Charactersets.Add("SQL_ASCII" , "ascii"); // ASCII - Charactersets.Add("EUC_JP" , "euc-jp"); // Japanese EUC - Charactersets.Add("EUC_CN" , "euc-cn"); // Chinese EUC - Charactersets.Add("UNICODE" , "UTF-8"); // Unicode (UTF-8) - Charactersets.Add("LATIN1" , "iso-8859-1"); // ISO 8859-1/ECMA 94 (Latin alphabet no.1) - Charactersets.Add("LATIN2" , "iso-8859-2"); // ISO 8859-2/ECMA 94 (Latin alphabet no.2) - Charactersets.Add("LATIN4" , 1257); // ISO 8859-4/ECMA 94 (Latin alphabet no.4) - Charactersets.Add("ISO_8859_7" , 1253); // ISO 8859-7/ECMA 118 (Latin/Greek) - Charactersets.Add("LATIN9" , "iso-8859-15"); // ISO 8859-15 (Latin alphabet no.9) - Charactersets.Add("KOI8" , "koi8-r"); // KOI8-R(U) - Charactersets.Add("WIN" , "windows-1251"); // Windows CP1251 - Charactersets.Add("WIN1256" , "windows-1256"); // Windows CP1256 (Arabic) - Charactersets.Add("WIN1256" , "windows-1256"); // Windows CP1256 (Arabic) - Charactersets.Add("WIN1256" , "windows-1258"); // TCVN-5712/Windows CP1258 (Vietnamese) - Charactersets.Add("WIN1256" , "windows-874"); // Windows CP874 (Thai) - } - - #endregion - - #region \xB7 Callbacks \xB7 - - public NotificationCallback Notification - { - get { return this.notification; } - set { this.notification = value; } - } - - public InfoMessageCallback InfoMessage - { - get { return this.infoMessage; } - set { this.infoMessage = value; } - } - - #endregion - - #region \xB7 Fields \xB7 - - private NotificationCallback notification; - private InfoMessageCallback infoMessage; - - private int handle; - private int secretKey; - private Hashtable parameterStatus; - private Socket socket; - private NetworkStream networkStream; - private SslStream secureStream; - private BinaryReader receive; - private BinaryWriter send; - private PgConnectionOptions options; - private Encoding encoding; - private char transactionStatus; - - #endregion - - #region \xB7 Properties \xB7 - - public int Handle - { - get { return this.handle; } - } - - public int SecretKey - { - get { return this.secretKey; } - } - - public Hashtable ParameterStatus - { - get - { - if (this.parameterStatus == null) - { - this.parameterStatus = Hashtable.Synchronized(new Hashtable()); - } - return this.parameterStatus; - } - } - - public PgConnectionOptions Options - { - get { return this.options; } - } - - public Encoding Encoding - { - get { return this.encoding; } - } - - #endregion - - #region \xB7 Internal Properties \xB7 - - internal SslStream SecureStream - { - get { return this.secureStream; } - } - - internal BinaryReader Receive - { - get { return this.receive; } - } - - internal BinaryWriter Send - { - get { return this.send; } - } - - #endregion - - #region \xB7 Constructors \xB7 - - public PgDbClient(string connectionString) - : this(new PgConnectionOptions(connectionString)) - { - } - - public PgDbClient(PgConnectionOptions options) - { - this.options = options; - this.encoding = Encoding.Default; - - GC.SuppressFinalize(this); - } - - #endregion - - #region \xB7 Database Methods \xB7 - - public void Connect() - { - try - { - PgDbClient.InitializeTypes(); - PgDbClient.InitializeCharSets(); - - this.InitializeSocket(); - - lock (this) - { - if (this.options.SSL) - { - // Send SSL request message - if (this.SslRequest()) - { - this.secureStream = new SslStream(this.networkStream, false); - - this.SecureStream.AuthenticateAsClient(this.options.DataSource); - - this.receive = new BinaryReader(this.SecureStream); - this.send = new BinaryWriter(this.SecureStream); - } - } - - // Send Startup message - PgOutputPacket packet = new PgOutputPacket(this.Encoding); - - packet.Write(PgCodes.PROTOCOL_VERSION3); - packet.WriteNullString("user"); - packet.WriteNullString(this.options.UserID); - - if (this.options.Database != null && this.options.Database.Length > 0) - { - packet.WriteNullString("database"); - packet.WriteNullString(this.options.Database); - } - - packet.WriteNullString("DateStyle"); - packet.WriteNullString(PgCodes.DATE_STYLE); - packet.Write((byte)0); // Terminator - - this.SendSimplePacket(packet); - - PgResponsePacket response = null; - - do - { - response = this.ReceiveResponsePacket(); - this.ProcessResponsePacket(response); - } - while (!response.IsReadyForQuery); - } - } - catch (IOException ex) - { - this.Detach(); - throw new PgClientException(ex.Message); - } - catch (PgClientException) - { - this.Detach(); - throw; - } - } - - public void Disconnect() - { - try - { - // Send packet to the server - PgOutputPacket packet = new PgOutputPacket(); - this.SendPacket(packet, PgFrontEndCodes.TERMINATE); - - this.Detach(); - } - catch (IOException ex) - { - throw new PgClientException(ex.Message); - } - catch (PgClientException) - { - throw; - } - } - - #endregion - - #region \xB7 Send Methods \xB7 - - internal void SendPacket(PgOutputPacket packet, char type) - { - this.Write(packet.GetPacketBytes(type)); - } - - internal void SendSimplePacket(PgOutputPacket packet) - { - this.Write(packet.GetSimplePacketBytes()); - } - - private void Write(byte[] buffer) - { - this.Write(buffer, 0, buffer.Length); - } - - private void Write(byte[] buffer, int index, int count) - { - try - { - this.send.Write(buffer, index, count); - this.send.Flush(); - } - catch (IOException) - { - throw; - } - } - - #endregion - - #region \xB7 Response Methods \xB7 - - public PgResponsePacket ReceiveResponsePacket() - { - PgResponsePacket responsePacket = null; - - lock (this) - { - responsePacket = this.ReceiveStandardPacket(); - - switch (responsePacket.Message) - { - case PgBackendCodes.ERROR_RESPONSE: - // Read the error message and trow the exception - PgClientException ex = this.ProcessErrorPacket(responsePacket); - - // Perform a sync - this.Sync(); - - // Throw the PostgreSQL exception - throw ex; - - case PgBackendCodes.NOTICE_RESPONSE: - // Read the notice message and raise an InfoMessage event - this.InfoMessage(this.ProcessErrorPacket(responsePacket)); - break; - - case PgBackendCodes.NOTIFICATION_RESPONSE: - this.ProcessNotificationResponse(responsePacket); - break; - } - } - - return responsePacket; - } - - private PgResponsePacket ReceiveStandardPacket() - { - PgResponsePacket responsePacket = null; - - try - { - char type = this.receive.ReadChar(); - int length = IPAddress.HostToNetworkOrder(this.receive.ReadInt32()) - 4; - - // Read the message data - byte[] buffer = new byte[length]; - int received = 0; - - while (received < length) - { - received += this.receive.Read(buffer, received, length - received); - } - - responsePacket = new PgResponsePacket(type, this.Encoding, buffer); - } - catch (IOException) - { - throw; - } - - return responsePacket; - } - - private void ProcessResponsePacket(PgResponsePacket packet) - { - switch (packet.Message) - { - case PgBackendCodes.AUTHENTICATION: - this.ProcessAuthPacket(packet); - break; - - case PgBackendCodes.PARAMETER_STATUS: - this.ProcessParameterStatus(packet); - break; - - case PgBackendCodes.READY_FOR_QUERY: - this.transactionStatus = packet.ReadChar(); - break; - - case PgBackendCodes.BACKEND_KEY_DATA: - // BackendKeyData - this.handle = packet.ReadInt32(); - this.secretKey = packet.ReadInt32(); - break; - } - } - - private void ProcessParameterStatus(PgResponsePacket packet) - { - string parameterName = packet.ReadNullString(); - string parameterValue = packet.ReadNullString(); - - this.ParameterStatus.Add(parameterName, parameterValue); - - switch (parameterName) - { - case "client_encoding": - this.encoding = Charactersets[parameterValue].Encoding; - break; - } - } - - private void ProcessAuthPacket(PgResponsePacket packet) - { - // Authentication response - int authType = packet.ReadInt32(); - - PgOutputPacket outPacket = new PgOutputPacket(this.Encoding); - - switch (authType) - { - case PgCodes.AUTH_OK: - // Authentication successful - return; - - case PgCodes.AUTH_KERBEROS_V4: - // Kerberos V4 authentication is required - break; - - case PgCodes.AUTH_KERBEROS_V5: - // Kerberos V5 authentication is required - break; - - case PgCodes.AUTH_CLEARTEXT_PASSWORD: - // Cleartext password is required - outPacket.WriteNullString(this.options.Password); - break; - - case PgCodes.AUTH_CRYPT_PASSWORD: - // crypt()-encrypted password is required - break; - - case PgCodes.AUTH_MD5_PASSWORD: - // MD5-encrypted password is required - - // First read salt to use when encrypting the password - byte[] salt = packet.ReadBytes(4); - - // Second calculate md5 of password + user - string userHash = MD5Authentication.GetMD5Hash( - this.Encoding.GetBytes(this.options.UserID), this.options.Password); - - // Third calculate real MD5 hash - string hash = MD5Authentication.GetMD5Hash(salt, userHash); - - // Finally write the md5 hash to the packet - outPacket.WriteNullString(PgCodes.MD5_PREFIX + hash); - break; - - case PgCodes.AUTH_SCM_CREDENTIAL: - // SCM credentials message is required - break; - } - - // Send the packet to the server - this.SendPacket(outPacket, PgFrontEndCodes.PASSWORD_MESSAGE); - } - - private PgClientException ProcessErrorPacket(PgResponsePacket packet) - { - char type = ' '; - PgClientError error = new PgClientError(); - - while (type != PgErrorCodes.END) - { - type = packet.ReadChar(); - switch (type) - { - case PgErrorCodes.SEVERITY: - error.Severity = packet.ReadNullString(); - break; - - case PgErrorCodes.CODE: - error.Code = packet.ReadNullString(); - break; - - case PgErrorCodes.MESSAGE: - error.Message = packet.ReadNullString(); - break; - - case PgErrorCodes.DETAIL: - error.Detail = packet.ReadNullString(); - break; - - case PgErrorCodes.HINT: - error.Hint = packet.ReadNullString(); - break; - - case PgErrorCodes.POSITION: - error.Position = packet.ReadNullString(); - break; - - case PgErrorCodes.WHERE: - error.Where = packet.ReadNullString(); - break; - - case PgErrorCodes.FILE: - error.File = packet.ReadNullString(); - break; - - case PgErrorCodes.LINE: - error.Line = Convert.ToInt32(packet.ReadNullString()); - break; - - case PgErrorCodes.ROUTINE: - error.Routine = packet.ReadNullString(); - break; - } - } - - PgClientException exception = new PgClientException(error.Message); - - exception.Errors.Add(error); - - return exception; - } - - private void ProcessNotificationResponse(PgResponsePacket packet) - { - int processID = packet.ReadInt32(); - string condition = packet.ReadNullString(); - string additional = packet.ReadNullString(); - - if (this.Notification != null) - { - this.Notification(processID, condition, additional); - } - } - - #endregion - - #region \xB7 Transaction Methods \xB7 - - public void BeginTransaction(IsolationLevel isolationLevel) - { - string sql = "START TRANSACTION ISOLATION LEVEL "; - - switch (isolationLevel) - { - case IsolationLevel.ReadCommitted: - sql += "READ COMMITTED"; - break; - - case IsolationLevel.ReadUncommitted: - throw new NotSupportedException("Read uncommitted transaction isolation is not supported"); - - case IsolationLevel.RepeatableRead: - throw new NotSupportedException("Repeatable read transaction isolation is not supported"); - - case IsolationLevel.Serializable: - sql += "SERIALIZABLE"; - break; - } - - PgStatement stmt = CreateStatement(sql); - stmt.Query(); - - if (stmt.Tag != "START TRANSACTION") - { - throw new PgClientException("A transaction is currently active. Parallel transactions are not supported."); - } - - this.transactionStatus = stmt.TransactionStatus; - } - - public void CommitTransaction() - { - PgStatement stmt = CreateStatement("COMMIT TRANSACTION"); - stmt.Query(); - - if (stmt.Tag != "COMMIT") - { - throw new PgClientException("There are no transaction for commit."); - } - - this.transactionStatus = stmt.TransactionStatus; - } - - public void RollbackTransction() - { - PgStatement stmt = CreateStatement("ROLLBACK TRANSACTION"); - stmt.Query(); - - if (stmt.Tag != "ROLLBACK") - { - throw new PgClientException("There are no transaction for rollback."); - } - - this.transactionStatus = stmt.TransactionStatus; - } - - #endregion - - #region \xB7 Client Methods \xB7 - - public void Flush() - { - lock (this) - { - try - { - PgOutputPacket packet = new PgOutputPacket(this.Encoding); - - // Send packet to the server - this.SendPacket(packet, PgFrontEndCodes.FLUSH); - } - catch (Exception) - { - throw; - } - } - } - - public void Sync() - { - lock (this) - { - try - { - PgOutputPacket packet = new PgOutputPacket(this.Encoding); - - // Send packet to the server - this.SendPacket(packet, PgFrontEndCodes.SYNC); - - // Receive response - PgResponsePacket response = null; - - do - { - response = this.ReceiveResponsePacket(); - this.ProcessResponsePacket(response); - } - while (!response.IsReadyForQuery); - } - catch - { - PgResponsePacket response = null; - - do - { - response = this.ReceiveResponsePacket(); - this.ProcessResponsePacket(response); - } - while (!response.IsReadyForQuery); - - throw; - } - } - } - - public void CancelRequest() - { - lock (this) - { - try - { - PgOutputPacket packet = new PgOutputPacket(); - - packet.Write((int)16); - packet.Write(PgCodes.CANCEL_REQUEST); - packet.Write(this.Handle); - packet.Write(this.SecretKey); - - // Send packet to the server - this.SendSimplePacket(packet); - } - catch (Exception) - { - throw; - } - } - } - - public bool SslRequest() - { - bool sslAvailable = false; - - lock (this) - { - try - { - PgOutputPacket packet = new PgOutputPacket(); - - packet.Write(PgCodes.SSL_REQUEST); - - // Send packet to the server - this.SendSimplePacket(packet); - - // Receive server response - switch (Convert.ToChar(this.networkStream.ReadByte())) - { - case 'S': - sslAvailable = true; - break; - - default: - sslAvailable = false; - break; - } - } - catch - { - throw; - } - } - - return sslAvailable; - } - - #endregion - - #region \xB7 Methods \xB7 - - public void SendInfoMessage(PgClientException exception) - { - if (this.InfoMessage != null) - { - this.InfoMessage(exception); - } - } - - public PgStatement CreateStatement() - { - return new PgStatement(this); - } - - public PgStatement CreateStatement(string stmtText) - { - return new PgStatement(this, stmtText); - } - - public PgStatement CreateStatement(string parseName, string portalName) - { - return new PgStatement(this, parseName, portalName); - } - - public PgStatement CreateStatement(string parseName, string portalName, string stmtText) - { - return new PgStatement(this, parseName, portalName, stmtText); - } - - #endregion - - #region \xB7 Private Methods \xB7 - - private void InitializeSocket() - { - IPAddress hostadd = Dns.GetHostEntry(this.options.DataSource).AddressList[0]; - - this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - - // Set Receive Buffer size. - this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, this.options.PacketSize); - - // Set Send Buffer size. - this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, this.options.PacketSize); - - // Disables the Nagle algorithm for send coalescing. - this.socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1); - - // Make the socket to connect to the Server - this.socket.Connect(new IPEndPoint(hostadd, this.options.PortNumber)); - this.networkStream = new NetworkStream(socket, true); - - // Create objects for read & write - this.receive = new BinaryReader(new BufferedStream(this.networkStream)); - this.send = new BinaryWriter(new BufferedStream(this.networkStream)); - - // The socket and stream shouldn't be automatically collected by the GC - GC.SuppressFinalize(this.socket); - GC.SuppressFinalize(this.networkStream); - GC.SuppressFinalize(this.receive); - GC.SuppressFinalize(this.send); - } - - private void Detach() - { - // Close streams - if (this.secureStream != null) - { - try - { - this.secureStream.Close(); - } - catch - { - } - } - if (this.networkStream != null) - { - this.networkStream.Close(); - } - if (this.socket != null) - { - this.socket.Close(); - } - } - - #endregion - } -} Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs 2006-03-13 21:42:55 UTC (rev 22) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs 2006-03-13 21:45:11 UTC (rev 23) @@ -271,7 +271,7 @@ System.Array array = (System.Array)parameter.Value; // Get array elements type info - PgType elementType = PgDbClient.DataTypes[parameter.DataType.ElementType]; + PgType elementType = PgDatabase.DataTypes[parameter.DataType.ElementType]; size = elementType.Size; // Create a new packet for write array parameter information Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgParameter.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgParameter.cs 2006-03-13 21:42:55 UTC (rev 22) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgParameter.cs 2006-03-13 21:45:11 UTC (rev 23) @@ -52,7 +52,7 @@ public PgParameter(int dataType) { - this.dataType = PgDbClient.DataTypes[dataType]; + this.dataType = PgDatabase.DataTypes[dataType]; } public PgParameter(int dataType, object data) : this(dataType) Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs 2006-03-13 21:42:55 UTC (rev 22) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs 2006-03-13 21:45:11 UTC (rev 23) @@ -283,7 +283,7 @@ } // Read array element type - PgType elementType = PgDbClient.DataTypes[this.ReadInt32()]; + PgType elementType = PgDatabase.DataTypes[this.ReadInt32()]; // Read array lengths and lower bounds for (int i = 0; i < dimensions; i++) @@ -306,7 +306,7 @@ public Array ReadVector(PgType type, int length) { - PgType elementType = PgDbClient.DataTypes[type.ElementType]; + PgType elementType = PgDatabase.DataTypes[type.ElementType]; Array data = null; data = Array.CreateInstance(elementType.SystemType, PgCodes.INDEX_MAX_KEYS); @@ -592,7 +592,7 @@ private Array ReadStringArray(PgType type, int length) { - PgType elementType = PgDbClient.DataTypes[type.ElementType]; + PgType elementType = PgDatabase.DataTypes[type.ElementType]; Array data = null; string contents = ReadString(length); Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgStatement.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgStatement.cs 2006-03-13 21:42:55 UTC (rev 22) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgStatement.cs 2006-03-13 21:45:11 UTC (rev 23) @@ -26,8 +26,7 @@ { #region \xB7 Fields \xB7 - private PgDbClient db; - + private PgDatabase db; private string stmtText; private bool hasRows; private string tag; @@ -49,7 +48,7 @@ #region \xB7 Properties \xB7 - public PgDbClient DbHandle + public PgDatabase DbHandle { get { return this.db; } set { this.db = value; } @@ -127,15 +126,18 @@ { } - public PgStatement(PgDbClient db) : this(db, null, null) + public PgStatement(PgDatabase db) + : this(db, null, null) { } - public PgStatement(PgDbClient db, string parseName, string portalName) : this(db, parseName, portalName, null) + public PgStatement(PgDatabase db, string parseName, string portalName) + : this(db, parseName, portalName, null) { } - public PgStatement(PgDbClient db, string stmtText) : this(db, null, null, stmtText) + public PgStatement(PgDatabase db, string stmtText) + : this(db, null, null, stmtText) { } @@ -143,7 +145,7 @@ { } - public PgStatement(PgDbClient db, string parseName, string portalName, string stmtText) + public PgStatement(PgDatabase db, string parseName, string portalName, string stmtText) { this.db = db; this.outParameter = new PgParameter(); @@ -698,7 +700,7 @@ this.rowDescriptor.Fields[i].FieldName = packet.ReadNullString(); this.rowDescriptor.Fields[i].OidTable = packet.ReadInt32(); this.rowDescriptor.Fields[i].OidNumber = packet.ReadInt16(); - this.rowDescriptor.Fields[i].DataType = PgDbClient.DataTypes[packet.ReadInt32()]; + this.rowDescriptor.Fields[i].DataType = PgDatabase.DataTypes[packet.ReadInt32()]; this.rowDescriptor.Fields[i].DataTypeSize = packet.ReadInt16(); this.rowDescriptor.Fields[i].TypeModifier = packet.ReadInt32(); this.rowDescriptor.Fields[i].FormatCode = (PgTypeFormat)packet.ReadInt16(); Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgType.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgType.cs 2006-03-13 21:42:55 UTC (rev 22) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgType.cs 2006-03-13 21:45:11 UTC (rev 23) @@ -62,9 +62,9 @@ { int type = elementType; - while (PgDbClient.DataTypes[type].DataType == PgDataType.Array) + while (PgDatabase.DataTypes[type].DataType == PgDataType.Array) { - type = PgDbClient.DataTypes[type].ElementType; + type = PgDatabase.DataTypes[type].ElementType; } return type; Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) Modified: pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj =================================================================== --- pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj 2006-03-13 21:42:55 UTC (rev 22) +++ pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj 2006-03-13 21:45:11 UTC (rev 23) @@ -11,8 +11,7 @@ <AssemblyKeyContainerName> </AssemblyKeyContainerName> <AssemblyName>SecureSocketLayer</AssemblyName> - <AssemblyOriginatorKeyFile> - </AssemblyOriginatorKeyFile> + <AssemblyOriginatorKeyFile>SecureSocketLayer.snk</AssemblyOriginatorKeyFile> <DefaultClientScript>JScript</DefaultClientScript> <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> <DefaultTargetSchema>IE50</DefaultTargetSchema> @@ -26,6 +25,7 @@ </FileUpgradeFlags> <UpgradeBackupLocation> </UpgradeBackupLocation> + <SignAssembly>true</SignAssembly> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <OutputPath>bin\Debug\</OutputPath>... [truncated message content] |
From: <car...@us...> - 2006-03-16 12:14:24
|
Revision: 28 Author: carlosga_fb Date: 2006-03-16 04:14:06 -0800 (Thu, 16 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=28&view=rev Log Message: ----------- Added handlers and events for the SSL callbacks Modified Paths: -------------- pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj.user pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo pgsqlclient/source/SecureSocketLayer/Net/Security/LocalCertificateSelectionCallback.cs Modified: pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-03-13 21:53:07 UTC (rev 27) +++ pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-03-16 12:14:06 UTC (rev 28) @@ -20,7 +20,7 @@ <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>TRACE;DEBUG;CUSTOM_SSL</DefineConstants> + <DefineConstants>TRACE;DEBUG</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> Modified: pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj.user =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj.user 2006-03-13 21:53:07 UTC (rev 27) +++ pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj.user 2006-03-16 12:14:06 UTC (rev 28) @@ -1,6 +1,6 @@ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <LastOpenVersion>8.0.50215</LastOpenVersion> - <ProjectView>ShowAllFiles</ProjectView> + <ProjectView>ProjectFiles</ProjectView> </PropertyGroup> </Project> \ No newline at end of file Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs 2006-03-13 21:53:07 UTC (rev 27) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs 2006-03-16 12:14:06 UTC (rev 28) @@ -22,8 +22,14 @@ using System.Drawing; using System.Collections; using System.ComponentModel; +using System.Security.Cryptography.X509Certificates; using PostgreSql.Data.Protocol; using PostgreSql.Data.Schema; +#if (CUSTOM_SSL) +using SecureSocketLayer.Net.Security; +#else +using System.Net.Security; +#endif namespace PostgreSql.Data.PostgreSqlClient { @@ -41,11 +47,8 @@ #region \xB7 SSL Events \xB7 -#warning SSL Support pending - /* - public event CertficateV ServerCertificateValidation; - public event CertificateSelectionCallback ClientCertificateSelection; - */ + public event RemoteCertificateValidationCallback UserCertificateValidation; + public event LocalCertificateSelectionCallback UserCertificateSelection; #endregion @@ -184,15 +187,15 @@ { } - public PgConnection(string connString) + public PgConnection(string connectionString) : base() { this.state = ConnectionState.Closed; this.connectionString = String.Empty; - if (connString != null) + if (connectionString != null) { - this.ConnectionString = connString; + this.ConnectionString = connectionString; } } @@ -337,6 +340,10 @@ // Add notification event handler this.connectionInternal.Database.Notification = new NotificationCallback(this.OnNotification); + + // Add SSL callback handlers + this.connectionInternal.Database.UserCertificateValidationCallback = new RemoteCertificateValidationCallback(OnUserCertificateValidation); + this.connectionInternal.Database.UserCertificateSelectionCallback = new LocalCertificateSelectionCallback(OnUserCertificateSelection); } catch (PgClientException ex) { @@ -361,14 +368,17 @@ // Remove notification callback this.connectionInternal.Database.Notification = null; + // Remove SSL callback handlers + this.connectionInternal.Database.UserCertificateValidationCallback = null; + this.connectionInternal.Database.UserCertificateSelectionCallback = null; + // Dispose Active commands this.connectionInternal.ClosePreparedCommands(); // Rollback active transaction this.connectionInternal.DisposeActiveTransaction(); - // Close connection permanently or send it - // back to the pool + // Close connection permanently or send it back to the pool if (this.connectionInternal.Pooled) { PgConnectionPool.FreeConnection(this.connectionInternal); @@ -385,9 +395,7 @@ // Raise StateChange event if (this.StateChange != null) { - this.StateChange( - this, - new StateChangeEventArgs(ConnectionState.Open, this.state)); + this.StateChange(this, new StateChangeEventArgs(ConnectionState.Open, this.state)); } } catch (PgClientException ex) @@ -449,6 +457,35 @@ } } + private bool OnUserCertificateValidation( + object sender, + X509Certificate certificate, + X509Chain chain, + SslPolicyErrors sslPolicyErrors) + { + if (this.UserCertificateValidation != null) + { + return this.UserCertificateValidation(this, certificate, chain, sslPolicyErrors); + } + + return false; + } + + private X509Certificate OnUserCertificateSelection( + object sender, + string targetHost, + X509CertificateCollection localCertificates, + X509Certificate remoteCertificate, + string[] acceptableIssuers) + { + if (this.UserCertificateSelection != null) + { + return this.UserCertificateSelection(this, targetHost, localCertificates, remoteCertificate, acceptableIssuers); + } + + return null; + } + #endregion } } Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-03-13 21:53:07 UTC (rev 27) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-03-16 12:14:06 UTC (rev 28) @@ -130,8 +130,18 @@ #endregion - #region \xB7 Callbacks \xB7 + #region \xB7 Callback Fields \xB7 + private NotificationCallback notification; + private InfoMessageCallback infoMessage; + + private RemoteCertificateValidationCallback userCertificateValidationCallback; + private LocalCertificateSelectionCallback userCertificateSelectionCallback; + + #endregion + + #region \xB7 Callback Properties \xB7 + public NotificationCallback Notification { get { return this.notification; } @@ -144,24 +154,33 @@ set { this.infoMessage = value; } } + public RemoteCertificateValidationCallback UserCertificateValidationCallback + { + get { return this.userCertificateValidationCallback; } + set { this.userCertificateValidationCallback = value; } + } + + public LocalCertificateSelectionCallback UserCertificateSelectionCallback + { + get { return this.userCertificateSelectionCallback; } + set { this.userCertificateSelectionCallback = value; } + } + #endregion #region \xB7 Fields \xB7 - private NotificationCallback notification; - private InfoMessageCallback infoMessage; - - private int handle; - private int secretKey; private Hashtable parameterStatus; - private Socket socket; + private Encoding encoding; + private Socket socket; private NetworkStream networkStream; private SslStream secureStream; private BinaryReader receive; private BinaryWriter send; private PgConnectionOptions options; - private Encoding encoding; - private char transactionStatus; + private int handle; + private int secretKey; + private char transactionStatus; #endregion @@ -255,7 +274,11 @@ // Send SSL request message if (this.SslRequest()) { - this.secureStream = new SslStream(this.networkStream, false); + this.secureStream = new SslStream( + this.networkStream, + false, + this.UserCertificateValidationCallback, + this.UserCertificateSelectionCallback); this.SecureStream.AuthenticateAsClient(this.options.DataSource); Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) Modified: pgsqlclient/source/SecureSocketLayer/Net/Security/LocalCertificateSelectionCallback.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Net/Security/LocalCertificateSelectionCallback.cs 2006-03-13 21:53:07 UTC (rev 27) +++ pgsqlclient/source/SecureSocketLayer/Net/Security/LocalCertificateSelectionCallback.cs 2006-03-16 12:14:06 UTC (rev 28) @@ -1,40 +1,40 @@ -// Secure Sockets Layer / Transport Security Layer Implementation -// Copyright(c) 2004-2005 Carlos Guzman Alvarez - -// -// 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. -// - -#if NET_2_0 - -using System; -using System.Security.Cryptography.X509Certificates; - -namespace SecureSocketLayer.Net.Security -{ - public delegate X509Certificate LocalCertificateSelectionCallback( - object sender, - string targetHost, +// Secure Sockets Layer / Transport Security Layer Implementation +// Copyright(c) 2004-2005 Carlos Guzman Alvarez + +// +// 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. +// + +#if NET_2_0 + +using System; +using System.Security.Cryptography.X509Certificates; + +namespace SecureSocketLayer.Net.Security +{ + public delegate X509Certificate LocalCertificateSelectionCallback( + object sender, + string targetHost, X509CertificateCollection localCertificates, - X509Certificate remoteCertificate, - string[] acceptableIssuers); -} - -#endif + X509Certificate remoteCertificate, + string[] acceptableIssuers); +} + +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-03-16 15:02:30
|
Revision: 29 Author: carlosga_fb Date: 2006-03-16 07:02:15 -0800 (Thu, 16 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=29&view=rev Log Message: ----------- Added UTF8 to the list of character sets Modified Paths: -------------- pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.sln pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-03-16 12:14:06 UTC (rev 28) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-03-16 15:02:15 UTC (rev 29) @@ -115,6 +115,7 @@ Charactersets.Add("EUC_JP" , "euc-jp"); // Japanese EUC Charactersets.Add("EUC_CN" , "euc-cn"); // Chinese EUC Charactersets.Add("UNICODE" , "UTF-8"); // Unicode (UTF-8) + Charactersets.Add("UTF8" , "UTF-8"); // UTF-8 Charactersets.Add("LATIN1" , "iso-8859-1"); // ISO 8859-1/ECMA 94 (Latin alphabet no.1) Charactersets.Add("LATIN2" , "iso-8859-2"); // ISO 8859-2/ECMA 94 (Latin alphabet no.2) Charactersets.Add("LATIN4" , 1257); // ISO 8859-4/ECMA 94 (Latin alphabet no.4) Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.sln =================================================================== --- pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.sln 2006-03-16 12:14:06 UTC (rev 28) +++ pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.sln 2006-03-16 15:02:15 UTC (rev 29) @@ -7,6 +7,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureSocketLayerTest", "SecureSocketLayerTest\SecureSocketLayerTest.csproj", "{7AFCAB88-9EA7-4263-B339-AB9A05C1C600}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PgSqlClientTest", "PgSqlClientTest\PgSqlClientTest.csproj", "{D7BC6DBA-10C5-4A13-8F15-CEAAF40383F8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -25,6 +27,10 @@ {7AFCAB88-9EA7-4263-B339-AB9A05C1C600}.Debug|Any CPU.Build.0 = Debug|Any CPU {7AFCAB88-9EA7-4263-B339-AB9A05C1C600}.Release|Any CPU.ActiveCfg = Release|Any CPU {7AFCAB88-9EA7-4263-B339-AB9A05C1C600}.Release|Any CPU.Build.0 = Release|Any CPU + {D7BC6DBA-10C5-4A13-8F15-CEAAF40383F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7BC6DBA-10C5-4A13-8F15-CEAAF40383F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7BC6DBA-10C5-4A13-8F15-CEAAF40383F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7BC6DBA-10C5-4A13-8F15-CEAAF40383F8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-03-17 14:23:32
|
Revision: 30 Author: carlosga_fb Date: 2006-03-17 06:23:22 -0800 (Fri, 17 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=30&view=rev Log Message: ----------- Changes to avoid problems with IPv6 Modified Paths: -------------- pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-03-16 15:02:15 UTC (rev 29) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-03-17 14:23:22 UTC (rev 30) @@ -831,7 +831,7 @@ private void InitializeSocket() { - IPAddress hostadd = Dns.GetHostEntry(this.options.DataSource).AddressList[0]; + IPAddress hostadd = GetIPAddress(this.options.DataSource, AddressFamily.InterNetwork); this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); @@ -859,6 +859,21 @@ GC.SuppressFinalize(this.send); } + private IPAddress GetIPAddress(string dataSource, AddressFamily addressFamily) + { + IPAddress[] addresses = Dns.GetHostEntry(this.options.DataSource).AddressList; + + foreach (IPAddress address in addresses) + { + if (address.AddressFamily == addressFamily) + { + return address; + } + } + + return addresses[0]; + } + private void Detach() { // Close streams Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-03-17 15:14:44
|
Revision: 31 Author: carlosga_fb Date: 2006-03-17 07:13:10 -0800 (Fri, 17 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=31&view=rev Log Message: ----------- Added changes on Database Schema support. Modified Paths: -------------- pgsqlclient/source/PostgreSql/Data/Design/ParameterCollection/PgParameterCollectionEditor.cs pgsqlclient/source/PostgreSql/Data/Design/ParameterCollection/PgParameterConverter.cs pgsqlclient/source/PostgreSql/Data/PgTypes/PgBox.cs pgsqlclient/source/PostgreSql/Data/PgTypes/PgCircle.cs pgsqlclient/source/PostgreSql/Data/PgTypes/PgLSeg.cs pgsqlclient/source/PostgreSql/Data/PgTypes/PgLine.cs pgsqlclient/source/PostgreSql/Data/PgTypes/PgPath.cs pgsqlclient/source/PostgreSql/Data/PgTypes/PgPoint.cs pgsqlclient/source/PostgreSql/Data/PgTypes/PgPolygon.cs pgsqlclient/source/PostgreSql/Data/PgTypes/PgTimeSpan.cs pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgCommand.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgCommandBuilder.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionPool.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDataAdapter.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDataReader.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDbType.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgError.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgErrorCollection.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgException.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgInfoMessageEventArgs.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgInfoMessageEventHandler.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgNotificationEventArgs.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgNotificationEventHandler.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgParameter.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgParameterCollection.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatedEventArgs.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatedEventHandler.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatingEventArgs.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatingEventHandler.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgTransaction.cs pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PostgreSqlClientFactory.cs pgsqlclient/source/PostgreSql/Data/Protocol/InfoMessageCallback.cs pgsqlclient/source/PostgreSql/Data/Protocol/NotificationCallback.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgAuthMethods.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgBackendCodes.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgCharset.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgCharsetCollection.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgClientError.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgClientErrorCollection.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgClientException.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgClientMessageEventArgs.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgClientMessageEventHandler.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgClientNotificationEventArgs.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgClientNotificationEventHandler.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgCodes.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgConnectionOptions.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgDataType.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgErrorCodes.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgFieldDescriptor.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgFrontEndCodes.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgParameter.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgRowDescriptor.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgStatement.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgStatementStatus.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgType.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeCollection.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeFormat.cs pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeStringFormats.cs pgsqlclient/source/PostgreSql/Data/Schema/MetaData.xml pgsqlclient/source/PostgreSql/Data/Schema/PgColumns.cs pgsqlclient/source/PostgreSql/Data/Schema/PgIndexColumns.cs pgsqlclient/source/PostgreSql/Data/Schema/PgIndexes.cs pgsqlclient/source/PostgreSql/Data/Schema/PgPrimaryKeys.cs pgsqlclient/source/PostgreSql/Data/Schema/PgSchema.cs pgsqlclient/source/PostgreSql/Data/Schema/PgSchemaFactory.cs pgsqlclient/source/PostgreSql/Data/Schema/PgTables.cs pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo Added Paths: ----------- pgsqlclient/source/PostgreSql/Data/Schema/PgCheckConstraints.cs pgsqlclient/source/PostgreSql/Data/Schema/PgFunctions.cs pgsqlclient/source/PostgreSql/Data/Schema/PgTriggers.cs pgsqlclient/source/PostgreSql/Data/Schema/PgViews.cs Modified: pgsqlclient/source/PostgreSql/Data/Design/ParameterCollection/PgParameterCollectionEditor.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Design/ParameterCollection/PgParameterCollectionEditor.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Design/ParameterCollection/PgParameterCollectionEditor.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Design/ParameterCollection/PgParameterConverter.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Design/ParameterCollection/PgParameterConverter.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Design/ParameterCollection/PgParameterConverter.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PgTypes/PgBox.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PgTypes/PgBox.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PgTypes/PgBox.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PgTypes/PgCircle.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PgTypes/PgCircle.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PgTypes/PgCircle.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PgTypes/PgLSeg.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PgTypes/PgLSeg.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PgTypes/PgLSeg.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PgTypes/PgLine.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PgTypes/PgLine.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PgTypes/PgLine.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PgTypes/PgPath.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PgTypes/PgPath.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PgTypes/PgPath.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PgTypes/PgPoint.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PgTypes/PgPoint.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PgTypes/PgPoint.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PgTypes/PgPolygon.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PgTypes/PgPolygon.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PgTypes/PgPolygon.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PgTypes/PgTimeSpan.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PgTypes/PgTimeSpan.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PgTypes/PgTimeSpan.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-03-17 15:13:10 UTC (rev 31) @@ -117,6 +117,9 @@ <Compile Include="PgTypes\PgPoint.cs" /> <Compile Include="PgTypes\PgPolygon.cs" /> <Compile Include="PgTypes\PgTimeSpan.cs" /> + <Compile Include="Schema\PgViews.cs" /> + <Compile Include="Schema\PgCheckConstraints.cs" /> + <Compile Include="Schema\PgFunctions.cs" /> <Compile Include="Schema\PgIndexColumns.cs" /> <Compile Include="Schema\PgIndexes.cs" /> <Compile Include="Schema\PgPrimaryKeys.cs" /> @@ -124,6 +127,7 @@ <Compile Include="Schema\PgSchema.cs" /> <Compile Include="Schema\PgSchemaFactory.cs" /> <Compile Include="Schema\PgTables.cs" /> + <Compile Include="Schema\PgTriggers.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Resources\ToolBox\PgCommand.bmp" /> @@ -147,9 +151,6 @@ <EmbeddedResource Include="Schema\MetaData.xml" /> </ItemGroup> <ItemGroup> - <Content Include="Schema\TextFile1.txt" /> - </ItemGroup> - <ItemGroup> <ProjectReference Include="..\..\SecureSocketLayer\SecureSocketLayer.csproj"> <Project>{8CA6C4CF-1737-4680-8AC7-4D34E3CC35DE}</Project> <Name>SecureSocketLayer</Name> Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgCommand.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgCommand.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgCommand.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgCommandBuilder.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgCommandBuilder.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgCommandBuilder.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionPool.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionPool.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionPool.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDataAdapter.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDataAdapter.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDataAdapter.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDataReader.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDataReader.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDataReader.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDbType.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDbType.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgDbType.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgError.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgError.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgError.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgErrorCollection.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgErrorCollection.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgErrorCollection.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgException.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgException.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgException.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgInfoMessageEventArgs.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgInfoMessageEventArgs.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgInfoMessageEventArgs.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgInfoMessageEventHandler.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgInfoMessageEventHandler.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgInfoMessageEventHandler.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgNotificationEventArgs.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgNotificationEventArgs.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgNotificationEventArgs.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgNotificationEventHandler.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgNotificationEventHandler.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgNotificationEventHandler.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgParameter.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgParameter.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgParameter.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgParameterCollection.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgParameterCollection.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgParameterCollection.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatedEventArgs.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatedEventArgs.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatedEventArgs.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatedEventHandler.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatedEventHandler.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatedEventHandler.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatingEventArgs.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatingEventArgs.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatingEventArgs.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatingEventHandler.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatingEventHandler.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgRowUpdatingEventHandler.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgTransaction.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgTransaction.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PgTransaction.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PostgreSqlClientFactory.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PostgreSqlClientFactory.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/PostgreSqlClient/PostgreSqlClientFactory.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/InfoMessageCallback.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/InfoMessageCallback.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/InfoMessageCallback.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/NotificationCallback.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/NotificationCallback.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/NotificationCallback.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgAuthMethods.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgAuthMethods.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgAuthMethods.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgBackendCodes.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgBackendCodes.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgBackendCodes.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgCharset.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgCharset.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgCharset.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgCharsetCollection.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgCharsetCollection.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgCharsetCollection.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgClientError.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgClientError.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgClientError.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgClientErrorCollection.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgClientErrorCollection.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgClientErrorCollection.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgClientException.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgClientException.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgClientException.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgClientMessageEventArgs.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgClientMessageEventArgs.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgClientMessageEventArgs.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgClientMessageEventHandler.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgClientMessageEventHandler.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgClientMessageEventHandler.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgClientNotificationEventArgs.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgClientNotificationEventArgs.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgClientNotificationEventArgs.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgClientNotificationEventHandler.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgClientNotificationEventHandler.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgClientNotificationEventHandler.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgCodes.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgCodes.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgCodes.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgConnectionOptions.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgConnectionOptions.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgConnectionOptions.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgDataType.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgDataType.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgDataType.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgErrorCodes.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgErrorCodes.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgErrorCodes.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgFieldDescriptor.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgFieldDescriptor.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgFieldDescriptor.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgFrontEndCodes.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgFrontEndCodes.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgFrontEndCodes.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgParameter.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgParameter.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgParameter.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgRowDescriptor.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgRowDescriptor.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgRowDescriptor.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgStatement.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgStatement.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgStatement.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgStatementStatus.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgStatementStatus.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgStatementStatus.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgType.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgType.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgType.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeCollection.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeCollection.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeCollection.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeFormat.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeFormat.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeFormat.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeStringFormats.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeStringFormats.cs 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgTypeStringFormats.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -11,7 +11,7 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2003, 2005 Carlos Guzman Alvarez + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez * All Rights Reserved. */ Modified: pgsqlclient/source/PostgreSql/Data/Schema/MetaData.xml =================================================================== --- pgsqlclient/source/PostgreSql/Data/Schema/MetaData.xml 2006-03-17 14:23:22 UTC (rev 30) +++ pgsqlclient/source/PostgreSql/Data/Schema/MetaData.xml 2006-03-17 15:13:10 UTC (rev 31) @@ -117,12 +117,6 @@ <PopulationMechanism>PrepareCollection</PopulationMechanism> </MetaDataCollections> <MetaDataCollections> - <CollectionName>CheckConstraintsByTable</CollectionName> - <NumberOfRestrictions>3</NumberOfRestrictions> - <NumberOfIdentifierParts>0</NumberOfIdentifierParts> - <PopulationMechanism>PrepareCollection</PopulationMechanism> - </MetaDataCollections> - <MetaDataCollections> <CollectionName>Columns</CollectionName> <NumberOfRestrictions>4</NumberOfRestrictions> <NumberOfIdentifierParts>0</NumberOfIdentifierParts> @@ -149,19 +143,19 @@ <PopulationMechanism>DataTable</PopulationMechanism> <PopulationString>DataTypes</PopulationString> </MetaDataCollections> - <MetaDataCollections> - <CollectionName>ForeignKeyColumns</CollectionName> - <NumberOfRestrictions>5</NumberOfRestrictions> - <NumberOfIdentifierParts>0</NumberOfIdentifierParts> - <PopulationMechanism>PrepareCollection</PopulationMechanism> - </MetaDataCollections> - <MetaDataCollections> - <CollectionName>ForeignKeys</CollectionName> - <NumberOfRestrictions>4</NumberOfRestrictions> - <NumberOfIdentifierParts>0</NumberOfIdentifierParts> - <PopulationMechanism>PrepareCollection</PopulationMechanism> - </MetaDataCollections> - <MetaDataCollections> + <MetaDataCollections> + <CollectionName>ForeignKeys</CollectionName> + <NumberOfRestrictions>4</NumberOfRestrictions> + <NumberOfIdentifierParts>0</NumberOfIdentifierParts> + <PopulationMechanism>PrepareCollection</PopulationMechanism> + </MetaDataCollections> + <MetaDataCollections> + <CollectionName>ForeignKeyColumns</CollectionName> + <NumberOfRestrictions>5</NumberOfRestrictions> + <NumberOfIdentifierParts>0</NumberOfIdentifierParts> + <PopulationMechanism>PrepareCollection</PopulationMechanism> + </MetaDataCollections> + <MetaDataCollections> <CollectionName>Functions</CollectionName> <NumberOfRestrictions>0</NumberOfRestrictions> <NumberOfIdentifierParts>0</NumberOfIdentifierParts> @@ -174,19 +168,19 @@ <PopulationMechanism>SQLCommand</PopulationMechanism> <PopulationString>SELECT pg_group.groname AS GROUP_NAME, pg_group.grolist AS GROUP_USERS FROM pg_group ORDER BY pg_group.groname</PopulationString> </MetaDataCollections> - <MetaDataCollections> - <CollectionName>IndexColumns</CollectionName> - <NumberOfRestrictions>4</NumberOfRestrictions> - <NumberOfIdentifierParts>0</NumberOfIdentifierParts> - <PopulationMechanism>PrepareCollection</PopulationMechanism> - </MetaDataCollections> - <MetaDataCollections> - <CollectionName>Indexes</CollectionName> - <NumberOfRestrictions>4</NumberOfRestrictions> - <NumberOfIdentifierParts>0</NumberOfIdentifierParts> - <PopulationMechanism>PrepareCollection</PopulationMechanism> - </MetaDataCollections> - <MetaDataCollections> + <MetaDataCollections> + <CollectionName>Indexes</CollectionName> + <NumberOfRestrictions>4</NumberOfRestrictions> + <NumberOfIdentifierParts>0</NumberOfIdentifierParts> + <PopulationMechanism>PrepareCollection</PopulationMechanism> + </MetaDataCollections> + <MetaDataCollections> + <CollectionName>IndexColumns</CollectionName> + <NumberOfRestrictions>4</NumberOfRestrictions> + <NumberOfIdentifierParts>0</NumberOfIdentifierParts> + <PopulationMechanism>PrepareCollection</PopulationMechanism> + </MetaDataCollections> + <MetaDataCollections> <CollectionName>MetaDataCollections</CollectionName> <NumberOfRestrictions>0</NumberOfRestrictions> <NumberOfIdentifierParts>0</NumberOfIdentifierParts> @@ -240,12 +234,6 @@ <PopulationMechanism>PrepareCollection</PopulationMechanism> </MetaDataCollections> <MetaDataCollections> - <CollectionName>TablePrivileges</CollectionName> - <NumberOfRestrictions>5</NumberOfRestrictions> - <NumberOfIdentifierParts>0</NumberOfIdentifierParts> - <PopulationMechanism>PrepareCollection</PopulationMechanism> - </MetaDataCollections> - <MetaDataCollections> <CollectionName>Triggers</CollectionName> <NumberOfRestrictions>4</NumberOfRestrictions> <NumberOfIdentifierParts>0</NumberOfIdentifierParts> @@ -259,24 +247,18 @@ <PopulationString>SELECT pg_shadow.usename AS USER_NAME, pg_shadow.usecreatedb AS CREATE_DATABASE, pg_shadow.usesuper AS IS_SUPERUSER, pg_shadow.usecatupd AS UPDATE_SYSCATALOGS, pg_shadow.passwd AS PASSWORD, pg_shadow.useconfig AS CONFIGURATION FROM pg_shadow ORDER BY pg_shadow.usename</PopulationString> </MetaDataCollections> <MetaDataCollections> - <CollectionName>ViewColumns</CollectionName> - <NumberOfRestrictions>4</NumberOfRestrictions> - <NumberOfIdentifierParts>0</NumberOfIdentifierParts> - <PopulationMechanism>PrepareCollection</PopulationMechanism> - </MetaDataCollections> - <MetaDataCollections> - <CollectionName>ViewPrivileges</CollectionName> - <NumberOfRestrictions>5</NumberOfRestrictions> - <NumberOfIdentifierParts>0</NumberOfIdentifierParts> - <PopulationMechanism>PrepareCollection</PopulationMechanism> - </MetaDataCollections> - <MetaDataCollections> <CollectionName>Views</CollectionName> <NumberOfRestrictions>3</NumberOfRestrictions> <NumberOfIdentifierParts>0</NumberOfIdentifierParts> <PopulationMechanism>PrepareCollection</PopulationMechanism> </MetaDataCollections> - <Restrictions> + <MetaDataCollections> + <CollectionName>ViewColumns</CollectionName> + <NumberOfRestrictions>4</NumberOfRestrictions> + <NumberOfIdentifierParts>0</NumberOfIdentifierParts> + <PopulationMechanism>PrepareCollection</PopulationMechanism> + </MetaDataCollections> + <Restrictions> <CollectionName>Columns</CollectionName> <RestrictionName>Catalog</RestrictionName> <RestrictionDefault>table_catalog</RestrictionDefault> @@ -306,17 +288,65 @@ <RestrictionDefault>table_catalog</RestrictionDefault> <RestrictionNumber>1</RestrictionNumber> </Restrictions> - <Restrictions> + <Restrictions> + <CollectionName>Indexes</CollectionName> + <RestrictionName>Catalog</RestrictionName> + <RestrictionDefault>table_catalog</RestrictionDefault> + <RestrictionNumber>0</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Indexes</CollectionName> + <RestrictionName>Schema</RestrictionName> + <RestrictionDefault>table_schema</RestrictionDefault> + <RestrictionNumber>1</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Indexes</CollectionName> + <RestrictionName>TableName</RestrictionName> + <RestrictionDefault>table_name</RestrictionDefault> + <RestrictionNumber>2</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Indexes</CollectionName> + <RestrictionName>Name</RestrictionName> + <RestrictionDefault>index_name</RestrictionDefault> + <RestrictionNumber>3</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Functions</CollectionName> + <RestrictionName>Catalog</RestrictionName> + <RestrictionDefault>function_catalog</RestrictionDefault> + <RestrictionNumber>0</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Functions</CollectionName> + <RestrictionName>Schema</RestrictionName> + <RestrictionDefault>function_schema</RestrictionDefault> + <RestrictionNumber>1</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Functions</CollectionName> + <RestrictionName>Name</RestrictionName> + <RestrictionDefault>function_name</RestrictionDefault> + <RestrictionNumber>2</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>PrimaryKeys</CollectionName> + <RestrictionName>Schema</RestrictionName> + <RestrictionDefault>table_catalog</RestrictionDefault> + <RestrictionNumber>0</RestrictionNumber> + </Restrictions> + <Restrictions> <CollectionName>PrimaryKeys</CollectionName> <RestrictionName>Schema</RestrictionName> <RestrictionDefault>table_schema</RestrictionDefault> - <RestrictionNumber>2</RestrictionNumber> + <RestrictionNumber>1</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>PrimaryKeys</CollectionName> <RestrictionName>Table</RestrictionName> <RestrictionDefault>table_name</RestrictionDefault> - <RestrictionNumber>3</RestrictionNumber> + <RestrictionNumber>2</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Tables</CollectionName> @@ -342,7 +372,49 @@ <RestrictionDefault>table_type</RestrictionDefault> <RestrictionNumber>4</RestrictionNumber> </Restrictions> - <DataSourceInformation> + <Restrictions> + <CollectionName>Triggers</CollectionName> + <RestrictionName>TableCatalog</RestrictionName> + <RestrictionDefault>table_catalog</RestrictionDefault> + <RestrictionNumber>0</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Triggers</CollectionName> + <RestrictionName>TableSchema</RestrictionName> + <RestrictionDefault>table_schema</RestrictionDefault> + <RestrictionNumber>1</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Triggers</CollectionName> + <RestrictionName>TableName</RestrictionName> + <RestrictionDefault>table_name</RestrictionDefault> + <RestrictionNumber>2</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Triggers</CollectionName> + <RestrictionName>Name</RestrictionName> + <RestrictionDefault>trigger_name</RestrictionDefault> + <RestrictionNumber>3</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Views</CollectionName> + <RestrictionName>Catalog</RestrictionName> + <RestrictionDefault>view_catalog</RestrictionDefault> + <RestrictionNumber>0</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Views</CollectionName> + <RestrictionName>Schema</RestrictionName> + <RestrictionDefault>view_schema</RestrictionDefault> + <RestrictionNumber>1</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>Views</CollectionName> + <RestrictionName>Name</RestrictionName> + <RestrictionDefault>view_name</RestrictionDefault> + <RestrictionNumber>2</RestrictionNumber> + </Restrictions> + <DataSourceInformation> <CompositeIdentifierSeparatorPattern>.</CompositeIdentifierSeparatorPattern> <DataSourceProductName>PostgreSQL</DataSourceProductName> <DataSourceProductVersion>7.4+</DataSourceProductVersion> Added: pgsqlclient/source/PostgreSql/Data/Schema/PgCheckConstraints.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Schema/PgCheckConstraints.cs (rev 0) +++ pgsqlclient/source/PostgreSql/Data/Schema/PgCheckConstraints.cs 2006-03-17 15:13:10 UTC (rev 31) @@ -0,0 +1,75 @@ +/* + * PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * Copyright (c)... [truncated message content] |
From: <car...@us...> - 2006-03-17 16:50:46
|
Revision: 32 Author: carlosga_fb Date: 2006-03-17 08:50:32 -0800 (Fri, 17 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=32&view=rev Log Message: ----------- ?\194?\183 More changes on database schema support ?\194?\183 Fixed bug in vector field processing Modified Paths: -------------- pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs pgsqlclient/source/PostgreSql/Data/Schema/MetaData.xml pgsqlclient/source/PostgreSql/Data/Schema/PgColumns.cs pgsqlclient/source/PostgreSql/Data/Schema/PgIndexes.cs pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo Modified: pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs 2006-03-17 15:13:10 UTC (rev 31) +++ pgsqlclient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs 2006-03-17 16:50:32 UTC (rev 32) @@ -309,7 +309,7 @@ PgType elementType = PgDatabase.DataTypes[type.ElementType]; Array data = null; - data = Array.CreateInstance(elementType.SystemType, PgCodes.INDEX_MAX_KEYS); + data = Array.CreateInstance(elementType.SystemType, (length / elementType.Size)); for (int i = 0; i < data.Length; i++ ) { Modified: pgsqlclient/source/PostgreSql/Data/Schema/MetaData.xml =================================================================== --- pgsqlclient/source/PostgreSql/Data/Schema/MetaData.xml 2006-03-17 15:13:10 UTC (rev 31) +++ pgsqlclient/source/PostgreSql/Data/Schema/MetaData.xml 2006-03-17 16:50:32 UTC (rev 32) @@ -259,6 +259,24 @@ <PopulationMechanism>PrepareCollection</PopulationMechanism> </MetaDataCollections> <Restrictions> + <CollectionName>CheckConstraints</CollectionName> + <RestrictionName>Catalog</RestrictionName> + <RestrictionDefault>constraint_catalog</RestrictionDefault> + <RestrictionNumber>1</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>CheckConstraints</CollectionName> + <RestrictionName>Schema</RestrictionName> + <RestrictionDefault>constraint_schema</RestrictionDefault> + <RestrictionNumber>2</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>CheckConstraints</CollectionName> + <RestrictionName>Name</RestrictionName> + <RestrictionDefault>constraint_name</RestrictionDefault> + <RestrictionNumber>3</RestrictionNumber> + </Restrictions> + <Restrictions> <CollectionName>Columns</CollectionName> <RestrictionName>Catalog</RestrictionName> <RestrictionDefault>table_catalog</RestrictionDefault> @@ -292,61 +310,61 @@ <CollectionName>Indexes</CollectionName> <RestrictionName>Catalog</RestrictionName> <RestrictionDefault>table_catalog</RestrictionDefault> - <RestrictionNumber>0</RestrictionNumber> + <RestrictionNumber>1</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Indexes</CollectionName> <RestrictionName>Schema</RestrictionName> <RestrictionDefault>table_schema</RestrictionDefault> - <RestrictionNumber>1</RestrictionNumber> + <RestrictionNumber>2</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Indexes</CollectionName> <RestrictionName>TableName</RestrictionName> <RestrictionDefault>table_name</RestrictionDefault> - <RestrictionNumber>2</RestrictionNumber> + <RestrictionNumber>3</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Indexes</CollectionName> <RestrictionName>Name</RestrictionName> <RestrictionDefault>index_name</RestrictionDefault> - <RestrictionNumber>3</RestrictionNumber> + <RestrictionNumber>4</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Functions</CollectionName> <RestrictionName>Catalog</RestrictionName> <RestrictionDefault>function_catalog</RestrictionDefault> - <RestrictionNumber>0</RestrictionNumber> + <RestrictionNumber>1</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Functions</CollectionName> <RestrictionName>Schema</RestrictionName> <RestrictionDefault>function_schema</RestrictionDefault> - <RestrictionNumber>1</RestrictionNumber> + <RestrictionNumber>2</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Functions</CollectionName> <RestrictionName>Name</RestrictionName> <RestrictionDefault>function_name</RestrictionDefault> - <RestrictionNumber>2</RestrictionNumber> + <RestrictionNumber>3</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>PrimaryKeys</CollectionName> <RestrictionName>Schema</RestrictionName> <RestrictionDefault>table_catalog</RestrictionDefault> - <RestrictionNumber>0</RestrictionNumber> + <RestrictionNumber>1</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>PrimaryKeys</CollectionName> <RestrictionName>Schema</RestrictionName> <RestrictionDefault>table_schema</RestrictionDefault> - <RestrictionNumber>1</RestrictionNumber> + <RestrictionNumber>2</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>PrimaryKeys</CollectionName> <RestrictionName>Table</RestrictionName> <RestrictionDefault>table_name</RestrictionDefault> - <RestrictionNumber>2</RestrictionNumber> + <RestrictionNumber>3</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Tables</CollectionName> @@ -376,43 +394,43 @@ <CollectionName>Triggers</CollectionName> <RestrictionName>TableCatalog</RestrictionName> <RestrictionDefault>table_catalog</RestrictionDefault> - <RestrictionNumber>0</RestrictionNumber> + <RestrictionNumber>1</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Triggers</CollectionName> <RestrictionName>TableSchema</RestrictionName> <RestrictionDefault>table_schema</RestrictionDefault> - <RestrictionNumber>1</RestrictionNumber> + <RestrictionNumber>2</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Triggers</CollectionName> <RestrictionName>TableName</RestrictionName> <RestrictionDefault>table_name</RestrictionDefault> - <RestrictionNumber>2</RestrictionNumber> + <RestrictionNumber>3</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Triggers</CollectionName> <RestrictionName>Name</RestrictionName> <RestrictionDefault>trigger_name</RestrictionDefault> - <RestrictionNumber>3</RestrictionNumber> + <RestrictionNumber>4</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Views</CollectionName> <RestrictionName>Catalog</RestrictionName> <RestrictionDefault>view_catalog</RestrictionDefault> - <RestrictionNumber>0</RestrictionNumber> + <RestrictionNumber>1</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Views</CollectionName> <RestrictionName>Schema</RestrictionName> <RestrictionDefault>view_schema</RestrictionDefault> - <RestrictionNumber>1</RestrictionNumber> + <RestrictionNumber>2</RestrictionNumber> </Restrictions> <Restrictions> <CollectionName>Views</CollectionName> <RestrictionName>Name</RestrictionName> <RestrictionDefault>view_name</RestrictionDefault> - <RestrictionNumber>2</RestrictionNumber> + <RestrictionNumber>3</RestrictionNumber> </Restrictions> <DataSourceInformation> <CompositeIdentifierSeparatorPattern>.</CompositeIdentifierSeparatorPattern> Modified: pgsqlclient/source/PostgreSql/Data/Schema/PgColumns.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Schema/PgColumns.cs 2006-03-17 15:13:10 UTC (rev 31) +++ pgsqlclient/source/PostgreSql/Data/Schema/PgColumns.cs 2006-03-17 16:50:32 UTC (rev 32) @@ -35,7 +35,10 @@ "numeric_precision, " + "numeric_scale, " + "ordinal_position, " + - "case is_nullable when true then false when false then true AS is_not_null, " + + "case is_nullable " + + "when true then false " + + "when false then true " + + "end AS is_not_null, " + "column_default, " + "character_octet_length, " + "character_set_catalog, " + @@ -43,7 +46,7 @@ "character_set_name, " + "collation_catalog, " + "collation_schema, " + - "collation_name, " + + "collation_name " + "FROM information_schema.columns "; if (restrictions != null && restrictions.Length > 0) Modified: pgsqlclient/source/PostgreSql/Data/Schema/PgIndexes.cs =================================================================== --- pgsqlclient/source/PostgreSql/Data/Schema/PgIndexes.cs 2006-03-17 15:13:10 UTC (rev 31) +++ pgsqlclient/source/PostgreSql/Data/Schema/PgIndexes.cs 2006-03-17 16:50:32 UTC (rev 32) @@ -27,20 +27,19 @@ { string sql = "SELECT " + - "null AS TABLE_CATALOG " + + "null AS TABLE_CATALOG, " + "pg_namespace.nspname AS TABLE_SCHEMA, " + "pg_class.relname AS TABLE_NAME, " + "null AS INDEX_CATALOG, " + "pg_namespidx.nspname AS INDEX_SCHEMA, " + "pg_classidx.relname AS INDEX_NAME, " + "pg_am.amname AS TYPE, " + - "pg_index.indkey AS INDEX_KEY, " + - "pg_index.indisclustered AS CLUSTERED, " + - "pg_index.indisunique AS UNIQUE, " + - "pg_index.indisprimary AS PRIMARY, " + + "pg_index.indisclustered AS IS_CLUSTERED, " + + "pg_index.indisunique AS IS_UNIQUE, " + + "pg_index.indisprimary AS IS_PRIMARY, " + "pg_am.amindexnulls AS ALLOW_NULLS, " + - "pg_am.amcanmulticol AS MULTICOLUMN, " + - "pg_am.amconcurrent AS CONCURRENT, " + + "pg_am.amcanmulticol AS IS_MULTICOLUMN, " + + "pg_am.amconcurrent AS IS_CONCURRENT, " + "pg_description.description AS DESCRIPTION " + "FROM pg_index " + "left join pg_class ON pg_index.indrelid = pg_class.oid " + Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |