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

Change stack size for Wince.

Allow for a longer agent atartup under wince.
Print gpg output via estream.
This commit is contained in:
Werner Koch 2010-11-23 18:46:41 +00:00
parent bbd08dd146
commit b3f9e2130e
18 changed files with 167 additions and 86 deletions

View File

@ -1,3 +1,8 @@
2010-11-23 Werner Koch <wk@g10code.com>
* am/cmacros.am (extra_bin_ldflags): New. For W32CE set the stack
size to 256k.
2010-11-17 Werner Koch <wk@g10code.com>
* configure.ac (ENABLE_CARD_SUPPORT): Define.

2
NEWS
View File

@ -4,7 +4,7 @@ Noteworthy changes in version 2.1.0beta2 (unreleased)
* TMPDIR is now also honored when creating a socket using
--no-standard-socket and with symcryptrun's temp files.
* Fixed a bug where Scdaemon sends a signal to Gpg-agent running in
* Fixed a bug where SCdaemon sends a signal to Gpg-agent running in
non-daemon mode.

View File

@ -1,3 +1,7 @@
2010-11-23 Werner Koch <wk@g10code.com>
* Makefile.am (gpg_agent_LDFLAGS): Add extra_bin_ldflags.
2010-11-11 Werner Koch <wk@g10code.com>
* agent.h (opt): Add field SIGUSR2_ENABLED.

View File

