Re: [PATCH 2/2] Use a new funtion to instead of outing error message for field checking

Steve Grubb
2008-08-07T17:45:15Z

On Thursday 07 August 2008 11:27:25 Miloslav Trmač wrote:
> > The method of outing error message for field checking is too big. It is
> > disadvantage to modify. Create a helper function to output error
> > messages.
> > It should be more pretty and smart.
>
> The whole part of libaudit that deals with audit rules seems to be only
> usable by auditctl - after all, all the error codes added by recent
> patches are not handled by any other application that might be using the
> function.  Are there any external applications that use
> audit_rule_fieldpair_data(), for example?

Not that I know of...but that doesn't mean that someone somewhere isn't
selling an app that does.

> Even if this patch is accepted (and it does improve the code),

I can't take a patch like this right now. It changes the API. I would however
take a patch that just moves things in auditctl.c. Big API changes need to
wait for 1 or 2 more releases and then we can restructure things.

> I think long-term it would be good not to enshrine the current error
> reporting system - at minimum it should be very clearly documented
> audit_number_to_errmsg() is not a long-term API and applications other
> than auditctl should not use it.  Or perhaps only move the code out of
> src/auditctl.c into src/errormsg.* and do not add it to libaudit at all.

I think that errors originating in libaudit should probably have text string
in it that explains the errors. But we have to wait to change the API another
release or two. We also have to make sure that we don't introduce text
relocations as we add strings in libraries.

Thanks,
-Steve