On (15/01/16 16:09), Simo Sorce wrote:
>On Fri, 2016-01-15 at 12:44 +0100, Lukas Slebodnik wrote:
>> On (15/01/16 12:03), Pavel Březina wrote:
>> >On 01/12/2016 10:15 AM, Lukas Slebodnik wrote:
>> >>ehlo,
>> >>
>> >>The main reason for these patch was to improve
>> >>recently added logging to hbac.
>> >>
>> >>Side effect of these change is improvement for libldb
>> >>and libsemanage (6th patch)
>> >>
>> >>4th patch is not API/ABI change because
>> >>such version has not beeen released yet.
>> >>If you do not like change in hbac callback
>> >>hbac_debug_fn_t then we should also remove
>> >>because it is too internal then we should
>> >>remove also the first two arguments.
>> >>"file", "line" also leaks internal data from libhbac.
>> >>Removing the first two arguments would be almost
>> >>consistent callbacks in libldb and libsemanage.
>> >>
>> >>LS
>> >
>> >Hi,
>> >I'm getting following errors:
>> >
>> >In file included from 
>> >/home/pbrezina/workspace/sssd/src/python/pyhbac.c:26:0:
>> >/home/pbrezina/workspace/sssd/src/providers/ipa/ipa_hbac.h:54:0: error:
>> >"SSS_ATTRIBUTE_PRINTF" redefined [-Werror]
>> > #define SSS_ATTRIBUTE_PRINTF(a1, a2) __attribute__((format(printf, a1, 
>> > a2)))
>> > ^
>> >In file included from 
>> >/home/pbrezina/workspace/sssd/src/python/pyhbac.c:24:0:
>> >/home/pbrezina/workspace/sssd/src/util/util.h:62:0: note: this is the
>> >location of the previous definition
>> > #define SSS_ATTRIBUTE_PRINTF(a1, a2) __attribute__ ((format (printf, a1,
>> >a2)))
>> >
>> I might add another #ifdef guard but I decided to rename macro
>> SSS_ATTRIBUTE_PRINTF -> HBAC_ATTRIBUTE_PRINTF
>
>
>Why is debug_fn being called directly in hbac/semanage/etc.. insted of
>being called through a common macro ?
>
libldb, libsemanage ... provide function which allows you to register
your own debug function

e.g.
libldb has ldb_set_debug and we register ldb_debug_messages wih prototype
   void ldb_debug_messages(void *context, enum ldb_debug_level level,
                           const char *fmt, va_list ap)

However you cannot call DEBUG macro with agruments:"const char *fmt, va_list ap"
So you need to call "vasprintf(&message, fmt, ap)" and then log message
and then log message + release message; it is inefficient.

The same situation is with libhbac and libsemanage.

Does this answer your question?

LS
_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org

Reply via email to