1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Replace all calls to access by gnupg_access

* common/sysutils.c (gnupg_access): New.  Replace all calls to access
by this wrapper.
* common/homedir.c (w32_shgetfolderpath): Change to return UTF-8
directory name.
(standard_homedir): Adjust for change.
(w32_commondir, gnupg_cachedir): Ditto.
--

Also use SHGetFolderPathW instead of SHGetFolderPathA on Windows.

This is required to correctly handle non-ascii filenames on Windows.

GnuPG-bug-id: 5098
This commit is contained in:
Werner Koch 2020-10-20 10:43:55 +02:00
parent 228836f79f
commit c94ee1386e
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
28 changed files with 151 additions and 128 deletions

View file

@ -1182,7 +1182,7 @@ process_new_key (server_ctx_t ctx, estream_t key)
goto leave;
}
if (access (dname, W_OK))
if (gnupg_access (dname, W_OK))
{
log_info ("skipping address '%s': Domain not configured\n", sl->mbox);
continue;
@ -1459,7 +1459,7 @@ check_and_publish (server_ctx_t ctx, const char *address, const char *nonce)
err = gpg_error_from_syserror ();
goto leave;
}
if (!access (fnewname, W_OK))
if (!gnupg_access (fnewname, W_OK))
{
/* Yes, we have a dane directory. */
s = strchr (address, '@');
@ -1795,7 +1795,7 @@ command_list_domains (void)
{ "pending", "-rwx" },
{ "hu", "-rwxr-xr-x" }
};
gpg_err_code_t ec;
gpg_error_t err;
strlist_t domaindirs;
strlist_t sl;
@ -1832,9 +1832,9 @@ command_list_domains (void)
err = gpg_error_from_syserror ();
goto leave;
}
if (access (fname, W_OK))
if ((ec = gnupg_access (fname, W_OK)))
{
err = gpg_error_from_syserror ();
err = gpg_error (ec);
if (gpg_err_code (err) == GPG_ERR_ENOENT)
{
if (gnupg_mkdir (fname, requireddirs[i].perm))
@ -1862,9 +1862,9 @@ command_list_domains (void)
err = gpg_error_from_syserror ();
goto leave;
}
if (access (fname, F_OK))
if ((ec = gnupg_access (fname, F_OK)))
{
err = gpg_error_from_syserror ();
err = gpg_error (ec);
if (gpg_err_code (err) == GPG_ERR_ENOENT)
log_error ("domain %s: submission address not configured\n",
domain);
@ -1941,6 +1941,7 @@ command_cron (void)
static gpg_error_t
command_check_key (const char *userid)
{
gpg_err_code_t ec;
gpg_error_t err;
char *addrspec = NULL;
char *fname = NULL;
@ -1949,9 +1950,9 @@ command_check_key (const char *userid)
if (err)
goto leave;
if (access (fname, R_OK))
if ((ec = gnupg_access (fname, R_OK)))
{
err = gpg_error_from_syserror ();
err = gpg_error (ec);
if (opt_with_file)
es_printf ("%s n %s\n", addrspec, fname);
if (gpg_err_code (err) == GPG_ERR_ENOENT)