Author: stsp
Date: Mon Jul 25 14:33:32 2011
New Revision: 1150723
URL: http://svn.apache.org/viewvc?rev=1150723&view=rev
Log:
On the gpg-agent-password-store branch, send the values of the LC_CTYPE
and DISPLAY variables to gpg-agent. These might be useful for the pinentry
program.
* subversion/libsvn_auth_gpg_agent/gpg_agent.c
(password_get_gpg_agent): If LC_CTYPE and/or DISPLAY environment variables
are set, use their values as arguments for the --lc-ctype and --display
options of gpg-agent.
Modified:
subversion/branches/gpg-agent-password-store/subversion/libsvn_auth_gpg_agent/gpg_agent.c
Modified:
subversion/branches/gpg-agent-password-store/subversion/libsvn_auth_gpg_agent/gpg_agent.c
URL:
http://svn.apache.org/viewvc/subversion/branches/gpg-agent-password-store/subversion/libsvn_auth_gpg_agent/gpg_agent.c?rev=1150723&r1=1150722&r2=1150723&view=diff
==============================================================================
---
subversion/branches/gpg-agent-password-store/subversion/libsvn_auth_gpg_agent/gpg_agent.c
(original)
+++
subversion/branches/gpg-agent-password-store/subversion/libsvn_auth_gpg_agent/gpg_agent.c
Mon Jul 25 14:33:32 2011
@@ -101,6 +101,8 @@ password_get_gpg_agent(const char **pass
struct sockaddr_un addr;
const char *tty_name;
const char *tty_type;
+ const char *lc_ctype;
+ const char *display;
const char *socket_name = NULL;
svn_checksum_t *digest = NULL;
@@ -195,6 +197,46 @@ password_get_gpg_agent(const char **pass
return FALSE;
}
+ /* Send LC_CTYPE to the gpg-agent daemon. */
+ lc_ctype = getenv("LC_CTYPE");
+ if (lc_ctype == NULL)
+ lc_ctype = getenv("LC_ALL");
+ if (lc_ctype == NULL)
+ lc_ctype = getenv("LANG");
+ if (lc_ctype != NULL)
+ {
+ request = apr_psprintf(pool, "OPTION lc-ctype=%s\n", lc_ctype);
+ send(sd, request, strlen(request), 0);
+ if (!receive_from_gpg_agent(sd, buffer, BUFFER_SIZE - 1))
+ {
+ close(sd);
+ return FALSE;
+ }
+ if (strncmp(buffer, "OK", 2) != 0)
+ {
+ close(sd);
+ return FALSE;
+ }
+ }
+
+ /* Send DISPLAY to the gpg-agent daemon. */
+ display = getenv("DISPLAY");
+ if (display != NULL)
+ {
+ request = apr_psprintf(pool, "OPTION display=%s\n", display);
+ send(sd, request, strlen(request), 0);
+ if (!receive_from_gpg_agent(sd, buffer, BUFFER_SIZE - 1))
+ {
+ close(sd);
+ return FALSE;
+ }
+ if (strncmp(buffer, "OK", 2) != 0)
+ {
+ close(sd);
+ return FALSE;
+ }
+ }
+
/* Create the CACHE_ID which will be generated based on REALMSTRING similar
to other password caching mechanisms. */
digest = svn_checksum_create(svn_checksum_md5, pool);