@ -75,7 +75,7 @@ gpg_agent_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_CFLAGS) $(PTH_CFLAGS)
gpg_agent_LDADD = $(commonpth_libs) \
$(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(PTH_LIBS) \
$(GPG_ERROR_LIBS) $(LIBINTL) $(NETLIBS) $(LIBICONV)
gpg_agent_LDFLAGS = $(gpg_agent_res_ldflags)
gpg_agent_LDFLAGS = $(extra_bin_ldflags) $(gpg_agent_res_ldflags)
gpg_agent_DEPENDENCIES = $(gpg_agent_res_deps)
gpg_protect_tool_SOURCES = \

View File

@ -54,11 +54,15 @@ endif
# Under Windows we use LockFileEx. WindowsCE provides this only on
# the WindowsMobile 6 platform and thus we need to use the coredll6
# import library.
# import library. We also want to use a stacksize of 256k instead of
# the 2MB which is the default with cegcc. 256k is the largest stack
# we use with pth.
if HAVE_W32CE_SYSTEM
extra_sys_libs = -lcoredll6
extra_bin_ldflags = -Wl,--stack=0x40000
else
extra_sys_libs =
extra_bin_ldflags =
endif

View File

@ -1,3 +1,10 @@
2010-11-23 Werner Koch <wk@g10code.com>
* asshelp.c (SECS_TO_WAIT_FOR_AGENT, SECS_TO_WAIT_FOR_DIRMNGR):
Use these constants. For W32CE increase them to 30 seconds.
(start_new_gpg_agent): Print time to startup agent.
(start_new_dirmngr): Ditto.
2010-11-04 Werner Koch <wk@g10code.com>
* logging.c (do_logv) [W32]: Don't set a default log stream if the

View File

@ -42,6 +42,15 @@
# define lock_spawn_t dotlock_t
#endif
/* The time we wait until the agent or the dirmngr are ready for
operation after we started them before giving up. */
#ifdef HAVE_W32CE_SYSTEM
# define SECS_TO_WAIT_FOR_AGENT 30
# define SECS_TO_WAIT_FOR_DIRMNGR 30
#else
# define SECS_TO_WAIT_FOR_AGENT 5
# define SECS_TO_WAIT_FOR_DIRMNGR 5
#endif
/* A bitfield that specifies the assuan categories to log. This is
identical to the default log handler of libassuan. We need to do
@ -335,6 +344,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
gpg_error_t err = 0;
char *infostr, *p;
assuan_context_t ctx;
int did_success_msg = 0;
*r_ctx = NULL;
@ -423,16 +433,19 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
if (verbose)
log_info (_("waiting %d seconds for the agent "
"to come up\n"), 5);
for (i=0; i < 5; i++)
"to come up\n"), SECS_TO_WAIT_FOR_AGENT);
for (i=0; i < SECS_TO_WAIT_FOR_AGENT; i++)
{
gnupg_sleep (1);
err = assuan_socket_connect (ctx, sockname, 0, 0);
if (!err)
{
if (verbose && !debug)
log_info (_("connection to agent"
" established\n"));
if (verbose)
{
log_info (_("connection to agent "
"established (%ds)\n"), i+1);
did_success_msg = 1;
}
break;
}
}
@ -517,7 +530,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
return gpg_err_make (errsource, GPG_ERR_NO_AGENT);
}
if (debug)
if (debug && !did_success_msg)
log_debug (_("connection to agent established\n"));
err = assuan_transact (ctx, "RESET",
@ -552,6 +565,7 @@ start_new_dirmngr (assuan_context_t *r_ctx,
gpg_error_t err;
assuan_context_t ctx;
const char *sockname;
int did_success_msg = 0;
*r_ctx = NULL;
@ -612,16 +626,19 @@ start_new_dirmngr (assuan_context_t *r_ctx,
if (verbose)
log_info (_("waiting %d seconds for the dirmngr to come up\n"),
5);
for (i=0; i < 5; i++)
SECS_TO_WAIT_FOR_DIRMNGR);
for (i=0; i < SECS_TO_WAIT_FOR_DIRMNGR; i++)
{
gnupg_sleep (1);
err = assuan_socket_connect (ctx, sockname, 0, 0);
if (!err)
{
if (verbose && !debug)
log_info (_("connection to the dirmngr"
" established\n"));
if (verbose)
{
log_info (_("connection to the dirmngr"
" established (%ds)\n"), i+1);
did_success_msg = 1;
}
break;
}
}
@ -646,7 +663,7 @@ start_new_dirmngr (assuan_context_t *r_ctx,
return gpg_err_make (errsource, GPG_ERR_NO_DIRMNGR);
}
if (debug)
if (debug && !did_success_msg)
log_debug (_("connection to the dirmngr established\n"));
*r_ctx = ctx;

View File

@ -1,3 +1,8 @@
2010-11-23 Werner Koch <wk@g10code.com>
* Makefile.am (dirmngr_LDFLAGS): Add extra_bin_ldflags.
(dirmngr_client_LDFLAGS): Ditto.
2010-10-21 Werner Koch <wk@g10code.com>
* dirmngr.c (main): Changed faked system time warning

View File

@ -63,7 +63,7 @@ dirmngr_LDADD = $(libcommonpth) ../gl/libgnu.a $(DNSLIBS) $(LIBASSUAN_LIBS) \
if !USE_LDAPWRAPPER
dirmngr_LDADD += $(LDAPLIBS)
endif
dirmngr_LDFLAGS = $(extra_bin_ldflags)
if USE_LDAPWRAPPER
dirmngr_ldap_SOURCES = dirmngr_ldap.c $(ldap_url)
@ -76,7 +76,9 @@ endif
dirmngr_client_SOURCES = dirmngr-client.c
dirmngr_client_LDADD = $(libcommon) no-libgcrypt.o \
../gl/libgnu.a $(LIBASSUAN_LIBS) \
$(GPG_ERROR_LIBS) $(LIBINTL) $(LIBICONV)
$(GPG_ERROR_LIBS) $(LIBINTL) \
$(LIBICONV)
dirmngr_client_LDFLAGS = $(extra_bin_ldflags)
no-libgcrypt.c : $(top_srcdir)/tools/no-libgcrypt.c

View File

@ -1,3 +1,13 @@
2010-11-23 Werner Koch <wk@g10code.com>
* Makefile.am (gpg2_LDFLAGS, gpgv2_LDFLAGS): Add extra_bin_ldflags.
* plaintext.c (handle_plaintext): Change to use estream.
s/rc/err/. Replace some xmalloc by xtrymalloc. Use more
gpg_strerror.
* options.h (struct): Change type of OUTFP to estream_t.
* decrypt.c (decrypt_message_fd): Adjust accordingly.
2010-11-17 Werner Koch <wk@g10code.com>
* keyedit.c (find_pk_from_sknode): Remove.

View File

@ -123,8 +123,10 @@ LDADD = $(needed_libs) ../common/libgpgrl.a \
$(LIBINTL) $(CAPLIBS) $(NETLIBS)
gpg2_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
$(LIBICONV) $(extra_sys_libs)
gpg2_LDFLAGS = $(extra_bin_ldflags)
gpgv2_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
$(LIBICONV) $(extra_sys_libs)
gpgv2_LDFLAGS = $(extra_bin_ldflags)
t_common_ldadd =
module_tests = t-rmd160

View File

@ -135,7 +135,7 @@ decrypt_message_fd (ctrl_t ctrl, int input_fd, int output_fd)
#warning Need to fix this if we want to use g13
opt.outfp = NULL;
#else
opt.outfp = fdopen (dup (output_fd), "wb");
opt.outfp = es_fdopen_nc (output_fd, "wb");
#endif
if (!opt.outfp)
{
@ -161,7 +161,7 @@ decrypt_message_fd (ctrl_t ctrl, int input_fd, int output_fd)
err = proc_encryption_packets (ctrl, NULL, fp );
iobuf_close (fp);
fclose (opt.outfp);
es_fclose (opt.outfp);
opt.outfp = NULL;
release_armor_context (afx);
release_progress_context (pfx);

View File

@ -43,7 +43,7 @@ struct
unsigned debug;
int armor;
char *outfile;
FILE *outfp; /* Hack, sometimes used in place of outfile. */
estream_t outfp; /* Hack, sometimes used in place of outfile. */
off_t max_output;
int dry_run;
int list_only;

View File

@ -49,9 +49,9 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
int nooutput, int clearsig)
{
char *fname = NULL;
FILE *fp = NULL;
estream_t fp = NULL;
static off_t count = 0;
int rc = 0;
int err = 0;
int c;
int convert = (pt->mode == 't' || pt->mode == 'u');
#ifdef __riscos__
@ -69,7 +69,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
output will be written to it. This is to make sure that no
not-yet-flushed stuff will be written after the plaintext
status message. */
fflush (stdout);
es_fflush (es_stdout);
snprintf (status, sizeof status,
"%X %lu ", (byte) pt->mode, (ulong) pt->timestamp);
@ -78,7 +78,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
if (!pt->is_partial)
{
sprintf (status, "%lu", (ulong) pt->len);
snprintf (status, sizeof status, "%lu", (ulong) pt->len);
write_status_text (STATUS_PLAINTEXT_LENGTH, status);
}
}
@ -88,11 +88,21 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
;
else if (opt.outfp)
{
fname = xstrdup ("[FP]");
fname = xtrystrdup ("[FP]");
if (!fname)
{
err = gpg_error_from_syserror ();
goto leave;
}
}
else if (opt.outfile)
{
fname = xstrdup (opt.outfile);
fname = xtrystrdup (opt.outfile);
if (!fname)
{
err = gpg_error_from_syserror ();
goto leave;
}
}
else if (pt->namelen == 8 && !memcmp (pt->name, "_CONSOLE", 8))
{
@ -106,7 +116,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
fname = ask_outfile_name (pt->name, pt->namelen);
if (!fname)
{
rc = gpg_error (GPG_ERR_GENERAL); /* Can't create file. */
err = gpg_error (GPG_ERR_GENERAL); /* Can't create file. */
goto leave;
}
}
@ -118,17 +128,13 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
else if (opt.outfp)
{
fp = opt.outfp;
#ifdef HAVE_DOSISH_SYSTEM
setmode (fileno (fp), O_BINARY);
#endif
es_set_binary (fp);
}
else if (iobuf_is_pipe_filename (fname) || !*fname)
{
/* No filename or "-" given; write to stdout. */
fp = stdout;
#ifdef HAVE_DOSISH_SYSTEM
setmode (fileno (fp), O_BINARY);
#endif
fp = es_stdout;
es_set_binary (fp);
}
else
{
@ -139,7 +145,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
xfree (tmp);
/* FIXME: Below used to be G10ERR_CREATE_FILE */
rc = gpg_error (GPG_ERR_GENERAL);
err = gpg_error (GPG_ERR_GENERAL);
goto leave;
}
xfree (fname);
@ -148,10 +154,10 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
}
#ifndef __riscos__
if (opt.outfp && is_secured_file (fileno (opt.outfp)))
if (opt.outfp && is_secured_file (es_fileno (opt.outfp)))
{
rc = gpg_error (GPG_ERR_EPERM);
log_error (_("error creating `%s': %s\n"), fname, gpg_strerror (rc));
err = gpg_error (GPG_ERR_EPERM);
log_error (_("error creating `%s': %s\n"), fname, gpg_strerror (err));
goto leave;
}
else if (fp || nooutput)
@ -159,14 +165,14 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
else if (is_secured_filename (fname))
{
gpg_err_set_errno (EPERM);
rc = gpg_error_from_syserror ();
log_error (_("error creating `%s': %s\n"), fname, strerror (errno));
err = gpg_error_from_syserror ();
log_error (_("error creating `%s': %s\n"), fname, gpg_strerror (err));
goto leave;
}
else if (!(fp = fopen (fname, "wb")))
else if (!(fp = es_fopen (fname, "wb")))
{
rc = gpg_error_from_syserror ();
log_error (_("error creating `%s': %s\n"), fname, strerror (errno));
err = gpg_error_from_syserror ();
log_error (_("error creating `%s': %s\n"), fname, gpg_strerror (err));
goto leave;
}
#else /* __riscos__ */
@ -182,11 +188,15 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
;
else
{
/* Note: riscos stuff is not expected to wrok anymore. If we
want to port it again to riscos we should do most of the suff
in estream. FIXME: Consider to remove all riscos special
cases. */
fp = fopen (fname, "wb");
if (!fp)
{
log_error (_("error creating `%s': %s\n"), fname, strerror (errno));
rc = G10ERR_CREATE_FILE;
log_error (_("error creating `%s': %s\n"), fname, gpg_strerror (err));
err = G10ERR_CREATE_FILE;
if (errno == 106)
log_info ("Do output file and input file have the same name?\n");
goto leave;
@ -210,7 +220,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
if (clearsig)
{
log_error ("clearsig encountered while not expected\n");
rc = G10ERR_UNEXPECTED;
err = gpg_error (GPG_ERR_UNEXPECTED);
goto leave;
}
@ -220,7 +230,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
if ((c = iobuf_get (pt->buf)) == -1)
{
rc = gpg_error_from_syserror ();
err = gpg_error_from_syserror ();
log_error ("problem reading source (%u bytes remaining)\n",
(unsigned) pt->len);
goto leave;
@ -237,17 +247,17 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
log_error ("error writing to `%s': %s\n",
fname, "exceeded --max-output limit\n");
rc = gpg_error (GPG_ERR_TOO_LARGE);
err = gpg_error (GPG_ERR_TOO_LARGE);
goto leave;
}
else if (putc (c, fp) == EOF)
else if (es_putc (c, fp) == EOF)
{
if (ferror (fp))
rc = gpg_error_from_syserror ();
if (es_ferror (fp))
err = gpg_error_from_syserror ();
else
rc = gpg_error (GPG_ERR_EOF);
err = gpg_error (GPG_ERR_EOF);
log_error ("error writing to `%s': %s\n",
fname, strerror (errno));
fname, gpg_strerror (err));
goto leave;
}
}
@ -262,7 +272,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
len = iobuf_read (pt->buf, buffer, len);
if (len == -1)
{
rc = gpg_error_from_syserror ();
err = gpg_error_from_syserror ();
log_error ("problem reading source (%u bytes remaining)\n",
(unsigned) pt->len);
xfree (buffer);
@ -276,15 +286,15 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
log_error ("error writing to `%s': %s\n",
fname, "exceeded --max-output limit\n");
rc = gpg_error (GPG_ERR_TOO_LARGE);
err = gpg_error (GPG_ERR_TOO_LARGE);
xfree (buffer);
goto leave;
}
else if (fwrite (buffer, 1, len, fp) != len)
else if (es_fwrite (buffer, 1, len, fp) != len)
{
rc = gpg_error_from_syserror ();
err = gpg_error_from_syserror ();
log_error ("error writing to `%s': %s\n",
fname, strerror (errno));
fname, gpg_strerror (err));
xfree (buffer);
goto leave;
}
@ -312,17 +322,17 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
log_error ("Error writing to `%s': %s\n",
fname, "exceeded --max-output limit\n");
rc = gpg_error (GPG_ERR_TOO_LARGE);
err = gpg_error (GPG_ERR_TOO_LARGE);
goto leave;
}
else if (putc (c, fp) == EOF)
else if (es_putc (c, fp) == EOF)
{
if (ferror (fp))
rc = gpg_error_from_syserror ();
if (es_ferror (fp))
err = gpg_error_from_syserror ();
else
rc = gpg_error (GPG_ERR_EOF);
err = gpg_error (GPG_ERR_EOF);
log_error ("error writing to `%s': %s\n",
fname, strerror (errno));
fname, gpg_strerror (err));
goto leave;
}
}
@ -330,9 +340,16 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
}
else
{ /* binary mode */
byte *buffer = xmalloc (32768);
byte *buffer;
int eof_seen = 0;
buffer = xtrymalloc (32768);
if (!buffer)
{
err = gpg_error_from_syserror ();
goto leave;
}
while (!eof_seen)
{
/* Why do we check for len < 32768:
@ -354,16 +371,15 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
log_error ("error writing to `%s': %s\n",
fname, "exceeded --max-output limit\n");
rc = gpg_error (GPG_ERR_TOO_LARGE);
err = gpg_error (GPG_ERR_TOO_LARGE);
xfree (buffer);
goto leave;
}
else if (fwrite (buffer, 1, len, fp) != len)
else if (es_fwrite (buffer, 1, len, fp) != len)
{
rc = (errno ? gpg_error_from_syserror ()
: gpg_error (GPG_ERR_INTERNAL));
err = gpg_error_from_syserror ();
log_error ("error writing to `%s': %s\n",
fname, strerror (errno));
fname, gpg_strerror (err));
xfree (buffer);
goto leave;
}
@ -385,15 +401,14 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
log_error ("error writing to `%s': %s\n",
fname, "exceeded --max-output limit\n");
rc = gpg_error (GPG_ERR_TOO_LARGE);
err = gpg_error (GPG_ERR_TOO_LARGE);
goto leave;
}
else if (putc (c, fp) == EOF)
else if (es_putc (c, fp) == EOF)
{
rc = (errno ? gpg_error_from_syserror ()
: gpg_error (GPG_ERR_INTERNAL));
err = gpg_error_from_syserror ();
log_error ("error writing to `%s': %s\n",
fname, strerror (errno));
fname, gpg_strerror (err));
goto leave;
}
}
@ -434,11 +449,10 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
pt->buf = NULL;
}
if (fp && fp != stdout && fp != opt.outfp && fclose (fp))
if (fp && fp != es_stdout && fp != opt.outfp && es_fclose (fp))
{
rc = (errno ? gpg_error_from_syserror ()
: gpg_error (GPG_ERR_INTERNAL));
log_error ("error closing `%s': %s\n", fname, strerror (errno));
err = gpg_error_from_syserror ();
log_error ("error closing `%s': %s\n", fname, gpg_strerror (err));
fp = NULL;
goto leave;
}
@ -448,20 +462,21 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
/* Make sure that stdout gets flushed after the plaintext has been
handled. This is for extra security as we do a flush anyway
before checking the signature. */
if (fflush (stdout))
if (es_fflush (es_stdout))
{
/* We need to check the return code to detect errors like disk
full for short plaintexts. See bug#1207. Checking return
values is a good idea in any case. */
if (!rc)
rc = gpg_error_from_syserror ();
log_error ("error flushing `%s': %s\n", "[stdout]", strerror (errno));
if (!err)
err = gpg_error_from_syserror ();
log_error ("error flushing `%s': %s\n", "[stdout]",
gpg_strerror (err));
}
if (fp && fp != stdout && fp != opt.outfp)
fclose (fp);
if (fp && fp != es_stdout && fp != opt.outfp)
es_fclose (fp);
xfree (fname);
return rc;
return err;
}

View File

@ -1,3 +1,7 @@
2010-11-23 Werner Koch <wk@g10code.com>
* Makefile.am (gpgsm_LDADD): Add extra_bin_ldflags.
2010-10-08 Werner Koch <wk@g10code.com>
* gpgsm.c: Add option --with-keygrip.

View File

@ -59,6 +59,7 @@ gpgsm_LDADD = $(common_libs) ../common/libgpgrl.a \
$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(LIBASSUAN_LIBS) \
$(GPG_ERROR_LIBS) $(LIBREADLINE) $(LIBINTL) $(ZLIBS) \
$(LIBICONV) $(extra_sys_libs)
gpgsm_LDFLAGS = $(extra_bin_ldflags)
# Make sure that all libs are build before we use them. This is
# important for things like make -j2.

View File

@ -1,3 +1,7 @@
2010-11-23 Werner Koch <wk@g10code.com>
* Makefile.am (gpgconf_LDFLAGS): Add extra_bin_ldflags.
2010-11-17 Marcus Brinkmann <mb@g10code.com>
* gogconf.c: Revert accidental debug output commit.

View File

@ -96,6 +96,7 @@ gpgconf_SOURCES = gpgconf.c gpgconf.h gpgconf-comp.c no-libgcrypt.c
gpgconf_LDADD = $(maybe_commonpth_libs) $(opt_libassuan_libs) \
$(LIBINTL) $(GPG_ERROR_LIBS) $(PTH_LIBS) $(NETLIBS) \
$(LIBICONV) $(W32SOCKLIBS)
gpgconf_LDFLAGS = $(extra_bin_ldflags)
gpgparsemail_SOURCES = gpgparsemail.c rfc822parse.c rfc822parse.h
gpgparsemail_LDADD =