diff --git a/libraries/libapparmor/swig/SWIG/libapparmor.i b/libraries/libapparmor/swig/SWIG/libapparmor.i index d56f5000d..b66b7ea5d 100644 --- a/libraries/libapparmor/swig/SWIG/libapparmor.i +++ b/libraries/libapparmor/swig/SWIG/libapparmor.i @@ -123,15 +123,34 @@ extern char *aa_splitcon(char *con, char **mode); /* apparmor.h */ extern int aa_is_enabled(void); -/* aa_find_mountpoint mnt is an output pointer to a heap-allocated string */ -%cstring_output_allocate(char **mnt, free(*$1)); -extern int aa_find_mountpoint(char **mnt); + +/* These should not receive the VOID_Object typemap */ extern int aa_change_hat(const char *subprofile, unsigned long magic_token); extern int aa_change_profile(const char *profile); extern int aa_change_onexec(const char *profile); extern int aa_change_hatv(const char *subprofiles[], unsigned long token); extern int aa_stack_profile(const char *profile); extern int aa_stack_onexec(const char *profile); + +/* aa_find_mountpoint mnt is an output pointer to a heap-allocated string */ +%cstring_output_allocate(char **mnt, free(*$1)); +/* The other errno-based functions should not always be returning the int value: + * - Python exceptions signal success/failure status instead via the %exception + * handler above. + * - Perl (the other binding) has $! for accessing errno but would check the int + * return status first. + * + * The generated C code for (out) resets the return value to None + * before appending the returned data (argout generated by %cstring stuff) + */ +#ifdef SWIGPYTHON +%typemap(out,noblock=1) int { +#if defined(VOID_Object) + $result = VOID_Object; +#endif +} +#endif +extern int aa_find_mountpoint(char **mnt); extern int aa_getprocattr(pid_t tid, const char *attr, char **label, char **mode); extern int aa_gettaskcon(pid_t target, char **label, char **mode); extern int aa_getcon(char **label, char **mode);