From 9bcbbb5873e7c885311e241ed95b7d5543b4904f42bade6ff35921d1c202a6f2 Mon Sep 17 00:00:00 2001
From: Adam Majer <amajer@suse.com>
Date: Fri, 15 Mar 2019 09:35:55 +0000
Subject: [PATCH] Accepting request 682853 from
 home:adamm:branches:systemsmanagement

- Update to 3.12.1 (LTS)
  - Added a new binary: cf-check
    + Corrupt local databases (LMDB) continues to be a problem.
    cf-check will be used to diagnose and remediate problems
    with corrupt databases. It is a standalone binary, which
    doesn't evaluate policy or use the local databases, thus
    it can be used in situations where the other binaries
    like cf-agent would hang.
    + cf-check replaces our lmdb database dumper, lmdump.
    + `cf-check lmdump` or symlinking / renaming it to lmdump
    will make cf-check have the exact same behavior as lmdump.
    cf-check will include much more functionality in the future
    and some of the code will be added to other binaries,
    for example to do health checks of databases on startup.
    Ticket: (ENT-4064)
  - Class names set by module protocol are automatically canonified
    (CFE-2877, CFE-2887)
  - Correct log level for data_readstringarray* (CFE-2922)
  - Eliminated error messages caused by attempting to kill expired processes
    (CFE-2824)
  - Fix cf-runalerts systemd unit conditions so the service will run
    (ENT-3929)
  - Fix the off-by-one error in cf-runagent background process spawning
    (CFE-2873)
  - Fixed a memory leak which occurred when reloading RSA keys from disk
  - Fixed a memory leak which occurred while loading augments files
    (CFE-2913)
  - Fixed an issue while parsing ps output on AIX (ENT-4295)
  - Fixed an issue with splay time in cf-execd (CFE-2931)
  - Fixed error handling and memory leak in cf-key (CFE-2918)

OBS-URL: https://build.opensuse.org/request/show/682853
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/cfengine?expand=0&rev=178
---
 0003-Reduce-string-truncation-warnings.patch | 248 +++++++++----------
 cfengine-3.12.1.tar.gz                       |   3 +
 cfengine.changes                             |  47 ++++
 cfengine.spec                                |  15 +-
 core-3.12.0.tar.gz                           |   3 -
 5 files changed, 179 insertions(+), 137 deletions(-)
 create mode 100644 cfengine-3.12.1.tar.gz
 delete mode 100644 core-3.12.0.tar.gz

diff --git a/0003-Reduce-string-truncation-warnings.patch b/0003-Reduce-string-truncation-warnings.patch
index c026367..5c64d5a 100644
--- a/0003-Reduce-string-truncation-warnings.patch
+++ b/0003-Reduce-string-truncation-warnings.patch
@@ -26,11 +26,11 @@ Subject: [PATCH 3/3] Reduce string truncation warnings
  tests/unit/set_domainname_test.c  |  2 +-
  20 files changed, 71 insertions(+), 70 deletions(-)
 
