/*
Authors:
Michal Zidek <mzidek@redhat.com>
Copyright (C) 2017 Red Hat
Config file validators test
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <popt.h>
#include <talloc.h>
#include <ini_configobj.h>
#include "tests/cmocka/common_mock.h"
#ifdef HAVE_LIBINI_CONFIG_V1_3
struct sss_ini_initdata {
char **error_list;
};
const char **errors_expected)
{
char **strs;
int ret;
&strs, &num_errors);
/* Output from validators */
for (int i = 0; i < num_errors; i++) {
/* Keep this printf loop for faster debugging */
}
for (int i = 0; i < num_errors && i <= num_errors_expected; i++) {
}
/* Check if the number of errors is the same */
}
{
const char *expected_errors[] = {
"[rule/allowed_sections]: Section [sssssssssssssd] is not allowed. "
"Check for typos.",
};
}
{
const char *expected_errors[] = {
"Check for typos.",
};
}
{
"debug_leTYPOvel = 10\n";
const char *expected_errors[] = {
"[rule/allowed_sssd_options]: Attribute 'debug_leTYPOvel' is not "
"allowed in section 'sssd'. Check for typos.",
};
}
{
"debug_leTYPOvel = 10\n";
const char *expected_errors[] = {
"[rule/allowed_pam_options]: Attribute 'debug_leTYPOvel' is not "
"allowed in section 'pam'. Check for typos.",
};
}
{
"debug_leTYPOvel = 10\n";
const char *expected_errors[] = {
"[rule/allowed_nss_options]: Attribute 'debug_leTYPOvel' is not "
"allowed in section 'nss'. Check for typos.",
};
}
{
"debug_leTYPOvel = 10\n";
const char *expected_errors[] = {
"[rule/allowed_pac_options]: Attribute 'debug_leTYPOvel' is not "
"allowed in section 'pac'. Check for typos.",
};
}
{
"debug_leTYPOvel = 10\n";
const char *expected_errors[] = {
"[rule/allowed_ifp_options]: Attribute 'debug_leTYPOvel' is not "
"allowed in section 'ifp'. Check for typos.",
};
}
{
"debug_leTYPOvel = 10\n";
const char *expected_errors[] = {
"[rule/allowed_subdomain_options]: Attribute 'debug_leTYPOvel' is not "
};
}
{
"debug_leTYPOvel = 10\n";
const char *expected_errors[] = {
"[rule/allowed_domain_options]: Attribute 'debug_leTYPOvel' is not "
"allowed in section 'application/myapp'. Check for typos.",
};
}
{
"debug_leTYPOvel = 10\n";
const char *expected_errors[] = {
"[rule/allowed_subdomain_options]: Attribute 'debug_leTYPOvel' is not "
};
}
{
"[pam]\n"
"[nss]\n"
"[domain/testdom.test]\n"
"[application/myapp]\n"
"[secrets]\n"
"[ssh]\n"
"[ifp]\n"
"[pac]\n";
}
{
"inherit_from = domain\n";
const char *expected_errors[] = {
"[rule/sssd_checks]: Attribute 'inherit_from' is not allowed in "
};
}
{
"inherit_from = domain\n";
}
{
int opt;
};
};
/* Set debug level to invalid value so we can decide if -d 0 was used. */
switch (opt) {
default:
return 1;
}
}
}
#else /* !HAVE_LIBINI_CONFIG_V1_3 */
{
return 0;
}
#endif /* HAVE_LIBINI_CONFIG_V1_3 */