Detail file reader header detection sucks

Arran Cudbard-Bell a.cudbard-bell at sussex.ac.uk
Sat Aug 8 09:15:53 CEST 2009


Hi,

src/modules/frs_detail/frs_detail.c

    650                 /*
    651                  *      Look for date/time header, and read VP's if
    652                  *      found.  If not, keep reading lines until we
    653                  *      find one.
    654                  */
    655                 if (data->state == STATE_HEADER) {
    656                         int y;
    657
    658                         if (sscanf(buffer, "%*s %*s %*d
%*d:%*d:%*d %d", &y)) {
    659                                 data->state = STATE_READING;
    660                         }
    661                         continue;
    662                 }

This'd be fine, except the format of the detail file header is user
definable! Wouldn't it be safer to just assume that the first line that
doesn't start with a \t is the header?

if (data->state == STATE_HEADER &&
    (buffer[0] != '\t')) {
    continue;
}

It's not like the detail file listener actually does anything with the
data from the record header.

Best regards,
Arran



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freeradius.org/pipermail/freeradius-devel/attachments/20090808/11f5ccae/attachment.pgp>


More information about the Freeradius-Devel mailing list