we do want this one bit from the last patch
This commit is contained in:
parent
1ad45f7009
commit
bcfc2dbeb1
|
@ -2818,8 +2818,13 @@ SWITCH_DECLARE(void) switch_cache_db_status(switch_stream_handle_t *stream)
|
||||||
switch_mutex_lock(sql_manager.dbh_mutex);
|
switch_mutex_lock(sql_manager.dbh_mutex);
|
||||||
|
|
||||||
for (dbh = sql_manager.handle_pool; dbh; dbh = dbh->next) {
|
for (dbh = sql_manager.handle_pool; dbh; dbh = dbh->next) {
|
||||||
char *needle = "pass=\"";
|
char *needles[3];
|
||||||
time_t diff = 0;
|
time_t diff = 0;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
needles[0] = "pass=\"";
|
||||||
|
needles[1] = "password=";
|
||||||
|
needles[2] = "password='";
|
||||||
|
|
||||||
diff = now - dbh->last_used;
|
diff = now - dbh->last_used;
|
||||||
|
|
||||||
|
@ -2832,11 +2837,26 @@ SWITCH_DECLARE(void) switch_cache_db_status(switch_stream_handle_t *stream)
|
||||||
|
|
||||||
/* sanitize password */
|
/* sanitize password */
|
||||||
memset(cleankey_str, 0, sizeof(cleankey_str));
|
memset(cleankey_str, 0, sizeof(cleankey_str));
|
||||||
pos1 = strstr(dbh->name, needle) + strlen(needle);
|
for (i = 0; i < 3; i++) {
|
||||||
pos2 = strstr(pos1, "\"");
|
if((pos1 = strstr(dbh->name, needles[i]))) {
|
||||||
strncpy(cleankey_str, dbh->name, pos1 - dbh->name);
|
pos1 += strlen(needles[i]);
|
||||||
strcpy(&cleankey_str[pos1 - dbh->name], pos2);
|
|
||||||
|
if (!(pos2 = strstr(pos1, "\""))) {
|
||||||
|
if (!(pos2 = strstr(pos1, "'"))) {
|
||||||
|
if (!(pos2 = strstr(pos1, " "))) {
|
||||||
|
pos2 = pos1 + strlen(pos1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strncpy(cleankey_str, dbh->name, pos1 - dbh->name);
|
||||||
|
strcpy(&cleankey_str[pos1 - dbh->name], pos2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == 3) {
|
||||||
|
strncpy(cleankey_str, dbh->name, strlen(dbh->name));
|
||||||
|
}
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if (dbh->use_count) {
|
if (dbh->use_count) {
|
||||||
|
|
Loading…
Reference in New Issue