~ubuntu-branches/ubuntu/quantal/m2crypto/quantal

« back to all changes in this revision

Viewing changes to .pc/fix_build_with_new_openssl.patch/SWIG/_util.i

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2011-08-10 17:01:24 UTC
  • mfrom: (23.3.1 oneiric)
  • Revision ID: package-import@ubuntu.com-20110810170124-ctuhz524p63n0hrz
* repackage upstream
  - remove non-free demo/x509/proxylib.py
* switch to dh_python2 (LP: #788514) 
* switch to 3.0 (quilt)
  - converted all upstream changes to patches
  - fix_sslv2_test.patch: testsuite patch for sslv2 deactivation
  - fix_build_with_new_openssl.patch: build fix from debian 0.20.1-1.1
* Merge from debian testing, remaining changes:
  - disable_sslv2_test.patch: disable sslv23_weak_crypto test as it is expected to
    fail with SSLv2 having been disabled in openssl 0.9.8o-1ubuntu3.
    (LP: #600549)
  - fix_sslv2_test2.patch: fix testsuite with newer openssl. (LP: #600549)
    - Backported from http://svn.osafoundation.org/viewvc/m2crypto/trunk/tests/test_smime.py?r1=698&r2=721
  - debian/control: Add openssl for FTBFS. 
  - debian/rules; enable testsuite, add more files to "clean" rule.
  - fix_kill_signal.patch: use signal 9 to kill old s_server processes
    to work around build HUP signal-ignore-mask (LP: #451998).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 1999-2002 Ng Pheng Siong. All rights reserved. */
 
2
/* $Id: _util.i 522 2007-05-08 22:21:51Z heikki $ */
 
3
 
 
4
%{
 
5
#include <openssl/x509v3.h>
 
6
%}
 
7
 
 
8
%inline %{
 
9
static PyObject *_util_err;
 
10
 
 
11
void util_init(PyObject *util_err) {
 
12
    Py_INCREF(util_err);
 
13
    _util_err = util_err;
 
14
}
 
15
    
 
16
PyObject *util_hex_to_string(PyObject *blob) {
 
17
    PyObject *obj;
 
18
    const void *buf;
 
19
    char *ret;
 
20
    Py_ssize_t len;
 
21
 
 
22
    if (PyObject_AsReadBuffer(blob, &buf, &len) == -1)
 
23
        return NULL;
 
24
 
 
25
    ret = hex_to_string((unsigned char *)buf, len);
 
26
    if (!ret) {
 
27
        PyErr_SetString(_util_err, ERR_reason_error_string(ERR_get_error()));
 
28
        return NULL;
 
29
    }
 
30
    obj = PyString_FromString(ret);
 
31
    OPENSSL_free(ret);
 
32
    return obj;
 
33
}
 
34
 
 
35
PyObject *util_string_to_hex(PyObject *blob) {
 
36
    PyObject *obj;
 
37
    const void *buf;
 
38
    unsigned char *ret;
 
39
    Py_ssize_t len0;
 
40
    long len;
 
41
 
 
42
    if (PyObject_AsReadBuffer(blob, &buf, &len0) == -1)
 
43
        return NULL;
 
44
 
 
45
    len = len0;
 
46
    ret = string_to_hex((char *)buf, &len);
 
47
    if (ret == NULL) {
 
48
        PyErr_SetString(_util_err, ERR_reason_error_string(ERR_get_error()));
 
49
        return NULL;
 
50
    }
 
51
    obj = PyString_FromStringAndSize(ret, len);
 
52
    OPENSSL_free(ret);
 
53
    return obj;
 
54
}
 
55
%}