FreeRADIUS InkBridge

File Handling Functions

The file handling functions perform operations on files.

The filenames can be taken from untrusted sources, in which cases special characters such as ‘/’ and ‘$’ are escaped. Any special character is replaced with an underscore, followed by the hex value of the character. Valid UTF-8 characters are allowed.

For example, the "unsafe" string user@freeradius.org/.. will turn into the filename user@freeradius.org_2f... This operation renders the filename "safe" for operations on the local file system. It is not possible for unsafe data to create unexpected files, or to perform directory traversal attacks.

Table 1. File Handling Functions

Function

Description

escape

Returns an escaped or safe version of the input string.

exists

Checks to see if a file exists on the filesystem.

head

Returns the first line of the file.

rm

Removes a file from the filesystem.

size

Returns the size of a file.

tail

Return the last line of a file or the last number(n) of lines of a file.