GNUPG-1-9-BRANCH gnupg (34 files)

cvs user wk cvs at cvs.gnupg.org
Wed Jun 1 17:24:58 CEST 2005


    Date: Wednesday, June 1, 2005 @ 17:46:01
  Author: wk
    Path: /cvs/gnupg/gnupg
     Tag: GNUPG-1-9-BRANCH

Modified: ChangeLog Makefile.am agent/ChangeLog agent/Makefile.am
          agent/gpg-agent.c autogen.sh common/ChangeLog common/Makefile.am
          common/util.h common/xasprintf.c configure.ac g10/ChangeLog
          g10/Makefile.am g10/exec.c kbx/ChangeLog kbx/Makefile.am
          kbx/keybox-file.c kbx/keybox-update.c scd/ChangeLog
          scd/Makefile.am scd/scdaemon.c sm/ChangeLog sm/Makefile.am
          sm/misc.c tools/ChangeLog tools/Makefile.am tools/symcryptrun.c
 Removed: common/fseeko.c common/ftello.c common/mkdtemp.c
          common/putc_unlocked.c common/strsep.c common/ttyname.c
          g10/mkdtemp.c

* configure.ac (gl_INIT): Add gnulib stuff.
(fseeko, ftello, ttyname, isascii): Replaced the AC_REPLACE_FUNCS
by a simple check.
(putc_unlocked): Removed check.  Not used.
(strsep, mkdtemp, asprintf): Replaced checks by gnulib checks.
(xsize): Added will probably come handy soon.
(CFLAGS): Use -Wformat-security instead of
-Wformat-nonliteral. Add --Wno-format-y2k.
* gl/, gl/m4/: New.

* gpg-agent.c: Include setenv.h.

* Makefile.am (AM_CPPFLAGS): Added.

* util.h: Add some includes for gnulib.
(ttyname, isascii): Define them inline.
* fseeko.c, ftello.c: Removed.
* strsep.c, mkdtemp.c: Removed.
* ttyname.c, isascii.c: Removed.

* mkdtemp.c: Removed.
* exec.c: Include mkdtemp.h

* keybox-file.c (ftello) [!HAVE_FSEEKO]: New replacement
function.  Copied from ../common/ftello.c.
* keybox-update.c (fseeko) [!HAVE_FSEEKO]: New replacement
function.  Copied from ../common/iobuf.c.

* scdaemon.c: Include mkdtemp.h.

* misc.c: Include setenv.h.

* symcryptrun.c: Include mkdtemp.h.


------------------------+
 ChangeLog              |   12 +++++
 Makefile.am            |    4 -
 agent/ChangeLog        |    4 +
 agent/Makefile.am      |    4 -
 agent/gpg-agent.c      |    1 
 autogen.sh             |    4 -
 common/ChangeLog       |   10 ++++
 common/Makefile.am     |   16 +------
 common/fseeko.c        |   41 -------------------
 common/ftello.c        |   46 ----------------------
 common/mkdtemp.c       |   97 ----------------------------------------------
 common/putc_unlocked.c |   31 --------------
 common/strsep.c        |   76 ------------------------------------
 common/ttyname.c       |   32 ---------------
 common/util.h          |   40 +++++++++++--------
 common/xasprintf.c     |    2 
 configure.ac           |   20 ++++-----
 g10/ChangeLog          |    5 ++
 g10/Makefile.am        |    6 +-
 g10/exec.c             |    5 --
 g10/mkdtemp.c          |   98 -----------------------------------------------
 kbx/ChangeLog          |    7 +++
 kbx/Makefile.am        |    5 +-
 kbx/keybox-file.c      |   16 +++++++
 kbx/keybox-update.c    |   32 +++++++++++++++
 scd/ChangeLog          |    4 +
 scd/Makefile.am        |    4 -
 scd/scdaemon.c         |    2 
 sm/ChangeLog           |    4 +
 sm/Makefile.am         |    4 -
 sm/misc.c              |    1 
 tools/ChangeLog        |    4 +
 tools/Makefile.am      |   14 ++++--
 tools/symcryptrun.c    |    1 
 34 files changed, 166 insertions(+), 486 deletions(-)


Index: gnupg/ChangeLog
diff -u gnupg/ChangeLog:1.131.2.75 gnupg/ChangeLog:1.131.2.76
--- gnupg/ChangeLog:1.131.2.75	Wed May 18 12:48:06 2005
+++ gnupg/ChangeLog	Wed Jun  1 17:46:01 2005
@@ -1,3 +1,15 @@
+2005-06-01  Werner Koch  <wk at g10code.com>
+
+	* configure.ac (gl_INIT): Add gnulib stuff.
+	(fseeko, ftello, ttyname, isascii): Replaced the AC_REPLACE_FUNCS
+	by a simple check.
+	(putc_unlocked): Removed check.  Not used.
+	(strsep, mkdtemp, asprintf): Replaced checks by gnulib checks.
+	(xsize): Added will probably come handy soon.
+	(CFLAGS): Use -Wformat-security instead of
+	-Wformat-nonliteral. Add --Wno-format-y2k.
+	* gl/, gl/m4/: New.
+
 2005-05-15  Werner Koch  <wk at g10code.com>
 
 	* configure.ac: Remove option --disable-threads; require the use
