From c3b551a0f853a07bac88cb57f81f9334da50e5fa Mon Sep 17 00:00:00 2001 From: Christophe Jaillet Date: Sat, 29 Nov 2014 09:22:43 +0000 Subject: [PATCH] Merge r1533765, r1621419, r1638159, r1638188, r1601603, r1638412, r1418763 from trunk ssl: Axe needless string duplication in setup for call to apr_proc_create() Fix sscanf format spotted by cppcheck fix indent. fix style Private function doesn't need ap_ prefix. tab vs space rename variables: s should be the server_rec Submitted by: trawick, jailletc36, jailletc36, jailletc36, takashi, jailletc36, sf Reviewed by: jailletc36, ylavic, covener Backported by: jailletc36 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1642403 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 18 ------------------ modules/dav/fs/repos.c | 13 +++++++------ modules/loggers/mod_logio.c | 12 ++++++++---- modules/proxy/mod_proxy_wstunnel.c | 4 ++-- modules/proxy/proxy_util.c | 6 +++--- modules/ssl/ssl_engine_init.c | 2 +- modules/ssl/ssl_engine_io.c | 21 ++++++++++----------- modules/ssl/ssl_engine_pphrase.c | 4 +--- server/protocol.c | 2 +- 9 files changed, 33 insertions(+), 49 deletions(-) diff --git a/STATUS b/STATUS index 62533dfb02..766389a1d5 100644 --- a/STATUS +++ b/STATUS @@ -110,24 +110,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: 2.4.x patch: trunk works +1 jkaluza, ylavic, covener - * easy proposals to synch 2.4.x and trunk - - ssl: Axe needless string duplication in setup for call to apr_proc_create() - - Fix sscanf format spotted by cppcheck - - fix indent. - - fix style - - Private function doesn't need ap_ prefix. - - tab vs space - - rename variables: s should be the server_rec - trunk patch: http://svn.apache.org/r1533765 - http://svn.apache.org/r1621419 - http://svn.apache.org/r1638159 - http://svn.apache.org/r1638188 - http://svn.apache.org/r1601603 - http://svn.apache.org/r1638412 - http://svn.apache.org/r1418763 - 2.4.x patch: trunk works - http://people.apache.org/~jailletc36/backport10.patch - +1: jailletc36, ylavic, covener PATCHES PROPOSED TO BACKPORT FROM TRUNK: diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c index 6c4c44b1fd..950646eed8 100644 --- a/modules/dav/fs/repos.c +++ b/modules/dav/fs/repos.c @@ -874,12 +874,13 @@ static int dav_fs_is_parent_resource( && ctx2->pathname[len1] == '/'); } -static apr_status_t tmpfile_cleanup(void *data) { - dav_stream *ds = data; - if (ds->temppath) { - apr_file_remove(ds->temppath, ds->p); - } - return APR_SUCCESS; +static apr_status_t tmpfile_cleanup(void *data) +{ + dav_stream *ds = data; + if (ds->temppath) { + apr_file_remove(ds->temppath, ds->p); + } + return APR_SUCCESS; } /* custom mktemp that creates the file with APR_OS_DEFAULT permissions */ diff --git a/modules/loggers/mod_logio.c b/modules/loggers/mod_logio.c index ad387a9b1b..359d467359 100644 --- a/modules/loggers/mod_logio.c +++ b/modules/loggers/mod_logio.c @@ -52,7 +52,8 @@ typedef struct logio_config_t { * Optional function for the core to add to bytes_out */ -static void ap_logio_add_bytes_out(conn_rec *c, apr_off_t bytes){ +static void ap_logio_add_bytes_out(conn_rec *c, apr_off_t bytes) +{ logio_config_t *cf = ap_get_module_config(c->conn_config, &logio_module); cf->bytes_out += bytes; @@ -62,7 +63,8 @@ static void ap_logio_add_bytes_out(conn_rec *c, apr_off_t bytes){ * Optional function for modules to adjust bytes_in */ -static void ap_logio_add_bytes_in(conn_rec *c, apr_off_t bytes){ +static void ap_logio_add_bytes_in(conn_rec *c, apr_off_t bytes) +{ logio_config_t *cf = ap_get_module_config(c->conn_config, &logio_module); cf->bytes_in += bytes; @@ -132,7 +134,8 @@ static apr_status_t logio_in_filter(ap_filter_t *f, apr_bucket_brigade *bb, ap_input_mode_t mode, apr_read_type_e block, - apr_off_t readbytes) { + apr_off_t readbytes) +{ apr_off_t length; apr_status_t status; logio_config_t *cf = ap_get_module_config(f->c->conn_config, &logio_module); @@ -151,7 +154,8 @@ static apr_status_t logio_in_filter(ap_filter_t *f, * The hooks... */ -static int logio_pre_conn(conn_rec *c, void *csd) { +static int logio_pre_conn(conn_rec *c, void *csd) +{ logio_config_t *cf = apr_pcalloc(c->pool, sizeof(*cf)); ap_set_module_config(c->conn_config, &logio_module, cf); diff --git a/modules/proxy/mod_proxy_wstunnel.c b/modules/proxy/mod_proxy_wstunnel.c index 6013549ac6..5fb8eb66e8 100644 --- a/modules/proxy/mod_proxy_wstunnel.c +++ b/modules/proxy/mod_proxy_wstunnel.c @@ -144,7 +144,7 @@ static int proxy_wstunnel_transfer(request_rec *r, conn_rec *c_i, conn_rec *c_o, /* * process the request and write the response. */ -static int ap_proxy_wstunnel_request(apr_pool_t *p, request_rec *r, +static int proxy_wstunnel_request(apr_pool_t *p, request_rec *r, proxy_conn_rec *conn, proxy_worker *worker, proxy_server_conf *conf, @@ -371,7 +371,7 @@ static int proxy_wstunnel_handler(request_rec *r, proxy_worker *worker, /* Step Three: Process the Request */ - status = ap_proxy_wstunnel_request(p, r, backend, worker, conf, uri, locurl, + status = proxy_wstunnel_request(p, r, backend, worker, conf, uri, locurl, server_portstr); break; } diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index e0fb69b42a..060b98f866 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -2527,7 +2527,7 @@ static apr_status_t send_http_connect(proxy_conn_rec *backend, /* Check for HTTP_OK response status */ if (status == APR_SUCCESS) { - int major, minor; + unsigned int major, minor; /* Only scan for three character status code */ char code_str[4]; @@ -2545,7 +2545,7 @@ static apr_status_t send_http_connect(proxy_conn_rec *backend, ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00950) "send_http_connect: the forward proxy returned code is '%s'", code_str); - status = APR_INCOMPLETE; + status = APR_INCOMPLETE; } } } @@ -3435,7 +3435,7 @@ PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p, /* for sub-requests, ignore freshness/expiry headers */ if (r->main) { - if ( !strcasecmp(headers_in[counter].key, "If-Match") + if ( !strcasecmp(headers_in[counter].key, "If-Match") || !strcasecmp(headers_in[counter].key, "If-Modified-Since") || !strcasecmp(headers_in[counter].key, "If-Range") || !strcasecmp(headers_in[counter].key, "If-Unmodified-Since") diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c index 6648f7c2df..772c8d3f4b 100644 --- a/modules/ssl/ssl_engine_init.c +++ b/modules/ssl/ssl_engine_init.c @@ -1039,7 +1039,7 @@ static apr_status_t ssl_init_server_certs(server_rec *s, if (!(cert = SSL_CTX_get0_certificate(mctx->ssl_ctx))) { #else ssl = SSL_new(mctx->ssl_ctx); - if (ssl) { + if (ssl) { /* Workaround bug in SSL_get_certificate in OpenSSL 0.9.8y */ SSL_set_connect_state(ssl); cert = SSL_get_certificate(ssl); diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c index 1422f2aeaf..fc0f36a74c 100644 --- a/modules/ssl/ssl_engine_io.c +++ b/modules/ssl/ssl_engine_io.c @@ -1954,8 +1954,8 @@ void ssl_io_filter_register(apr_pool_t *p) #define DUMP_WIDTH 16 -static void ssl_io_data_dump(server_rec *srvr, - const char *s, +static void ssl_io_data_dump(server_rec *s, + const char *b, long len) { char buf[256]; @@ -1964,12 +1964,12 @@ static void ssl_io_data_dump(server_rec *srvr, unsigned char ch; trunc = 0; - for(; (len > 0) && ((s[len-1] == ' ') || (s[len-1] == '\0')); len--) + for(; (len > 0) && ((b[len-1] == ' ') || (b[len-1] == '\0')); len--) trunc++; rows = (len / DUMP_WIDTH); if ((rows * DUMP_WIDTH) < len) rows++; - ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, srvr, + ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, s, "+-------------------------------------------------------------------------+"); for(i = 0 ; i< rows; i++) { #if APR_CHARSET_EBCDIC @@ -1979,7 +1979,7 @@ static void ssl_io_data_dump(server_rec *srvr, j = len % DUMP_WIDTH; if (j == 0) j = DUMP_WIDTH; - memcpy(ebcdic_text,(char *)(s) + i * DUMP_WIDTH, j); + memcpy(ebcdic_text,(char *)(b) + i * DUMP_WIDTH, j); ap_xlate_proto_from_ascii(ebcdic_text, j); #endif /* APR_CHARSET_EBCDIC */ apr_snprintf(tmp, sizeof(tmp), "| %04x: ", i * DUMP_WIDTH); @@ -1988,7 +1988,7 @@ static void ssl_io_data_dump(server_rec *srvr, if (((i * DUMP_WIDTH) + j) >= len) apr_cpystrn(buf+strlen(buf), " ", sizeof(buf)-strlen(buf)); else { - ch = ((unsigned char)*((char *)(s) + i * DUMP_WIDTH + j)) & 0xff; + ch = ((unsigned char)*((char *)(b) + i * DUMP_WIDTH + j)) & 0xff; apr_snprintf(tmp, sizeof(tmp), "%02x%c", ch , j==7 ? '-' : ' '); apr_cpystrn(buf+strlen(buf), tmp, sizeof(buf)-strlen(buf)); } @@ -1998,7 +1998,7 @@ static void ssl_io_data_dump(server_rec *srvr, if (((i * DUMP_WIDTH) + j) >= len) apr_cpystrn(buf+strlen(buf), " ", sizeof(buf)-strlen(buf)); else { - ch = ((unsigned char)*((char *)(s) + i * DUMP_WIDTH + j)) & 0xff; + ch = ((unsigned char)*((char *)(b) + i * DUMP_WIDTH + j)) & 0xff; #if APR_CHARSET_EBCDIC apr_snprintf(tmp, sizeof(tmp), "%c", (ch >= 0x20 && ch <= 0x7F) ? ebcdic_text[j] : '.'); #else /* APR_CHARSET_EBCDIC */ @@ -2008,13 +2008,12 @@ static void ssl_io_data_dump(server_rec *srvr, } } apr_cpystrn(buf+strlen(buf), " |", sizeof(buf)-strlen(buf)); - ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, srvr, - "%s", buf); + ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, s, "%s", buf); } if (trunc > 0) - ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, srvr, + ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, s, "| %04ld - ", len + trunc); - ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, srvr, + ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, s, "+-------------------------------------------------------------------------+"); return; } diff --git a/modules/ssl/ssl_engine_pphrase.c b/modules/ssl/ssl_engine_pphrase.c index a1f8734cab..e158a4765a 100644 --- a/modules/ssl/ssl_engine_pphrase.c +++ b/modules/ssl/ssl_engine_pphrase.c @@ -415,12 +415,10 @@ static apr_status_t ssl_pipe_child_create(apr_pool_t *p, const char *progname) APR_FULL_BLOCK, APR_NO_PIPE)) == APR_SUCCESS)) { char **args; - const char *pname; apr_tokenize_to_argv(progname, &args, p); - pname = apr_pstrdup(p, args[0]); procnew = (apr_proc_t *)apr_pcalloc(p, sizeof(*procnew)); - rc = apr_proc_create(procnew, pname, (const char * const *)args, + rc = apr_proc_create(procnew, args[0], (const char * const *)args, NULL, procattr, p); if (rc == APR_SUCCESS) { /* XXX: not sure if we aught to... diff --git a/server/protocol.c b/server/protocol.c index 5acdb547e5..499be515e8 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -555,7 +555,7 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb) const char *uri; const char *pro; - int major = 1, minor = 0; /* Assume HTTP/1.0 if non-"HTTP" protocol */ + unsigned int major = 1, minor = 0; /* Assume HTTP/1.0 if non-"HTTP" protocol */ char http[5]; apr_size_t len; int num_blank_lines = 0; -- 2.50.1