Skip to contentSkip to conversation

auparse question

DISCUSSION LC Bruzenak 3 participants 4 messages Aug 30, 2011 – Aug 31, 2011

lore
Share & tools
lore
#0 lore raw

I'm using auparse_get_field_type from the parse lib.
The return value for error is "0" which is also that of the AUDIT_PID field.

Right? I am getting some errors that thought they were PIDs.

Thx,
LCB

Signature · 2 lines
LC (Lenny) Bruzenak
[email protected]
#1 lore raw

----- Original Message -----

Quoted 5 lines

I'm using auparse_get_field_type from the parse lib.
The return value for error is "0" which is also that of the AUDIT_PID field.

Right? I am getting some errors that thought they were PIDs.

The return value of auparse_get_field_type() is a value from auparse_type_t defined in auparse-defs.h. 0 is AUPARSE_TYPE_UNCLASSIFIED (i.e. "there is no current field, or we don't know what kind of data is in the field"). AUPARSE_TYPE_* and the AUDIT_* field enums both deal with fields, but are distinct. It is somewhat confusing I'm afraid.
Mirek

#3 lore raw
In reply to LC Bruzenak
Quoted 5 lines · LC Bruzenak

I'm using auparse_get_field_type from the parse lib.
The return value for error is "0" which is also that of the AUDIT_PID field.

Right? I am getting some errors that thought they were PIDs.

That does seem to be a mistake in the API. As a workaround for this, you can check for an error with auparse_get_record_text() == NULL. I suppose I could fix the problem going forward by making auparse_get_type() return -1 on error.

-Steve

#2 lore raw
In reply to Miloslav Trmac
Quoted 9 lines · Miloslav Trmac

----- Original Message -----

Quoted 5 lines

I'm using auparse_get_field_type from the parse lib.
The return value for error is "0" which is also that of the AUDIT_PID field.

Right? I am getting some errors that thought they were PIDs.

The return value of auparse_get_field_type() is a value from auparse_type_t defined in auparse-defs.h.

Right. AUDIT_PID is an event record type which would be returned by auparse_get_type(). If you look in auparse.h, you can see the groupings of functions that access event level, record level, and field level components.

Quoted 2 lines

0 is AUPARSE_TYPE_UNCLASSIFIED (i.e. "there is
no current field, or we don't know what kind of data is in the field").

Yes, but the intent of AUPARSE_TYPE_UNCLASSIFIED is to say that the field contains data that needs no special cross reference or conversion to be human readable (or as you say we don't know about the field). This is different from returning something to say that you are not pointed at a valid field - i.e. you ran off the end. From what I can tell, you can only get the error if you are moving the internal pointer around without checking return codes. There really is an unintended API mistake in there. :)

Quoted 2 lines

AUPARSE_TYPE_* and the AUDIT_* field enums both deal with fields, but are distinct. It is somewhat confusing I'm afraid.

Maybe looking at the auparse.h file clarifies a few things since they are grouped?

-Steve