~akhil011/ubuntu/wily/monit/crypto_fix

« back to all changes in this revision

Viewing changes to src/p.y

  • Committer: Package Import Robot
  • Author(s): Sergey B Kirpichev
  • Date: 2014-05-19 13:33:44 UTC
  • mfrom: (1.1.22)
  • Revision ID: package-import@ubuntu.com-20140519133344-xucbhs18wvojnsu4
Tags: 1:5.8.1-1
* Imported Upstream version 5.8.1
* Refresh patches
* Fix HURD build, broken by upstream
* Install CONTRIBUTORS file

Show diffs side-by-side

added added

removed removed

Lines of Context:
798
798
                  }
799
799
                | ALLOW STRING {
800
800
                    if (! (add_net_allow($2) || add_host_allow($2))) {
801
 
                      yyerror2("erroneous network or host identifier %s", $2);
 
801
                      yyerror2("Erroneous network or host identifier %s", $2);
802
802
                    }
803
803
                    FREE($2);
804
804
                  }
1633
1633
                    rate1.count  = $<number>1;
1634
1634
                    rate1.cycles = $<number>1;
1635
1635
                    if (rate1.cycles < 1 || rate1.cycles > BITMAP_MAX)
1636
 
                      yyerror2("the number of cycles must be between 1 and %d", BITMAP_MAX);
 
1636
                      yyerror2("The number of cycles must be between 1 and %d", BITMAP_MAX);
1637
1637
                  }
1638
1638
                | NUMBER NUMBER CYCLE {
1639
1639
                    rate1.count  = $<number>1;
1640
1640
                    rate1.cycles = $<number>2;
1641
1641
                    if (rate1.cycles < 1 || rate1.cycles > BITMAP_MAX)
1642
 
                      yyerror2("the number of cycles must be between 1 and %d", BITMAP_MAX);
 
1642
                      yyerror2("The number of cycles must be between 1 and %d", BITMAP_MAX);
1643
1643
                    if (rate1.count < 1 || rate1.count > rate1.cycles)
1644
 
                      yyerror2("the number of events must be bigger then 0 and less than poll cycles");
 
1644
                      yyerror2("The number of events must be bigger then 0 and less than poll cycles");
1645
1645
                  }
1646
1646
                ;
1647
1647
 
1650
1650
                    rate2.count  = $<number>1;
1651
1651
                    rate2.cycles = $<number>1;
1652
1652
                    if (rate2.cycles < 1 || rate2.cycles > BITMAP_MAX)
1653
 
                      yyerror2("the number of cycles must be between 1 and %d", BITMAP_MAX);
 
1653
                      yyerror2("The number of cycles must be between 1 and %d", BITMAP_MAX);
1654
1654
                  }
1655
1655
                | NUMBER NUMBER CYCLE {
1656
1656
                    rate2.count  = $<number>1;
1657
1657
                    rate2.cycles = $<number>2;
1658
1658
                    if (rate2.cycles < 1 || rate2.cycles > BITMAP_MAX)
1659
 
                      yyerror2("the number of cycles must be between 1 and %d", BITMAP_MAX);
 
1659
                      yyerror2("The number of cycles must be between 1 and %d", BITMAP_MAX);
1660
1660
                    if (rate2.count < 1 || rate2.count > rate2.cycles)
1661
 
                      yyerror2("the number of events must be bigger then 0 and less than poll cycles");
 
1661
                      yyerror2("The number of events must be bigger then 0 and less than poll cycles");
1662
1662
                  }
1663
1663
                ;
1664
1664
 
1716
1716
 
