1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Some minor changes and typo fixes.

Started to implement a TCP option in gpg-connect-agent.
This commit is contained in:
Werner Koch 2010-02-26 10:52:05 +00:00
parent 01a571a16b
commit 0e018d7144
8 changed files with 120 additions and 20 deletions

View File

@ -1,3 +1,9 @@
2010-02-26 Werner Koch <wk@g10code.com>
* configure.ac (HAVE_W32CE_SYSTEM): New ac_define and
am_conditional.
* autogen.sh: New option --build-w32ce.
2009-12-08 Werner Koch <wk@g10code.com>
* configure.ac (USE_DNS_CERT): Support ADNS.

View File

@ -394,20 +394,25 @@ start_pinentry (ctrl_t ctrl)
may help a pinentry to avoid implementing localization code. */
static struct { const char *key, *value; } tbl[] = {
/* TRANSLATORS: These are labels for buttons etc used in
Pinentries. A underscore indicates that the next letter
should be used as an accelerator. The actual to be
translated text starts after the second vertical bar. */
Pinentries. An underscore indicates that the next letter
should be used as an accelerator. Double the underscore for
a literal one. The actual to be translated text starts after
the second vertical bar. */
{ "ok", N_("|pinentry-label|_OK") },
{ "cancel", N_("|pinentry-label|_Cancel") },
{ "prompt", N_("|pinentry-label|PIN:") },
{ NULL, NULL}
};
char *optstr;
int idx;
const char *s, *s2;
for (idx=0; tbl[idx].key; idx++)
{
if (asprintf (&optstr, "OPTION default-ok=%s",
tbl[idx].key, _(tbl[idx].value)) < 0 )
s = _(tbl[idx].value);
if (*s == '|' && (s2=strchr (s+1,'|')))
s = s2+1;
if (asprintf (&optstr, "OPTION default-%s=%s", tbl[idx].key, s) < 0 )
return unlock_pinentry (out_of_core ());
assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
NULL);

View File

@ -45,9 +45,28 @@ if test x"$1" = x"--force"; then
shift
fi
# Convenience option to use certain configure options for some hosts.
myhost=""
myhostsub=""
case "$1" in
--build-w32)
myhost="w32"
;;
--build-w32ce)
myhost="w32"
myhostsub="ce"
;;
--build-amd64)
myhost="amd64"
;;
*)
;;
esac
# ***** W32 build script *******
# Used to cross-compile for Windows.
if test "$1" = "--build-w32"; then
if [ "$myhost" = "w32" ]; then
tmp=`dirname $0`
tsdir=`cd "$tmp"; pwd`
shift
@ -57,12 +76,21 @@ if test "$1" = "--build-w32"; then
fi
build=`$tsdir/scripts/config.guess`
case $myhostsub in
ce)
[ -z "$w32root" ] && w32root="$HOME/w32ce_root"
toolprefixes="arm-mingw32ce"
;;
*)
[ -z "$w32root" ] && w32root="$HOME/w32root"
toolprefixes="i586-mingw32msvc i386-mingw32msvc mingw32"
;;
esac
echo "Using $w32root as standard install directory" >&2
# Locate the cross compiler
crossbindir=
for host in i586-mingw32msvc i386-mingw32msvc mingw32; do
for host in $toolprefixes; do
if ${host}-gcc --version >/dev/null 2>&1 ; then
crossbindir=/usr/${host}/bin
conf_CC="CC=${host}-gcc"
@ -71,8 +99,10 @@ if test "$1" = "--build-w32"; then
done
if [ -z "$crossbindir" ]; then
echo "Cross compiler kit not installed" >&2
if [ -z "$sub" ]; then
echo "Under Debian GNU/Linux, you may install it using" >&2
echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
fi
echo "Stop." >&2
exit 1
fi
@ -102,7 +132,7 @@ fi
# ***** AMD64 cross build script *******
# Used to cross-compile for AMD64 (for testing)
if test "$1" = "--build-amd64"; then
if [ "$myhost" = "amd64" ]; then
tmp=`dirname $0`
tsdir=`cd "$tmp"; pwd`
shift

View File

