krb5_utils-tests.c revision 6b57784f0f175275fd900eca21c77415e3a5ea52
/*
SSSD
Kerberos 5 Backend Module -- Utilities tests
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2009 Red Hat
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 <stdlib.h>
#include <popt.h>
#include <check.h>
#include "providers/krb5/krb5_utils.h"
#include "providers/krb5/krb5_auth.h"
#define TESTS_PATH "tests_krb5_utils"
#define FILENAME "ghi"
#define USERNAME "testuser"
#define UID "12345"
#define PRINCIPAL_NAME "testuser@EXAMPLE.COM"
#define REALM "REALM.ORG"
#define HOME_DIRECTORY "/home/testuser"
#define CCACHE_DIR "/var/tmp"
#define PID "4321"
extern struct dp_option default_krb5_opts[];
struct krb5child_req *kr;
} while(0)
void setup_create_dir(void)
{
}
void teardown_create_dir(void)
{
int ret;
}
{
int ret;
"expected [%d], got [%d].",
"expected [%d], got [%d].",
"mode of [%s] does not match, "
"expected [%o], got [%o].", dirname,
}
{
int ret;
char *cwd;
char *user_dir;
char *dn1;
char *dn2;
char *dn3;
char *filename;
if (uid == 0) {
uid = 12345;
gid = 12345;
}
"while x-bit is missing.");
}
{
int ret;
char *cwd;
char *dirname;
char *subdirname;
char *filename;
"dir does not failed with EINVAL.");
}
{
int ret;
char *cwd;
char *dirname;
char *filename;
const char *errstr;
int errval;
int errpos;
" position %d. (Error: %d [%s])\n",
filename);
"illegal pattern '/./' in filename [%s].",
filename);
"illegal pattern '/../' in filename [%s].",
filename);
"illegal pattern '//' in filename [%s].",
filename);
}
{
char *residual;
char *dirname;
char *cwd;
const char *errstr;
int errval;
int errpos;
" position %d. (Error: %d [%s])\n",
cwd, TESTS_PATH);
cwd, TESTS_PATH);
}
void setup_talloc_context(void)
{
int ret;
int i;
for (i = 0; i < KRB5_OPTS; i++) {
}
}
void free_talloc_context(void)
{
int ret;
}
const char *expected)
{
char *result;
int ret;
"Expansion failed, result [%s], expected [%s].",
}
{
}
{
}
{
char *result;
int ret;
"Expansion failed, result [%s], expected [%s].",
"Expansion failed, result [%s], expected [%s].",
}
{
}
{
}
{
}
{
}
{
char *result;
int ret;
}
{
char *result;
int ret;
}
{
}
{
char *result;
int ret;
}
{
char *test_template = NULL;
char *result;
}
{
const char *test_template = BASE;
char *result;
"Expansion failed, result [%s], expected [%s].",
}
{
char *result;
const char *file_template;
const char *expected;
"Expansion failed, result [%s], expected [%s].",
"Expansion failed, result [%s], expected [%s].",
}
{
int ret;
bool different_realm;
"does not cause EINVAL.");
"different_realm is not false.");
"different_realm is not true.");
"different_realm is not true.");
}
Suite *krb5_utils_suite (void)
{
if (getuid() == 0) {
} else {
printf("Run as root to enable more tests.\n");
}
suite_add_tcase (s, tc_create_dir);
return s;
}
{
int ret;
int opt;
int number_failed;
struct poptOption long_options[] = {
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
} else {
}
return 1;
}
Suite *s = krb5_utils_suite ();
/* If CK_VERBOSITY is set, use that, otherwise it defaults to CK_NORMAL */
srunner_free (sr);
if (number_failed == 0) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
return EXIT_FAILURE;
}