1717
1717
space           : IF SPACE operator value unit rate1 THEN action1 recovery {
1718
1718
                    if (!filesystem_usage(current->inf, current->path))
1719
 
                      yyerror2("cannot read usage of filesystem %s", current->path);
 
1719
                      yyerror2("Cannot read usage of filesystem %s", current->path);
1720
1720
                    filesystemset.resource = RESOURCE_ID_SPACE;
1721
1721
                    filesystemset.operator = $<number>3;
1722
1722
                    filesystemset.limit_absolute = (int)((float)$<real>4 / (float)current->inf->priv.filesystem.f_bsize * (float)$<number>5);
1869
1869
  msg = Str_vcat(s, ap);
1870
1870
  va_end(ap);
1871
1871
 
1872
 
  LogError("%s:%i: Error: %s '%s'\n", currentfile, lineno, msg, yytext);
 
1872
  LogError("%s:%i: %s '%s'\n", currentfile, lineno, msg, yytext);
1873
1873
  cfg_errflag++;
1874
1874
 
1875
1875
  FREE(msg);
1889
1889
  msg = Str_vcat(s, ap);
1890
1890
  va_end(ap);
1891
1891
 
1892
 
  LogWarning("%s:%i: Warning: %s '%s'\n", currentfile, lineno, msg, yytext);
 
1892
  LogWarning("%s:%i: %s '%s'\n", currentfile, lineno, msg, yytext);
1893
1893
 
1894
1894
  FREE(msg);
1895
1895
 
1908
1908
  msg = Str_vcat(s, ap);
1909
1909
  va_end(ap);
1910
1910
 
1911
 
  LogError("%s:%i: Error: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
 
1911
  LogError("%s:%i: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
1912
1912
  cfg_errflag++;
1913
1913
 
1914
1914
  FREE(msg);
1928
1928
  msg = Str_vcat(s, ap);
1929
1929
  va_end(ap);
1930
1930
 
1931
 
  LogWarning("%s:%i: Warning: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
 
1931
  LogWarning("%s:%i: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
1932
1932
 
1933
1933
  FREE(msg);
1934
1934
 
1945
1945
  servicelist = tail = current = NULL;
1946
1946
 
1947
1947
  if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) {
1948
 
    LogError("%s: Error: cannot open the control file '%s' -- %s\n", prog, controlfile, STRERROR);
 
1948
    LogError("Cannot open the control file '%s' -- %s\n", controlfile, STRERROR);
1949
1949
    return FALSE;
1950
1950
  }
1951
1951
 
2064
2064
 
2065
2065
        /* Check that we do not start monit in daemon mode without having a poll time */
2066
2066
        if (!Run.polltime && (Run.isdaemon || Run.init)) {
2067
 
                LogError("%s: Error: Poll time not defined. Please define poll time in the\n control file or use the -d option when starting monit\n", prog);
 
2067
                LogError("Poll time not defined. Please define poll time in the\n control file or use the -d option when starting monit\n");
2068
2068
                cfg_errflag++;
2069
2069
        }
2070
2070
 
2075
2075
                if (s->type == TYPE_HOST) {
2076
2076
                        /* Verify that a remote service has a port or an icmp list */
2077
2077
                        if (!s->portlist && !s->icmplist) {
2078
 
                                LogError("%s: Error: 'check host' statement is incomplete: Please specify a port number to test\n or an icmp test at the remote host: '%s'\n", prog, s->name);
 
2078
                                LogError("'check host' statement is incomplete: Please specify a port number to test\n or an icmp test at the remote host: '%s'\n", s->name);
2079
2079
                                cfg_errflag++;
2080
2080
                        }
2081
2081
                } else if (s->type == TYPE_PROGRAM) {
2082
2082
                        /* Verify that a program test has a status test */
2083
2083
                        if (! s->statuslist) {
2084
 
                                LogError("%s: Error: 'check program %s' is incomplete: Please add an 'if status != n' test\n", prog, s->name);
 
2084
                                LogError("'check program %s' is incomplete: Please add an 'if status != n' test\n", s->name);
2085
2085
                                cfg_errflag++;
2086
2086
                        }
2087
2087
                        /* Create the Command object */
2120
2120
                                        }
2121
2121
                                }
2122
2122
                                if (! Run.mmonitcredentials)
2123
 
                                LogWarning("%s: Warning: M/Monit registration with credentials enabled, but no suitable credentials found in monit configuration file -- please add 'allow user:password' option to 'set httpd' statement\n", prog);
 
2123
                                LogWarning("M/Monit registration with credentials enabled, but no suitable credentials found in monit configuration file -- please add 'allow user:password' option to 'set httpd' statement\n");
2124
2124
                        }
2125
2125
                } else
2126
 
                LogWarning("%s: Warning: M/Monit enabled but no httpd allowed -- please add 'set httpd' statement\n", prog);
 
2126
                LogWarning("M/Monit enabled but no httpd allowed -- please add 'set httpd' statement\n");
2127
2127
        }
