summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2019-11-18 19:32:46 (GMT)
committerGitHub <noreply@github.com>2019-11-18 19:32:46 (GMT)
commit00923c63995e34cdc25d699478f113de99a69df9 (patch)
tree597e8346b14d890b99ddcd6ee8c3ef659f349dd2 /Doc
parent476e76f7cf78598146140c3bda48d53cda50707c (diff)
downloadcpython-00923c63995e34cdc25d699478f113de99a69df9.zip
cpython-00923c63995e34cdc25d699478f113de99a69df9.tar.gz
cpython-00923c63995e34cdc25d699478f113de99a69df9.tar.bz2
bpo-38622: Add missing audit events for ctypes module (GH-17158)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/ctypes.rst36
1 files changed, 36 insertions, 0 deletions
diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
index 1f84b7a..e0bc28f 100644
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -1526,6 +1526,12 @@ object is available:
``ctypes.dlsym`` with arguments ``library`` (the library object) and ``name``
(the symbol's name as a string or integer).
+.. audit-event:: ctypes.dlsym/handle handle,name ctypes.LibraryLoader
+
+ In cases when only the library handle is available rather than the object,
+ accessing a function raises an auditing event ``ctypes.dlsym/handle`` with
+ arguments ``handle`` (the raw library handle) and ``name``.
+
.. _ctypes-foreign-functions:
Foreign functions
@@ -1611,6 +1617,19 @@ They are instances of a private class:
passed arguments.
+.. audit-event:: ctypes.seh_exception code foreign-functions
+
+ On Windows, when a foreign function call raises a system exception (for
+ example, due to an access violation), it will be captured and replaced with
+ a suitable Python exception. Further, an auditing event
+ ``ctypes.seh_exception`` with argument ``code`` will be raised, allowing an
+ audit hook to replace the exception with its own.
+
+.. audit-event:: ctypes.call_function func_pointer,arguments ctype-foreign-functions
+
+ Some ways to invoke foreign function calls may raise an auditing event
+ ``ctypes.call_function`` with arguments ``function pointer`` and ``arguments``.
+
.. _ctypes-function-prototypes:
Function prototypes
@@ -1802,6 +1821,8 @@ Utility functions
Returns the address of the memory buffer as integer. *obj* must be an
instance of a ctypes type.
+ .. audit-event:: ctypes.addressof obj ctypes.addressof
+
.. function:: alignment(obj_or_type)
@@ -1844,6 +1865,7 @@ Utility functions
termination character. An integer can be passed as second argument which allows
specifying the size of the array if the length of the bytes should not be used.
+ .. audit-event:: ctypes.create_string_buffer init,size ctypes.create_string_buffer
.. function:: create_unicode_buffer(init_or_size, size=None)
@@ -1860,6 +1882,7 @@ Utility functions
allows specifying the size of the array if the length of the string should not
be used.
+ .. audit-event:: ctypes.create_unicode_buffer init,size ctypes.create_unicode_buffer
.. function:: DllCanUnloadNow()
@@ -1917,11 +1940,15 @@ Utility functions
Returns the current value of the ctypes-private copy of the system
:data:`errno` variable in the calling thread.
+ .. audit-event:: ctypes.get_errno "" ctypes.get_errno
+
.. function:: get_last_error()
Windows only: returns the current value of the ctypes-private copy of the system
:data:`LastError` variable in the calling thread.
+ .. audit-event:: ctypes.get_last_error "" ctypes.get_last_error
+
.. function:: memmove(dst, src, count)
Same as the standard C memmove library function: copies *count* bytes from
@@ -1965,6 +1992,7 @@ Utility functions
Set the current value of the ctypes-private copy of the system :data:`errno`
variable in the calling thread to *value* and return the previous value.
+ .. audit-event:: ctypes.set_errno errno ctypes.set_errno
.. function:: set_last_error(value)
@@ -1973,6 +2001,7 @@ Utility functions
:data:`LastError` variable in the calling thread to *value* and return the
previous value.
+ .. audit-event:: ctypes.set_last_error error ctypes.set_last_error
.. function:: sizeof(obj_or_type)
@@ -1987,6 +2016,8 @@ Utility functions
object. If size is specified, it is used as size, otherwise the string is assumed
to be zero-terminated.
+ .. audit-event:: ctypes.string_at address,size ctypes.string_at
+
.. function:: WinError(code=None, descr=None)
@@ -2007,6 +2038,8 @@ Utility functions
characters of the string, otherwise the string is assumed to be
zero-terminated.
+ .. audit-event:: ctypes.wstring_at address,size ctypes.wstring_at
+
.. _ctypes-data-types:
@@ -2034,6 +2067,7 @@ Data types
source buffer in bytes; the default is zero. If the source buffer is not
large enough a :exc:`ValueError` is raised.
+ .. audit-event:: ctypes.cdata/buffer pointer,size,offset ctypes._CData.from_buffer
.. method:: _CData.from_buffer_copy(source[, offset])
@@ -2043,6 +2077,8 @@ Data types
is zero. If the source buffer is not large enough a :exc:`ValueError` is
raised.
+ .. audit-event:: ctypes.cdata/buffer pointer,size,offset ctypes._CData.from_buffer_copy
+
.. method:: from_address(address)
This method returns a ctypes type instance using the memory specified by