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

Pth tweaks and improved estream.c

This commit is contained in:
Werner Koch 2006-10-17 14:34:42 +00:00
parent 751f009c65
commit be410be660
51 changed files with 5380 additions and 4882 deletions

View File

@ -1,3 +1,9 @@
2006-10-17 Werner Koch <wk@g10code.com>
* autogen.sh <--build-w32>: Test also for a host "mingw32".
* configure.ac: Removed W32LIBS. Use NETLIBS instead.
2006-10-11 Werner Koch <wk@g10code.com>
Released 1.9.92.

5
NEWS
View File

@ -1,6 +1,11 @@
Noteworthy changes in version 1.9.93
-------------------------------------------------
* In --with-validation mode gpgsm will now also ask whether a root
certificate should be trusted.
* Link to Pth only if really necessary.
Noteworthy changes in version 1.9.92 (2006-10-11)
-------------------------------------------------

View File

@ -1,3 +1,8 @@
2006-10-17 Werner Koch <wk@g10code.com>
* Makefile.am (gpg_agent_LDADD): Link to libcommonpth.
(gpg_agent_CFLAGS): New. This allows to only link this with Pth.
2006-10-16 Werner Koch <wk@g10code.com>
* call-pinentry.c (agent_get_confirmation): Map Cancel code here too.

View File

@ -27,8 +27,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/common -I$(top_srcdir)/intl
include $(top_srcdir)/am/cmacros.am
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBASSUAN_PTH_CFLAGS) $(GPG_ERROR_CFLAGS) \
$(PTH_CFLAGS)
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(GPG_ERROR_CFLAGS)
gpg_agent_SOURCES = \
gpg-agent.c agent.h \
@ -48,9 +47,11 @@ gpg_agent_SOURCES = \
common_libs = ../jnlib/libjnlib.a ../common/libcommon.a ../gl/libgnu.a
commonpth_libs = ../jnlib/libjnlib.a ../common/libcommonpth.a ../gl/libgnu.a
pwquery_libs = ../common/libsimple-pwquery.a
gpg_agent_LDADD = $(common_libs) \
gpg_agent_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_PTH_CFLAGS) $(PTH_CFLAGS)
gpg_agent_LDADD = $(commonpth_libs) \
$(LIBGCRYPT_LIBS) $(LIBASSUAN_PTH_LIBS) $(PTH_LIBS) \
$(GPG_ERROR_LIBS) $(LIBINTL) $(NETLIBS)
@ -61,24 +62,19 @@ gpg_protect_tool_SOURCES = \
# Needs $(NETLIBS) for libsimple-pwquery.la.
gpg_protect_tool_LDADD = $(pwquery_libs) $(common_libs) \
$(LIBGCRYPT_LIBS) -lgpg-error $(LIBINTL) $(NETLIBS)
if HAVE_W32_SYSTEM
gpg_protect_tool_LDADD += -lwsock32
endif
$(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) $(LIBINTL) $(NETLIBS)
gpg_preset_passphrase_SOURCES = \
preset-passphrase.c
# Needs $(NETLIBS) for libsimple-pwquery.la.
gpg_preset_passphrase_LDADD = $(pwquery_libs) $(common_libs) \
$(LIBGCRYPT_LIBS) -lgpg-error @LIBINTL@ $(NETLIBS)
if HAVE_W32_SYSTEM
gpg_preset_passphrase_LDADD += -lwsock32
endif
$(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) $(LIBINTL) $(NETLIBS)
# Make sure that all libs are build before we use them. This is
# important for things like make -j2.
$(PROGRAMS): $(common_libs) $(pwquery_libs)
$(PROGRAMS): $(common_libs) $(commonpth_libs) $(pwquery_libs)
#

View File

@ -57,7 +57,7 @@ if test "$1" = "--build-w32"; then
# Locate the cross compiler
crossbindir=
for host in i586-mingw32msvc i386-mingw32msvc; do
for host in i586-mingw32msvc i386-mingw32msvc mingw32; do
if ${host}-gcc --version >/dev/null 2>&1 ; then
crossbindir=/usr/${host}/bin
conf_CC="CC=${host}-gcc"

View File

@ -1,3 +1,13 @@
2006-10-17 Werner Koch <wk@g10code.com>
* estream.c (struct estream_internal, es_initialize)
(es_deinitialize, print_fun_writer, es_print): New and modified
functions to avoid tempfiles for printf style printing.
* Makefile.am (libcommonpth_a_SOURCES): New. We now build a secon
version of the library with explicit Pth support.
* exechelp.c, estream.c: Make use of WITHOUT_GNU_PTH.
2006-10-08 Werner Koch <wk@g10code.com>
* gpgrlhelp.c: Trun all functions into dummies if readline is not

