Bug 1149 - Does not build on QNX
Summary: Does not build on QNX
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Build system (show other bugs)
Version: 4.3p1
Hardware: ix86 Other
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-03 09:25 AEDT by Matt Kraai
Modified: 2006-10-07 11:44 AEST (History)
0 users

See Also:


Attachments
Patch (632 bytes, patch)
2006-02-03 09:26 AEDT, Matt Kraai
no flags Details | Diff
disable /etc/default/logn check on qnx (365 bytes, patch)
2006-02-08 11:09 AEDT, Tim Rice
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Kraai 2006-02-03 09:25:27 AEDT
OpenSSH does not build on QNX 6.3.0: configure doesn't recognize the system as a QNX Neutrino system; it tries to use lastlog.h, which isn't available; and it tries to use /etc/default/login, which has an incompatible format.

I'll attach a patch that fixes the first two problems.  I wasn't sure how to fix the third, so I worked around it by passing --disable-etc-default-login to configure.
Comment 1 Matt Kraai 2006-02-03 09:26:30 AEDT
Created attachment 1060 [details]
Patch
Comment 2 Tim Rice 2006-02-04 09:54:24 AEDT
(In reply to comment #0)
> OpenSSH does not build on QNX 6.3.0: configure doesn't recognize the system as
> a QNX Neutrino system; it tries to use lastlog.h, which isn't available; and it
> tries to use /etc/default/login, which has an incompatible format.

What is the output of config.guess on QNX?

The configure script is broken on 4.3p1. Please apply the patch sent to the
list ad report back.

http://marc.theaimsgroup.com/?l=openssh-unix-dev&m=113892892008957
or
http://www.zip.com.au/~dtucker/openssh/4.3p1-configure.patch


Comment 3 Matt Kraai 2006-02-05 05:58:20 AEDT
(In reply to comment #2)
> (In reply to comment #0)
> > OpenSSH does not build on QNX 6.3.0: configure doesn't recognize the system as
> > a QNX Neutrino system; it tries to use lastlog.h, which isn't available; and it
> > tries to use /etc/default/login, which has an incompatible format.
> 
> What is the output of config.guess on QNX?

i386-pc-nto-qnx6.3.0

> The configure script is broken on 4.3p1. Please apply the patch sent to the
> list ad report back.
> 
> http://marc.theaimsgroup.com/?l=openssh-unix-dev&m=113892892008957
> or
> http://www.zip.com.au/~dtucker/openssh/4.3p1-configure.patch

I still needed the patch I attached to compile.
Comment 4 Tim Rice 2006-02-05 08:44:24 AEDT
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #0)
> > > OpenSSH does not build on QNX 6.3.0: configure doesn't recognize the system as
> > > a QNX Neutrino system; it tries to use lastlog.h, which isn't available; and it
> > > tries to use /etc/default/login, which has an incompatible format.
> > 
> > What is the output of config.guess on QNX?
> 
> i386-pc-nto-qnx6.3.0
> 
OK this part is a no brainer.
-*-*-nto-qnx)
+*-*-nto-qnx*)

Is defining DISABLE_LASTLOG correct for ALL nto-qnx versions?

Comment 5 Matt Kraai 2006-02-05 12:16:12 AEDT
(In reply to comment #4)
> Is defining DISABLE_LASTLOG correct for ALL nto-qnx versions?

I don't know: I only have access to QNX 6.3.0 systems.  I doubt that QNX would have removed support for it, though.
Comment 6 Tim Rice 2006-02-05 12:45:37 AEDT
(In reply to comment #5)
> (In reply to comment #4)
> > Is defining DISABLE_LASTLOG correct for ALL nto-qnx versions?
> 
> I don't know: I only have access to QNX 6.3.0 systems.  I doubt that QNX would
> have removed support for it, though.
> 

Probably not. OK. fix commited. Please test the next snapshot.
Comment 7 Matt Kraai 2006-02-07 03:31:58 AEDT
(In reply to comment #6)
> Probably not. OK. fix commited. Please test the next snapshot.

The 20060206 snapshot built successfully but the resulting binaries still tried to use /etc/default/login.
Comment 8 Tim Rice 2006-02-08 11:09:55 AEDT
Created attachment 1062 [details]
disable /etc/default/logn check on qnx

Sorry, forgot abour your /etc/default/login issue.
I guess you'd rather not "configure --disable-etc-default-login"
Try this patch to confiugure.ac
Comment 9 Matt Kraai 2006-02-09 04:49:13 AEDT
(In reply to comment #8)
> Created an attachment (id=1062) [edit]
> disable /etc/default/logn check on qnx
> 
> Sorry, forgot abour your /etc/default/login issue.
> I guess you'd rather not "configure --disable-etc-default-login"
> Try this patch to confiugure.ac

That didn't seem to work.  It looks like it was reset to yes on line 25979 of configure.
Comment 10 Tim Rice 2006-02-09 06:24:28 AEDT
(In reply to comment #9)
> 
> That didn't seem to work.  It looks like it was reset to yes on line 25979 of
> configure.
> 

Ahh, that should have been 
enable_etc_default_login=no
Comment 11 Matt Kraai 2006-02-09 11:03:34 AEDT
(In reply to comment #10)
> Ahh, that should have been 
> enable_etc_default_login=no

Substituting enable_etc_default_login for etc_default_login in the patch fixes the problem.
Comment 12 Matt Kraai 2006-02-09 12:23:58 AEDT
When I start sshd during the boot process, it prints the following message and exits:

> PRNG is not seeded

Here's the relevant excerpt from config.log:

> configure:15440: checking whether OpenSSL's PRNG is internally seeded
> configure:15465: gcc -o conftest -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -I/usr/local/ssl/include  -L/usr/local/ssl/lib  conftest.c -lcrypto -lz -lsocket  >&5
> configure:15468: $? = 0
> configure:15470: ./conftest
> configure:15473: $? = 0
> configure:15477: result: yes

Adding

 with_rand_helper=yes

to the nto-qnx case fixes this problem.
Comment 13 Tim Rice 2006-02-09 16:41:56 AEDT
(In reply to comment #12)
> When I start sshd during the boot process, it prints the following message and
> exits:
> 
> > PRNG is not seeded
> 
> Here's the relevant excerpt from config.log:
> 
> > configure:15440: checking whether OpenSSL's PRNG is internally seeded
> > configure:15465: gcc -o conftest -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -I/usr/local/ssl/include  -L/usr/local/ssl/lib  conftest.c -lcrypto -lz -lsocket  >&5
> > configure:15468: $? = 0
> > configure:15470: ./conftest
> > configure:15473: $? = 0
> > configure:15477: result: yes
> 

If your OpenSSL is internally seeded but you are seeing "PRNG is not seeded"
on boot, I can only guess that there is not enough random data on boot.
What is the source of random data on QNX?
If you are running prngd, is it starting well before sshd?

> Adding
> 
>  with_rand_helper=yes
> to the nto-qnx case fixes this problem.
That will not be going into configure.ac.
Comment 14 Darren Tucker 2006-02-09 17:11:13 AEDT
(In reply to comment #13)
> > Adding with_rand_helper=yes
> > to the nto-qnx case fixes this problem.
>
> That will not be going into configure.ac.

Yeah, it's a host-specific thing not a platform-specific thing.

Configure does the right thing for the configuration it's running on, but if you have a host that might or might not need it (or are packaging for multiple hosts with differing configurations), it can be forcibly enabled at configure time with the --with-rand-helper option.
Comment 15 Tim Rice 2006-02-12 13:40:51 AEDT
I've commited the patch to disable /etc/default/login checks on QNX
Closing bug
Comment 16 Matt Kraai 2006-02-15 09:27:35 AEDT
(In reply to comment #13)
> If your OpenSSL is internally seeded but you are seeing "PRNG is not seeded"
> on boot, I can only guess that there is not enough random data on boot.
> What is the source of random data on QNX?

There is a program named random that can collect data from interrupts, /proc, and the high-performance clock.  Would it be possible to make sshd wait for enough entropy to be collected instead of exiting?
Comment 17 Darren Tucker 2006-02-15 11:16:28 AEDT
(In reply to comment #16)
> There is a program named random that can collect data from interrupts, /proc,
> and the high-performance clock.  Would it be possible to make sshd wait for
> enough entropy to be collected instead of exiting?

You could modify entropy.c, but having sshd potentially hang on startup is probably not a good idea in general.  You could also have the startup script wait (trivial program with RAND_status()/sleep(1) in a loop).

Most other platforms solve this kind of problem by saving the random seed on shutdown and reseeding on startup.
Comment 18 Matt Kraai 2006-02-15 20:12:46 AEDT
(In reply to comment #17)
> Most other platforms solve this kind of problem by saving the random seed on
> shutdown and reseeding on startup.

Does sshd do this or does some other operating system service?  If I were to write my own program to do so, would I use RAND_file_name, RAND_write_file, and RAND_read_file or should I seed the operating system's random number generator (assuming the RAND functions don't do so)?
Comment 19 Darren Tucker 2006-02-15 22:43:36 AEDT
(In reply to comment #18)
> (In reply to comment #17)
> > Most other platforms solve this kind of problem by saving the random seed on
> > shutdown and reseeding on startup.
> 
> Does sshd do this or does some other operating system service?

It's usually either the entropy collector service itself when shut down (eg prngd) or the system shutdown scripts (eg most Linuxes will do something like "dd if=/dev/urandom of=/some/file bs=512 count=1").

> If I were to
> write my own program to do so, would I use RAND_file_name, RAND_write_file,
> and RAND_read_file or should I seed the operating system's random number
> generator (assuming the RAND functions don't do so)?

For best effect should to use the OS's facilities since that would help all users of the entropy source, but for users of OpenSSL (including OpenSSH) the RAND_* functions mentioned above seem as if they would be adequate (although I've not used them).

Whatever you do you should try not to reuse the same seedfile.
Comment 20 Darren Tucker 2006-10-07 11:44:17 AEST
Change all RESOLVED bug to CLOSED with the exception of the ones fixed post-4.4.