Re: [Tigervnc-devel] [PATCH] Workaround for older gnutls

2010-09-30 Thread Martin Koegler
On Wed, Sep 29, 2010 at 05:37:14PM -0500, DRC wrote:
> On 9/20/10 3:42 AM, Adam Tkac wrote:
> > Which version of autoconf are you using?
> 
> The version that ships with RHEL 4 (2.59).
> 
> The attached patch seems to make things work properly.  Question for
> Martin:  Is the "while(0)" really necessary?  I don't understand why the
> macro can't just be:
> 
> #define gnutls_transport_set_global_errno(A) errno=(A)

For the usage of gnutls_transport_set_global_errno in tigervnc, it
does not matter - but such a define can not be used on any place,
where you could call a real function.

The "do { ... } while (0)" allows a define to be used like a real
function.

Regards,
Martin Kögler

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] Workaround for older gnutls

2010-09-29 Thread DRC
On 9/20/10 3:42 AM, Adam Tkac wrote:
> Which version of autoconf are you using?

The version that ships with RHEL 4 (2.59).

The attached patch seems to make things work properly.  Question for
Martin:  Is the "while(0)" really necessary?  I don't understand why the
macro can't just be:

#define gnutls_transport_set_global_errno(A) errno=(A)
Index: configure.ac
===
--- configure.ac(revision 4145)
+++ configure.ac(working copy)
@@ -78,6 +78,8 @@
AC_CHECK_LIB([gnutls], [gnutls_global_init],
 [GNUTLS_LIBS='-lgnutls'
  AC_DEFINE([HAVE_GNUTLS], 1, [Is gnutls present? ])])
+   AC_CHECK_LIB([gnutls], [gnutls_transport_set_global_errno], [],
+[AC_DEFINE([HAVE_OLD_GNUTLS], 1, [Does gnutls lack the 
gnutls_transport_set_global_errno() function? ])])
 fi
 AC_SUBST([GNUTLS_LIBS])
 AM_CONDITIONAL([HAVE_GNUTLS], [ ! test "x$GNUTLS_LIBS" = x ])
Index: common/rdr/TLSOutStream.cxx
===
--- common/rdr/TLSOutStream.cxx (revision 4145)
+++ common/rdr/TLSOutStream.cxx (working copy)
@@ -27,6 +27,10 @@
 #include 
 #include 
 
+#ifdef HAVE_OLD_GNUTLS
+#define gnutls_transport_set_global_errno(A) do { errno = (A); } while(0)
+#endif
+
 #ifdef HAVE_GNUTLS
 using namespace rdr;
 
Index: common/rdr/TLSInStream.cxx
===
--- common/rdr/TLSInStream.cxx  (revision 4145)
+++ common/rdr/TLSInStream.cxx  (working copy)
@@ -27,6 +27,10 @@
 #include 
 #include 
 
+#ifdef HAVE_OLD_GNUTLS
+#define gnutls_transport_set_global_errno(A) do { errno = (A); } while(0)
+#endif
+
 #ifdef HAVE_GNUTLS 
 using namespace rdr;
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] Workaround for older gnutls

2010-09-20 Thread Adam Tkac
On Thu, Sep 16, 2010 at 03:00:26AM -0500, DRC wrote:
> On 9/9/10 2:11 AM, Martin Koegler wrote:
> > I can not imaging, how such errors can happen.
> > 
> > This test only adds the following to config.h:
> > 
> > |  /* Is gnutls_set_global_errno present */
> > |  #define gnutls_transport_set_global_errno(A) do { errno = (A); } while(0)
> > |
> > 
> > So any code not refering to gnutls_transport_set_global_errno should
> > not be affected.
> > 
> > Can you check, what is added to your config.h? My first guess is, that
> > some garbage is at the end of that file, which breaks everything after
> > including it.
> 
> 
> Yes, here is what is added to my config.h:
> 
> 
> /* Is gnutls_set_global_errno present */
> /* #undef gnutls_transport_set_global_errno */(A)
> 
> 
> so that is indeed the problem, but the configure test is definitely not
> detecting the presence of gnutls_transport_set_global_errno(), so I
> don't know why it adds this.  Perhaps yet another backward
> incompatibility within autotools?

