Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Little fix for security/openssh: (7 Items)
   
Little fix for security/openssh  
bmake install 
leads to:
...
cc -O2 -I/usr/pkg/include -Wall -Wpointer-arith -Wuninitialized -I. -I. -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg
/include -DSSHDIR=\"/usr/pkg/etc/ssh\"  -D_PATH_SSH_PROGRAM=\"/usr/pkg/bin/ssh\"  -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/pkg
/bin/ssh-askpass\"  -D_PATH_SFTP_SERVER=\"/usr/pkg/libexec/sftp-server\"  -D_PATH_SSH_KEY_SIGN=\"/usr/pkg/libexec/ssh-
keysign\"  -D_PATH_SSH_PIDDIR=\"/var/run\"  -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/chroot/sshd\"  -DSSH_RAND_HELPER=\"/usr/
pkg/libexec/ssh-rand-helper\" -DHAVE_CONFIG_H -c atomicio.c
atomicio.c: In function `atomicio':
atomicio.c:55: error: storage size of `pfd' isn't known
atomicio.c:58: error: `POLLIN' undeclared (first use in this function)
atomicio.c:58: error: (Each undeclared identifier is reported only once
atomicio.c:58: error: for each function it appears in.)
atomicio.c:58: error: `POLLOUT' undeclared (first use in this function)
atomicio.c:70: warning: implicit declaration of function `poll'
atomicio.c:55: warning: unused variable `pfd'
atomicio.c: In function `atomiciov':
atomicio.c:94: error: storage size of `pfd' isn't known
atomicio.c:104: error: `POLLIN' undeclared (first use in this function)
atomicio.c:104: error: `POLLOUT' undeclared (first use in this function)
atomicio.c:94: warning: unused variable `pfd'
cc: /usr/qnx632/host/qnx6/x86/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.5/cc1 error 1


The fix is obvious: poll is defined in sys/poll.h and need therefore to be included in atomicio.c. Then everything 
compiles and works fine.


The patch for the c file is the easiest one:
# less patch-ax
$NetBSD$

On QNX the function poll() is defined in sys/poll.h and must therefore be included.

--- atomicio.c.orig     2007-06-25 14:15:12.000000000 +0200
+++ atomicio.c
@@ -35,6 +35,9 @@
 #ifdef HAVE_POLL_H
 #include <poll.h>
 #endif
+#ifdef HAVE_SYS_POLL_H
+#include <sys/poll.h>
+#endif
 #include <string.h>
 #include <unistd.h>


Then I need to define the newly introduced define HAVE_SYS_POLL_H. This has to be done through configure.ac!?

# less  patch-ay
$NetBSD$

On QNX the function poll() is defined in sys/poll.h and must therefore be included.

--- configure.ac.orig   2007-08-10 06:36:12.000000000 +0200
+++ configure.ac
@@ -223,6 +227,7 @@ AC_CHECK_HEADERS( \
        sys/dir.h \
        sys/mman.h \
        sys/ndir.h \
+      sys/poll.h \
        sys/prctl.h \
        sys/pstat.h \
        sys/select.h \

 
As far as I know autoheader generates config.h.in from configure.ac. But it seems to be included in the original source.
 Therefore another path is required:

# less patch-az
$NetBSD$

--- config.h.in.orig    2007-09-04 08:50:04.000000000 +0200
+++ config.h.in
@@ -636,6 +642,9 @@
 /* Define to 1 if you have the <poll.h> header file. */
 #undef HAVE_POLL_H

+/* Define to 1 if you have the <sys/poll.h> header file. */
+#undef HAVE_SYS_POLL_H
+
 /* Define to 1 if you have the `prctl' function. */
 #undef HAVE_PRCTL


BUT this doesn't work.  HAVE_SYS_POLL_H is not defined in the generated config.h 8-((


Invoking autoheader manually does not help, too:
# autoheader
autoheader: warning: missing template: HAVE_INTERIX
autoheader: Use AC_DEFINE([HAVE_INTERIX], [], [Description])


As you see, I'm new to the autotools. Any ideas where I must look for?

If I have gotten around the remaining issue. How should I proceed to get the required changes into the QNX pkgsrc 
subversion repository? Who will take care that the required change is moved upstream (NetBSD as upstream pkgsrc and 
OpenBSD as openssh author)?

Thanks
Christian
Re: Little fix for security/openssh  
I *think* if you patch the configure.ac, you need to update the
Makefile to add:

 USE_TOOLS+=  autoconf

 pre-configure:
       cd ${WRKSRC} && autoconf

