From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Dennis Subject: Re: difficulty with TYPE Date: Tue, 15 Jan 2008 08:58:20 -0500 Message-ID: <478CBBFC.8090303@redhat.com> References: <18436f8f0801142314g46f77485x311cfb2826f2dff4@mail.gmail.com> <1200404039.30787.4.camel@code.and.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1200404039.30787.4.camel@code.and.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: James Antill Cc: linux-audit@redhat.com, Abhishek Gupta List-Id: linux-audit@redhat.com James Antill wrote: > The second iovec above can't just be MAX_AUDIT_MESSAGE_LENGTH, or if > there are two messages you'll read some/all of the next one(s). You > either need to read the header first and then use hdr.size, or separate > the IO from the parsing. > Also you can't just check for readv() as above, you need to check that > you've read the amount of data you want, and if you didn't get it all > yet then loop. This is why we provide libraries to do things like this, it can be tricky to get right. The feed() interface to auparse consumes arbitrary amounts of data (perfect for use in select/recv calls) and then calls back with audit events as they are recognized in the input stream you fed it. -- John Dennis