2128
2128
 
2129
2129
        /* Check the sanity of any dependency graph */
2375
2375
 
2376
2376
  if (t->test_changes || notime) {
2377
2377
    if (! file_exist(current->path)) {
2378
 
      DEBUG("%s: Debug: the path '%s' used in the TIMESTAMP statement refer to a non-existing object\n", prog, current->path);
 
2378
      DEBUG("The path '%s' used in the TIMESTAMP statement refer to a non-existing object\n", current->path);
2379
2379
    } else if (!(t->timestamp = file_getTimestamp(current->path, S_IFDIR|S_IFREG))) {
2380
 
      yyerror2("cannot get the timestamp for '%s'", current->path);
 
2380
      yyerror2("Cannot get the timestamp for '%s'", current->path);
2381
2381
    }
2382
2382
  }
2383
2383
 
2397
2397
  ASSERT(ar);
2398
2398
 
2399
2399
  if (ar->count > ar->cycle)
2400
 
    yyerror2("the number of restarts must be less than poll cycles");
 
2400
    yyerror2("The number of restarts must be less than poll cycles");
2401
2401
  if (ar->count <= 0 || ar->cycle <= 0)
2402
 
    yyerror2("zero or negative values not allowed in a action rate statement");
 
2402
    yyerror2("Zero or negative values not allowed in a action rate statement");
2403
2403
 
2404
2404
  NEW(a);
2405
2405
  a->count  = ar->count;
2481
2481
      /* If the file doesn't exist, set dummy value */
2482
2482
      snprintf(cs->hash, sizeof(cs->hash), "00000000000000000000000000000000");
2483
2483
      cs->initialized = FALSE;
2484
 
      yywarning2("cannot compute a checksum for file %s", current->path);
 
2484
      yywarning2("Cannot compute a checksum for file %s", current->path);
2485
2485
    }
2486
2486
  }
2487
2487
 
2493
2493
    } else if (len == 40) {
2494
2494
      cs->type = HASH_SHA1;
2495
2495
    } else {
2496
 
      yyerror2("unknown checksum type [%s] for file %s", cs->hash, current->path);
 
2496
      yyerror2("Unknown checksum type [%s] for file %s", cs->hash, current->path);
2497
2497
      reset_checksumset();
2498
2498
      return;
2499
2499
    }
2500
2500
  } else if (( cs->type == HASH_MD5 && len!=32 ) || ( cs->type == HASH_SHA1 && len != 40 )) {
2501
 
    yyerror2("invalid checksum [%s] for file %s", cs->hash, current->path);
 
2501
    yyerror2("Invalid checksum [%s] for file %s", cs->hash, current->path);
2502
2502
    reset_checksumset();
2503
2503
    return;
2504
2504
  }
2578
2578
    char errbuf[STRLEN];
2579
2579
    regerror(reg_return, ms->regex_comp, errbuf, STRLEN);
2580
2580
    if (m->match_path != NULL)
2581
 
      yyerror2("regex parsing error:%s on line %i of", errbuf, linenumber);
 
2581
      yyerror2("Regex parsing error: %s on line %i of", errbuf, linenumber);
2582
2582
    else
2583
 
      yyerror2("regex parsing error:%s", errbuf);
 
2583
      yyerror2("Regex parsing error: %s", errbuf);
2584
2584
  }
2585
2585
#endif
2586
2586
  appendmatch(m->ignore ? &current->matchignorelist : &current->matchlist, m);
