Using linelog with "-" in filename results in "--".

Arran Cudbard-Bell a.cudbardb at freeradius.org
Fri Apr 17 12:38:29 CEST 2015


> On 17 Apr 2015, at 08:00, Chaigneau, Nicolas <nicolas.chaigneau at capgemini.com> wrote:
> 
>>> 
>>> 
>>> I'm using 3.0.x with linelog module, with a filename set up as follows:
>>> 
>>> filename=${logdir}/RadiusTrace-%{Client-Shortname}-%Y%m%d%H.log
>>> 
>>> 
>>> In clients.conf I have some clients which contain "-" characters.
>>> When the linelog creates the output file, the "-" are doubled (resulting in "--" in the file name).
>>> 
>>> (This is done in function rad_filename_escape from main\util.c)
>>> 
>>> 
>>> 
>>> Is there a way to prevent this ?
>> 
>> The escape function produces POSIX fully portable filenames, whilst allowing recovery of the input text.
>> 
>> It should be possible to modify the escape functions so that hyphen doesn't have another hyphen to escape it, unless the  hyphen in the src string was before a disallowed character.
>> 
>> Thinking about it, that's probably a good idea.
>> 
> 
> 
> Can this be considered a bug so it can be done in 3.0.x ? :)
> 
> 
> Alternatively, rlm_detail provides a parameter (escape_filenames) that allows to disable the escaping.
> 
> Maybe this could be a good idea to do this also for rlm_linelog.

Yeah, that's a better idea. The escape function needs to prevent collisions from occurring, so hyphens need to be escaped.

I've added the same config_item as rlm_detail, which defaults to off. The behaviour should be almost the same as 3.0.7, except now it'll prevent upwards directory traversal and do something sensible with control chars.

-Arran

Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS development team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 872 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20150417/8c255318/attachment.sig>


More information about the Freeradius-Users mailing list