@ -234,7 +234,7 @@ _parse_ber_header (unsigned char const **buffer, size_t *size,
/* FIXME: The following function should not go into this file but for
now it is easier to keep it here. */
/* Return the next token of an canconical encoded S-expression. BUF
/* Return the next token of an canonical encoded S-expression. BUF
is the pointer to the S-expression and BUFLEN is a pointer to the
length of this S-expression (used to validate the syntax). Both
are updated to reflect the new position. The token itself is

View File

@ -483,6 +483,7 @@ AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
try_gettext=yes
have_dosish_system=no
have_w32_system=no
have_w32ce_system=no
use_simple_gettext=no
case "${host}" in
*-mingw32*)
@ -499,6 +500,7 @@ case "${host}" in
disable_keyserver_path=yes
have_dosish_system=yes
have_w32_system=yes
case "${host}" in *-mingw32ce*) have_w32ce_system=yes ;; esac
try_gettext="no"
use_simple_gettext=yes
;;
@ -563,8 +565,12 @@ AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
if test "$have_w32_system" = yes; then
AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
if test "$have_w32ce_system" = yes; then
AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
fi
fi
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
if test "$disable_keyserver_path" = yes; then
AC_DEFINE(DISABLE_KEYSERVER_PATH,1,

View File

@ -421,13 +421,16 @@ hash_for (PKT_public_key *pk)
return match_dsa_hash(qbytes);
}
else if (/*FIXME: call agent
pk->is_protected && sk->protect.s2k.mode==1002*/ 0)
else if (0
/* FIXME: call agent sk->is_protected && sk->protect.s2k.mode == 1002
&& sk->protect.ivlen == 16
&& !memcmp (sk->protect.iv, "\xD2\x76\x00\x01\x24\x01\x01", 7)*/)
{
/* The secret key lives on a smartcard, and current smartcards only
handle SHA-1 and RIPEMD/160. This is correct now, but may
need revision as the cards add algorithms. */
/* The sk lives on a smartcard, and old smartcards only handle
SHA-1 and RIPEMD/160. Newer smartcards (v2.0) don't have
this restriction anymore. Fortunately the serial number
encodes the version of the card and thus we know that this
key is on a v1 card. */
if(opt.personal_digest_prefs)
{
prefitem_t *prefs;

View File

@ -1,3 +1,7 @@
2010-02-26 Werner Koch <wk@g10code.com>
* gpg-connect-agent.c (main): New option --tcp-socket.
2010-01-10 Werner Koch <wk@g10code.com>
* symcryptrun.c (utmp.h): Remove header; it is not used.

View File

@ -49,6 +49,7 @@ enum cmd_and_opt_values
oQuiet = 'q',
oVerbose = 'v',
oRawSocket = 'S',
oTcpSocket = 'T',
oExec = 'E',
oRun = 'r',
oSubst = 's',
@ -72,6 +73,8 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_n (oDecode,"decode", N_("decode received data lines")),
ARGPARSE_s_s (oRawSocket, "raw-socket",
N_("|NAME|connect to Assuan socket NAME")),
ARGPARSE_s_s (oTcpSocket, "tcp-socket",
N_("|ADDR|connect to Assuan server at ADDR")),
ARGPARSE_s_n (oExec, "exec",
N_("run the Assuan server given on the command line")),
ARGPARSE_s_n (oNoExtConnect, "no-ext-connect",
@ -96,6 +99,7 @@ struct
int hex; /* Print data lines in hex format. */
int decode; /* Decode received data lines. */
const char *raw_socket; /* Name of socket to connect in raw mode. */
const char *tcp_socket; /* Name of server to connect in tcp mode. */
int exec; /* Run the pgm given on the command line. */
unsigned int connect_flags; /* Flags used for connecting. */
int enable_varsubst; /* Set if variable substitution is enabled. */
@ -1177,6 +1181,7 @@ main (int argc, char **argv)
case oHex: opt.hex = 1; break;
case oDecode: opt.decode = 1; break;
case oRawSocket: opt.raw_socket = pargs.r.ret_str; break;
case oTcpSocket: opt.tcp_socket = pargs.r.ret_str; break;
case oExec: opt.exec = 1; break;
case oNoExtConnect: opt.connect_flags &= ~(1); break;
case oRun: opt_run = pargs.r.ret_str; break;
@ -1207,8 +1212,23 @@ main (int argc, char **argv)
cmdline_commands = argv;
if (opt.exec && opt.raw_socket)
{
opt.raw_socket = NULL;
log_info (_("option \"%s\" ignored due to \"%s\"\n"),
"--raw-socket", "--exec");
}
if (opt.exec && opt.tcp_socket)
{
opt.tcp_socket = NULL;
log_info (_("option \"%s\" ignored due to \"%s\"\n"),
"--tcp-socket", "--exec");
}
if (opt.tcp_socket && opt.raw_socket)
{
opt.tcp_socket = NULL;
log_info (_("option \"%s\" ignored due to \"%s\"\n"),
"--tcp-socket", "--raw-socket");
}
if (opt_run && !(script_fp = fopen (opt_run, "r")))
{
@ -1269,6 +1289,32 @@ main (int argc, char **argv)
if (opt.verbose)
log_info ("connection to socket `%s' established\n", opt.raw_socket);
}
else if (opt.tcp_socket)
{
char *url;
url = xstrconcat ("assuan://", opt.tcp_socket, NULL);
rc = assuan_new (&ctx);
if (rc)
{
log_error ("assuan_new failed: %s\n", gpg_strerror (rc));
exit (1);
}
rc = assuan_socket_connect (ctx, opt.tcp_socket, 0, 0);
if (rc)
{
log_error ("can't connect to server `%s': %s\n",
opt.tcp_socket, gpg_strerror (rc));
exit (1);
}
if (opt.verbose)
log_info ("connection to socket `%s' established\n", url);
xfree (url);
}
else
ctx = start_agent ();