View File

@ -20,16 +20,15 @@
## Process this file with automake to produce Makefile.in
noinst_LIBRARIES = libcommon.a libsimple-pwquery.a libgpgrl.a
noinst_LIBRARIES = libcommon.a libcommonpth.a libsimple-pwquery.a libgpgrl.a
noinst_PROGRAMS = $(module_tests)
TESTS = $(module_tests)
AM_CPPFLAGS = -I$(top_srcdir)/gl
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBASSUAN_PTH_CFLAGS) $(KSBA_CFLAGS) \
$(PTH_CFLAGS)
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS)
libcommon_a_SOURCES = \
common_sources = \
common-defs.h \
util.h i18n.h \
errors.h \
@ -61,6 +60,12 @@ libcommon_a_SOURCES = \
pka.c pka.h \
http.c http.h
libcommon_a_SOURCES = $(common_sources)
libcommon_a_CFLAGS = $(AM_CFLAGS) -DWITHOUT_GNU_PTH=1
libcommonpth_a_SOURCES = $(common_sources)
libcommonpth_a_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_PTH_CFLAGS) $(PTH_CFLAGS)
libsimple_pwquery_a_SOURCES = \
simple-pwquery.c simple-pwquery.h asshelp.c asshelp.h

View File

@ -30,6 +30,7 @@
#include <sys/types.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@ -39,6 +40,11 @@
#include <stddef.h>
#include <assert.h>
#ifdef WITHOUT_GNU_PTH /* Give the Makefile a chance to build without Pth. */
#undef HAVE_PTH
#undef USE_GNU_PTH
#endif
#ifdef HAVE_PTH
# include <pth.h>
#endif
@ -149,8 +155,13 @@ struct estream_internal
unsigned int eof: 1;
} indicators;
unsigned int deallocate_buffer: 1;
unsigned int print_err: 1; /* Error in print_fun_writer. */
int print_errno; /* Errno from print_fun_writer. */
size_t print_ntotal; /* Bytes written from in print_fun_writer. */
FILE *print_fp; /* Stdio stream used by print_fun_writer. */
};
typedef struct estream_internal *estream_internal_t;
#define ESTREAM_LOCK(stream) ESTREAM_MUTEX_LOCK (stream->intern->lock)
@ -916,6 +927,10 @@ es_initialize (estream_t stream,
stream->intern->func_close = functions.func_close;
stream->intern->strategy = _IOFBF;
stream->intern->fd = fd;
stream->intern->print_err = 0;
stream->intern->print_errno = 0;
stream->intern->print_ntotal = 0;
stream->intern->print_fp = NULL;
stream->intern->indicators.err = 0;
stream->intern->indicators.eof = 0;
stream->intern->deallocate_buffer = 0;
@ -934,6 +949,14 @@ es_deinitialize (estream_t stream)
es_cookie_close_function_t func_close;
int err, tmp_err;
if (stream->intern->print_fp)
{
int save_errno = errno;
fclose (stream->intern->print_fp);
stream->intern->print_fp = NULL;
errno = save_errno;
}
func_close = stream->intern->func_close;
err = 0;
@ -941,6 +964,7 @@ es_deinitialize (estream_t stream)
SET_UNLESS_NONZERO (err, tmp_err, es_flush (stream));
if (func_close)
SET_UNLESS_NONZERO (err, tmp_err, (*func_close) (stream->intern->cookie));
return err;
}
@ -1625,13 +1649,80 @@ doreadline (estream_t ES__RESTRICT stream, size_t max_length,
}
/* Helper for esprint. */
#if defined(HAVE_FOPENCOOKIE) || defined(HAVE_FUNOPEN)
static int
print_fun_writer (void *cookie_arg, const char *buffer, size_t size)
{
estream_t stream = cookie_arg;
size_t nwritten;
/* We don't return an error but let es_print check whether an error
has occured. Internally we skip everything after an error. */
if (!stream->intern->print_err)
{
if (es_writen (stream, buffer, size, &nwritten))
{
stream->intern->print_err = 1;
stream->intern->print_errno = errno;
}
else
stream->intern->print_ntotal += nwritten;
}
return 0;
}
#endif /* HAVE_FOPENCOOKIE || HAVE_FUNOPEN */
/* The core of our printf function. This is called in locked state. */
static int
es_print (estream_t ES__RESTRICT stream,
const char *ES__RESTRICT format, va_list ap)
{
#if defined(HAVE_FOPENCOOKIE) || defined(HAVE_FUNOPEN)
if (!stream->intern->print_fp)
{
#ifdef HAVE_FOPENCOOKIE
{
cookie_io_functions_t io = { NULL };
io.write = print_fun_writer;
stream->intern->print_fp = fopencookie (stream, "w", io);
}
#else /*!HAVE_FOPENCOOKIE*/
stream->intern->print_fp = funopen (stream, NULL,
print_fun_writer, NULL, NULL);
#endif /*!HAVE_FOPENCOOKIE*/
if (!stream->intern->print_fp)
return -1;
}
stream->intern->print_err = 0;
stream->intern->print_errno = 0;
stream->intern->print_ntotal = 0;
if ( vfprintf (stream->intern->print_fp, format, ap) < 0
|| fflush (stream->intern->print_fp) )
{
stream->intern->print_errno = errno;
stream->intern->print_err = 1;
fclose (stream->intern->print_fp);
stream->intern->print_fp = NULL;
}
if (stream->intern->print_err)
{
errno = stream->intern->print_errno;
return -1;
}
return (int)stream->intern->print_ntotal;
#else /* No funopen or fopencookie. */
char data[BUFFER_BLOCK_SIZE];
size_t bytes_written;
size_t bytes_read;
size_t bytes_written;
FILE *tmp_stream;
int err;
@ -1675,11 +1766,11 @@ es_print (estream_t ES__RESTRICT stream,
goto out;
out:
if (tmp_stream)
fclose (tmp_stream);
return err ? -1 : bytes_written;
#endif /* no funopen or fopencookie */
}

View File

@ -29,6 +29,12 @@
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#ifdef WITHOUT_GNU_PTH /* Give the Makefile a chance to build without Pth. */
#undef HAVE_PTH
#undef USE_GNU_PTH
#endif
#ifdef USE_GNU_PTH
#include <pth.h>
#endif

View File

@ -1107,11 +1107,10 @@ GNUPG_CHECK_GNUMAKE
# Add some extra libs here so that previous tests don't fail for
# mysterious reasons - the final link step should bail out.
if test "$have_w32_system" = yes; then
W32LIBS="-lwsock32"
NETLIBS="${NETLIBS} -lwsock32"
fi
AC_SUBST(NETLIBS)
AC_SUBST(W32LIBS)
#

View File

@ -1,3 +1,8 @@
2006-10-12 Werner Koch <wk@g10code.com>
* Makefile.am (man_MANS): Do not install gnupg.7 due to a conflict
with gpg1.
2006-10-12 David Shaw <dshaw@jabberwocky.com>
* gpg.texi: Document --s2k-count.

View File

@ -51,13 +51,13 @@ YAT2M_OPTIONS = -I $(srcdir) \
myman_sources = gnupg7.texi gpg.texi gpgsm.texi gpg-agent.texi \
scdaemon.texi tools.texi
myman_pages = gnupg.7 gpg2.1 gpgsm.1 gpg-agent.1 scdaemon.1 gpgv2.1 \
myman_pages = gpg2.1 gpgsm.1 gpg-agent.1 scdaemon.1 gpgv2.1 \
watchgnupg.1 gpgconf.1 addgnupghome.8 gpg-preset-passphrase.1 \
gpg-connect-agent.1 gpgparsemail.1 symcryptrun.1 \
gpgsm-gencert.sh.1
man_MANS = $(myman_pages)
noinst_MANS = gnupg.7
watchgnupg_SOURCE = gnupg.texi
@ -65,7 +65,7 @@ watchgnupg_SOURCE = gnupg.texi
CLEANFILES = faq.raw.xref
DISTCLEANFILES = gnupg.tmp gnupg.ops yat2m-stamp.tmp yat2m-stamp \
$(myman_pages)
$(myman_pages) gnupg.7
yat2m_SOURCES = yat2m.c
@ -112,7 +112,7 @@ yat2m-stamp: $(myman_sources)
yat2m-stamp: yat2m
$(myman_pages) : yat2m-stamp
$(myman_pages) gnupg.7 : yat2m-stamp
@if test -f $@; then :; else \
trap 'rm -rf yat2m-stamp yat2m-lock' 1 2 13 15; \
if mkdir yat2m-lock 2>/dev/null; then \

View File

@ -1,3 +1,7 @@
2006-10-17 Werner Koch <wk@g10code.com>
* Makefile.am (LDADD): Replaced W32LIBS by NETLIBS.
2006-10-12 David Shaw <dshaw@jabberwocky.com>
* parse-packet.c (parse_symkeyenc): Show the unpacked as well as

View File

@ -27,7 +27,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/common \
include $(top_srcdir)/am/cmacros.am
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBASSUAN_PTH_CFLAGS) $(GPG_ERROR_CFLAGS)
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(GPG_ERROR_CFLAGS)
needed_libs = ../gl/libgnu.a ../common/libcommon.a ../jnlib/libjnlib.a
@ -110,7 +110,7 @@ gpgv2_SOURCES = gpgv.c \
LDADD = $(needed_libs) ../common/libgpgrl.a \
$(ZLIBS) $(DNSLIBS) $(LIBREADLINE) \
$(LIBINTL) $(CAPLIBS) $(W32LIBS)
$(LIBINTL) $(CAPLIBS) $(NETLIBS)
gpg2_LDADD = $(LIBGCRYPT_LIBS) $(LDADD) $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS)
gpgv2_LDADD = $(LIBGCRYPT_LIBS) $(LDADD) $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS)

