httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
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 GMT
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) {



Mime
View raw message