UnixConfigCheck.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #include "UnixConfigCheck.h"
  18. #include <cstdlib>
  19. UnixConfigCheck::UnixConfigCheck(const char *lpszConfigFile) : ECConfigCheck("Unix Configuration file", lpszConfigFile)
  20. {
  21. }
  22. void UnixConfigCheck::loadChecks()
  23. {
  24. addCheck("default_domain", CONFIG_MANDATORY);
  25. addCheck("fullname_charset", 0, &testCharset);
  26. addCheck("min_user_uid", "max_user_uid", CONFIG_MANDATORY, &testId);
  27. addCheck("min_group_gid", "max_group_gid", CONFIG_MANDATORY, &testId);
  28. }
  29. int UnixConfigCheck::testId(const config_check_t *check)
  30. {
  31. if (atoi(check->value1.c_str()) < atoi(check->value2.c_str()))
  32. return CHECK_OK;
  33. printError(check->option1, "is equal or greater then \"" + check->option2 + "\" (" + check->value1 + ">=" + check->value2 + ")");
  34. return CHECK_ERROR;
  35. }