krb5_utils-tests.c revision daa53f46d3ddcba0cbe2d23251c250794e576cf1
/*
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 *testpath;
char *dirname;
char *subdirname;
char *filename;
"while x-bit is missing.");
}
{
int ret;
char *cwd;
char *dirname;
char *subdirname;
char *filename;
"does not failed with EINVAL.");
}
{
int ret;
char *cwd;
char *testpath;
char *dirname;
char *subdir;
char *filename;
"while x-bit is missing.");
}
{
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);
}
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, const bool expected_private_path)
{
char *result;
int ret;
bool private_path = false;
&private_path);
"Expansion failed, result [%s], expected [%s].",
"Unexprected private path, get [%s], expected [%s].",
}
{
}
{
}
{
}
{
}
{
}
{
}
{
char *result;
int ret;
bool private_path = false;
&private_path);
fail_unless(private_path == false,
"Unexprected private path, get [%s], expected [%s].",
}
{
char *result;
int ret;
bool private_path = false;
&private_path);
fail_unless(private_path == false,
"Unexprected private path, get [%s], expected [%s].",
}
{
}
{
char *result;
int ret;
bool private_path = false;
&private_path);
&private_path);
fail_unless(private_path == false,
"Unexprected private path, get [%s], expected [%s].",
}
{
char *test_template = NULL;
char *result;
bool private_path = false;
&private_path);
fail_unless(private_path == false,
"Unexprected private path, get [%s], expected [%s].",
}
{
const char *test_template = BASE;
char *result;
bool private_path = false;
&private_path);
"Expansion failed, result [%s], expected [%s].",
fail_unless(private_path == false,
"Unexprected private path, get [%s], expected [%s].",
}
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[] = {
};
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;
}