Re: libassuan troubles

Michael Nottebrock <[email protected]>
Newsgroups gmane.comp.encryption.gpg.gpa.devel
Message-ID <[email protected]>
On Monday 19 April 2004 22:17, I wrote:

> dirmngr does compile without any problems, but pinentry, even the latest
> version from CVS, still contains a bogus check for fopencookie and bails
> during configure stage if it isn't found.

I've checked out pinentry from CVS again and hacked at it until it compiled.

Diff attached.

-- 
   ,_,   | Michael Nottebrock               | [email protected]
 (/^ ^\) | FreeBSD - The Power to Serve     | http://www.freebsd.org
   \u/   | K Desktop Environment on FreeBSD | http://freebsd.kde.org

_______________________________________________
Gpa-dev mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gpa-dev
pinentry.diff (text/x-diff, 5.1 KB)
Index: autogen.sh
===================================================================
RCS file: /cvs/aegypten/pinentry/autogen.sh,v
retrieving revision 1.4
diff -u -r1.4 autogen.sh
--- autogen.sh	19 Apr 2004 14:13:27 -0000	1.4
+++ autogen.sh	19 Apr 2004 21:45:12 -0000
@@ -18,7 +18,7 @@
 }
 
 check_version () {
-    if [ $(( `("$1" --version || echo "0") | cvtver` >= $2 )) == 1 ]; then
+    if [ $(( `("$1" --version || echo "0") | cvtver` >= $2 )) = 1 ]; then
        return 0
     fi
     echo "**Error**: "\`$1\'" not installed or too old." >&2
Index: configure.ac
===================================================================
RCS file: /cvs/aegypten/pinentry/configure.ac,v
retrieving revision 1.30
diff -u -r1.30 configure.ac
--- configure.ac	2 Jan 2004 15:42:39 -0000	1.30
+++ configure.ac	19 Apr 2004 21:45:38 -0000
@@ -62,13 +62,21 @@
 AC_CHECK_FUNCS(seteuid stpcpy mmap)
 GNUPG_CHECK_MLOCK
 
-dnl Checks for libassuan.
-AC_CHECK_FUNCS(fopencookie,,[
-    AC_MSG_ERROR([[
+# Check for funopen
+AC_CHECK_FUNCS(funopen)
+if test $ac_cv_func_funopen != yes; then
+    # No funopen but we can implement that in terms of fopencookie.
+    AC_CHECK_FUNCS(fopencookie)
+    if test $ac_cv_func_fopencookie = yes; then
+        AC_LIBOBJ([funopen])
+    else
+        AC_MSG_WARN([
 ***
-*** fopencookie(3) is needed to build this package.
-*** We will provide an replacement in a later release.
-***]])])
+*** No implementation of fopencookie or funopen available.
+*** The assuan_get_data_fp feature won't work.
+***])
+    fi
+fi
 
 dnl Checks for libsecmem.
 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
Index: assuan/assuan-handler.c
===================================================================
RCS file: /cvs/aegypten/pinentry/assuan/assuan-handler.c,v
retrieving revision 1.2
diff -u -r1.2 assuan-handler.c
--- assuan/assuan-handler.c	4 Mar 2002 02:26:58 -0000	1.2
+++ assuan/assuan-handler.c	19 Apr 2004 21:45:43 -0000
@@ -28,6 +28,14 @@
 #define spacep(p)  (*(p) == ' ' || *(p) == '\t')
 #define digitp(a) ((a) >= '0' && (a) <= '9')
 
+typedef struct
+{
+  ssize_t (*read)(void*,char*,size_t);
+  ssize_t (*write)(void*,const char*,size_t);
+  int (*seek)(void*,off_t*,int);
+  int (*close)(void*);
+} _IO_cookie_io_functions_t;
+typedef _IO_cookie_io_functions_t cookie_io_functions_t;
 
 static int
 dummy_handler (ASSUAN_CONTEXT ctx, char *line)
@@ -604,21 +612,21 @@
 FILE *
 assuan_get_data_fp (ASSUAN_CONTEXT ctx)
 {
-  cookie_io_functions_t cookie_fnc;
-
+#if defined (HAVE_FOPENCOOKIE) || defined (HAVE_FUNOPEN)
   if (ctx->outbound.data.fp)
     return ctx->outbound.data.fp;
-  
-  cookie_fnc.read = NULL; 
-  cookie_fnc.write = _assuan_cookie_write_data;
-  cookie_fnc.seek = NULL;
-  cookie_fnc.close = _assuan_cookie_write_flush;
 
-  ctx->outbound.data.fp = fopencookie (ctx, "wb", cookie_fnc);
+
+  ctx->outbound.data.fp = funopen (ctx, 0,
+                                   _assuan_cookie_write_data,
+                                   0, _assuan_cookie_write_flush);
   ctx->outbound.data.error = 0;
   return ctx->outbound.data.fp;
+#else
+  errno = ENOSYS;
+  return NULL;
+#endif
 }
-
 
 /* Set the text used for the next OK reponse.  This string is
    automatically reset to NULL after the next command. */
Index: assuan/assuan-socket-connect.c
===================================================================
RCS file: /cvs/aegypten/pinentry/assuan/assuan-socket-connect.c,v
retrieving revision 1.1
diff -u -r1.1 assuan-socket-connect.c
--- assuan/assuan-socket-connect.c	24 Jan 2002 09:08:28 -0000	1.1
+++ assuan/assuan-socket-connect.c	19 Apr 2004 21:45:50 -0000
@@ -23,6 +23,7 @@
 #include <stddef.h>
 #include <stdio.h>
 #include <errno.h>
+#include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <unistd.h>
Index: assuan/assuan-socket-server.c
===================================================================
RCS file: /cvs/aegypten/pinentry/assuan/assuan-socket-server.c,v
retrieving revision 1.2
diff -u -r1.2 assuan-socket-server.c
--- assuan/assuan-socket-server.c	29 Mar 2002 21:21:20 -0000	1.2
+++ assuan/assuan-socket-server.c	19 Apr 2004 21:45:50 -0000
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
+#include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <unistd.h>
Index: assuan/mkerrors
===================================================================
RCS file: /cvs/aegypten/pinentry/assuan/mkerrors,v
retrieving revision 1.1
diff -u -r1.1 mkerrors
--- assuan/mkerrors	24 Jan 2002 09:08:28 -0000	1.1
+++ assuan/mkerrors	19 Apr 2004 21:45:50 -0000
@@ -68,4 +68,4 @@
   return s;
 }
 
-EOF
\ No newline at end of file
+EOF
Index: secmem/secmem.c
===================================================================
RCS file: /cvs/aegypten/pinentry/secmem/secmem.c,v
retrieving revision 1.2
diff -u -r1.2 secmem.c
--- secmem/secmem.c	22 Dec 2003 10:48:32 -0000	1.2
+++ secmem/secmem.c	19 Apr 2004 21:46:01 -0000
@@ -55,6 +55,12 @@
     double g;
 } PROPERLY_ALIGNED_TYPE;
 
+#ifndef HAVE_ULONG_TYPEDEF
+  #undef ulong      /* maybe there is a macro with this name */
+  typedef unsigned long ulong;
+  #define HAVE_ULONG_TYPEDEF
+#endif
+
 #define log_error log_info
 #define log_bug log_fatal
signature.asc (application/pgp-signature, 187 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQBAhEz/Xhc68WspdLARAnW2AJ42A+/gB6gLJIsrU9CK5pnkhZMF7wCeJxXR
+84Uj83vVQ40OVYbEHGq6Co=
=YuD1
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.