Index: gnupg/Makefile.am
diff -u gnupg/Makefile.am:1.46.4.12 gnupg/Makefile.am:1.46.4.13
--- gnupg/Makefile.am:1.46.4.12	Wed Dec 15 15:15:09 2004
+++ gnupg/Makefile.am	Wed Jun  1 17:46:01 2005
@@ -19,7 +19,7 @@
 
 ## Process this file with automake to produce Makefile.in
 
-ACLOCAL_AMFLAGS = -I m4
+ACLOCAL_AMFLAGS = -I m4 -I gl/m4
 AUTOMAKE_OPTIONS = dist-bzip2
 
 EXTRA_DIST = scripts/config.rpath autogen.sh README.CVS
@@ -59,7 +59,7 @@
 tests = tests
 endif
 
-SUBDIRS = m4 intl jnlib common ${kbx} \
+SUBDIRS = m4 intl gl jnlib common ${kbx} \
  ${gpg} ${sm} ${agent} ${scd} tools po doc ${tests}
 
 dist-hook:
Index: gnupg/agent/ChangeLog
diff -u gnupg/agent/ChangeLog:1.59.2.82 gnupg/agent/ChangeLog:1.59.2.83
--- gnupg/agent/ChangeLog:1.59.2.82	Tue May 31 22:03:04 2005
+++ gnupg/agent/ChangeLog	Wed Jun  1 17:46:01 2005
@@ -1,3 +1,7 @@
+2005-06-01  Werner Koch  <wk at g10code.com>
+
+	* gpg-agent.c: Include setenv.h.
+
 2005-05-31  Werner Koch  <wk at g10code.com>
 
 	* agent.h (out_of_core): s/__inline__/inine.  Noted by Ray Link.
Index: gnupg/agent/Makefile.am
diff -u gnupg/agent/Makefile.am:1.22.2.6 gnupg/agent/Makefile.am:1.22.2.7
--- gnupg/agent/Makefile.am:1.22.2.6	Wed Jan 26 23:20:21 2005
+++ gnupg/agent/Makefile.am	Wed Jun  1 17:46:01 2005
@@ -21,7 +21,7 @@
 bin_PROGRAMS = gpg-agent
 libexec_PROGRAMS = gpg-protect-tool gpg-preset-passphrase
 
-AM_CPPFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/intl
+AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/common -I$(top_srcdir)/intl
 
 include $(top_srcdir)/am/cmacros.am
 
@@ -44,7 +44,7 @@
 	learncard.c
 
 
-gpg_agent_LDADD = ../jnlib/libjnlib.a ../common/libcommon.a \
+gpg_agent_LDADD = ../gl/libgnu.a ../jnlib/libjnlib.a ../common/libcommon.a \
                 $(LIBGCRYPT_LIBS) $(PTH_LIBS) $(LIBASSUAN_LIBS) \
 	         -lgpg-error @LIBINTL@
 
Index: gnupg/agent/gpg-agent.c
diff -u gnupg/agent/gpg-agent.c:1.31.2.39 gnupg/agent/gpg-agent.c:1.31.2.40
--- gnupg/agent/gpg-agent.c:1.31.2.39	Tue May 31 22:03:04 2005
+++ gnupg/agent/gpg-agent.c	Wed Jun  1 17:46:01 2005
@@ -48,6 +48,7 @@
 #ifdef HAVE_W32_SYSTEM
 #include "../jnlib/w32-afunix.h"
 #endif
+#include "setenv.h"
 
 
 enum cmd_and_opt_values 
Index: gnupg/autogen.sh
diff -u gnupg/autogen.sh:1.2.4.8 gnupg/autogen.sh:1.2.4.9
--- gnupg/autogen.sh:1.2.4.8	Thu Jan 13 19:00:46 2005
+++ gnupg/autogen.sh	Wed Jun  1 17:46:01 2005
@@ -152,8 +152,8 @@
 fi
 
 
-echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
-$ACLOCAL -I m4 $ACLOCAL_FLAGS
+echo "Running aclocal -I m4 -I gl/m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
+$ACLOCAL -I m4 -I gl/m4 $ACLOCAL_FLAGS
 echo "Running autoheader..."
 $AUTOHEADER
 echo "Running automake --gnu ..."
Index: gnupg/common/ChangeLog
diff -u gnupg/common/ChangeLog:1.30.2.51 gnupg/common/ChangeLog:1.30.2.52
--- gnupg/common/ChangeLog:1.30.2.51	Tue May 31 22:03:04 2005
+++ gnupg/common/ChangeLog	Wed Jun  1 17:46:01 2005
@@ -1,3 +1,13 @@
+2005-06-01  Werner Koch  <wk at g10code.com>
+
+	* Makefile.am (AM_CPPFLAGS): Added.
+
+	* util.h: Add some includes for gnulib.
+	(ttyname, isascii): Define them inline.
+	* fseeko.c, ftello.c: Removed.
+	* strsep.c, mkdtemp.c: Removed.
+	* ttyname.c, isascii.c: Removed.
+
 2005-05-31  Werner Koch  <wk at g10code.com>
 
 	* dynload.h: s/__inline__/inline/.
Index: gnupg/common/Makefile.am
diff -u gnupg/common/Makefile.am:1.15.2.14 gnupg/common/Makefile.am:1.15.2.15
--- gnupg/common/Makefile.am:1.15.2.14	Mon Apr 11 18:10:03 2005
+++ gnupg/common/Makefile.am	Wed Jun  1 17:46:01 2005
@@ -21,7 +21,9 @@
 
 noinst_LIBRARIES = libcommon.a libsimple-pwquery.a
 