2598
2598
 
2599
2599
  handle = fopen(ms->match_path, "r");
2600
2600
  if (handle == NULL) {
2601
 
    yyerror2("cannot read regex match file (%s)", ms->match_path);
 
2601
    yyerror2("Cannot read regex match file (%s)", ms->match_path);
2602
2602
    return;
2603
2603
  }
2604
2604
 
2827
2827
    if (reg_return != 0) {
2828
2828
      char errbuf[STRLEN];
2829
2829
      regerror(reg_return, g->expect, errbuf, STRLEN);
2830
 
      yyerror2("regex parsing error:%s", errbuf);
 
2830
      yyerror2("Regex parsing error: %s", errbuf);
2831
2831
    }
2832
2832
#else
2833
2833
    g->expect = expect;
2874
2874
  command->arg[command->length] = NULL;
2875
2875
 
2876
2876
  if (command->length >= ARGMAX)
2877
 
    yyerror("exceeded maximum number of program arguments");
 
2877
    yyerror("Exceeded maximum number of program arguments");
2878
2878
 
2879
2879
}
2880
2880
 
2925
2925
    if (reg_return != 0) {
2926
2926
      char errbuf[STRLEN];
2927
2927
      regerror(reg_return, urlrequest->regex, errbuf, STRLEN);
2928
 
      yyerror2("regex parsing error: %s", errbuf);
 
2928
      yyerror2("Regex parsing error: %s", errbuf);
2929
2929
    }
2930
2930
  }
2931
2931
#else
2947
2947
  c->url = url;
2948
2948
  if (!strcmp(c->url->protocol, "https")) {
2949
2949
    if (!have_ssl()) {
2950
 
      yyerror("ssl check cannot be activated. SSL is not supported");
 
2950
      yyerror("SSL check cannot be activated. SSL is not supported");
2951
2951
    } else {
2952
2952
      c->ssl.use_ssl = TRUE;
2953
2953
      c->ssl.version = (sslversion == SSL_VERSION_NONE) ? SSL_VERSION_AUTO : sslversion;
3015
3015
    pwd = getpwnam(user);
3016
3016
 
3017
3017
    if (pwd == NULL) {
3018
 
      yyerror2("requested user not found on the system");
 
3018
      yyerror2("Requested user not found on the system");
3019
3019
      return(0);
3020
3020
    }
3021
3021
 
3022
3022
  } else {
3023
3023
 
3024
3024
    if ( (pwd = getpwuid(uid)) == NULL ) {
3025
 
      yyerror2("requested uid not found on the system");
 
3025
      yyerror2("Requested uid not found on the system");
3026
3026
      return(0);
3027
3027
    }
3028
3028
  }
3044
3044
    grd = getgrnam(group);
3045
3045
 
3046
3046
    if (grd == NULL) {
3047
 
      yyerror2("requested group not found on the system");
 
3047
      yyerror2("Requested group not found on the system");
3048
3048
      return(0);
3049
3049
    }
3050
3050
 
3051
3051
  } else {
3052
3052
 
3053
3053
    if ( (grd = getgrgid(gid)) == NULL ) {
3054
 
      yyerror2("requested gid not found on the system");
 
3054
      yyerror2("Requested gid not found on the system");
3055
3055
      return(0);
3056
3056
    }
3057
3057
 
3070
3070
    command->has_uid = TRUE;
3071
3071
    command->uid = uid;
3072
3072
  } else
3073
 
    yyerror("uid statement requires root privileges");
 
3073
    yyerror("UID statement requires root privileges");
3074
3074
}
3075
3075
 
3076
3076
 
3082
3082
    command->has_gid = TRUE;
3083
3083
    command->gid = gid;
3084
3084
  } else
3085
 
    yyerror("gid statement requires root privileges");
 
3085
    yyerror("GID statement requires root privileges");
3086
3086
}
3087
3087
 
3088
3088
 
3132
3132
        
