Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cf-agent/cf-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ static PromiseResult DefaultVarPromiseWrapper(EvalContext *ctx, const Promise *p

int main(int argc, char *argv[])
{
printf("CRAIG: cf-agent argc=%d\n", argc);
for(int i=0; i<argc; i++) {
printf("CRAIG: argv[%d]='%s'\n", i, argv[i]);
}
SetupSignalsForAgent();
#ifdef HAVE_LIBXML2
xmlInitParser();
Expand Down
4 changes: 2 additions & 2 deletions cf-serverd/server_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1761,10 +1761,10 @@ bool DoExec2(const EvalContext *ctx,
/* STEP 5: RUN CFRUNCOMMAND. */

snprintf(sendbuf, sendbuf_size,
"cf-serverd executing cfruncommand: %s\n",
"cf-serverd executing cfruncommand: '%s'\n",
cmdbuf);
SendTransaction(conn->conn_info, sendbuf, 0, CF_DONE);
Log(LOG_LEVEL_INFO, "%s", sendbuf);
Log(LOG_LEVEL_INFO, "'%s'", sendbuf);

FILE *pp = cf_popen(cmdbuf, "r", true);
if (pp == NULL)
Expand Down
13 changes: 13 additions & 0 deletions libpromises/generic_agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -2457,13 +2457,26 @@ pid_t ReadPID(char *filename)

bool GenericAgentConfigParseArguments(GenericAgentConfig *config, int argc, char **argv)
{
printf("CRAIG ParseArg()\n");
if (argc == 0)
{
return true;
}

if (argc > 1)
{
Log(LOG_LEVEL_ERR, "Special 1-arg <policy-file> expected, got %d arguments instead. See debug output for details.", argc);
for (int i=0; i<argc; i++) {
Log(LOG_LEVEL_ERR, "argv[%d]='%s'", i, argv[i]);
char raw[2048] = "";
for(int j=0; j<512; j++) {
char chunk[5];
snprintf(chunk, 5, "0x%02x ", argv[i][j]);
StringAppend(raw, chunk, 2048);
if (argv[i][j] == 0) break;
}
Log(LOG_LEVEL_DEBUG, "Too many args, argv[%d] is '%s' [%s]", i, argv[i], raw);
}
return false;
}

Expand Down
Loading