pgsqlclient-checkins Mailing List for PostgreSqlClient (Page 48)
Status: Inactive
Brought to you by:
carlosga_fb
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(120) |
Aug
(95) |
Sep
(95) |
Oct
(213) |
Nov
(114) |
Dec
(64) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(6) |
Feb
(134) |
Mar
(88) |
Apr
(28) |
May
(22) |
Jun
(15) |
Jul
(23) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(6) |
Dec
|
2005 |
Jan
(8) |
Feb
(6) |
Mar
|
Apr
(42) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(84) |
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
(84) |
Apr
(46) |
May
(40) |
Jun
(8) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <car...@us...> - 2003-08-20 17:18:43
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Cryptography/ASN1 In directory sc8-pr-cvs1:/tmp/cvs-serv20417/ASN1 Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Cryptography/ASN1 added to the repository |
From: <car...@us...> - 2003-08-20 17:14:53
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source In directory sc8-pr-cvs1:/tmp/cvs-serv20027 Added Files: PgSqlClient.Security.Tls.snk Log Message: Added initial release of a simple TLS protocol implementation, it uses tree files from the Mono project that are under the MIT X11 license. --- NEW FILE: PgSqlClient.Security.Tls.snk --- (This appears to be a binary file; contents omitted.) |
From: <car...@us...> - 2003-08-20 17:10:44
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv19395/PgSqlClient.Security.Tls Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls added to the repository |
From: <car...@us...> - 2003-08-20 17:09:00
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Handshake In directory sc8-pr-cvs1:/tmp/cvs-serv19699/Handshake Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Handshake added to the repository |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source In directory sc8-pr-cvs1:/tmp/cvs-serv19958 Added Files: AssemblyInfo.cs TlsCipherSuite.cs TlsCipherSuiteCollection.cs TlsContentType.cs TlsException.cs TlsProtocol.cs TlsReader.cs TlsServerSettings.cs TlsSession.cs TlsSessionSettings.cs TlsSessionState.cs TlsStreamReader.cs TlsStreamWriter.cs TlsWriter.cs Log Message: Added initial release of a simple TLS protocol implementation, it uses tree files from the Mono project that are under the MIT X11 license. --- NEW FILE: AssemblyInfo.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsCipherSuite.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsCipherSuiteCollection.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsContentType.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsException.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsProtocol.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsReader.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerSettings.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsSession.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsSessionSettings.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsSessionState.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsStreamReader.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsStreamWriter.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsWriter.cs --- (This appears to be a binary file; contents omitted.) |
From: <car...@us...> - 2003-08-20 16:59:27
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Cryptography/ASN1 In directory sc8-pr-cvs1:/tmp/cvs-serv20520 Added Files: ASN1.cs Log Message: Added initial release of a simple TLS protocol implementation, it uses tree files from the Mono project that are under the MIT X11 license. --- NEW FILE: ASN1.cs --- // // ASN1.cs: Abstract Syntax Notation 1 - micro-parser and generator // // Author: // Sebastien Pouliot (spo...@mo...) // // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) // using System; using System.Collections; namespace Mono.Security { // References: // a. ITU ASN.1 standards (free download) // http://www.itu.int/ITU-T/studygroups/com17/languages/ #if INSIDE_CORLIB internal #else public #endif class ASN1 { protected byte m_nTag; protected byte[] m_aValue; protected ArrayList elist; public ASN1 () : this (0x00, null) {} public ASN1 (byte tag) : this (tag, null) {} public ASN1 (byte tag, byte[] data) { m_nTag = tag; m_aValue = data; } public ASN1 (byte[] data) { m_nTag = data [0]; int nLenLength = 0; int nLength = data [1]; if (nLength > 0x80) { // composed length nLenLength = nLength - 0x80; nLength = 0; for (int i = 0; i < nLenLength; i++) { nLength *= 256; nLength += data [i + 2]; } } m_aValue = new byte [nLength]; Array.Copy (data, (2 + nLenLength), m_aValue, 0, nLength); if ((m_nTag & 0x20) == 0x20) { int nStart = (2 + nLenLength); Decode (data, ref nStart, data.Length); } } public int Count { get { if (elist == null) return 0; return elist.Count; } } public byte Tag { get { return m_nTag; } } public int Length { get { if (m_aValue != null) return m_aValue.Length; else return 0; } } public byte[] Value { get { if (m_aValue == null) GetBytes (); return (byte[]) m_aValue.Clone (); } set { if (value != null) m_aValue = (byte[]) value.Clone (); } } private bool CompareArray (byte[] array1, byte[] array2) { bool bResult = (array1.Length == array2.Length); if (bResult) { for (int i = 0; i < array1.Length; i++) { if (array1[i] != array2[i]) return false; } } return bResult; } public bool Equals (byte[] asn1) { return CompareArray (this.GetBytes (), asn1); } public bool CompareValue (byte[] aValue) { return CompareArray (m_aValue, aValue); } public virtual ASN1 Add (ASN1 asn1) { if (asn1 != null) { if (elist == null) elist = new ArrayList (); elist.Add (asn1); } return asn1; } public virtual byte[] GetBytes () { byte[] val = null; if (m_aValue != null) { val = m_aValue; } else if (Count > 0) { int esize = 0; ArrayList al = new ArrayList (); foreach (ASN1 a in elist) { byte[] item = a.GetBytes (); al.Add (item); esize += item.Length; } val = new byte [esize]; int pos = 0; for (int i=0; i < elist.Count; i++) { byte[] item = (byte[]) al[i]; Array.Copy (item, 0, val, pos, item.Length); pos += item.Length; } } byte[] der; int nLengthLen = 0; if (val != null) { int nLength = val.Length; // special for length > 127 if (nLength > 127) { if (nLength < 256) { der = new byte [3 + nLength]; Array.Copy (val, 0, der, 3, nLength); nLengthLen += 0x81; der[2] = (byte)(nLength); } else { der = new byte [4 + nLength]; Array.Copy (val, 0, der, 4, nLength); nLengthLen += 0x82; der[2] = (byte)(nLength / 256); der[3] = (byte)(nLength % 256); } } else { der = new byte [2 + nLength]; Array.Copy (val, 0, der, 2, nLength); nLengthLen = nLength; } if (m_aValue == null) m_aValue = val; } else der = new byte[2]; der[0] = m_nTag; der[1] = (byte)nLengthLen; return der; } // Note: Recursive protected void Decode (byte[] asn1, ref int anPos, int anLength) { byte nTag; int nLength; byte[] aValue; // minimum is 2 bytes (tag + length of 0) while (anPos < anLength - 1) { int nPosOri = anPos; DecodeTLV (asn1, ref anPos, out nTag, out nLength, out aValue); ASN1 elm = Add (new ASN1 (nTag, aValue)); if ((nTag & 0x20) == 0x20) { int nConstructedPos = anPos; elm.Decode (asn1, ref nConstructedPos, nConstructedPos + nLength); } anPos += nLength; // value length } } // TLV : Tag - Length - Value protected void DecodeTLV (byte[] asn1, ref int anPos, out byte anTag, out int anLength, out byte[] aValue) { anTag = asn1 [anPos++]; anLength = asn1 [anPos++]; // special case where L contains the Length of the Length + 0x80 if ((anLength & 0x80) == 0x80) { int nLengthLen = anLength & 0x7F; anLength = 0; for (int i = 0; i < nLengthLen; i++) anLength = anLength * 256 + asn1 [anPos++]; } aValue = new byte [anLength]; Array.Copy (asn1, anPos, aValue, 0, anLength); } public ASN1 this [int index] { get { try { if (index >= elist.Count) return null; return (ASN1) elist [index]; } catch { return null; } } } public ASN1 Element (int index, byte anTag) { try { if (index >= elist.Count) return null; ASN1 elm = (ASN1) elist [index]; if (elm.Tag == anTag) return elm; else return null; } catch { return null; } } } } |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Handshake In directory sc8-pr-cvs1:/tmp/cvs-serv20714 Added Files: TlsClientCertificateType.cs TlsClientFinished.cs TlsClientHandshakeMessage.cs TlsClientHello.cs TlsClientKeyExchange.cs TlsHandshakeHashes.cs TlsHandshakeType.cs TlsServerCertificate.cs TlsServerCertificateRequest.cs TlsServerFinished.cs TlsServerHandshakeMessage.cs TlsServerHello.cs TlsServerHelloDone.cs TlsServerKeyExchange.cs Log Message: Added initial release of a simple TLS protocol implementation, it uses tree files from the Mono project that are under the MIT X11 license. --- NEW FILE: TlsClientCertificateType.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsClientFinished.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsClientHandshakeMessage.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsClientHello.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsClientKeyExchange.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsHandshakeHashes.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsHandshakeType.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerCertificate.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerCertificateRequest.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerFinished.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerHandshakeMessage.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerHello.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerHelloDone.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerKeyExchange.cs --- (This appears to be a binary file; contents omitted.) |
From: <car...@us...> - 2003-08-20 16:50:29
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Alerts In directory sc8-pr-cvs1:/tmp/cvs-serv20169 Added Files: TlsAlert.cs TlsCloseNotifyAlert.cs TlsWarningAlertEventArgs.cs Log Message: Added initial release of a simple TLS protocol implementation, it uses tree files from the Mono project that are under the MIT X11 license. --- NEW FILE: TlsAlert.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsCloseNotifyAlert.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsWarningAlertEventArgs.cs --- (This appears to be a binary file; contents omitted.) |
From: <car...@us...> - 2003-08-20 16:45:52
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source In directory sc8-pr-cvs1:/tmp/cvs-serv19488/source Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source added to the repository |
From: <car...@us...> - 2003-08-20 16:45:51
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Alerts In directory sc8-pr-cvs1:/tmp/cvs-serv19536/Alerts Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Alerts added to the repository |
From: <car...@us...> - 2003-08-20 16:45:31
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Cryptography In directory sc8-pr-cvs1:/tmp/cvs-serv20307 Added Files: ARC4Managed.cs RC4.cs Log Message: Added initial release of a simple TLS protocol implementation, it uses tree files from the Mono project that are under the MIT X11 license. --- NEW FILE: ARC4Managed.cs --- // // ARC4Managed.cs: Alleged RC4(tm) compatible symmetric stream cipher // RC4 is a trademark of RSA Security // using System; using System.Security.Cryptography; namespace Mono.Security.Cryptography { // References: // a. Usenet 1994 - RC4 Algorithm revealed // http://www.qrst.de/html/dsds/rc4.htm public class ARC4Managed : RC4, ICryptoTransform { private byte[] key; private byte[] state; private byte x; private byte y; private bool m_disposed; public ARC4Managed () : base () { state = new byte [256]; m_disposed = false; } ~ARC4Managed () { Dispose (true); } protected override void Dispose (bool disposing) { if (!m_disposed) { x = 0; y = 0; if (key != null) { Array.Clear (key, 0, key.Length); key = null; } Array.Clear (state, 0, state.Length); state = null; GC.SuppressFinalize (this); m_disposed = true; } } public override byte[] Key { get { return (byte[]) key.Clone (); } set { key = (byte[]) value.Clone (); KeySetup (key); } } public bool CanReuseTransform { get { return false; } } public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgvIV) { Key = rgbKey; return (ICryptoTransform) this; } public override ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgvIV) { Key = rgbKey; return CreateEncryptor (); } public override void GenerateIV () { // not used for a stream cipher IV = new byte [0]; } public override void GenerateKey () { byte[] key = new byte [KeySizeValue >> 3]; RandomNumberGenerator rng = RandomNumberGenerator.Create (); rng.GetBytes (key); Key = key; } public bool CanTransformMultipleBlocks { get { return true; } } public int InputBlockSize { get { return 1; } } public int OutputBlockSize { get { return 1; } } private void KeySetup (byte[] key) { byte index1 = 0; byte index2 = 0; for (int counter = 0; counter < 256; counter++) state [counter] = (byte) counter; x = 0; y = 0; for (int counter = 0; counter < 256; counter++) { index2 = (byte) ((key [index1] + state [counter] + index2) % 256); // swap byte byte tmp = state [counter]; state [counter] = state [index2]; state [index2] = tmp; index1 = (byte) ((index1 + 1) % key.Length); } } public int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset) { byte xorIndex; for (int counter = 0; counter < inputCount; counter ++) { x = (byte) ((x + 1) % 256); y = (byte) ((state [x] + y) % 256); // swap byte byte tmp = state [x]; state [x] = state [y]; state [y] = tmp; xorIndex = (byte) (state [x] + (state [y]) % 256); outputBuffer [outputOffset + counter] = (byte) (inputBuffer [inputOffset + counter] ^ state [xorIndex]); } return inputCount; } public byte[] TransformFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount) { byte[] output = new byte [inputCount]; TransformBlock (inputBuffer, inputOffset, inputCount, output, 0); return output; } } } --- NEW FILE: RC4.cs --- // // RC4.cs: RC4(tm) symmetric stream cipher // RC4 is a trademark of RSA Security // // Author: // Sebastien Pouliot (spo...@mo...) // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) // using System; using System.Security.Cryptography; namespace Mono.Security.Cryptography { public abstract class RC4 : SymmetricAlgorithm { private static KeySizes[] s_legalBlockSizes = { new KeySizes (64, 64, 0) }; private static KeySizes[] s_legalKeySizes = { new KeySizes (40, 2048, 8) }; public RC4() { KeySizeValue = 128; BlockSizeValue = 64; FeedbackSizeValue = BlockSizeValue; LegalBlockSizesValue = s_legalBlockSizes; LegalKeySizesValue = s_legalKeySizes; } new static public RC4 Create() { return Create ("RC4"); } new static public RC4 Create (string algName) { object o = CryptoConfig.CreateFromName (algName); // in case machine.config isn't configured to use // any RC4 implementation if (o == null) { o = new ARC4Managed (); } return (RC4) o; } } } |
From: <car...@us...> - 2003-08-20 16:44:40
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Cryptography In directory sc8-pr-cvs1:/tmp/cvs-serv19650/Cryptography Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Cryptography added to the repository |
From: <car...@us...> - 2003-08-20 16:44:29
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Handshake In directory sc8-pr-cvs1:/tmp/cvs-serv27055 Modified Files: TlsClientKeyExchange.cs Log Message: Changes on handling of RSA keys Index: TlsClientKeyExchange.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Handshake/TlsClientKeyExchange.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsClientKeyExchange.cs 20 Aug 2003 11:51:31 -0000 1.1 --- TlsClientKeyExchange.cs 20 Aug 2003 15:45:05 -0000 1.2 *************** *** 43,48 **** byte[] preMasterSecret = Session.CreatePremasterSecret(); // Encrypt premaster_sercret ! RSAPKCS1KeyExchangeFormatter formatter = new RSAPKCS1KeyExchangeFormatter(Session.State.Cipher.RSA); // Write the preMasterSecret encrypted --- 43,59 ---- byte[] preMasterSecret = Session.CreatePremasterSecret(); + // Create a new RSA key + RSACryptoServiceProvider rsa = null; + if (Session.State.ServerSettings.ServerKeyExchange) + { + rsa = Session.State.Cipher.CreateRSA(Session.State.ServerSettings.RsaParameters); + } + else + { + rsa = Session.State.Cipher.CreateRSA(Session.State.ServerSettings.ServerCertificates[0]); + } + // Encrypt premaster_sercret ! RSAPKCS1KeyExchangeFormatter formatter = new RSAPKCS1KeyExchangeFormatter(rsa); // Write the preMasterSecret encrypted *************** *** 54,57 **** --- 65,71 ---- // Create keys Session.CreateKeys(); + + // Clear resources + rsa.Clear(); } |
From: <car...@us...> - 2003-08-20 16:43:55
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv22050 Modified Files: changelog.txt Log Message: Update CHANGELOG.TXT Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** changelog.txt 20 Aug 2003 11:54:39 -0000 1.18 --- changelog.txt 20 Aug 2003 11:57:54 -0000 1.19 *************** *** 3,7 **** ! 2003-08-15 Carlos Guzmán Álvarez <car...@te...> * Added initial release of a simple TLS protocol implementation, --- 3,7 ---- ! 2003-08-20 Carlos Guzmán Álvarez <car...@te...> * Added initial release of a simple TLS protocol implementation, |
From: <car...@us...> - 2003-08-20 16:37:29
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv21431 Modified Files: changelog.txt Log Message: Update changelog.txt Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** changelog.txt 15 Aug 2003 17:52:32 -0000 1.17 --- changelog.txt 20 Aug 2003 11:54:39 -0000 1.18 *************** *** 3,6 **** --- 3,13 ---- + 2003-08-15 Carlos Guzmán Álvarez <car...@te...> + + * Added initial release of a simple TLS protocol implementation, + it uses tree files from the Mono project that are under the MIT X11 + license. + + 2003-08-15 Carlos Guzmán Álvarez <car...@te...> |
From: <car...@us...> - 2003-08-20 16:29:16
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source In directory sc8-pr-cvs1:/tmp/cvs-serv26961 Modified Files: TlsCipherSuite.cs TlsSession.cs Log Message: Changes on handling of RSA keys Index: TlsCipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/TlsCipherSuite.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsCipherSuite.cs 20 Aug 2003 11:48:20 -0000 1.1 --- TlsCipherSuite.cs 20 Aug 2003 15:44:47 -0000 1.2 *************** *** 40,45 **** private byte effectiveKeyBits; private byte ivSize; ! private byte blockSize; ! private RSA rsa; private TlsSessionState sessionState; --- 40,44 ---- private byte effectiveKeyBits; private byte ivSize; ! private byte blockSize; private TlsSessionState sessionState; *************** *** 103,111 **** } - public RSA RSA - { - get { return rsa; } - } - public TlsSessionState SessionState { --- 102,105 ---- *************** *** 140,144 **** #region METHODS ! public void CreateRSA(X509Certificate certificate) { // This code is from Mono.Security.X509Certificate class. --- 134,138 ---- #region METHODS ! public RSACryptoServiceProvider CreateRSA(X509Certificate certificate) { // This code is from Mono.Security.X509Certificate class. *************** *** 152,163 **** if ((modulus == null) || (modulus.Tag != 0x02)) { ! this.rsa = null; ! return; } ASN1 exponent = pubkey [1]; if (exponent.Tag != 0x02) { ! this.rsa = null; ! return; } --- 146,155 ---- if ((modulus == null) || (modulus.Tag != 0x02)) { ! return null; } ASN1 exponent = pubkey [1]; if (exponent.Tag != 0x02) { ! return null; } *************** *** 165,172 **** rsaParams.Exponent = exponent.Value; ! CreateRSA(rsaParams); } ! public void CreateRSA(RSAParameters rsaParams) { // BUG: MS BCL 1.0 can't import a key which --- 157,164 ---- rsaParams.Exponent = exponent.Value; ! return CreateRSA(rsaParams); } ! public RSACryptoServiceProvider CreateRSA(RSAParameters rsaParams) { // BUG: MS BCL 1.0 can't import a key which *************** *** 174,179 **** // the container. int keySize = (rsaParams.Modulus.Length << 3); ! this.rsa = new RSACryptoServiceProvider(keySize); ! this.rsa.ImportParameters(rsaParams); } --- 166,173 ---- // the container. int keySize = (rsaParams.Modulus.Length << 3); ! RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(keySize); ! rsa.ImportParameters(rsaParams); ! ! return rsa; } Index: TlsSession.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/TlsSession.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsSession.cs 20 Aug 2003 11:48:20 -0000 1.1 --- TlsSession.cs 20 Aug 2003 15:44:47 -0000 1.2 *************** *** 158,172 **** reader.ReadRecord(); } - - // Generate encryption algorithms based on information - // sent by the server - if (state.ServerSettings.ServerKeyExchange) - { - State.Cipher.CreateRSA(State.ServerSettings.RsaParameters); - } - else - { - State.Cipher.CreateRSA(State.ServerSettings.ServerCertificates[0]); - } // Send client certificate if requested --- 158,161 ---- |
From: <car...@us...> - 2003-08-20 15:44:37
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient In directory sc8-pr-cvs1:/tmp/cvs-serv13595 Modified Files: PgDbClient.cs Log Message: Removed test code Index: PgDbClient.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgDbClient.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PgDbClient.cs 20 Aug 2003 11:53:19 -0000 1.4 --- PgDbClient.cs 20 Aug 2003 14:27:50 -0000 1.5 *************** *** 160,170 **** // Start TLS Session session.StartSession(); - - send.WriteRecord(Encoding.Default.GetBytes("GET / HTTP/1.0")); - - byte[] r = receive.ReadRecord(); - - // End TLS Session - session.EndSession(); } catch (TlsException ex) --- 160,163 ---- *************** *** 217,223 **** { // Send packet to the server ! PgOutputPacket packet = new PgOutputPacket(); ! SendData(packet.GetPacketBytes(PgFrontEndCodes.TERMINATE)); // Close socket and streams --- 210,221 ---- { // Send packet to the server ! PgOutputPacket packet = new PgOutputPacket(); SendData(packet.GetPacketBytes(PgFrontEndCodes.TERMINATE)); + + // if it's an SSL connection end session + if (settings.SSL) + { + session.EndSession(); + } // Close socket and streams |
From: <car...@us...> - 2003-08-20 15:42:51
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source In directory sc8-pr-cvs1:/tmp/cvs-serv22361 Modified Files: TlsCipherSuiteCollection.cs TlsReader.cs TlsWriter.cs Log Message: Simplify a little record encryption/decryption Index: TlsCipherSuiteCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/TlsCipherSuiteCollection.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsCipherSuiteCollection.cs 20 Aug 2003 11:48:20 -0000 1.1 --- TlsCipherSuiteCollection.cs 20 Aug 2003 15:15:50 -0000 1.2 *************** *** 61,64 **** --- 61,65 ---- // scs.Add((0x00 << 0x08) | 0x02, "TLS_RSA_WITH_NULL_SHA", "", "SHA", true, false, 0, 0, 0, 0, 0); // scs.Add((0x00 << 0x08) | 0x03, "TLS_RSA_EXPORT_WITH_RC4_40_MD5", "RC4", "MD5", true, false, 5, 16, 40, 0, 0); + scs.Add((0x00 << 0x08) | 0x0A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", "3DES", "SHA", false, true, 24, 24, 168, 8, 8); scs.Add((0x00 << 0x08) | 0x05, "TLS_RSA_WITH_RC4_128_SHA", "RC4", "SHA", false, false, 16, 16, 128, 0, 0); scs.Add((0x00 << 0x08) | 0x04, "TLS_RSA_WITH_RC4_128_MD5", "RC4", "MD5", false, false, 16, 16, 128, 0, 0); *************** *** 67,71 **** // scs.Add((0x00 << 0x08) | 0x08, "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA", "DES", "SHA", true, true, 5, 8, 40, 8, 8); scs.Add((0x00 << 0x08) | 0x09, "TLS_RSA_WITH_DES_CBC_SHA", "DES", "SHA", false, true, 8, 8, 56, 8, 8); - scs.Add((0x00 << 0x08) | 0x0A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", "3DES", "SHA", false, true, 24, 24, 168, 8, 8); --- 68,71 ---- Index: TlsReader.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/TlsReader.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsReader.cs 20 Aug 2003 11:48:20 -0000 1.1 --- TlsReader.cs 20 Aug 2003 15:15:50 -0000 1.2 *************** *** 87,91 **** case TlsContentType.ChangeCipherSpec: // Reset sequence numbers ! session.State.ReadSequenceNumber = 0; break; --- 87,91 ---- case TlsContentType.ChangeCipherSpec: // Reset sequence numbers ! session.State.ReadSequenceNumber = 0; break; *************** *** 312,337 **** state.ServerWriteIV); ! // Decrypt message fragment if (session.State.Cipher.CipherMode == CipherMode.CBC) { ! // Block Ciphers ( fragment + mac + padding + padding_length ) ! TlsStreamReader r = new TlsStreamReader(decryptor.TransformFinalBlock(fragment, 0, fragment.Length)); ! ! fragmentSize = (r.GetBytes().Length - 1) - session.State.Cipher.HashSize; ! ! dcrFragment = new byte[fragmentSize]; ! dcrMAC = new byte[session.State.Cipher.HashSize]; ! ! r.Read(dcrFragment, 0, dcrFragment.Length); ! r.Read(dcrMAC, 0, dcrMAC.Length); } else { ! // Stream Ciphers ( fragment + mac ) ! fragmentSize = fragment.Length - session.State.Cipher.HashSize; ! dcrFragment = decryptor.TransformFinalBlock(fragment, 0, fragmentSize); ! dcrMAC = decryptor.TransformFinalBlock(fragment, fragmentSize, session.State.Cipher.HashSize); } // Check MAC code byte[] mac = encodeRecordMAC(contentType, dcrFragment); --- 312,333 ---- state.ServerWriteIV); ! // Decrypt message fragment ( fragment + mac [+ padding + padding_length] ) ! byte[] buffer = decryptor.TransformFinalBlock(fragment, 0, fragment.Length); ! if (session.State.Cipher.CipherMode == CipherMode.CBC) { ! fragmentSize = (buffer.Length - 1) - session.State.Cipher.HashSize; } else { ! fragmentSize = buffer.Length - session.State.Cipher.HashSize; } + dcrFragment = new byte[fragmentSize]; + dcrMAC = new byte[session.State.Cipher.HashSize]; + + System.Array.Copy(buffer, 0, dcrFragment, 0, dcrFragment.Length); + System.Array.Copy(buffer, dcrFragment.Length, dcrMAC, 0, dcrMAC.Length); + // Check MAC code byte[] mac = encodeRecordMAC(contentType, dcrFragment); *************** *** 352,355 **** --- 348,354 ---- // Update sequence number session.State.ReadSequenceNumber++; + + // Clear resources + cipher.Clear(); return dcrFragment; Index: TlsWriter.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/TlsWriter.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsWriter.cs 20 Aug 2003 11:48:20 -0000 1.1 --- TlsWriter.cs 20 Aug 2003 15:15:50 -0000 1.2 *************** *** 186,196 **** ICryptoTransform encryptor = cipher.CreateEncryptor( state.ClientWriteKey, ! state.ClientWriteIV); ! ! // Complete data to encrypt if (session.State.Cipher.CipherMode == CipherMode.CBC) { - // Block Ciphers ( fragment + mac + padding + padding_length ) - // Calculate padding_length int fragmentLength = fragment.Length + mac.Length + 1; --- 186,199 ---- ICryptoTransform encryptor = cipher.CreateEncryptor( state.ClientWriteKey, ! state.ClientWriteIV); ! ! // Encryption ( fragment + mac [+ padding + padding_length] ) ! MemoryStream ms = new MemoryStream(); ! CryptoStream cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write); ! ! cs.Write(fragment, 0, fragment.Length); ! cs.Write(mac, 0, mac.Length); if (session.State.Cipher.CipherMode == CipherMode.CBC) { // Calculate padding_length int fragmentLength = fragment.Length + mac.Length + 1; *************** *** 198,225 **** int paddingLength = (((fragmentLength/blockSize)*8) + blockSize) - fragmentLength; ! MemoryStream ms = new MemoryStream(); ! CryptoStream cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write); ! ! cs.Write(fragment, 0, fragment.Length); ! cs.Write(mac, 0, mac.Length); cs.WriteByte((byte)paddingLength); - cs.FlushFinalBlock(); - cs.Close(); - - record.Write(ms.ToArray()); } ! else ! { ! // Stream Ciphers ( fragment + mac ) ! byte[] ecrFragment = encryptor.TransformFinalBlock(fragment, 0, fragment.Length); ! byte[] ecrMAC = encryptor.TransformFinalBlock(mac, 0, mac.Length); ! // Encrypt frament + MAC ! record.Write(ecrFragment); ! record.Write(ecrMAC); ! } // Update sequence number session.State.WriteSequenceNumber++; return record.GetBytes(); --- 201,217 ---- int paddingLength = (((fragmentLength/blockSize)*8) + blockSize) - fragmentLength; ! // Write padding length byte cs.WriteByte((byte)paddingLength); } ! cs.FlushFinalBlock(); ! cs.Close(); ! record.Write(ms.ToArray()); // Update sequence number session.State.WriteSequenceNumber++; + + // Clear resources + cipher.Clear(); return record.GetBytes(); |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient In directory sc8-pr-cvs1:/tmp/cvs-serv771 Modified Files: PgAuthMethods.cs PgConnectionParams.cs PgDbClient.cs PgInetWriter.cs PgOutputPacket.cs PgStatement.cs Log Message: Added changes for better handling of net writes Index: PgAuthMethods.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgAuthMethods.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PgAuthMethods.cs 2 Aug 2003 19:43:01 -0000 1.1.1.1 --- PgAuthMethods.cs 15 Aug 2003 17:50:09 -0000 1.2 *************** *** 49,51 **** } } ! } --- 49,51 ---- } } ! } \ No newline at end of file Index: PgConnectionParams.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgConnectionParams.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PgConnectionParams.cs 2 Aug 2003 19:43:02 -0000 1.1.1.1 --- PgConnectionParams.cs 15 Aug 2003 17:50:09 -0000 1.2 *************** *** 35,38 **** --- 35,39 ---- private bool pooling; private Encoding encoding; + private bool ssl; #endregion *************** *** 92,95 **** --- 93,102 ---- get { return pooling; } set { pooling = value; } + } + + public bool SSL + { + get { return ssl; } + set { ssl = value; } } Index: PgDbClient.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgDbClient.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgDbClient.cs 2 Aug 2003 21:12:16 -0000 1.2 --- PgDbClient.cs 15 Aug 2003 17:50:09 -0000 1.3 *************** *** 25,28 **** --- 25,30 ---- using System.Text; + //using PgSqlClient.Security.TLS; + namespace PostgreSql.Data.NPgClient { *************** *** 143,147 **** lock (this) { ! PgOutputPacket packet = new PgOutputPacket(4, settings.Encoding); packet.WriteInt(PgCodes.PROTOCOL_VERSION3); --- 145,181 ---- lock (this) { ! if (settings.SSL) ! { ! // Send SSL request message ! SSLRequest(); ! ! if (settings.SSL) ! { ! /* ! TlsSession session = new TlsSession(new TlsSessionSettings(TlsProtocol.Tls1)); ! ! TlsWriter tlsSend = session.GetWriter(new BufferedStream(this.networkStream)); ! TlsReader tlsRead = session.GetReader(new BufferedStream(this.networkStream)); ! ! try ! { ! // Start TLS Session ! session.StartSession(); ! } ! catch (TlsException ex) ! { ! // If the exception is fatal close connection ! if (ex.AlertLevel == TlsAlertLevel.Fatal) ! { ! this.Detach(); ! } ! throw new PgClientException(ex.Message); ! } ! */ ! } ! } ! ! // Send Startup message ! PgOutputPacket packet = new PgOutputPacket(settings.Encoding); packet.WriteInt(PgCodes.PROTOCOL_VERSION3); *************** *** 155,159 **** packet.Write((byte)0); // Terminator ! send.WriteSimplePacket(packet); PgResponsePacket response = new PgResponsePacket(); --- 189,194 ---- packet.Write((byte)0); // Terminator ! send.Write(packet.GetSimplePacketBytes()); ! send.Flush(); PgResponsePacket response = new PgResponsePacket(); *************** *** 163,167 **** { response = ReceiveResponsePacket(); ! processResponsePacket(response); } } --- 198,202 ---- { response = ReceiveResponsePacket(); ! processResponsePacket(response); } } *************** *** 169,172 **** --- 204,208 ---- catch (PgClientException ex) { + this.Detach(); throw ex; } *************** *** 179,188 **** // Send packet to the server PgOutputPacket packet = new PgOutputPacket(); ! send.WritePacket(PgFrontEndCodes.TERMINATE, packet); ! // Close all streams ! receive.Close(); ! send.Close(); ! socket.Close(); } catch (PgClientException ex) --- 215,224 ---- // Send packet to the server PgOutputPacket packet = new PgOutputPacket(); ! ! send.Write(packet.GetPacketBytes(PgFrontEndCodes.TERMINATE)); ! send.Flush(); ! // Close socket and streams ! this.Detach(); } catch (PgClientException ex) *************** *** 192,200 **** } #endregion #region RESPONSE_METHODS ! public PgResponsePacket ReceiveResponsePacket() { char type; --- 228,245 ---- } + public void Detach() + { + // Close socket and streams + receive.Close(); + send.Close(); + socket.Close(); + } + + #endregion #region RESPONSE_METHODS ! public PgResponsePacket ReceiveResponsePacket(params bool[] sslRequest) { char type; *************** *** 204,209 **** lock (this) { type = (char)receive.ReadByte(); ! length = receive.ReadInt() - 4; if (length != 0) --- 249,258 ---- lock (this) { + length = 0; type = (char)receive.ReadByte(); ! if ((sslRequest.Length > 0 && !sslRequest[0]) || type == PgBackendCodes.ERROR_RESPONSE) ! { ! length = receive.ReadInt() - 4; ! } if (length != 0) *************** *** 344,348 **** // Send the packet to the server ! send.WritePacket(PgFrontEndCodes.PASSWORD_MESSAGE, outPacket); } --- 393,398 ---- // Send the packet to the server ! send.Write(outPacket.GetPacketBytes(PgFrontEndCodes.PASSWORD_MESSAGE)); ! send.Flush(); } *************** *** 491,495 **** // Send packet to the server ! send.WritePacket(PgFrontEndCodes.FLUSH, packet); } catch (Exception ex) --- 541,546 ---- // Send packet to the server ! send.Write(packet.GetPacketBytes(PgFrontEndCodes.FLUSH)); ! send.Flush(); } catch (Exception ex) *************** *** 509,513 **** // Send packet to the server ! send.WritePacket(PgFrontEndCodes.SYNC, packet); } catch (Exception ex) --- 560,565 ---- // Send packet to the server ! send.Write(packet.GetPacketBytes(PgFrontEndCodes.SYNC)); ! send.Flush(); } catch (Exception ex) *************** *** 524,529 **** try { ! PgOutputPacket packet = new PgOutputPacket(0); packet.WriteInt(PgCodes.CANCEL_REQUEST); packet.WriteInt(Handle); --- 576,582 ---- try { ! PgOutputPacket packet = new PgOutputPacket(); + packet.WriteInt(16); packet.WriteInt(PgCodes.CANCEL_REQUEST); packet.WriteInt(Handle); *************** *** 531,535 **** // Send packet to the server ! send.WriteSimplePacket(packet); } catch (Exception ex) --- 584,624 ---- // Send packet to the server ! send.Write(packet.GetSimplePacketBytes()); ! send.Flush(); ! } ! catch (Exception ex) ! { ! throw ex; ! } ! } ! } ! ! public void SSLRequest() ! { ! lock (this) ! { ! try ! { ! PgOutputPacket packet = new PgOutputPacket(); ! ! packet.WriteInt(PgCodes.SSL_REQUEST); ! ! // Send packet to the server ! send.Write(packet.GetSimplePacketBytes()); ! send.Flush(); ! ! // Receive server response ! PgResponsePacket response = ReceiveResponsePacket(true); ! ! switch (response.Message) ! { ! case 'S': ! settings.SSL = true; ! break; ! ! default: ! settings.SSL = false; ! break; ! } } catch (Exception ex) Index: PgInetWriter.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgInetWriter.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PgInetWriter.cs 2 Aug 2003 19:43:02 -0000 1.1.1.1 --- PgInetWriter.cs 15 Aug 2003 17:50:09 -0000 1.2 *************** *** 36,39 **** --- 36,40 ---- #region METHODS + /* public void WriteSimplePacket(PgOutputPacket packet) { *************** *** 59,63 **** Flush(); } ! #endregion } --- 60,64 ---- Flush(); } ! */ #endregion } Index: PgOutputPacket.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgOutputPacket.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PgOutputPacket.cs 2 Aug 2003 19:43:02 -0000 1.1.1.1 --- PgOutputPacket.cs 15 Aug 2003 17:50:09 -0000 1.2 *************** *** 49,53 **** { this.encoding = Encoding.Default; ! Write(new byte[5]); } --- 49,53 ---- { this.encoding = Encoding.Default; ! Write(new byte[0]); } *************** *** 55,71 **** { this.encoding = encoding; ! Write(new byte[5]); ! } ! ! public PgOutputPacket(int length) : base(new MemoryStream()) ! { ! this.encoding = Encoding.Default; ! Write(new byte[length]); ! } ! ! public PgOutputPacket(int length, Encoding encoding) : base(new MemoryStream(), encoding) ! { ! this.encoding = encoding; ! Write(new byte[length]); } --- 55,59 ---- { this.encoding = encoding; ! Write(new byte[0]); } *************** *** 248,252 **** public int GetByteCount() { ! return (int)((MemoryStream)BaseStream).Length - 1; } --- 236,240 ---- public int GetByteCount() { ! return (int)((MemoryStream)BaseStream).Length; } *************** *** 260,263 **** --- 248,277 ---- ((MemoryStream)BaseStream).SetLength(0); ((MemoryStream)BaseStream).Position = 0; + } + + #endregion + + #region PACKET_BYTES + + public byte[] GetSimplePacketBytes() + { + PgOutputPacket packet = new PgOutputPacket(); + + // Write packet contents + packet.WriteInt(GetByteCount() + 4); + packet.Write(GetBytes()); + + return packet.GetBytes(); + } + + public byte[] GetPacketBytes(char format) + { + PgOutputPacket packet = new PgOutputPacket(); + + packet.Write((byte)format); + packet.WriteInt(GetByteCount() + 4); + packet.Write(GetBytes()); + + return packet.GetBytes(); } Index: PgStatement.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgStatement.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PgStatement.cs 2 Aug 2003 19:43:02 -0000 1.1.1.1 --- PgStatement.cs 15 Aug 2003 17:50:09 -0000 1.2 *************** *** 190,194 **** // Send packet to the server ! db.Send.WritePacket(PgFrontEndCodes.PARSE, packet); // Sync server and client --- 190,195 ---- // Send packet to the server ! db.Send.Write(packet.GetPacketBytes(PgFrontEndCodes.PARSE)); ! db.Send.Flush(); // Sync server and client *************** *** 239,243 **** // Send packet to the server ! db.Send.WritePacket(PgFrontEndCodes.DESCRIBE, packet); // Sync server and client --- 240,245 ---- // Send packet to the server ! db.Send.Write(packet.GetPacketBytes(PgFrontEndCodes.DESCRIBE)); ! db.Send.Flush(); // Sync server and client *************** *** 307,311 **** // Send packet to the server ! db.Send.WritePacket(PgFrontEndCodes.BIND, packet); // Sync server and client --- 309,314 ---- // Send packet to the server ! db.Send.Write(packet.GetPacketBytes(PgFrontEndCodes.BIND)); ! db.Send.Flush(); // Sync server and client *************** *** 341,345 **** // Send packet to the server ! db.Send.WritePacket(PgFrontEndCodes.EXECUTE, packet); // Sync server and client --- 344,349 ---- // Send packet to the server ! db.Send.Write(packet.GetPacketBytes(PgFrontEndCodes.EXECUTE)); ! db.Send.Flush(); // Sync server and client *************** *** 396,400 **** // Send packet to the server ! db.Send.WritePacket(PgFrontEndCodes.FUNCTION_CALL, packet); // Receive response --- 400,405 ---- // Send packet to the server ! db.Send.Write(packet.GetPacketBytes(PgFrontEndCodes.FUNCTION_CALL)); ! db.Send.Flush(); // Receive response *************** *** 426,430 **** // Send packet to the server ! db.Send.WritePacket(PgFrontEndCodes.QUERY, packet); // Receive response --- 431,436 ---- // Send packet to the server ! db.Send.Write(packet.GetPacketBytes(PgFrontEndCodes.QUERY)); ! db.Send.Flush(); // Receive response *************** *** 497,501 **** // Send packet to the server ! db.Send.WritePacket(PgFrontEndCodes.CLOSE, packet); // Sync server and client --- 503,508 ---- // Send packet to the server ! db.Send.Write(packet.GetPacketBytes(PgFrontEndCodes.CLOSE)); ! db.Send.Flush(); // Sync server and client |
From: <car...@us...> - 2003-08-16 00:23:29
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv1102 Modified Files: changelog.txt Log Message: Updated changelog.txt Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** changelog.txt 14 Aug 2003 17:16:04 -0000 1.16 --- changelog.txt 15 Aug 2003 17:52:32 -0000 1.17 *************** *** 2,5 **** --- 2,17 ---- ------------------------------------------------------- + + 2003-08-15 Carlos Guzmán Álvarez <car...@te...> + + * Added changes for better handling of net writes. + + + * source/PgCommand.cs: + * source/PgCommandBuilder.cs: + + - Added stored procedure execution using only the sp name. + + 2003-08-12 Carlos Guzmán Álvarez <car...@te...> |
From: <car...@us...> - 2003-08-15 20:28:34
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source In directory sc8-pr-cvs1:/tmp/cvs-serv554 Modified Files: PgCommand.cs PgCommandBuilder.cs Log Message: Added stored procedure execution using only the sp name. Index: PgCommand.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgCommand.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PgCommand.cs 12 Aug 2003 19:30:13 -0000 1.3 --- PgCommand.cs 15 Aug 2003 17:49:05 -0000 1.4 *************** *** 22,25 **** --- 22,26 ---- using System.Collections; using System.ComponentModel; + using System.Text; using System.Text.RegularExpressions; *************** *** 307,311 **** if (Transaction != null) { - // throw new InvalidOperationException("Command must have a valid Transaction."); if (!Connection.Equals(Transaction.Connection)) { --- 308,311 ---- *************** *** 461,468 **** statement.Status == PgStatementStatus.Error) { ! if (commandType == CommandType.StoredProcedure && ! !CommandText.ToUpper().StartsWith("SELECT * FROM ")) { ! CommandText = "SELECT * FROM " + CommandText; } --- 461,467 ---- statement.Status == PgStatementStatus.Error) { ! if (commandType == CommandType.StoredProcedure) { ! CommandText = parseSPCommandText(); } *************** *** 582,585 **** --- 581,617 ---- #region PRIVATE_METHODS + + private string parseSPCommandText() + { + string result = CommandText; + + if (!commandText.Trim().ToLower().StartsWith("select ")) + { + StringBuilder paramsText = new StringBuilder(); + + // Append the stored proc parameter name + paramsText.Append(CommandText); + paramsText.Append("("); + for (int i = 0; i < parameters.Count; i++) + { + if (parameters[i].Direction == ParameterDirection.Input || + parameters[i].Direction == ParameterDirection.InputOutput) + { + // Append parameter name to parameter list + paramsText.Append(parameters[i].ParameterName); + if (i != parameters.Count - 1) + { + paramsText = paramsText.Append(","); + } + } + } + paramsText.Append(")"); + paramsText.Replace(",)", ")"); + + result = "select * from " + paramsText.ToString(); + } + + return result; + } private string getStmtName() Index: PgCommandBuilder.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgCommandBuilder.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgCommandBuilder.cs 5 Aug 2003 17:59:07 -0000 1.2 --- PgCommandBuilder.cs 15 Aug 2003 17:49:05 -0000 1.3 *************** *** 191,196 **** } - string paramsText = String.Empty; - command.Parameters.Clear(); --- 191,194 ---- *************** *** 210,219 **** parameter.Direction = ParameterDirection.Input; - - paramsText = paramsText + parameter.ParameterName; - if ((i + 1) != parameterCount) - { - paramsText = paramsText + ","; - } } --- 208,211 ---- *************** *** 227,232 **** parameter.Direction = ParameterDirection.Output; } - - command.CommandText = command.CommandText + "(" + paramsText + ")"; } } --- 219,222 ---- |
From: <car...@us...> - 2003-08-15 20:12:03
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient.UnitTests/source In directory sc8-pr-cvs1:/tmp/cvs-serv944 Modified Files: PgCommandBuilderTest.cs PgCommandTest.cs Log Message: Added stored procedure execution using only the sp name. Index: PgCommandBuilderTest.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient.UnitTests/source/PgCommandBuilderTest.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PgCommandBuilderTest.cs 2 Aug 2003 19:43:03 -0000 1.1.1.1 --- PgCommandBuilderTest.cs 15 Aug 2003 17:51:20 -0000 1.2 *************** *** 130,134 **** PgCommandBuilder builder = new PgCommandBuilder(); ! PgCommand command = new PgCommand("DeriveCount(10)", Connection); command.CommandType = CommandType.StoredProcedure; --- 130,134 ---- PgCommandBuilder builder = new PgCommandBuilder(); ! PgCommand command = new PgCommand("DeriveCount", Connection); command.CommandType = CommandType.StoredProcedure; Index: PgCommandTest.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient.UnitTests/source/PgCommandTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgCommandTest.cs 3 Aug 2003 12:00:25 -0000 1.2 --- PgCommandTest.cs 15 Aug 2003 17:51:20 -0000 1.3 *************** *** 155,159 **** public void ExecuteStoredProcTest() { ! PgCommand command = new PgCommand("TestCount()", Connection); command.CommandType = CommandType.StoredProcedure; --- 155,159 ---- public void ExecuteStoredProcTest() { ! PgCommand command = new PgCommand("TestCount", Connection); command.CommandType = CommandType.StoredProcedure; |
From: <car...@us...> - 2003-08-14 17:21:00
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv30870 Modified Files: changelog.txt Log Message: Updated CHANGELOG.TXT Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** changelog.txt 12 Aug 2003 19:30:57 -0000 1.15 --- changelog.txt 14 Aug 2003 17:16:04 -0000 1.16 *************** *** 6,10 **** * source/PgParameterCollection.cs: ! - Fixed error on RemoveAt method --- 6,10 ---- * source/PgParameterCollection.cs: ! - Fixed error on RemoveAt method (#788826). *************** *** 13,20 **** - Added processing of new connection string element for ssl connections. * source/PgParameter.cs: ! - Fixed error on null value andling and rearrange FbDbType infering from Value property ! to match SqlParameter behavior ( Thanks to Alessandro Petrelli for his feedback). 2003-07-07 Carlos Guzmán Álvarez <car...@te...> --- 13,22 ---- - Added processing of new connection string element for ssl connections. + * source/PgParameter.cs: ! - Fixed error on null value handling and rearrange FbDbType infering from Value property ! to match SqlParameter behavior (#88827). ! 2003-07-07 Carlos Guzmán Álvarez <car...@te...> |
From: <car...@us...> - 2003-08-12 19:50:22
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv4452 Modified Files: changelog.txt Log Message: Update changelog.txt Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** changelog.txt 12 Aug 2003 14:25:51 -0000 1.14 --- changelog.txt 12 Aug 2003 19:30:57 -0000 1.15 *************** *** 9,16 **** - * source/PgCommand.cs: - - - Added correct handling of null values when setting output parameters values. - * source/PgDbConnection.cs: --- 9,12 ---- |
From: <car...@us...> - 2003-08-12 19:32:25
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source In directory sc8-pr-cvs1:/tmp/cvs-serv4271 Modified Files: PgCommand.cs PgParameter.cs Log Message: Improve a little latest changes for handle null values on parameters Index: PgCommand.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgCommand.cs 12 Aug 2003 13:32:27 -0000 1.2 --- PgCommand.cs 12 Aug 2003 19:30:13 -0000 1.3 *************** *** 572,579 **** ((PgParameter)paramEnumerator.Current).Direction == ParameterDirection.ReturnValue) { - if (values[i] == null) - { - values[i] = System.DBNull.Value; - } ((PgParameter)paramEnumerator.Current).Value = values[i]; i++; --- 572,575 ---- Index: PgParameter.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgParameter.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PgParameter.cs 12 Aug 2003 13:13:03 -0000 1.3 --- PgParameter.cs 12 Aug 2003 19:30:13 -0000 1.4 *************** *** 133,136 **** --- 133,140 ---- set { + if (value == null) + { + value = System.DBNull.Value; + } this.value = value; if (defaultCtor) |