Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 77851 invoked from network); 31 May 2009 08:51:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 31 May 2009 08:51:22 -0000 Received: (qmail 38619 invoked by uid 500); 31 May 2009 08:51:34 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 38544 invoked by uid 500); 31 May 2009 08:51:34 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 38535 invoked by uid 99); 31 May 2009 08:51:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 May 2009 08:51:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 May 2009 08:51:30 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 40D982388872; Sun, 31 May 2009 08:51:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r780385 - in /httpd/mod_ftp/trunk/modules/ftp: ftp_data_connection.c ftp_lowportd.c Date: Sun, 31 May 2009 08:51:09 -0000 To: cvs@httpd.apache.org From: wrowe@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090531085109.40D982388872@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: wrowe Date: Sun May 31 08:51:08 2009 New Revision: 780385 URL: http://svn.apache.org/viewvc?rev=780385&view=rev Log: Compiles on Solaris. With luck, this even works. Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c httpd/mod_ftp/trunk/modules/ftp/ftp_lowportd.c Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c?rev=780385&r1=780384&r2=780385&view=diff ============================================================================== --- httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c (original) +++ httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c Sun May 31 08:51:08 2009 @@ -175,7 +175,7 @@ fc->passive_created = -1; } -#ifdef HAVE_NETINET_IP_H +#ifdef HAVE_SOL_IP_H sopt = IPTOS_THROUGHPUT; if (((apr_os_sock_get(&sd, fc->datasock)) == APR_SUCCESS) && #ifdef HAVE_SOL_IP Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_lowportd.c URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_lowportd.c?rev=780385&r1=780384&r2=780385&view=diff ============================================================================== --- httpd/mod_ftp/trunk/modules/ftp/ftp_lowportd.c (original) +++ httpd/mod_ftp/trunk/modules/ftp/ftp_lowportd.c Sun May 31 08:51:08 2009 @@ -191,16 +191,24 @@ apr_status_t stat; int sd = -1; struct msghdr msg = {0}; + int one; + struct iovec iov = {(void*)&one, sizeof(one)}; +#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL struct cmsghdr *cmsg; union { struct cmsghdr align; char ccmsg[CMSG_SPACE(sizeof(*sockinfo.os_sock))]; } msgbuf; - int one; - struct iovec iov = {&one, sizeof(one)}; msg.msg_control = msgbuf.ccmsg; msg.msg_controllen = sizeof(msgbuf.ccmsg); +#else + int fd = -1; + + msg.msg_accrightslen = sizeof(fd); + msg.msg_accrights = (caddr_t)&fd; + sockinfo.os_sock = &fd; +#endif msg.msg_iov = &iov; msg.msg_iovlen = 1; @@ -239,16 +247,21 @@ return stat; } +#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL cmsg = CMSG_FIRSTHDR(&msg); - if (!cmsg || cmsg->cmsg_level != SOL_SOCKET - || cmsg->cmsg_type != SCM_RIGHTS) { + if (cmsg && CMSG_LEN == sizeof(int) && cmsg->cmsg_level == SOL_SOCKET + && cmsg->cmsg_type == SCM_RIGHTS) + sockinfo.os_sock = (int *)CMSG_DATA(cmsg); + else +#else + if (msg.msg_accrightslen != sizeof(fd)) +#endif + { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, APR_EINVAL, r, "ftp low numbered port request; unexpected response"); close(sd); return APR_EINVAL; } - - sockinfo.os_sock = (int *)CMSG_DATA(cmsg); sockinfo.family = sa->sa.sin.sin_family; sockinfo.type = SOCK_STREAM; #if APR_MAJOR_VERSION > 0 @@ -354,12 +367,14 @@ int fd; int one = 1; struct msghdr msg = {0}; + struct iovec iov = {(void*)&one, sizeof(one)}; +#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL struct cmsghdr *cmsg; union { struct cmsghdr align; char ccmsg[CMSG_SPACE(sizeof(fd))]; } msgbuf; - struct iovec iov = {&one, sizeof(one)}; +#endif apr_pool_clear(ptrans); @@ -433,17 +448,24 @@ continue; } - msg.msg_control = msgbuf.ccmsg; - msg.msg_controllen = sizeof(msgbuf.ccmsg); msg.msg_iov = &iov; msg.msg_iovlen = 1; +#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL + msg.msg_control = msgbuf.ccmsg; + msg.msg_controllen = sizeof(msgbuf.ccmsg); + + cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(sizeof(fd)); *(int*)CMSG_DATA(cmsg) = fd; msg.msg_controllen = cmsg->cmsg_len; +#else + msg.msg_accrightslen = sizeof(fd); + msg.msg_accrights = (caddr_t)&fd; +#endif while (sendmsg(sd2, &msg, 0) == -1) if (errno != EINTR) {