small patches for libksba-1.0.1 and libassuan-1.0.1

Peter O'Gorman gnupg-devel at mlists.thewrittenword.com
Mon Apr 30 23:47:30 CEST 2007


Hi,
We had to patch libksba to get it to build on hpux and aix4.3 with the
native compilers.

ksba
On AIX-4.3, xlc complains if enums end in a comma. HPUX does not like
doing pointer math with void* pointers.

assuan
We need to define _XOPEN_SOURCE etc for irix and Tru64. There was
another pointer math issue, and Tru64 4.0D does not have snprintf,
rather than using trio or another replacement, I just used sprintf
and made sure that the result would be small enough.

Thanks,
Peter
-------------- next part --------------
Index: src/crl.c
===================================================================
--- src/crl.c.orig	2006-08-31 07:57:24.000000000 +0000
+++ src/crl.c	2007-04-30 16:12:29.791318000 +0000
@@ -59,7 +59,7 @@
                            crl->hashbuf.buffer, crl->hashbuf.used);
           crl->hashbuf.used = 0;
         }
-      buffer += n;
+      buffer = (char*)buffer + n;
       length -= n;
     }
 }
Index: src/ksba.h
===================================================================
--- src/ksba.h.orig	2006-08-31 14:57:54.000000000 +0000
+++ src/ksba.h	2007-04-30 16:17:32.723334000 +0000
@@ -78,7 +78,7 @@
     KSBA_SR_DETACHED_DATA = 8,
     KSBA_SR_BEGIN_ITEMS = 9,
     KSBA_SR_GOT_ITEM = 10,
-    KSBA_SR_END_ITEMS = 11,
+    KSBA_SR_END_ITEMS = 11
   } 
 ksba_stop_reason_t;
 typedef ksba_stop_reason_t KsbaStopReason _KSBA_DEPRECATED;
Index: src/asn1-parse.y
===================================================================
--- src/asn1-parse.y.orig	2006-06-20 06:40:10.000000000 +0000
+++ src/asn1-parse.y	2007-04-30 16:23:35.351631000 +0000
@@ -54,7 +54,7 @@
 /* constants used in the grammar */
 enum {
   CONST_EXPLICIT = 1,
-  CONST_IMPLICIT,
+  CONST_IMPLICIT
 };
 
 struct parser_control_s {

-------------- next part --------------
Index: configure.ac
===================================================================
--- configure.ac.orig	2007-04-30 21:07:54.924432000 +0000
+++ configure.ac	2007-04-30 21:07:58.936707000 +0000
@@ -98,7 +95,7 @@
         have_dosish_system=yes
         have_w32_system=yes
         ;;
-    *-solaris*)
+    *-solaris*|*-irix*|*-osf*)
 	AC_DEFINE(_XOPEN_SOURCE, 500, Activate extensions on Solaris)
 	AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Activate extensions on Solaris)
 	AC_DEFINE(__EXTENSIONS__, 1, Activate extensions on Solaris)
@@ -192,7 +189,7 @@
 
 # Checks for library functions.
 
-AC_CHECK_FUNCS(flockfile funlockfile)
+AC_CHECK_FUNCS(flockfile funlockfile snprintf)
 
 # Check for funopen
 AC_CHECK_FUNCS(funopen)
Index: src/assuan-uds.c
===================================================================
--- src/assuan-uds.c.orig	2007-04-30 21:07:54.972677000 +0000
+++ src/assuan-uds.c	2007-04-30 21:11:25.044447000 +0000
@@ -150,7 +150,7 @@
   if (len > buflen) /* We have more than the user requested.  */
     len = buflen;
 
-  memcpy (buf, ctx->uds.buffer + ctx->uds.bufferoffset, len);
+  memcpy (buf, (char*)ctx->uds.buffer + ctx->uds.bufferoffset, len);
   ctx->uds.buffersize -= len;
   assert (ctx->uds.buffersize >= 0);
   ctx->uds.bufferoffset += len;
@@ -206,7 +206,12 @@
 
   /* We need to send some real data so that a read won't return 0
      which will be taken as an EOF.  It also helps with debugging. */ 
+#if HAVE_SNPRINTF
   snprintf (buffer, sizeof(buffer)-1, "# descriptor %d is in flight\n", fd);
+#else
+  /* The following can not exceed 79 chars, even if fd is ULLONG_MAX */
+  sprintf(buffer,"# descriptor %d is in flight\n", fd);
+#endif
   buffer[sizeof(buffer)-1] = 0;
 
   memset (&msg, 0, sizeof (msg));
Index: src/assuan-pipe-connect.c
===================================================================
--- src/assuan-pipe-connect.c.orig	2007-04-30 21:07:54.996791000 +0000
+++ src/assuan-pipe-connect.c	2007-04-30 21:26:09.018369000 +0000
@@ -338,10 +338,20 @@
 
           execv (name, (char *const *) argv); 
           /* oops - use the pipe to tell the parent about it */
+#if HAVE_SNPRINTF
           snprintf (errbuf, sizeof(errbuf)-1,
                     "ERR %d can't exec `%s': %.50s\n",
                     _assuan_error (ASSUAN_Problem_Starting_Server),
                     name, strerror (errno));
+#else
+          /* errbuf is 512 bytes, the maximum length of the following
+           * string must be < 511, in reality, it will always be
+           * less than 128 bytes */
+          sprintf (errbuf,
+                    "ERR %d can't exec `%.50s': %.50s\n",
+                    _assuan_error (ASSUAN_Problem_Starting_Server),
+                    name, strerror (errno));
+#endif
           errbuf[sizeof(errbuf)-1] = 0;
           writen (1, errbuf, strlen (errbuf));
           _exit (4);
@@ -520,10 +530,20 @@
 
           execv (name, (char *const *) argv); 
           /* oops - use the pipe to tell the parent about it */
+#if HAVE_SNPRINTF
           snprintf (errbuf, sizeof(errbuf)-1,
                     "ERR %d can't exec `%s': %.50s\n",
                     _assuan_error (ASSUAN_Problem_Starting_Server),
                     name, strerror (errno));
+#else
+          /* errbuf is 512 bytes, the maximum length of the following
+           * string must be < 511, in reality, it will always be
+           * less than 128 bytes */
+          sprintf (errbuf,
+                    "ERR %d can't exec `%.50s': %.50s\n",
+                    _assuan_error (ASSUAN_Problem_Starting_Server),
+                    name, strerror (errno));
+#endif
           errbuf[sizeof(errbuf)-1] = 0;
           writen (fds[1], errbuf, strlen (errbuf));
           _exit (4);


More information about the Gnupg-devel mailing list