summaryrefslogtreecommitdiff
path: root/OpenSSL/ssl/context.c
diff options
context:
space:
mode:
authorJean-Paul Calderone <exarkun@divmod.com>2011-09-11 09:18:14 -0400
committerJean-Paul Calderone <exarkun@divmod.com>2011-09-11 09:18:14 -0400
commit2164154f28866f6d125c67b5ba306c2211bbc066 (patch)
treef704967c48f643a2762ba82773aabff23868ec01 /OpenSSL/ssl/context.c
parentf1b7030bab5f838bd174779196ea6110a7270a7d (diff)
parent3958486249048b83ae097c73d29e174010507fb9 (diff)
downloadpyopenssl-2164154f28866f6d125c67b5ba306c2211bbc066.tar.gz
merge trunk
Diffstat (limited to 'OpenSSL/ssl/context.c')
-rw-r--r--OpenSSL/ssl/context.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/OpenSSL/ssl/context.c b/OpenSSL/ssl/context.c
index d0b49cb..9a9fd11 100644
--- a/OpenSSL/ssl/context.c
+++ b/OpenSSL/ssl/context.c
@@ -1108,6 +1108,23 @@ ssl_Context_set_options(ssl_ContextObj *self, PyObject *args)
return PyLong_FromLong(SSL_CTX_set_options(self->ctx, options));
}
+static char ssl_Context_set_mode_doc[] = "\n\
+Add modes via bitmask. Modes set before are not cleared!\n\
+\n\
+@param mode: The mode to add.\n\
+@return: The new mode bitmask.\n\
+";
+static PyObject *
+ssl_Context_set_mode(ssl_ContextObj *self, PyObject *args) {
+ long mode;
+
+ if (!PyArg_ParseTuple(args, "l:set_mode", &mode)) {
+ return NULL;
+ }
+
+ return PyLong_FromLong(SSL_CTX_set_mode(self->ctx, mode));
+}
+
static char ssl_Context_set_tlsext_servername_callback_doc[] = "\n\
Specify a callback function to be called when clients specify a server name.\n\
\n\
@@ -1174,6 +1191,7 @@ static PyMethodDef ssl_Context_methods[] = {
ADD_METHOD(set_app_data),
ADD_METHOD(get_cert_store),
ADD_METHOD(set_options),
+ ADD_METHOD(set_mode),
ADD_METHOD(set_tlsext_servername_callback),
{ NULL, NULL }
};