3133
3133
        if ( handle == NULL ) {
3134
3134
                if (username != NULL)
3135
 
                yyerror2("cannot read htpasswd (%s)", filename);
 
3135
                yyerror2("Cannot read htpasswd (%s)", filename);
3136
3136
                else
3137
 
                yyerror2("cannot read htpasswd", filename);
 
3137
                yyerror2("Cannot read htpasswd", filename);
3138
3138
                return;
3139
3139
        }
3140
3140
        
3215
3215
  c->digesttype  = DIGEST_PAM;
3216
3216
  c->is_readonly = readonly;
3217
3217
 
3218
 
  DEBUG("%s: Adding PAM group '%s'.\n", prog, groupname);
 
3218
  DEBUG("Adding PAM group '%s'\n", groupname);
3219
3219
 
3220
3220
  return;
3221
3221
}
3237
3237
  } else {
3238
3238
 
3239
3239
    if (Util_getUserCredentials(uname) != NULL) {
3240
 
      yywarning2("credentials for user %s were already added, entry ignored", uname);
 
3240
      yywarning2("Credentials for user %s were already added, entry ignored", uname);
3241
3241
      FREE(uname);
3242
3242
      FREE(passwd);
3243
3243
      return FALSE;
3260
3260
  c->digesttype  = dtype;
3261
3261
  c->is_readonly = readonly;
3262
3262
 
3263
 
  DEBUG("%s: Debug: Adding credentials for user '%s'.\n", prog, uname);
 
3263
  DEBUG("Adding credentials for user '%s'\n", uname);
3264
3264
 
3265
3265
  return TRUE;
3266
3266
 
3299
3299
    else if (IS(facility, "log_daemon"))
3300
3300
      Run.facility = LOG_DAEMON;
3301
3301
    else
3302
 
      yyerror2("invalid syslog facility");
 
3302
      yyerror2("Invalid syslog facility");
3303
3303
  } else {
3304
3304
    Run.facility = LOG_USER;
3305
3305
  }
3490
3490
  ASSERT(name);
3491
3491
 
3492
3492
  if (Util_existService(name) || (current && IS(name, current->name)))
3493
 
    yyerror2("service name conflict, %s already defined", name);
 
3493
    yyerror2("Service name conflict, %s already defined", name);
3494
3494
  if (name && *name == '/')
3495
 
          yyerror2("service name '%s' must not start with '/' -- ", name);
 
3495
          yyerror2("Service name '%s' must not start with '/' -- ", name);
3496
3496
}
3497
3497
 
3498
3498
 
3509
3509
  result = (int)strtol(buf, &status, 8);
3510
3510
 
3511
3511
  if ( *status != '\0' || result < 0 || result > 07777 )
3512
 
    yyerror2("permission statements must have an octal value between 0 and 7777");
 
3512
    yyerror2("Permission statements must have an octal value between 0 and 7777");
3513
3513
 
3514
3514
  return result;
3515
3515
}
3523
3523
  ASSERT(hostname);
3524
3524
 
3525
3525
  if (!check_host(hostname))
3526
 
    yywarning2("hostname did not resolve");
 
3526
    yywarning2("Hostname did not resolve");
3527
3527
}
3528
3528
 
3529
3529
/*
3551
3551
      for (d = s->dependantlist; d; d = d->next) {
3552
3552
        Service_T dp = Util_getService(d->dependant);
3553
3553
        if (!dp) {
3554
 
          LogError("%s: Error: Depend service '%s' is not defined in the control file\n", prog, d->dependant);
 
3554
          LogError("Depend service '%s' is not defined in the control file\n", d->dependant);
3555
3555
          exit(1);
3556
3556
        }
3557
3557
        if (!dp->visited) {
3570
3570
 
3571
3571
  if (!done) {
3572
3572
        ASSERT(depends_on);
3573
 
        LogError("%s: Error: Found a depend loop in the control file involving the service '%s'\n", prog, depends_on->name);
 
3573
        LogError("Found a depend loop in the control file involving the service '%s'\n", depends_on->name);
3574
3574
        exit(1);
3575
3575
   }
3576
3576