Klaus Kämpf
2019-12-16 13:49:02 +00:00
committed by Git OBS Bridge
parent 6b40094f8e
commit 30ad6c641f
8 changed files with 181 additions and 264 deletions

View File

@@ -1,49 +0,0 @@
From 7f0daf6cd3b6018c882c553ce0a3da51d47fec83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Thu, 30 Jul 2015 10:48:47 +0200
Subject: [PATCH 1/3] Set sys.bindir to /usr/sbin, expect cf-*components there
That's where the /var/cfengine/bin/* symlinks point to and where
the systemd .service files expect the daemons.
This path is used in 'processes' of
masterfiles/update/update_processes.cf:enable_cfengine_agents
---
libenv/sysinfo.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/libenv/sysinfo.c b/libenv/sysinfo.c
index 5447659da5e1..5715d9acc7b7 100644
--- a/libenv/sysinfo.c
+++ b/libenv/sysinfo.c
@@ -589,8 +589,7 @@ static void GetNameInfo3(EvalContext *ctx)
EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "masterdir", GetMasterDir(), CF_DATA_TYPE_STRING, "source=agent");
EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "inputdir", GetInputDir(), CF_DATA_TYPE_STRING, "source=agent");
- snprintf(workbuf, CF_BUFSIZE, "%s%cbin", workdir, FILE_SEPARATOR);
- EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "bindir", workbuf, CF_DATA_TYPE_STRING, "source=agent");
+ EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "bindir", "/usr/bin", CF_DATA_TYPE_STRING, "source=agent");
snprintf(workbuf, CF_BUFSIZE, "%s%cfailsafe.cf", GetInputDir(), FILE_SEPARATOR);
EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "failsafe_policy_path", workbuf, CF_DATA_TYPE_STRING, "source=agent");
@@ -635,7 +634,7 @@ static void GetNameInfo3(EvalContext *ctx)
components[i]);
}
#else
- snprintf(name, CF_MAXVARSIZE - 1, "%s%cbin%c%s", workdir, FILE_SEPARATOR, FILE_SEPARATOR, components[i]);
+ snprintf(name, CF_MAXVARSIZE - 1, "/usr/bin/%s", components[i]);
#endif
have_component[i] = false;
@@ -660,7 +659,7 @@ static void GetNameInfo3(EvalContext *ctx)
snprintf(name, CF_MAXVARSIZE - 1, "%s%cbin%c%s.exe", workdir, FILE_SEPARATOR, FILE_SEPARATOR,
components[1]);
#else
- snprintf(name, CF_MAXVARSIZE - 1, "%s%cbin%c%s", workdir, FILE_SEPARATOR, FILE_SEPARATOR, components[1]);
+ snprintf(name, CF_MAXVARSIZE - 1, "/usr/bin/%s", components[1]);
#endif
if (stat(name, &sb) != -1)
--
2.17.1

View File

@@ -1,7 +1,7 @@
From 35f37177192c77c66634346db354140b3c494dd0 Mon Sep 17 00:00:00 2001
From 00f764ed46713ea95a26836404b93aa6df899b59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Fri, 11 Apr 2014 09:25:05 +0200
Subject: [PATCH 2/3] Simplify and fix parsing of /etc/SuSE-release (fixes
Subject: [PATCH 1/3] Simplify and fix parsing of /etc/SuSE-release (fixes
issue #5423)
This patch is a simplification of sysinfo.c:Linux_Suse_Version()
@@ -17,10 +17,10 @@ to achieve the following
1 file changed, 60 insertions(+), 127 deletions(-)
diff --git a/libenv/sysinfo.c b/libenv/sysinfo.c
index 5715d9acc7b7..29b82b36807b 100644
index 8a3d4f05174f..a6b1618c6a70 100644
--- a/libenv/sysinfo.c
+++ b/libenv/sysinfo.c
@@ -1954,6 +1954,7 @@ static int Linux_Suse_Version(EvalContext *ctx)
@@ -1963,6 +1963,7 @@ static int Linux_Suse_Version(EvalContext *ctx)
#define SUSE_RELEASE_FLAG "linux "
char classbuf[CF_MAXVARSIZE];
@@ -28,7 +28,7 @@ index 5715d9acc7b7..29b82b36807b 100644
Log(LOG_LEVEL_VERBOSE, "This appears to be a SUSE system.");
EvalContextClassPutHard(ctx, "SUSE", "inventory,attribute_name=none,source=agent");
@@ -1973,23 +1974,26 @@ static int Linux_Suse_Version(EvalContext *ctx)
@@ -1982,23 +1983,26 @@ static int Linux_Suse_Version(EvalContext *ctx)
return 1;
}
@@ -62,7 +62,7 @@ index 5715d9acc7b7..29b82b36807b 100644
}
}
if (ferror(fp))
@@ -2003,28 +2007,38 @@ static int Linux_Suse_Version(EvalContext *ctx)
@@ -2012,28 +2016,38 @@ static int Linux_Suse_Version(EvalContext *ctx)
fclose(fp);
@@ -117,7 +117,7 @@ index 5715d9acc7b7..29b82b36807b 100644
{
Item *list, *ip;
@@ -2042,120 +2056,39 @@ static int Linux_Suse_Version(EvalContext *ctx)
@@ -2051,120 +2065,39 @@ static int Linux_Suse_Version(EvalContext *ctx)
}
else
{
@@ -262,5 +262,5 @@ index 5715d9acc7b7..29b82b36807b 100644
}
--
2.17.1
2.24.0

