~ubuntu-branches/ubuntu/trusty/libxslt/trusty

« back to all changes in this revision

Viewing changes to python/libxsl.py

  • Committer: Bazaar Package Importer
  • Author(s): Mike Hommey
  • Date: 2008-08-03 09:03:42 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080803090342-0gzx6fixj16lirxt
Tags: 1.1.24-2
libexslt/crypto.c: Apply upstream fix for CVE-2008-2935. Closes: #493162.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
            if osname == 'Linux' or osname == 'SunOS':
21
21
                RTLD_GLOBAL = 0x00100
22
22
                RTLD_NOW = 0x00002
23
 
            elif osname == 'Darwin':
24
 
                RTLD_GLOBAL = 0x8
25
 
                RTLD_NOW = 0x2
 
23
            elif osname == 'Darwin':
 
24
                RTLD_GLOBAL = 0x8
 
25
                RTLD_NOW = 0x2
26
26
            #
27
27
            # is there a better method ?
28
28
            #
30
30
#                print "libxslt could not guess RTLD_GLOBAL and RTLD_NOW " + \
31
31
#                      "on this platform: %s" % (osname)
32
32
        except:
33
 
             pass
 
33
             pass
34
34
#            print "libxslt could not guess RTLD_GLOBAL and RTLD_NOW " + \
35
35
#                  "on this platform: %s" % (osname)
36
36
    except:
37
 
         RTLD_GLOBAL = -1
38
 
         RTLD_NOW = -1
 
37
        RTLD_GLOBAL = -1
 
38
        RTLD_NOW = -1
39
39
 
40
40
    if RTLD_GLOBAL != -1 and RTLD_NOW != -1:
41
41
        try:
56
56
        import libxsltmod
57
57
        import libxml2
58
58
 
 
59
 
 
60
class transformCtxtBase:
 
61
    def __init__(self, _obj=None):
 
62
        if _obj != None: 
 
63
            self._o = _obj;
 
64
            return
 
65
        self._o = None
 
66
    def __hash__(self):
 
67
        v = libxsltmod.xsltGetTransformContextHashCode(self._o)
 
68
        return v
 
69
    def __eq__(self, other):
 
70
        if other == None:
 
71
            return 0
 
72
        v = libxsltmod.xsltCompareTransformContextsEqual(self._o, other._o)
 
73
        return v
 
74
        
 
75
class stylesheetBase:
 
76
    def __init__(self, _obj=None):
 
77
        if _obj != None: 
 
78
            self._o = _obj;
 
79
            return
 
80
        self._o = None
 
81
    def __hash__(self):
 
82
        v = libxsltmod.xsltGetStylesheetHashCode(self._o)
 
83
        return v
 
84
    def __eq__(self, other):
 
85
        if other == None:
 
86
            return 0
 
87
        v = libxsltmod.xsltCompareStylesheetsEqual(self._o, other._o)
 
88
        return v
 
89
 
59
90
class extensionModule:
60
91
    def _styleInit(self, style, URI):
61
92
        return self.styleInit(stylesheet(_obj=style), URI)
71
102
 
72
103
    def styleInit(self, style, URI):
73
104
        """Callback function when used in a newly compiled stylesheet,
74
 
           the return value is passed in subsequent calls"""
75
 
        pass
 
105
           the return value is passed in subsequent calls"""
 
106
        pass
76
107
 
77
108
    def styleShutdown(self, style, URI, data):
78
109
        """Callback function when a stylesheet using it is destroyed"""
79
 
        pass
 
110
        pass
80
111
 
81
112
    def ctxtInit(self, ctxt, URI):
82
113
        """Callback function when used in a new transformation process,
83
 
           the return value is passed in subsequent calls"""
84
 
        pass
 
114
           the return value is passed in subsequent calls"""
 
115
        pass
85
116
 
86
117
    def ctxtShutdown(self, ctxt, URI, data):
87
118
        """Callback function when a transformation using it finishes"""
88
 
        pass
 
119
        pass
89
120
 
90
121
def cleanup():
91
122
    """Cleanup all libxslt and libxml2 memory allocated"""