OpenSSH 3.1p1 will not build on BSD/OS 4.2 Two files fail: ssh-agent.c: In function `lookup_identity': ssh-agent.c:135: warning: implicit declaration of function `TAILQ_FOREACH' ssh-agent.c:135: `next' undeclared (first use in this function) ssh-agent.c:135: (Each undeclared identifier is reported only once ssh-agent.c:135: for each function it appears in.) ssh-agent.c:135: syntax error before `{' ssh-agent.c:138: warning: control reaches end of non-void function ssh-agent.c: At top level: ssh-agent.c:111: warning: `idtab_init' defined but not used ssh-agent.c:131: warning: `lookup_identity' defined but not used *** Error code 1 BSDI's <sys/queue.h> lacks TAILQ_FOREACH. While openbsd-compat/fake-queue.h can provide TAILQ_FOREACH, defining HAVE_BOGUS_SYS_QUEUE_H does not work. <sys/queue.h> is included by a number of system includes, causing _SYS_QUEUE_H_ to be defined by the time fake-queue.h is included which in turn ifdefs out all of fake-queue.h. ssh-rand-helper.c: In function `get_random_bytes_prngd': ssh-rand-helper.c:154: `ulong' undeclared (first use in this function) ssh-rand-helper.c:154: (Each undeclared identifier is reported only once ssh-rand-helper.c:154: for each function it appears in.) ssh-rand-helper.c:154: syntax error before `0x7f000001' *** Error code 1 (continuing) defines.h defines: #ifndef INADDR_LOOPBACK #define INADDR_LOOPBACK ((ulong)0x7f000001) #endif It should probably be "u_long".
I just went through someone with this problem. And HAVE_BOGUS_SYS_QUEUE_H worked for them. However you must have BOTH HAVE_SYS_QUEUE_H and HAVE_BOGUS_SYS_QUEUE_H set. As for INADDR_LOOPBACK. I'd like to know where on BSD/OS that is defined so we can check and include it correctly. Otherwise the correct fix (which I am verifying with the SCO 3 fokes) is to change it to #define INADDR_LOOPBACK (0x7f000001L)
> I just went through someone with this problem. And HAVE_BOGUS_SYS_QUEUE_H > worked for them. However you must have BOTH HAVE_SYS_QUEUE_H and > HAVE_BOGUS_SYS_QUEUE_H set. I tried this, and had no luck. As a test I even removed the #ifdefs in ssh-agent.c to force fake-queue.h to be included. If I'm reading gcc -E right, and it's been a long time since I have, the problem lies in <sys/queue.h> getting included before fake-queue.h. The include path looks like: includes.h -> config.h -> defines.h -> <netinet/in.h> -> <netinet6/in6.h> -> <sys/queue.h> Then <sys/queue.h> defines _SYS_QUEUE_H_ so that when fake-queue.h, it's all ifdef'ed out (and of course it would explode if both were included). I pasted the define for TAILQ_FOREACH into ssh-agent.c and it compiles fine. So it's probably just a case of finding a more graceful way of doing that. > As for INADDR_LOOPBACK. I'd like to know where on BSD/OS that is defined > so we can check and include it correctly. It's defined in <rpc/types.h>: #ifndef INADDR_LOOPBACK #define INADDR_LOOPBACK (u_long)0x7F000001 #endif I included that in defines.h and it compiled as well. Having done that I installed 3.1p1. The server works fine, but the clients all failed with: (rand child) setuid: Operation not permitted ssh-rand-helper child produced insufficient data Removing the setuid bit from "ssh" solved this problem. Digging a little deeper it looks like original_uid and original_euid are never initialized. ->Spike
Created attachment 44 [details] sftp-int.c: cmds[] to sftp_cmds[]
On a 4.1 system I had the same errors and an additional one. The fake-queue, was fixable by: CFLAGS=-DHAVE_BOGUS_SYS_QUEUE_H=1 The additional error is in sftp-int.c. The build fails on: gcc -o sftp sftp.o sftp-client.o sftp-common.o sftp-int.o sftp-glob.o -L. -Lopenbsd-compat/ -L/weblib/local/lib -L/usr/lib -Lyes -lssh -l openbsd-compat -lutil -lz -lcrypto /usr/lib/libc.a(prandom.o)(.data+0x0): multiple definition of `cmds' sftp-int.o(.rodata+0x48): first defined here ld: Warning: size of symbol `cmds' changed from 256 to 40 in prandom.o make: *** [sftp] Error 1 I renamed cmds to sftp_cmds and all is well. See uploaded patch.
Why are we renaming things without any reasoning behind it?
The reasoning is, that this bug is similar to: http://www.openldap.org/lists/openldap-bugs/200005/msg00032.html And that prandom.o is in libc. Another reason is, that 'cmds' is likely to conflict unless you protect it, since it's quite a common name. I don't know the reason for using sftp's own structure, instead of using the libc provided structure, so if it can be modified to use libc's. The only reference to cmds I found in /usr/include was: /usr/include/arpa/telnet.h Which also uses it's own name: #ifdef TELCMDS char *telcmds[] = { "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, }; #else extern char *telcmds[]; #endif So it seemed the logical thing to do.
why not have the array static?
Created attachment 47 [details] Workaround for fake-queue
The patch for fake-queue.h works, but just looks ugly. Since <sys/param.h> is the one <sys/queue.h>, and the full path becomes: "includes.h" -> "config.h" -> "defines.h" -> <sys/param.h> I wasn't able to come up with a better solution. The #undef's are there to get rid of the 'redefinition' warnings. That it works on 4.1 is probably, because for some reason somewhere, KERNEL is defined on 4.2 before including <sys/param.h> while it isn't on 4.1. As for the static cmds[], that seemed to do the trick quite well.
*** Bug 155 has been marked as a duplicate of this bug. ***
*** Bug 174 has been marked as a duplicate of this bug. ***
I just commited a patch that does the following: - Removes all attempt to detect/use system <sys/queue.h> - #undef all macros in fake-queue.h - changes the #ifdef/#define/#endif wrapper from _SYS_QUEUE to _FAKE_QUEUE - Uses our fake-queue.h always It should be out on the CVS mirrors within a few hours. If this does not resolve the issue please reopen before 3.2 release. - Ben
Mass change of RESOLVED bugs to CLOSED