-diff --git a/cf-agent/verify_databases.c b/cf-agent/verify_databases.c
-index 704a938d1bc1..a60ccb9682a7 100644
---- a/cf-agent/verify_databases.c
-+++ b/cf-agent/verify_databases.c
-@@ -221,7 +221,7 @@ static PromiseResult VerifySQLPromise(EvalContext *ctx, Attributes a, const Prom
+Index: cfengine-3.12.1/cf-agent/verify_databases.c
+===================================================================
+--- cfengine-3.12.1.orig/cf-agent/verify_databases.c
++++ cfengine-3.12.1/cf-agent/verify_databases.c
+@@ -221,7 +221,7 @@ static PromiseResult VerifySQLPromise(Ev
      }
      else
      {
@@ -39,7 +39,7 @@ index 704a938d1bc1..a60ccb9682a7 100644
  
          if (VerifyTablePromise(ctx, &cfdb, query, a.database.columns, a, pp, &result))
          {
-@@ -300,7 +300,7 @@ static int VerifyDatabasePromise(CfdbConn *cfdb, char *database, Attributes a)
+@@ -300,7 +300,7 @@ static int VerifyDatabasePromise(CfdbCon
          if (((a.transaction.action) != cfa_warn) && (!DONTDO))
          {
              Log(LOG_LEVEL_VERBOSE, "Attempting to delete the database '%s'", database);
@@ -48,7 +48,7 @@ index 704a938d1bc1..a60ccb9682a7 100644
              CfVoidQueryDB(cfdb, query);
              return cfdb->result;
          }
-@@ -316,7 +316,7 @@ static int VerifyDatabasePromise(CfdbConn *cfdb, char *database, Attributes a)
+@@ -316,7 +316,7 @@ static int VerifyDatabasePromise(CfdbCon
          if (((a.transaction.action) != cfa_warn) && (!DONTDO))
          {
              Log(LOG_LEVEL_VERBOSE, "Attempting to create the database '%s'", database);
@@ -57,7 +57,7 @@ index 704a938d1bc1..a60ccb9682a7 100644
              CfVoidQueryDB(cfdb, query);
              return cfdb->result;
          }
-@@ -499,7 +499,7 @@ static int ValidateRegistryPromiser(char *key, const Promise *pp)
+@@ -499,7 +499,7 @@ static int ValidateRegistryPromiser(char
  static int VerifyTablePromise(EvalContext *ctx, CfdbConn *cfdb, char *table_path, Rlist *columns, Attributes a,
                                const Promise *pp, PromiseResult *result)
  {
@@ -66,7 +66,7 @@ index 704a938d1bc1..a60ccb9682a7 100644
      int i, count, size, no_of_cols, *size_table, *done, identified, retval = true;
      char **name_table, **type_table;
  
-@@ -670,12 +670,12 @@ static int VerifyTablePromise(EvalContext *ctx, CfdbConn *cfdb, char *table_path
+@@ -670,12 +670,12 @@ static int VerifyTablePromise(EvalContex
                  {
                      if (size_table[i] > 0)
                      {
@@ -81,7 +81,7 @@ index 704a938d1bc1..a60ccb9682a7 100644
                                   type_table[i]);
                      }
  
-@@ -742,7 +742,7 @@ static int CreateTableColumns(CfdbConn *cfdb, char *table, Rlist *columns)
+@@ -742,7 +742,7 @@ static int CreateTableColumns(CfdbConn *
  
      if (no_of_cols > 0)
      {
@@ -90,7 +90,7 @@ index 704a938d1bc1..a60ccb9682a7 100644
  
          for (i = 0; i < no_of_cols; i++)
          {
-@@ -781,7 +781,7 @@ static int CreateTableColumns(CfdbConn *cfdb, char *table, Rlist *columns)
+@@ -781,7 +781,7 @@ static int CreateTableColumns(CfdbConn *
  static Rlist *GetSQLTables(CfdbConn *cfdb)
  {
      Rlist *list = NULL;
@@ -99,7 +99,7 @@ index 704a938d1bc1..a60ccb9682a7 100644
  
      ListTables(cfdb->type, query);
  
-@@ -870,7 +870,7 @@ static int ValidateSQLTableName(char *table_path, char *db, char *table)
+@@ -870,7 +870,7 @@ static int ValidateSQLTableName(char *ta
  
  static void QueryTableColumns(char *s, char *db, char *table)
  {
@@ -108,11 +108,11 @@ index 704a938d1bc1..a60ccb9682a7 100644
               "SELECT column_name,data_type,character_maximum_length FROM information_schema.columns WHERE table_name ='%s' AND table_schema = '%s'",
               table, db);
  }
-diff --git a/cf-agent/verify_exec.c b/cf-agent/verify_exec.c
-index a21126c4fd48..a5a16ee68b8f 100644
---- a/cf-agent/verify_exec.c
-+++ b/cf-agent/verify_exec.c
-@@ -203,7 +203,7 @@ static char *GetLockNameExec(Attributes a, const Promise *pp)
+Index: cfengine-3.12.1/cf-agent/verify_exec.c
+===================================================================
+--- cfengine-3.12.1.orig/cf-agent/verify_exec.c
++++ cfengine-3.12.1/cf-agent/verify_exec.c
+@@ -203,7 +203,7 @@ static char *GetLockNameExec(Attributes
  static ActionResult RepairExec(EvalContext *ctx, Attributes a,
                                 const Promise *pp, PromiseResult *result)
  {
@@ -121,7 +121,7 @@ index a21126c4fd48..a5a16ee68b8f 100644
      char cmdline[CF_BUFSIZE];
      char comm[20];
      int outsourced, count = 0;
-@@ -456,7 +456,7 @@ static ActionResult RepairExec(EvalContext *ctx, Attributes a,
+@@ -456,7 +456,7 @@ static ActionResult RepairExec(EvalConte
      umask(maskval);
  #endif
  
@@ -130,11 +130,11 @@ index a21126c4fd48..a5a16ee68b8f 100644
  
  #ifndef __MINGW32__
      if ((a.transaction.background) && outsourced)
-diff --git a/cf-agent/verify_packages.c b/cf-agent/verify_packages.c
-index 54b8564bca13..1e55a9513da6 100644
---- a/cf-agent/verify_packages.c
-+++ b/cf-agent/verify_packages.c
-@@ -3176,7 +3176,7 @@ static void DeletePackageManagers(PackageManager *np)
+Index: cfengine-3.12.1/cf-agent/verify_packages.c
+===================================================================
+--- cfengine-3.12.1.orig/cf-agent/verify_packages.c
++++ cfengine-3.12.1/cf-agent/verify_packages.c
+@@ -3176,7 +3176,7 @@ static void DeletePackageManagers(Packag
  
  const char *PrefixLocalRepository(const Rlist *repositories, const char *package)
  {
@@ -143,10 +143,10 @@ index 54b8564bca13..1e55a9513da6 100644
      struct stat sb;
      char path[CF_BUFSIZE];
  
-diff --git a/cf-execd/cf-execd-runner.c b/cf-execd/cf-execd-runner.c
-index 67263c1fb075..18a32a0a32f2 100644
---- a/cf-execd/cf-execd-runner.c
-+++ b/cf-execd/cf-execd-runner.c
+Index: cfengine-3.12.1/cf-execd/cf-execd-runner.c
+===================================================================
+--- cfengine-3.12.1.orig/cf-execd/cf-execd-runner.c
++++ cfengine-3.12.1/cf-execd/cf-execd-runner.c
 @@ -195,7 +195,7 @@ void LocalExec(const ExecConfig *config)
      strlcpy(esc_command, MapName(cmd), CF_BUFSIZE);
  
@@ -165,11 +165,11 @@ index 67263c1fb075..18a32a0a32f2 100644
                       GetWorkDir(), canonified_fq_name, line, thread_name);
  
              MapName(filename);
-diff --git a/cf-monitord/env_monitor.c b/cf-monitord/env_monitor.c
-index a55119625344..3f0f4faadc8d 100644
---- a/cf-monitord/env_monitor.c
-+++ b/cf-monitord/env_monitor.c
-@@ -936,7 +936,7 @@ static double SetClasses(EvalContext *ctx, char *name, double variable, double a
+Index: cfengine-3.12.1/cf-monitord/env_monitor.c
+===================================================================
+--- cfengine-3.12.1.orig/cf-monitord/env_monitor.c
++++ cfengine-3.12.1/cf-monitord/env_monitor.c
+@@ -943,7 +943,7 @@ static double SetClasses(EvalContext *ct
      {
          Log(LOG_LEVEL_DEBUG, "No sigma variation .. can't measure class");
  
@@ -178,7 +178,7 @@ index a55119625344..3f0f4faadc8d 100644
          MonEntropyPurgeUnused(buffer);
  
          return sig;
-@@ -1044,13 +1044,13 @@ static void SetVariable(char *name, double value, double average, double stddev,
+@@ -1051,13 +1051,13 @@ static void SetVariable(char *name, doub
  {
      char var[CF_BUFSIZE];
  
@@ -195,11 +195,11 @@ index a55119625344..3f0f4faadc8d 100644
      AppendItem(classlist, var, "");
  }
  
-diff --git a/cf-monitord/mon_network_sniffer.c b/cf-monitord/mon_network_sniffer.c
-index 5813052768ea..1c5064a38b27 100644
---- a/cf-monitord/mon_network_sniffer.c
-+++ b/cf-monitord/mon_network_sniffer.c
-@@ -210,7 +210,7 @@ static void IncrementCounter(Item **list, char *name)
+Index: cfengine-3.12.1/cf-monitord/mon_network_sniffer.c
+===================================================================
+--- cfengine-3.12.1.orig/cf-monitord/mon_network_sniffer.c
++++ cfengine-3.12.1/cf-monitord/mon_network_sniffer.c
+@@ -210,7 +210,7 @@ static void IncrementCounter(Item **list
  
  static void AnalyzeArrival(Item *ip_addresses, long iteration, char *arrival, double *cf_this)
  {
@@ -208,7 +208,7 @@ index 5813052768ea..1c5064a38b27 100644
      int isme_dest, isme_src;
  
      src[0] = dest[0] = '\0';
-@@ -387,11 +387,11 @@ static void AnalyzeArrival(Item *ip_addresses, long iteration, char *arrival, do
+@@ -387,11 +387,11 @@ static void AnalyzeArrival(Item *ip_addr
  
          if (strstr(arrival, ".138"))
          {
@@ -222,11 +222,11 @@ index 5813052768ea..1c5064a38b27 100644
          }
          else
          {
-diff --git a/cf-runagent/cf-runagent.c b/cf-runagent/cf-runagent.c
-index 92045d31c9fe..3942929fcb98 100644
---- a/cf-runagent/cf-runagent.c
-+++ b/cf-runagent/cf-runagent.c
-@@ -794,15 +794,15 @@ static void HailExec(AgentConnection *conn, char *peer)
+Index: cfengine-3.12.1/cf-runagent/cf-runagent.c
+===================================================================
+--- cfengine-3.12.1.orig/cf-runagent/cf-runagent.c
++++ cfengine-3.12.1/cf-runagent/cf-runagent.c
+@@ -796,15 +796,15 @@ static void HailExec(AgentConnection *co
  static FILE *NewStream(char *name)
  {
      FILE *fp;
@@ -245,11 +245,11 @@ index 92045d31c9fe..3942929fcb98 100644
                   GetWorkDir(), FILE_SEPARATOR, FILE_SEPARATOR, name);
      }
  
-diff --git a/cf-serverd/server_common.c b/cf-serverd/server_common.c
-index 6bf95be92852..bfcd25d386e2 100644
---- a/cf-serverd/server_common.c
-+++ b/cf-serverd/server_common.c
-@@ -370,8 +370,8 @@ static void AbortTransfer(ConnectionInfo *connection, char *filename)
+Index: cfengine-3.12.1/cf-serverd/server_common.c
+===================================================================
+--- cfengine-3.12.1.orig/cf-serverd/server_common.c
++++ cfengine-3.12.1/cf-serverd/server_common.c
+@@ -370,8 +370,8 @@ static void AbortTransfer(ConnectionInfo
  {
      Log(LOG_LEVEL_VERBOSE, "Aborting transfer of file due to source changes");
  
@@ -260,7 +260,7 @@ index 6bf95be92852..bfcd25d386e2 100644
               CF_CHANGEDSTR1, CF_CHANGEDSTR2, filename);
  
      if (SendTransaction(connection, sendbuffer, 0, CF_DONE) == -1)
-@@ -385,9 +385,9 @@ static void FailedTransfer(ConnectionInfo *connection)
+@@ -385,9 +385,9 @@ static void FailedTransfer(ConnectionInf
  {
      Log(LOG_LEVEL_VERBOSE, "Transfer failure");
  
@@ -308,7 +308,7 @@ index 6bf95be92852..bfcd25d386e2 100644
  
                      if (ConnectionInfoProtocolVersion(conn_info) == CF_PROTOCOL_CLASSIC)
                      {
-@@ -606,7 +606,7 @@ void CfEncryptGetFile(ServerFileGetState *args)
+@@ -606,7 +606,7 @@ void CfEncryptGetFile(ServerFileGetState
  
          while (true)
          {
@@ -317,10 +317,10 @@ index 6bf95be92852..bfcd25d386e2 100644
  
              if ((n_read = read(fd, sendbuffer, blocksize)) == -1)
              {
-diff --git a/libcfnet/client_protocol.c b/libcfnet/client_protocol.c
-index 0b80f0acf519..085b0fa27e30 100644
---- a/libcfnet/client_protocol.c
-+++ b/libcfnet/client_protocol.c
+Index: cfengine-3.12.1/libcfnet/client_protocol.c
+===================================================================
+--- cfengine-3.12.1.orig/libcfnet/client_protocol.c
++++ cfengine-3.12.1/libcfnet/client_protocol.c
 @@ -63,7 +63,7 @@ void SetSkipIdentify(bool enabled)
  
  int IdentifyAgent(ConnectionInfo *conn_info)
@@ -330,11 +330,11 @@ index 0b80f0acf519..085b0fa27e30 100644
      char dnsname[CF_MAXVARSIZE], localip[CF_MAX_IP_LEN];
      int ret;
  
-diff --git a/libenv/sysinfo.c b/libenv/sysinfo.c
-index 29b82b36807b..1f194c5522e5 100644
---- a/libenv/sysinfo.c
-+++ b/libenv/sysinfo.c
-@@ -443,7 +443,7 @@ static void GetNameInfo3(EvalContext *ctx)
+Index: cfengine-3.12.1/libenv/sysinfo.c
+===================================================================
+--- cfengine-3.12.1.orig/libenv/sysinfo.c
++++ cfengine-3.12.1/libenv/sysinfo.c
+@@ -443,7 +443,7 @@ static void GetNameInfo3(EvalContext *ct
      };
      int have_component[COMPONENTS_SIZE];
      struct stat sb;
@@ -343,7 +343,7 @@ index 29b82b36807b..1f194c5522e5 100644
  
      if (uname(&VSYSNAME) == -1)
      {
-@@ -2064,7 +2064,7 @@ static int Linux_Suse_Version(EvalContext *ctx)
+@@ -2064,7 +2064,7 @@ static int Linux_Suse_Version(EvalContex
          strncpy(classbuf, vendor, CF_MAXVARSIZE);
          EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent");
          snprintf(classbuf + strlen(classbuf), CF_MAXVARSIZE - strlen(classbuf), "_%d", major);
@@ -352,7 +352,7 @@ index 29b82b36807b..1f194c5522e5 100644
          if (minor != -1)
          {
              snprintf(classbuf + strlen(classbuf), CF_MAXVARSIZE - strlen(classbuf), "_%d", minor);
-@@ -2177,7 +2177,7 @@ static void LinuxDebianSanitizeIssue(char *buffer)
+@@ -2177,7 +2177,7 @@ static void LinuxDebianSanitizeIssue(cha
  
  static int Linux_Misc_Version(EvalContext *ctx)
  {
@@ -361,7 +361,7 @@ index 29b82b36807b..1f194c5522e5 100644
      char version[CF_MAXVARSIZE];
      char os[CF_MAXVARSIZE];
      char buffer[CF_BUFSIZE];
-@@ -2218,7 +2218,7 @@ static int Linux_Misc_Version(EvalContext *ctx)
+@@ -2218,7 +2218,7 @@ static int Linux_Misc_Version(EvalContex
  
      if (*os && *version)
      {
@@ -370,7 +370,7 @@ index 29b82b36807b..1f194c5522e5 100644
          SetFlavor(ctx, flavor);
          return 1;
      }
-@@ -2233,7 +2233,7 @@ static int Linux_Debian_Version(EvalContext *ctx)
+@@ -2233,7 +2233,7 @@ static int Linux_Debian_Version(EvalCont
      int major = -1;
      int release = -1;
      int result;
@@ -379,7 +379,7 @@ index 29b82b36807b..1f194c5522e5 100644
  
      Log(LOG_LEVEL_VERBOSE, "This appears to be a debian system.");
      EvalContextClassPutHard(ctx, "debian", "inventory,attribute_name=none,source=agent");
-@@ -2253,15 +2253,15 @@ static int Linux_Debian_Version(EvalContext *ctx)
+@@ -2253,15 +2253,15 @@ static int Linux_Debian_Version(EvalCont
      {
      case 2:
          Log(LOG_LEVEL_VERBOSE, "This appears to be a Debian %u.%u system.", major, release);
@@ -398,7 +398,7 @@ index 29b82b36807b..1f194c5522e5 100644
          SetFlavor(ctx, classname);
          break;
  
-@@ -2270,7 +2270,7 @@ static int Linux_Debian_Version(EvalContext *ctx)
+@@ -2270,7 +2270,7 @@ static int Linux_Debian_Version(EvalCont
          sscanf(buffer, "%25[^/]", version);
          if (strlen(version) > 0)
          {
@@ -407,7 +407,7 @@ index 29b82b36807b..1f194c5522e5 100644
              EvalContextClassPutHard(ctx, classname, "inventory,attribute_name=none,source=agent");
          }
          break;
-@@ -2288,7 +2288,7 @@ static int Linux_Debian_Version(EvalContext *ctx)
+@@ -2288,7 +2288,7 @@ static int Linux_Debian_Version(EvalCont
      {
          LinuxDebianSanitizeIssue(buffer);
          sscanf(buffer, "%*s %*s %[^./]", version);
@@ -416,7 +416,7 @@ index 29b82b36807b..1f194c5522e5 100644
          EvalContextClassPutHard(ctx, "debian", "inventory,attribute_name=none,source=agent");
          SetFlavor(ctx, buffer);
      }
-@@ -2296,12 +2296,12 @@ static int Linux_Debian_Version(EvalContext *ctx)
+@@ -2296,12 +2296,12 @@ static int Linux_Debian_Version(EvalCont
      {
          LinuxDebianSanitizeIssue(buffer);
          sscanf(buffer, "%*s %[^.].%d", version, &release);
@@ -497,11 +497,11 @@ index 29b82b36807b..1f194c5522e5 100644
              EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent");
              sufficient = 1;
          }
-diff --git a/libpromises/cf3globals.c b/libpromises/cf3globals.c
-index f16e14d688b8..8ede60fd8b0e 100644
---- a/libpromises/cf3globals.c
-+++ b/libpromises/cf3globals.c
-@@ -55,7 +55,7 @@ long LASTSEENEXPIREAFTER = SECONDS_PER_WEEK; /* GLOBAL_P */
+Index: cfengine-3.12.1/libpromises/cf3globals.c
+===================================================================
+--- cfengine-3.12.1.orig/libpromises/cf3globals.c
++++ cfengine-3.12.1/libpromises/cf3globals.c
+@@ -55,7 +55,7 @@ long LASTSEENEXPIREAFTER = SECONDS_PER_W
  bool DONTDO = false; /* GLOBAL_A */
  
  /* NB! Check use before changing sizes */
@@ -510,11 +510,11 @@ index f16e14d688b8..8ede60fd8b0e 100644
  char VUQNAME[CF_MAXVARSIZE] = ""; /* GLOBAL_E */
  char VDOMAIN[CF_MAXVARSIZE] = ""; /* GLOBAL_E GLOBAL_P */
  
-diff --git a/libpromises/cf3lex.l b/libpromises/cf3lex.l
-index 7d9f666cc727..b18c573d0c64 100644
---- a/libpromises/cf3lex.l
-+++ b/libpromises/cf3lex.l
-@@ -333,7 +333,7 @@ promise_type   [a-zA-Z_]+:
+Index: cfengine-3.12.1/libpromises/cf3lex.l
+===================================================================
+--- cfengine-3.12.1.orig/libpromises/cf3lex.l
++++ cfengine-3.12.1/libpromises/cf3lex.l
+@@ -334,7 +334,7 @@ promise_type   [a-zA-Z_]+:
                            {
                                yyerror("identifier too long");
                            }
@@ -523,7 +523,7 @@ index 7d9f666cc727..b18c573d0c64 100644
                            return IDSYNTAX;
                        }
  
-@@ -346,7 +346,7 @@ promise_type   [a-zA-Z_]+:
+@@ -347,7 +347,7 @@ promise_type   [a-zA-Z_]+:
                            {
                                yyerror("qualified identifier too long");
                            }
@@ -532,7 +532,7 @@ index 7d9f666cc727..b18c573d0c64 100644
                            return IDSYNTAX;
                        }
  
-@@ -440,7 +440,7 @@ promise_type   [a-zA-Z_]+:
+@@ -441,7 +441,7 @@ promise_type   [a-zA-Z_]+:
  
                            tmp = xstrdup(yytext);
                            tmp[yyleng - 1] = '\0';
@@ -541,11 +541,11 @@ index 7d9f666cc727..b18c573d0c64 100644
  
                            if (P.currentclasses != NULL)
                            {
-diff --git a/libpromises/cf3parse.y b/libpromises/cf3parse.y
-index b29bb4445c68..bd899e240174 100644
---- a/libpromises/cf3parse.y
-+++ b/libpromises/cf3parse.y
-@@ -1132,7 +1132,7 @@ functionid:            IDSYNTAX
+Index: cfengine-3.12.1/libpromises/cf3parse.y
+===================================================================
+--- cfengine-3.12.1.orig/libpromises/cf3parse.y
++++ cfengine-3.12.1/libpromises/cf3parse.y
+@@ -1134,7 +1134,7 @@ functionid:            IDSYNTAX
                       | NAKEDVAR
                         {
                             ParserDebug("\tP:%s:%s:%s:%s function nakedvar = %s\n", P.block, P.blocktype, P.blockid, P.currentclasses ? P.currentclasses : "any", P.currentstring);
@@ -554,11 +554,11 @@ index b29bb4445c68..bd899e240174 100644
                             free(P.currentstring);
                             P.currentstring = NULL;
                         }
-diff --git a/libpromises/eval_context.c b/libpromises/eval_context.c
-index cb751ae46796..5257a7d13c95 100644
---- a/libpromises/eval_context.c
-+++ b/libpromises/eval_context.c
-@@ -1568,7 +1568,7 @@ Class *EvalContextClassMatch(const EvalContext *ctx, const char *regex)
+Index: cfengine-3.12.1/libpromises/eval_context.c
+===================================================================
+--- cfengine-3.12.1.orig/libpromises/eval_context.c
++++ cfengine-3.12.1/libpromises/eval_context.c
+@@ -1569,7 +1569,7 @@ Class *EvalContextClassMatch(const EvalC
  static bool EvalContextClassPut(EvalContext *ctx, const char *ns, const char *name, bool is_soft, ContextScope scope, const char *tags)
  {
      {
@@ -567,7 +567,7 @@ index cb751ae46796..5257a7d13c95 100644
          char canonified_context[CF_MAXVARSIZE];
  
  
-@@ -1591,7 +1591,7 @@ static bool EvalContextClassPut(EvalContext *ctx, const char *ns, const char *na
+@@ -1592,7 +1592,7 @@ static bool EvalContextClassPut(EvalCont
  
          if (ns && strcmp(ns, "default") != 0)
          {
@@ -576,11 +576,11 @@ index cb751ae46796..5257a7d13c95 100644
          }
          else
          {
-diff --git a/libpromises/evalfunction.c b/libpromises/evalfunction.c
-index f4d5db0f8356..b88e6f20b0a2 100644
---- a/libpromises/evalfunction.c
-+++ b/libpromises/evalfunction.c
-@@ -496,7 +496,7 @@ static Rlist *GetHostsFromLastseenDB(Item *addresses, time_t horizon, bool retur
+Index: cfengine-3.12.1/libpromises/evalfunction.c
+===================================================================
+--- cfengine-3.12.1.orig/libpromises/evalfunction.c
++++ cfengine-3.12.1/libpromises/evalfunction.c
+@@ -496,7 +496,7 @@ static Rlist *GetHostsFromLastseenDB(Ite
      Item *ip;
      time_t now = time(NULL);
      double entrytime;
@@ -589,11 +589,11 @@ index f4d5db0f8356..b88e6f20b0a2 100644
  
      for (ip = addresses; ip != NULL; ip = ip->next)
      {
-diff --git a/libpromises/expand.c b/libpromises/expand.c
-index 7235930f41bf..62de3e091f2a 100644
---- a/libpromises/expand.c
-+++ b/libpromises/expand.c
-@@ -870,7 +870,7 @@ static void ResolveControlBody(EvalContext *ctx, GenericAgentConfig *config,
+Index: cfengine-3.12.1/libpromises/expand.c
+===================================================================
+--- cfengine-3.12.1.orig/libpromises/expand.c
++++ cfengine-3.12.1/libpromises/expand.c
+@@ -870,7 +870,7 @@ static void ResolveControlBody(EvalConte
  
              EvalContextVariableRemoveSpecial(ctx, SPECIAL_SCOPE_SYS, "domain");
              EvalContextVariableRemoveSpecial(ctx, SPECIAL_SCOPE_SYS, "fqhost");
@@ -602,10 +602,10 @@ index 7235930f41bf..62de3e091f2a 100644
              EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "fqhost",
                                            VFQNAME, CF_DATA_TYPE_STRING,
                                            "inventory,source=agent,attribute_name=Host name");
-diff --git a/libpromises/keyring.c b/libpromises/keyring.c
-index d6cbdfa51aba..134bd165adf8 100644
---- a/libpromises/keyring.c
-+++ b/libpromises/keyring.c
+Index: cfengine-3.12.1/libpromises/keyring.c
+===================================================================
+--- cfengine-3.12.1.orig/libpromises/keyring.c
++++ cfengine-3.12.1/libpromises/keyring.c
 @@ -83,9 +83,9 @@ int RemovePublicKey(const char *id)
  
          if (c && c[strlen(suffix)] == '\0')     /* dirp->d_name ends with suffix */
@@ -618,23 +618,22 @@ index d6cbdfa51aba..134bd165adf8 100644
              MapName(keyfilename);
  
              if (unlink(keyfilename) < 0)
-diff --git a/libpromises/syslog_client.c b/libpromises/syslog_client.c
-index 3109997436a1..d19572b6f970 100644
---- a/libpromises/syslog_client.c
-+++ b/libpromises/syslog_client.c
-@@ -111,7 +111,7 @@ void RemoteSysLog(int log_priority, const char *log_string)
-             char message[rfc3164_len];
+Index: cfengine-3.12.1/libpromises/syslog_client.c
+===================================================================
+--- cfengine-3.12.1.orig/libpromises/syslog_client.c
++++ cfengine-3.12.1/libpromises/syslog_client.c
+@@ -112,6 +112,7 @@ void RemoteSysLog(int log_priority, cons
              char timebuffer[26];
              pid_t pid = getpid();
--
+ 
 +            // rfc3164_len is WAY too small
-             snprintf(message, sizeof(message), "<%i>%.15s %s %s[%d]: %s",
-                      log_priority | SYSLOG_FACILITY,
-                      cf_strtimestamp_local(now, timebuffer) + 4,
-diff --git a/tests/unit/logging_test.c b/tests/unit/logging_test.c
-index e625e2b8c945..dc6ee2451a88 100644
---- a/tests/unit/logging_test.c
-+++ b/tests/unit/logging_test.c
+             snprintf(
+                 message,
+                 sizeof(message),
+Index: cfengine-3.12.1/tests/unit/logging_test.c
+===================================================================
+--- cfengine-3.12.1.orig/tests/unit/logging_test.c
++++ cfengine-3.12.1/tests/unit/logging_test.c
 @@ -6,7 +6,7 @@
  #include <syslog_client.h>
  #include <string_lib.h>
@@ -644,10 +643,10 @@ index e625e2b8c945..dc6ee2451a88 100644
  char VPREFIX[CF_MAXVARSIZE];
  
  static struct sockaddr *got_address;
-diff --git a/tests/unit/set_domainname_test.c b/tests/unit/set_domainname_test.c
-index 7096109e8991..933d17d0d518 100644
---- a/tests/unit/set_domainname_test.c
-+++ b/tests/unit/set_domainname_test.c
+Index: cfengine-3.12.1/tests/unit/set_domainname_test.c
+===================================================================
+--- cfengine-3.12.1.orig/tests/unit/set_domainname_test.c
++++ cfengine-3.12.1/tests/unit/set_domainname_test.c
 @@ -9,7 +9,7 @@
  
  /* Global variables we care about */
@@ -657,6 +656,3 @@ index 7096109e8991..933d17d0d518 100644
  char VUQNAME[CF_MAXVARSIZE];
  char VDOMAIN[CF_MAXVARSIZE];
  
--- 
-2.17.1
-
diff --git a/cfengine-3.12.1.tar.gz b/cfengine-3.12.1.tar.gz
new file mode 100644
index 0000000..1d60be1
--- /dev/null
+++ b/cfengine-3.12.1.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:20bd406bbf79b0939e4232a9ff385443d7d286f36f8c9a8e54e18b7ad0797829
+size 2487248
diff --git a/cfengine.changes b/cfengine.changes
index 4ef8319..c632f35 100644
--- a/cfengine.changes
+++ b/cfengine.changes
@@ -1,3 +1,50 @@
+-------------------------------------------------------------------
+Fri Mar  8 12:51:04 UTC 2019 - Adam Majer <adam.majer@suse.de>
+
+- Update to 3.12.1 (LTS)
+  - Added a new binary: cf-check
+    + Corrupt local databases (LMDB) continues to be a problem.
+    cf-check will be used to diagnose and remediate problems
+    with corrupt databases. It is a standalone binary, which
+    doesn't evaluate policy or use the local databases, thus
+    it can be used in situations where the other binaries
+    like cf-agent would hang.
+    + cf-check replaces our lmdb database dumper, lmdump.
+    + `cf-check lmdump` or symlinking / renaming it to lmdump
+    will make cf-check have the exact same behavior as lmdump.
+    cf-check will include much more functionality in the future
+    and some of the code will be added to other binaries,
+    for example to do health checks of databases on startup.
+    Ticket: (ENT-4064)
+  - Class names set by module protocol are automatically canonified
+    (CFE-2877, CFE-2887)
+  - Correct log level for data_readstringarray* (CFE-2922)
+  - Eliminated error messages caused by attempting to kill expired processes
+    (CFE-2824)
+  - Fix cf-runalerts systemd unit conditions so the service will run
+    (ENT-3929)
+  - Fix the off-by-one error in cf-runagent background process spawning
+    (CFE-2873)
+  - Fixed a memory leak which occurred when reloading RSA keys from disk
+  - Fixed a memory leak which occurred while loading augments files
+    (CFE-2913)
+  - Fixed an issue while parsing ps output on AIX (ENT-4295)
+  - Fixed an issue with splay time in cf-execd (CFE-2931)
+  - Fixed error handling and memory leak in cf-key (CFE-2918)
+  - Fixed memory leak in lmdb cleanup (CFE-2918)
+  - Fixed memory leaks in cf-agent during bootstrap (CFE-2918)
+  - Fixed memory leaks in variablesmatching() and findfiles() (CFE-2918)
+  - Fixed missing class with mustache templates in warn_only mode (CFE-2600)
+  - Fixed small memory leak in cf-serverd (CFE-2918)
+  - Fixed valgrind warning about lmdb writing uninitialized memory (CFE-2591)
+  - Read mustache-rendered files in text mode when comparing digest (ENT-2526)
+  - Reload persistent classes on config reload in cf-execd and cf-serverd
+    (CFE-2857)
+  - Started using custom cleanup function instead of atexit due to race
+    condition with unloading DLLs on Windows (ENT-3756)
+
+- 0003-Reduce-string-truncation-warnings.patch: refreshed
+
 -------------------------------------------------------------------
 Wed Jul 25 07:29:51 UTC 2018 - aeszter@gwdg.de
 
diff --git a/cfengine.spec b/cfengine.spec
index 5a6fc65..54ad4ad 100644
--- a/cfengine.spec
+++ b/cfengine.spec
@@ -1,7 +1,7 @@
 #
 # spec file for package cfengine
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,8 +16,6 @@
 #
 
 
-%define srcversion 3.12.0
-%define srcname core-%{srcversion}
 %define libname   libpromises
 %define libsoname %{libname}3
 # Yes, its not FHS conformant but in sync with cfengine documentation
@@ -34,16 +32,16 @@
 %bcond_with postgresql
 %bcond_with libvirt
 Name:           cfengine
-Version:        %{srcversion}
+Version:        3.12.1
 Release:        0
 # This is the place where workdir should be
-#define         basedir   /var/lib/%{name}
-#define         workdir   %{basedir}/work
+#define         basedir   /var/lib/%%{name}
+#define         workdir   %%{basedir}/work
 Summary:        Configuration management framework
 License:        GPL-3.0-only
 Group:          Productivity/Networking/System
 Url:            http://www.cfengine.org/
-Source:         %{srcname}.tar.gz
+Source:         https://cfengine-package-repos.s3.amazonaws.com/tarballs/cfengine-%{version}.tar.gz
 Source1:        %{name}.SuSEfirewall2
 Source2:        cf-execd.service
 Source3:        cf-monitord.service
@@ -169,7 +167,7 @@ Group:          Documentation/Other
 Lots of example promises for CFEngine.
 
 %prep
-%setup -q -n %{srcname}
+%setup -q
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
@@ -348,6 +346,7 @@ fi
 %doc ChangeLog README.md
 %license LICENSE
 %{_bindir}/cf-agent
+%{_bindir}/cf-check
 %{_bindir}/cf-execd
 %{_bindir}/cf-key
 %{_bindir}/cf-net
diff --git a/core-3.12.0.tar.gz b/core-3.12.0.tar.gz
deleted file mode 100644
index 6010380..0000000
--- a/core-3.12.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f93e2f112063a7d5b9e2ee197e46d6dac0414cca66bf2726c05f9dd3fa8f1970
-size 2127099