summaryrefslogtreecommitdiff
path: root/extra/yassl/src/yassl_int.cpp
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-04-05 10:49:38 +0200
committerSergei Golubchik <sergii@pisem.net>2012-04-05 10:49:38 +0200
commitd4b30a7a84742ae03774fe25af2cbad144ba2d5d (patch)
treed65a66f9f2f9378a1f4ca014e18952ae514f4cb1 /extra/yassl/src/yassl_int.cpp
parentd993ce1bbf8413a0aaf5a524a11334359234c5f4 (diff)
parentcea2c5d28ead6ae4191aea164df9b80b41a743ad (diff)
downloadmariadb-git-mariadb-5.1.62.tar.gz
mysql-5.1.62 mergemariadb-5.1.62
Diffstat (limited to 'extra/yassl/src/yassl_int.cpp')
-rw-r--r--extra/yassl/src/yassl_int.cpp59
1 files changed, 46 insertions, 13 deletions
diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp
index ece8dc1784e..64feb8e44d5 100644
--- a/extra/yassl/src/yassl_int.cpp
+++ b/extra/yassl/src/yassl_int.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2011, Oracle and/or its affiliates
+ Copyright (c) 2005, 2012, Oracle and/or its affiliates
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,8 +11,9 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ along with this program; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ MA 02110-1301 USA.
*/
@@ -307,8 +308,9 @@ SSL::SSL(SSL_CTX* ctx)
SetError(YasslError(err));
return;
}
- else if (serverSide && !(ctx->GetCiphers().setSuites_)) {
+ else if (serverSide && ctx->GetCiphers().setSuites_ == 0) {
// remove RSA or DSA suites depending on cert key type
+ // but don't override user sets
ProtocolVersion pv = secure_.get_connection().version_;
bool removeDH = secure_.use_parms().removeDH_;
@@ -1127,8 +1129,28 @@ void SSL::flushBuffer()
void SSL::Send(const byte* buffer, uint sz)
{
- if (socket_.send(buffer, sz) != sz)
- SetError(send_error);
+ unsigned int sent = 0;
+
+ if (socket_.send(buffer, sz, sent) != sz) {
+ if (socket_.WouldBlock()) {
+ buffers_.SetOutput(NEW_YS output_buffer(sz - sent, buffer + sent,
+ sz - sent));
+ SetError(YasslError(SSL_ERROR_WANT_WRITE));
+ }
+ else
+ SetError(send_error);
+ }
+}
+
+
+void SSL::SendWriteBuffered()
+{
+ output_buffer* out = buffers_.TakeOutput();
+
+ if (out) {
+ mySTL::auto_ptr<output_buffer> tmp(out);
+ Send(out->get_buffer(), out->get_size());
+ }
}
@@ -1290,7 +1312,6 @@ void SSL::matchSuite(const opaque* peer, uint length)
if (secure_.use_parms().suites_[i] == peer[j]) {
secure_.use_parms().suite_[0] = 0x00;
secure_.use_parms().suite_[1] = peer[j];
-
return;
}
@@ -1434,7 +1455,6 @@ void SSL::addBuffer(output_buffer* b)
void SSL_SESSION::CopyX509(X509* x)
{
- assert(peerX509_ == 0);
if (x == 0) return;
X509_NAME* issuer = x->GetIssuer();
@@ -1832,7 +1852,7 @@ SSL_CTX::GetCA_List() const
}
-VerifyCallback SSL_CTX::getVerifyCallback() const
+const VerifyCallback SSL_CTX::getVerifyCallback() const
{
return verifyCallback_;
}
@@ -2231,7 +2251,7 @@ Hashes& sslHashes::use_certVerify()
}
-Buffers::Buffers() : rawInput_(0)
+Buffers::Buffers() : prevSent(0), plainSz(0), rawInput_(0), output_(0)
{}
@@ -2242,12 +2262,18 @@ Buffers::~Buffers()
STL::for_each(dataList_.begin(), dataList_.end(),
del_ptr_zero()) ;
ysDelete(rawInput_);
+ ysDelete(output_);
+}
+
+
+void Buffers::SetOutput(output_buffer* ob)
+{
+ output_ = ob;
}
void Buffers::SetRawInput(input_buffer* ib)
{
- assert(rawInput_ == 0);
rawInput_ = ib;
}
@@ -2261,6 +2287,15 @@ input_buffer* Buffers::TakeRawInput()
}
+output_buffer* Buffers::TakeOutput()
+{
+ output_buffer* ret = output_;
+ output_ = 0;
+
+ return ret;
+}
+
+
const Buffers::inputList& Buffers::getData() const
{
return dataList_;
@@ -2535,14 +2570,12 @@ ASN1_STRING* StringHolder::GetString()
// these versions should never get called
int Compress(const byte* in, int sz, input_buffer& buffer)
{
- assert(0);
return -1;
}
int DeCompress(input_buffer& in, int sz, input_buffer& out)
{
- assert(0);
return -1;
}