char * myqtt_support_find_data_file ( MyQttCtx ctx,
const char *  name 
)

Allows to lookup for a file into the known myqtt data file locations.

While locating data files inside MyQtt Library context a set of function are used to allows MyQtt Library API consumers to produce easily application level code that is platform/directory-structure independent as possible.

MyQtt Library allows to configure known file locations using myqtt_support_add_search_path and myqtt_support_add_search_path_ref.

Once configured search paths, application level calls to this function to locate files using basenames such as myCertificate.cert, configuration.xml, etc. This avoid full paths file names that are a problem while moving around the source code not only across different platforms but also on the same.

See myqtt_support_add_search_path for more information about known data files location.

This function could have a problem while looking for sensitive files. If a path is not properly configured, an attacker is able to place a manipulated copy for the file inside a valid path, but not the one expected. In such case you must perform domain constrained searches using myqtt_support_domain_find_data_file and its associated function to install search path with a domain constraing them:

Parameters
ctxThe context where the operation will be performed.
namethe base file name to lookup.
Returns
NULL or the file path. Value returned should be unrefered using axl_free when no longer needed.

References myqtt_support_domain_find_data_file().