You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/01/23 20:12:25 UTC
[1/6] trafficserver git commit: TS-3287 Eliminate some dead code
around random()
Repository: trafficserver
Updated Branches:
refs/heads/master 1d19318b0 -> 1ccb1ea4c
TS-3287 Eliminate some dead code around random()
Coverity CID #1261573
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/fc559c12
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/fc559c12
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/fc559c12
Branch: refs/heads/master
Commit: fc559c126d302f6928046ec764854cadb540eedf
Parents: cb7fc8f
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Jan 23 12:04:28 2015 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Jan 23 12:05:43 2015 -0700
----------------------------------------------------------------------
mgmt/web2/WebCompatibility.cc | 24 ------------------------
mgmt/web2/WebCompatibility.h | 7 -------
mgmt/web2/WebHttp.cc | 4 ----
3 files changed, 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc559c12/mgmt/web2/WebCompatibility.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebCompatibility.cc b/mgmt/web2/WebCompatibility.cc
index d0fecfa..7065418 100644
--- a/mgmt/web2/WebCompatibility.cc
+++ b/mgmt/web2/WebCompatibility.cc
@@ -201,27 +201,3 @@ WebFileGetDateGmt(WebHandle h_file)
return date;
}
-
-//-------------------------------------------------------------------------
-// WebSeedRand
-//-------------------------------------------------------------------------
-
-void
-WebSeedRand(long seed)
-{
- srand48(seed);
- return;
-
-}
-
-//-------------------------------------------------------------------------
-// WebRand
-//-------------------------------------------------------------------------
-
-long
-WebRand()
-{
- // we may want to fix this later
- // coverity[secure_coding]
- return lrand48();
-}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc559c12/mgmt/web2/WebCompatibility.h
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebCompatibility.h b/mgmt/web2/WebCompatibility.h
index 3666208..d8c8170 100644
--- a/mgmt/web2/WebCompatibility.h
+++ b/mgmt/web2/WebCompatibility.h
@@ -79,11 +79,4 @@ int WebFileImport_Xmalloc(const char *file, char **file_buf, int *file_size);
int WebFileGetSize(WebHandle h_file);
time_t WebFileGetDateGmt(WebHandle h_file);
-//-------------------------------------------------------------------------
-// Random Numbers
-//-------------------------------------------------------------------------
-
-void WebSeedRand(long seed);
-long WebRand();
-
#endif // _WEB_COMPATIBILITY_H_
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc559c12/mgmt/web2/WebHttp.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebHttp.cc b/mgmt/web2/WebHttp.cc
index 91d99aa..02b5236 100644
--- a/mgmt/web2/WebHttp.cc
+++ b/mgmt/web2/WebHttp.cc
@@ -38,7 +38,6 @@
#include "WebHttp.h"
#include "WebHttpContext.h"
#include "WebHttpMessage.h"
-#include "WebHttpSession.h"
#include "WebOverview.h"
#include "mgmtapi.h"
@@ -469,9 +468,6 @@ WebHttpInit()
// initialize file bindings
g_file_bindings_ht = ink_hash_table_create(InkHashTableKeyType_String);
ink_hash_table_insert(g_file_bindings_ht, "/synthetic.txt", (void *) handle_synthetic);
-
- // initialize other modules
- WebHttpSessionInit();
}
//-------------------------------------------------------------------------
[6/6] trafficserver git commit: TS-3287 Ignore the warning on random
Posted by zw...@apache.org.
TS-3287 Ignore the warning on random
Coverity CID #1261572
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1ccb1ea4
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1ccb1ea4
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1ccb1ea4
Branch: refs/heads/master
Commit: 1ccb1ea4c06ad6f563351320607de62e76c860b6
Parents: 7ec9f0c
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Jan 23 12:07:41 2015 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Jan 23 12:07:41 2015 -0700
----------------------------------------------------------------------
plugins/experimental/buffer_upload/buffer_upload.cc | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1ccb1ea4/plugins/experimental/buffer_upload/buffer_upload.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/buffer_upload/buffer_upload.cc b/plugins/experimental/buffer_upload/buffer_upload.cc
index 1957ab8..81a0093 100644
--- a/plugins/experimental/buffer_upload/buffer_upload.cc
+++ b/plugins/experimental/buffer_upload/buffer_upload.cc
@@ -885,6 +885,7 @@ attach_pvc_plugin(TSCont /* contp ATS_UNUSED */, TSEvent event, void *edata)
if (uconfig->use_disk_buffer) {
char path[500];
+ // coverity[dont_call]
int index = (int) (random() % uconfig->subdir_num);
sprintf(path, "%s/%02X/tmp-XXXXXX", uconfig->base_dir, index);
[3/6] trafficserver git commit: TS-3318 Remove
mgmt/Web2/WebHttpSession.{cc, h}
Posted by zw...@apache.org.
TS-3318 Remove mgmt/Web2/WebHttpSession.{cc,h}
This also helps fixing Coverity CID #1261573
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/cb7fc8f9
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/cb7fc8f9
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/cb7fc8f9
Branch: refs/heads/master
Commit: cb7fc8f9efd67c7286616bcc94bf607035e28693
Parents: f7f3055
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Jan 23 11:41:44 2015 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Jan 23 12:05:43 2015 -0700
----------------------------------------------------------------------
mgmt/web2/Makefile.am | 2 -
mgmt/web2/WebHttpSession.cc | 218 ---------------------------------------
mgmt/web2/WebHttpSession.h | 46 ---------
3 files changed, 266 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cb7fc8f9/mgmt/web2/Makefile.am
----------------------------------------------------------------------
diff --git a/mgmt/web2/Makefile.am b/mgmt/web2/Makefile.am
index a376620..6703fe9 100644
--- a/mgmt/web2/Makefile.am
+++ b/mgmt/web2/Makefile.am
@@ -41,8 +41,6 @@ libweb_a_SOURCES = \
WebHttpContext.h \
WebHttpMessage.cc \
WebHttpMessage.h \
- WebHttpSession.cc \
- WebHttpSession.h \
WebIntrMain.cc \
WebIntrMain.h \
WebOverview.cc \
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cb7fc8f9/mgmt/web2/WebHttpSession.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebHttpSession.cc b/mgmt/web2/WebHttpSession.cc
deleted file mode 100644
index ed45f81..0000000
--- a/mgmt/web2/WebHttpSession.cc
+++ /dev/null
@@ -1,218 +0,0 @@
-/** @file
-
- A brief file description
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-/****************************************************************************
- *
- * WebHttpSession.cc - Manage session data
- *
- *
- ****************************************************************************/
-
-#include "ink_platform.h"
-#include "ink_hash_table.h"
-#include "ink_hash_table.h"
-
-#include "mgmtapi.h"
-#include "MgmtUtils.h"
-#include "WebCompatibility.h"
-#include "WebGlobals.h"
-#include "WebHttpSession.h"
-
-//#include "LocalManager.h"
-
-#define SESSION_EXPIRES 600 // 10 minutes
-#define CURRENT_SESSION_EXPIRES 100 // 10 minutes
-#define SESSION_KEY_LEN 8
-
-static InkHashTable *g_session_ht = 0;
-static ink_mutex g_session_mutex;
-
-struct session_ele
-{
- time_t created;
- void *data;
- WebHttpSessionDeleter deleter_func;
-};
-
-//-------------------------------------------------------------------------
-// deleter_main
-//-------------------------------------------------------------------------
-
-static void *
-deleter_main(void *)
-{
- time_t now;
- InkHashTableIteratorState htis;
- InkHashTableEntry *hte;
- char *key;
- session_ele *session;
- int session_count;
- while (1) {
- time(&now);
- ink_mutex_acquire(&wGlobals.submitLock);
- // mutex_try_acquire to avoid potential deadlocking; not so
- // critical that we don't delete these objects right now.
- session_count = 0;
- if (ink_mutex_try_acquire(&g_session_mutex)) {
- for (hte = ink_hash_table_iterator_first(g_session_ht, &htis);
- hte != NULL; hte = ink_hash_table_iterator_next(g_session_ht, &htis)) {
- key = (char *) ink_hash_table_entry_key(g_session_ht, hte);
- session = (session_ele *) ink_hash_table_entry_value(g_session_ht, hte);
- if (now - session->created > SESSION_EXPIRES) {
- ink_hash_table_delete(g_session_ht, key);
- session->deleter_func(session->data);
- ats_free(session);
- } else {
- session_count++;
- }
- }
- ink_mutex_release(&g_session_mutex);
- }
- ink_mutex_release(&wGlobals.submitLock);
- // random arbitrary heuristic
- mgmt_sleep_sec(SESSION_EXPIRES / 10);
- }
- return NULL;
-}
-
-//-------------------------------------------------------------------------
-// InkMgmtApiCtxDeleter
-//-------------------------------------------------------------------------
-
-void
-InkMgmtApiCtxDeleter(void *data)
-{
- TSCfgContextDestroy((TSCfgContext) data);
-}
-
-//-------------------------------------------------------------------------
-// WebHttpSessionInit
-//-------------------------------------------------------------------------
-
-void
-WebHttpSessionInit()
-{
- time_t now;
- time(&now);
- WebSeedRand((long) now);
- g_session_ht = ink_hash_table_create(InkHashTableKeyType_String);
- ink_mutex_init(&g_session_mutex, "g_session_mutex");
- ink_thread_create(deleter_main, NULL);
-}
-
-//-------------------------------------------------------------------------
-// WebHttpSessionStore
-//-------------------------------------------------------------------------
-
-int
-WebHttpSessionStore(char *key, void *data, WebHttpSessionDeleter deleter_func)
-{
- int err = WEB_HTTP_ERR_OKAY;
- session_ele *session;
- void *dummy;
- time_t now;
-
- if (!key || !data || !deleter_func) {
- return WEB_HTTP_ERR_FAIL;
- }
- ink_mutex_acquire(&g_session_mutex);
- if (ink_hash_table_lookup(g_session_ht, key, &dummy)) {
- err = WEB_HTTP_ERR_FAIL;
- goto Ldone;
- }
- time(&now);
- session = (session_ele *)ats_malloc(sizeof(session_ele));
- session->created = now;
- session->data = data;
- session->deleter_func = deleter_func;
- ink_hash_table_insert(g_session_ht, key, (void *) session);
-
-Ldone:
- ink_mutex_release(&g_session_mutex);
- return err;
-}
-
-//-------------------------------------------------------------------------
-// WebHttpSessionRetrieve
-//-------------------------------------------------------------------------
-
-int
-WebHttpSessionRetrieve(char *key, void **data)
-{
- int err;
- session_ele *session;
- if (!key) {
- return WEB_HTTP_ERR_FAIL;
- }
- ink_mutex_acquire(&g_session_mutex);
- if (!ink_hash_table_lookup(g_session_ht, key, (void **) &session)) {
- err = WEB_HTTP_ERR_FAIL;
- } else {
- *data = session->data;
- err = WEB_HTTP_ERR_OKAY;
- }
- ink_mutex_release(&g_session_mutex);
- return err;
-}
-
-//-------------------------------------------------------------------------
-// WebHttpSessionDelete
-//-------------------------------------------------------------------------
-
-int
-WebHttpSessionDelete(char *key)
-{
- int err = WEB_HTTP_ERR_OKAY;
- session_ele *session;
- if (!key) {
- return WEB_HTTP_ERR_FAIL;
- }
- ink_mutex_acquire(&g_session_mutex);
- if (!ink_hash_table_lookup(g_session_ht, key, (void **) &session)) {
- err = WEB_HTTP_ERR_FAIL;
- goto Ldone;
- }
- ink_hash_table_delete(g_session_ht, key);
- session->deleter_func(session->data);
- ats_free(session);
-Ldone:
- ink_mutex_release(&g_session_mutex);
- return err;
-}
-
-char *
-WebHttpMakeSessionKey_Xmalloc()
-{
- char *session_key_str = (char *)ats_malloc(SESSION_KEY_LEN + 2);
- long session_key = WebRand();
- // note: snprintf takes the buffer length, not the string
- // length? Add 2 to ats_malloc above to be safe. ^_^
- snprintf(session_key_str, SESSION_KEY_LEN + 1, "%lx", session_key);
- return session_key_str;
-}
-
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cb7fc8f9/mgmt/web2/WebHttpSession.h
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebHttpSession.h b/mgmt/web2/WebHttpSession.h
deleted file mode 100644
index e1ec9ad..0000000
--- a/mgmt/web2/WebHttpSession.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/** @file
-
- A brief file description
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-/****************************************************************************
- *
- * WebHttpSession.h - Manage session data
- *
- *
- ****************************************************************************/
-
-#ifndef _WEB_HTTP_SESSION_
-#define _WEB_HTTP_SESSION_
-
-#include "P_RecCore.h"
-
-typedef void (*WebHttpSessionDeleter) (void *data);
-void InkMgmtApiCtxDeleter(void *data);
-
-void WebHttpSessionInit();
-int WebHttpSessionStore(char *key, void *data, WebHttpSessionDeleter deleter_func);
-int WebHttpSessionRetrieve(char *key, void **data);
-int WebHttpSessionDelete(char *key);
-
-char *WebHttpMakeSessionKey_Xmalloc();
-
-#endif // _WEB_HTTP_SESSION_
[5/6] trafficserver git commit: Added TS-3318 to CHANGES
Posted by zw...@apache.org.
Added TS-3318 to CHANGES
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7ec9f0cc
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7ec9f0cc
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7ec9f0cc
Branch: refs/heads/master
Commit: 7ec9f0cc37a530a4fcfc1b0d439e153f497c6ae1
Parents: fc559c1
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Jan 23 12:05:29 2015 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Jan 23 12:06:51 2015 -0700
----------------------------------------------------------------------
CHANGES | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7ec9f0cc/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 48f10e6..18b04c0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 5.3.0
+ *) [TS-3318] Remove mgmt/Web2/WebHttpSession.{cc,h}, it is not used.
+
*) [TS-3243] Removing warnings from loading certificates with duplicated
names.
[2/6] trafficserver git commit: TS-3287 Mark this is false positive
Posted by zw...@apache.org.
TS-3287 Mark this is false positive
Coverity CID #1261574
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/43af58d0
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/43af58d0
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/43af58d0
Branch: refs/heads/master
Commit: 43af58d0a45a677b8c1a5f5b7ca2052a0b6a2651
Parents: 1d19318
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Jan 23 11:36:20 2015 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Jan 23 12:05:43 2015 -0700
----------------------------------------------------------------------
plugins/tcpinfo/tcpinfo.cc | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/43af58d0/plugins/tcpinfo/tcpinfo.cc
----------------------------------------------------------------------
diff --git a/plugins/tcpinfo/tcpinfo.cc b/plugins/tcpinfo/tcpinfo.cc
index 1937eed..6afdda8 100644
--- a/plugins/tcpinfo/tcpinfo.cc
+++ b/plugins/tcpinfo/tcpinfo.cc
@@ -238,6 +238,7 @@ tcp_info_hook(TSCont contp, TSEvent event, void *edata)
// no need to run rand if we are always going log (100%)
if (config->sample < 1000) {
+ // coverity[dont_call]
random = rand() % 1000;
TSDebug("tcpinfo", "random: %d, config->sample: %d", random, config->sample);
}
[4/6] trafficserver git commit: TS-3287 Ignore this coverity error
Posted by zw...@apache.org.
TS-3287 Ignore this coverity error
Coverity CID #1261575
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f7f3055a
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f7f3055a
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f7f3055a
Branch: refs/heads/master
Commit: f7f3055a22f175d9158f8a5ae473482519fcce43
Parents: 43af58d
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Jan 23 11:40:26 2015 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Jan 23 12:05:43 2015 -0700
----------------------------------------------------------------------
proxy/hdrs/HdrTest.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f7f3055a/proxy/hdrs/HdrTest.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/HdrTest.cc b/proxy/hdrs/HdrTest.cc
index d7186fa..eb26455 100644
--- a/proxy/hdrs/HdrTest.cc
+++ b/proxy/hdrs/HdrTest.cc
@@ -311,7 +311,7 @@ HdrTest::test_format_date()
// (2) test a few times per day from 1/1/1970 to past 2010
- // coverity[secure_coding]
+ // coverity[dont_call]
for (t = 0; t < 40 * 366 * (24 * 60 * 60); t += (int) (drand48() * (24 * 60 * 60))) {
cftime_replacement(buffer, sizeof(buffer), "%a, %d %b %Y %T %Z", &t);
t2 = mime_parse_date(buffer, buffer + (int) strlen(buffer));