The LIBMTP_Open_Raw_Device_Uncached function may return NULL if
an error occurs when attempting to open the device. We need to
check for that possibility.
Incenp-bug-id: 6
(This patch will prevent the crash observed in that bug, but it
does not fix the fact that LIBMTP sometimes fails to open the
device.)
The rc variable in the get_file function in the libmtp-based
module was not initialized, leading to a random return code when
no MTP device is present. This could lead to a crash if the
returned value happened to be zero, which is interpreted as a
success by the calling code (which then assumes that the share
has been successfully retrieved).
The put_file of the libmtp-based scheme module now supports
sending a file to any (pre-existing) directory on the device,
instead of only the root directory.
Do not have the module represent themselves with the
gfsec_scheme_module_t structure. Now a module must just take care
of providing the appropriate functions (currently only "get_file")
to perform the task.
The initialization function in scheme-module will assemble the
structures and call any initialization function required.
This patch introduces the notion of a "scheme module". Such a
module provides a "get_file" function to retrieve the contents of
a file located at a specified URI.
Currently available modules:
- the "file" module, supporting the "file://" URI scheme;
- the "libmtp" module, using the LibMTP library to support the
"mtp://' scheme;
- the "gio" module, using the GLib-GIO library to support the
"uuid://" and "label://" schemes.