Which version of autoconf are you using?

Regards, Adam

-- 
Adam Tkac, Red Hat, Inc.

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] Workaround for older gnutls

2010-09-18 Thread DRC
On 9/18/10 4:48 AM, Martin Koegler wrote:
> Autoconf allows adding a argument list to a Macro defined by AC_DEFINE:
> 
> |  -- Macro: AC_DEFINE (VARIABLE, VALUE, [DESCRIPTION])
> |  -- Macro: AC_DEFINE (VARIABLE)
> |  Define VARIABLE to VALUE (verbatim), by defining a C preprocessor
> |  macro for VARIABLE.  VARIABLE should be a C identifier, optionally
> |  suffixed by a parenthesized argument list to define a C
> |  preprocessor macro with arguments.  The macro argument list, if
> |  present, should be a comma-separated list of C identifiers,
> |  possibly terminated by an ellipsis `...' if C99 syntax is employed.
> |  VARIABLE should not contain comments, white space, trigraphs,
> |  backslash-newlines, universal character names, or non-ASCII
> |  characters.
> 
> My autoconf puts in config.h.in:
> 
> /* Is gnutls_set_global_errno present */
> #undef gnutls_transport_set_global_errno
> 
> So the syntax error is a autotools problem related to AC_DEFINE and argument. 

Not surprising.  I've said this before-- autotools is really bad about
being compatible with itself.  When they change the behavior of a
function, they should really change the name of it as well to avoid
these sorts of problems.


> A seperate question is, if your gnutls includes this function:
> grep -r gnutls_transport_set_global_errno /usr/include/gnutls/

No, it doesn't.  I'm using the stock version of gnutls (1.0.20) that
ships with RHEL 4.  The TigerVNC configure script is properly detecting
that I don't have the function, so it seems like one way to fix this
would be to simply define a static macro if the
gnutls_transport_set_global_errno function doesn't exist and then have
the gnutls_transport_set_global_errno() macro pre-defined in config.h.in
(but #ifdef around it based on the setting of the afore-mentioned static
macro.)  I'll look into implementing that on Monday.

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] Workaround for older gnutls

2010-09-18 Thread Martin Koegler
On Thu, Sep 16, 2010 at 03:00:26AM -0500, DRC wrote:
> On 9/9/10 2:11 AM, Martin Koegler wrote:
> Yes, here is what is added to my config.h:
> 
> 
> /* Is gnutls_set_global_errno present */
> /* #undef gnutls_transport_set_global_errno */(A)
> 
> 
> so that is indeed the problem, but the configure test is definitely not
> detecting the presence of gnutls_transport_set_global_errno(), so I
> don't know why it adds this.  Perhaps yet another backward
> incompatibility within autotools?

Autoconf allows adding a argument list to a Macro defined by AC_DEFINE:

|  -- Macro: AC_DEFINE (VARIABLE, VALUE, [DESCRIPTION])
|  -- Macro: AC_DEFINE (VARIABLE)
|  Define VARIABLE to VALUE (verbatim), by defining a C preprocessor
|  macro for VARIABLE.  VARIABLE should be a C identifier, optionally
|  suffixed by a parenthesized argument list to define a C
|  preprocessor macro with arguments.  The macro argument list, if
|  present, should be a comma-separated list of C identifiers,
|  possibly terminated by an ellipsis `...' if C99 syntax is employed.
|  VARIABLE should not contain comments, white space, trigraphs,
|  backslash-newlines, universal character names, or non-ASCII
|  characters.

My autoconf puts in config.h.in:

/* Is gnutls_set_global_errno present */
#undef gnutls_transport_set_global_errno

So the syntax error is a autotools problem related to AC_DEFINE and argument. 

A seperate question is, if your gnutls includes this function:
grep -r gnutls_transport_set_global_errno /usr/include/gnutls/

