libselinux swig wrapper breakage
I was testing a few functions from the libselinux swig wrapper (cvs selinux-usr) and ran in to problems:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
import selinux
selinux.setexeccon('user_u:user_r:user_spamassassin_t')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: argument number 1: a 'security_context_t *' is expected, 'str(user_u:user_r:user_spamassassin_t)' is received
Quoted 1 line
Quoted 1 line
Quoted 1 line
selinux.getexeccon()
Segmentation fault
Signature · 8 lines
Chris PeBenito <[email protected]> Developer, Hardened Gentoo Linux Embedded Gentoo Linux Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243 Key fingerprint = B0E6 877A 883F A57A 8E6A CB00 BC8E E42D E6AF 9243
Quoted 5 lines
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: argument number 1: a 'security_context_t*' is expected, 'str(user_u:user_r:user_spamassassin_t)' is received
You're passing a string into something that expects a security_context_t.
That won't work - it fails, because security_context_t is an opaque type, and swig has no idea that it represents a char*. It would know that if selinux.h was included in the interface file. However, the swig bindings for selinux take the approach of listing all the functions manually (and omitting the public definition of security_context_t as a char*).
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 8 lines
Quoted 5 lines
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: argument number 1: a 'security_context_t*' is expected, 'str(user_u:user_r:user_spamassassin_t)' is receivedYou're passing a string into something that expects a
security_context_t.That won't work - it fails, because
security_context_tis an opaque type, and swig has no idea that it represents a char*. It would know that ifselinux.hwas included in the interface file. However, the swig bindings for selinux take the approach of listing all the functions manually (and omitting the public definition ofsecurity_context_tas a char*).
Well, selinux.h is included in the bindings, but it isn't processed, which is what I meant...
%{ #include %} is an inline declaration at a particular section of the wrappers (I forget which one is default). %include indicates the file should be processed by swig, and wrappers generated.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.