-AM_CFLAGS =  $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS) $(PTH_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/gl
+
+AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS) $(PTH_CFLAGS)
 
 libcommon_a_SOURCES = \
 	util.h i18n.h \
@@ -49,18 +51,6 @@
 	estream.c estream.h
 
 
-libcommon_a_LIBADD = @LIBOBJS@
-
 libsimple_pwquery_a_SOURCES = \
 	simple-pwquery.c simple-pwquery.h asshelp.c asshelp.h
 
-libsimple_pwquery_a_LIBADD = @LIBOBJS@
-
-
-
-
-
-
-
-
-
Index: gnupg/common/fseeko.c
diff -u gnupg/common/fseeko.c:1.1.2.1 gnupg/common/fseeko.c:removed
--- gnupg/common/fseeko.c:1.1.2.1	Thu Dec  2 08:48:09 2004
+++ gnupg/common/fseeko.c	Wed Jun  1 17:46:02 2005
@@ -1,41 +0,0 @@
-/* fseeko.c - libc replacement function
- * Copyright (C) 2001 Free Software Foundation, Inc.
- *
- * This file is part of GnuPG.
- *
- * GnuPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GnuPG 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; 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 <sys/types.h>  /* Defines off_t under W32.  */
-
-int
-fseeko (FILE *stream, off_t off, int whence)
-{
-  return fseek (stream, off, whence);
-}
-
-
-
-
-
-
-
-
-
-
Index: gnupg/common/ftello.c
diff -u gnupg/common/ftello.c:1.1.2.1 gnupg/common/ftello.c:removed
--- gnupg/common/ftello.c:1.1.2.1	Thu Dec  2 08:48:09 2004
+++ gnupg/common/ftello.c	Wed Jun  1 17:46:02 2005
@@ -1,46 +0,0 @@
-/* ftello.c - libc replacement function
- * Copyright (C) 2001 Free Software Foundation, Inc.
- *
- * This file is part of GnuPG.
- *
- * GnuPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GnuPG 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; 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 <sys/types.h>  /* Defines off_t under W32.  */
-
-off_t
-ftello (FILE *stream)
-{
-  long int off;
-
-  off = ftell (stream);
-  if (off == -1)
-    return (off_t)-1;
-  return off;
-}
-
-
-
-
-
-
-
-
-
-
Index: gnupg/common/mkdtemp.c
diff -u gnupg/common/mkdtemp.c:1.2.2.2 gnupg/common/mkdtemp.c:removed
--- gnupg/common/mkdtemp.c:1.2.2.2	Mon Dec 20 17:17:24 2004
+++ gnupg/common/mkdtemp.c	Wed Jun  1 17:46:02 2005
@@ -1,97 +0,0 @@
-/* mkdtemp.c - libc replacement function
- * Copyright (C) 2001 Free Software Foundation, Inc.
- *
- * This file is part of GnuPG.
- *
- * GnuPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GnuPG 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-/* This is a replacement function for mkdtemp in case the platform
-   we're building on (like mine!) doesn't have it. */
-
-#include <config.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <gcrypt.h>
-
-#ifdef MKDIR_TAKES_ONE_ARG
-# undef mkdir
-# define mkdir(a,b) mkdir(a)
-#endif
-
-char *
-mkdtemp (char *template)
-{
-  int attempts,idx,count=0;
-  unsigned char *ch;
-
-  idx=strlen(template);
-
-  /* Walk backwards to count all the Xes */
-  while(idx>0 && template[idx-1]=='X')
-    {
-      count++;
-      idx--;
-    }
-
-  if(count==0)
-    {
-      errno=EINVAL;
-      return NULL;
-    }
-
-  ch=&template[idx];
-
-  /* Try 4 times to make the temp directory */
-  for(attempts=0;attempts<4;attempts++)
-    {
-      int remaining=count;
-      char *marker=ch;
-      unsigned char *randombits;
-
-      idx=0;
-
-      randombits = gcry_xmalloc (4*remaining);
-      gcry_create_nonce (randombits, 4*remaining);
-
-      while(remaining>1)
-	{
-	  sprintf(marker,"%02X",randombits[idx++]);
-	  marker+=2;
-	  remaining-=2;
-	}
-
-      /* Any leftover Xes?  get_random_bits rounds up to full bytes,
-         so this is safe. */
-      if(remaining>0)
-	sprintf(marker,"%X",randombits[idx]&0xF);
-
-      gcry_free (randombits);
-
-      if(mkdir(template,0700)==0)
-	break;
-    }
-
-  if(attempts==4)
-    return NULL; /* keeps the errno from mkdir, whatever it is */
-
-  return template;
-}
-
-
Index: gnupg/common/putc_unlocked.c
diff -u gnupg/common/putc_unlocked.c:1.1 gnupg/common/putc_unlocked.c:removed
--- gnupg/common/putc_unlocked.c:1.1	Thu Jan  9 13:53:52 2003
+++ gnupg/common/putc_unlocked.c	Wed Jun  1 17:46:02 2005
@@ -1,31 +0,0 @@
-/* putc_unlocked.c - Replacement for putc_unlocked.
- * Copyright (C) 2002 Free Software Foundation, Inc.
- *
- * This file is part of GnuPG.
- *
- * GnuPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GnuPG 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; 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>
-
-int
-putc_unlocked (int c, FILE *stream)
-{
-  return putc (c, stream);
-}
Index: gnupg/common/strsep.c
diff -u gnupg/common/strsep.c:1.1.2.2 gnupg/common/strsep.c:removed
--- gnupg/common/strsep.c:1.1.2.2	Fri Dec  3 19:38:23 2004
+++ gnupg/common/strsep.c	Wed Jun  1 17:46:02 2005
@@ -1,76 +0,0 @@
-/* strsep.c - Replacement for strsep().
- * Copyright (C) 1992, 1993, 1996, 1997, 1998, 1999,
- *               2004 Free Software Foundation, Inc.
- *
- * This file is part of the GNU C Library.
- *
- * The GNU C Library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * The GNU C Library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the GNU C Library; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA.  
- */
-
-/* Code taken from glibc-2.3.2/sysdeps/generic/strsep.c and slightly
-   modified for use with GnuPG. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <string.h>
-
-char *
-strsep (char **stringp, const char *delim)
-{
-  char *begin, *end;
-
-  begin = *stringp;
-  if (begin == NULL)
-    return NULL;
-
-  /* A frequent case is when the delimiter string contains only one
-     character.  Here we don't need to call the expensive `strpbrk'
-     function and instead work using `strchr'.  */
-  if (delim[0] == '\0' || delim[1] == '\0')
-    {
-      char ch = delim[0];
-
-      if (ch == '\0')
-        end = NULL;
-      else
-        {
-          if (*begin == ch)
-            end = begin;
-          else if (*begin == '\0')
-            end = NULL;
-          else
-            end = strchr (begin + 1, ch);
-        }
-    }
-  else
-    /* Find the end of the token.  */
-    end = strpbrk (begin, delim);
-
-  if (end)
-    {
-      /* Terminate the token and set *STRINGP past NUL character.  */
-      *end++ = '\0';
-      *stringp = end;
-    }
-  else
-    /* No more delimiters; this is the last token.  */
-    *stringp = NULL;
-
-  return begin;
-}
-
Index: gnupg/common/ttyname.c
diff -u gnupg/common/ttyname.c:1.1.2.1 gnupg/common/ttyname.c:removed
--- gnupg/common/ttyname.c:1.1.2.1	Wed Dec 15 15:15:09 2004
+++ gnupg/common/ttyname.c	Wed Jun  1 17:46:02 2005
@@ -1,32 +0,0 @@
-/* ttyname.c - Replacement for ttyname.
- * Copyright (C) 2004 Free Software Foundation, Inc.
- *
- * This file is part of GnuPG.
- *
- * GnuPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GnuPG 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-/* This one is a simple dummy and suitable for Dosish systems.  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-
-char *
-ttyname (int fd)
-{
-  return NULL;
-}
Index: gnupg/common/util.h
diff -u gnupg/common/util.h:1.12.2.17 gnupg/common/util.h:1.12.2.18
--- gnupg/common/util.h:1.12.2.17	Mon Apr 18 12:44:45 2005
+++ gnupg/common/util.h	Wed Jun  1 17:46:01 2005
@@ -25,7 +25,13 @@
 #include <time.h>   /* We need time_t. */
 #include <gpg-error.h> /* we need gpg-error_t. */
 
