summaryrefslogtreecommitdiff
path: root/dbus_bindings
Commit message (Collapse)AuthorAgeFilesLines
* unixfd: Fix assertion failure constructing UnixFd for invalid fdSimon McVittie2022-09-061-3/+3
| | | | | | | | | | | | | File descriptors are represented as the C int type, but only non-negative values represent a valid fd, with all negative values representing the absence of a fd (a NULL-like value). Previously, make_fd() accepted negative fds, but then UnixFd_tp_new would crash with an assertion failure. Instead, range-check the value according to the semantically valid range. If it isn't, raise the same error we previously raised for values that don't fit in an int. Signed-off-by: Simon McVittie <smcv@collabora.com>
* message: Fix assertion failure unpacking handle to an out-of-range fdSimon McVittie2022-09-061-0/+8
| | | | | | | | | | | | | | | | | | In the D-Bus wire protocol, the representation of a Unix fd is a simple integer in the message body (referred to as the "handle" in GDBus) which acts as an index into the array of out-of-band fds attached to the message. The libdbus API (and therefore the dbus-python API) automatically translates handles into fds, but the GDBus API does not, making it possible for a GDBus sender to send a message containing handles that are out-of-range for the number of attached fds. The message bus also does not prevent such messages from being sent. dbus-python services need to cope with this and fail gracefully while unpacking the message, rather than crashing with an assertion failure in UnixFd_tp_new when the fd turns out to be invalid. Resolves: https://github.com/firewalld/firewalld/issues/985 Signed-off-by: Simon McVittie <smcv@collabora.com>
* add set_allow_interactive_authorization / ↵Ricter Zheng2022-04-271-0/+28
| | | | | | get_allow_interactive_authorization for message add unit tests
* Remove support for Python 2Simon McVittie2021-09-1519-689/+96
| | | | | | | | Python 2 reached EOL on 2020-01-01, and the latest version of AX_PYTHON_DEVEL breaks the build with Python 2. This seems as good a time as any to drop compatibility. Signed-off-by: Simon McVittie <smcv@collabora.com>
* unixfd: Don't leak self if variant_level < 0Simon McVittie2021-07-191-4/+5
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* unixfd: Close fd in error pathDavid King2021-07-191-1/+3
| | | | | | Found by Coverity. Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=1938703
* abstract: Stringify float subclasses using float's reprSimon McVittie2019-11-211-1/+14
| | | | | | | | Python 3.8 removes the tp_str for various built-in types, so we would print Double values as their repr (for example dbus.Double(0.5)), which is a regression. Print them as 0.5 instead. Signed-off-by: Simon McVittie <smcv@collabora.com>
* int: Ensure we stringify Booleans as 0 or 1Simon McVittie2019-11-211-1/+7
| | | | | | | | | | Python 3.8 removes the tp_str for various built-in types, so we would print Boolean values as their repr (for example dbus.Boolean(True)), which is a regression. Print them as 0 or 1 instead, which was the historical behaviour (arguably False or True would be better, but that would be a behaviour change). Signed-off-by: Simon McVittie <smcv@collabora.com>
* abstract: Stringify long subclasses using long's reprSimon McVittie2019-11-211-1/+14
| | | | | | | | | | Python 3.8 removes the tp_str for various built-in types, so we would print long-derived values as their repr (for example dbus.Int64(42)), which is a regression. Print them as 42 instead. Co-authored-by: matclab <mathieu@clabaut.net> Signed-off-by: Simon McVittie <smcv@collabora.com> Fixes: https://gitlab.freedesktop.org/dbus/dbus-python/issues/31
* Revert "Consistently save/restore exception indicator when called from C code"Simon McVittie2019-09-123-43/+16
| | | | | | | | | | Saving and restoring the exception indicator breaks users of dbus-python that rely on being able to raise SystemExit (or call sys.exit()) from a dbus-python method, such as libsecret's test suite. This reverts commit dbc0f7ef463922c026f1183a07368aa61ffe98dc. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Consistently save/restore exception indicator when called from C codeSimon McVittie2019-09-023-16/+43
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* TRACE: Fix NULL argument to format stringSimon McVittie2019-09-021-1/+1
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* unixfd: Adjust docstringSimon McVittie2019-09-021-2/+2
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* Add variant_level to UnixFd typeJohn Baublitz2019-08-301-3/+27
|
* Silence -Wcast-function-type with gcc 8Simon McVittie2019-07-236-45/+48
| | | | | | | | | Casting via void (*)(void) is the documented way to suppress this warning. This is required because the CPython API treats function pointers as generic, with flags to indicate different calling conventions. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Don't set deprecated tp_print to NULL on Python 3Simon McVittie2019-07-157-1/+40
| | | | | | | This has apparently never actually done anything in the Python 3 series. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Add clearer licensing information in SPDX formatSimon McVittie2019-07-1528-0/+56
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* Improve documentation for SphinxSimon McVittie2018-05-028-93/+63
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* doc: Be more clear about bytes vs. unicodeSimon McVittie2018-05-022-5/+9
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* Improve UTF8String documentationSimon McVittie2018-05-021-9/+8
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* Convert documentation from epydoc to SphinxSimon McVittie2018-05-027-70/+56
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* Rename source directories for C code to silence an ImportWarningSimon McVittie2017-11-0528-0/+11289
Python warns that it is not importing these directories because they contain no __init__.py. Signed-off-by: Simon McVittie <smcv@collabora.com>