On 24/02/15 21:56, Tim Rice wrote:> On Wed, 25 Feb 2015, Damien Miller wrote: > > | On Tue, 24 Feb 2015, Tom G. Christensen wrote: > | > | > I've switched to HEAD in the git repo and it now builds on Solaris > | > 2.6, 7, 8 and 9 but the testsuite still cannot be built due to the > | > missing <err.h>. > > The err.h issue is fixes but there still msghdr structure differences > to deal with. >Yes I saw that later. The testsuite build fails on Solaris 2.6 thusly: regress/netcat.c: In function 'timeout_connect': regress/netcat.c:703: warning: passing argument 2 of 'connect' discards qualifiers from pointer target type regress/netcat.c:709: warning: passing argument 4 of 'getsockopt' from incompatible pointer type regress/netcat.c: In function 'local_listen': regress/netcat.c:735: warning: unused variable 'x' regress/netcat.c:735: warning: unused variable 'ret' regress/netcat.c: In function 'fdpass': regress/netcat.c:1037: error: 'struct msghdr' has no member named 'msg_control' regress/netcat.c:1038: error: 'struct msghdr' has no member named 'msg_controllen' regress/netcat.c:1039: error: 'struct msghdr' has no member named 'msg_controllen' regress/netcat.c:1039: error: 'struct msghdr' has no member named 'msg_control' regress/netcat.c: In function 'set_common_sockopts': regress/netcat.c:1196: warning: passing argument 4 of 'setsockopt' from incompatible pointer type regress/netcat.c:1201: warning: passing argument 4 of 'setsockopt' from incompatible pointer type regress/netcat.c:1206: warning: passing argument 4 of 'setsockopt' from incompatible pointer type regress/netcat.c:1211: warning: passing argument 4 of 'setsockopt' from incompatible pointer type regress/netcat.c: In function 'decode_addrport': regress/netcat.c:1419: warning: comparison between signed and unsigned make: *** [regress/netcat] Error 1 I guess that is what you meant about structure differences. It looks like on Solaris I can choose between msg_accrights* or msg_control*/msg_flags in struct msghdr. The latter requires _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED which will also require __EXTENSIONS__ or other useful things suddenly go away. Building openssh with CC="gcc -D__EXTENSIONS__ -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED" is possible (tested only on Solaris 9 so far). Unfortunately now that I can finally run the testsuite I see ssh-keygen dumps core in keygen-change.sh but all tests before that passes. $ gdb ssh-keygen GNU gdb (GDB) 7.8 ... Reading symbols from ssh-keygen...done. (gdb) core regress/core [New LWP 1] Core was generated by `/export/home/tgc/buildpkg/openssh/src/openssh-git/ssh-keygen -p -P secret1 -N 2'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0xfedb4b14 in strlen () from /usr/lib/libc.so.1 (gdb) bt #0 0xfedb4b14 in strlen () from /usr/lib/libc.so.1 #1 0xfee07a20 in _doprnt () from /usr/lib/libc.so.1 #2 0xfee095e0 in printf () from /usr/lib/libc.so.1 #3 0x000546b0 in do_change_passphrase (pw=pw at entry=0x92954) at ssh-keygen.c:1279 #4 0x00059420 in main (argc=0, argv=0xffbfe664) at ssh-keygen.c:2530 (gdb) fram 3 #3 0x000546b0 in do_change_passphrase (pw=pw at entry=0x92954) at ssh-keygen.c:1279 1279 printf("Key has comment '%s'\n", comment); (gdb) print comment $1 = 0x0 (gdb) I've not had time to look into this further and also I've not verified if this happens without setting CC. -tgc
On Wed, 25 Feb 2015, Tom G. Christensen wrote:> On 24/02/15 21:56, Tim Rice wrote: > > On Wed, 25 Feb 2015, Damien Miller wrote: > > > > | On Tue, 24 Feb 2015, Tom G. Christensen wrote: > > | > > | > I've switched to HEAD in the git repo and it now builds on Solaris > > | > 2.6, 7, 8 and 9 but the testsuite still cannot be built due to the > > | > missing <err.h>. > > > > The err.h issue is fixes but there still msghdr structure differences > > to deal with. > > > > Yes I saw that later. > > The testsuite build fails on Solaris 2.6 thusly:[...]> regress/netcat.c:1037: error: 'struct msghdr' has no member named > 'msg_control'ah, looks like we need to copy some bits from monitor_fdpass.c -d
On Thu, 26 Feb 2015, Damien Miller wrote:> > Yes I saw that later. > > > > The testsuite build fails on Solaris 2.6 thusly: > [...] > > regress/netcat.c:1037: error: 'struct msghdr' has no member named > > 'msg_control' > > ah, looks like we need to copy some bits from monitor_fdpass.cPerhaps like this: diff --git regress/netcat.c regress/netcat.c index 3f100bd..29e85bf 100644 --- regress/netcat.c +++ regress/netcat.c @@ -1014,43 +1014,44 @@ fillbuf(int fd, unsigned char *buf, size_t *bufpos) void fdpass(int nfd) { - struct msghdr mh; +#if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) + struct msghdr msg; +#ifndef HAVE_ACCRIGHTS_IN_MSGHDR union { struct cmsghdr hdr; char buf[CMSG_SPACE(sizeof(int))]; } cmsgbuf; struct cmsghdr *cmsg; - struct iovec iov; - char c = '\0'; - ssize_t r; +#endif + struct iovec vec; + char ch = '\0'; struct pollfd pfd; + ssize_t r; - /* Avoid obvious stupidity */ - if (isatty(STDOUT_FILENO)) - errx(1, "Cannot pass file descriptor to tty"); - - bzero(&mh, sizeof(mh)); - bzero(&cmsgbuf, sizeof(cmsgbuf)); - bzero(&iov, sizeof(iov)); - bzero(&pfd, sizeof(pfd)); - - mh.msg_control = (caddr_t)&cmsgbuf.buf; - mh.msg_controllen = sizeof(cmsgbuf.buf); - cmsg = CMSG_FIRSTHDR(&mh); + memset(&msg, 0, sizeof(msg)); +#ifdef HAVE_ACCRIGHTS_IN_MSGHDR + msg.msg_accrights = (caddr_t)&nfd; + msg.msg_accrightslen = sizeof(nfd); +#else + memset(&cmsgbuf, 0, sizeof(cmsgbuf)); + msg.msg_control = (caddr_t)&cmsgbuf.buf; + msg.msg_controllen = sizeof(cmsgbuf.buf); + cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_len = CMSG_LEN(sizeof(int)); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; *(int *)CMSG_DATA(cmsg) = nfd; +#endif - iov.iov_base = &c; - iov.iov_len = 1; - mh.msg_iov = &iov; - mh.msg_iovlen = 1; + vec.iov_base = &ch; + vec.iov_len = 1; + msg.msg_iov = &vec; + msg.msg_iovlen = 1; bzero(&pfd, sizeof(pfd)); pfd.fd = STDOUT_FILENO; for (;;) { - r = sendmsg(STDOUT_FILENO, &mh, 0); + r = sendmsg(STDOUT_FILENO, &msg, 0); if (r == -1) { if (errno == EAGAIN || errno == EINTR) { pfd.events = POLLOUT; @@ -1065,6 +1066,9 @@ fdpass(int nfd) break; } exit(0); +#else + errx(1, "%s: file descriptor passing not supported", __func__); +#endif } /* Deal with RFC 854 WILL/WONT DO/DONT negotiation. */