
cherokee at cherokee-project
Jul 1, 2009, 3:12 AM
Views: 102
Permalink
|
|
[3407] cherokee/trunk/cherokee: Neither of these plug-ins was checking whether log writes were
|
|
Revision: 3407 http://svn.cherokee-project.com/changeset/3407 Author: alo Date: 2009-07-01 12:12:05 +0200 (Wed, 01 Jul 2009) Log Message: ----------- Neither of these plug-ins was checking whether log writes were specified in the configuration. This leaded to server crashes when there were not configured properly. Modified Paths: -------------- cherokee/trunk/cherokee/logger_custom.c cherokee/trunk/cherokee/logger_ncsa.c Modified: cherokee/trunk/cherokee/logger_custom.c =================================================================== --- cherokee/trunk/cherokee/logger_custom.c 2009-07-01 08:35:43 UTC (rev 3406) +++ cherokee/trunk/cherokee/logger_custom.c 2009-07-01 10:12:05 UTC (rev 3407) @@ -257,6 +257,10 @@ cherokee_buffer_t *output, void *param) { + UNUSED (template); + UNUSED (token); + UNUSED (param); + return cherokee_buffer_add_ullong10 (output, cherokee_bogonow_msec); } @@ -392,13 +396,13 @@ ret = cherokee_config_node_read (config, key_config, &tmp); if (ret != ret_ok) { - PRINT_ERROR ("Custom Logger: A template is needed for logging connections: %s\n", key_config); + LOG_CRITICAL ("Custom Logger: A template is needed for logging connections: %s\n", key_config); return ret_error; } ret = cherokee_template_parse (template, tmp); if (ret != ret_ok) { - PRINT_ERROR ("Couldn't parse custom log: '%s'\n", tmp->buf); + LOG_CRITICAL ("Couldn't parse custom log: '%s'\n", tmp->buf); return ret_error; } @@ -452,20 +456,24 @@ /* Init properties */ ret = cherokee_config_node_get (config, "access", &subconf); - if (ret == ret_ok) { - ret = cherokee_server_get_log_writer (VSERVER_SRV(vsrv), subconf, &n->writer_access); - if (ret != ret_ok) { - return ret_error; - } + if (ret != ret_ok) { + LOG_CRITICAL_S ("Logger Custom: No 'access' log has been defined.\n"); + return ret_error; } + ret = cherokee_server_get_log_writer (VSERVER_SRV(vsrv), subconf, &n->writer_access); + if (ret != ret_ok) { + return ret_error; + } ret = cherokee_config_node_get (config, "error", &subconf); - if (ret == ret_ok) { - ret = cherokee_server_get_log_writer (VSERVER_SRV(vsrv), subconf, &n->writer_error); - if (ret != ret_ok) { - return ret_error; - } + if (ret != ret_ok) { + LOG_CRITICAL_S ("Logger Custom: No 'error' log has been defined.\n"); + return ret_error; } + ret = cherokee_server_get_log_writer (VSERVER_SRV(vsrv), subconf, &n->writer_error); + if (ret != ret_ok) { + return ret_error; + } /* Templates */ Modified: cherokee/trunk/cherokee/logger_ncsa.c =================================================================== --- cherokee/trunk/cherokee/logger_ncsa.c 2009-07-01 08:35:43 UTC (rev 3406) +++ cherokee/trunk/cherokee/logger_ncsa.c 2009-07-01 10:12:05 UTC (rev 3407) @@ -113,20 +113,24 @@ /* Init the logger writers */ ret = cherokee_config_node_get (config, "access", &subconf); - if (ret == ret_ok) { - ret = cherokee_server_get_log_writer (VSERVER_SRV(vsrv), subconf, &logger->writer_access); - if (ret != ret_ok) { - return ret_error; - } + if (ret != ret_ok) { + LOG_CRITICAL_S ("Logger NCSA: No 'access' log has been defined.\n"); + return ret_error; } + ret = cherokee_server_get_log_writer (VSERVER_SRV(vsrv), subconf, &logger->writer_access); + if (ret != ret_ok) { + return ret_error; + } ret = cherokee_config_node_get (config, "error", &subconf); - if (ret == ret_ok) { - ret = cherokee_server_get_log_writer (VSERVER_SRV(vsrv), subconf, &logger->writer_error); - if (ret != ret_ok) { - return ret_error; - } + if (ret != ret_ok) { + LOG_CRITICAL_S ("Logger NCSA: No 'error' log has been defined.\n"); + return ret_error; } + ret = cherokee_server_get_log_writer (VSERVER_SRV(vsrv), subconf, &logger->writer_error); + if (ret != ret_ok) { + return ret_error; + } return ret_ok; }
|