View File

@ -1,3 +1,8 @@
2006-10-17 Werner Koch <wk@g10code.com>
* Makefile.am: Removed W32LIBS as they are included in NETLIBS.
Removed PTH_LIBS.
2006-09-26 Werner Koch <wk@g10code.com>
* curl-shim.c: Adjusted for changes in http.c.

View File

@ -47,20 +47,20 @@ gpg2keys_curl_SOURCES = gpgkeys_curl.c ksutil.c ksutil.h no-libgcrypt.c
gpg2keys_ldap_CPPFLAGS = $(LDAP_CPPFLAGS) $(AM_CPPFLAGS)
gpg2keys_ldap_LDADD = $(LDAPLIBS) $(NETLIBS) \
$(other_libs) $(W32LIBS)
$(other_libs)
gpg2keys_finger_LDADD = $(common_libs) $(LIBGCRYPT_LIBS) \
$(NETLIBS) $(other_libs) $(W32LIBS)
$(NETLIBS) $(other_libs)
if FAKE_CURL
gpg2keys_curl_SOURCES += curl-shim.c curl-shim.h
gpg2keys_curl_CPPFLAGS = $(AM_CPPFLAGS)
gpg2keys_curl_LDADD = $(common_libs) $(GPG_ERROR_LIBS) $(NETLIBS) $(DNSLIBS) \
$(other_libs) $(PTH_LIBS) $(W32LIBS)
$(other_libs)
gpg2keys_hkp_SOURCES += curl-shim.c curl-shim.h
gpg2keys_hkp_CPPFLAGS = $(AM_CPPFLAGS)
gpg2keys_hkp_LDADD = $(common_libs) $(GPG_ERROR_LIBS) $(NETLIBS) $(DNSLIBS) \
$(other_libs) $(PTH_LIBS) $(W32LIBS)
$(other_libs)
else
gpg2keys_curl_CPPFLAGS = $(LIBCURL_CPPFLAGS) $(AM_CPPFLAGS)
gpg2keys_curl_LDADD = $(LIBCURL) $(GETOPT)