-/* to pass hash functions to libksba we need to cast it */
+/* Common GNUlib includes (-I ../gl/). */
+#include "strpbrk.h"
+#include "strsep.h"
+#include "vasprintf.h"
+
+
+/* Hash function used with libksba. */
 #define HASH_FNC ((void (*)(void *, const void*,size_t))gcry_md_write)
 
 /* get all the stuff from jnlib */
@@ -152,24 +158,26 @@
 int is_file_compressed (const char *s, int *ret_rc);
 
 
-/*-- replacement functions from funcname.c --*/
-#if !HAVE_VASPRINTF
-#include <stdarg.h>
-int vasprintf (char **result, const char *format, va_list args);
-int asprintf (char **result, const char *format, ...) JNLIB_GCC_A_PRINTF(2,3);
-#endif
-#ifndef HAVE_STRSEP
-char *strsep (char **stringp, const char *delim);
-#endif
+
+/*-- Simple replacement functions. */
 #ifndef HAVE_TTYNAME
-char *ttyname (int fd);
-#endif
-#ifndef HAVE_MKDTEMP
-char *mkdtemp (char *template);
-#endif
+/* Systems without ttyname (W32) will merely return NULL. */
+static inline char *
+ttyname (int fd) 
+{
+  return NULL
+};
+#endif /* !HAVE_TTYNAME */
 
+#ifndef HAVE_ISASCII
+static inline int 
+isascii (int c)
+{
+  return (((c) & ~0x7f) == 0);
+}
+#endif /* !HAVE_ISASCII */
 
-/*-- some macros to replace ctype ones and avoid locale problems --*/
+/*-- Macros to replace ctype ones to avoid locale problems. --*/
 #define spacep(p)   (*(p) == ' ' || *(p) == '\t')
 #define digitp(p)   (*(p) >= '0' && *(p) <= '9')
 #define hexdigitp(a) (digitp (a)                     \
Index: gnupg/common/xasprintf.c
diff -u gnupg/common/xasprintf.c:1.1.2.2 gnupg/common/xasprintf.c:1.1.2.3
--- gnupg/common/xasprintf.c:1.1.2.2	Fri Feb 25 17:14:55 2005
+++ gnupg/common/xasprintf.c	Wed Jun  1 17:46:01 2005
@@ -43,7 +43,7 @@
   return p;
 }
 
