You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by fu...@apache.org on 2007/03/27 17:01:28 UTC
svn commit: r522940 - /httpd/mod_ftp/trunk/modules/ftp/mod_ftp.c
Author: fuankg
Date: Tue Mar 27 08:01:28 2007
New Revision: 522940
URL: http://svn.apache.org/viewvc?view=rev&rev=522940
Log:
removed tabs and trailing spaces.
Modified:
httpd/mod_ftp/trunk/modules/ftp/mod_ftp.c
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?view=diff&rev=522940&r1=522939&r2=522940
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/mod_ftp.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/mod_ftp.c Tue Mar 27 08:01:28 2007
@@ -42,18 +42,18 @@
/* Find the handles of non-ftp filters we will be using
*
- * This must be done after register_hooks since SSL
+ * 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
+ ftp_byterange_filter_handle
= ap_get_output_filter_handle("BYTERANGE");
- ftp_content_length_filter_handle
- = ap_get_output_filter_handle("CONTENT_LENGTH");
- ftp_ssl_input_filter_handle
+ ftp_content_length_filter_handle
+ = ap_get_output_filter_handle("CONTENT_LENGTH");
+ ftp_ssl_input_filter_handle
= ap_get_input_filter_handle(FTP_SSL_FILTER);
- ftp_ssl_output_filter_handle
+ ftp_ssl_output_filter_handle
= ap_get_output_filter_handle(FTP_SSL_FILTER);
/* Register our custom log format flags
@@ -140,7 +140,7 @@
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;
@@ -173,7 +173,7 @@
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;
@@ -198,7 +198,7 @@
fsc->limit_perserver = base->limit_perserver;
fsc->limitdbfile = ap_server_root_relative(p, base->limitdbfile);
-
+
if (!fsc->banner_message) {
fsc->banner_message = base->banner_message;
fsc->banner_message_isfile = base->banner_message_isfile;
@@ -233,24 +233,24 @@
conf->readme = add->readme;
conf->readme_isfile = add->readme_isfile;
- conf->fileperms = (add->fileperms == APR_OS_DEFAULT)
+ conf->fileperms = (add->fileperms == APR_OS_DEFAULT)
? base->fileperms : add->fileperms;
- conf->dirperms = (add->dirperms == APR_OS_DEFAULT)
+ conf->dirperms = (add->dirperms == APR_OS_DEFAULT)
? base->dirperms : add->dirperms;
return conf;
}
int ftp_have_ssl(void)
-{
- return (ftp_ssl_input_filter_handle
+{
+ return (ftp_ssl_input_filter_handle
&& ftp_ssl_output_filter_handle);
}
static void ftp_insert_filter(request_rec *r)
{
ftp_connection *fc = ftp_get_module_config(r->request_config);
-
+
/* XXX: mod_negotiation does not run the create_request hook, so
* we must dig deeper looking for our request_config. Look
* at this later.
@@ -259,23 +259,23 @@
if (r->main) {
fc = ftp_get_module_config(r->main->request_config);
}
-
+
if (!fc) {
return;
}
}
if (fc->datasock && (fc->filter_mask & FTP_NEED_DATA_OUT)) {
- ap_add_output_filter_handle(ftp_data_out_filter_handle, fc, r,
+ ap_add_output_filter_handle(ftp_data_out_filter_handle, fc, r,
r->connection);
}
if (fc->filter_mask & FTP_NEED_BYTERANGE) {
- ap_add_output_filter_handle(ftp_byterange_filter_handle, NULL,
+ ap_add_output_filter_handle(ftp_byterange_filter_handle, NULL,
r, r->connection);
}
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,
+ ap_add_output_filter_handle(ftp_crlf_filter_handle,
apr_pcalloc(r->pool, sizeof(int*)),
r, r->connection);
}
@@ -301,7 +301,7 @@
* the require line properly if we are ensuring that users can not switch
* to other user's home directories.
*/
-static char *find_dir(apr_pool_t *p, const char *wildcard,
+static char *find_dir(apr_pool_t *p, const char *wildcard,
const char *curr_file)
{
char *dirname;
@@ -326,7 +326,7 @@
return NULL;
}
return NULL;
-}
+}
/*
* The check_user_id hook. This is a hack that allows us to ensure that only
@@ -368,7 +368,7 @@
while (strcmp(w = ap_getword_white(r->pool, &t), "")) {
if (!strcmp(w, "dir-name")) {
char *dirname = find_dir(r->pool, conf->d, r->filename);
- rl->requirement = apr_pstrcat(r->pool, rl->requirement,
+ rl->requirement = apr_pstrcat(r->pool, rl->requirement,
" ", dirname, NULL);
}
else {
@@ -434,7 +434,7 @@
char *error_str = NULL;
ftp_dir_config *d = dconf;
-
+
umask = strtol(arg, &endp, 8);
mode = umask & 0666;
@@ -495,7 +495,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";
@@ -508,7 +508,7 @@
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;
@@ -518,12 +518,12 @@
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;
char *op = ap_getword_conf(cmd->pool, &raw);
-
+
if (!strcasecmp(op, "RequireSSL")) {
opt_mask = FTP_OPT_REQUIRESSL;
}
@@ -576,7 +576,7 @@
return apr_pstrcat(cmd->pool, "Invalid IP address for ",
cmd->directive->directive, " (", addr, ")", NULL);
}
-
+
fsc->pasv_addr = apr_pstrdup(cmd->pool, addr);
return NULL;
@@ -624,14 +624,14 @@
}
if (!strncmp(arg, "file:", 5)) {
- rv = apr_stat(&finfo,
+ rv = apr_stat(&finfo,
ap_server_root_relative(cmd->temp_pool, arg + 5),
APR_FINFO_TYPE, cmd->temp_pool);
if (rv != APR_SUCCESS || finfo.filetype != APR_REG) {
return apr_pstrcat(cmd->pool, "Invalid message file: ",
arg + 5, NULL);
}
-
+
*(file_flag) = 1;
*(dest) = ap_server_root_relative(cmd->pool, arg + 5);
}
@@ -675,10 +675,10 @@
const char *min, const char *max)
{
char *error_str = NULL;
-
- ftp_server_config *fsc =
+
+ ftp_server_config *fsc =
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);
@@ -688,7 +688,7 @@
"Invalid range for %s (%s > %s)",
cmd->directive->directive, min, max);
}
-
+
return error_str;
}
@@ -696,10 +696,10 @@
const char *min, const char *max)
{
char *error_str = NULL;
-
- ftp_server_config *fsc =
+
+ ftp_server_config *fsc =
ftp_get_module_config(cmd->server->module_config);
-
+
/* XXX: better error handling */
fsc->active_min = atoi(min);
if (!max) {
@@ -714,7 +714,7 @@
"Invalid range for %s (%s > %s)",
cmd->directive->directive, min, max);
}
-
+
return error_str;
}
@@ -755,7 +755,7 @@
if (err != NULL) {
return err;
}
-
+
fsc = ftp_get_module_config(cmd->server->module_config);
/* XXX: better error handling */
@@ -775,23 +775,23 @@
{
char *error_str = NULL;
ftp_server_config *fsc;
-
+
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
return err;
}
-
+
fsc = ftp_get_module_config(cmd->server->module_config);
-
+
/* XXX: better error handling */
fsc->limit_perip = (apr_port_t) atoi(limit);
-
+
if (fsc->limit_perip < 0) {
error_str = apr_psprintf(cmd->pool,
"%s value must be 0 or greater (%s)",
cmd->directive->directive, limit);
}
-
+
return error_str;
}
@@ -807,7 +807,7 @@
}
fsc = ftp_get_module_config(cmd->server->module_config);
-
+
/* XXX: better error handling */
fsc->limit_perserver = (apr_port_t) atoi(limit);
@@ -831,7 +831,7 @@
}
fsc = ftp_get_module_config(cmd->server->module_config);
-
+
fsc->limitdbfile = ap_server_root_relative(cmd->pool, dbfile);
if (!fsc->limitdbfile) {
return apr_pstrcat(cmd->pool, "Invalid FTPLimitDBFile value: ",
@@ -846,54 +846,54 @@
*/
static const command_rec ftp_cmds[] = {
AP_INIT_FLAG("FTP", ftp_enable, NULL, RSRC_CONF,
- "Run an FTP server on this host"),
+ "Run an FTP server on this host"),
AP_INIT_TAKE1("FTPUmask", ftp_umask, NULL, OR_FILEINFO,
- "Set the umask for created files"),
+ "Set the umask for created files"),
AP_INIT_TAKE1("FTPDirUmask", ftp_dirumask, NULL, OR_FILEINFO,
- "Set the umask for created directory"),
+ "Set the umask for created directory"),
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,
+ AP_INIT_TAKE1("FTPTimeoutIdle", ftp_set_int_slot,
+ (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,
+ AP_INIT_TAKE1("FTPTimeoutData", ftp_set_int_slot,
+ (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,
- "Maximum number of login attempts"),
- AP_INIT_FLAG("FTPImplicitSSL", ftp_implicit_ssl, NULL, RSRC_CONF,
+ max_login_attempts), RSRC_CONF,
+ "Maximum number of login attempts"),
+ AP_INIT_FLAG("FTPImplicitSSL", ftp_implicit_ssl, NULL, RSRC_CONF,
"Use SSL implicitly."),
- AP_INIT_RAW_ARGS("FTPOptions", ftp_options, NULL, RSRC_CONF,
+ AP_INIT_RAW_ARGS("FTPOptions", ftp_options, NULL, RSRC_CONF,
"Set options for this server"),
AP_INIT_TAKE1("FTPPASVaddr", ftp_set_pasv_addr, NULL, RSRC_CONF,
"Set the allowed PASV server IP address for the data "
"channel"),
- AP_INIT_TAKE1("FTPPASVbindaddr", ftp_set_pasv_bindaddr, NULL, RSRC_CONF,
+ AP_INIT_TAKE1("FTPPASVbindaddr", ftp_set_pasv_bindaddr, NULL, RSRC_CONF,
"Set and bind the allowed PASV server IP "
"address for the data channel"),
- AP_INIT_TAKE2("FTPPASVrange", ftp_set_pasv_range, NULL, RSRC_CONF,
+ AP_INIT_TAKE2("FTPPASVrange", ftp_set_pasv_range, NULL, RSRC_CONF,
"Set the allowed PASV port range"),
- AP_INIT_TAKE1("FTPBannerMessage", ftp_set_banner_message, NULL, RSRC_CONF,
+ 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,
+ AP_INIT_TAKE1("FTPExitMessage", ftp_set_exit_message, NULL, RSRC_CONF,
"Set logout message"),
- AP_INIT_TAKE1("FTPHomeDir", ftp_set_homedir, NULL, RSRC_CONF,
+ AP_INIT_TAKE1("FTPHomeDir", ftp_set_homedir, NULL, RSRC_CONF,
"Set the path to directory containing user's "
"home directories"),
- AP_INIT_TAKE1("FTPDocRootEnv", ftp_set_docrootenv, NULL, RSRC_CONF,
+ AP_INIT_TAKE1("FTPDocRootEnv", ftp_set_docrootenv, NULL, RSRC_CONF,
"Set the DocumentRoot based on the given environment "
"variable, such as a per-user LDAP property"),
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."),
- AP_INIT_TAKE1("FTPReadmeMessage", ftp_set_readme_message, NULL, OR_ALL,
+ AP_INIT_TAKE1("FTPReadmeMessage", ftp_set_readme_message, NULL, OR_ALL,
"Set per-directory Readme file"),
AP_INIT_TAKE1("FTPLimitLoginUser", ftp_set_limit_peruser, NULL, RSRC_CONF,
"Set the maximum number of concurrent logins per user"),
@@ -903,9 +903,9 @@
"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,
+ AP_INIT_TAKE1("FTPDataBlockSize", ftp_set_int_slot,
+ (void *)APR_OFFSETOF(ftp_server_config,
+ data_block_size), RSRC_CONF,
"Block size in bytes to use during data transfers"),
{NULL}
};
@@ -913,7 +913,7 @@
static void register_hooks(apr_pool_t *p)
{
static const char *const pred[] = { "mod_log_config.c",
- NULL };
+ NULL };
static const char *const post[] = { NULL };
@@ -921,7 +921,7 @@
ap_hook_post_config(ftp_post_config, post, NULL, APR_HOOK_MIDDLE);
ap_hook_child_init(ftp_child_init, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_process_connection(ftp_process_connection, NULL, NULL,
- APR_HOOK_MIDDLE);
+ APR_HOOK_MIDDLE);
ap_hook_create_request(ftp_create_request,NULL,NULL,APR_HOOK_MIDDLE);
ap_hook_check_user_id(ftp_check_user_id, NULL, NULL, APR_HOOK_REALLY_FIRST);
ap_hook_insert_filter(ftp_insert_filter,NULL,NULL,APR_HOOK_MIDDLE);
@@ -931,14 +931,14 @@
ftp_protocol_filter,
NULL,
AP_FTYPE_PROTOCOL);
- ftp_crlf_filter_handle = ap_register_output_filter("FTP_CRLF",
- ftp_crlf_filter,
- NULL,
- AP_FTYPE_RESOURCE - 1);
- ftp_data_out_filter_handle = ap_register_output_filter("FTP_DATA_OUT",
- ftp_data_out_filter,
- NULL,
- AP_FTYPE_NETWORK - 2);
+ ftp_crlf_filter_handle = ap_register_output_filter("FTP_CRLF",
+ ftp_crlf_filter,
+ NULL,
+ AP_FTYPE_RESOURCE - 1);
+ ftp_data_out_filter_handle = ap_register_output_filter("FTP_DATA_OUT",
+ ftp_data_out_filter,
+ NULL,
+ AP_FTYPE_NETWORK - 2);
/* Register all core command handlers */
ftp_register_core_cmds(p);