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.
| Function | Description |
|---|---|
Returns the contents of a file |
|
Returns an escaped or safe version of the input string |
|
Checks to see if a file exists on the filesystem |
|
Returns the first line of the file |
|
Create a directory on the filesystem |
|
Removes a file from the filesystem |
|
Removes a directory from the filesystem |
|
Returns the size of a file |
|
Return the last line of a file or the last number(n) of lines of a file |
|
Create a file if it does not already exist |