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

* configure.ac: Remove the check for asprintf

* app-common.h (app_openpgp_storekey: Add prototype.

* app-openpgp.c (do_sign): Replace asprintf by direct allocation.
This avoids problems with missing vasprintf implementations.

* card-util.c (generate_card_keys): Add a #warning for gnupg 1.9
and use the same string there.

* util.h [!HAVE_VASPRINTF]: Removed prototype.

* vasprintf.c: Removed. It was used only at one place and I don't
want to get into build problems in 1.4.
This commit is contained in:
Werner Koch 2004-10-21 16:56:22 +00:00
parent 107e515aa9
commit 0ebf79c824
12 changed files with 47 additions and 183 deletions

View File

@ -9,6 +9,8 @@ Authors
Birger Langkjer <birger.langkjer@image.dk> Translations [da] Birger Langkjer <birger.langkjer@image.dk> Translations [da]
Britov Ivanovich <maxbritov@tut.by> Translations [ru]
Daniel Resare <daniel@resare.com> Translations [sv] Daniel Resare <daniel@resare.com> Translations [sv]
David Shaw <dshaw@jabberwocky.com> Assigns past and future changes. David Shaw <dshaw@jabberwocky.com> Assigns past and future changes.
@ -58,6 +60,9 @@ Nils Ellmenreich <nils 'at' infosun.fmi.uni-passau.de>
Paul Eggert <eggert@twinsun.com> Paul Eggert <eggert@twinsun.com>
(configuration macros for LFS) (configuration macros for LFS)
Pavel I. Shajdo <zwon@severodvinsk.ru> Translations [ru]
(man pages)
Pedro Morais <morais@poli.org> Translations [pt_PT] Pedro Morais <morais@poli.org> Translations [pt_PT]
Rémi Guyomarch <rguyom@mail.dotcom.fr> Assigns past and future changes. Rémi Guyomarch <rguyom@mail.dotcom.fr> Assigns past and future changes.

View File

@ -1,3 +1,7 @@
2004-10-21 Werner Koch <wk@g10code.com>
* configure.ac: Remove the check for asprintf
2004-10-15 Werner Koch <wk@g10code.com> 2004-10-15 Werner Koch <wk@g10code.com>
Released 1.3.91. Released 1.3.91.

2
NEWS
View File

@ -1,5 +1,7 @@
Noteworthy changes in version 1.3.92 Noteworthy changes in version 1.3.92
------------------------------------------------- -------------------------------------------------
* Added Russian man page. Thanks to Pawel I. Shajdo.
Noteworthy changes in version 1.3.91 (2004-10-15) Noteworthy changes in version 1.3.91 (2004-10-15)

View File

@ -799,7 +799,7 @@ AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime)
AC_CHECK_FUNCS(atexit raise getpagesize strftime nl_langinfo setlocale) AC_CHECK_FUNCS(atexit raise getpagesize strftime nl_langinfo setlocale)
AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask rand pipe stat getaddrinfo) AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask rand pipe stat getaddrinfo)
AC_REPLACE_FUNCS(mkdtemp timegm) AC_REPLACE_FUNCS(mkdtemp timegm)
AC_REPLACE_FUNCS(vasprintf)
AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>]) AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
# See if getopt is in libiberty. This is of course not optimal since # See if getopt is in libiberty. This is of course not optimal since

View File

