"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cf-agent/verify_files_utils.c" between
cfengine-3.12.6.tar.gz and cfengine-3.12.7.tar.gz

About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version. Community version. LTS (Long Term Support) release.

verify_files_utils.c  (cfengine-3.12.6):verify_files_utils.c  (cfengine-3.12.7)
skipping to change at line 78 skipping to change at line 78
#include <cf-windows-functions.h> #include <cf-windows-functions.h>
#define CF_RECURSION_LIMIT 100 #define CF_RECURSION_LIMIT 100
static const Rlist *AUTO_DEFINE_LIST = NULL; /* GLOBAL_P */ static const Rlist *AUTO_DEFINE_LIST = NULL; /* GLOBAL_P */
static Item *VSETXIDLIST = NULL; static Item *VSETXIDLIST = NULL;
const Rlist *SINGLE_COPY_LIST = NULL; /* GLOBAL_P */ const Rlist *SINGLE_COPY_LIST = NULL; /* GLOBAL_P */
static Rlist *SINGLE_COPY_CACHE = NULL; /* GLOBAL_X */ StringSet *SINGLE_COPY_CACHE = NULL; /* GLOBAL_X */
static bool TransformFile(EvalContext *ctx, char *file, Attributes attr, const P romise *pp, PromiseResult *result); static bool TransformFile(EvalContext *ctx, char *file, Attributes attr, const P romise *pp, PromiseResult *result);
static PromiseResult VerifyName(EvalContext *ctx, char *path, struct stat *sb, A ttributes attr, const Promise *pp); static PromiseResult VerifyName(EvalContext *ctx, char *path, struct stat *sb, A ttributes attr, const Promise *pp);
static PromiseResult VerifyDelete(EvalContext *ctx, static PromiseResult VerifyDelete(EvalContext *ctx,
const char *path, const struct stat *sb, const char *path, const struct stat *sb,
Attributes attr, const Promise *pp); Attributes attr, const Promise *pp);
static PromiseResult VerifyCopy(EvalContext *ctx, const char *source, char *dest ination, Attributes attr, const Promise *pp, static PromiseResult VerifyCopy(EvalContext *ctx, const char *source, char *dest ination, Attributes attr, const Promise *pp,
CompressedArray **inode_cache, AgentConnection * conn); CompressedArray **inode_cache, AgentConnection * conn);
static PromiseResult TouchFile(EvalContext *ctx, char *path, Attributes attr, co nst Promise *pp); static PromiseResult TouchFile(EvalContext *ctx, char *path, Attributes attr, co nst Promise *pp);
static PromiseResult VerifyFileAttributes(EvalContext *ctx, const char *file, st ruct stat *dstat, Attributes attr, const Promise *pp); static PromiseResult VerifyFileAttributes(EvalContext *ctx, const char *file, st ruct stat *dstat, Attributes attr, const Promise *pp);
skipping to change at line 248 skipping to change at line 248
sourcefile); sourcefile);
return PROMISE_RESULT_NOOP; return PROMISE_RESULT_NOOP;
} }
if (attr.haveselect && !SelectLeaf(ctx, sourcefile, &ssb, attr.select)) if (attr.haveselect && !SelectLeaf(ctx, sourcefile, &ssb, attr.select))
{ {
Log(LOG_LEVEL_DEBUG, "Skipping non-selected file '%s'", sourcefile); Log(LOG_LEVEL_DEBUG, "Skipping non-selected file '%s'", sourcefile);
return PROMISE_RESULT_NOOP; return PROMISE_RESULT_NOOP;
} }
if (RlistIsInListOfRegex(SINGLE_COPY_CACHE, destfile)) if ((SINGLE_COPY_CACHE != NULL) && StringSetContains(SINGLE_COPY_CACHE, dest file))
{ {
Log(LOG_LEVEL_INFO, "Skipping single-copied file '%s'", destfile); Log(LOG_LEVEL_INFO, "Skipping single-copied file '%s'", destfile);
return PROMISE_RESULT_NOOP; return PROMISE_RESULT_NOOP;
} }
if (attr.copy.link_type != FILE_LINK_TYPE_NONE) if (attr.copy.link_type != FILE_LINK_TYPE_NONE)
{ {
lastnode = ReadLastNode(sourcefile); lastnode = ReadLastNode(sourcefile);
if (MatchRlistItem(ctx, attr.copy.link_instead, lastnode)) if (MatchRlistItem(ctx, attr.copy.link_instead, lastnode))
skipping to change at line 405 skipping to change at line 405
} }
cfPS(ctx, LOG_LEVEL_VERBOSE, PROMISE_RESULT_CHANGE, pp, attr, cfPS(ctx, LOG_LEVEL_VERBOSE, PROMISE_RESULT_CHANGE, pp, attr,
"Updated file from '%s:%s'", "Updated file from '%s:%s'",
server, sourcefile); server, sourcefile);
result = PromiseResultUpdate(result, PROMISE_RESULT_CHANGE); result = PromiseResultUpdate(result, PROMISE_RESULT_CHANGE);
if (SINGLE_COPY_LIST) if (SINGLE_COPY_LIST)
{ {
RlistPrependScalarIdemp(&SINGLE_COPY_CACHE, destfile); StringSetAdd(SINGLE_COPY_CACHE, xstrdup(destfile));
} }
if (MatchRlistItem(ctx, AUTO_DEFINE_LIST, destfile)) if (MatchRlistItem(ctx, AUTO_DEFINE_LIST, destfile))
{ {
FileAutoDefine(ctx, destfile); FileAutoDefine(ctx, destfile);
} }
} }
else else
{ {
cfPS(ctx, LOG_LEVEL_ERR, PROMISE_RESULT_FAIL, pp, cfPS(ctx, LOG_LEVEL_ERR, PROMISE_RESULT_FAIL, pp,
skipping to change at line 573 skipping to change at line 573
result = PromiseResultUpdate( result = PromiseResultUpdate(
result, PROMISE_RESULT_CHANGE); result, PROMISE_RESULT_CHANGE);
result = PromiseResultUpdate( result = PromiseResultUpdate(
result, VerifyCopiedFileAttributes(ctx, sourcefile, result, VerifyCopiedFileAttributes(ctx, sourcefile,
destfile, &ssb, destfile, &ssb,
&dsb, attr, pp)); &dsb, attr, pp));
} }
if (RlistIsInListOfRegex(SINGLE_COPY_LIST, destfile)) if (RlistIsInListOfRegex(SINGLE_COPY_LIST, destfile))
{ {
RlistPrependScalarIdemp(&SINGLE_COPY_CACHE, destfile); StringSetAdd(SINGLE_COPY_CACHE, xstrdup(destfile));
} }
} }
else else
{ {
cfPS(ctx, LOG_LEVEL_ERR, PROMISE_RESULT_FAIL, pp, attr, cfPS(ctx, LOG_LEVEL_ERR, PROMISE_RESULT_FAIL, pp, attr,
"Was not able to copy '%s' to '%s'", "Was not able to copy '%s' to '%s'",
sourcefile, destfile); sourcefile, destfile);
result = PromiseResultUpdate(result, PROMISE_RESULT_FAIL); result = PromiseResultUpdate(result, PROMISE_RESULT_FAIL);
} }
skipping to change at line 605 skipping to change at line 605
result = PromiseResultUpdate( result = PromiseResultUpdate(
result, VerifyCopiedFileAttributes(ctx, sourcefile, destfile, result, VerifyCopiedFileAttributes(ctx, sourcefile, destfile,
&ssb, &dsb, attr, pp)); &ssb, &dsb, attr, pp));
/* Now we have to check for single copy, even though nothing was /* Now we have to check for single copy, even though nothing was
copied otherwise we can get oscillations between multipe copied otherwise we can get oscillations between multipe
versions if type is based on a checksum */ versions if type is based on a checksum */
if (RlistIsInListOfRegex(SINGLE_COPY_LIST, destfile)) if (RlistIsInListOfRegex(SINGLE_COPY_LIST, destfile))
{ {
RlistPrependScalarIdemp(&SINGLE_COPY_CACHE, destfile); StringSetAdd(SINGLE_COPY_CACHE, xstrdup(destfile));
} }
cfPS(ctx, LOG_LEVEL_VERBOSE, PROMISE_RESULT_NOOP, pp, attr, cfPS(ctx, LOG_LEVEL_VERBOSE, PROMISE_RESULT_NOOP, pp, attr,
"File '%s' is an up to date copy of source", destfile); "File '%s' is an up to date copy of source", destfile);
} }
} }
return result; return result;
} }
skipping to change at line 2671 skipping to change at line 2671
cfPS(ctx, LOG_LEVEL_VERBOSE, PROMISE_RESULT_NOOP, pp, attr, cfPS(ctx, LOG_LEVEL_VERBOSE, PROMISE_RESULT_NOOP, pp, attr,
"Can't stat file '%s' on '%s' but promise is kept because of" "Can't stat file '%s' on '%s' but promise is kept because of"
" 'missing_ok' in files.copy_from promise", " 'missing_ok' in files.copy_from promise",
BufferData(source), conn ? conn->remoteip : "localhost"); BufferData(source), conn ? conn->remoteip : "localhost");
BufferDestroy(source); BufferDestroy(source);
return PROMISE_RESULT_CHANGE; return PROMISE_RESULT_CHANGE;
} }
else else
{ {
cfPS(ctx, LOG_LEVEL_INFO, PROMISE_RESULT_FAIL, pp, attr, cfPS(ctx, LOG_LEVEL_ERR, PROMISE_RESULT_FAIL, pp, attr,
"Can't stat file '%s' on '%s' in files.copy_from promise", "Can't stat file '%s' on '%s' in files.copy_from promise",
BufferData(source), conn ? conn->remoteip : "localhost"); BufferData(source), conn ? conn->remoteip : "localhost");
BufferDestroy(source); BufferDestroy(source);
return PROMISE_RESULT_FAIL; return PROMISE_RESULT_FAIL;
} }
} }
start = BeginMeasure(); start = BeginMeasure();
strlcpy(vbuff, destination, CF_BUFSIZE - 3); strlcpy(vbuff, destination, CF_BUFSIZE - 3);
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added

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