View File

@@ -1,46 +1,45 @@
From be9783fd1ba5f5150fef1c95349192271942a478 Mon Sep 17 00:00:00 2001
From 5c454a3ac32943ddd867cd0955bead955f38fd6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Tue, 3 Jul 2018 09:18:08 +0200
Subject: [PATCH 3/3] Reduce string truncation warnings
Subject: [PATCH 2/3] Reduce string truncation warnings
---
cf-agent/verify_databases.c | 18 ++++++-------
cf-agent/verify_exec.c | 4 +--
cf-agent/verify_databases.c | 18 +++++++-------
cf-agent/verify_exec.c | 4 ++--
cf-agent/verify_packages.c | 2 +-
cf-execd/cf-execd-runner.c | 4 +--
cf-monitord/env_monitor.c | 8 +++---
cf-execd/cf-execd-runner.c | 4 ++--
cf-monitord/env_monitor.c | 8 +++----
cf-monitord/mon_network_sniffer.c | 6 ++---
cf-runagent/cf-runagent.c | 6 ++---
cf-serverd/server_common.c | 18 ++++++-------
cf-serverd/server_common.c | 18 +++++++-------
libcfnet/client_protocol.c | 2 +-
libenv/sysinfo.c | 45 ++++++++++++++++---------------
libenv/sysinfo.c | 40 +++++++++++++++----------------
libpromises/cf3globals.c | 2 +-
libpromises/cf3lex.l | 6 ++---
libpromises/cf3parse.y | 2 +-
libpromises/eval_context.c | 4 +--
libpromises/eval_context.c | 4 ++--
libpromises/evalfunction.c | 2 +-
libpromises/expand.c | 2 +-
libpromises/keyring.c | 4 +--
libpromises/syslog_client.c | 2 +-
libpromises/keyring.c | 4 ++--
tests/unit/logging_test.c | 2 +-
tests/unit/set_domainname_test.c | 2 +-
20 files changed, 71 insertions(+), 70 deletions(-)
19 files changed, 66 insertions(+), 68 deletions(-)
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
diff --git a/cf-agent/verify_databases.c b/cf-agent/verify_databases.c
index be8ed98bbc15..c55da6a890d5 100644
--- a/cf-agent/verify_databases.c
+++ b/cf-agent/verify_databases.c
@@ -221,7 +221,7 @@ static PromiseResult VerifySQLPromise(EvalContext *ctx, const Attributes *a, con
}
else
{
- snprintf(query, CF_MAXVARSIZE - 1, "%s.%s", database, table);
+ snprintf(query, sizeof(query) - 1, "%s.%s", database, table);
if (VerifyTablePromise(ctx, &cfdb, query, a.database.columns, a, pp, &result))
if (VerifyTablePromise(ctx, &cfdb, query, a->database.columns, a, pp, &result))
{
@@ -300,7 +300,7 @@ static int VerifyDatabasePromise(CfdbCon
if (((a.transaction.action) != cfa_warn) && (!DONTDO))
@@ -301,7 +301,7 @@ static int VerifyDatabasePromise(CfdbConn *cfdb, char *database, const Attribute
if (((a->transaction.action) != cfa_warn) && (!DONTDO))
{
Log(LOG_LEVEL_VERBOSE, "Attempting to delete the database '%s'", database);
- snprintf(query, CF_MAXVARSIZE - 1, "drop database %s", database);
@@ -48,8 +47,8 @@ Index: cfengine-3.12.1/cf-agent/verify_databases.c
CfVoidQueryDB(cfdb, query);
return cfdb->result;
}
@@ -316,7 +316,7 @@ static int VerifyDatabasePromise(CfdbCon
if (((a.transaction.action) != cfa_warn) && (!DONTDO))
@@ -317,7 +317,7 @@ static int VerifyDatabasePromise(CfdbConn *cfdb, char *database, const Attribute
if (((a->transaction.action) != cfa_warn) && (!DONTDO))
{
Log(LOG_LEVEL_VERBOSE, "Attempting to create the database '%s'", database);
- snprintf(query, CF_MAXVARSIZE - 1, "create database %s", database);
@@ -57,16 +56,16 @@ Index: cfengine-3.12.1/cf-agent/verify_databases.c
CfVoidQueryDB(cfdb, query);
return cfdb->result;
}
@@ -499,7 +499,7 @@ static int ValidateRegistryPromiser(char
static int VerifyTablePromise(EvalContext *ctx, CfdbConn *cfdb, char *table_path, Rlist *columns, Attributes a,
@@ -506,7 +506,7 @@ static bool VerifyTablePromise(EvalContext *ctx, CfdbConn *cfdb, char *table_pat
const Promise *pp, PromiseResult *result)
{
assert(a != NULL);
- char name[CF_MAXVARSIZE], type[CF_MAXVARSIZE], query[CF_MAXVARSIZE], table[CF_MAXVARSIZE], db[CF_MAXVARSIZE];
+ char name[CF_MAXVARSIZE], type[CF_MAXVARSIZE], query[CF_BUFSIZE], table[CF_MAXVARSIZE], db[CF_MAXVARSIZE];
int i, count, size, no_of_cols, *size_table, *done, identified, retval = true;
int i, count, size, no_of_cols, *size_table, *done, identified;
bool retval = true;
char **name_table, **type_table;
@@ -670,12 +670,12 @@ static int VerifyTablePromise(EvalContex
@@ -678,12 +678,12 @@ static bool VerifyTablePromise(EvalContext *ctx, CfdbConn *cfdb, char *table_pat
{
if (size_table[i] > 0)
{
@@ -81,7 +80,7 @@ Index: cfengine-3.12.1/cf-agent/verify_databases.c
type_table[i]);
}
@@ -742,7 +742,7 @@ static int CreateTableColumns(CfdbConn *
@@ -750,7 +750,7 @@ static bool CreateTableColumns(CfdbConn *cfdb, char *table, Rlist *columns)
if (no_of_cols > 0)
{
@@ -90,7 +89,7 @@ Index: cfengine-3.12.1/cf-agent/verify_databases.c
for (i = 0; i < no_of_cols; i++)
{
@@ -781,7 +781,7 @@ static int CreateTableColumns(CfdbConn *
@@ -789,7 +789,7 @@ static bool CreateTableColumns(CfdbConn *cfdb, char *table, Rlist *columns)
static Rlist *GetSQLTables(CfdbConn *cfdb)
{
Rlist *list = NULL;
@@ -99,21 +98,21 @@ Index: cfengine-3.12.1/cf-agent/verify_databases.c
ListTables(cfdb->type, query);
@@ -870,7 +870,7 @@ static int ValidateSQLTableName(char *ta
@@ -878,7 +878,7 @@ static bool ValidateSQLTableName(char *table_path, char *db, char *table)
static void QueryTableColumns(char *s, char *db, char *table)
{
- snprintf(s, CF_MAXVARSIZE - 1,
+ snprintf(s, CF_BUFSIZE - 1,
"SELECT column_name,data_type,character_maximum_length FROM information_schema.columns WHERE table_name ='%s' AND table_schema = '%s'",
"SELECT column_name,data_type,character_maximum_length FROM information_schema->columns WHERE table_name ='%s' AND table_schema = '%s'",
table, db);
}
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,
diff --git a/cf-agent/verify_exec.c b/cf-agent/verify_exec.c
index fae286563eb3..941645aee991 100644
--- a/cf-agent/verify_exec.c
+++ b/cf-agent/verify_exec.c
@@ -207,7 +207,7 @@ static char *GetLockNameExec(const Attributes *a, const Promise *pp)
static ActionResult RepairExec(EvalContext *ctx, const Attributes *a,
const Promise *pp, PromiseResult *result)
{
- char eventname[CF_BUFSIZE];
@@ -121,7 +120,7 @@ Index: cfengine-3.12.1/cf-agent/verify_exec.c
char cmdline[CF_BUFSIZE];
char comm[20];
int outsourced, count = 0;
@@ -456,7 +456,7 @@ static ActionResult RepairExec(EvalConte
@@ -460,7 +460,7 @@ static ActionResult RepairExec(EvalContext *ctx, const Attributes *a,
umask(maskval);
#endif
@@ -129,12 +128,12 @@ Index: cfengine-3.12.1/cf-agent/verify_exec.c
+ snprintf(eventname, CF_BUFSIZE*2 - 1, "Exec(%s)", cmdline);
#ifndef __MINGW32__
if ((a.transaction.background) && outsourced)
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
if ((a->transaction.background) && outsourced)
diff --git a/cf-agent/verify_packages.c b/cf-agent/verify_packages.c
index c3ffded995f0..e291858a71e9 100644
--- a/cf-agent/verify_packages.c
+++ b/cf-agent/verify_packages.c
@@ -3233,7 +3233,7 @@ static void DeletePackageManagers(PackageManager *np)
const char *PrefixLocalRepository(const Rlist *repositories, const char *package)
{
@@ -143,10 +142,10 @@ Index: cfengine-3.12.1/cf-agent/verify_packages.c
struct stat sb;
char path[CF_BUFSIZE];
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
diff --git a/cf-execd/cf-execd-runner.c b/cf-execd/cf-execd-runner.c
index 1e743b4d09da..dfde122ba84c 100644
--- a/cf-execd/cf-execd-runner.c
+++ b/cf-execd/cf-execd-runner.c
@@ -195,7 +195,7 @@ void LocalExec(const ExecConfig *config)
strlcpy(esc_command, MapName(cmd), CF_BUFSIZE);
@@ -165,11 +164,11 @@ Index: cfengine-3.12.1/cf-execd/cf-execd-runner.c
GetWorkDir(), canonified_fq_name, line, thread_name);
MapName(filename);
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
diff --git a/cf-monitord/env_monitor.c b/cf-monitord/env_monitor.c
index 472e4c2c3d3e..866aa18dacec 100644
--- a/cf-monitord/env_monitor.c
+++ b/cf-monitord/env_monitor.c
@@ -938,7 +938,7 @@ static double SetClasses(EvalContext *ctx, char *name, double variable, double a
{
Log(LOG_LEVEL_DEBUG, "No sigma variation .. can't measure class");
@@ -178,7 +177,7 @@ Index: cfengine-3.12.1/cf-monitord/env_monitor.c
MonEntropyPurgeUnused(buffer);
return sig;
@@ -1051,13 +1051,13 @@ static void SetVariable(char *name, doub
@@ -1046,13 +1046,13 @@ static void SetVariable(char *name, double value, double average, double stddev,
{
char var[CF_BUFSIZE];
@@ -195,11 +194,11 @@ Index: cfengine-3.12.1/cf-monitord/env_monitor.c
AppendItem(classlist, var, "");
}
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
diff --git a/cf-monitord/mon_network_sniffer.c b/cf-monitord/mon_network_sniffer.c
index 4ec8f3c79124..7466d94fcb70 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)
static void AnalyzeArrival(Item *ip_addresses, long iteration, char *arrival, double *cf_this)
{
@@ -208,7 +207,7 @@ Index: cfengine-3.12.1/cf-monitord/mon_network_sniffer.c
int isme_dest, isme_src;
src[0] = dest[0] = '\0';
@@ -387,11 +387,11 @@ static void AnalyzeArrival(Item *ip_addr
@@ -399,11 +399,11 @@ static void AnalyzeArrival(Item *ip_addresses, long iteration, char *arrival, do
if (strstr(arrival, ".138"))
{
@@ -222,11 +221,11 @@ Index: cfengine-3.12.1/cf-monitord/mon_network_sniffer.c
}
else
{
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
diff --git a/cf-runagent/cf-runagent.c b/cf-runagent/cf-runagent.c
index 6c546acd55e2..5e9b74d5d3e9 100644
--- a/cf-runagent/cf-runagent.c
+++ b/cf-runagent/cf-runagent.c
@@ -796,15 +796,15 @@ static void HailExec(AgentConnection *conn, char *peer)
static FILE *NewStream(char *name)
{
FILE *fp;
@@ -245,11 +244,11 @@ Index: cfengine-3.12.1/cf-runagent/cf-runagent.c
GetWorkDir(), FILE_SEPARATOR, FILE_SEPARATOR, name);
}
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
diff --git a/cf-serverd/server_common.c b/cf-serverd/server_common.c
index 77ac6c4dfd43..31d71ab4a742 100644
--- a/cf-serverd/server_common.c
+++ b/cf-serverd/server_common.c
@@ -372,8 +372,8 @@ static void AbortTransfer(ConnectionInfo *connection, char *filename)
{
Log(LOG_LEVEL_VERBOSE, "Aborting transfer of file due to source changes");
@@ -260,7 +259,7 @@ Index: cfengine-3.12.1/cf-serverd/server_common.c
CF_CHANGEDSTR1, CF_CHANGEDSTR2, filename);
if (SendTransaction(connection, sendbuffer, 0, CF_DONE) == -1)
@@ -385,9 +385,9 @@ static void FailedTransfer(ConnectionInf
@@ -387,9 +387,9 @@ static void FailedTransfer(ConnectionInfo *connection)
{
Log(LOG_LEVEL_VERBOSE, "Transfer failure");
@@ -272,7 +271,7 @@ Index: cfengine-3.12.1/cf-serverd/server_common.c
if (SendTransaction(connection, sendbuffer, 0, CF_DONE) == -1)
{
@@ -419,7 +419,7 @@ void CfGetFile(ServerFileGetState *args)
@@ -421,7 +421,7 @@ void CfGetFile(ServerFileGetState *args)
{
Log(LOG_LEVEL_INFO, "REFUSE access to file: %s", filename);
RefuseAccess(args->conn, args->replyfile);
@@ -281,7 +280,7 @@ Index: cfengine-3.12.1/cf-serverd/server_common.c
if (ConnectionInfoProtocolVersion(conn_info) == CF_PROTOCOL_CLASSIC)
{
SendSocketStream(ConnectionInfoSocket(conn_info), sendbuffer, args->buf_size);
@@ -437,7 +437,7 @@ void CfGetFile(ServerFileGetState *args)
@@ -439,7 +439,7 @@ void CfGetFile(ServerFileGetState *args)
{
Log(LOG_LEVEL_ERR, "Open error of file '%s'. (open: %s)",
filename, GetErrorStr());
@@ -290,7 +289,7 @@ Index: cfengine-3.12.1/cf-serverd/server_common.c
if (ConnectionInfoProtocolVersion(conn_info) == CF_PROTOCOL_CLASSIC)
{
SendSocketStream(ConnectionInfoSocket(conn_info), sendbuffer, args->buf_size);
@@ -458,7 +458,7 @@ void CfGetFile(ServerFileGetState *args)
@@ -460,7 +460,7 @@ void CfGetFile(ServerFileGetState *args)
while (true)
{
@@ -299,7 +298,7 @@ Index: cfengine-3.12.1/cf-serverd/server_common.c
Log(LOG_LEVEL_DEBUG, "Now reading from disk...");
@@ -490,7 +490,7 @@ void CfGetFile(ServerFileGetState *args)
@@ -492,7 +492,7 @@ void CfGetFile(ServerFileGetState *args)
if (sb.st_size != savedlen)
{
@@ -308,7 +307,7 @@ Index: cfengine-3.12.1/cf-serverd/server_common.c
if (ConnectionInfoProtocolVersion(conn_info) == CF_PROTOCOL_CLASSIC)
{
@@ -606,7 +606,7 @@ void CfEncryptGetFile(ServerFileGetState
@@ -608,7 +608,7 @@ void CfEncryptGetFile(ServerFileGetState *args)
while (true)
{
@@ -317,24 +316,24 @@ Index: cfengine-3.12.1/cf-serverd/server_common.c
if ((n_read = read(fd, sendbuffer, blocksize)) == -1)
{
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
diff --git a/libcfnet/client_protocol.c b/libcfnet/client_protocol.c
index 2f4668882f6a..54cfda95e4d3 100644
--- a/libcfnet/client_protocol.c
+++ b/libcfnet/client_protocol.c
@@ -63,7 +63,7 @@ void SetSkipIdentify(bool enabled)
int IdentifyAgent(ConnectionInfo *conn_info)
bool IdentifyAgent(ConnectionInfo *conn_info)
{
- char uname[CF_BUFSIZE], sendbuff[CF_BUFSIZE];
+ char uname[CF_MAXVARSIZE], sendbuff[CF_BUFSIZE];
char dnsname[CF_MAXVARSIZE], localip[CF_MAX_IP_LEN];
int ret;
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
diff --git a/libenv/sysinfo.c b/libenv/sysinfo.c
index a6b1618c6a70..20c92996eed7 100644
--- a/libenv/sysinfo.c
+++ b/libenv/sysinfo.c
@@ -444,7 +444,7 @@ static void GetNameInfo3(EvalContext *ctx)
};
int have_component[COMPONENTS_SIZE];
struct stat sb;
@@ -343,7 +342,7 @@ Index: cfengine-3.12.1/libenv/sysinfo.c
if (uname(&VSYSNAME) == -1)
{
@@ -2064,7 +2064,7 @@ static int Linux_Suse_Version(EvalContex
@@ -2073,7 +2073,7 @@ static int Linux_Suse_Version(EvalContext *ctx)
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 +351,7 @@ Index: cfengine-3.12.1/libenv/sysinfo.c
if (minor != -1)
{
snprintf(classbuf + strlen(classbuf), CF_MAXVARSIZE - strlen(classbuf), "_%d", minor);
@@ -2177,7 +2177,7 @@ static void LinuxDebianSanitizeIssue(cha
@@ -2186,7 +2186,7 @@ static void LinuxDebianSanitizeIssue(char *buffer)
static int Linux_Misc_Version(EvalContext *ctx)
{
@@ -361,7 +360,7 @@ Index: cfengine-3.12.1/libenv/sysinfo.c
char version[CF_MAXVARSIZE];
char os[CF_MAXVARSIZE];
char buffer[CF_BUFSIZE];
@@ -2218,7 +2218,7 @@ static int Linux_Misc_Version(EvalContex
@@ -2227,7 +2227,7 @@ static int Linux_Misc_Version(EvalContext *ctx)
if (*os && *version)
{
@@ -370,7 +369,7 @@ Index: cfengine-3.12.1/libenv/sysinfo.c
SetFlavor(ctx, flavor);
return 1;
}
@@ -2233,7 +2233,7 @@ static int Linux_Debian_Version(EvalCont
@@ -2242,7 +2242,7 @@ static int Linux_Debian_Version(EvalContext *ctx)
int major = -1;
int release = -1;
int result;
@@ -378,18 +377,8 @@ Index: cfengine-3.12.1/libenv/sysinfo.c
+ char classname[CF_BUFSIZE], buffer[CF_BUFSIZE], os[CF_MAXVARSIZE], version[CF_MAXVARSIZE];
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(EvalCont
{
case 2:
Log(LOG_LEVEL_VERBOSE, "This appears to be a Debian %u.%u system.", major, release);
- snprintf(classname, CF_MAXVARSIZE, "debian_%u_%u", major, release);
+ snprintf(classname, CF_BUFSIZE, "debian_%u_%u", major, release);
EvalContextClassPutHard(ctx, classname, "inventory,attribute_name=none,source=agent");
- snprintf(classname, CF_MAXVARSIZE, "debian_%u", major);
+ snprintf(classname, CF_BUFSIZE, "debian_%u", major);
SetFlavor(ctx, classname);
break;
EvalContextClassPutHard(
@@ -2276,7 +2276,7 @@ static int Linux_Debian_Version(EvalContext *ctx)
case 1:
Log(LOG_LEVEL_VERBOSE, "This appears to be a Debian %u system.", major);
@@ -398,40 +387,21 @@ Index: cfengine-3.12.1/libenv/sysinfo.c
SetFlavor(ctx, classname);
break;
@@ -2270,7 +2270,7 @@ static int Linux_Debian_Version(EvalCont
@@ -2285,11 +2285,8 @@ static int Linux_Debian_Version(EvalContext *ctx)
sscanf(buffer, "%25[^/]", version);
if (strlen(version) > 0)
{
- snprintf(classname, CF_MAXVARSIZE, "debian_%s", version);
- EvalContextClassPutHard(
- ctx,
- classname,
- "inventory,attribute_name=none,source=agent,derived-from-file="DEBIAN_VERSION_FILENAME);
+ snprintf(classname, CF_BUFSIZE, "debian_%s", version);
EvalContextClassPutHard(ctx, classname, "inventory,attribute_name=none,source=agent");
+ EvalContextClassPutHard(ctx, classname, "inventory,attribute_name=none,source=agent");
}
break;
@@ -2288,7 +2288,7 @@ static int Linux_Debian_Version(EvalCont
{
LinuxDebianSanitizeIssue(buffer);
sscanf(buffer, "%*s %*s %[^./]", version);
- snprintf(buffer, CF_MAXVARSIZE, "debian_%s", version);
+ snprintf(buffer, CF_BUFSIZE, "debian_%s", version);
EvalContextClassPutHard(ctx, "debian", "inventory,attribute_name=none,source=agent");
SetFlavor(ctx, buffer);
}
@@ -2296,12 +2296,12 @@ static int Linux_Debian_Version(EvalCont
{
LinuxDebianSanitizeIssue(buffer);
sscanf(buffer, "%*s %[^.].%d", version, &release);
- snprintf(buffer, CF_MAXVARSIZE, "ubuntu_%s", version);
+ snprintf(buffer, CF_BUFSIZE, "ubuntu_%s", version);
SetFlavor(ctx, buffer);
EvalContextClassPutHard(ctx, "ubuntu", "inventory,attribute_name=none,source=agent");
if (release >= 0)
{
- snprintf(buffer, CF_MAXVARSIZE, "ubuntu_%s_%d", version, release);
+ snprintf(buffer, CF_BUFSIZE, "ubuntu_%s_%d", version, release);
EvalContextClassPutHard(ctx, buffer, "inventory,attribute_name=none,source=agent");
}
}
@@ -2515,13 +2515,13 @@ static int EOS_Version(EvalContext *ctx)
@@ -2543,13 +2540,13 @@ static int EOS_Version(EvalContext *ctx)
{
if (strstr(buffer, "EOS"))
{
@@ -447,7 +417,7 @@ Index: cfengine-3.12.1/libenv/sysinfo.c
EvalContextClassPutHard(ctx, class, "inventory,attribute_name=none,source=agent");
}
}
@@ -2541,14 +2541,14 @@ static int MiscOS(EvalContext *ctx)
@@ -2569,14 +2566,14 @@ static int MiscOS(EvalContext *ctx)
{
if (strstr(buffer, "BIG-IP"))
{
@@ -465,7 +435,7 @@ Index: cfengine-3.12.1/libenv/sysinfo.c
EvalContextClassPutHard(ctx, class, "inventory,attribute_name=none,source=agent");
SetFlavor(ctx, "BIG-IP");
}
@@ -2561,7 +2561,8 @@ static int MiscOS(EvalContext *ctx)
@@ -2589,7 +2586,8 @@ static int MiscOS(EvalContext *ctx)
static int VM_Version(EvalContext *ctx)
{
@@ -475,7 +445,7 @@ Index: cfengine-3.12.1/libenv/sysinfo.c
int major, minor, bug;
int sufficient = 0;
@@ -2573,17 +2574,17 @@ static int VM_Version(EvalContext *ctx)
@@ -2601,17 +2599,17 @@ static int VM_Version(EvalContext *ctx)
{
if (sscanf(buffer, "VMware ESX Server %d.%d.%d", &major, &minor, &bug) > 0)
{
@@ -497,11 +467,11 @@ Index: cfengine-3.12.1/libenv/sysinfo.c
EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent");
sufficient = 1;
}
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
diff --git a/libpromises/cf3globals.c b/libpromises/cf3globals.c
index 7915affc07fc..932dd62456f9 100644
--- a/libpromises/cf3globals.c
+++ b/libpromises/cf3globals.c
@@ -55,7 +55,7 @@ long LASTSEENEXPIREAFTER = SECONDS_PER_WEEK; /* GLOBAL_P */
bool DONTDO = false; /* GLOBAL_A */
/* NB! Check use before changing sizes */
@@ -510,10 +480,10 @@ Index: cfengine-3.12.1/libpromises/cf3globals.c
char VUQNAME[CF_MAXVARSIZE] = ""; /* GLOBAL_E */
char VDOMAIN[CF_MAXVARSIZE] = ""; /* GLOBAL_E GLOBAL_P */
Index: cfengine-3.12.1/libpromises/cf3lex.l
===================================================================
--- cfengine-3.12.1.orig/libpromises/cf3lex.l
+++ cfengine-3.12.1/libpromises/cf3lex.l
diff --git a/libpromises/cf3lex.l b/libpromises/cf3lex.l
index c28c4302a74a..766fe3fd7896 100644
--- a/libpromises/cf3lex.l
+++ b/libpromises/cf3lex.l
@@ -334,7 +334,7 @@ promise_type [a-zA-Z_]+:
{
yyerror("identifier too long");
@@ -541,11 +511,11 @@ Index: cfengine-3.12.1/libpromises/cf3lex.l
if (P.currentclasses != NULL)
{
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
diff --git a/libpromises/cf3parse.y b/libpromises/cf3parse.y
index 9fea664a9874..5e5268d9f372 100644
--- a/libpromises/cf3parse.y
+++ b/libpromises/cf3parse.y
@@ -1142,7 +1142,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 +524,11 @@ Index: cfengine-3.12.1/libpromises/cf3parse.y
free(P.currentstring);
P.currentstring = NULL;
}
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
diff --git a/libpromises/eval_context.c b/libpromises/eval_context.c
index 7c7ffd069e3e..497ea48874c3 100644
--- a/libpromises/eval_context.c
+++ b/libpromises/eval_context.c
@@ -1571,7 +1571,7 @@ Class *EvalContextClassMatch(const EvalContext *ctx, const char *regex)
static bool EvalContextClassPut(EvalContext *ctx, const char *ns, const char *name, bool is_soft, ContextScope scope, const char *tags)
{
{
@@ -567,7 +537,7 @@ Index: cfengine-3.12.1/libpromises/eval_context.c
char canonified_context[CF_MAXVARSIZE];
@@ -1592,7 +1592,7 @@ static bool EvalContextClassPut(EvalCont
@@ -1594,7 +1594,7 @@ static bool EvalContextClassPut(EvalContext *ctx, const char *ns, const char *na
if (ns && strcmp(ns, "default") != 0)
{
@@ -576,11 +546,11 @@ Index: cfengine-3.12.1/libpromises/eval_context.c
}
else
{
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
diff --git a/libpromises/evalfunction.c b/libpromises/evalfunction.c
index 505a2e6d140b..6fb0f261fafc 100644
--- a/libpromises/evalfunction.c
+++ b/libpromises/evalfunction.c
@@ -496,7 +496,7 @@ static Rlist *GetHostsFromLastseenDB(Item *addresses, time_t horizon, bool retur
Item *ip;
time_t now = time(NULL);
double entrytime;
@@ -589,11 +559,11 @@ Index: cfengine-3.12.1/libpromises/evalfunction.c
for (ip = addresses; ip != NULL; ip = ip->next)
{
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
diff --git a/libpromises/expand.c b/libpromises/expand.c
index 37da303b189e..0494a3c1be29 100644
--- a/libpromises/expand.c
+++ b/libpromises/expand.c
@@ -870,7 +870,7 @@ static void ResolveControlBody(EvalContext *ctx, GenericAgentConfig *config,
EvalContextVariableRemoveSpecial(ctx, SPECIAL_SCOPE_SYS, "domain");
EvalContextVariableRemoveSpecial(ctx, SPECIAL_SCOPE_SYS, "fqhost");
@@ -602,10 +572,10 @@ Index: cfengine-3.12.1/libpromises/expand.c
EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "fqhost",
VFQNAME, CF_DATA_TYPE_STRING,
"inventory,source=agent,attribute_name=Host name");
Index: cfengine-3.12.1/libpromises/keyring.c
===================================================================
--- cfengine-3.12.1.orig/libpromises/keyring.c
+++ cfengine-3.12.1/libpromises/keyring.c
diff --git a/libpromises/keyring.c b/libpromises/keyring.c
index a8e4f2c8c640..55e52c28a358 100644
--- a/libpromises/keyring.c
+++ b/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,22 +588,10 @@ Index: cfengine-3.12.1/libpromises/keyring.c
MapName(keyfilename);
if (unlink(keyfilename) < 0)
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),
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
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
@@ -6,7 +6,7 @@
#include <syslog_client.h>
#include <string_lib.h>
@@ -643,10 +601,10 @@ Index: cfengine-3.12.1/tests/unit/logging_test.c
char VPREFIX[CF_MAXVARSIZE];
static struct sockaddr *got_address;
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
diff --git a/tests/unit/set_domainname_test.c b/tests/unit/set_domainname_test.c
index 55cd05c17463..87a9dace0d68 100644
--- a/tests/unit/set_domainname_test.c
+++ b/tests/unit/set_domainname_test.c
@@ -9,7 +9,7 @@
/* Global variables we care about */
@@ -656,3 +614,6 @@ Index: cfengine-3.12.1/tests/unit/set_domainname_test.c
char VUQNAME[CF_MAXVARSIZE];
char VDOMAIN[CF_MAXVARSIZE];
--
2.24.0

View File

@@ -1,27 +1,27 @@
From b5e4b0ca4384400cc8822ac06cdacbb97bc3c6e3 Mon Sep 17 00:00:00 2001
From 114297240e5a86235a13f654bd2905c27c777b4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Tue, 3 Jul 2018 09:38:39 +0200
Subject: [PATCH 4/4] make home dir for tests
Subject: [PATCH 3/3] make home dir for tests
Author: Adam Majer <adam.majer@suse.de>
Upstream: https://tracker.mender.io/browse/CFE-2549
BNC#1016848
Summary: this tests requires home directory, otherwise spams logfile
---
tests/load/run_lastseen_threaded_load.sh | 2 ++
1 file changed, 2 insertions(+)
tests/load/run_lastseen_threaded_load.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/load/run_lastseen_threaded_load.sh b/tests/load/run_lastseen_threaded_load.sh
index 7dc5bcae7c25..60ea99af0c55 100755
index aebcf21a913e..215379e9f416 100755
--- a/tests/load/run_lastseen_threaded_load.sh
+++ b/tests/load/run_lastseen_threaded_load.sh
@@ -6,4 +6,6 @@ then
exit 0;
@@ -7,5 +7,6 @@ then
fi
echo "Starting run_lastseen_threaded_load.sh test"
+text -x ~/.cfagent/state || mkdir -p ~/.cfagent/state
+
./lastseen_threaded_load -c 1 4 1 1
--
2.17.1
2.24.0

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:20bd406bbf79b0939e4232a9ff385443d7d286f36f8c9a8e54e18b7ad0797829
size 2487248

3
cfengine-3.14.0.2.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7e11ec3d188240d71725a24504c5b7680004481fe596d7d895c8bee364e75b6d
size 2231997

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Dec 16 13:25:37 UTC 2019 - Klaus Kämpf <kkaempf@suse.com>
- Update to 3.14.0.2 (upstream 3.14.0-2)
see https://github.com/cfengine/core/blob/3.14.0-2/ChangeLog
-------------------------------------------------------------------
Tue Jul 23 11:23:47 UTC 2019 - matthias.gerstner@suse.com

View File

@@ -1,7 +1,7 @@
#
# spec file for package cfengine
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@@ -37,7 +37,7 @@
%bcond_with postgresql
%bcond_with libvirt
Name: cfengine
Version: 3.12.1
Version: 3.14.0.2
Release: 0
# This is the place where workdir should be
#define basedir /var/lib/%%{name}
@@ -45,7 +45,7 @@ Release: 0
Summary: Configuration management framework
License: GPL-3.0-only
Group: Productivity/Networking/System
Url: http://www.cfengine.org/
URL: http://www.cfengine.org/
Source: https://cfengine-package-repos.s3.amazonaws.com/tarballs/cfengine-%{version}.tar.gz
Source1: %{name}.SuSEfirewall2
Source2: cf-execd.service
@@ -68,15 +68,15 @@ Source107: http://www.verticalsysadmin.com/cfengine/primer.pdf
# PATCH-FIX-SUSE
# set cfengine's notion of bindir to /usr/bin instead of /var/cfengine/bin
# kkaempf@suse.de
Patch1: 0001-Set-sys.bindir-to-usr-sbin-expect-cf-components-ther.patch
#Patch1: 0001-Set-sys.bindir-to-usr-sbin-expect-cf-components-ther.patch
# PATCH-FIX-UPSTREAM add 'suse' class for consistency with other vendor classes
# PATCH-FEATURE-UPSTREAM better /etc/SuSE-release parsing, upstream #5423
# kkaempf@suse.de
Patch2: 0002-Simplify-and-fix-parsing-of-etc-SuSE-release-fixes-i.patch
Patch2: 0001-Simplify-and-fix-parsing-of-etc-SuSE-release-fixes-i.patch
# PATCH-FIX-SUSE reduce "string truncated" (in strncpy) warnings
Patch3: 0003-Reduce-string-truncation-warnings.patch
Patch3: 0002-Reduce-string-truncation-warnings.patch
# PATCH-FIX-SUSE BNC#1016848, adam.majer
Patch10: 0004-make-home-dir-for-tests.patch
Patch10: 0003-make-home-dir-for-tests.patch
# SLE 11 or RHEL5 autoconf does not support AM_SUBST_NOTMAKE, kkaempf@suse.de
Patch99: remove-am_subst_notmake.patch
@@ -172,8 +172,7 @@ Group: Documentation/Other
Lots of example promises for CFEngine.
%prep
%setup -q
%patch1 -p1
%setup -q -n core-3.14.0-2
%patch2 -p1
%patch3 -p1
%if 0%{?suse_version} <= 1110