-/* Same as above bit return NULL on memory failure.  */
+/* Same as above but return NULL on memory failure.  */
 char *
 xtryasprintf (const char *fmt, ...)
 {
Index: gnupg/configure.ac
diff -u gnupg/configure.ac:1.36.2.88 gnupg/configure.ac:1.36.2.89
--- gnupg/configure.ac:1.36.2.88	Wed May 18 12:48:06 2005
+++ gnupg/configure.ac	Wed Jun  1 17:46:01 2005
@@ -337,6 +337,7 @@
 AC_CHECK_TOOL(AR, ar, :)
 AC_PATH_PROG(PERL,"perl")
 AC_ISC_POSIX
+gl_EARLY
 AC_SYS_LARGEFILE
 AC_CHECK_PROG(DOCBOOK_TO_MAN, docbook-to-man, yes, no)
 AM_CONDITIONAL(HAVE_DOCBOOK_TO_MAN, test "$ac_cv_prog_DOCBOOK_TO_MAN" = yes)
@@ -794,23 +795,21 @@
 AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime)
 AC_CHECK_FUNCS(atexit raise getpagesize strftime nl_langinfo setlocale)
 AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask rand pipe stat getaddrinfo)
+AC_CHECK_FUNCS(fseeko ftello ttyname isascii)
 
 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
 
+# gnulib checks
+gl_SOURCE_BASE(gl)
+gl_M4_BASE(gl/m4)
+gl_MODULES(setenv strsep mkdtemp vasprintf xsize)
+gl_INIT
+
 # These are needed by libjnlib - fixme: we should have macros for them
 AC_CHECK_FUNCS(memicmp stpcpy strlwr strtoul memmove stricmp strtol)
 AC_CHECK_FUNCS(getrusage setrlimit stat setlocale)
 AC_CHECK_FUNCS(flockfile funlockfile fopencookie funopen)
 
-AC_REPLACE_FUNCS(vasprintf)
-AC_REPLACE_FUNCS(mkdtemp)
-AC_REPLACE_FUNCS(fseeko ftello)
-AC_REPLACE_FUNCS(isascii)
-AC_REPLACE_FUNCS(putc_unlocked)
-AC_REPLACE_FUNCS(strsep)
-AC_REPLACE_FUNCS(ttyname)
-
-
 
 #
 # check for gethrtime and run a testprogram to see whether
@@ -989,7 +988,7 @@
 if test "$GCC" = yes; then
     if test "$USE_MAINTAINER_MODE" = "yes"; then
         CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
-        CFLAGS="$CFLAGS -Wformat-nonliteral"
+        CFLAGS="$CFLAGS -Wno-format-y2k -Wformat-security"
     else
         CFLAGS="$CFLAGS -Wall"
     fi
@@ -1126,6 +1125,7 @@
 Makefile
 po/Makefile.in
 intl/Makefile
+gl/Makefile
 jnlib/Makefile
 common/Makefile
 kbx/Makefile
Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.372.2.54 gnupg/g10/ChangeLog:1.372.2.55
--- gnupg/g10/ChangeLog:1.372.2.54	Tue Dec 21 11:03:00 2004
+++ gnupg/g10/ChangeLog	Wed Jun  1 17:46:01 2005
@@ -1,3 +1,8 @@
+2005-06-01  Werner Koch  <wk at g10code.com>
+
+	* mkdtemp.c: Removed.
+	* exec.c: Include mkdtemp.h
+
 2004-12-21  Werner Koch  <wk at g10code.com>
 
 	* gpgv.c, g10.c (main): Use default_hoemdir ().
Index: gnupg/g10/Makefile.am
diff -u gnupg/g10/Makefile.am:1.75.2.11 gnupg/g10/Makefile.am:1.75.2.12
--- gnupg/g10/Makefile.am:1.75.2.11	Sat Dec 18 11:22:09 2004
+++ gnupg/g10/Makefile.am	Wed Jun  1 17:46:01 2005
@@ -21,14 +21,14 @@
 
 EXTRA_DIST = options.skel
 
-AM_CPPFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/include \
-              -I$(top_srcdir)/intl 
+AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/common \
+              -I$(top_srcdir)/include -I$(top_srcdir)/intl 
 
 include $(top_srcdir)/am/cmacros.am
 
 AM_CFLAGS = $(LIBGCRYPT_CFLAGS)
 
-needed_libs = ../common/libcommon.a ../jnlib/libjnlib.a
+needed_libs = ../gl/libgnu.a ../common/libcommon.a ../jnlib/libjnlib.a
 
 bin_PROGRAMS = gpg2 gpgv2
 
Index: gnupg/g10/exec.c
diff -u gnupg/g10/exec.c:1.13.2.2 gnupg/g10/exec.c:1.13.2.3
--- gnupg/g10/exec.c:1.13.2.2	Tue Sep 23 19:48:30 2003
+++ gnupg/g10/exec.c	Wed Jun  1 17:46:01 2005
@@ -39,6 +39,7 @@
 #include "i18n.h"
 #include "iobuf.h"
 #include "util.h"
+#include "mkdtemp.h"
 #include "exec.h"
 
 #ifdef NO_EXEC
@@ -55,10 +56,6 @@
 
 #else /* ! NO_EXEC */
 
