Re: SSL.Context.load_verify_locations
"Thomas D. Uram" <[email protected]>
| Newsgroups | gmane.comp.python.cryptography |
|---|---|
| Message-ID | <[email protected]> |
Okay, I'm using code from subversion now, and the problem persists when passing
cafile=None and capath="/path/to/ca/certs". I seem to need to define a typemap to go from
None to NULL in _lib.i:
Index: SWIG/_lib.i
===================================================================
--- SWIG/_lib.i (revision 295)
+++ SWIG/_lib.i (working copy)
@@ -462,6 +462,15 @@
$1=$input;
}
+%typemap(python, in) char * {
+ if ($input == Py_None) {
+ $1 = NULL;
+ }
+ else {
+ $1 = PyString_AsString($input);
+ }
+}
+
%typemap(python, in) PyObject * {
$1=$input;
}
Also, fwiw, I needed to make this change to make the build, else PyCodeObject was not found:
Index: SWIG/_m2crypto.i
===================================================================
--- SWIG/_m2crypto.i (revision 295)
+++ SWIG/_m2crypto.i (working copy)
@@ -15,6 +15,8 @@
#include <openssl/rand.h>
#include <_lib.h>
+#include "compile.h"
+
static PyObject *ssl_verify_cb_func;
static PyObject *ssl_info_cb_func;
static PyObject *ssl_set_tmp_dh_cb_func;
I'm not sure if that's where the include should be added.
On 06/08/05 22:17, Heikki Toivonen wrote:
> Thomas D. Uram wrote:
>
>>Strange. I'm using m2crypto-0.13, and I get this:
>
> [...]
>
>> return m2.ssl_ctx_load_verify_locations(self.ctx, cafile, capath or '')
>>TypeError: ssl_ctx_load_verify_locations() argument 2 must be string, not None
>
>
> Ah, I'm working on the latest from Subversion, and I fixed that weeks
> ago. I don't know why that was introduced either. The problem in 0.13 is
> that last part of the call to m2.ssl_ctx_load_verify_locations - it
> should say |capath|, not |capath or ''|.
>
>
>>I think re-enabling the cafile/capath assertion makes the most sense.
>
>
> Done.
>
> Thanks for the report,
>
> --
> Heikki Toivonen
>