Regards,
Martin Kögler

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] Workaround for older gnutls

2010-09-16 Thread DRC
On 9/9/10 2:11 AM, Martin Koegler wrote:
> I can not imaging, how such errors can happen.
> 
> This test only adds the following to config.h:
> 
> |  /* Is gnutls_set_global_errno present */
> |  #define gnutls_transport_set_global_errno(A) do { errno = (A); } while(0)
> |
> 
> So any code not refering to gnutls_transport_set_global_errno should
> not be affected.
> 
> Can you check, what is added to your config.h? My first guess is, that
> some garbage is at the end of that file, which breaks everything after
> including it.


Yes, here is what is added to my config.h:


/* Is gnutls_set_global_errno present */
/* #undef gnutls_transport_set_global_errno */(A)


so that is indeed the problem, but the configure test is definitely not
detecting the presence of gnutls_transport_set_global_errno(), so I
don't know why it adds this.  Perhaps yet another backward
incompatibility within autotools?

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] Workaround for older gnutls

2010-09-09 Thread Martin Koegler
On Wed, Sep 08, 2010 at 02:14:55AM -0500, DRC wrote:
> However, when I attempted to apply the patch to work around this, I got
> a worse build error:
> 
>  gcc4 -DHAVE_CONFIG_H -I. -I/home/drc/worksrc/tigervnc/common/os -I../..
> -I/home/drc/worksrc/tigervnc/common -O3 -static-libgcc -fPIC -Wall -MT
> libos_la-net.lo -MD -MP -MF .deps/libos_la-net.Tpo -c
> /home/drc/worksrc/tigervnc/common/os/net.c  -fPIC -DPIC -o
> .libs/libos_la-net.o
> In file included from /usr/include/stdlib.h:33,
>  from /home/drc/worksrc/tigervnc/common/os/net.c:23:
> /usr/lib/gcc/x86_64-redhat-linux5E/4.1.2/include/stddef.h:214: error:
> expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
> In file included from /home/drc/worksrc/tigervnc/common/os/net.c:23:
> /usr/include/stdlib.h:140: error: expected '=', ',', ';', 'asm' or
> '__attribute__' before '__ctype_get_mb_cur_max'
> In file included from /usr/include/sys/types.h:266,
>  from /usr/include/stdlib.h:433,
>  from /home/drc/worksrc/tigervnc/common/os/net.c:23:
> /usr/include/bits/pthreadtypes.h:48: error: expected
> specifier-qualifier-list before 'size_t'
> In file included from /home/drc/worksrc/tigervnc/common/os/net.c:23:
> /usr/include/stdlib.h:450: error: expected declaration specifiers or
> '...' before 'size_t'
> /usr/include/stdlib.h:480: error: expected declaration specifiers or
> '...' before 'size_t'
> /usr/include/stdlib.h:482: error: nonnull argument with out-of-range
> operand number (argument 1, operand 4)
> /usr/include/stdlib.h:584: error: expected ')' before '__size'
> /usr/include/stdlib.h:586: error: expected ')' before '__nmemb'
> /usr/include/stdlib.h:595: error: expected declaration specifiers or
> '...' before 'size_t'
> In file included from /usr/include/stdlib.h:606,
>  from /home/drc/worksrc/tigervnc/common/os/net.c:23:
> /usr/include/alloca.h:33: error: expected ')' before '__size'
> In file included from /home/drc/worksrc/tigervnc/common/os/net.c:23:

I can not imaging, how such errors can happen.

This test only adds the following to config.h:

|  /* Is gnutls_set_global_errno present */
|  #define gnutls_transport_set_global_errno(A) do { errno = (A); } while(0)
|

So any code not refering to gnutls_transport_set_global_errno should
not be affected.

Can you check, what is added to your config.h? My first guess is, that
some garbage is at the end of that file, which breaks everything after
including it.

Regards,
Martin Kögler

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] Workaround for older gnutls