-#ifndef HAVE_MKDTEMP
-char *mkdtemp(char *template);
-#endif
-
 #if defined (_WIN32)
 /* This is a nicer system() for windows that waits for programs to
    return before returning control to the caller.  I hate helpful
Index: gnupg/g10/mkdtemp.c
diff -u gnupg/g10/mkdtemp.c:1.3.4.1 gnupg/g10/mkdtemp.c:removed
--- gnupg/g10/mkdtemp.c:1.3.4.1	Wed Jun 18 21:55:55 2003
+++ gnupg/g10/mkdtemp.c	Wed Jun  1 17:46:02 2005
@@ -1,98 +0,0 @@
-/* mkdtemp.c - libc replacement function
- * Copyright (C) 2001 Free Software Foundation, Inc.
- *
- * This file is part of GnuPG.
- *
- * GnuPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GnuPG 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-/* This is a replacement function for mkdtemp in case the platform
-   we're building on (like mine!) doesn't have it. */
-
-#include <config.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "types.h"
-#include "cipher.h"
-
-#ifdef MKDIR_TAKES_ONE_ARG
-# undef mkdir
-# define mkdir(a,b) mkdir(a)
-#endif
-
-char *mkdtemp(char *template)
-{
-  unsigned int attempts,idx,count=0;
-  byte *ch;
-
-  idx=strlen(template);
-
-  /* Walk backwards to count all the Xes */
-  while(idx>0 && template[idx-1]=='X')
-    {
-      count++;
-      idx--;
-    }
-
-  if(count==0)
-    {
-      errno=EINVAL;
-      return NULL;
-    }
-
-  ch=&template[idx];
-
-  /* Try 4 times to make the temp directory */
-  for(attempts=0;attempts<4;attempts++)
-    {
-      unsigned int remaining=count;
-      char *marker=ch;
-      byte *randombits;
-
-      idx=0;
-
-      /* Using really random bits is probably overkill here.  The
-	 worst thing that can happen with a directory name collision
-	 is that the function will return an error. */
-
-      randombits=get_random_bits(4*remaining,0,0);
-
-      while(remaining>1)
-	{
-	  sprintf(marker,"%02X",randombits[idx++]);
-	  marker+=2;
-	  remaining-=2;
-	}
-
-      /* Any leftover Xes?  get_random_bits rounds up to full bytes,
-         so this is safe. */
-      if(remaining>0)
-	sprintf(marker,"%X",randombits[idx]&0xF);
-
-      xfree (randombits);
-
-      if(mkdir(template,0700)==0)
-	break;
-    }
-
-  if(attempts==4)
-    return NULL; /* keeps the errno from mkdir, whatever it is */
-
-  return template;
-}
Index: gnupg/kbx/ChangeLog
diff -u gnupg/kbx/ChangeLog:1.15.2.11 gnupg/kbx/ChangeLog:1.15.2.12
--- gnupg/kbx/ChangeLog:1.15.2.11	Sat Dec 18 11:22:09 2004
+++ gnupg/kbx/ChangeLog	Wed Jun  1 17:46:01 2005
@@ -1,3 +1,10 @@
+2005-06-01  Werner Koch  <wk at g10code.com>
+
+	* keybox-file.c (ftello) [!HAVE_FSEEKO]: New replacement
+	function.  Copied from ../common/ftello.c.
+	* keybox-update.c (fseeko) [!HAVE_FSEEKO]: New replacement
+	function.  Copied from ../common/iobuf.c.
+
 2004-12-18  Werner Koch  <wk at g10code.com>
 
 	* keybox-defs.h (map_assuan_err): Define in terms of
Index: gnupg/kbx/Makefile.am
diff -u gnupg/kbx/Makefile.am:1.8.2.3 gnupg/kbx/Makefile.am:1.8.2.4
--- gnupg/kbx/Makefile.am:1.8.2.3	Thu Dec  2 08:48:08 2004
+++ gnupg/kbx/Makefile.am	Wed Jun  1 17:46:01 2005
@@ -23,7 +23,7 @@
 INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\"
 
 EXTRA_DIST = mkerrors
-AM_CPPFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/intl \
+AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/common -I$(top_srcdir)/intl \
 	       $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS)
 
 noinst_LIBRARIES = libkeybox.a
@@ -45,6 +45,7 @@
 
 # Note that libcommon is only required to resolve the LIBOBJS.
 kbxutil_SOURCES = kbxutil.c $(common_sources)
-kbxutil_LDADD   = ../jnlib/libjnlib.a  $(KSBA_LIBS) $(LIBGCRYPT_LIBS) \
+kbxutil_LDADD   = ../gl/libgnu.a ../jnlib/libjnlib.a  \
+	          $(KSBA_LIBS) $(LIBGCRYPT_LIBS) \
                   -lgpg-error $(LIBINTL) ../common/libcommon.a
 
Index: gnupg/kbx/keybox-file.c
diff -u gnupg/kbx/keybox-file.c:1.5.2.1 gnupg/kbx/keybox-file.c:1.5.2.2
--- gnupg/kbx/keybox-file.c:1.5.2.1	Mon Apr 26 10:09:22 2004
+++ gnupg/kbx/keybox-file.c	Wed Jun  1 17:46:01 2005
@@ -27,6 +27,22 @@
 
 #include "keybox-defs.h"
 
+
+#if !defined(HAVE_FTELLO) && !defined(ftello)
+static off_t
+ftello (FILE *stream)
+{
+  long int off;
+
+  off = ftell (stream);
+  if (off == -1)
+    return (off_t)-1;
+  return off;
+}
+#endif /* !defined(HAVE_FTELLO) && !defined(ftello) */
+
+
+
 /* Read a block at the current postion and return it in r_blob.
    r_blob may be NULL to simply skip the current block */
 int
