core: Support dirinfo("socketdir")
* src/dirinfo.c (WANT_SOCKETDIR): New. (dirinfo): Add field socketdir. (parse_output): Support "socketdir". (get_gpgconf_item): Return socketdir. * tests/t-engine-info.c (main): Add socketdir to the output. * src/w32-util.c (_gpgme_create_process_utf8): Fix indentation. -- GnuPG-bug-id: 5613 This is not strictly necessary because we could deduce this from one of the other socket info items but it is more clean to have a dedicated info item. The socketdir item is available for 5 years now (GnuPG commit 8e3fa5a4b205c534de2142e5d071712f957cf06a)
This commit is contained in:
parent
8148237cb4
commit
eb37d6469e
@ -91,7 +91,7 @@ GPGMEPP_EXPORT EngineInfo engineInfo(Engine engine);
|
||||
homedir, sysconfdir, bindir, libexecdir, libdir,
|
||||
datadir, localedir, agent-socket, agent-ssh-socket,
|
||||
dirmngr-socket, uiserver-socket, gpgconf-name, gpg-name,
|
||||
gpgsm-name, g13-name
|
||||
gpgsm-name, g13-name, socketdir.
|
||||
|
||||
This may be extended in the future.
|
||||
*/
|
||||
|
@ -44,6 +44,7 @@ enum
|
||||
WANT_LIBDIR,
|
||||
WANT_DATADIR,
|
||||
WANT_LOCALEDIR,
|
||||
WANT_SOCKETDIR,
|
||||
WANT_AGENT_SOCKET,
|
||||
WANT_AGENT_SSH_SOCKET,
|
||||
WANT_DIRMNGR_SOCKET,
|
||||
@ -67,6 +68,7 @@ static struct {
|
||||
char *libdir;
|
||||
char *datadir;
|
||||
char *localedir;
|
||||
char *socketdir;
|
||||
char *agent_socket;
|
||||
char *agent_ssh_socket;
|
||||
char *dirmngr_socket;
|
||||
@ -152,6 +154,8 @@ parse_output (char *line, int components)
|
||||
dirinfo.datadir = strdup (value);
|
||||
else if (!strcmp (line, "localedir") && !dirinfo.localedir)
|
||||
dirinfo.localedir = strdup (value);
|
||||
else if (!strcmp (line, "socketdir") && !dirinfo.socketdir)
|
||||
dirinfo.socketdir = strdup (value);
|
||||
else if (!strcmp (line, "agent-socket") && !dirinfo.agent_socket)
|
||||
{
|
||||
const char name[] = "S.uiserver";
|
||||
@ -310,6 +314,10 @@ get_gpgconf_item (int what)
|
||||
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
||||
"gpgme-dinfo: homedir='%s'\n",
|
||||
dirinfo.homedir);
|
||||
if (dirinfo.socketdir)
|
||||
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
||||
"gpgme-dinfo: sockdir='%s'\n",
|
||||
dirinfo.socketdir);
|
||||
if (dirinfo.agent_socket)
|
||||
_gpgme_debug (NULL,DEBUG_INIT, -1, NULL, NULL, NULL,
|
||||
"gpgme-dinfo: agent='%s'\n",
|
||||
@ -336,6 +344,7 @@ get_gpgconf_item (int what)
|
||||
case WANT_LIBDIR: result = dirinfo.libdir; break;
|
||||
case WANT_DATADIR: result = dirinfo.datadir; break;
|
||||
case WANT_LOCALEDIR: result = dirinfo.localedir; break;
|
||||
case WANT_SOCKETDIR: result = dirinfo.socketdir; break;
|
||||
case WANT_AGENT_SOCKET: result = dirinfo.agent_socket; break;
|
||||
case WANT_AGENT_SSH_SOCKET: result = dirinfo.agent_ssh_socket; break;
|
||||
case WANT_DIRMNGR_SOCKET: result = dirinfo.dirmngr_socket; break;
|
||||
@ -476,6 +485,8 @@ gpgme_get_dirinfo (const char *what)
|
||||
return get_gpgconf_item (WANT_DATADIR);
|
||||
else if (!strcmp (what, "localedir"))
|
||||
return get_gpgconf_item (WANT_LOCALEDIR);
|
||||
else if (!strcmp (what, "socketdir"))
|
||||
return get_gpgconf_item (WANT_SOCKETDIR);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
@ -841,16 +841,17 @@ _gpgme_access (const char *path, int mode)
|
||||
|
||||
|
||||
/* Like CreateProcessA but mapping the arguments to wchar API */
|
||||
int _gpgme_create_process_utf8 (const char *application_name_utf8,
|
||||
char *command_line_utf8,
|
||||
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||
BOOL bInheritHandles,
|
||||
DWORD dwCreationFlags,
|
||||
void *lpEnvironment,
|
||||
char *working_directory_utf8,
|
||||
LPSTARTUPINFOA si,
|
||||
LPPROCESS_INFORMATION lpProcessInformation)
|
||||
int
|
||||
_gpgme_create_process_utf8 (const char *application_name_utf8,
|
||||
char *command_line_utf8,
|
||||
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||
BOOL bInheritHandles,
|
||||
DWORD dwCreationFlags,
|
||||
void *lpEnvironment,
|
||||
char *working_directory_utf8,
|
||||
LPSTARTUPINFOA si,
|
||||
LPPROCESS_INFORMATION lpProcessInformation)
|
||||
{
|
||||
BOOL ret;
|
||||
wchar_t *application_name = utf8_to_wchar0 (application_name_utf8);
|
||||
|
@ -118,6 +118,7 @@ main (int argc, char **argv )
|
||||
"libdir",
|
||||
"datadir",
|
||||
"localedir",
|
||||
"socketdir",
|
||||
"agent-socket",
|
||||
"agent-ssh-socket",
|
||||
"dirmngr-socket",
|
||||
|
Loading…
Reference in New Issue
Block a user