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 *'
There are two issues with the current binding for
semanage_module_install_info:Running the following code
results in