Index: gnupg/kbx/keybox-update.c
diff -u gnupg/kbx/keybox-update.c:1.4.2.4 gnupg/kbx/keybox-update.c:1.4.2.5
--- gnupg/kbx/keybox-update.c:1.4.2.4	Thu Dec  2 08:48:08 2004
+++ gnupg/kbx/keybox-update.c	Wed Jun  1 17:46:01 2005
@@ -31,6 +31,38 @@
 #define EXTSEP_S "."
 
 
+#if !defined(HAVE_FSEEKO) && !defined(fseeko)
+
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+#ifndef LONG_MAX
+# define LONG_MAX ((long) ((unsigned long) -1 >> 1))
+#endif
+#ifndef LONG_MIN
+# define LONG_MIN (-1 - LONG_MAX)
+#endif
+
+/****************
+ * A substitute for fseeko, for hosts that don't have it.
+ */
+static int
+fseeko (FILE * stream, off_t newpos, int whence)
+{
+  while (newpos != (long) newpos)
+    {
+      long pos = newpos < 0 ? LONG_MIN : LONG_MAX;
+      if (fseek (stream, pos, whence) != 0)
+	return -1;
+      newpos -= pos;
+      whence = SEEK_CUR;
+    }
+  return fseek (stream, (long) newpos, whence);
+}
+#endif /* !defined(HAVE_FSEEKO) && !defined(fseeko) */
+
+
+
 static int
 create_tmp_file (const char *template,
                  char **r_bakfname, char **r_tmpfname, FILE **r_fp)
Index: gnupg/scd/ChangeLog
diff -u gnupg/scd/ChangeLog:1.25.2.82 gnupg/scd/ChangeLog:1.25.2.83
--- gnupg/scd/ChangeLog:1.25.2.82	Tue May 31 22:03:03 2005
+++ gnupg/scd/ChangeLog	Wed Jun  1 17:46:01 2005
@@ -1,3 +1,7 @@
+2005-06-01  Werner Koch  <wk at g10code.com>
+
+	* scdaemon.c: Include mkdtemp.h.
+
 2005-05-31  Werner Koch  <wk at g10code.com>
 
 	* tlv.c [GNUPG_MAJOR_VERSION==1]: Define constants instead of
Index: gnupg/scd/Makefile.am
diff -u gnupg/scd/Makefile.am:1.15.2.14 gnupg/scd/Makefile.am:1.15.2.15
--- gnupg/scd/Makefile.am:1.15.2.14	Mon May 23 22:18:13 2005
+++ gnupg/scd/Makefile.am	Wed Jun  1 17:46:01 2005
@@ -23,7 +23,7 @@
 pkglib_PROGRAMS = pcsc-wrapper
 endif
 
-AM_CPPFLAGS = -I$(top_srcdir)/intl -I$(top_srcdir)/common
+AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/common
 
 include $(top_srcdir)/am/cmacros.am
 
@@ -43,7 +43,7 @@
 	app.c app-common.h app-help.c $(card_apps)
 
 
-scdaemon_LDADD = ../jnlib/libjnlib.a ../common/libcommon.a \
+scdaemon_LDADD = ../gl/libgnu.a ../jnlib/libjnlib.a ../common/libcommon.a \
 	$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(PTH_LIBS) $(LIBASSUAN_LIBS) \
 	$(LIBUSB_LIBS) -lgpg-error $(LIBINTL) $(DL_LIBS)
 
Index: gnupg/scd/scdaemon.c
diff -u gnupg/scd/scdaemon.c:1.12.2.29 gnupg/scd/scdaemon.c:1.12.2.30
--- gnupg/scd/scdaemon.c:1.12.2.29	Sat May 21 20:49:00 2005
+++ gnupg/scd/scdaemon.c	Wed Jun  1 17:46:01 2005
@@ -51,7 +51,7 @@
 #include "../jnlib/w32-afunix.h"
 #endif
 #include "ccid-driver.h"
-
+#include "mkdtemp.h"
 
 enum cmd_and_opt_values 
 { aNull = 0,
Index: gnupg/sm/ChangeLog
diff -u gnupg/sm/ChangeLog:1.101.2.94 gnupg/sm/ChangeLog:1.101.2.95
--- gnupg/sm/ChangeLog:1.101.2.94	Thu Apr 21 11:33:06 2005
+++ gnupg/sm/ChangeLog	Wed Jun  1 17:46:00 2005
@@ -1,3 +1,7 @@
+2005-06-01  Werner Koch  <wk at g10code.com>
+
+	* misc.c: Include setenv.h.
+
 2005-04-21  Werner Koch  <wk at g10code.com>
 
 	* gpgsm.c: New options --{enable,disable}-trusted-cert-crl-check.
Index: gnupg/sm/Makefile.am
diff -u gnupg/sm/Makefile.am:1.27.2.6 gnupg/sm/Makefile.am:1.27.2.7
--- gnupg/sm/Makefile.am:1.27.2.6	Thu Apr 21 09:16:41 2005
+++ gnupg/sm/Makefile.am	Wed Jun  1 17:46:00 2005
@@ -24,7 +24,7 @@
 AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBASSUAN_CFLAGS) $(KSBA_CFLAGS) \
             $(PTH_CFLAGS)
 
