OpenLDAP
Up to top level
Build   Contrib   Development   Documentation   Historical   Incoming   Software Bugs   Software Enhancements   Web  

Logged in as guest

Viewing Incoming/6534
Full headers

From: quanah@openldap.org
Subject: bad ifdef/elif clause in liblutil
Compose comment
Download message
State:
0 replies:
7 followups: 1 2 3 4 5 6 7

Major security issue: yes  no

Notes:

Notification:


Date: Mon, 26 Apr 2010 15:10:21 +0000
From: quanah@openldap.org
To: openldap-its@OpenLDAP.org
Subject: bad ifdef/elif clause in liblutil
Full_Name: Quanah Gibson-Mount
Version: 2.4.21
OS: NA
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (75.111.45.108)


The following if/elif clause in liblutil is wrong:

#ifdef HAVE_SETSID
                (void) setsid();
#elif TIOCNOTTY
                if ( (sd = open( "/dev/tty", O_RDWR )) != -1 ) {
                        (void) ioctl( sd, TIOCNOTTY, NULL );
                        (void) close( sd );
                }
#endif


The elif should be

#elif defined(TIOCNOTTY)

Followup 1

Download message
Date: Thu, 29 Apr 2010 08:31:19 -0700
From: Quanah Gibson-Mount <quanah@zimbra.com>
To: openldap-its@openldap.org
Subject: Re: (ITS#6534) bad ifdef/elif clause in liblutil
--On Monday, April 26, 2010 3:10 PM +0000 quanah@OpenLDAP.org wrote:

> Full_Name: Quanah Gibson-Mount
> Version: 2.4.21
> OS: NA
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (75.111.45.108)
>
>
> The following if/elif clause in liblutil is wrong:

Actually, the issue seems to be name changes in the header files under BSD. 
This causes TIOCNOTTY to end up being undefined.

Here's the header information:

kibi@kbsd:~$ grep TIOCNOTTY /usr/include/ -r
/usr/include/sys/ttycom.h:#define	  TIOCNOTTY	 _IO('t', 113)		/* void tty 
association */

kibi@kbsd:~$ grep ttycom.h -r /usr/include/
/usr/include/sys/tty.h:#include <sys/ttycom.h>
/usr/include/bits/ioctls.h:#include <sys/ttycom.h>


So we either need <bits/ioctls.h> or <sys/ttycom.h> to be included
on this 
particular platform.  My guess is the latter would be most appropriate.

--Quanah


--

Quanah Gibson-Mount
Principal Software Engineer
Zimbra, Inc
--------------------
Zimbra ::  the leader in open source messaging and collaboration



Followup 2

Download message
From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
Date: Fri, 30 Apr 2010 15:23:08 +0200
To: quanah@zimbra.com
Cc: openldap-its@openldap.org
Subject: Re: (ITS#6534) bad ifdef/elif clause in liblutil
quanah@zimbra.com writes:
> Actually, the issue seems to be name changes in the header files under BSD.

> This causes TIOCNOTTY to end up being undefined.

That would not give the error message shown in
<http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg776021.html>:

build/buildd-openldap_2.4.21-1-kfreebsd-amd64-VWAqZY/openldap-2.4.21/libraries/liblutil/detach.c:131:7:
 error: missing binary operator before token "long"

Line 131 is "#elif TIOCNOTTY".  There's no 'long' there is TIOCNOTTY is
undefined, it'd just evaluate to #elif 0.  So my guess is that TIOCNOTTY
somewhere is defined to expand to an expression involving a (long) cast.

-- 
Hallvard



Followup 3

Download message
Date: Tue, 25 May 2010 11:36:05 -0700
From: Quanah Gibson-Mount <quanah@zimbra.com>
To: h.b.furuseth@usit.uio.no, openldap-its@openldap.org
Subject: Re: (ITS#6534) bad ifdef/elif clause in liblutil
--On Friday, April 30, 2010 1:23 PM +0000 h.b.furuseth@usit.uio.no wrote:

> quanah@zimbra.com writes:
>> Actually, the issue seems to be name changes in the header files under
>> BSD.  This causes TIOCNOTTY to end up being undefined.
>
> That would not give the error message shown in
> <http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg776021.
> html>:
>
> build/buildd-openldap_2.4.21-1-kfreebsd-amd64-VWAqZY/openldap-2.4.21/libr
> aries/liblutil/detach.c:131:7:  error: missing binary operator before
> token "long"
>
> Line 131 is "#elif TIOCNOTTY".  There's no 'long' there is TIOCNOTTY is
> undefined, it'd just evaluate to #elif 0.  So my guess is that TIOCNOTTY
> somewhere is defined to expand to an expression involving a (long) cast.

Apprently so.

<http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg785259.html>

--Quanah


--

Quanah Gibson-Mount
Principal Software Engineer
Zimbra, Inc
--------------------
Zimbra ::  the leader in open source messaging and collaboration



Followup 4

Download message
Date: Thu, 22 Jul 2010 10:46:12 -0700
From: Quanah Gibson-Mount <quanah@zimbra.com>
To: openldap-its@openldap.org
Subject: Re: (ITS#6534) bad ifdef/elif clause in liblutil
--On Tuesday, May 25, 2010 6:37 PM +0000 quanah@zimbra.com wrote:

> --On Friday, April 30, 2010 1:23 PM +0000 h.b.furuseth@usit.uio.no wrote:
>
>> quanah@zimbra.com writes:
>>> Actually, the issue seems to be name changes in the header files
under
>>> BSD.  This causes TIOCNOTTY to end up being undefined.
>>
>> That would not give the error message shown in
>> <http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg776021.
>> html>:
>>
>> build/buildd-openldap_2.4.21-1-kfreebsd-amd64-VWAqZY/openldap-2.4.21/libr
>> aries/liblutil/detach.c:131:7:  error: missing binary operator before
>> token "long"
>>
>> Line 131 is "#elif TIOCNOTTY".  There's no 'long' there is TIOCNOTTY is
>> undefined, it'd just evaluate to #elif 0.  So my guess is that
TIOCNOTTY
>> somewhere is defined to expand to an expression involving a (long)
cast.
>
> Apprently so.
>
> <http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg785259.
> html>

Fixed by debian.

--Quanah


--

Quanah Gibson-Mount
Principal Software Engineer
Zimbra, Inc
--------------------
Zimbra ::  the leader in open source messaging and collaboration



Followup 5

Download message
From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
Date: Mon, 26 Jul 2010 17:36:39 +0200
To: quanah@zimbra.com
Cc: openldap-its@openldap.org
Subject: Re: (ITS#6534) bad ifdef/elif clause in liblutil
quanah@zimbra.com writes:
>>> Line 131 is "#elif TIOCNOTTY".  There's no 'long' there is
TIOCNOTTY is
>>> undefined, it'd just evaluate to #elif 0.  So my guess is that
TIOCNOTTY
>>> somewhere is defined to expand to an expression involving a (long)
cast.
>>
>> Apprently so.
>>
>> <http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg785259.
>> html>
> 
> Fixed by debian.

Which is nice, but doesn't help with older debian versions.
I don't see what's wrong with changing our #elif to #elif defined
like you originally suggested, though I remember there was some
confused #elif discussion earlier.

-- 
Hallvard



Followup 6

Download message
Date: Sun, 20 Mar 2011 22:21:00 +0100
From: Martin Matuska <mm@FreeBSD.org>
To: openldap-its@OpenLDAP.org
CC: quanah@OpenLDAP.org
Subject: Re: (ITS#6534) bad ifdef/elif clause in liblutil
This problem is a generic problem of gcc version 4.4 and later.

The new behaviour documented by GCC:
http://gcc.gnu.org/gcc-4.4/porting_to.html

I recommend importing the patch from
http://www.openldap.org/its/index.cgi/Build?id=6832

More information:
http://www.cyrius.com/journal/gcc/gcc-4.4-preprocessor-errors
http://gcc.gnu.org/viewcvs?view=revision&revision=136209



Followup 7

Download message
Date: Sun, 20 Mar 2011 23:32:41 -0700
From: Howard Chu <hyc@symas.com>
To: mm@FreeBSD.org
CC: openldap-its@openldap.org
Subject: Re: (ITS#6534) bad ifdef/elif clause in liblutil
mm@FreeBSD.org wrote:
> This problem is a generic problem of gcc version 4.4 and later.

You're replying to a closed ITS. Not much point to that.

> The new behaviour documented by GCC:
> http://gcc.gnu.org/gcc-4.4/porting_to.html
>
> I recommend importing the patch from
> http://www.openldap.org/its/index.cgi/Build?id=6832

The patch from ITS#6832 is already in CVS. That's what the "fixed in HEAD" 
status means. There's really nothing left to say or do here.

> More information:
> http://www.cyrius.com/journal/gcc/gcc-4.4-preprocessor-errors
> http://gcc.gnu.org/viewcvs?view=revision&revision=136209

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/


Up to top level
Build   Contrib   Development   Documentation   Historical   Incoming   Software Bugs   Software Enhancements   Web  

Logged in as guest


The OpenLDAP Issue Tracking System uses a hacked version of JitterBug

______________
© Copyright 2013, OpenLDAP Foundation, info@OpenLDAP.org