1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-25 20:25:28 +03:00
aports/community/gvmd/strptime.patch
Robert Contreras 128e613367 community/gvmd: Fix for parse_ctime error
Fixes issue with SCAP, CPE, and CVE data not being loaded into the database. Related to commit 8f388675247b7d2f1c133e3923bc8633c2c77988 that has a MR open.
2020-03-01 09:24:13 +00:00

82 lines
3.4 KiB
Diff

diff --git a/src/manage_sql.c b/src/manage_sql.c
index 5fbcea45..1d247f23 100644
--- a/src/manage_sql.c
+++ b/src/manage_sql.c
@@ -888,23 +888,23 @@ parse_iso_time (const char *text_time)
memset (&tm, 0, sizeof (struct tm));
tm.tm_isdst = -1;
- if (strptime ((char*) text_time, "%FT%T%z", &tm) == NULL)
+ if (strptime ((char*) text_time, "%Y-%m-%dT%T%z", &tm) == NULL)
{
gchar *tz;
memset (&tm, 0, sizeof (struct tm));
tm.tm_isdst = -1;
- if (strptime ((char*) text_time, "%FT%TZ", &tm) == NULL)
+ if (strptime ((char*) text_time, "%Y-%m-%dT%TZ", &tm) == NULL)
{
/* Try time without timezone suffix, applying timezone of user. */
memset (&tm, 0, sizeof (struct tm));
tm.tm_isdst = -1;
- if (strptime ((char*) text_time, "%FT%T", &tm) == NULL)
+ if (strptime ((char*) text_time, "%Y-%m-%dT%T", &tm) == NULL)
{
memset (&tm, 0, sizeof (struct tm));
tm.tm_isdst = -1;
- if (strptime ((char*) text_time, "%F %T", &tm) == NULL)
+ if (strptime ((char*) text_time, "%Y-%m-%d %T", &tm) == NULL)
return parse_ctime (text_time);
}
@@ -928,11 +928,11 @@ parse_iso_time (const char *text_time)
memset (&tm, 0, sizeof (struct tm));
tm.tm_isdst = -1;
- if (strptime ((char*) text_time, "%FT%T", &tm) == NULL)
+ if (strptime ((char*) text_time, "%Y-%m-%dT%T", &tm) == NULL)
{
memset (&tm, 0, sizeof (struct tm));
tm.tm_isdst = -1;
- if (strptime ((char*) text_time, "%F %T", &tm) == NULL)
+ if (strptime ((char*) text_time, "%Y-%m-%d %T", &tm) == NULL)
{
assert (0);
g_warning ("%s: Failed to parse time", __FUNCTION__);
@@ -961,7 +961,7 @@ parse_iso_time (const char *text_time)
memset (&tm, 0, sizeof (struct tm));
tm.tm_isdst = -1;
- if (strptime ((char*) text_time, "%FT%TZ", &tm) == NULL)
+ if (strptime ((char*) text_time, "%Y-%m-%dT%TZ", &tm) == NULL)
{
assert (0);
g_warning ("%s: Failed to parse time", __FUNCTION__);
@@ -1045,7 +1045,7 @@ parse_iso_time (const char *text_time)
memset (&tm, 0, sizeof (struct tm));
tm.tm_isdst = -1;
- if (strptime ((char*) text_time, "%FT%T%z", &tm) == NULL)
+ if (strptime ((char*) text_time, "%Y-%m-%dT%T%z", &tm) == NULL)
{
assert (0);
g_warning ("%s: Failed to parse time", __FUNCTION__);
@@ -28442,7 +28442,7 @@ host_summary_append (GString *host_summary_buffer, const char *host,
struct tm start_tm;
memset (&start_tm, 0, sizeof (struct tm));
- if (strptime (start_iso, "%FT%H:%M:%S", &start_tm) == NULL)
+ if (strptime (start_iso, "%Y-%m-%dT%H:%M:%S", &start_tm) == NULL)
{
g_warning ("%s: Failed to parse start", __FUNCTION__);
return;
@@ -28462,7 +28462,7 @@ host_summary_append (GString *host_summary_buffer, const char *host,
struct tm end_tm;
memset (&end_tm, 0, sizeof (struct tm));
- if (strptime (end_iso, "%FT%H:%M:%S", &end_tm) == NULL)
+ if (strptime (end_iso, "%Y-%m-%dT%H:%M:%S", &end_tm) == NULL)
{
g_warning ("%s: Failed to parse end", __FUNCTION__);
return;