-AM_CPPFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/intl 
+AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/common -I$(top_srcdir)/intl 
 include $(top_srcdir)/am/cmacros.am
 
 
@@ -52,7 +52,7 @@
 	certreqgen.c 
 
 
-gpgsm_LDADD = ../jnlib/libjnlib.a ../kbx/libkeybox.a	\
+gpgsm_LDADD = ../gl/libgnu.a ../jnlib/libjnlib.a ../kbx/libkeybox.a	\
               ../common/libcommon.a \
               $(LIBGCRYPT_LIBS)  $(KSBA_LIBS) $(LIBASSUAN_LIBS) -lgpg-error \
 	      $(LIBINTL) $(PTH_LIBS)
Index: gnupg/sm/misc.c
diff -u gnupg/sm/misc.c:1.3.2.4 gnupg/sm/misc.c:1.3.2.5
--- gnupg/sm/misc.c:1.3.2.4	Tue Dec  7 12:21:40 2004
+++ gnupg/sm/misc.c	Wed Jun  1 17:46:00 2005
@@ -31,6 +31,7 @@
 
 #include "gpgsm.h"
 #include "i18n.h"
+#include "setenv.h"
 
 /* Setup the environment so that the pinentry is able to get all
    required information.  This is used prior to an exec of the
Index: gnupg/tools/ChangeLog
diff -u gnupg/tools/ChangeLog:1.25.2.77 gnupg/tools/ChangeLog:1.25.2.78
--- gnupg/tools/ChangeLog:1.25.2.77	Tue May 31 22:03:03 2005
+++ gnupg/tools/ChangeLog	Wed Jun  1 17:46:00 2005
@@ -1,3 +1,7 @@
+2005-06-01  Werner Koch  <wk at g10code.com>
+
+	* symcryptrun.c: Include mkdtemp.h. 
+
 2005-05-31  Werner Koch  <wk at g10code.com>
 
 	* watchgnupg.c: Make sure that PF_LCOAL and AF_LOCAL are defines.
Index: gnupg/tools/Makefile.am
diff -u gnupg/tools/Makefile.am:1.31.2.15 gnupg/tools/Makefile.am:1.31.2.16
--- gnupg/tools/Makefile.am:1.31.2.15	Sat May 28 15:43:21 2005
+++ gnupg/tools/Makefile.am	Wed Jun  1 17:46:00 2005
@@ -21,7 +21,7 @@
              rfc822parse.c rfc822parse.h gpgparsemail.c \
 	     addgnupghome gpgsm-gencert.sh
 
-AM_CPPFLAGS =  -I$(top_srcdir)/intl -I$(top_srcdir)/common
+AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/common
 include $(top_srcdir)/am/cmacros.am
 
 AM_CFLAGS = $(GPG_ERROR_CFLAGS) $(LIBASSUAN_CFLAGS)
@@ -43,19 +43,23 @@
 
 gpgconf_SOURCES = gpgconf.c gpgconf.h gpgconf-comp.c no-libgcrypt.c
 
-gpgconf_LDADD = ../jnlib/libjnlib.a ../common/libcommon.a @LIBINTL@
+gpgconf_LDADD = ../gl/libgnu.a ../jnlib/libjnlib.a \
+                ../common/libcommon.a @LIBINTL@
 
 symcryptrun_SOURCES = symcryptrun.c
-symcryptrun_LDADD = $(LIBUTIL_LIBS) ../jnlib/libjnlib.a ../common/libcommon.a \
+symcryptrun_LDADD = $(LIBUTIL_LIBS) ../gl/libgnu.a ../jnlib/libjnlib.a \
+                    ../common/libcommon.a \
 		    ../common/libsimple-pwquery.a $(LIBGCRYPT_LIBS) \
 		    $(GPG_ERROR_LIBS) $(LIBINTL)
 
 watchgnupg_SOURCES = watchgnupg.c 
 
 gpg_connect_agent_SOURCES = gpg-connect-agent.c no-libgcrypt.c
-gpg_connect_agent_LDADD = ../jnlib/libjnlib.a ../common/libcommon.a \
+gpg_connect_agent_LDADD = ../gl/libgnu.a ../jnlib/libjnlib.a \
+                          ../common/libcommon.a \
                           $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) $(LIBINTL)
 
 gpgkey2ssh_SOURCES = gpgkey2ssh.c
 gpgkey2ssh_CFLAGS = $(LIBGCRYPT_CFLAGS) $(GPG_ERROR_CFLAGS)
-gpgkey2ssh_LDADD = ../common/libcommon.a $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS)
+gpgkey2ssh_LDADD = ../gl/libgnu.a ../common/libcommon.a \
+                   $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS)
Index: gnupg/tools/symcryptrun.c
diff -u gnupg/tools/symcryptrun.c:1.1.2.8 gnupg/tools/symcryptrun.c:1.1.2.9
--- gnupg/tools/symcryptrun.c:1.1.2.8	Thu Apr 21 12:07:41 2005
+++ gnupg/tools/symcryptrun.c	Wed Jun  1 17:46:00 2005
@@ -82,6 +82,7 @@
 #define JNLIB_NEED_LOG_LOGV
 #include "i18n.h"
 #include "../common/util.h"
+#include "mkdtemp.h"
 
 /* FIXME: Bah.  For spwq_secure_free.  */
 #define SIMPLE_PWQUERY_IMPLEMENTATION 1




More information about the Gnupg-commits mailing list