httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r629101 [3/4] - /httpd/mod_ftp/trunk/modules/ftp/
Date Tue, 19 Feb 2008 14:03:38 GMT
Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_connection.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_connection.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_connection.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_connection.c Tue Feb 19 06:03:35 2008
@@ -34,34 +34,35 @@
  * Arguments: c - The connection associated with the session
  *            fc - The ftp connection to initialize
  *
- * Returns: nothing 
+ * Returns: nothing
  */
 static void initialize_ftp_connection(conn_rec *c, ftp_connection *fc)
 {
-    /* The ftp_connection structure is calloc'ed so only initalize
-     * the members that we need to.
+    /*
+     * The ftp_connection structure is calloc'ed so only initalize the
+     * members that we need to.
      */
-    fc->connection       = c;
-    fc->user             = ftp_unknown_username;
-    fc->auth             = FTP_AUTH_NONE;
-    fc->prot             = FTP_PROT_CLEAR;
-    fc->type             = TYPE_A;
-    fc->passive_created  = -1;
-    fc->orig_server      = c->base_server;
-
-    fc->cwd              = apr_palloc(c->pool, APR_PATH_MAX + 1);
-    fc->cwd[0]           = '/';
-    fc->cwd[1]           = '\0';
+    fc->connection = c;
+    fc->user = ftp_unknown_username;
+    fc->auth = FTP_AUTH_NONE;
+    fc->prot = FTP_PROT_CLEAR;
+    fc->type = TYPE_A;
+    fc->passive_created = -1;
+    fc->orig_server = c->base_server;
+
+    fc->cwd = apr_palloc(c->pool, APR_PATH_MAX + 1);
+    fc->cwd[0] = '/';
+    fc->cwd[1] = '\0';
 
-    fc->rename_from      = apr_palloc(c->pool, APR_PATH_MAX + 1);
-    fc->rename_from[0]   = '\0';
+    fc->rename_from = apr_palloc(c->pool, APR_PATH_MAX + 1);
+    fc->rename_from[0] = '\0';
 
     apr_pool_create(&fc->login_pool, c->pool);
     apr_pool_tag(fc->login_pool, "login");
     apr_pool_create(&fc->data_pool, c->pool);
     apr_pool_tag(fc->data_pool, "data");
 
-    fc->cntlsock  = ap_get_module_config(c->conn_config, &core_module);
+    fc->cntlsock = ap_get_module_config(c->conn_config, &core_module);
 
     ftp_set_module_config(c->conn_config, fc);
 }
@@ -79,9 +80,10 @@
     apr_status_t rv;
     apr_socket_t *client_socket;
 
-    /* This is handled in the NET_TIME filter, which unfortunately
-     * ignores the timeout for the purpose of AP_MODE_INIT.
-     * Fix a timeout so the core read filter will behave.
+    /*
+     * This is handled in the NET_TIME filter, which unfortunately ignores
+     * the timeout for the purpose of AP_MODE_INIT. Fix a timeout so the core
+     * read filter will behave.
      */
     client_socket = ap_get_module_config(cdata->conn_config, &core_module);
     rv = apr_socket_timeout_set(client_socket, fc->orig_server->timeout);
@@ -100,29 +102,29 @@
         ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, fc->orig_server,
                      "Failed to initialize the ftp ssl data stream");
     }
-    
+
     return rv;
 }
 
 /*
- * ftp_send_welcome: Send the server welcome string to the client 
- * 
- * Arguments: fc - The ftp connection to send the welcome message to 
- * 
+ * ftp_send_welcome: Send the server welcome string to the client
+ *
+ * Arguments: fc - The ftp connection to send the welcome message to
+ *
  * Returns: apr_status_t
  */
 static apr_status_t ftp_send_welcome(ftp_connection *fc)
 {
     conn_rec *c = fc->connection;
-    ftp_server_config *fsc = 
-        ftp_get_module_config(fc->orig_server->module_config);
+    ftp_server_config *fsc =
+    ftp_get_module_config(fc->orig_server->module_config);
     apr_status_t rv;
 
     /* Check if a login message has been configured */
     if (fsc->banner_message) {
         if (fsc->banner_message_isfile) {
-            rv = ftp_show_file(c->output_filters, fc->data_pool, 
-                               FTP_REPLY_SERVICE_READY, fc, 
+            rv = ftp_show_file(c->output_filters, fc->data_pool,
+                               FTP_REPLY_SERVICE_READY, fc,
                                fsc->banner_message);
             if (rv != APR_SUCCESS) {
                 return rv;
@@ -135,7 +137,7 @@
                                  outbuf, sizeof(outbuf));
 
             rv = ftp_reply(fc, c->output_filters, fc->data_pool,
-                           FTP_REPLY_SERVICE_READY, 1, outbuf); 
+                           FTP_REPLY_SERVICE_READY, 1, outbuf);
 
             if (rv != APR_SUCCESS) {
                 return rv;
@@ -152,11 +154,11 @@
 }
 
 /*
- * ftp_process_connection: Connection handler for the FTP module. 
- * 
+ * ftp_process_connection: Connection handler for the FTP module.
+ *
  * Arguments: c - The incoming connection
  *
- * Returns: Returns OK when the connection is to be closed. 
+ * Returns: Returns OK when the connection is to be closed.
  */
 int ftp_process_connection(conn_rec *c)
 {
@@ -168,14 +170,14 @@
     extern ap_filter_rec_t *ftp_ssl_input_filter_handle;
     extern ap_filter_rec_t *ftp_ssl_output_filter_handle;
     ftp_server_config *fsc =
-        ftp_get_module_config(c->base_server->module_config);
+    ftp_get_module_config(c->base_server->module_config);
 
     if (!fsc->enabled) {
         return DECLINED;
     }
 
     /*
-     * Allocate for FTP connection structure, and initialize 
+     * Allocate for FTP connection structure, and initialize
      */
     fc = apr_pcalloc(c->pool, sizeof(*fc));
     initialize_ftp_connection(c, fc);
@@ -194,27 +196,29 @@
                 ap_remove_input_filter(f);
             }
         }
-    } else {
+    }
+    else {
         /* Initialize control connection */
         if ((rv = ftp_ssl_init(c)) != APR_SUCCESS) {
-            /* Error initializing the connection, most likely from a
-             * client attempting to connect w/o SSL.  Just drop the 
-             * connection */
+            /*
+             * Error initializing the connection, most likely from a client
+             * attempting to connect w/o SSL.  Just drop the connection
+             */
             ap_log_error(APLOG_MARK, APLOG_INFO, rv, fc->orig_server,
                          "Error initializing SSL connection.  Client "
                          "connecting without SSL?");
             return OK;
         }
 
-        /* From draft-murray-auth-ftp-ssl-06.txt:
-         * For implicit SSL the data connection should be implicitly
-         * protected (i.e. the PBSZ 0, PROT P command sequence is not 
-         * required but the client and server will protect the data channel 
-         * as if it had).
-         *
+        /*
+         * From draft-murray-auth-ftp-ssl-06.txt: For implicit SSL the data
+         * connection should be implicitly protected (i.e. the PBSZ 0, PROT P
+         * command sequence is not required but the client and server will
+         * protect the data channel as if it had).
+         * 
          * Support for Implicit SSL was declared deprecated as of
-         * draft-murray-auth-ftp-ssl-07.txt, and is not documented 
-         * whatsoever within RFC4217.
+         * draft-murray-auth-ftp-ssl-07.txt, and is not documented whatsoever
+         * within RFC4217.
          */
         fc->auth = FTP_AUTH_SSL;
         fc->prot = FTP_PROT_PRIVATE;
@@ -229,12 +233,12 @@
     }
 
     /*
-     * Begin processing requests 
+     * Begin processing requests
      */
 
     /* Set initial login timeout value */
     rv = apr_socket_timeout_set(fc->cntlsock,
-                          fsc->timeout_login * APR_USEC_PER_SEC);
+                                fsc->timeout_login * APR_USEC_PER_SEC);
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, fc->orig_server,
                      "Couldn't set SO_TIMEOUT socket option");
@@ -245,14 +249,15 @@
 
     while ((r = ftp_read_request(fc)) != NULL) {
 
-        /* Set socket timeout values.  A user can use the SITE command
-         * to change the idle timeout during an FTP session, but since
-         * we do not support the SITE command, it doesn't make sense to
-         * be setting the socket timeout on every single request.
+        /*
+         * Set socket timeout values.  A user can use the SITE command to
+         * change the idle timeout during an FTP session, but since we do not
+         * support the SITE command, it doesn't make sense to be setting the
+         * socket timeout on every single request.
          */
         if (!idle_timeout_set) {
             rv = apr_socket_timeout_set(fc->cntlsock,
-                                  fsc->timeout_idle * APR_USEC_PER_SEC);
+                                        fsc->timeout_idle * APR_USEC_PER_SEC);
             if (rv != APR_SUCCESS) {
                 ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, r->server,
                              "Couldn't set socket timeout");
@@ -262,9 +267,9 @@
 
         ap_update_child_status(c->sbh,
                                SERVER_BUSY_WRITE, NULL);
-        
+
         ftp_process_request(r);
-        
+
         if (ap_extended_status) {
             ap_increment_counts(c->sbh, r);
         }
@@ -275,13 +280,13 @@
         if (fc->close_connection) {
             break;
         }
-        
+
         /* Check if the client has requested a secure connection */
-        if ((fc->auth == FTP_AUTH_TLS || fc->auth == FTP_AUTH_SSL) && 
+        if ((fc->auth == FTP_AUTH_TLS || fc->auth == FTP_AUTH_SSL) &&
             fc->is_secure == 0) {
-            ap_add_output_filter_handle(ftp_ssl_output_filter_handle, 
-                                        fc->ssl_output_ctx, NULL ,c);
-            ap_add_input_filter_handle(ftp_ssl_input_filter_handle, 
+            ap_add_output_filter_handle(ftp_ssl_output_filter_handle,
+                                        fc->ssl_output_ctx, NULL, c);
+            ap_add_input_filter_handle(ftp_ssl_input_filter_handle,
                                        fc->ssl_input_ctx, NULL, c);
             fc->is_secure = 1;
         }

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=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c Tue Feb 19 06:03:35 2008
@@ -39,11 +39,11 @@
 }
 
 /*
- * ftp_open_datasock: If we are in passive mode we accept and return a 
+ * ftp_open_datasock: If we are in passive mode we accept and return a
  *                    socket.  If we are in active mode, a socket is
- *                    created based on the fc->clientsa sockaddr and 
+ *                    created based on the fc->clientsa sockaddr and
  *                    then returned.
- * 
+ *
  * Arguments: r - The request.
  *
  * Returns: apr_status_t
@@ -60,16 +60,17 @@
 
     fsc = ftp_get_module_config(r->server->module_config);
 
-    /* handle err condition when the creation of the socket had failed,
-     * this will occur if a PORT command has failed */
+    /*
+     * handle err condition when the creation of the socket had failed, this
+     * will occur if a PORT command has failed
+     */
     if (!fc->csock) {
-       ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, r->server,
-                    "Nonexistant connection");
-       return APR_EGENERAL;
+        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r->server,
+                     "Nonexistant connection");
+        return APR_EGENERAL;
     }
 
-    if (fc->passive_created != -1)
-    {
+    if (fc->passive_created != -1) {
         pollset[0].desc_type = APR_POLL_SOCKET;
         pollset[0].desc.s = fc->csock;
         pollset[0].reqevents = APR_POLLIN;
@@ -77,32 +78,39 @@
         pollset[1].desc.s = fc->cntlsock;
         pollset[1].reqevents = (APR_POLLIN | APR_POLLPRI);
 
-        /* since it is possible to hang in accept(), poll both
-         * the control and client sockets waiting for activity. */
-        apr_socket_timeout_get(fc->csock, &timeout); /* likely to be -1 */
+        /*
+         * since it is possible to hang in accept(), poll both the control
+         * and client sockets waiting for activity.
+         */
+        apr_socket_timeout_get(fc->csock, &timeout);    /* likely to be -1 */
         res = apr_poll(pollset, 2, &n, timeout);
-                
+
         if (res == APR_SUCCESS) {
             if (pollset[0].rtnevents & APR_POLLIN) {
                 /* activity on client socket, fall through to accept() */
                 ;
-            } else if (pollset[1].rtnevents & (APR_POLLIN | APR_POLLPRI)) {
-                /* command channel has activity. since we can only do
-                 * a single read ahead operation, no use in looping here
-                 * if the command is not an ABOR.  bail out and let
-                 * command processing occur as normal. */
+            }
+            else if (pollset[1].rtnevents & (APR_POLLIN | APR_POLLPRI)) {
+                /*
+                 * command channel has activity. since we can only do a
+                 * single read ahead operation, no use in looping here if the
+                 * command is not an ABOR.  bail out and let command
+                 * processing occur as normal.
+                 */
                 ap_log_error(APLOG_MARK, APLOG_ERR, res, r->server,
                              "Activity on control channel while waiting "
                              "for client connect, processing command");
-                
+
                 /* manual cleanup, no need to close the socket */
                 fc->csock = NULL;
                 fc->passive_created = -1;
                 return APR_ECONNRESET;
             }
-        } else {
-            /* not much we can do, one of our sockets was likely
-             * disconnected */
+        }
+        else {
+            /*
+             * not much we can do, one of our sockets was likely disconnected
+             */
             fc->csock = NULL;
             fc->passive_created = -1;
             return APR_EGENERAL;
@@ -120,7 +128,7 @@
             ap_log_error(APLOG_MARK, APLOG_ERR, res, r->server,
                          "Couldn't close passive connection");
         }
-        
+
         /* retest the apr_accept result from above */
         if (rv != APR_SUCCESS) {
             return rv;
@@ -165,10 +173,10 @@
         ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
                      "Couldn't set APR_SO_REUSEADDR socket option");
     }
-    
+
     /* Set the default data connection timeout value */
     rv = apr_socket_timeout_set(fc->datasock,
-                          fsc->timeout_data * APR_USEC_PER_SEC);
+                                fsc->timeout_data * APR_USEC_PER_SEC);
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
                      "Couldn't set socket timeout");
@@ -179,8 +187,8 @@
 
 /*
  * ftp_open_dataconn: Creates the appropriate data channel
- *                    and initializes the 
- * 
+ *                    and initializes the
+ *
  * Arguments: r - The request.
  *            write - Open for write-to-client only
  *
@@ -191,26 +199,28 @@
     ftp_server_config *fsc = ftp_get_module_config(r->server->module_config);
     ftp_connection *fc = ftp_get_module_config(r->connection->conn_config);
     conn_rec *cdata;
-    ap_filter_t *f; 
+    ap_filter_t *f;
 
     if (ftp_open_datasock(r) != APR_SUCCESS) {
         return NULL;
     }
 
-    cdata = ap_run_create_connection(r->pool, r->server, fc->datasock, 
-                                     r->connection->id, r->connection->sbh, 
+    cdata = ap_run_create_connection(r->pool, r->server, fc->datasock,
+                                     r->connection->id, r->connection->sbh,
                                      r->connection->bucket_alloc);
 
     ftp_set_module_config(cdata->conn_config, fc);
 
     ap_run_pre_connection(cdata, fc->datasock);
 
-    /* Open data connection only if the connection is from the client's IP address.
-     * All other PASV connection attempts are denied, unless disabled using:
-     *
-     *   FTPOptions AllowProxyPASV
+    /*
+     * Open data connection only if the connection is from the client's IP
+     * address. All other PASV connection attempts are denied, unless
+     * disabled using:
+     * 
+     * FTPOptions AllowProxyPASV
      */
-    if (fc->clientsa == NULL) { /* Only check PASV, never PORT connections */ 
+    if (fc->clientsa == NULL) { /* Only check PASV, never PORT connections */
         if (!(fsc->options & FTP_OPT_ALLOWPROXYPASV)) {
             if (strcmp(fc->connection->remote_ip, cdata->remote_ip) != 0) {
                 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
@@ -228,31 +238,31 @@
         fc->passive_created = 0;
     }
 
-    if ( write_not_read ) {
-        /* We need the network-level poll filter to watch both the
-         * control incoming command and writable data port conditions
+    if (write_not_read) {
+        /*
+         * We need the network-level poll filter to watch both the control
+         * incoming command and writable data port conditions
          */
         fc->filter_mask += FTP_NEED_DATA_OUT;
     }
     else {
-        /* Once Apache has inserted the core i/o filters, we must
-         * insert our idea of a core socket, based on our own
-         * ftp_datasock bucket, instead of the socket_bucket.
-         * This will capture any abort command on the control
-         * socket while actually reading from the data socket.
-         *
+        /*
+         * Once Apache has inserted the core i/o filters, we must insert our
+         * idea of a core socket, based on our own ftp_datasock bucket,
+         * instead of the socket_bucket. This will capture any abort command
+         * on the control socket while actually reading from the data socket.
+         * 
          * Insert this bucket type only for read connections
          */
         for (f = cdata->input_filters; f; f = f->next) {
-            if (strcasecmp(f->frec->name, "CORE_IN") == 0) 
-            {
+            if (strcasecmp(f->frec->name, "CORE_IN") == 0) {
                 core_net_rec *net = f->ctx;
                 apr_bucket *e;
 
                 net->in_ctx = apr_pcalloc(fc->data_pool, sizeof(*net->in_ctx));
                 net->in_ctx->b = apr_brigade_create(fc->data_pool,
                                                     f->c->bucket_alloc);
-                net->in_ctx->tmpbb = 
+                net->in_ctx->tmpbb =
                     apr_brigade_create(net->in_ctx->b->p,
                                        net->in_ctx->b->bucket_alloc);
 
@@ -264,10 +274,11 @@
         }
     }
 
-    /* We initalize the data connection here by adding/removing
-     * the SSL/TLS filters.  We then invoke ftp_ssl_init immediately
-     * for writers, since negotation would normally occur on the
-     * first socket read (and we won't be reading from that socket.)
+    /*
+     * We initalize the data connection here by adding/removing the SSL/TLS
+     * filters.  We then invoke ftp_ssl_init immediately for writers, since
+     * negotation would normally occur on the first socket read (and we won't
+     * be reading from that socket.)
      */
     if (fc->prot == FTP_PROT_CLEAR) {
         for (f = cdata->output_filters; f; f = f->next) {
@@ -283,8 +294,8 @@
     }
     else if ((fc->prot == FTP_PROT_PRIVATE) && write_not_read) {
         if (ftp_ssl_init(cdata) != APR_SUCCESS) {
-            /* In case of failure within ssl_init, 
-             * return no data connection 
+            /*
+             * In case of failure within ssl_init, return no data connection
              */
             apr_socket_close(fc->datasock);
             fc->datasock = NULL;
@@ -296,12 +307,11 @@
      * We now need to remove the NET_TIME filter to allow
      * use to control timeouts ourselves.
      */
-     for (f = cdata->input_filters; f; f = f->next) {
-         if (strcasecmp(f->frec->name, "NET_TIME") == 0) {
-             ap_remove_input_filter(f);
-         }
-     }
+    for (f = cdata->input_filters; f; f = f->next) {
+        if (strcasecmp(f->frec->name, "NET_TIME") == 0) {
+            ap_remove_input_filter(f);
+        }
+    }
 
     return cdata;
 }
-

Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_data_filters.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_data_filters.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_data_filters.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_data_filters.c Tue Feb 19 06:03:35 2008
@@ -24,14 +24,14 @@
 #include "mod_ftp.h"
 
 /* Reimplement the core i/o filters to insert two-channel
- * data socket buckets for send or retrieve, monitoring 
+ * data socket buckets for send or retrieve, monitoring
  * the control channel for sideband ABOR-like commands.
  *
  * These filters sit below
  */
 
-static apr_status_t datasock_bucket_read(apr_bucket *a, const char **str,
-                                         apr_size_t *len, apr_read_type_e block)
+static apr_status_t datasock_bucket_read(apr_bucket * a, const char **str,
+                                    apr_size_t * len, apr_read_type_e block)
 {
     ftp_connection *fc = a->data;
     apr_socket_t *sd = fc->datasock;
@@ -67,23 +67,23 @@
 
     pollset[0].desc_type = APR_POLL_SOCKET;
     pollset[0].desc.s = fc->datasock;
-    pollset[0].reqevents = APR_POLLIN; /* APR_POLLOUT for write */
+    pollset[0].reqevents = APR_POLLIN;  /* APR_POLLOUT for write */
     pollset[1].desc_type = APR_POLL_SOCKET;
     pollset[1].desc.s = fc->cntlsock;
     pollset[1].reqevents = (APR_POLLIN | APR_POLLPRI);
-    pollset[1].rtnevents = 0; /* For poll(1), pretend poll answered this */
+    pollset[1].rtnevents = 0;   /* For poll(1), pretend poll answered this */
 
     /* XXX: evil, no apr_socket_pool_get accessor available, though */
-    pollset[1].p = pollset[0].p = *((apr_pool_t **)fc->datasock);
-    
+    pollset[1].p = pollset[0].p = *((apr_pool_t **) fc->datasock);
+
     do {
         /* Unset so we don't trip over the len when we don't call recv */
         *len = 0;
 
-        /* If we have already assembled our next_request, don't
-        * bother polling the control connection - we won't read
-        * ahead two commands
-        */
+        /*
+         * If we have already assembled our next_request, don't bother
+         * polling the control connection - we won't read ahead two commands
+         */
         rv = apr_poll(pollset, fc->next_request ? 1 : 2,
                       &n, polltimeout);
         /* pedantic sanity check, this should never happen */
@@ -92,9 +92,9 @@
         }
 
         if (rv != APR_SUCCESS) {
-            /* The loss of either socket here means
-             * the death of the data connection.
-             * Unset the length to avoid looping
+            /*
+             * The loss of either socket here means the death of the data
+             * connection. Unset the length to avoid looping
              */
             break;
         }
@@ -115,11 +115,12 @@
             *len = APR_BUCKET_BUFF_SIZE;
             rv = apr_socket_recv(sd, buf, len);
         }
-    } while (APR_STATUS_IS_EINTR(rv) 
-                 || (APR_STATUS_IS_EAGAIN(rv) && (block == APR_BLOCK_READ)));
-    /* EINTR, above, is obvious, EAGAIN is less so - win32 (perhaps others)
-     * can trigger POLLIN a little too early, before the recieved packet
-     * has actually been disassembled - so loop again.
+    } while (APR_STATUS_IS_EINTR(rv)
+             || (APR_STATUS_IS_EAGAIN(rv) && (block == APR_BLOCK_READ)));
+    /*
+     * EINTR, above, is obvious, EAGAIN is less so - win32 (perhaps others)
+     * can trigger POLLIN a little too early, before the recieved packet has
+     * actually been disassembled - so loop again.
      */
 
     if (block == APR_NONBLOCK_READ) {
@@ -142,7 +143,7 @@
      * new bucket.
      *
      * Even if there is nothing more to read, don't close the socket here
-     * as we have to use it to send any response :)  We could shut it 
+     * as we have to use it to send any response :)  We could shut it
      * down for reading, but there is no benefit to doing so.
      */
     if (*len > 0) {
@@ -150,7 +151,7 @@
         /* Change the current bucket to refer to what we read */
         a = apr_bucket_heap_make(a, buf, *len, apr_bucket_free);
         h = a->data;
-        h->alloc_len = APR_BUCKET_BUFF_SIZE; /* note the real buffer size */
+        h->alloc_len = APR_BUCKET_BUFF_SIZE;    /* note the real buffer size */
         *str = buf;
         APR_BUCKET_INSERT_AFTER(a, ftp_bucket_datasock_create(fc, a->list));
     }
@@ -162,22 +163,22 @@
     return APR_SUCCESS;
 }
 
-static apr_bucket *ftp_bucket_datasock_make(apr_bucket *b, ftp_connection *fc)
+static apr_bucket *ftp_bucket_datasock_make(apr_bucket * b, ftp_connection *fc)
 {
     /*
      * Note that typically the socket is allocated from the connection pool
-     * so it will disappear when the connection is finished. 
+     * so it will disappear when the connection is finished.
      */
-    b->type        = &ftp_bucket_type_datasock;
-    b->length      = (apr_size_t)(-1);
-    b->start       = -1;
-    b->data        = fc;
+    b->type = &ftp_bucket_type_datasock;
+    b->length = (apr_size_t) (-1);
+    b->start = -1;
+    b->data = fc;
 
     return b;
 }
 
 apr_bucket *ftp_bucket_datasock_create(ftp_connection *fc,
-                                       apr_bucket_alloc_t *list)
+                                                  apr_bucket_alloc_t * list)
 {
     apr_bucket *b = apr_bucket_alloc(sizeof(*b), list);
 
@@ -193,13 +194,13 @@
     APR_BUCKET_DATA,
     apr_bucket_destroy_noop,
     datasock_bucket_read,
-    apr_bucket_setaside_notimpl, 
+    apr_bucket_setaside_notimpl,
     apr_bucket_split_notimpl,
     apr_bucket_copy_notimpl
 };
- 
- 
-apr_status_t ftp_data_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
+
+
+apr_status_t ftp_data_out_filter(ap_filter_t * f, apr_bucket_brigade *bb)
 {
     ftp_connection *fc = f->ctx;
     ftp_server_config *fsc;
@@ -225,11 +226,12 @@
 
     while (!APR_BRIGADE_EMPTY(bb)) {
 
-        /* The brigade can be far to 'chunky' to respect the ABOR
-         * tests we perform below.  Dice up the raw response stream
-         * into chuncks (48000 bytes by default) and and check between
-         * each chunk for a control channel command.  At 48000 this is 
-         * at least 1/minute on a very slow 9600 baud line.
+        /*
+         * The brigade can be far to 'chunky' to respect the ABOR tests we
+         * perform below.  Dice up the raw response stream into chuncks
+         * (48000 bytes by default) and and check between each chunk for a
+         * control channel command.  At 48000 this is at least 1/minute on a
+         * very slow 9600 baud line.
          */
         rv = apr_brigade_partition(bb, fsc->data_block_size, &e);
         if (rv != APR_SUCCESS && rv != APR_INCOMPLETE) {
@@ -237,8 +239,9 @@
         }
         next_bb = apr_brigade_split(bb, e);
 
-        /* Poll to see if we are are prepared to pass on the brigade
-         * and the client hasn't ABORted us yet.
+        /*
+         * Poll to see if we are are prepared to pass on the brigade and the
+         * client hasn't ABORted us yet.
          */
         apr_socket_timeout_get(fc->datasock, &polltimeout);
 
@@ -248,15 +251,17 @@
         pollset[1].desc_type = APR_POLL_SOCKET;
         pollset[1].desc.s = fc->cntlsock;
         pollset[1].reqevents = (APR_POLLIN | APR_POLLPRI);
-        pollset[1].rtnevents = 0; /* For poll(1), pretend poll answered this */
+        pollset[1].rtnevents = 0;       /* For poll(1), pretend poll answered
+                                         * this */
 
         /* XXX: evil, no apr_socket_pool_get accessor available, though */
-        pollset[1].p = pollset[0].p = *((apr_pool_t **)fc->datasock);
+        pollset[1].p = pollset[0].p = *((apr_pool_t **) fc->datasock);
 
         do {
-            /* If we have already assembled our next_request, don't
-             * bother polling the control connection - we won't read
-             * ahead two commands
+            /*
+             * If we have already assembled our next_request, don't bother
+             * polling the control connection - we won't read ahead two
+             * commands
              */
             rv = apr_poll(pollset, fc->next_request ? 1 : 2,
                           &n, polltimeout);
@@ -266,8 +271,9 @@
             }
 
             if (rv != APR_SUCCESS) {
-                /* The loss of either socket here means
-                 * the death of the data connection.
+                /*
+                 * The loss of either socket here means the death of the data
+                 * connection.
                  */
                 break;
             }
@@ -277,8 +283,8 @@
                 rv = ftp_read_ahead_request(fc);
 
                 if ((rv != APR_SUCCESS) &&
-                    !(APR_STATUS_IS_EINTR(rv) || (APR_STATUS_IS_EAGAIN(rv)) ||
-                      APR_STATUS_IS_EOF(rv))) {
+                  !(APR_STATUS_IS_EINTR(rv) || (APR_STATUS_IS_EAGAIN(rv)) ||
+                    APR_STATUS_IS_EOF(rv))) {
                     f->c->aborted = 1;
                     return rv;
                 }
@@ -288,9 +294,10 @@
                 break;
             }
         } while (APR_STATUS_IS_EINTR(rv) || APR_STATUS_IS_EAGAIN(rv));
-        /* EINTR, above, is obvious, EAGAIN is less so - win32 (perhaps others)
-         * can trigger POLLIN a little too early, before the recieved packet
-         * has actually been disassembled - so loop again.
+        /*
+         * EINTR, above, is obvious, EAGAIN is less so - win32 (perhaps
+         * others) can trigger POLLIN a little too early, before the recieved
+         * packet has actually been disassembled - so loop again.
          */
 
         if (c->aborted || f->c->aborted) {

Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_filters.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_filters.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_filters.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_filters.c Tue Feb 19 06:03:35 2008
@@ -31,18 +31,18 @@
  *                  need them to transfer the file properly.
  *
  * Arguments: f - The current filter.
- *            bb - The bucket brigade sent down the filter stack. 
+ *            bb - The bucket brigade sent down the filter stack.
  *
  * Returns:  APR_SUCCESS on success, otherwise the status code is returned.
  */
 
-apr_status_t ftp_crlf_filter(ap_filter_t * f, apr_bucket_brigade * bb)
+apr_status_t ftp_crlf_filter(ap_filter_t *f, apr_bucket_brigade *bb)
 {
     apr_bucket *e;
     apr_bucket *b;
     apr_status_t rv;
     apr_off_t this_size = 0;
-    int *seen_cr = (int *)f->ctx;
+    int *seen_cr = (int *) f->ctx;
 
     e = APR_BRIGADE_FIRST(bb);
     while (e != APR_BRIGADE_SENTINEL(bb)) {
@@ -51,7 +51,7 @@
         const char *pos;
 
         if (e->length == 0) {
-            e = APR_BUCKET_NEXT(e);  /* onwards */
+            e = APR_BUCKET_NEXT(e);     /* onwards */
             continue;
         }
 
@@ -60,19 +60,20 @@
             return rv;
         }
 
-        /* Skip all of the extra effort below for empty buckets,
-         * if this is EOS we will catch it at the while condition
-         * looking for the trailing sentinal.
+        /*
+         * Skip all of the extra effort below for empty buckets, if this is
+         * EOS we will catch it at the while condition looking for the
+         * trailing sentinal.
          */
         if (len == 0) {
-            e = APR_BUCKET_NEXT(e);  /* onwards */
+            e = APR_BUCKET_NEXT(e);     /* onwards */
             continue;
         }
 
         /* Handle case where we have a leading LF */
         if (!*seen_cr) {
             if (buf[0] == '\n') {
-                b = apr_bucket_immortal_create("\r", 1, 
+                b = apr_bucket_immortal_create("\r", 1,
                                                f->c->bucket_alloc);
                 APR_BUCKET_INSERT_BEFORE(e, b);
                 this_size += 1;
@@ -82,41 +83,46 @@
             *seen_cr = 0;
         }
 
-        /* We search the data for a LF without a preceeding CR.
-         * If we find one, we split the bucket so that the LF 
-         * is the first character in the new bucket, and then
-         * insert a new bucket with a CR and insert it before 
-         * the LF bucket (ignored on the next loop by seen_cr.)
-         * As long as we keep seeing CRLF pairs, keep looking
-         * forward through the buffer.
+        /*
+         * We search the data for a LF without a preceeding CR. If we find
+         * one, we split the bucket so that the LF is the first character in
+         * the new bucket, and then insert a new bucket with a CR and insert
+         * it before the LF bucket (ignored on the next loop by seen_cr.) As
+         * long as we keep seeing CRLF pairs, keep looking forward through
+         * the buffer.
          */
         pos = buf;
-        while (++pos, pos = memchr(pos, APR_ASCII_LF, len - (pos-buf))) {
-            /* We found a bare linefeed, insert a CR and advance
-             * to the LF-remainder (we skip that LF above) */
+        while (++pos, pos = memchr(pos, APR_ASCII_LF, len - (pos - buf))) {
+            /*
+             * We found a bare linefeed, insert a CR and advance to the
+             * LF-remainder (we skip that LF above)
+             */
             if (*(pos - 1) != APR_ASCII_CR) {
                 apr_bucket_split(e, pos - buf);
-                e = APR_BUCKET_NEXT(e);  /* second half */
-                b = apr_bucket_immortal_create("\r", 1, 
+                e = APR_BUCKET_NEXT(e); /* second half */
+                b = apr_bucket_immortal_create("\r", 1,
                                                f->c->bucket_alloc);
                 APR_BUCKET_INSERT_BEFORE(e, b);
-                this_size += (pos - buf) + 1; /* including the CR */
+                this_size += (pos - buf) + 1;   /* including the CR */
                 *seen_cr = 1;
                 break;
             }
         }
 
-        /* If we just split, we will 'reread' this current bucket... 
-         * But otherwise we note if the trailing character is a CR,
-         * tally this bucket, and advance to the next bucket */
+        /*
+         * If we just split, we will 'reread' this current bucket... But
+         * otherwise we note if the trailing character is a CR, tally this
+         * bucket, and advance to the next bucket
+         */
         if (!pos) {
             *seen_cr = (buf[len - 1] == '\r');
             this_size += len;
-            e = APR_BUCKET_NEXT(e);  /* onwards */
+            e = APR_BUCKET_NEXT(e);     /* onwards */
         }
 
-        /* We got too big and chunky, let's spill this out to the
-         * client data connection and resume processing
+        /*
+         * We got too big and chunky, let's spill this out to the client data
+         * connection and resume processing
          */
         if (this_size >= 9000) {
             apr_bucket_brigade *bb_split = bb;

Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_inet_pton.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_inet_pton.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_inet_pton.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_inet_pton.c Tue Feb 19 06:03:35 2008
@@ -62,182 +62,180 @@
  * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
  */
 
-static int	inet_pton4 __P((const char *src, unsigned char *dst));
+static int inet_pton4 __P((const char *src, unsigned char *dst));
 #if APR_HAVE_IPV6
-static int	inet_pton6 __P((const char *src, unsigned char *dst));
+static int inet_pton6 __P((const char *src, unsigned char *dst));
 #endif
 
 /* int
  * inet_pton(af, src, dst)
- *	convert from presentation format (which usually means ASCII printable)
- *	to network format (which is usually some kind of binary format).
+ *      convert from presentation format (which usually means ASCII printable)
+ *      to network format (which is usually some kind of binary format).
  * return:
- *	1 if the address was valid for the specified address family
- *	0 if the address wasn't valid (`dst' is untouched in this case)
- *	-1 if some other error occurred (`dst' is untouched in this case, too)
+ *      1 if the address was valid for the specified address family
+ *      0 if the address wasn't valid (`dst' is untouched in this case)
+ *      -1 if some other error occurred (`dst' is untouched in this case, too)
  * author:
- *	Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
-int
-ftp_inet_pton(int af, const char *src, void *dst)
+int ftp_inet_pton(int af, const char *src, void *dst)
 {
-	switch (af) {
-	case AF_INET:
-		return (inet_pton4(src, dst));
+    switch (af) {
+    case AF_INET:
+        return (inet_pton4(src, dst));
 #if APR_HAVE_IPV6
-	case AF_INET6:
-		return (inet_pton6(src, dst));
+    case AF_INET6:
+        return (inet_pton6(src, dst));
 #endif
-	default:
-		errno = EAFNOSUPPORT;
-		return (-1);
-	}
-	/* NOTREACHED */
+    default:
+        errno = EAFNOSUPPORT;
+        return (-1);
+    }
+    /* NOTREACHED */
 }
 
 /* int
  * inet_pton4(src, dst)
- *	like inet_aton() but without all the hexadecimal and shorthand.
+ *      like inet_aton() but without all the hexadecimal and shorthand.
  * return:
- *	1 if `src' is a valid dotted quad, else 0.
+ *      1 if `src' is a valid dotted quad, else 0.
  * notice:
- *	does not touch `dst' unless it's returning 1.
+ *      does not touch `dst' unless it's returning 1.
  * author:
- *	Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
-static int
-inet_pton4(const char *src, unsigned char *dst)
+static int inet_pton4(const char *src, unsigned char *dst)
 {
-	static const char digits[] = "0123456789";
-	int saw_digit, octets, ch;
-	unsigned char tmp[INADDRSZ], *tp;
-
-	saw_digit = 0;
-	octets = 0;
-	*(tp = tmp) = 0;
-	while ((ch = *src++) != '\0') {
-		const char *pch;
-
-		if ((pch = ap_strchr_c(digits, ch)) != NULL) {
-			unsigned int new = *tp * 10 + (pch - digits);
-
-			if (new > 255)
-				return (0);
-			*tp = new;
-			if (! saw_digit) {
-				if (++octets > 4)
-					return (0);
-				saw_digit = 1;
-			}
-		} else if (ch == '.' && saw_digit) {
-			if (octets == 4)
-				return (0);
-			*++tp = 0;
-			saw_digit = 0;
-		} else
-			return (0);
-	}
-	if (octets < 4)
-		return (0);
+    static const char digits[] = "0123456789";
+    int saw_digit, octets, ch;
+    unsigned char tmp[INADDRSZ], *tp;
+
+    saw_digit = 0;
+    octets = 0;
+    *(tp = tmp) = 0;
+    while ((ch = *src++) != '\0') {
+        const char *pch;
+
+        if ((pch = ap_strchr_c(digits, ch)) != NULL) {
+            unsigned int new = *tp * 10 + (pch - digits);
+
+            if (new > 255)
+                return (0);
+            *tp = new;
+            if (!saw_digit) {
+                if (++octets > 4)
+                    return (0);
+                saw_digit = 1;
+            }
+        }
+        else if (ch == '.' && saw_digit) {
+            if (octets == 4)
+                return (0);
+            *++tp = 0;
+            saw_digit = 0;
+        }
+        else
+            return (0);
+    }
+    if (octets < 4)
+        return (0);
 
-	memcpy(dst, tmp, INADDRSZ);
-	return (1);
+    memcpy(dst, tmp, INADDRSZ);
+    return (1);
 }
 
 #if APR_HAVE_IPV6
 /* int
  * inet_pton6(src, dst)
- *	convert presentation level address to network order binary form.
+ *      convert presentation level address to network order binary form.
  * return:
- *	1 if `src' is a valid [RFC1884 2.2] address, else 0.
+ *      1 if `src' is a valid [RFC1884 2.2] address, else 0.
  * notice:
- *	(1) does not touch `dst' unless it's returning 1.
- *	(2) :: in a full address is silently ignored.
+ *      (1) does not touch `dst' unless it's returning 1.
+ *      (2) :: in a full address is silently ignored.
  * credit:
- *	inspired by Mark Andrews.
+ *      inspired by Mark Andrews.
  * author:
- *	Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
-static int
-inet_pton6(const char *src, unsigned char *dst)
+static int inet_pton6(const char *src, unsigned char *dst)
 {
-	static const char xdigits_l[] = "0123456789abcdef",
-			  xdigits_u[] = "0123456789ABCDEF";
-	unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
-	const char *xdigits, *curtok;
-	int ch, saw_xdigit;
-	unsigned int val;
-
-	memset((tp = tmp), '\0', IN6ADDRSZ);
-	endp = tp + IN6ADDRSZ;
-	colonp = NULL;
-	/* Leading :: requires some special handling. */
-	if (*src == ':')
-		if (*++src != ':')
-			return (0);
-	curtok = src;
-	saw_xdigit = 0;
-	val = 0;
-	while ((ch = *src++) != '\0') {
-		const char *pch;
-
-		if ((pch = ap_strchr_c((xdigits = xdigits_l), ch)) == NULL)
-			pch = ap_strchr_c((xdigits = xdigits_u), ch);
-		if (pch != NULL) {
-			val <<= 4;
-			val |= (pch - xdigits);
-			if (val > 0xffff)
-				return (0);
-			saw_xdigit = 1;
-			continue;
-		}
-		if (ch == ':') {
-			curtok = src;
-			if (!saw_xdigit) {
-				if (colonp)
-					return (0);
-				colonp = tp;
-				continue;
-			}
-			if (tp + INT16SZ > endp)
-				return (0);
-			*tp++ = (unsigned char) (val >> 8) & 0xff;
-			*tp++ = (unsigned char) val & 0xff;
-			saw_xdigit = 0;
-			val = 0;
-			continue;
-		}
-		if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
-		    inet_pton4(curtok, tp) > 0) {
-			tp += INADDRSZ;
-			saw_xdigit = 0;
-			break;	/* '\0' was seen by inet_pton4(). */
-		}
-		return (0);
-	}
-	if (saw_xdigit) {
-		if (tp + INT16SZ > endp)
-			return (0);
-		*tp++ = (unsigned char) (val >> 8) & 0xff;
-		*tp++ = (unsigned char) val & 0xff;
-	}
-	if (colonp != NULL) {
-		/*
-		 * Since some memmove()'s erroneously fail to handle
-		 * overlapping regions, we'll do the shift by hand.
-		 */
-		const int n = tp - colonp;
-		int i;
-
-		for (i = 1; i <= n; i++) {
-			endp[- i] = colonp[n - i];
-			colonp[n - i] = 0;
-		}
-		tp = endp;
-	}
-	if (tp != endp)
-		return (0);
-	memcpy(dst, tmp, IN6ADDRSZ);
-	return (1);
+    static const char xdigits_l[] = "0123456789abcdef", xdigits_u[] = "0123456789ABCDEF";
+    unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
+    const char *xdigits, *curtok;
+    int ch, saw_xdigit;
+    unsigned int val;
+
+    memset((tp = tmp), '\0', IN6ADDRSZ);
+    endp = tp + IN6ADDRSZ;
+    colonp = NULL;
+    /* Leading :: requires some special handling. */
+    if (*src == ':')
+        if (*++src != ':')
+            return (0);
+    curtok = src;
+    saw_xdigit = 0;
+    val = 0;
+    while ((ch = *src++) != '\0') {
+        const char *pch;
+
+        if ((pch = ap_strchr_c((xdigits = xdigits_l), ch)) == NULL)
+            pch = ap_strchr_c((xdigits = xdigits_u), ch);
+        if (pch != NULL) {
+            val <<= 4;
+            val |= (pch - xdigits);
+            if (val > 0xffff)
+                return (0);
+            saw_xdigit = 1;
+            continue;
+        }
+        if (ch == ':') {
+            curtok = src;
+            if (!saw_xdigit) {
+                if (colonp)
+                    return (0);
+                colonp = tp;
+                continue;
+            }
+            if (tp + INT16SZ > endp)
+                return (0);
+            *tp++ = (unsigned char) (val >> 8) & 0xff;
+            *tp++ = (unsigned char) val & 0xff;
+            saw_xdigit = 0;
+            val = 0;
+            continue;
+        }
+        if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
+            inet_pton4(curtok, tp) > 0) {
+            tp += INADDRSZ;
+            saw_xdigit = 0;
+            break;              /* '\0' was seen by inet_pton4(). */
+        }
+        return (0);
+    }
+    if (saw_xdigit) {
+        if (tp + INT16SZ > endp)
+            return (0);
+        *tp++ = (unsigned char) (val >> 8) & 0xff;
+        *tp++ = (unsigned char) val & 0xff;
+    }
+    if (colonp != NULL) {
+        /*
+         * Since some memmove()'s erroneously fail to handle
+         * overlapping regions, we'll do the shift by hand.
+         */
+        const int n = tp - colonp;
+        int i;
+
+        for (i = 1; i <= n; i++) {
+            endp[-i] = colonp[n - i];
+            colonp[n - i] = 0;
+        }
+        tp = endp;
+    }
+    if (tp != endp)
+        return (0);
+    memcpy(dst, tmp, IN6ADDRSZ);
+    return (1);
 }
 #endif

Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_limitlogin.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_limitlogin.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_limitlogin.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_limitlogin.c Tue Feb 19 06:03:35 2008
@@ -23,7 +23,7 @@
 #define FTP_BUILD
 #include "mod_ftp.h"
 
-#include "ap_mpm.h" /* For MPM query interface */
+#include "ap_mpm.h"             /* For MPM query interface */
 #include "apr_dbm.h"
 #if !(defined(WIN32) || defined(NETWARE))
 #include "unixd.h"
@@ -35,7 +35,7 @@
 /*
  * We also use the below as a state variable. Ugly.
  */
-static apr_global_mutex_t   *ftp_lock = NULL;
+static apr_global_mutex_t *ftp_lock = NULL;
 
 static apr_status_t ftp_mutex_init(server_rec *s, apr_pool_t *p)
 {
@@ -43,10 +43,10 @@
 
     if (fsc->limit_perip || fsc->limit_peruser || fsc->limit_perserver)
         return apr_global_mutex_create(&ftp_lock,
-                                   apr_pstrcat(p, fsc->limitdbfile, ".LoCK", NULL),
-                                   APR_LOCK_DEFAULT, p);
-     else
-         return APR_SUCCESS;
+                            apr_pstrcat(p, fsc->limitdbfile, ".LoCK", NULL),
+                                       APR_LOCK_DEFAULT, p);
+    else
+        return APR_SUCCESS;
 }
 
 static apr_status_t ftp_mutex_on(void)
@@ -76,7 +76,7 @@
 
     ftp_mutex_on();
     if ((rv = apr_dbm_open(&dbf, fsc->limitdbfile,
-                           APR_DBM_RWCREATE, FTP_DB_FILE_MODE, p)) != APR_SUCCESS) {
+                   APR_DBM_RWCREATE, FTP_DB_FILE_MODE, p)) != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
                      "Cannot create FTPLimitDBFile file `%s'",
                      fsc->limitdbfile);
@@ -121,7 +121,7 @@
         return apr_global_mutex_child_init(&ftp_lock, fsc->limitdbfile, p);
 }
 
-apr_status_t ftp_mutexdb_cleanup (void *data)
+apr_status_t ftp_mutexdb_cleanup(void *data)
 {
     server_rec *s = data;
     ftp_server_config *fsc = ftp_get_module_config(s->module_config);
@@ -156,19 +156,20 @@
     apr_datum_t skey;
     apr_datum_t val;
     apr_dbm_t *dbf;
-    char temp[10];   /* Note: This means only values <= 999,999,999 */
+    char temp[10];              /* Note: This means only values <=
+                                 * 999,999,999 */
     int uval = 0;
     int ival = 0;
     int sval = 0;
     ftp_server_config *fsc =
-        ftp_get_module_config(r->server->module_config);
+    ftp_get_module_config(r->server->module_config);
 
     if (!ftp_lock)
         return FTP_LIMIT_OK;
 
     ftp_mutex_on();
     if ((rv = apr_dbm_open(&dbf, fsc->limitdbfile,
-                           APR_DBM_RWCREATE, FTP_DB_FILE_MODE, r->pool)) != APR_SUCCESS) {
+             APR_DBM_RWCREATE, FTP_DB_FILE_MODE, r->pool)) != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
                      "Cannot open FTPLimitDBFile file `%s' for login check",
                      fsc->limitdbfile);
@@ -179,11 +180,11 @@
      * First we check the user settings.
      * This is a safe cast, this is a lookup key.
      */
-    ukey.dptr = (char *)user;
+    ukey.dptr = (char *) user;
     ukey.dsize = strlen(user);
-    rv = apr_dbm_fetch(dbf, ukey, &val);  /* error for non-existant? */
+    rv = apr_dbm_fetch(dbf, ukey, &val);        /* error for non-existant? */
     if (val.dptr != NULL && val.dsize > 0) {
-        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize+1));
+        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize + 1));
         uval = atoi(temp);
     }
     if (fsc->limit_peruser && uval >= fsc->limit_peruser) {
@@ -194,11 +195,11 @@
      * Now we check the IP settings.
      * This is a safe cast, this is a lookup key.
      */
-    ikey.dptr = (char *)c->remote_ip;
+    ikey.dptr = (char *) c->remote_ip;
     ikey.dsize = strlen(c->remote_ip);
-    rv = apr_dbm_fetch(dbf, ikey, &val);  /* error for non-existant? */
+    rv = apr_dbm_fetch(dbf, ikey, &val);        /* error for non-existant? */
     if (val.dptr != NULL && val.dsize > 0) {
-        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize+1));
+        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize + 1));
         ival = atoi(temp);
     }
     if (fsc->limit_perip && ival >= fsc->limit_perip) {
@@ -211,9 +212,9 @@
      */
     skey.dptr = FTP_SERVER_LIMIT_KEY;
     skey.dsize = strlen(FTP_SERVER_LIMIT_KEY);
-    rv = apr_dbm_fetch(dbf, skey, &val);  /* error for non-existant? */
+    rv = apr_dbm_fetch(dbf, skey, &val);        /* error for non-existant? */
     if (val.dptr != NULL && val.dsize > 0) {
-        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize+1));
+        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize + 1));
         sval = atoi(temp);
     }
     if (fsc->limit_perserver && sval >= fsc->limit_perserver) {
@@ -227,7 +228,9 @@
      * If not (that is, if we check and then, if OK, we *then*
      * update), we hit a race condition.
      */
-    sval++; uval++; ival++;
+    sval++;
+    uval++;
+    ival++;
     apr_snprintf(temp, sizeof(temp), "%d", uval);
     val.dptr = temp;
     val.dsize = strlen(temp);
@@ -242,7 +245,7 @@
     val.dptr = temp;
     val.dsize = strlen(temp);
     rv = apr_dbm_store(dbf, skey, val);
-    
+
     apr_dbm_close(dbf);
 
     ftp_mutex_off();
@@ -259,52 +262,56 @@
     apr_datum_t skey;
     apr_datum_t val;
     apr_dbm_t *dbf;
-    char temp[10];   /* Note: This means only values <= 999,999,999 */
+    char temp[10];              /* Note: This means only values <=
+                                 * 999,999,999 */
     int uval = 0;
     int ival = 0;
     int sval = 0;
     ftp_server_config *fsc =
-        ftp_get_module_config(fc->orig_server->module_config);
+    ftp_get_module_config(fc->orig_server->module_config);
 
     if (!ftp_lock)
         return 0;
-    
+
     ftp_mutex_on();
     if ((rv = apr_dbm_open(&dbf, fsc->limitdbfile,
-                           APR_DBM_RWCREATE, FTP_DB_FILE_MODE, fc->login_pool))
-            != APR_SUCCESS) {
+                        APR_DBM_RWCREATE, FTP_DB_FILE_MODE, fc->login_pool))
+        != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_ERR, rv, fc->orig_server,
-                     "Cannot open FTPLimitDBFile file `%s' for logged out update",
+               "Cannot open FTPLimitDBFile file `%s' for logged out update",
                      fsc->limitdbfile);
         ftp_mutex_off();
         return rv;
     }
-    /* This is a safe cast, it's a lookup key
+    /*
+     * This is a safe cast, it's a lookup key
      */
-    ukey.dptr = (char *)fc->user;
+    ukey.dptr = (char *) fc->user;
     ukey.dsize = strlen(fc->user);
-    rv = apr_dbm_fetch(dbf, ukey, &val);  /* error for non-existant? */
+    rv = apr_dbm_fetch(dbf, ukey, &val);        /* error for non-existant? */
     if (val.dptr != NULL && val.dsize > 0) {
-        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize+1));
+        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize + 1));
         uval = atoi(temp);
     }
 
-    ikey.dptr = (char *)c->remote_ip;
+    ikey.dptr = (char *) c->remote_ip;
     ikey.dsize = strlen(c->remote_ip);
-    rv = apr_dbm_fetch(dbf, ikey, &val);  /* error for non-existant? */
+    rv = apr_dbm_fetch(dbf, ikey, &val);        /* error for non-existant? */
     if (val.dptr != NULL && val.dsize > 0) {
-        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize+1));
+        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize + 1));
         ival = atoi(temp);
     }
-    
+
     skey.dptr = FTP_SERVER_LIMIT_KEY;
     skey.dsize = strlen(FTP_SERVER_LIMIT_KEY);
-    rv = apr_dbm_fetch(dbf, skey, &val);  /* error for non-existant? */
+    rv = apr_dbm_fetch(dbf, skey, &val);        /* error for non-existant? */
     if (val.dptr != NULL && val.dsize > 0) {
-        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize+1));
+        apr_cpystrn(temp, val.dptr, MYMIN(sizeof(temp), val.dsize + 1));
         sval = atoi(temp);
     }
-    sval--; uval--; ival--;
+    sval--;
+    uval--;
+    ival--;
     if (sval < 0)
         sval = 0;
     if (uval < 0)
@@ -321,7 +328,7 @@
     val.dptr = temp;
     val.dsize = strlen(temp);
     rv = apr_dbm_store(dbf, ikey, val);
-    
+
     apr_snprintf(temp, sizeof(temp), "%d", sval);
     val.dptr = temp;
     val.dsize = strlen(temp);
@@ -333,4 +340,3 @@
 
     return 0;
 }
-

Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_log.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_log.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_log.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_log.c Tue Feb 19 06:03:35 2008
@@ -19,7 +19,7 @@
  *
  * FTP Protocol module for Apache 2.0
  */
- 
+
 #define FTP_BUILD
 #include "mod_ftp.h"
 

Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_message.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_message.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_message.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_message.c Tue Feb 19 06:03:35 2008
@@ -32,8 +32,8 @@
  *
  * Returns: nadda
  */
-void ftp_message_generate(ftp_connection *fc, const char *inbuf, 
-                          char *outbuf, size_t outlen)
+void ftp_message_generate(ftp_connection *fc, const char *inbuf,
+                               char *outbuf, size_t outlen)
 {
     conn_rec *c = fc->connection;
     const char *inptr = inbuf;
@@ -47,53 +47,53 @@
             outlen -= 1;
         }
         else {
-            switch(*++inptr) {
-              case 'T':
+            switch (*++inptr) {
+            case 'T':
                 apr_ctime(time_str, apr_time_now());
                 apr_cpystrn(outptr, time_str, outlen);
                 break;
-              case 'C':
+            case 'C':
                 apr_snprintf(outptr, outlen, "%s", fc->cwd);
                 break;
-              case 'h':
+            case 'h':
                 apr_getnameinfo(&remote_host, c->remote_addr, 0);
                 apr_snprintf(outptr, outlen, "%s", remote_host);
                 break;
-              case 'L':
+            case 'L':
                 apr_getnameinfo(&local_host, c->local_addr, 0);
                 apr_snprintf(outptr, outlen, "%s", local_host);
                 break;
-              case 'E':
-                apr_snprintf(outptr, outlen, "%s", 
+            case 'E':
+                apr_snprintf(outptr, outlen, "%s",
                              fc->orig_server->server_admin);
                 break;
-              case 'a':
+            case 'a':
                 apr_snprintf(outptr, outlen, "%s", c->local_ip);
                 break;
-              case 'A':
+            case 'A':
                 apr_snprintf(outptr, outlen, "%s", c->remote_ip);
                 break;
-              case 'u':
+            case 'u':
                 apr_snprintf(outptr, outlen, "%s", fc->user);
                 break;
-              case 'f':
+            case 'f':
                 apr_snprintf(outptr, outlen, "%d", fc->files);
                 break;
-              case 't':
+            case 't':
                 apr_snprintf(outptr, outlen, "%" APR_OFF_T_FMT, fc->bytes);
                 break;
-              case 'b':
+            case 'b':
                 apr_snprintf(outptr, outlen, "%" APR_OFF_T_FMT, fc->traffic);
                 break;
-              case 'x':
+            case 'x':
                 apr_snprintf(outptr, outlen, "%d", fc->transfers);
                 break;
-              case '%':
+            case '%':
                 *outptr++ = '%';
                 outlen -= 1;
                 *outptr = '\0';
                 break;
-              default:
+            default:
                 *outptr++ = '%';
                 outlen -= 1;
                 if (outlen > 1) {

Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_protocol.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_protocol.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_protocol.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_protocol.c Tue Feb 19 06:03:35 2008
@@ -32,10 +32,10 @@
  *
  */
 static apr_status_t ftp_read_line(char **result, apr_size_t *bytes_read,
-                                  apr_pool_t *pool,
-                                  apr_bucket_brigade *bb,
-                                  ap_filter_t *input_filters,
-                                  int block, ftp_connection *fc)
+                                               apr_pool_t *pool,
+                                               apr_bucket_brigade *bb,
+                                               ap_filter_t *input_filters,
+                                               int block, ftp_connection *fc)
 {
     char *last_char = NULL;
     apr_status_t rv;
@@ -45,9 +45,10 @@
     char *pbuf;
     char *pos;
 
-    /* We manage a leading (intially empty) pool bucket that 
-     * we will use to concatinate the line over (possibly)
-     * multiple non-blocking invocations of ftp_read_line()
+    /*
+     * We manage a leading (intially empty) pool bucket that we will use to
+     * concatinate the line over (possibly) multiple non-blocking invocations
+     * of ftp_read_line()
      */
 
     if (APR_BRIGADE_EMPTY(bb)) {
@@ -55,9 +56,9 @@
                                     pool, input_filters->c->bucket_alloc);
         pb = pe->data;
         pb->heap.alloc_len = MIN_LINE_ALLOC;
-        pbuf = (char*)pb->base;
+        pbuf = (char *) pb->base;
 #ifdef FTP_TRACE
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                      fc->orig_server, "FTP frl: empty bb");
 #endif
     }
@@ -65,7 +66,7 @@
         pe = APR_BRIGADE_FIRST(bb);
         pb = pe->data;
         if (APR_BUCKET_IS_POOL(pe) && pb->pool)
-            pbuf = (char*)pb->base;
+            pbuf = (char *) pb->base;
         else if (APR_BUCKET_IS_HEAP(pe) || APR_BUCKET_IS_POOL(pe))
             pbuf = pb->heap.base;
         else
@@ -76,7 +77,7 @@
         /* Remove pe so we have a clean brigade for the loop below */
         APR_BUCKET_REMOVE(pe);
 #ifdef FTP_TRACE
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                      fc->orig_server, "FTP frl: using previous bb");
 #endif
     }
@@ -88,7 +89,7 @@
         for (;;) {
 
             apr_brigade_cleanup(bb);
-            rv = ap_get_brigade(input_filters, bb, 
+            rv = ap_get_brigade(input_filters, bb,
                                 AP_MODE_GETLINE, block, 0);
 
             if (rv != APR_SUCCESS) {
@@ -99,11 +100,11 @@
             if (APR_BRIGADE_EMPTY(bb)) {
                 APR_BRIGADE_INSERT_HEAD(bb, pe);
 #ifdef FTP_TRACE
-                ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+                ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                              fc->orig_server, "FTP frl: got empty brigade");
 #endif
-                return (block == APR_BLOCK_READ) ? APR_EGENERAL 
-                                                 : APR_EAGAIN;
+                return (block == APR_BLOCK_READ) ? APR_EGENERAL
+                    : APR_EAGAIN;
             }
 
             while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) {
@@ -135,13 +136,13 @@
                 if (rv == APR_SUCCESS && APR_BUCKET_IS_SOCKET(e_next)) {
                     apr_socket_t *sock = e_next->data;
                     rv = apr_socket_atmark(sock, &mark);
-                    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
-                        fc->orig_server, "FTP frl: atmark: %x %d",
-		        (int) rv, mark);
+                    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
+                                 fc->orig_server, "FTP frl: atmark: %x %d",
+                                 (int) rv, mark);
                     if (rv == APR_SUCCESS && mark) {
                         pe->length = 0;
-                        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
-                            fc->orig_server, "FTP frl: Saw OOB");
+                        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
+                                     fc->orig_server, "FTP frl: Saw OOB");
                         continue;
                     }
                 }
@@ -152,9 +153,10 @@
                 }
 
                 if (len == 0) {
-                    /* no use attempting a zero-byte alloc (hurts when
-                     * using --with-efence --enable-pool-debug) or
-                     * doing any of the other logic either
+                    /*
+                     * no use attempting a zero-byte alloc (hurts when using
+                     * --with-efence --enable-pool-debug) or doing any of the
+                     * other logic either
                      */
                     apr_bucket_delete(e);
                     continue;
@@ -183,20 +185,20 @@
                         new_buffer = apr_palloc(pb->pool, new_size);
                         memcpy(new_buffer, pb->base, pe->length);
                         pb->base = new_buffer;
-                        pbuf = (char*)pb->base;
+                        pbuf = (char *) pb->base;
                     }
                     else {
                         new_buffer = malloc(new_size);
                         if (!new_buffer)
                             return APR_ENOSPC;
                         memcpy(new_buffer, pb->heap.base, pe->length);
-                        free (pb->heap.base);
+                        free(pb->heap.base);
                         pb->heap.base = new_buffer;
-                        pbuf = (char*) pb->heap.base;
+                        pbuf = (char *) pb->heap.base;
                     }
                     pb->heap.alloc_len = new_size;
                 }
-    
+
                 /* Just copy the rest of the data to the end of the buffer. */
                 pos = pbuf + pe->length;
                 memcpy(pos, str, len);
@@ -211,26 +213,27 @@
             /* If we got a full line of input, stop reading */
             if (last_char && (*last_char == APR_ASCII_LF)) {
 
-                /* Trim the trailing spaces or tabs, LF and CR*/
+                /* Trim the trailing spaces or tabs, LF and CR */
                 while ((last_char > pbuf)
                        && apr_isspace(*(last_char - 1))) {
                     --last_char;
                 }
 
-                /* Since we want to remove the LF from the line, we'll go ahead
-                 * and set this last character to be the term NULL
+                /*
+                 * Since we want to remove the LF from the line, we'll go
+                 * ahead and set this last character to be the term NULL
                  */
                 *last_char = '\0';
 
-                /* Return the result string, and the actual bytes 
-                 * read from the network (before we truncated 
-                 * trailing whitespace and newlines)
-                 *
-                 * We may have moved from a pool to another pool, 
-                 * or to a heap bucket.  Reallocate from the current
-                 * pool in these cases.
+                /*
+                 * Return the result string, and the actual bytes read from
+                 * the network (before we truncated trailing whitespace and
+                 * newlines)
+                 * 
+                 * We may have moved from a pool to another pool, or to a heap
+                 * bucket.  Reallocate from the current pool in these cases.
                  */
-                if (pb->pool && pb->pool == pool) {
+                if (pb->pool &&pb->pool == pool) {
                     *result = pbuf;
                 }
                 else {
@@ -238,13 +241,14 @@
                     memcpy(*result, pbuf, last_char - pbuf + 1);
                 }
                 *bytes_read = pe->length;
-                
-                /* Finally destroy the working bucket - if it is heap 
-                 * the heap data will also be free()'d.
+
+                /*
+                 * Finally destroy the working bucket - if it is heap the
+                 * heap data will also be free()'d.
                  */
                 apr_bucket_destroy(pe);
 #ifdef FTP_TRACE
-                ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+                ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                              fc->orig_server, "FTP frl: got full line");
 #endif
                 return APR_SUCCESS;
@@ -253,7 +257,7 @@
 
     } while (pe->length <= 0);
 #ifdef FTP_TRACE
-    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                  fc->orig_server, "FTP frl: fall through success");
 #endif
     return APR_SUCCESS;
@@ -266,7 +270,7 @@
  * Arguments: r - The request to read from.
  * Arguments: bb - The brigade to retrieve.
  *
- * Returns: Returns 0 on success, 1 on error. 
+ * Returns: Returns 0 on success, 1 on error.
  */
 static apr_status_t ftp_read_request_line(ftp_connection *fc,
                                           request_rec *r,
@@ -282,12 +286,12 @@
         fc->next_request = NULL;
         fc->next_reqsize = 0;
 #ifdef FTP_TRACE
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                      r->server, "FTP frrl: using read-ahead request");
 #endif
     }
     else if ((rv = ftp_read_line(&r->the_request, &bytes_read,
-                                 fc->connection->pool, bb, r->input_filters, 
+                                 fc->connection->pool, bb, r->input_filters,
                                  APR_BLOCK_READ, fc)) != APR_SUCCESS) {
         return rv;
     }
@@ -296,31 +300,31 @@
     r->request_time = apr_time_now();
     ll = r->the_request;
 #ifdef FTP_TRACE
-    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                  r->server, "FTP frrl: raw command: %s", ll);
 #endif
     r->method = ftp_toupper(r->pool, ap_getword_white(r->pool, &ll));
-    r->method = ftp_get_cmd_alias(r->method);    
+    r->method = ftp_get_cmd_alias(r->method);
     r->method_number = ap_method_number_of(r->method);
 
     return APR_SUCCESS;
 }
 
-apr_status_t ftp_read_ahead_request(ftp_connection *fc) 
+apr_status_t ftp_read_ahead_request(ftp_connection *fc)
 {
     apr_status_t rv;
     const char *ll;
     const char *method;
 
 #ifdef FTP_TRACE
-    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                  fc->orig_server, "FTP frar: entering");
 #endif
 
     /* Review one command, only once */
     if (fc->next_request && *fc->next_request) {
 #ifdef FTP_TRACE
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                      fc->orig_server, "FTP frar: previously read-ahead");
 #endif
         return APR_SUCCESS;
@@ -329,21 +333,21 @@
     if (!fc->next_pool) {
         apr_pool_create(&fc->next_pool, fc->connection->pool);
         apr_pool_tag(fc->next_pool, "next_cmd");
-        fc->next_bb = apr_brigade_create(fc->next_pool, 
+        fc->next_bb = apr_brigade_create(fc->next_pool,
                                          fc->connection->bucket_alloc);
 #ifdef FTP_TRACE
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                      fc->orig_server, "FTP frar: created next_pool");
 #endif
     }
 
     rv = ftp_read_line(&fc->next_request, &fc->next_reqsize,
-                       fc->next_pool, fc->next_bb, 
-                       fc->connection->input_filters, 
+                       fc->next_pool, fc->next_bb,
+                       fc->connection->input_filters,
                        APR_NONBLOCK_READ, fc);
     if (APR_STATUS_IS_EAGAIN(rv)) {
 #ifdef FTP_TRACE
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                      fc->orig_server, "FTP frar: not ready - read again");
 #endif
         /* We actually like some failures here */
@@ -360,7 +364,7 @@
     ll = fc->next_request;
 
 #ifdef FTP_TRACE
-    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                  fc->orig_server, "FTP frar: raw command: %s", ll);
 #endif
 
@@ -381,17 +385,17 @@
         ll = ++method;
 
     /* XXX gross hack till we straighten out constness */
-    fc->next_request = (char *)ll;  /* store away "cleaned" command */
+    fc->next_request = (char *) ll;     /* store away "cleaned" command */
 
     method = ftp_toupper(fc->next_pool, ap_getword_white(fc->next_pool, &ll));
 
 #ifdef FTP_TRACE
-    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                  fc->orig_server, "FTP frar: method: %s", method);
 #endif
     /* Can we ignore this command for a while? */
     if (ftp_cmd_abort_data(method)) {
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                      fc->orig_server, "FTP frar: I see ABOR");
         return APR_ECONNRESET;
     }
@@ -403,10 +407,10 @@
 /*
  * ftp_read_request: Called from the connection handler.  Used to
  *                   read the request and fill out the request record.
- *                       
+ *
  * Arguments: fc - The ftp_connection rec associated with this request.
  *
- * Returns: Returns an initialized request_rec 
+ * Returns: Returns an initialized request_rec
  */
 request_rec *ftp_read_request(ftp_connection *fc)
 {
@@ -448,7 +452,7 @@
 
     /*
      * We now need to remove the NET_TIME filter to allow
-     * use to control timeouts ourselves. 
+     * use to control timeouts ourselves.
      */
     for (f = c->input_filters; f; f = f->next) {
         if (strcasecmp(f->frec->name, "NET_TIME") == 0) {
@@ -471,28 +475,30 @@
 
     r->per_dir_config = r->server->lookup_defaults;
 
-    r->sent_bodyct     = 0;                      /* bytect isn't for body */
+    r->sent_bodyct = 0;         /* bytect isn't for body */
 
-    r->read_length     = 0;
-    r->read_body       = REQUEST_NO_BODY;
+    r->read_length = 0;
+    r->read_body = REQUEST_NO_BODY;
 
-    r->status          = HTTP_OK;                /* Until we get a request */
-    r->the_request     = NULL;
+    r->status = HTTP_OK;        /* Until we get a request */
+    r->the_request = NULL;
 
-    /* Begin by presuming any module can make its own path_info assumptions,
+    /*
+     * Begin by presuming any module can make its own path_info assumptions,
      * until some module interjects and changes the value.
      */
     r->used_path_info = AP_REQ_DEFAULT_PATH_INFO;
 
     r->protocol = "FTP";
     r->method = NULL;
-    
-    /* We don't use r->uri for every request, but some modules (SSL)
-     * require r->uri to not be NULL in the post_read_request hook 
-     *
-     * The canonical (http) form of "Any location" is *, e.g. the
-     * http OPTIONS * request.  It's not a bad pattern to keep with
-     * module author's expectations.
+
+    /*
+     * We don't use r->uri for every request, but some modules (SSL) require
+     * r->uri to not be NULL in the post_read_request hook
+     * 
+     * The canonical (http) form of "Any location" is *, e.g. the http OPTIONS *
+     * request.  It's not a bad pattern to keep with module author's
+     * expectations.
      */
     r->uri = "*";
 
@@ -500,18 +506,18 @@
     if (fc->next_bb) {
         tmp_bb = fc->next_bb;
 #ifdef FTP_TRACE
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                      r->server, "FTP frr: using next_bb");
 #endif
-    } else {
+    }
+    else {
         tmp_bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
 #ifdef FTP_TRACE
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                      r->server, "FTP frr: using tmp_bb");
 #endif
     }
-    if ((rv = ftp_read_request_line(fc, r, tmp_bb)) != APR_SUCCESS)
-    {
+    if ((rv = ftp_read_request_line(fc, r, tmp_bb)) != APR_SUCCESS) {
         apr_time_t timeout;
         apr_bucket_brigade *bb;
         apr_bucket *b;
@@ -522,15 +528,15 @@
 
         if (rv == APR_TIMEUP) {
             /*
-             * Handle client timeouts here.  The idle timeout for the 
-             * control connection is set in the process_connection 
+             * Handle client timeouts here.  The idle timeout for the
+             * control connection is set in the process_connection
              * handler, if the timeout is reached, ftp_read_request_line
-             * will return with an error.  Here we send the client a 
+             * will return with an error.  Here we send the client a
              * friendly error message, and close the connection.
              */
             apr_socket_timeout_get(fc->cntlsock, &timeout);
 
-            ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, 
+            ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, 0,
                          r->server,
                          "User %s timed out after %d seconds", fc->user,
                          (int) (timeout / APR_USEC_PER_SEC));
@@ -550,18 +556,20 @@
             b = apr_bucket_flush_create(c->bucket_alloc);
             APR_BRIGADE_INSERT_TAIL(bb, b);
             ap_pass_brigade(c->output_filters, bb);
-           
+
             apr_brigade_destroy(bb);
         }
         else {
-            /* Remote client suddenly disconnected, don't bother sending
-             * an error since the client is long gone.  Just log the error.
+            /*
+             * Remote client suddenly disconnected, don't bother sending an
+             * error since the client is long gone.  Just log the error.
              */
-            ap_log_error(APLOG_MARK, APLOG_INFO, rv, 
+            ap_log_error(APLOG_MARK, APLOG_INFO, rv,
                          r->server, "User %s disconnected", fc->user);
         }
-        /* Return NULL to the connection handler, causing the connection
-         * to be dropped.
+        /*
+         * Return NULL to the connection handler, causing the connection to
+         * be dropped.
          */
         return NULL;
     }
@@ -569,25 +577,28 @@
     apr_brigade_destroy(tmp_bb);
     fc->next_bb = NULL;
 
-    /* ftp_read_line returns the_request always allocated from the
-     * correct pool.  If not, we have a bug.  No need to clean up
-     * next_pool above in the failure case, because it is allocated 
-     * from the connection (soon to be destroyed.)
+    /*
+     * ftp_read_line returns the_request always allocated from the correct
+     * pool.  If not, we have a bug.  No need to clean up next_pool above in
+     * the failure case, because it is allocated from the connection (soon to
+     * be destroyed.)
      */
     if (fc->next_pool) {
         apr_pool_destroy(fc->next_pool);
         fc->next_pool = NULL;
 #ifdef FTP_TRACE
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0,
                      r->server, "FTP frr: clearing next_pool");
 #endif
     }
 
-    /* PHP does initializations of important data structures in the
-     * post_read_request phase.  */
+    /*
+     * PHP does initializations of important data structures in the
+     * post_read_request phase.
+     */
     if ((access_status = ap_run_post_read_request(r))) {
 
-        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0,
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, 0,
                      r->server, "Post read request failed, dropping "
                      "client connection.");
         return NULL;
@@ -598,7 +609,7 @@
 
 /*
  * ftp_reply: This function is used for sending command responses to the
- *            client over the control connection.  All responses should 
+ *            client over the control connection.  All responses should
  *            be sent through this function.
  *
  * Arguments: out_filter - The output filter chain.
@@ -607,15 +618,15 @@
  *            l - Flag that determines if this is a long response or not.  Long
  *                responses have the format %d-%s%s, short responses use a
  *                space in place of the dash.
- *                
+ *
  *                    1 - this is long response.
  *                    0 - this is a short (the last) response.
  *            fmt - Format string to be sent to the client.
  *
  * Returns: apr_status_t
  */
-apr_status_t ftp_reply(ftp_connection *fc, ap_filter_t *out_filter, 
-                       apr_pool_t *p, int n, int l, const char *fmt, ...)
+apr_status_t ftp_reply(ftp_connection *fc, ap_filter_t *out_filter,
+                          apr_pool_t *p, int n, int l, const char *fmt,...)
 {
     char buf[BUFSIZ], reply[BUFSIZ];
     int len;
@@ -630,12 +641,12 @@
     va_end(ap);
 
     bb = apr_brigade_create(p, out_filter->c->bucket_alloc);
-    b = apr_bucket_pool_create(reply, len, p, 
+    b = apr_bucket_pool_create(reply, len, p,
                                out_filter->c->bucket_alloc);
     APR_BRIGADE_INSERT_HEAD(bb, b);
     b = apr_bucket_flush_create(out_filter->c->bucket_alloc);
     APR_BRIGADE_INSERT_TAIL(bb, b);
-    
+
     fc->traffic += len;
 
     return ap_pass_brigade(out_filter, bb);
@@ -653,8 +664,8 @@
  *
  * Returns: apr_status_t
  */
-apr_status_t ftp_show_file(ap_filter_t *out_filter, apr_pool_t *p, int code, 
-                           ftp_connection *fc, const char *path)
+apr_status_t ftp_show_file(ap_filter_t *out_filter, apr_pool_t *p, int code,
+                                        ftp_connection *fc, const char *path)
 {
     apr_status_t rv;
     apr_file_t *file;
@@ -667,10 +678,10 @@
         return rv;
     }
 
-    while(apr_file_gets(buf, sizeof(buf), file) == APR_SUCCESS) {
+    while (apr_file_gets(buf, sizeof(buf), file) == APR_SUCCESS) {
         /* Strip off trailing space/cr/lf, ftp_reply does not expect them */
         pos = buf + strlen(buf) - 1;
-        while ((pos >= buf) && apr_isspace(*pos)) 
+        while ((pos >= buf) && apr_isspace(*pos))
             --pos;
         pos[1] = '\0';
 
@@ -702,32 +713,35 @@
     ftp_server_config *fsc;
     conn_rec *c = r->connection;
 
-    /* We are done checking subrequest values for r->status, so we can
-     * place our ftp reply code there so it can be logged */
+    /*
+     * We are done checking subrequest values for r->status, so we can place
+     * our ftp reply code there so it can be logged
+     */
     r->status = status;
 
-    /* In general, status codes below 400 will be considered success.
+    /*
+     * In general, status codes below 400 will be considered success.
      * Specific exceptions are toggled, below.
      */
     if (status >= 400) {
         apr_table_setn(r->subprocess_env, "ftp_transfer_ok", "0");
     }
 
-    switch(status) {
+    switch (status) {
     case FTP_REPLY_SYSTEM_STATUS:
-        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_SYSTEM_STATUS, 1, 
+        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_SYSTEM_STATUS, 1,
                   "Extensions supported:\n"
                   " AUTH TLS\n"
                   " PBSZ\n"
                   " PROT\n"
                   " SIZE\n"
                   " MDTM");
-        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_SYSTEM_STATUS, 0, 
+        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_SYSTEM_STATUS, 0,
                   "END");
         break;
     case FTP_REPLY_SYSTEM_TYPE:
-        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_SYSTEM_TYPE, 0, 
-                  apr_pstrcat(r->pool, "UNIX Type: L8 System: \"",  
+        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_SYSTEM_TYPE, 0,
+                  apr_pstrcat(r->pool, "UNIX Type: L8 System: \"",
                               ap_get_server_version(), "\"", NULL));
         break;
     case FTP_REPLY_CONTROL_CLOSE:
@@ -735,13 +749,13 @@
         if (fsc->exit_message) {
             if (fsc->exit_message_isfile) {
                 ftp_show_file(c->output_filters, r->pool,
-                              FTP_REPLY_CONTROL_CLOSE, fc, fsc->exit_message);
+                            FTP_REPLY_CONTROL_CLOSE, fc, fsc->exit_message);
             }
             else {
                 char reply[BUFSIZ];
                 ftp_message_generate(fc, fsc->exit_message, reply,
                                      sizeof(reply));
-                ftp_reply(fc, c->output_filters, r->pool, 
+                ftp_reply(fc, c->output_filters, r->pool,
                           FTP_REPLY_CONTROL_CLOSE, 1, reply);
             }
         }
@@ -750,25 +764,25 @@
                   "Goodbye.");
         break;
     case FTP_REPLY_DATA_CLOSE:
-        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_DATA_CLOSE, 0, 
+        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_DATA_CLOSE, 0,
                   "Transfer complete.");
         break;
     case FTP_REPLY_USER_LOGGED_IN:
-        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_USER_LOGGED_IN, 0, 
+        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_USER_LOGGED_IN, 0,
                   "User %s logged in", fc->user);
         break;
     case FTP_REPLY_SECURITY_EXCHANGE_DONE:
-        ftp_reply(fc, c->output_filters, r->pool, 
+        ftp_reply(fc, c->output_filters, r->pool,
                   FTP_REPLY_SECURITY_EXCHANGE_DONE, 0,
                   "Security exchange completed");
         break;
     case FTP_REPLY_COMPLETED:
-        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_COMPLETED, 0, 
+        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_COMPLETED, 0,
                   "%s command successful.", r->method);
         break;
     case FTP_REPLY_CANNOT_OPEN_DATACONN:
-        ftp_reply(fc, c->output_filters, r->pool, 
-                  FTP_REPLY_CANNOT_OPEN_DATACONN, 
+        ftp_reply(fc, c->output_filters, r->pool,
+                  FTP_REPLY_CANNOT_OPEN_DATACONN,
                   0, "Cannot open data connection.");
         break;
     case FTP_REPLY_TRANSFER_ABORTED:
@@ -776,19 +790,20 @@
                   0, "Transfer aborted");
         break;
     case FTP_REPLY_COMMAND_UNRECOGNIZED:
-        ftp_reply(fc, c->output_filters, r->pool, 
-                  FTP_REPLY_COMMAND_UNRECOGNIZED, 0, 
+        ftp_reply(fc, c->output_filters, r->pool,
+                  FTP_REPLY_COMMAND_UNRECOGNIZED, 0,
                   "%s: Command not recognized", r->method);
         break;
     case FTP_REPLY_BAD_SEQUENCE:
-        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_BAD_SEQUENCE, 0, 
+        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_BAD_SEQUENCE, 0,
                   "Bad sequence of commands");
         break;
     case FTP_REPLY_BAD_PROTOCOL:
-        /* XXX This is really crufty, the given server may be configured
-         * to support only an IPv4 or IPv6 binding
+        /*
+         * XXX This is really crufty, the given server may be configured to
+         * support only an IPv4 or IPv6 binding
          */
-        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_BAD_PROTOCOL, 0, 
+        ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_BAD_PROTOCOL, 0,
 #if APR_HAVE_IPV6
                   "Network protocol not supported, use (1,2)");
 #else
@@ -796,24 +811,24 @@
 #endif
         break;
     case FTP_REPLY_PROT_NOT_SUPPORTED:
-        ftp_reply(fc, c->output_filters, r->pool, 
+        ftp_reply(fc, c->output_filters, r->pool,
                   FTP_REPLY_PROT_NOT_SUPPORTED, 0,
                   "Requested PROT level not supported by mechanism");
         break;
 
-    /* Exception cases, failure codes that fall before the 400's: */
+        /* Exception cases, failure codes that fall before the 400's: */
     case FTP_REPLY_SERVICE_READY_IN_N_MIN:
     case FTP_REPLY_NOT_IMPLEMENTED:
     case FTP_REPLY_NEED_ACCOUNT:
         apr_table_setn(r->subprocess_env, "ftp_transfer_ok", "0");
-        /* failure is flagged for status < 400
-         * now fall through...
+        /*
+         * failure is flagged for status < 400 now fall through...
          */
 
     default:
-        ftp_reply(fc, c->output_filters, r->pool, status, 0, 
+        ftp_reply(fc, c->output_filters, r->pool, status, 0,
                   "%s", fc->response_notes ? fc->response_notes
-                                           : "Undefined Internal Error.");
+                  : "Undefined Internal Error.");
     }
 
     return;

Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_request.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_request.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_request.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_request.c Tue Feb 19 06:03:35 2008
@@ -36,13 +36,13 @@
  * Arguments: r - The request to be processed.
  *            fc - The ftp connection record associated with this request.
  *
- * Returns: Nothing. 
+ * Returns: Nothing.
  */
 void ftp_process_request(request_rec *r)
 {
     ftp_connection *fc = ftp_get_module_config(r->connection->conn_config);
     ftp_server_config *fsc =
-        ftp_get_module_config(r->server->module_config);
+    ftp_get_module_config(r->server->module_config);
 
     int res;
 
@@ -54,12 +54,12 @@
 
     /* If the passive connection has been open too long, close it */
     if ((fc->passive_created != -1) && fc->csock
-            && (res != FTP_REPLY_DATA_CLOSE)
-            && (res != FTP_REPLY_CONTROL_CLOSE) 
-            && (apr_time_now() - fc->passive_created
-                    > apr_time_from_sec(fsc->timeout_data))) {
+        && (res != FTP_REPLY_DATA_CLOSE)
+        && (res != FTP_REPLY_CONTROL_CLOSE)
+        && (apr_time_now() - fc->passive_created
+            > apr_time_from_sec(fsc->timeout_data))) {
         ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server,
-                     "Timeout waiting to use passive port (closing data connection).");
+          "Timeout waiting to use passive port (closing data connection).");
         ftp_reset_dataconn(fc);
     }
 
@@ -69,8 +69,8 @@
 }
 
 apr_status_t ftp_protocol_filter(ap_filter_t *f, apr_bucket_brigade *b,
-                                 ap_input_mode_t mode, apr_read_type_e block,
-                                 apr_off_t readbytes)
+                                ap_input_mode_t mode, apr_read_type_e block,
+                                              apr_off_t readbytes)
 {
     apr_bucket *eos;
 



Mime
View raw message