sysdb-tests.c revision 2ce00e0d3896bb42db169d1e79553a81ca837a22
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd System Database
a78048ccbdb6256da15e6b0e7e95355e480c2301nd Copyright (C) Stephen Gallagher <sgallagh@redhat.com> 2009
8928b6e739f1de5efcfa2a258f2cee76b52c6dfdgryzor This program is free software; you can redistribute it and/or modify
8928b6e739f1de5efcfa2a258f2cee76b52c6dfdgryzor it under the terms of the GNU General Public License as published by
8928b6e739f1de5efcfa2a258f2cee76b52c6dfdgryzor the Free Software Foundation; either version 3 of the License, or
a78048ccbdb6256da15e6b0e7e95355e480c2301nd (at your option) any later version.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd This program is distributed in the hope that it will be useful,
9f0c535f81304713568808c9ab2f05b75583fd16nilgun but WITHOUT ANY WARRANTY; without even the implied warranty of
9f0c535f81304713568808c9ab2f05b75583fd16nilgun MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9f0c535f81304713568808c9ab2f05b75583fd16nilgun GNU General Public License for more details.
along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdlib.h>
#include <check.h>
#include <talloc.h>
#include <tevent.h>
#include <popt.h>
#include "confdb/confdb_setup.h"
#include "db/sysdb_private.h"
#include "db/sysdb_services.h"
#include "db/sysdb_autofs.h"
struct sysdb_test_ctx {
char *conf_db;
int ret;
return EFAULT;
return ENOMEM;
return EIO;
return ENOMEM;
return ret;
return ret;
return ret;
return ret;
return ret;
return ret;
return EOK;
struct test_data {
const char *username;
const char *groupname;
const char *netgrname;
const char *autofsmapname;
const char *shell;
bool finished;
int error;
const char **attrlist;
char **memberlist;
char *homedir;
char *gecos;
int ret;
return ret;
char *homedir;
char *gecos;
int ret;
return ret;
int ret;
return ret;
int ret;
return ret;
int ret;
return ret;
int ret;
return ret;
int ret;
return ret;
int ret;
return ret;
int ret;
return ret;
int ret;
return ret;
int ret;
return ret;
int ret;
return ret;
const char *username;
int ret;
return ENOMEM;
return ret;
const char *username;
int ret;
return ENOMEM;
return ret;
char *object_name;
int ret;
if (!object_name) {
return ENOMEM;
return ret;
int ret;
return ret;
int ret;
return ENOMEM;
return ret;
int ret;
if (!dn) {
return ENOMEM;
return ret;
int ret;
char *member;
if (!attrs) {
return ENOMEM;
if (!member) {
return ENOMEM;
return ret;
return ret;
int ret;
char *member;
if (!attrs) {
return ENOMEM;
if (!member) {
return ENOMEM;
return ret;
return ret;
return ret;
const char *description;
int ret;
return ret;
int ret;
return ret;
int ret;
return ret;
int ret;
const char *description;
if (!attrs) {
return ENOMEM;
if (ret) {
return ret;
return ret;
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
char *membername;
int ret;
const char *username;
int ret;
if (ret) {
goto done;
goto done;
if (ret) {
goto done;
done:
const char *groupname;
int ret;
if (ret) {
goto done;
goto done;
if (ret) {
goto done;
done:
const char *e_groupname;
const char *groupname;
int ret;
if (ret) {
goto done;
goto done;
done:
const char *e_username;
const char *username;
int ret;
if (ret) {
goto done;
goto done;
done:
int ret;
&res);
int ret;
&res);
int ret;
const char *attrval;
char *username;
int ret;
if (ret) {
goto done;
done:
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
char *object_name;
int ret;
int ret;
char *object_name;
int ret;
int ret;
int ret;
const char *password,
int expected_result)
int ret;
0, expire_date);
const char *password,
int expected_result)
int ret;
char *username;
char *username;
char *username;
int ret;
int ret;
char *gid_str;
for (i = 0; i < msgs_count; i++) {
int ret;
char *uid_str;
int ret;
int ret;
int ret;
if (_i == 0) {
int ret;
if (_i == 0) {
int ret;
if (_i == 0) {
char *ghostname;
int ret;
char *ghostname_del;
char *ghostname_add;
int ret;
char *ghostname_rep;
char *ghostname_del;
char *ghostname_check;
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
int ret;
char *ghostname;
int ret;
int ret, j;
char *expected;
int ret;
int ret;
if (exp_gh < 0) {
exp_gh = 0;
if (exp_gh) {
char *ghostname_del;
char *ghostname_add;
int ret;
char *ghostname_del;
char *ghostname_add;
int ret;
int ret;
char **list;
list[0]);
const char *name;
goto done;
goto done;
done:
const char *name;
goto done;
goto done;
done:
char **add_groups;
char **del_groups;
(const char *const *)add_groups,
(const char *const *)del_groups);
int ret;
const char *groupname;
char *parsed;
int ret;
int ret;
const char *netgrname;
int ret;
int ret;
int ret;
int ret;
const char *description;
const char *netgrname;
const char *attrval;
const char *received_user;
const char *received_group;
bool by_name,
const char *primary_name,
int port,
const char **aliases,
const char **protocols)
bool matched;
const char *ret_name;
int ret_port;
if (by_name) {
matched = false;
for (j = 0; aliases[j]; j++) {
matched = true;
matched = false;
for (j = 0; protocols[j]; j++) {
matched = true;
const char *primary_name,
int port,
const char **aliases,
const char **protocols,
char *primary_name;
const char **aliases;
const char **protocols;
NULL);
const char **aliases;
const char **protocols;
const char *alias);
const char **aliases;
const char **protocols;
NULL);
bool enumerated;
&enumerated);
const char *filter;
"name=subdomuser,cn=users,cn=test.sub,cn=sysdb");
"name=subdomuser,cn=users,cn=test.sub,cn=sysdb");
"name=subdomgroup,cn=groups,cn=test.sub,cn=sysdb");
&msg);
#ifdef BUILD_AUTOFS
const char *autofsmapname;
const char *autofsmapname;
const char *autofsmapname;
const char *autofsmapname;
const char *autofsmapname;
const char *autofskey;
const char *autofsval;
int ii;
const char *autofsmapname;
const char *autofsmapname;
const char *autofskey;
const char *autofsval;
const char *autofskey;
NULL };
const char *filter;
#ifdef BUILD_AUTOFS
int opt;
int ret;
int failure_count;
int no_cleanup = 0;
switch(opt) {
return EXIT_FAILURE;
return EXIT_FAILURE;
return EXIT_FAILURE;
return EXIT_SUCCESS;
return EXIT_FAILURE;