httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r652221 - /httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c
Date Wed, 30 Apr 2008 01:39:43 GMT
Author: wrowe
Date: Tue Apr 29 18:39:43 2008
New Revision: 652221

URL: http://svn.apache.org/viewvc?rev=652221&view=rev
Log:
Reorganize the cmd_port and cmd_eprt code to resemble
one another in code flow.  Construct sa, then start in on s.

Modified:
    httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c

Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c?rev=652221&r1=652220&r2=652221&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c Tue Apr 29 18:39:43 2008
@@ -1743,32 +1743,6 @@
         return res;
     }
 
-#if 0
-    if ((fsc->active_min != -1) && (fsc->active_min < 1024)) {
-        /*
-         * Here's the case of low numbered port creation; the only way to
-         * accomplish this is either grant the apache user/group the right to
-         * bind to low numbered ports, or to have the parent running as root
-         * spin off socket fd's through a domain socket to all interested ftp
-         * worker processes.
-         */
-    }
-#endif
-
-#if APR_MAJOR_VERSION < 1
-    rv = apr_socket_create_ex(&s, family, SOCK_STREAM, APR_PROTO_TCP,
-                              fc->data_pool);
-#else
-    rv = apr_socket_create(&s, family, SOCK_STREAM, APR_PROTO_TCP,
-                           fc->data_pool);
-#endif
-
-    if (rv != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
-                     "Couldn't create socket");
-        return FTP_REPLY_CANNOT_OPEN_DATACONN;
-    }
-
     sa = apr_palloc(fc->data_pool, sizeof(apr_sockaddr_t));
     memcpy(sa, c->local_addr, sizeof(apr_sockaddr_t));
     sa->next = NULL;
@@ -1789,7 +1763,34 @@
     }
     sa->sa.sin.sin_port = htons(sa->port);
 
+#if APR_MAJOR_VERSION < 1
+    rv = apr_socket_create_ex(&s, family, SOCK_STREAM, APR_PROTO_TCP,
+                              fc->data_pool);
+#else
+    rv = apr_socket_create(&s, family, SOCK_STREAM, APR_PROTO_TCP,
+                           fc->data_pool);
+#endif
+
+    if (rv != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
+                     "Couldn't create socket");
+        return FTP_REPLY_CANNOT_OPEN_DATACONN;
+    }
+
     apr_socket_opt_set(s, APR_SO_REUSEADDR, 1);
+
+#if 0
+    if ((fsc->active_min != -1) && (fsc->active_min < 1024)) {
+        /*
+         * Here's the case of low numbered port creation; the only way to
+         * accomplish this is either grant the apache user/group the right to
+         * bind to low numbered ports, or to have the parent running as root
+         * spin off socket fd's through a domain socket to all interested ftp
+         * worker processes.
+         */
+    }
+#endif
+
     rv = apr_socket_bind(s, sa);
 
     if (rv != APR_SUCCESS) {
@@ -1903,32 +1904,6 @@
         }
     }
 
-#if 0
-    if ((fsc->active_min != -1) && (fsc->active_min < 1024)) {
-        /*
-         * Here's the case of low numbered port creation; the only way to
-         * accomplish this is either grant the apache user/group the right to
-         * bind to low numbered ports, or to have the parent running as root
-         * spin off socket fd's through a domain socket to all interested ftp
-         * worker processes.
-         */
-    }
-#endif
-
-#if APR_MAJOR_VERSION < 1
-    rv = apr_socket_create_ex(&s, APR_INET, SOCK_STREAM, APR_PROTO_TCP,
-                              fc->data_pool);
-#else
-    rv = apr_socket_create(&s, APR_INET, SOCK_STREAM, APR_PROTO_TCP,
-                           fc->data_pool);
-#endif
-
-    if (rv != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
-                     "Couldn't create socket");
-        return FTP_REPLY_CANNOT_OPEN_DATACONN;
-    }
-
     if (fsc->active_min != -1) {
         local_port = fsc->active_min +
             (apr_port_t) (rand() % (fsc->active_max -
@@ -1963,7 +1938,35 @@
         return FTP_REPLY_CANNOT_OPEN_DATACONN;
     }
 
+#if APR_MAJOR_VERSION < 1
+    rv = apr_socket_create_ex(&s, APR_INET, SOCK_STREAM, APR_PROTO_TCP,
+                              fc->data_pool);
+#else
+    rv = apr_socket_create(&s, APR_INET, SOCK_STREAM, APR_PROTO_TCP,
+                           fc->data_pool);
+#endif
+
+    if (rv != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
+                     "Couldn't create socket");
+        return FTP_REPLY_CANNOT_OPEN_DATACONN;
+    }
+
     apr_socket_opt_set(s, APR_SO_REUSEADDR, 1);
+
+#if 0
+    if ((fsc->active_min != -1) && (fsc->active_min < 1024)) {
+        /*
+         * Here's the case of low numbered port creation; the only way to
+         * accomplish this is either grant the apache user/group the right to
+         * bind to low numbered ports, or to have the parent running as root
+         * spin off socket fd's through a domain socket to all interested ftp
+         * worker processes.
+         */
+    }
+    else
+#endif
+
     rv = apr_socket_bind(s, sa);
 
     if (rv != APR_SUCCESS) {



Mime
View raw message