Skip to content

Incorrect SWIG binding for semanage_module_install_info #502

Description

@Bob131

There are two issues with the current binding for semanage_module_install_info:

  • It takes both a buffer and a length, as separate arguments
  • The buffer argument is unmarshalled as though it were a Unicode string and not a binary blob

Running the following code

handle = semanage.semanage_handle_create()
_, info = semanage.semanage_module_info_create(handle)
semanage.semanage_module_install_info(handle, info, b'123', 3)

results in

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    semanage.semanage_module_install_info(handle, info, b'123', 3)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.14/site-packages/semanage.py", line 255, in semanage_module_install_info
    return _semanage.semanage_module_install_info(sh, modinfo, data, data_len)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'semanage_module_install_info', argument 3 of type 'char *'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions