httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r629101 [4/4] - /httpd/mod_ftp/trunk/modules/ftp/
Date Tue, 19 Feb 2008 14:03:38 GMT
Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_util.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_util.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_util.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_util.c Tue Feb 19 06:03:35 2008
@@ -23,16 +23,16 @@
 #define FTP_BUILD
 #include "mod_ftp.h"
 #include "apr_fnmatch.h"
-#include "ap_mpm.h" /* For MPM query interface */
+#include "ap_mpm.h"             /* For MPM query interface */
 
-#include <sys/stat.h> /* For file perms */
+#include <sys/stat.h>           /* For file perms */
 
 
 /* Warning; the *arg is consumed, manipulated and must have the same lifetime
  * as the desired *addr results!
  */
 int ftp_eprt_decode(apr_int32_t *family, char **addr, apr_port_t *port,
-                    char *arg)
+                        char *arg)
 {
     char *argv, delim = *arg;
 
@@ -41,7 +41,8 @@
 
     ++arg;
     argv = arg;
-    while (isdigit(*arg)) ++arg;
+    while (isdigit(*arg))
+        ++arg;
     if (*arg != delim)
         return FTP_REPLY_SYNTAX_ERROR;
     *(arg++) = '\0';
@@ -62,12 +63,15 @@
     if (*arg == delim)
         return FTP_REPLY_SYNTAX_ERROR;
     if (*family == APR_INET) {
-        while (isdigit(*arg) || (*arg == '.')) ++arg;
+        while (isdigit(*arg) || (*arg == '.'))
+            ++arg;
     }
 #if APR_HAVE_IPV6
     else if (*family == APR_INET6) {
-        while (isxdigit(*arg) || (*arg == ':')) ++arg;
-        while (isdigit(*arg) || (*arg == '.')) ++arg;
+        while (isxdigit(*arg) || (*arg == ':'))
+            ++arg;
+        while (isdigit(*arg) || (*arg == '.'))
+            ++arg;
     }
 #endif
     else
@@ -80,7 +84,8 @@
     argv = arg;
     if (*arg == delim)
         return FTP_REPLY_SYNTAX_ERROR;
-    while (isdigit(*arg)) ++arg;
+    while (isdigit(*arg))
+        ++arg;
     if (*arg != delim)
         return FTP_REPLY_SYNTAX_ERROR;
     *(arg++) = '\0';
@@ -92,55 +97,55 @@
     return FTP_REPLY_COMMAND_OK;
 }
 
-static char *ftp_modestring_get(char *mode, apr_filetype_e typ, 
-                                      apr_fileperms_t perms)
+static char *ftp_modestring_get(char *mode, apr_filetype_e typ,
+                                     apr_fileperms_t perms)
 {
 
 #ifdef WIN32
     perms = ftp_unix_mode2perms(0);
-#endif /* WIN32 */
+#endif                          /* WIN32 */
 
-    if(perms < 0 || perms >= FTP_MAX_MODESTRING) {
+    if (perms < 0 || perms >= FTP_MAX_MODESTRING) {
         return FTP_UNKNOWN_MODESTRING;  /* see mod_ftp.h */
     }
 
     if (typ == APR_DIR) {
         mode[0] = 'd';
     }
-    if(perms & APR_UREAD) {
+    if (perms & APR_UREAD) {
         mode[1] = 'r';
     }
-    if(perms & APR_UWRITE) {
+    if (perms & APR_UWRITE) {
         mode[2] = 'w';
     }
-    if(perms & APR_UEXECUTE) {
+    if (perms & APR_UEXECUTE) {
         mode[3] = 'x';
     }
-    if(perms & APR_USETID) {
+    if (perms & APR_USETID) {
         mode[3] = 's';
     }
-    if(perms & APR_GREAD) {
+    if (perms & APR_GREAD) {
         mode[4] = 'r';
     }
-    if(perms & APR_GWRITE) {
+    if (perms & APR_GWRITE) {
         mode[5] = 'w';
     }
-    if(perms & APR_GEXECUTE) {
+    if (perms & APR_GEXECUTE) {
         mode[6] = 'x';
     }
-    if(perms & APR_GSETID) {
+    if (perms & APR_GSETID) {
         mode[6] = 's';
     }
-    if(perms & APR_WREAD) {
+    if (perms & APR_WREAD) {
         mode[7] = 'r';
     }
-    if(perms & APR_WWRITE) {
+    if (perms & APR_WWRITE) {
         mode[8] = 'w';
     }
-    if(perms & APR_WEXECUTE) {
+    if (perms & APR_WEXECUTE) {
         mode[9] = 'x';
     }
-    if(perms & APR_WSTICKY) {
+    if (perms & APR_WSTICKY) {
         mode[9] = 't';
     }
     return mode;
@@ -158,8 +163,8 @@
  * Returns: ftp_direntry structure on success, NULL otherwise.
  */
 static struct ftp_direntry *ftp_direntry_make(request_rec *r,
-                                              const char *name,
-                                              const char *pattern)
+                                                           const char *name,
+                                                        const char *pattern)
 {
     ftp_server_config *fsc = ftp_get_module_config(r->server->module_config);
     struct ftp_direntry *dirent;
@@ -168,7 +173,7 @@
     char mode[FTP_MODESTRING_LEN] = "----------";
 
     for (test = name; (sl = ap_strchr_c(test, '/')); test = sl + 1)
-        /* noop */ ;
+         /* noop */ ;
 
     if (!strcmp("..", test)) {
         return NULL;
@@ -179,7 +184,7 @@
     ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Pattern - fdm: %s", pattern);
 #endif
 
-    if (pattern && *pattern && 
+    if (pattern && *pattern &&
         (apr_fnmatch(pattern, name, APR_FNM_PATHNAME | APR_FNM_PERIOD) != APR_SUCCESS)) {
 #ifdef FTP_DEBUG
         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "no match");
@@ -189,63 +194,64 @@
 
     rr = ap_sub_req_lookup_file(name, r, NULL);
 
-    if ((rr->finfo.filetype != 0) && 
+    if ((rr->finfo.filetype != 0) &&
         ((rr->status == HTTP_OK) || (rr->status == HTTP_MOVED_PERMANENTLY) ||
-         (rr->status == HTTP_UNAUTHORIZED && 
+         (rr->status == HTTP_UNAUTHORIZED &&
           fsc->options & FTP_OPT_SHOWUNAUTH)) &&
-        (rr->uri != NULL)) 
-    {
+        (rr->uri != NULL)) {
         apr_time_exp_t xt;
         apr_size_t retcode;
         char *lasts;
 
         /* We don't mess with char returned here, so its fine to cast */
-        lasts = ap_strrchr((char *)name, '/');
+        lasts = ap_strrchr((char *) name, '/');
 
-        dirent             = apr_pcalloc(r->pool, sizeof(ftp_direntry));
-        dirent->next       = NULL;
-        dirent->name       = apr_pstrdup(r->pool, lasts + 1);
-        dirent->nlink      = rr->finfo.nlink;
-        dirent->size       = rr->finfo.size;
-        dirent->csize      = rr->finfo.csize;
+        dirent = apr_pcalloc(r->pool, sizeof(ftp_direntry));
+        dirent->next = NULL;
+        dirent->name = apr_pstrdup(r->pool, lasts + 1);
+        dirent->nlink = rr->finfo.nlink;
+        dirent->size = rr->finfo.size;
+        dirent->csize = rr->finfo.csize;
         dirent->modestring = apr_pstrdup(r->pool,
                                          ftp_modestring_get(
-                                                mode,
-                                                rr->finfo.filetype,
-                                                rr->finfo.protection)
-                                         );
-
-        /* If FTPOptions RemoveUserGroup is set, we don't bother looking
-         * up user and group information for each file */
+                                                            mode,
+                                                         rr->finfo.filetype,
+                                                       rr->finfo.protection)
+            );
+
+        /*
+         * If FTPOptions RemoveUserGroup is set, we don't bother looking up
+         * user and group information for each file
+         */
         if (fsc->options & FTP_OPT_REMOVEUSERGROUP) {
             dirent->username = apr_psprintf(r->pool, "%d", rr->finfo.user);
             dirent->groupname = apr_psprintf(r->pool, "%d", rr->finfo.group);
         }
         else {
             if ((apr_uid_name_get(&dirent->username, rr->finfo.user, r->pool)
-                    != APR_SUCCESS) || (!dirent->username) 
-                                    || (!dirent->username[0])) {
+                 !=APR_SUCCESS) || (!dirent->username)
+                || (!dirent->username[0])) {
                 dirent->username = apr_psprintf(r->pool, "%d", rr->finfo.user);
             }
             if ((apr_gid_name_get(&dirent->groupname, rr->finfo.group, r->pool)
-                    != APR_SUCCESS) || (!dirent->groupname) 
-                                    || (!dirent->groupname[0])) {
+                 !=APR_SUCCESS) || (!dirent->groupname)
+                || (!dirent->groupname[0])) {
                 dirent->groupname = apr_psprintf(r->pool, "%d", rr->finfo.group);
             }
         }
 
         apr_time_exp_lt(&xt, rr->finfo.mtime);
-        
-        if (r->request_time - rr->finfo.mtime > 
+
+        if (r->request_time - rr->finfo.mtime >
             180 * 24 * 60 * 60 * APR_USEC_PER_SEC) {
-            apr_strftime(dirent->datestring, &retcode, 
+            apr_strftime(dirent->datestring, &retcode,
                          sizeof(dirent->datestring), "%b %e  %Y", &xt);
         }
         else {
-            apr_strftime(dirent->datestring, &retcode, 
+            apr_strftime(dirent->datestring, &retcode,
                          sizeof(dirent->datestring), "%b %e %H:%M", &xt);
         }
-    } 
+    }
     else {
         dirent = NULL;
     }
@@ -263,8 +269,8 @@
  *          d1 is found, respectively, to be less than, match or
  *          be greater than d2.
  */
- static int ftp_dsortf(struct ftp_direntry **d1,
-                       struct ftp_direntry **d2)
+static int ftp_dsortf(struct ftp_direntry ** d1,
+                          struct ftp_direntry ** d2)
 {
     /* Simple sort based on filename */
     return strcmp((*d1)->name, (*d2)->name);
@@ -273,7 +279,7 @@
 /* ftp_direntry_get: Return an array of ftp_direntry structures based
  *                   on the uri stored in the request rec.  An extra
  *                   argument may be passed for pattern matching.
- *         
+ *
  * Arguments: r       - The request record for the directory index
  *            pattern - Pattern to get a directory listing for.
  *
@@ -288,10 +294,11 @@
     int num, i;
     char *fname;
     const char *path, *search;
-    
-    /* The actual search pattern, used to determine if we should recurse
-     * into a directory or not.  If the search pattern is just *, we should
-     * not decend.  For search patterns like 'm*', we should.
+
+    /*
+     * The actual search pattern, used to determine if we should recurse into
+     * a directory or not.  If the search pattern is just *, we should not
+     * decend.  For search patterns like 'm*', we should.
      */
 #ifdef FTP_DEBUG
     ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Pattern - start: %s", pattern);
@@ -299,13 +306,13 @@
 
     path = pattern;
     search = ap_strrchr_c(pattern, '/');
-    
+
     if (search == NULL) {
         search = ap_strrchr_c(pattern, '\\');
     }
     if (search != NULL) {
         search++;
-        path = apr_pstrndup(r->pool, pattern, search-pattern);
+        path = apr_pstrndup(r->pool, pattern, search - pattern);
     }
 
 #ifdef FTP_DEBUG
@@ -315,16 +322,17 @@
 
 #ifdef WIN32
 
-    /* Win32 will always return sucess on apr_dir_open, which means
-     * we have to stat the file to see if the request was made for
-     * a directory or file.
+    /*
+     * Win32 will always return sucess on apr_dir_open, which means we have
+     * to stat the file to see if the request was made for a directory or
+     * file.
      */
     rv = apr_stat(&finfo, path, APR_FINFO_MIN, r->pool);
     if (finfo.filetype != APR_DIR) {
         /* Must be for a single file */
-        return ftp_direntry_make(r, path, pattern);    
+        return ftp_direntry_make(r, path, pattern);
     }
-#endif /* WIN32 */
+#endif                          /* WIN32 */
 
     rv = apr_dir_open(&dir, path, r->pool);
 
@@ -340,7 +348,7 @@
 
     num = 0;
     head = current = NULL;
-    while ((rv = apr_dir_read(&finfo, APR_FINFO_DIRENT, dir)) 
+    while ((rv = apr_dir_read(&finfo, APR_FINFO_DIRENT, dir))
            == APR_SUCCESS) {
 
         fname = ap_make_full_path(r->pool, path, finfo.name);
@@ -348,7 +356,7 @@
         if (!p) {
             continue;
         }
-        
+
         /* Add this entry to the linked list */
         if (head == NULL) {
             head = p;
@@ -359,12 +367,12 @@
             current->next = p;
             current = p;
         }
-        /* We are only going to support single recursive listings
-         * this means that requests such as 'ls m*' will print out
-         * all files that match, and recurse a single level into
-         * directories.
+        /*
+         * We are only going to support single recursive listings this means
+         * that requests such as 'ls m*' will print out all files that match,
+         * and recurse a single level into directories.
          */
-        
+
         if (search && (search[0] != '*') && (p->modestring[0] == 'd'))
{
             const char *newpattern = apr_pstrcat(r->pool, fname,
                                                  "/*", NULL);
@@ -375,14 +383,14 @@
         }
         num++;
     }
-    
+
     apr_dir_close(dir);
-    
+
     /* Sort this mess */
     if (num > 0) {
         a = (struct ftp_direntry **) apr_pcalloc(r->pool,
                                                  num *
-                                                 sizeof (ftp_direntry));
+                                                 sizeof(ftp_direntry));
         p = head;
         i = 0;
         while (p) {
@@ -390,8 +398,8 @@
             p = p->next;
         }
         num = i;
-        qsort((void *) a, num, sizeof (struct ftp_direntry *),
-              (int(*)(const void *, const void *))ftp_dsortf);
+        qsort((void *) a, num, sizeof(struct ftp_direntry *),
+              (int (*) (const void *, const void *)) ftp_dsortf);
 
         /* Re-construct the list from the sorted list */
         head = a[0];
@@ -402,7 +410,7 @@
         }
         current->next = NULL;
     }
-        
+
     return head;
 }
 
@@ -425,7 +433,7 @@
     apr_table_setn(r->headers_in, "Authorization", fc->authorization);
 }
 
-/* ftp_set_uri: Setup r->uri based on a file argument and user's 
+/* ftp_set_uri: Setup r->uri based on a file argument and user's
  *              current working directory.  We also run the translate
  *              name phase here to set r->filename.
  *
@@ -441,12 +449,14 @@
 
     if (arg[0] == '/') {
         ap_parse_uri(r, arg);
-    } else {
+    }
+    else {
         ap_parse_uri(r, ap_make_full_path(r->pool, fc->cwd, arg));
     }
     ap_getparents(r->uri);
 
-    /* If the path ended in /., ap_getparents converts it to /, but we really
+    /*
+     * If the path ended in /., ap_getparents converts it to /, but we really
      * don't want the trailing / there, so remove it.
      */
     if (r->uri[strlen(r->uri) - 1] == '/') {
@@ -467,7 +477,7 @@
     if (res) {
         fc->response_notes = apr_psprintf(r->pool, FTP_MSG_PERM_DENIED,
                                           r->parsed_uri.path);
-        return FTP_REPLY_LOCAL_ERROR;    
+        return FTP_REPLY_LOCAL_ERROR;
     }
     r->uri = ap_escape_uri(r->pool, r->uri);
 
@@ -479,7 +489,7 @@
  * Arguments: perms - apr_fileperms_t
  *
  * Returns: mode_t
- */ 
+ */
 mode_t ftp_unix_perms2mode(apr_fileperms_t perms)
 {
     mode_t mode = 0;
@@ -512,7 +522,7 @@
     if (perms & APR_WEXECUTE) {
         mode |= S_IXOTH;
     }
-#endif /* WIN32 */
+#endif                          /* WIN32 */
     return mode;
 }
 
@@ -521,7 +531,7 @@
  * Arguments: mode - mode_t
  *
  * Returns: apr_fileperms_t
- */ 
+ */
 apr_fileperms_t ftp_unix_mode2perms(mode_t mode)
 {
     apr_fileperms_t perms = 0;
@@ -562,7 +572,7 @@
     if (mode & S_IXOTH) {
         perms |= APR_WEXECUTE;
     }
-#endif /* WIN32 */
+#endif                          /* WIN32 */
     return perms;
 }
 
@@ -570,8 +580,8 @@
  *
  * Arguments: s - The string
  *
- * Returns: The capitialized string. 
- */ 
+ * Returns: The capitialized string.
+ */
 char *ftp_toupper(apr_pool_t *p, const char *s)
 {
     char *upper = apr_pstrdup(p, s);
@@ -581,7 +591,7 @@
         *pos = apr_toupper(*pos);
         pos++;
     }
-    
+
     return upper;
 }
 
@@ -612,8 +622,10 @@
         }
     }
 
-    /* We are the only available server, so go ahead.  Maybe this should
-     * be optimized out so it's only in debug builds? */
+    /*
+     * We are the only available server, so go ahead.  Maybe this should be
+     * optimized out so it's only in debug builds?
+     */
     if (ap_exists_config_define("ONE_PROCESS")) {
         return 0;
     }

Modified: httpd/mod_ftp/trunk/modules/ftp/mod_ftp.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/mod_ftp.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/mod_ftp.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/mod_ftp.c Tue Feb 19 06:03:35 2008
@@ -36,16 +36,16 @@
 
 /* Register callbacks for mod_log_config. */
 static int ftp_pre_config(apr_pool_t *p, apr_pool_t *plog,
-                          apr_pool_t *ptemp)
+                              apr_pool_t *ptemp)
 {
-    APR_OPTIONAL_FN_TYPE(ap_register_log_handler) *log_pfn_register;
+    APR_OPTIONAL_FN_TYPE(ap_register_log_handler) * log_pfn_register;
 
-    /* Find the handles of non-ftp filters we will be using
-     *
-     * This must be done after register_hooks since SSL
-     * may not be loaded before FTP, but before we actually
-     * process the config because we test those filter handles
-     * to determine if SSL-related directives are valid.
+    /*
+     * Find the handles of non-ftp filters we will be using
+     * 
+     * This must be done after register_hooks since SSL may not be loaded before
+     * FTP, but before we actually process the config because we test those
+     * filter handles to determine if SSL-related directives are valid.
      */
     ftp_byterange_filter_handle
         = ap_get_output_filter_handle("BYTERANGE");
@@ -56,7 +56,8 @@
     ftp_ssl_output_filter_handle
         = ap_get_output_filter_handle(FTP_SSL_FILTER);
 
-    /* Register our custom log format flags
+    /*
+     * Register our custom log format flags
      */
     log_pfn_register = APR_RETRIEVE_OPTIONAL_FN(ap_register_log_handler);
 
@@ -75,14 +76,15 @@
 
 
 static int ftp_post_config(apr_pool_t *p, apr_pool_t *plog,
-                           apr_pool_t *ptemp, server_rec *s)
+                               apr_pool_t *ptemp, server_rec *s)
 {
     server_rec *base = s;
     ftp_server_config *basefsc = ftp_get_module_config(s->module_config);
 
     ap_add_version_component(p, FTP_SERVER_STRING);
 
-    /* Fixup global values, then base server and virtual host values
+    /*
+     * Fixup global values, then base server and virtual host values
      */
     if (!basefsc->limitdbfile)
         basefsc->limitdbfile = ap_server_root_relative(p, FTP_DEFAULT_DBFILE);
@@ -92,10 +94,10 @@
 
         if (fsc->timeout_login == FTP_UNSPEC)
             fsc->timeout_login = FTP_TIMEOUT_LOGIN;
-        if (fsc->timeout_idle  == FTP_UNSPEC)
-            fsc->timeout_idle  = FTP_TIMEOUT_IDLE;
-        if (fsc->timeout_data  == FTP_UNSPEC)
-            fsc->timeout_data  = FTP_TIMEOUT_DATA;
+        if (fsc->timeout_idle == FTP_UNSPEC)
+            fsc->timeout_idle = FTP_TIMEOUT_IDLE;
+        if (fsc->timeout_data == FTP_UNSPEC)
+            fsc->timeout_data = FTP_TIMEOUT_DATA;
 
         if (fsc->max_login_attempts == FTP_UNSPEC)
             fsc->max_login_attempts = FTP_MAX_LOGINS;
@@ -139,45 +141,46 @@
 
 static void *create_ftp_server_config(apr_pool_t *p, server_rec *s)
 {
-    ftp_server_config *fsc  = apr_pcalloc(p, sizeof(*fsc));
+    ftp_server_config *fsc = apr_pcalloc(p, sizeof(*fsc));
 
-    fsc->timeout_login      = FTP_UNSPEC;
-    fsc->timeout_idle       = FTP_UNSPEC;
-    fsc->timeout_data       = FTP_UNSPEC;
+    fsc->timeout_login = FTP_UNSPEC;
+    fsc->timeout_idle = FTP_UNSPEC;
+    fsc->timeout_data = FTP_UNSPEC;
     fsc->max_login_attempts = FTP_UNSPEC;
 
-    fsc->active_min         = FTP_UNSPEC;
-    fsc->active_max         = FTP_UNSPEC;
-    fsc->pasv_min           = FTP_UNSPEC;
-    fsc->pasv_max           = FTP_UNSPEC;
+    fsc->active_min = FTP_UNSPEC;
+    fsc->active_max = FTP_UNSPEC;
+    fsc->pasv_min = FTP_UNSPEC;
+    fsc->pasv_max = FTP_UNSPEC;
     fsc->epsv_ignore_family = FTP_UNSPEC;
 
-    fsc->data_block_size    = FTP_UNSPEC;
+    fsc->data_block_size = FTP_UNSPEC;
 
-    fsc->limit_peruser      = FTP_UNSPEC;
-    fsc->limit_perip        = FTP_UNSPEC;
-    fsc->limit_perserver    = FTP_UNSPEC;
+    fsc->limit_peruser = FTP_UNSPEC;
+    fsc->limit_perip = FTP_UNSPEC;
+    fsc->limit_perserver = FTP_UNSPEC;
 
     return fsc;
 }
 
 static void *merge_ftp_server_config(apr_pool_t *p, void *basev, void *addv)
 {
-    ftp_server_config *base = (ftp_server_config *)basev;
-    ftp_server_config *add  = (ftp_server_config *)addv;
-    ftp_server_config *fsc  = apr_palloc(p, sizeof(*fsc));
-
-    /* We default to the add config, so any directive not
-     * handled here won't be inherited from the base server.
+    ftp_server_config *base = (ftp_server_config *) basev;
+    ftp_server_config *add = (ftp_server_config *) addv;
+    ftp_server_config *fsc = apr_palloc(p, sizeof(*fsc));
+
+    /*
+     * We default to the add config, so any directive not handled here won't
+     * be inherited from the base server.
      */
-    memcpy (fsc, add, sizeof(*fsc));
+    memcpy(fsc, add, sizeof(*fsc));
 
     if (fsc->timeout_login == FTP_UNSPEC)
         fsc->timeout_login = base->timeout_login;
-    if (fsc->timeout_idle  == FTP_UNSPEC)
-        fsc->timeout_idle  = base->timeout_idle;
-    if (fsc->timeout_data  == FTP_UNSPEC)
-        fsc->timeout_data  = base->timeout_data;
+    if (fsc->timeout_idle == FTP_UNSPEC)
+        fsc->timeout_idle = base->timeout_idle;
+    if (fsc->timeout_data == FTP_UNSPEC)
+        fsc->timeout_data = base->timeout_data;
 
     if (fsc->max_login_attempts == FTP_UNSPEC)
         fsc->max_login_attempts = FTP_MAX_LOGINS;
@@ -222,17 +225,17 @@
 {
     ftp_dir_config *conf = apr_pcalloc(p, sizeof(*conf));
 
-    conf->fileperms          = APR_OS_DEFAULT;
-    conf->dirperms           = APR_OS_DEFAULT;
+    conf->fileperms = APR_OS_DEFAULT;
+    conf->dirperms = APR_OS_DEFAULT;
 
     return conf;
 }
 
 static void *merge_ftp_dir_config(apr_pool_t *p, void *basev, void *addv)
 {
-    ftp_dir_config *base = (ftp_dir_config *)basev;
-    ftp_dir_config *add  = (ftp_dir_config *)addv;
-    ftp_dir_config *conf  = apr_palloc(p, sizeof(*conf));
+    ftp_dir_config *base = (ftp_dir_config *) basev;
+    ftp_dir_config *add = (ftp_dir_config *) addv;
+    ftp_dir_config *conf = apr_palloc(p, sizeof(*conf));
 
     /* XXX: NO-INHERIT the FTPReadmeMessage? */
     conf->path = add->path;
@@ -240,9 +243,9 @@
     conf->readme_isfile = add->readme_isfile;
 
     conf->fileperms = (add->fileperms == APR_OS_DEFAULT)
-                    ? base->fileperms : add->fileperms;
+        ? base->fileperms : add->fileperms;
     conf->dirperms = (add->dirperms == APR_OS_DEFAULT)
-                   ? base->dirperms : add->dirperms;
+        ? base->dirperms : add->dirperms;
 
     return conf;
 }
@@ -250,7 +253,7 @@
 int ftp_have_ssl(void)
 {
     return (ftp_ssl_input_filter_handle
-                && ftp_ssl_output_filter_handle);
+            && ftp_ssl_output_filter_handle);
 }
 
 static void ftp_insert_filter(request_rec *r)
@@ -271,7 +274,7 @@
     if (fc->filter_mask & FTP_NEED_CRLF) {
         /* CRLF filter has a single int context, "did we last have a CR?" */
         ap_add_output_filter_handle(ftp_crlf_filter_handle,
-                                    apr_pcalloc(r->pool, sizeof(int*)),
+                                    apr_pcalloc(r->pool, sizeof(int *)),
                                     r, r->connection);
     }
 }
@@ -295,7 +298,7 @@
  * to other user's home directories.
  */
 static char *find_dir(apr_pool_t *p, const char *wildcard,
-                      const char *curr_file)
+                           const char *curr_file)
 {
     char *dirname;
     size_t i;
@@ -306,7 +309,8 @@
             continue;
         }
         if (wildcard[i] == '*' && wildcard[i + 1] == '/') {
-            /* Now we have the portion we want to match against.  Find the
+            /*
+             * Now we have the portion we want to match against.  Find the
              * corresponding string in the current file.
              */
             size_t j = i;
@@ -339,8 +343,8 @@
     core_dir_config *conf;
     int x;
 
-    conf = (core_dir_config *)ap_get_module_config(r->per_dir_config,
-                                                   &core_module);
+    conf = (core_dir_config *) ap_get_module_config(r->per_dir_config,
+                                                    &core_module);
 
     if (!reqs_arr) {
         return DECLINED;
@@ -348,11 +352,11 @@
 
     newrequire = apr_array_make(r->pool, 2, sizeof(require_line));
 
-    reqs = (require_line *)reqs_arr->elts;
+    reqs = (require_line *) reqs_arr->elts;
     for (x = 0; x < reqs_arr->nelts; x++) {
         require_line *rl;
 
-        rl = (require_line *)apr_array_push(newrequire);
+        rl = (require_line *) apr_array_push(newrequire);
         rl->method_mask = reqs[x].method_mask;
 
         t = reqs[x].requirement;
@@ -379,7 +383,7 @@
 
     return DECLINED;
 }
-#endif /* AP_VERSION > 2.2 */
+#endif                          /* AP_VERSION > 2.2 */
 
 /*
  * Handle FTP module directives
@@ -391,20 +395,20 @@
  * configurations.
  */
 static const char *ftp_set_int_slot(cmd_parms *cmd, void *dummy,
-                                    const char *arg)
+                                         const char *arg)
 {
     char *endptr;
     char *error_str = NULL;
     int offset = (int) (long) cmd->info;
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
-    *(int *) ((char*)fsc + offset) = strtol(arg, &endptr, 10);
+    *(int *) ((char *) fsc + offset) = strtol(arg, &endptr, 10);
 
     if ((*arg == '\0') || (*endptr != '\0')) {
         error_str = apr_psprintf(cmd->pool,
-                     "Invalid value for directive %s, expected integer",
-                     cmd->directive->directive);
+                         "Invalid value for directive %s, expected integer",
+                                 cmd->directive->directive);
     }
 
     return error_str;
@@ -414,7 +418,7 @@
 static const char *ftp_enable(cmd_parms *cmd, void *dummy, int arg)
 {
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
     fsc->enabled = arg;
 
@@ -454,16 +458,17 @@
 
     umask = strtol(arg, &endp, 8);
 
-    /* Here the r bits  of umask are taken to xmask all other bits
-     * set to 1.
+    /*
+     * Here the r bits  of umask are taken to xmask all other bits set to 1.
      */
     xmask = umask & 0444;
     xmask = xmask >> 2;
     xmask |= 0666;
 
-    /* Here r bits are & with x bits. Effectively it confirms that x permission
-     * is given to all who are given r permission. but allow to deny r while x
-     * is given.
+    /*
+     * Here r bits are & with x bits. Effectively it confirms that x
+     * permission is given to all who are given r permission. but allow to
+     * deny r while x is given.
      */
     mode = umask & xmask;
 
@@ -482,7 +487,7 @@
 static const char *ftp_implicit_ssl(cmd_parms *cmd, void *dummy, int arg)
 {
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
     if (!ftp_have_ssl()) {
         return "No SSL module found, cannot enable implicit SSL";
@@ -495,17 +500,17 @@
 static const char *ftp_set_jail(cmd_parms *cmd, void *dummy, int arg)
 {
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
     fsc->jailuser = arg;
     return NULL;
 }
 
 static const char *ftp_options(cmd_parms *cmd, void *dummy,
-                               const char *raw)
+                                    const char *raw)
 {
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
     while (raw[0]) {
         int opt_mask = 0;
@@ -559,11 +564,11 @@
 }
 
 static const char *ftp_set_pasv_addr(cmd_parms *cmd, void *dummy,
-                                     const char *addr)
+                                          const char *addr)
 {
     apr_uint32_t ipaddr;
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
     if ((ftp_inet_pton(AF_INET, addr, &ipaddr)) != 1) {
         return apr_pstrcat(cmd->pool, "Invalid IP address for ",
@@ -576,10 +581,10 @@
 }
 
 static const char *ftp_set_pasv_bindaddr(cmd_parms *cmd, void *dummy,
-                                         const char *addr)
+                                              const char *addr)
 {
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 #if APR_HAVE_IPV6
     struct in6_addr ipaddr;
 #else
@@ -605,14 +610,14 @@
 }
 
 static const char *ftp_set_message_generic(cmd_parms *cmd, const char *arg,
-                                           const char **dest, int *file_flag)
+                                          const char **dest, int *file_flag)
 {
     apr_finfo_t finfo;
     apr_status_t rv;
 
     if (*dest != NULL) {
-        ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0,
-                     cmd->server, "Ignoring duplicate message file: %s", arg);
+        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0,
+                   cmd->server, "Ignoring duplicate message file: %s", arg);
         return NULL;
     }
 
@@ -636,27 +641,27 @@
 }
 
 static const char *ftp_set_banner_message(cmd_parms *cmd, void *dummy,
-                                          const char *arg)
+                                               const char *arg)
 {
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
     return ftp_set_message_generic(cmd, arg, &fsc->banner_message,
                                    &fsc->banner_message_isfile);
 }
 
 static const char *ftp_set_exit_message(cmd_parms *cmd, void *dummy,
-                                        const char *arg)
+                                             const char *arg)
 {
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
     return ftp_set_message_generic(cmd, arg, &fsc->exit_message,
                                    &fsc->exit_message_isfile);
 }
 
 static const char *ftp_set_readme_message(cmd_parms *cmd, void *dconf,
-                                          const char *arg)
+                                               const char *arg)
 {
     ftp_dir_config *d = dconf;
 
@@ -665,19 +670,19 @@
 }
 
 static const char *ftp_set_pasv_range(cmd_parms *cmd, void *dummy,
-                                      const char *min, const char *max)
+                                           const char *min, const char *max)
 {
     char *error_str = NULL;
 
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
     /* XXX: better error handling */
     fsc->pasv_min = (apr_port_t) atoi(min);
     fsc->pasv_max = (apr_port_t) atoi(max);
 
-    if (fsc->pasv_min > fsc->pasv_max 
-            || fsc->pasv_min < 0 || fsc->pasv_max > 0xFFFF) {
+    if (fsc->pasv_min > fsc->pasv_max
+        || fsc->pasv_min < 0 || fsc->pasv_max > 0xFFFF) {
         error_str = apr_psprintf(cmd->pool,
                                  "Invalid range for %s (%s > %s)",
                                  cmd->directive->directive, min, max);
@@ -687,12 +692,12 @@
 }
 
 static const char *ftp_set_active_ports(cmd_parms *cmd, void *dummy,
-                                        const char *min, const char *max)
+                                           const char *min, const char *max)
 {
     char *error_str = NULL;
 
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
     /* XXX: better error handling */
     fsc->active_min = atoi(min);
@@ -705,7 +710,7 @@
     }
 
     if (fsc->active_min > fsc->active_max
-            || fsc->active_min < 0 || fsc->active_max > 0xFFFF) {
+        || fsc->active_min < 0 || fsc->active_max > 0xFFFF) {
         error_str = apr_psprintf(cmd->pool,
                                  "Invalid range for %s (%s > %s)",
                                  cmd->directive->directive, min, max);
@@ -715,10 +720,10 @@
 }
 
 static const char *ftp_set_homedir(cmd_parms *cmd, void *dummy,
-                                   const char *dir)
+                                        const char *dir)
 {
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
     if (*dir != '/') {
         return apr_pstrcat(cmd->pool, "Path for ", cmd->directive->directive,
@@ -731,10 +736,10 @@
 }
 
 static const char *ftp_set_docrootenv(cmd_parms *cmd, void *dummy,
-                                      const char *var)
+                                           const char *var)
 {
     ftp_server_config *fsc =
-        ftp_get_module_config(cmd->server->module_config);
+    ftp_get_module_config(cmd->server->module_config);
 
     fsc->docrootenv = apr_pstrdup(cmd->pool, var);
 
@@ -742,7 +747,7 @@
 }
 
 static const char *ftp_set_limit_peruser(cmd_parms *cmd, void *dummy,
-                                      const char *limit)
+                                              const char *limit)
 {
     char *error_str = NULL;
     ftp_server_config *fsc;
@@ -762,7 +767,7 @@
 }
 
 static const char *ftp_set_limit_perip(cmd_parms *cmd, void *dummy,
-                                         const char *limit)
+                                            const char *limit)
 {
     char *error_str = NULL;
     ftp_server_config *fsc;
@@ -782,7 +787,7 @@
 }
 
 static const char *ftp_set_limit_perserver(cmd_parms *cmd, void *dummy,
-                                         const char *limit)
+                                                const char *limit)
 {
     char *error_str = NULL;
     ftp_server_config *fsc;
@@ -802,7 +807,7 @@
 }
 
 static const char *ftp_set_dbfile(cmd_parms *cmd, void *dummy,
-                                  const char *dbfile)
+                                       const char *dbfile)
 {
     ftp_server_config *fsc;
 
@@ -836,20 +841,20 @@
     AP_INIT_FLAG("FTP", ftp_enable, NULL, RSRC_CONF,
                  "Run an FTP server on this host"),
     AP_INIT_TAKE1("FTPTimeoutLogin", ftp_set_int_slot,
-                  (void *)APR_OFFSETOF(ftp_server_config,
-                                         timeout_login), RSRC_CONF,
+                  (void *) APR_OFFSETOF(ftp_server_config,
+                                        timeout_login), RSRC_CONF,
                   "Idle time allowed when logging in"),
     AP_INIT_TAKE1("FTPTimeoutIdle", ftp_set_int_slot,
-                  (void *)APR_OFFSETOF(ftp_server_config,
-                                         timeout_idle), RSRC_CONF,
+                  (void *) APR_OFFSETOF(ftp_server_config,
+                                        timeout_idle), RSRC_CONF,
                   "Idle time allowed during a FTP session"),
     AP_INIT_TAKE1("FTPTimeoutData", ftp_set_int_slot,
-                  (void *)APR_OFFSETOF(ftp_server_config,
-                                         timeout_data), RSRC_CONF,
+                  (void *) APR_OFFSETOF(ftp_server_config,
+                                        timeout_data), RSRC_CONF,
                   "Idle time allowed during a data transfer"),
     AP_INIT_TAKE1("FTPMaxLoginAttempts", ftp_set_int_slot,
-                  (void *)APR_OFFSETOF(ftp_server_config,
-                                         max_login_attempts), RSRC_CONF,
+                  (void *) APR_OFFSETOF(ftp_server_config,
+                                        max_login_attempts), RSRC_CONF,
                   "Maximum number of login attempts"),
     AP_INIT_FLAG("FTPImplicitSSL", ftp_implicit_ssl, NULL, RSRC_CONF,
                  "Use SSL implicitly."),
@@ -865,8 +870,8 @@
                   "Set the allowed PASV port range"),
     AP_INIT_FLAG("FTPEPSVIgnoreFamily", ftp_epsv_ignore_family,
                  NULL, RSRC_CONF, \
-                 "Instructs EPSV handler to ignore the requested IPv4 or IPv6"
-                 " address family (to accomodate network translation)"), 
+               "Instructs EPSV handler to ignore the requested IPv4 or IPv6"
+                 " address family (to accomodate network translation)"),
     AP_INIT_TAKE1("FTPBannerMessage", ftp_set_banner_message, NULL, RSRC_CONF,
                   "Set initial login message"),
     AP_INIT_TAKE1("FTPExitMessage", ftp_set_exit_message, NULL, RSRC_CONF,
@@ -880,18 +885,18 @@
     AP_INIT_FLAG("FTPJailUser", ftp_set_jail, NULL, RSRC_CONF,
                  "Users are not allowed to leave their home directories"),
     AP_INIT_TAKE12("FTPActiveRange", ftp_set_active_ports, NULL, RSRC_CONF,
-                   "Ports the server will use for connecting to the client."),
+                 "Ports the server will use for connecting to the client."),
     AP_INIT_TAKE1("FTPLimitLoginUser", ftp_set_limit_peruser, NULL, RSRC_CONF,
                   "Set the maximum number of concurrent logins per user"),
     AP_INIT_TAKE1("FTPLimitLoginIP", ftp_set_limit_perip, NULL, RSRC_CONF,
-                  "Set the maximum number of concurrent logins per IP address"),
+              "Set the maximum number of concurrent logins per IP address"),
     AP_INIT_TAKE1("FTPLimitLoginServer", ftp_set_limit_perserver, NULL, RSRC_CONF,
                   "Set the maximum number of concurrent logins per server"),
     AP_INIT_TAKE1("FTPLimitDBFile", ftp_set_dbfile, NULL, RSRC_CONF,
                   "Set the location for the Login Limit DB file"),
     AP_INIT_TAKE1("FTPDataBlockSize", ftp_set_int_slot,
-                  (void *)APR_OFFSETOF(ftp_server_config,
-                                         data_block_size), RSRC_CONF,
+                  (void *) APR_OFFSETOF(ftp_server_config,
+                                        data_block_size), RSRC_CONF,
                   "Block size in bytes to use during data transfers"),
     AP_INIT_TAKE1("FTPReadmeMessage", ftp_set_readme_message, NULL, OR_ALL,
                   "Set per-directory Readme file"),
@@ -909,8 +914,8 @@
     ap_hook_child_init(ftp_child_init, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_process_connection(ftp_process_connection, NULL, NULL,
                                APR_HOOK_MIDDLE);
-    ap_hook_create_request(ftp_create_request,NULL,NULL,APR_HOOK_MIDDLE);
-    ap_hook_insert_filter(ftp_insert_filter,NULL,NULL,APR_HOOK_MIDDLE);
+    ap_hook_create_request(ftp_create_request, NULL, NULL, APR_HOOK_MIDDLE);
+    ap_hook_insert_filter(ftp_insert_filter, NULL, NULL, APR_HOOK_MIDDLE);
 
 #if ((AP_SERVER_MAJORVERSION_NUMBER < 3) && (AP_SERVER_MINORVERSION_NUMBER <
3))
     ap_hook_check_user_id(ftp_check_user_id, NULL, NULL, APR_HOOK_REALLY_FIRST);
@@ -924,17 +929,17 @@
     ftp_crlf_filter_handle = ap_register_output_filter("FTP_CRLF",
                                                        ftp_crlf_filter,
                                                        NULL,
-                                                       AP_FTYPE_RESOURCE - 1);
+                                                     AP_FTYPE_RESOURCE - 1);
     ftp_data_out_filter_handle = ap_register_output_filter("FTP_DATA_OUT",
-                                                           ftp_data_out_filter,
+                                                        ftp_data_out_filter,
                                                            NULL,
-                                                           AP_FTYPE_NETWORK - 2);
+                                                      AP_FTYPE_NETWORK - 2);
 
     /* Register all core command handlers */
     ftp_register_core_cmds(p);
 }
 
-module FTP_DECLARE_DATA ftp_module = 
+module FTP_DECLARE_DATA ftp_module =
 {
     STANDARD20_MODULE_STUFF,
     create_ftp_dir_config,      /* create per-directory config structure */

Modified: httpd/mod_ftp/trunk/modules/ftp/mod_ftp_cmd_pwd.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/mod_ftp_cmd_pwd.c?rev=629101&r1=629100&r2=629101&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/mod_ftp_cmd_pwd.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/mod_ftp_cmd_pwd.c Tue Feb 19 06:03:35 2008
@@ -21,9 +21,9 @@
  */
 
 /*
- * A simple example of how to override a commmand.  The FTP hooks will 
+ * A simple example of how to override a commmand.  The FTP hooks will
  * run all handlers for a command, until a module returns anything other
- * than DECLINED.  All core commands are registered as FTP_HOOK_LAST, so 
+ * than DECLINED.  All core commands are registered as FTP_HOOK_LAST, so
  * any module can override using FTP_HOOK_MIDDLE or FTP_HOOK_FIRST.
  *
  * -rpm 2/28/2001
@@ -46,7 +46,7 @@
 static void register_hooks(apr_pool_t *p)
 {
     ftp_hook_cmd("PWD", mod_ftp_cmd_pwd2, FTP_HOOK_MIDDLE,
-                 FTP_NEED_LOGIN|FTP_TAKE0,
+                 FTP_NEED_LOGIN | FTP_TAKE0,
                  "This command does not do anything.");
 }
 



Mime
View raw message