Apply the get_peer_cert_chain parts of okuda's patch
diff --git a/OpenSSL/ssl/connection.c b/OpenSSL/ssl/connection.c
index 5b304b1..09e2607 100755
--- a/OpenSSL/ssl/connection.c
+++ b/OpenSSL/ssl/connection.c
@@ -1098,6 +1098,43 @@
     }
 }
 
+static char ssl_Connection_get_peer_cert_chain_doc[] = "\n\
+Retrieve the other side's certificate (if any)\n\
+\n\
+Arguments: self - The Connection object\n\
+           args - The Python argument tuple, should be empty\n\
+Returns:   The peer's certificates chain tuple\n\
+";
+static PyObject *
+ssl_Connection_get_peer_cert_chain(ssl_ConnectionObj *self, PyObject *args)
+{
+    STACK_OF(X509) *sk;
+    PyObject *tpl, *item;
+    Py_ssize_t i;
+
+    if (!PyArg_ParseTuple(args, ":get_peer_cert_chain"))
+        return NULL;
+
+    sk = SSL_get_peer_cert_chain(self->ssl);
+    if (sk != NULL)
+    {
+        tpl = PyTuple_New(sk_X509_num(sk));
+        for (i=0; i<sk_X509_num(sk); i++)
+        {
+            item = (PyObject *)crypto_X509_New(sk_X509_value(sk,i), 1);
+            Py_INCREF(item);
+            PyTuple_SET_ITEM(tpl, i, item);
+        }
+        return tpl;
+    }
+    else
+    {
+        Py_INCREF(Py_None);
+        return Py_None;
+    }
+
+}
+
 static char ssl_Connection_want_read_doc[] = "\n\
 Checks if more data has to be read from the transport layer to complete an\n\
 operation.\n\
@@ -1175,6 +1212,7 @@
     ADD_METHOD(master_key),
     ADD_METHOD(sock_shutdown),
     ADD_METHOD(get_peer_certificate),
+    ADD_METHOD(get_peer_cert_chain),
     ADD_METHOD(want_read),
     ADD_METHOD(want_write),
     ADD_METHOD(set_accept_state),