But I am not sure, if the configure is also patched, then you might in trouble.
Re: Little fix for security/openssh  
This has not solved the problem 8-(

The problem seems that it is called too late. Therefor a propate may change manually to configure (via patch file) and 
everything works.

I attach the output from svn diff:
$ cd /usr/src/HEAD/pkgsrc/security/openssh
$ svn diff > /tmp/openssh-patches


I can not do it mayself:
$ svn commit -m "Changes to find the function poll in sys/poll.h where it resides on QNX"
svn: Commit failed (details follow):
svn: MKACTIVITY of '/svn/repos/pkgsrc/!svn/act/8384990d-863c-0410-aff9-d8a0519677ca': 403 Forbidden (http://community.
qnx.com)

Will someone do the changes on my behalf?

Bye
Christian
Attachment: Text openssh-patches 3.63 KB
Re: Little fix for security/openssh  
On Fri, Oct 12, 2007 at 02:22:45PM -0400, Christian Leutloff wrote:
> bmake install 
> leads to:
> ...
> cc -O2 -I/usr/pkg/include -Wall -Wpointer-arith -Wuninitialized -I. -I.
> -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include
> -DSSHDIR=\"/usr/pkg/etc/ssh\"  -D_PATH_SSH_PROGRAM=\"/usr/pkg/bin/ssh\"
> -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/pkg/bin/ssh-askpass\"
> -D_PATH_SFTP_SERVER=\"/usr/pkg/libexec/sftp-server\"
> -D_PATH_SSH_KEY_SIGN=\"/usr/pkg/libexec/ssh-keysign\"
> -D_PATH_SSH_PIDDIR=\"/var/run\"
> -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/chroot/sshd\"
> -DSSH_RAND_HELPER=\"/usr/pkg/libexec/ssh-rand-helper\" -DHAVE_CONFIG_H
> -c atomicio.c
> atomicio.c: In function `atomicio':
> atomicio.c:55: error: storage size of `pfd' isn't known
> atomicio.c:58: error: `POLLIN' undeclared (first use in this function)
> atomicio.c:58: error: (Each undeclared identifier is reported only once
> atomicio.c:58: error: for each function it appears in.)
> atomicio.c:58: error: `POLLOUT' undeclared (first use in this function)
> atomicio.c:70: warning: implicit declaration of function `poll'
> atomicio.c:55: warning: unused variable `pfd'
> atomicio.c: In function `atomiciov':
> atomicio.c:94: error: storage size of `pfd' isn't known
> atomicio.c:104: error: `POLLIN' undeclared (first use in this function)
> atomicio.c:104: error: `POLLOUT' undeclared (first use in this function)
> atomicio.c:94: warning: unused variable `pfd'
> cc:
> /usr/qnx632/host/qnx6/x86/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.5/cc1
> error 1
> 
> 
> The fix is obvious: poll is defined in sys/poll.h and need therefore to
> be included in atomicio.c. Then everything compiles and works fine.
> 
> 
> The patch for the c file is the easiest one:
> # less patch-ax
> $NetBSD$
> 
> On QNX the function poll() is defined in sys/poll.h and must therefore
> be included.
> 
> --- atomicio.c.orig     2007-06-25 14:15:12.000000000 +0200
> +++ atomicio.c
> @@ -35,6 +35,9 @@
>  #ifdef HAVE_POLL_H
>  #include <poll.h>
>  #endif
> +#ifdef HAVE_SYS_POLL_H
> +#include <sys/poll.h>
> +#endif
>  #include <string.h>
>  #include <unistd.h>

This is a QNX bug.  POSIX defines <poll.h>.  Some systems
link this to <sys/poll.h> or vice versa which I guess we
will have to as well for backward compatibility.

I'll update the utility package (guess we should come up
with a new name for it).

-seanb
Re: Little fix for security/openssh  
> 
> This is a QNX bug.  POSIX defines <poll.h>.  Some systems
> link this to <sys/poll.h> or vice versa which I guess we
> will have to as well for backward compatibility.
> 
> I'll update the utility package (guess we should come up
> with a new name for it).

Updated.

-seanb
Re: Little fix for security/openssh  
That works, too.

I've dropped my patch.
Re: Little fix for security/openssh  
On Tue, Oct 16, 2007 at 09:45:16AM -0400, Christian Leutloff wrote:
> That works, too.
> 
> I've dropped my patch.

Thanks all the same.

It would be nice to have things just work with stock 6.3.2
but we're kinda at the point where the qnxutil archive is
a requirement for development so if they're obvious QNX
issues I'd rather fix them outright.

-seanb