Ejemplo n.º 1
0
static bool IsContextIgnorableForReporting(const char *context_name)
{
    return (strncmp(context_name,"Min",3) == 0 || strncmp(context_name,"Hr",2) == 0 || strcmp(context_name,"Q1") == 0
     || strcmp(context_name,"Q2") == 0 || strcmp(context_name,"Q3") == 0 || strcmp(context_name,"Q4") == 0
     || strncmp(context_name,"GMT_Hr",6) == 0  || strncmp(context_name,"Yr",2) == 0
     || strncmp(context_name,"Day",3) == 0 || strcmp(context_name,"license_expired") == 0
     || strcmp(context_name,"any") == 0 || strcmp(context_name,"from_cfexecd") == 0
     || IsStrIn(context_name,MONTH_TEXT) || IsStrIn(context_name,DAY_TEXT)
     || IsStrIn(context_name,SHIFT_TEXT)) || strncmp(context_name,"Lcycle",6) == 0;
}
Ejemplo n.º 2
0
int CheckParseVariableName(const char *name)
{
 const char *reserved[] = { "promiser", "handle", "promise_filename", "promise_dirname", "promise_linenumber", "this", NULL };
 char scopeid[CF_MAXVARSIZE], vlval[CF_MAXVARSIZE];
 int count = 0, level = 0;

 if (IsStrIn(name, reserved))
    {
    return false;
    }

 scopeid[0] = '\0';

 if (strchr(name, '.'))
    {
    for (const char *sp = name; *sp != '\0'; sp++)
       {
       switch (*sp)
          {
          case '.':
              if (++count > 1 && level != 1)
                 {
                 return false;
                 }
              break;

          case '[':
              level++;
              break;

          case ']':
              level--;
              break;

          default:
              break;
          }

       if (level > 1)
          {
          yyerror("Too many levels of [] reserved for array use");
          return false;
          }

       }

    if (count == 1)
       {
       sscanf(name, "%[^.].%s", scopeid, vlval);

       if (strlen(scopeid) == 0 || strlen(vlval) == 0)
          {
          return false;
          }
       }
    }

 return true;
}
Ejemplo n.º 3
0
Archivo: syntax.c Proyecto: dnaeon/core
void CheckBundle(char *name, char *type)
{
    Bundle *bp;
    char output[CF_BUFSIZE];
    const char *reserved[] = { "sys", "const", "mon", "edit", "match", "mon", "this", NULL };

    CfDebug("Checking for bundle (%s,%s)\n", name, type);

    if (IsStrIn(name, reserved))
    {
        snprintf(output, CF_BUFSIZE, "Use of a reserved context as a bundle name \"%s\" ", name);
        ReportError(output);
    }

    for (bp = BUNDLES; bp != NULL; bp = bp->next)
    {
        if ((strcmp(name, bp->name) == 0) && (strcmp(type, bp->type) == 0))
        {
            snprintf(output, CF_BUFSIZE, "Redefinition of bundle %s for %s is a broken promise", name, type);
            ReportError(output);
            ERRORCOUNT++;
        }
    }
}
Ejemplo n.º 4
0
static bool IsPromiseValuableForLogging(const Promise *pp)
{
    return pp && (pp->parent_promise_type->name != NULL) && (!IsStrIn(pp->parent_promise_type->name, NO_LOG_TYPES));
}
Ejemplo n.º 5
0
/*
 * Vars, classes and similar promises which do not affect the system itself (but
 * just support evalution) do not need to be counted as repaired/failed, as they
 * may change every iteration and introduce lot of churn in reports without
 * giving any value.
 */
static bool IsPromiseValuableForStatus(const Promise *pp)
{
    return pp && (pp->parent_promise_type->name != NULL) && (!IsStrIn(pp->parent_promise_type->name, NO_STATUS_TYPES));
}
Ejemplo n.º 6
0
static bool IsPromiseValuableForLogging(const Promise *pp)
{
    return pp && (pp->agentsubtype != NULL) && (!IsStrIn(pp->agentsubtype, NO_LOG_TYPES));
}
Ejemplo n.º 7
0
/*
 * Vars, classes and similar promises which do not affect the system itself (but
 * just support evalution) do not need to be counted as repaired/failed, as they
 * may change every iteration and introduce lot of churn in reports without
 * giving any value.
 */
static bool IsPromiseValuableForStatus(const Promise *pp)
{
    return pp && (pp->agentsubtype != NULL) && (!IsStrIn(pp->agentsubtype, NO_STATUS_TYPES));
}