krb5_utils-tests.c revision 6c676de3f7e8dee3655343c2975995f73ec1ef04
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova Kerberos 5 Backend Module -- Utilities tests
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova Sumit Bose <sbose@redhat.com>
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova Copyright (C) 2009 Red Hat
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova This program is free software; you can redistribute it and/or modify
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova it under the terms of the GNU General Public License as published by
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova the Free Software Foundation; either version 3 of the License, or
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova (at your option) any later version.
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova This program is distributed in the hope that it will be useful,
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova but WITHOUT ANY WARRANTY; without even the implied warranty of
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova GNU General Public License for more details.
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova You should have received a copy of the GNU General Public License
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova along with this program. If not, see <http://www.gnu.org/licenses/>.
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova#define PRINCIPAL_NAME "testuser@EXAMPLE.COM"
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovaextern struct dp_option default_krb5_opts[];
669b4334be8eb3313ca146137db1b83a8873632aKristina Sojakova fail_unless(ret == EOK, "rmdir [%s] failed, [%d][%s].", __dir__, \
e7cedce0d43b62593b8d5d552bdc36eb5ba73409Kristina Sojakova fail_unless(tmp_ctx == NULL, "Talloc context already initialized.");
228124cdf2560445e7f1b5312476935b51887463Kristina Sojakova fail_unless(tmp_ctx != NULL, "Cannot create talloc context.");
228124cdf2560445e7f1b5312476935b51887463Kristina Sojakova fail_unless(tmp_ctx != NULL, "Talloc context already freed.");
53d7a124a59889b9de5c6ffa856a5e697b043c90Kristina Sojakova fail_unless(ret == 0, "Cannot free talloc context.");
228124cdf2560445e7f1b5312476935b51887463Kristina Sojakovastatic void check_dir(const char *dirname, uid_t uid, gid_t gid, mode_t mode)
53d7a124a59889b9de5c6ffa856a5e697b043c90Kristina Sojakova fail_unless(ret == EOK, "stat failed [%d][%s].", errno, strerror(errno));
53d7a124a59889b9de5c6ffa856a5e697b043c90Kristina Sojakova fail_unless(S_ISDIR(stat_buf.st_mode), "[%s] is not a directory.", dirname);
228124cdf2560445e7f1b5312476935b51887463Kristina Sojakova fail_unless(stat_buf.st_uid == uid, "uid does not match, "
228124cdf2560445e7f1b5312476935b51887463Kristina Sojakova "expected [%d], got [%d].",
53d7a124a59889b9de5c6ffa856a5e697b043c90Kristina Sojakova fail_unless(stat_buf.st_gid == gid, "gid does not match, "
228124cdf2560445e7f1b5312476935b51887463Kristina Sojakova "expected [%d], got [%d].",
228124cdf2560445e7f1b5312476935b51887463Kristina Sojakova fail_unless((stat_buf.st_mode & ~S_IFMT) == mode,
228124cdf2560445e7f1b5312476935b51887463Kristina Sojakova "mode of [%s] does not match, "
669b4334be8eb3313ca146137db1b83a8873632aKristina SojakovaSTART_TEST(test_private_ccache_dir_in_user_dir)
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova fail_unless(cwd != NULL, "getcwd failed.");
int ret;
char *cwd;
char *dirname;
char *subdirname;
char *filename;
char *cwd;
char *dirname;
char *filename;
const char *errstr;
int errval;
int errpos;
filename);
filename);
char *residual;
char *dirname;
char *cwd;
void setup_talloc_context(void)
int ret;
for (i = 0; i < KRB5_OPTS; i++) {
void free_talloc_context(void)
int ret;
const char *expected)
char *result;
int ret;
char *result;
int ret;
char *result;
int ret;
char *result;
int ret;
char *result;
int ret;
char *result;
char *result;
char *result;
const char *file_template;
const char *expected;
int ret;
bool different_realm;
const char **str,
if (getuid() == 0) {
int ret;
int opt;
int number_failed;
switch(opt) {
if (number_failed == 0) {
return EXIT_FAILURE;
return EXIT_SUCCESS;
return EXIT_FAILURE;