"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/utils.c" between
gvmd-21.4.2.tar.gz and gvmd-21.4.3.tar.gz

About: OpenVAS Greenbone Vulnerability Manager is a layer between OpenVAS-Scanner and various client applications such as OpenVAS-Client or Greenbone Security Assistant. Among other features, it adds server-side storage of scan results and it makes it unnecessary for scan clients to keep connection until a scan finishes.

utils.c  (gvmd-21.4.2):utils.c  (gvmd-21.4.3)
skipping to change at line 363 skipping to change at line 363
time_str = g_match_info_fetch (match_info, 2); time_str = g_match_info_fetch (match_info, 2);
secs_str = g_match_info_fetch (match_info, 3); secs_str = g_match_info_fetch (match_info, 3);
offset_str = g_match_info_fetch (match_info, 4); offset_str = g_match_info_fetch (match_info, 4);
cleaned_text_time cleaned_text_time
= g_strdup_printf ("%sT%s%s%s", = g_strdup_printf ("%sT%s%s%s",
date_str ? date_str : "", date_str ? date_str : "",
time_str ? time_str : "", time_str ? time_str : "",
secs_str && strcmp (secs_str, "") secs_str && strcmp (secs_str, "")
? secs_str : ":00", ? secs_str : ":00",
offset_str ? offset_str : ""); offset_str ? offset_str : "");
#if !defined(__GLIBC__)
if (strptime_with_reset ((char*) cleaned_text_time, "%FT%T%z", &tm)) if (strptime_with_reset ((char*) cleaned_text_time, "%Y-%m-%dT%T", &tm))
#else
if (strptime_with_reset ((char*) cleaned_text_time, "%FT%T%z", &tm))
#endif
{ {
/* ISO time with numeric offset (e.g. 2020-06-01T01:02:03+04:30) */ /* ISO time with numeric offset (e.g. 2020-06-01T01:02:03+04:30) */
tm.tm_sec = tm.tm_sec - tm.tm_gmtoff; tm.tm_sec = tm.tm_sec - tm.tm_gmtoff;
tm.tm_gmtoff = 0; tm.tm_gmtoff = 0;
epoch_time = mktime_with_tz (&tm, "UTC"); epoch_time = mktime_with_tz (&tm, "UTC");
} }
else if (strptime_with_reset ((char*) cleaned_text_time, "%FT%TZ", &tm)) #if !defined(__GLIBC__)
else if (strptime_with_reset ((char*) cleaned_text_time, "%Y-%m-%dT%T",
&tm))
#else
else if (strptime_with_reset ((char*) cleaned_text_time, "%FT%TZ", &tm))
#endif
{ {
/* ISO time with "Z" for UTC timezone (e.g. 2020-06-01T01:02:03Z) */ /* ISO time with "Z" for UTC timezone (e.g. 2020-06-01T01:02:03Z) */
epoch_time = mktime_with_tz (&tm, "UTC"); epoch_time = mktime_with_tz (&tm, "UTC");
} }
else if (strptime_with_reset ((char*) cleaned_text_time, "%FT%T", &tm)) #if !defined(__GLIBC__)
else if (strptime_with_reset ((char*) cleaned_text_time, "%Y-%m-%dT%T",
&tm))
#else
else if (strptime_with_reset ((char*) cleaned_text_time, "%FT%T", &tm))
#endif
{ {
/* ISO time without timezone suffix (e.g. 2020-06-01T01:02:03) */ /* ISO time without timezone suffix (e.g. 2020-06-01T01:02:03) */
epoch_time = mktime_with_tz (&tm, fallback_tz ? fallback_tz : "UTC"); epoch_time = mktime_with_tz (&tm, fallback_tz ? fallback_tz : "UTC");
} }
else else
g_warning ("%s: Could not parse time %s", __func__, text_time); g_warning ("%s: Could not parse time %s", __func__, text_time);
g_free (date_str); g_free (date_str);
g_free (time_str); g_free (time_str);
g_free (secs_str); g_free (secs_str);
skipping to change at line 426 skipping to change at line 437
static char time_string[100]; static char time_string[100];
if (localtime_r (epoch_time, &tm) == NULL) if (localtime_r (epoch_time, &tm) == NULL)
return NULL; return NULL;
#ifdef __FreeBSD__ #ifdef __FreeBSD__
if (tm.tm_gmtoff == 0) if (tm.tm_gmtoff == 0)
#else #else
if (timezone == 0) if (timezone == 0)
#endif #endif
{ {
if (strftime (time_string, 98, "%FT%TZ", &tm) == 0) #if !defined(__GLIBC__)
if (strftime (time_string, 98, "%Y-%m-%dT%T", &tm) == 0)
#else
if (strftime (time_string, 98, "%FT%TZ", &tm) == 0)
#endif
return NULL; return NULL;
if (abbrev) if (abbrev)
*abbrev = "UTC"; *abbrev = "UTC";
} }
else else
{ {
int len; int len;
if (strftime (time_string, 98, "%FT%T%z", &tm) == 0) #if !defined(__GLIBC__)
if (strftime (time_string, 98, "%Y-%m-%dT%T", &tm) == 0)
#else
if (strftime (time_string, 98, "%FT%T%z", &tm) == 0)
#endif
return NULL; return NULL;
/* Insert the ISO 8601 colon by hand. */ /* Insert the ISO 8601 colon by hand. */
len = strlen (time_string); len = strlen (time_string);
time_string[len + 1] = '\0'; time_string[len + 1] = '\0';
time_string[len] = time_string[len - 1]; time_string[len] = time_string[len - 1];
time_string[len - 1] = time_string[len - 2]; time_string[len - 1] = time_string[len - 2];
time_string[len - 2] = ':'; time_string[len - 2] = ':';
if (abbrev) if (abbrev)
 End of changes. 5 change blocks. 
6 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)