[apparmor] RFC [Patch 0/1] Update log parsing interface
John Johansen
john.johansen at canonical.com
Wed Jul 13 06:59:24 UTC 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/12/2011 08:52 PM, Steve Beattie wrote:
> On Tue, Jul 12, 2011 at 03:49:29PM -0700, John Johansen wrote:
>> While I am tinkering with the library, I got to wondering why we ever/still
>> export the log parsing library interface without the aa_ prefix.
>
> Heh, I was just wondering the same thing as I was poking at the python
> library getting all excited about the idea of being to query the library
> to determine confinement status rather than manually doing it.
>
>> This patch takes care of the library end of things, and should allow older
>> versions of programs calling the library to function. This patch doesn't
>> currently cover the update of the tools calling the library to use the
>> new interface, nor does it deal with swig clients breaking if a new
>> swig interface is used.
>
> I'm not convinced it's actually backwards compatible in the way
> you think it is. IIRC, if you want to offer an old (versioned)
> symbol available, you (in the past anyway) needed to do the same
> sort of aliasing that's done for the old change_hat (IMMUNIX_1.0 and
> APPARMOR_1.0) symbols. 'readelf' output on the generated .so would
> tell you for sure.
>
yes we need to provide the 1.1 parse_record and free_record, I seem to
have dropped that part. Instead of aliases I set them up as a fn calling
into the aa_ version but we could just as easily setup and alias
revised patch below
- ---
Export the log parsing interface with the aa_ prefix
export the log parsing interface so that it uses the aa_ prefix, while
retaining the old interface for backwards compatability.
Signed-off-by: John Johansen <john.johansen at canonical.com>
diff --git a/libraries/libapparmor/src/aalogparse.h b/libraries/libapparmor/src/aalogparse.h
index c439bfb..3e913e4 100644
- --- a/libraries/libapparmor/src/aalogparse.h
+++ b/libraries/libapparmor/src/aalogparse.h
@@ -151,14 +151,14 @@ typedef struct
* @return Parsed data.
*/
aa_log_record *
- -parse_record(char *str);
+aa_parse_record(char *str);
/**
* Frees all struct data.
* @param[in] Data to free.
*/
void
- -free_record(aa_log_record *record);
+aa_free_record(aa_log_record *record);
#endif
diff --git a/libraries/libapparmor/src/libaalogparse.c b/libraries/libapparmor/src/libaalogparse.c
index 5292830..b4cac72 100644
- --- a/libraries/libapparmor/src/libaalogparse.c
+++ b/libraries/libapparmor/src/libaalogparse.c
@@ -35,7 +35,7 @@
#include "parser.h"
/* This is mostly just a wrapper around the code in grammar.y */
- -aa_log_record *parse_record(char *str)
+aa_log_record *aa_parse_record(char *str)
{
if (str == NULL)
return NULL;
@@ -43,7 +43,13 @@ aa_log_record *parse_record(char *str)
return _parse_yacc(str);
}
- -void free_record(aa_log_record *record)
+/* old version of aa_parse_record */
+aa_log_record *parse_record(char *str)
+{
+ return aa_parse_record(str);
+}
+
+void aa_free_record(aa_log_record *record)
{
if (record != NULL)
{
@@ -83,6 +89,11 @@ void free_record(aa_log_record *record)
return;
}
+void free_record(aa_log_record *record)
+{
+ aa_free_record(record);
+}
+
/* Set all of the fields to appropriate values */
void _init_log_record(aa_log_record *record)
{
diff --git a/libraries/libapparmor/src/libapparmor.map b/libraries/libapparmor/src/libapparmor.map
index ebd13c9..362eaf3 100644
- --- a/libraries/libapparmor/src/libapparmor.map
+++ b/libraries/libapparmor/src/libapparmor.map
@@ -25,6 +25,8 @@ APPARMOR_1.1 {
aa_introspect_confinement;
parse_record;
free_record;
+ aa_parse_record;
+ aa_free_record;
local:
*;
} APPARMOR_1.0;
diff --git a/libraries/libapparmor/testsuite/test_multi.c b/libraries/libapparmor/testsuite/test_multi.c
index 93e2d63..e1c3ec8 100644
- --- a/libraries/libapparmor/testsuite/test_multi.c
+++ b/libraries/libapparmor/testsuite/test_multi.c
@@ -39,7 +39,7 @@ int main(int argc, char **argv)
fclose(testcase);
- - test = parse_record(log_line);
+ test = aa_parse_record(log_line);
if (test == NULL)
{
@@ -47,7 +47,7 @@ int main(int argc, char **argv)
return(1);
}
ret = print_results(test);
- - free_record(test);
+ aa_free_record(test);
return ret;
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk4dQkYACgkQxAVxIsEKI+bA2ACgnGi98KacbD1Vh3V/FpKS9MQP
jX0AoIoXWag4/u3PniwjZxhzLDC0sscN
=5wRb
-----END PGP SIGNATURE-----
More information about the AppArmor
mailing list