371
po/be.po

File diff suppressed because it is too large Load Diff

371
po/ca.po

File diff suppressed because it is too large Load Diff

371
po/cs.po

File diff suppressed because it is too large Load Diff

371
po/da.po

File diff suppressed because it is too large Load Diff

371
po/de.po

File diff suppressed because it is too large Load Diff

371
po/el.po

File diff suppressed because it is too large Load Diff

371
po/eo.po

File diff suppressed because it is too large Load Diff

371
po/es.po

File diff suppressed because it is too large Load Diff

371
po/et.po

File diff suppressed because it is too large Load Diff

371
po/fi.po

File diff suppressed because it is too large Load Diff

371
po/fr.po

File diff suppressed because it is too large Load Diff

371
po/gl.po

File diff suppressed because it is too large Load Diff

371
po/hu.po

File diff suppressed because it is too large Load Diff

371
po/id.po

File diff suppressed because it is too large Load Diff

371
po/it.po

File diff suppressed because it is too large Load Diff

371
po/ja.po

File diff suppressed because it is too large Load Diff

371
po/nb.po

File diff suppressed because it is too large Load Diff

371
po/pl.po

File diff suppressed because it is too large Load Diff

371
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

371
po/ro.po

File diff suppressed because it is too large Load Diff

371
po/ru.po

File diff suppressed because it is too large Load Diff

371
po/sk.po

File diff suppressed because it is too large Load Diff

371
po/sv.po

File diff suppressed because it is too large Load Diff

371
po/tr.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,12 @@
2006-10-17 Werner Koch <wk@g10code.com>
* Makefile.am (scdaemon_LDADD): Link against libcommonpth.
2006-10-12 Werner Koch <wk@g10code.com>
* apdu.c: Include pth.h after unistd.h for the sake of newer Pth
versions.
2006-10-11 Werner Koch <wk@g10code.com>
* app-openpgp.c (do_sign): Redirect to do_auth for OpenPGP.3.

View File

@ -44,9 +44,9 @@ scdaemon_SOURCES = \
app.c app-common.h app-help.c $(card_apps)
scdaemon_LDADD = ../jnlib/libjnlib.a ../common/libcommon.a ../gl/libgnu.a \
scdaemon_LDADD = ../jnlib/libjnlib.a ../common/libcommonpth.a ../gl/libgnu.a \
$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(LIBASSUAN_PTH_LIBS) $(PTH_LIBS) \
$(LIBUSB_LIBS) -lgpg-error $(LIBINTL) $(DL_LIBS) $(NETLIBS)
$(LIBUSB_LIBS) $(GPG_ERROR_LIBS) $(LIBINTL) $(DL_LIBS) $(NETLIBS)
# Removed for now: We need to decide whether it makes sense to
# continue it at all, given that gpg has now all required

View File

@ -33,9 +33,9 @@
#include <assert.h>
#include <signal.h>
#ifdef USE_GNU_PTH
# include <pth.h>
# include <unistd.h>
# include <fcntl.h>
# include <pth.h>
#endif

View File

@ -1,5 +1,8 @@
2006-10-17 Werner Koch <wk@g10code.com>
* gpgsm.c: No need for pth.h.
(main): or to init it. It used to be hack for W32.
* sign.c (gpgsm_get_default_cert): Changed to return only
certificates usable for signing.

View File

@ -22,8 +22,7 @@
bin_PROGRAMS = gpgsm
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBASSUAN_PTH_CFLAGS) $(KSBA_CFLAGS) \
$(PTH_CFLAGS)
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/common -I$(top_srcdir)/intl
include $(top_srcdir)/am/cmacros.am
@ -58,8 +57,8 @@ common_libs = ../jnlib/libjnlib.a ../kbx/libkeybox.a \
../common/libcommon.a ../gl/libgnu.a
gpgsm_LDADD = $(common_libs) \
$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(LIBASSUAN_PTH_LIBS) \
-lgpg-error $(LIBINTL) $(PTH_LIBS) $(ZLIBS)
$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(LIBASSUAN_LIBS) \
$(GPG_ERROR_LIBS) $(LIBINTL) $(ZLIBS)
# Make sure that all libs are build before we use them. This is
# important for things like make -j2.

View File

@ -28,9 +28,7 @@
#include <ctype.h>
#include <unistd.h>
#include <fcntl.h>
#ifdef USE_GNU_PTH
# include <pth.h>
#endif
#include "gpgsm.h"
#include <gcrypt.h>
@ -773,11 +771,6 @@ main ( int argc, char **argv)
NEED_KSBA_VERSION, ksba_check_version (NULL) );
}
#ifdef HAVE_W32_SYSTEM
/* For W32 we need pth. */
pth_init ();
#endif
gcry_control (GCRYCTL_USE_SECURE_RNDPOOL);

View File

@ -1,3 +1,8 @@
2006-10-12 Werner Koch <wk@g10code.com>
* Makefile.am (gpg-zip, gpgsplit): Do not install due to a
conflict with gpg1.
2006-10-11 Werner Koch <wk@g10code.com>
* gpgsm-gencert.sh: Allow generation of card keys.

View File

@ -33,7 +33,8 @@ sbin_SCRIPTS = addgnupghome
bin_SCRIPTS = gpgsm-gencert.sh
if HAVE_USTAR
bin_SCRIPTS += gpg-zip
# bin_SCRIPTS += gpg-zip
noinst_SCRIPTS = gpg-zip
endif
if BUILD_SYMCRYPTRUN
@ -43,12 +44,12 @@ else
endif
bin_PROGRAMS = gpgconf gpg-connect-agent gpgkey2ssh ${symcryptrun} \
gpgparsemail gpgsplit
gpgparsemail
if !HAVE_W32_SYSTEM
bin_PROGRAMS += watchgnupg
endif
noinst_PROGRAMS = clean-sat mk-tdata make-dns-cert
noinst_PROGRAMS = clean-sat mk-tdata make-dns-cert gpgsplit
common_libs = ../jnlib/libjnlib.a ../common/libcommon.a ../gl/libgnu.a
pwquery_libs = ../common/libsimple-pwquery.a