@ -1,3 +1,13 @@
2004-10-21 Werner Koch <wk@g10code.com>
* app-common.h (app_openpgp_storekey: Add prototype.
* app-openpgp.c (do_sign): Replace asprintf by direct allocation.
This avoids problems with missing vasprintf implementations.
* card-util.c (generate_card_keys): Add a #warning for gnupg 1.9
and use the same string there.
2004-10-20 David Shaw <dshaw@jabberwocky.com> 2004-10-20 David Shaw <dshaw@jabberwocky.com>
* g10.c (parse_list_options): Fix non-constant initializer so we * g10.c (parse_list_options): Fix non-constant initializer so we

View File

@ -88,6 +88,13 @@ struct app_ctx_s {
#if GNUPG_MAJOR_VERSION == 1 #if GNUPG_MAJOR_VERSION == 1
int app_select_openpgp (app_t app); int app_select_openpgp (app_t app);
int app_get_serial_and_stamp (app_t app, char **serial, time_t *stamp); int app_get_serial_and_stamp (app_t app, char **serial, time_t *stamp);
int app_openpgp_storekey (app_t app, int keyno,
unsigned char *template, size_t template_len,
time_t created_at,
const unsigned char *m, size_t mlen,
const unsigned char *e, size_t elen,
int (*pincb)(void*, const char *, char **),
void *pincb_arg);
#else #else
/*-- app-help.c --*/ /*-- app-help.c --*/
gpg_error_t app_help_get_keygrip_string (ksba_cert_t cert, char *hexkeygrip); gpg_error_t app_help_get_keygrip_string (ksba_cert_t cert, char *hexkeygrip);

View File

@ -1298,10 +1298,15 @@ do_sign (app_t app, const char *keyidstr, int hashalgo,
{ {
char *prompt; char *prompt;
if (asprintf (&prompt, _("PIN [sigs done: %lu]"), sigcount) < 0) #define PROMPTSTRING _("PIN [sigs done: %lu]")
prompt = malloc (strlen (PROMPTSTRING) + 50);
if (!prompt)
return gpg_error_from_errno (errno); return gpg_error_from_errno (errno);
sprintf (prompt, PROMPTSTRING, sigcount);
rc = pincb (pincb_arg, prompt, &pinvalue); rc = pincb (pincb_arg, prompt, &pinvalue);
free (prompt); free (prompt);
#undef PROMPTSTRING
} }
if (rc) if (rc)
{ {

View File

@ -895,10 +895,10 @@ generate_card_keys (const char *serialno)
m_free(answer); m_free(answer);
} }
#else #else
/* Does 1.9 have answer_is_yes_no_default() ? */ want_backup = cpr_get_answer_is_yes
want_backup = !(cpr_get_answer_is_yes
( "cardedit.genkeys.backup_enc", ( "cardedit.genkeys.backup_enc",
_("Inhibit off-card backup of encryption key? (y/N) "))); _("Make off-card backup of encryption key? (Y/n) "));
#warning we need answer_is_yes_no_default()
#endif #endif
if ( (info.fpr1valid && !fpr_is_zero (info.fpr1)) if ( (info.fpr1valid && !fpr_is_zero (info.fpr1))

View File

@ -1,3 +1,7 @@
2004-10-21 Werner Koch <wk@g10code.com>
* util.h [!HAVE_VASPRINTF]: Removed prototype.
2004-10-15 Werner Koch <wk@g10code.com> 2004-10-15 Werner Koch <wk@g10code.com>
* util.h [!HAVE_VASPRINTF]: Add asprintf prototype. * util.h [!HAVE_VASPRINTF]: Add asprintf prototype.

View File

@ -245,15 +245,6 @@ int asprintf (char **buf, const char *fmt, ...);
/*-- Replacement functions from funcname.c --*/ /*-- Replacement functions from funcname.c --*/
#if !HAVE_VASPRINTF
int asprintf (char **result, const char *format, ...)
#if defined (__riscos__) \
|| (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 ))
__attribute__ ((format (printf,2,3)))
#endif
;
#endif
/******** some macros ************/ /******** some macros ************/

View File

@ -1,3 +1,8 @@
2004-10-21 Werner Koch <wk@g10code.com>
* vasprintf.c: Removed. It was used only at one place and I don't
want to get into build problems in 1.4.
2004-10-18 David Shaw <dshaw@jabberwocky.com> 2004-10-18 David Shaw <dshaw@jabberwocky.com>
* http.c (connect_server, send_request): Use the URI scheme as the * http.c (connect_server, send_request): Use the URI scheme as the

View File

@ -1,169 +0,0 @@
/* Like vsprintf but provides a pointer to malloc'd storage, which must
be freed by the caller.
Copyright (C) 1994, 2002 Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Libiberty is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef TEST
int global_total_width;
#endif
int
vasprintf (char **result, const char *format, va_list args)
{
const char *p = format;
/* Add one to make sure that it is never zero, which might cause malloc
to return NULL. */
int total_width = strlen (format) + 1;
va_list ap;
#ifdef va_copy
va_copy (ap, args);
#else
#ifdef __va_copy
__va_copy (ap, args);
#else
memcpy (&ap, args, sizeof (va_list));
#endif /* __va_copy */
#endif /* va_copy */
while (*p != '\0')
{
if (*p++ == '%')
{
while (strchr ("-+ #0", *p))
++p;
if (*p == '*')
{
++p;
total_width += abs (va_arg (ap, int));
}
else
total_width += strtoul (p, (char**)&p, 10);
if (*p == '.')
{
++p;
if (*p == '*')
{
++p;
total_width += abs (va_arg (ap, int));
}
else
total_width += strtoul (p, (char**)&p, 10);
}
while (strchr ("hlL", *p))
++p;
/* Should be big enough for any format specifier except %s
and floats. */
total_width += 30;
switch (*p)
{
case 'd':
case 'i':
case 'o':
case 'u':
case 'x':
case 'X':
case 'c':
(void) va_arg (ap, int);
break;
case 'f':
case 'e':
case 'E':
case 'g':
case 'G':
(void) va_arg (ap, double);
/* Since an ieee double can have an exponent of 307, we'll
make the buffer wide enough to cover the gross case. */
total_width += 307;
break;
case 's':
{
char *tmp = va_arg (ap, char *);
if (tmp)
total_width += strlen (tmp);
else /* in case the vsprintf does prints a text */
total_width += 25; /* e.g. "(null pointer reference)" */
}
break;
case 'p':
case 'n':
(void) va_arg (ap, char *);
break;
}
}
}
#ifdef TEST
global_total_width = total_width;
#endif
*result = malloc (total_width);
if (*result != NULL)
return vsprintf (*result, format, args);
else
return 0;
}
int
asprintf (char **buf, const char *fmt, ...)
{
int status;
va_list ap;
va_start (ap, fmt);
status = vasprintf (buf, fmt, ap);
va_end (ap);
return status;
}
#ifdef TEST
void
checkit (const char* format, ...)
{
va_list args;
char *result;
va_start (args, format);
vasprintf (&result, format, args);
if (strlen (result) < global_total_width)
printf ("PASS: ");
else
printf ("FAIL: ");
printf ("%d %s\n", global_total_width, result);
}
int
main (void)
{
checkit ("%d", 0x12345678);
checkit ("%200d", 5);
checkit ("%.300d", 6);
checkit ("%100.150d", 7);
checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
777777777777777777333333333333366666666666622222222222777777777777733333");
checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx");
}
#endif /* TEST */