Recent GCC versions enable the -fno-common flag by default, causing
compilation to fail due to the global xdg variable being declared both
in the header file and in the implementation file. Fix by declaring the
variable in the header file as "extern", as it should have been.
closes#8
If a file-based URI contains an authority part that is not 'localhost',
error out when reading the configuration instead of letting the file
module detect and ignore the error later.
Beyond authentication failure, there are other conditions for which
Libcurl does not automatically return an error. E.g., if the server
replies with a 404 Not Found, from Libcurl's point of view that is still
a success (the request went through and a reply was received). So we
need to check that we received the response we expect.
When attempting to upload a share to a remote server (http or https
URI), check the response code to detect authentication failure
(curl_easy_perform does not do that by itself).
Add partial support for http(s) share URIs in gfsec-split. A created
shared can now be immediately sent to a web server that accepts PUT
requests. Credentials are to be provided in a .netrc file.
Free the buffer holding the URL in the get_file function of the libcurl
module. Also refactor that function to avoid checking the return value
of curl functions guaranteed to always return CURLOK.
The only way get_config_path can fail is if it cannot create the
configuration directory where the configuration is to be stored, so
let's make the error message reflect that.
Do not allocate an empty string if the authority part of the URI is
empty empty, store it as NULL instead. Only allow that if the scheme is
file://, otherwise error out.
Detect if the path portion is reduced to the initial '/', and error out
in that case.
If a URI parameter has an empty value, treat that as an immediate
general error (even if the parameter is not unrecognized and therefore
ignored) instead of dealing with it later.
When parsing URI parameters, the following case was not detected:
?param1¶m2=value
The absence of a value for param1 was missed because the code would look
for the '=' character in the next parameter (as if there was a single
parameter named 'param1¶m2').
Fix that by checking that the '=' delimiter comes before the next '&'
delimiter, if any.
Expand the use of the share parameter to accept a numeric value in
addition to the keywords 'no' and 'full'. That value is interpreted as
the share number, and takes precedence over the filename's extension.
Accept 'share=full' as a synonym for 'share=no', indicating that a given
"share" actually contains the whole secret. Reject any other value as
invalid.
If gfsec-split is to create a configuration file in the "standard"
configuration directory ($XDG_CONFIG_HOME/gfsecret), make sure
that directory exists.
Closes#6
Make gfsec-split fallback to $HOME/.config if the XDG_CONFIG_HOME
variable is not set, as gfsec-use already does and as requested by
the XDG Base Directory Specification.
Also apply the fallback if the variable is *defined* but *empty*.
References #6
According to both man(7) and man-pages(7), the .TH command expects
the section number before the date, and optionally the manual name
as the last argument.
Closes#4