2010-09-08 Thread DRC
I have confirmed that RHEL 4 doesn't have the
gnutls_transport_set_global_errno function:

 g++ -DHAVE_CONFIG_H -I. -I/home/drc/worksrc/tigervnc/common/rdr -I../..
-I/home/drc/worksrc/tigervnc/common
-I/home/drc/worksrc/tigervnc/common/zlib -O3 -static-libgcc -fPIC -Wall
-MT librdr_la-TLSInStream.lo -MD -MP -MF .deps/librdr_la-TLSInStream.Tpo
-c /home/drc/worksrc/tigervnc/common/rdr/TLSInStream.cxx  -fPIC -DPIC -o
.libs/librdr_la-TLSInStream.o
/home/drc/worksrc/tigervnc/common/rdr/TLSInStream.cxx: In function
`ssize_t rdr::gnutls_InStream_pull(void*, void*, size_t)':
/home/drc/worksrc/tigervnc/common/rdr/TLSInStream.cxx:42: error:
`gnutls_transport_set_global_errno' was not declared in this scope
/home/drc/worksrc/tigervnc/common/rdr/TLSInStream.cxx:42: warning:
unused variable 'gnutls_transport_set_global_errno'
/home/drc/worksrc/tigervnc/common/rdr/TLSInStream.cxx:46: warning:
comparison between signed and unsigned integer expressions
/home/drc/worksrc/tigervnc/common/rdr/TLSInStream.cxx:52: error:
`gnutls_transport_set_global_errno' was not declared in this scope
/home/drc/worksrc/tigervnc/common/rdr/TLSInStream.cxx:52: warning:
unused variable 'gnutls_transport_set_global_errno'
make[3]: *** [librdr_la-TLSInStream.lo] Error 1


However, when I attempted to apply the patch to work around this, I got
a worse build error:

 gcc4 -DHAVE_CONFIG_H -I. -I/home/drc/worksrc/tigervnc/common/os -I../..
-I/home/drc/worksrc/tigervnc/common -O3 -static-libgcc -fPIC -Wall -MT
libos_la-net.lo -MD -MP -MF .deps/libos_la-net.Tpo -c
/home/drc/worksrc/tigervnc/common/os/net.c  -fPIC -DPIC -o
.libs/libos_la-net.o
In file included from /usr/include/stdlib.h:33,
 from /home/drc/worksrc/tigervnc/common/os/net.c:23:
/usr/lib/gcc/x86_64-redhat-linux5E/4.1.2/include/stddef.h:214: error:
expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
In file included from /home/drc/worksrc/tigervnc/common/os/net.c:23:
/usr/include/stdlib.h:140: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '__ctype_get_mb_cur_max'
In file included from /usr/include/sys/types.h:266,
 from /usr/include/stdlib.h:433,
 from /home/drc/worksrc/tigervnc/common/os/net.c:23:
/usr/include/bits/pthreadtypes.h:48: error: expected
specifier-qualifier-list before 'size_t'
In file included from /home/drc/worksrc/tigervnc/common/os/net.c:23:
/usr/include/stdlib.h:450: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:480: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:482: error: nonnull argument with out-of-range
operand number (argument 1, operand 4)
/usr/include/stdlib.h:584: error: expected ')' before '__size'
/usr/include/stdlib.h:586: error: expected ')' before '__nmemb'
/usr/include/stdlib.h:595: error: expected declaration specifiers or
'...' before 'size_t'
In file included from /usr/include/stdlib.h:606,
 from /home/drc/worksrc/tigervnc/common/os/net.c:23:
/usr/include/alloca.h:33: error: expected ')' before '__size'
In file included from /home/drc/worksrc/tigervnc/common/os/net.c:23:

(and many many more)



On 9/3/10 12:53 AM, Martin Koegler wrote:
> On Thu, Sep 02, 2010 at 10:42:17AM +0200, Adam Tkac wrote:
>> On Thu, Sep 02, 2010 at 09:05:52AM +0200, Martin Koegler wrote:
>>> Signed-off-by: Martin Koegler 
>>> ---
>>>  configure.ac |2 ++
>>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> May I ask you which version of GNUTLS is old, please? Did you check
>> this change doesn't break later gnutls_error_is_fatal/gnutls_strerror
>> calls?
>  
> I tried compiling it on a system, which had the development file of
> gnutls 1.0.X installed (please don't ask why). With this change,
> vencrypt compiles and TLS connections are working.
> 
> This patch restores the old vnecrypt behaviour, if GNUTLS is missing
> gnutls_transport_set_global_errno to avoid raising the minimal
> required GNUTLS version.
> 
> After checking, when gnutls_transport_set_global_errno was introduced,
> please decide yourself, if support for older versions is really
> necessary.
> 
> Regards,
> Martin Kögler
> 
> --
> This SF.net Dev2Dev email is sponsored by:
> 
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> ___
> Tigervnc-devel mailing list
> Tigervnc-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.source

Re: [Tigervnc-devel] [PATCH] Workaround for older gnutls

2010-09-03 Thread DRC
On 9/2/10 11:53 PM, Martin Koegler wrote:
> After checking, when gnutls_transport_set_global_errno was introduced,
> please decide yourself, if support for older versions is really
> necessary.

I need to try building this stuff on RHEL 4 to make sure it all works on 
that platform.  I'll try to get around to that within the next couple of 
weeks.  That's the earliest version of gnutls that I would care about, 
and I imagine most wouldn't care about anything prior to RHEL 5.

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] Workaround for older gnutls

2010-09-02 Thread Martin Koegler
On Thu, Sep 02, 2010 at 10:42:17AM +0200, Adam Tkac wrote:
> On Thu, Sep 02, 2010 at 09:05:52AM +0200, Martin Koegler wrote:
> > Signed-off-by: Martin Koegler 
> > ---
> >  configure.ac |2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> May I ask you which version of GNUTLS is old, please? Did you check
> this change doesn't break later gnutls_error_is_fatal/gnutls_strerror
> calls?
 
I tried compiling it on a system, which had the development file of
gnutls 1.0.X installed (please don't ask why). With this change,
vencrypt compiles and TLS connections are working.

This patch restores the old vnecrypt behaviour, if GNUTLS is missing
gnutls_transport_set_global_errno to avoid raising the minimal
required GNUTLS version.

After checking, when gnutls_transport_set_global_errno was introduced,
please decide yourself, if support for older versions is really
necessary.

Regards,
Martin Kögler

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] Workaround for older gnutls

2010-09-02 Thread Adam Tkac
On Thu, Sep 02, 2010 at 09:05:52AM +0200, Martin Koegler wrote:
> Signed-off-by: Martin Koegler 
> ---
>  configure.ac |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)

May I ask you which version of GNUTLS is old, please? Did you check
this change doesn't break later gnutls_error_is_fatal/gnutls_strerror
calls?

Regards, Adam

> 
> diff --git a/configure.ac b/configure.ac
> index 5acd762..f6dfc10 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -78,6 +78,8 @@ if test "x$enable_gnutls" = xyes; then
>   AC_CHECK_LIB([gnutls], [gnutls_global_init],
>[GNUTLS_LIBS='-lgnutls'
> AC_DEFINE([HAVE_GNUTLS], 1, [Is gnutls present? ])])
> + AC_CHECK_LIB([gnutls], [gnutls_transport_set_global_errno], [],
> +  [AC_DEFINE([gnutls_transport_set_global_errno(A)], [do { 
> errno = (A); } while(0)], [Is gnutls_set_global_errno present])])
>  fi
>  AC_SUBST([GNUTLS_LIBS])
>  AM_CONDITIONAL([HAVE_GNUTLS], [ ! test "x$GNUTLS_LIBS" = x ])
> -- 
> 1.5.6.5
> 
> 
> --
> This SF.net Dev2Dev email is sponsored by:
> 
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> ___
> Tigervnc-devel mailing list
> Tigervnc-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

-- 
Adam Tkac, Red Hat, Inc.

--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel