summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2015-02-09 18:12:01 +0100
committerMartin Kosek <mkosek@redhat.com>2015-03-18 13:33:38 +0100
commitd0d79ada379ab809c26a7dc0bbc88b47ab85f744 (patch)
treef7217ef06e1e96518b65619eb4de532fa76a66a0
parent6ce47d86db77373b15bb62a92b22dd2accc74b37 (diff)
downloadfreeipa-d0d79ada379ab809c26a7dc0bbc88b47ab85f744.tar.gz
freeipa-d0d79ada379ab809c26a7dc0bbc88b47ab85f744.tar.xz
freeipa-d0d79ada379ab809c26a7dc0bbc88b47ab85f744.zip
extdom: migrate check-based test to cmocka
Besides moving the existing tests to cmocka two new tests are added which were missing from the old tests. Related to https://fedorahosted.org/freeipa/ticket/4922 Reviewed-By: Jakub Hrozek <jhrozek@redhat.com>
-rw-r--r--daemons/ipa-slapi-plugins/ipa-extdom-extop/Makefile.am20
-rw-r--r--daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom.h14
-rw-r--r--daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_cmocka_tests.c156
-rw-r--r--daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c28
-rw-r--r--daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_tests.c203
5 files changed, 176 insertions, 245 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/Makefile.am b/daemons/ipa-slapi-plugins/ipa-extdom-extop/Makefile.am
index a1679812e..9c2fa1c6a 100644
--- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/Makefile.am
+++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/Makefile.am
@@ -38,11 +38,6 @@ libipa_extdom_extop_la_LIBADD = \
TESTS =
check_PROGRAMS =
-if HAVE_CHECK
-TESTS += extdom_tests
-check_PROGRAMS += extdom_tests
-endif
-
if HAVE_CMOCKA
if HAVE_NSS_WRAPPER
TESTS_ENVIRONMENT = . ./test_data/test_setup.sh;
@@ -51,21 +46,6 @@ check_PROGRAMS += extdom_cmocka_tests
endif
endif
-extdom_tests_SOURCES = \
- ipa_extdom_tests.c \
- ipa_extdom_common.c \
- $(NULL)
-extdom_tests_CFLAGS = $(CHECK_CFLAGS)
-extdom_tests_LDFLAGS = \
- -rpath $(shell pkg-config --libs-only-L dirsrv | sed -e 's/-L//') \
- $(NULL)
-extdom_tests_LDADD = \
- $(CHECK_LIBS) \
- $(LDAP_LIBS) \
- $(DIRSRV_LIBS) \
- $(SSSNSSIDMAP_LIBS) \
- $(NULL)
-
extdom_cmocka_tests_SOURCES = \
ipa_extdom_cmocka_tests.c \
ipa_extdom_common.c \
diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom.h b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom.h
index 0d5d55d2f..65dd43ea3 100644
--- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom.h
+++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom.h
@@ -185,5 +185,19 @@ int getgrnam_r_wrapper(size_t buf_max, const char *name,
struct group *grp, char **_buf, size_t *_buf_len);
int getgrgid_r_wrapper(size_t buf_max, gid_t gid,
struct group *grp, char **_buf, size_t *_buf_len);
+int pack_ber_sid(const char *sid, struct berval **berval);
+int pack_ber_name(const char *domain_name, const char *name,
+ struct berval **berval);
+int pack_ber_user(struct ipa_extdom_ctx *ctx,
+ enum response_types response_type,
+ const char *domain_name, const char *user_name,
+ uid_t uid, gid_t gid,
+ const char *gecos, const char *homedir,
+ const char *shell, struct sss_nss_kv *kv_list,
+ struct berval **berval);
+int pack_ber_group(enum response_types response_type,
+ const char *domain_name, const char *group_name,
+ gid_t gid, char **members, struct sss_nss_kv *kv_list,
+ struct berval **berval);
void set_err_msg(struct extdom_req *req, const char *format, ...);
#endif /* _IPA_EXTDOM_H_ */
diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_cmocka_tests.c b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_cmocka_tests.c
index 586b58b0f..42d588d08 100644
--- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_cmocka_tests.c
+++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_cmocka_tests.c
@@ -213,30 +213,46 @@ void test_getgrgid_r_wrapper(void **state)
free(buf);
}
+struct test_data {
+ struct extdom_req *req;
+ struct ipa_extdom_ctx *ctx;
+};
+
void extdom_req_setup(void **state)
{
- struct extdom_req *req;
+ struct test_data *test_data;
+
+ test_data = calloc(sizeof(struct test_data), 1);
+ assert_non_null(test_data);
+
+ test_data->req = calloc(sizeof(struct extdom_req), 1);
+ assert_non_null(test_data->req);
- req = calloc(sizeof(struct extdom_req), 1);
- assert_non_null(req);
+ test_data->ctx = calloc(sizeof(struct ipa_extdom_ctx), 1);
+ assert_non_null(test_data->req);
- *state = req;
+ *state = test_data;
}
void extdom_req_teardown(void **state)
{
- struct extdom_req *req;
+ struct test_data *test_data;
- req = (struct extdom_req *) *state;
+ test_data = (struct test_data *) *state;
- free_req_data(req);
+ free_req_data(test_data->req);
+ free(test_data->ctx);
+ free(test_data);
}
void test_set_err_msg(void **state)
{
struct extdom_req *req;
+ struct test_data *test_data;
+
+ test_data = (struct test_data *) *state;
+ req = test_data->req;
- req = (struct extdom_req *) *state;
assert_null(req->err_msg);
set_err_msg(NULL, NULL);
@@ -254,6 +270,127 @@ void test_set_err_msg(void **state)
assert_string_equal(req->err_msg, "Test [ABCD][1234].");
}
+#define TEST_SID "S-1-2-3-4"
+#define TEST_DOMAIN_NAME "DOMAIN"
+
+char res_sid[] = {0x30, 0x0e, 0x0a, 0x01, 0x01, 0x04, 0x09, 0x53, 0x2d, 0x31, \
+ 0x2d, 0x32, 0x2d, 0x33, 0x2d, 0x34};
+char res_nam[] = {0x30, 0x13, 0x0a, 0x01, 0x02, 0x30, 0x0e, 0x04, 0x06, 0x44, \
+ 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x04, 0x04, 0x74, 0x65, 0x73, \
+ 0x74};
+char res_uid[] = {0x30, 0x1c, 0x0a, 0x01, 0x03, 0x30, 0x17, 0x04, 0x06, 0x44, \
+ 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x04, 0x04, 0x74, 0x65, 0x73, \
+ 0x74, 0x02, 0x02, 0x30, 0x39, 0x02, 0x03, 0x00, 0xd4, 0x31};
+char res_gid[] = {0x30, 0x1e, 0x0a, 0x01, 0x04, 0x30, 0x19, 0x04, 0x06, 0x44, \
+ 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x04, 0x0a, 0x74, 0x65, 0x73, \
+ 0x74, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x02, 0x03, 0x00, \
+ 0xd4, 0x31};
+
+void test_encode(void **state)
+{
+ int ret;
+ struct berval *resp_val;
+ struct ipa_extdom_ctx *ctx;
+ struct test_data *test_data;
+
+ test_data = (struct test_data *) *state;
+ ctx = test_data->ctx;
+
+ ctx->max_nss_buf_size = (128*1024*1024);
+
+ ret = pack_ber_sid(TEST_SID, &resp_val);
+ assert_int_equal(ret, LDAP_SUCCESS);
+ assert_int_equal(sizeof(res_sid), resp_val->bv_len);
+ assert_memory_equal(res_sid, resp_val->bv_val, resp_val->bv_len);
+ ber_bvfree(resp_val);
+
+ ret = pack_ber_name(TEST_DOMAIN_NAME, "test", &resp_val);
+ assert_int_equal(ret, LDAP_SUCCESS);
+ assert_int_equal(sizeof(res_nam), resp_val->bv_len);
+ assert_memory_equal(res_nam, resp_val->bv_val, resp_val->bv_len);
+ ber_bvfree(resp_val);
+
+ ret = pack_ber_user(ctx, RESP_USER, TEST_DOMAIN_NAME, "test", 12345, 54321,
+ NULL, NULL, NULL, NULL, &resp_val);
+ assert_int_equal(ret, LDAP_SUCCESS);
+ assert_int_equal(sizeof(res_uid), resp_val->bv_len);
+ assert_memory_equal(res_uid, resp_val->bv_val, resp_val->bv_len);
+ ber_bvfree(resp_val);
+
+ ret = pack_ber_group(RESP_GROUP, TEST_DOMAIN_NAME, "test_group", 54321,
+ NULL, NULL, &resp_val);
+ assert_int_equal(ret, LDAP_SUCCESS);
+ assert_int_equal(sizeof(res_gid), resp_val->bv_len);
+ assert_memory_equal(res_gid, resp_val->bv_val, resp_val->bv_len);
+ ber_bvfree(resp_val);
+}
+
+char req_sid[] = {0x30, 0x11, 0x0a, 0x01, 0x01, 0x0a, 0x01, 0x01, 0x04, 0x09, \
+ 0x53, 0x2d, 0x31, 0x2d, 0x32, 0x2d, 0x33, 0x2d, 0x34};
+char req_nam[] = {0x30, 0x16, 0x0a, 0x01, 0x02, 0x0a, 0x01, 0x01, 0x30, 0x0e, \
+ 0x04, 0x06, 0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x04, 0x04, \
+ 0x74, 0x65, 0x73, 0x74};
+char req_uid[] = {0x30, 0x14, 0x0a, 0x01, 0x03, 0x0a, 0x01, 0x01, 0x30, 0x0c, \
+ 0x04, 0x06, 0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x02, 0x02, \
+ 0x30, 0x39};
+char req_gid[] = {0x30, 0x15, 0x0a, 0x01, 0x04, 0x0a, 0x01, 0x01, 0x30, 0x0d, \
+ 0x04, 0x06, 0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x02, 0x03, \
+ 0x00, 0xd4, 0x31};
+
+void test_decode(void **state)
+{
+ struct berval req_val;
+ struct extdom_req *req;
+ int ret;
+
+ req_val.bv_val = req_sid;
+ req_val.bv_len = sizeof(req_sid);
+
+ ret = parse_request_data(&req_val, &req);
+
+ assert_int_equal(ret, LDAP_SUCCESS);
+ assert_int_equal(req->input_type, INP_SID);
+ assert_int_equal(req->request_type, REQ_SIMPLE);
+ assert_string_equal(req->data.sid, "S-1-2-3-4");
+ free_req_data(req);
+
+ req_val.bv_val = req_nam;
+ req_val.bv_len = sizeof(req_nam);
+
+ ret = parse_request_data(&req_val, &req);
+
+ assert_int_equal(ret, LDAP_SUCCESS);
+ assert_int_equal(req->input_type, INP_NAME);
+ assert_int_equal(req->request_type, REQ_SIMPLE);
+ assert_string_equal(req->data.name.domain_name, "DOMAIN");
+ assert_string_equal(req->data.name.object_name, "test");
+ free_req_data(req);
+
+ req_val.bv_val = req_uid;
+ req_val.bv_len = sizeof(req_uid);
+
+ ret = parse_request_data(&req_val, &req);
+
+ assert_int_equal(ret, LDAP_SUCCESS);
+ assert_int_equal(req->input_type, INP_POSIX_UID);
+ assert_int_equal(req->request_type, REQ_SIMPLE);
+ assert_string_equal(req->data.posix_uid.domain_name, "DOMAIN");
+ assert_int_equal(req->data.posix_uid.uid, 12345);
+ free_req_data(req);
+
+ req_val.bv_val = req_gid;
+ req_val.bv_len = sizeof(req_gid);
+
+ ret = parse_request_data(&req_val, &req);
+
+ assert_int_equal(ret, LDAP_SUCCESS);
+ assert_int_equal(req->input_type, INP_POSIX_GID);
+ assert_int_equal(req->request_type, REQ_SIMPLE);
+ assert_string_equal(req->data.posix_gid.domain_name, "DOMAIN");
+ assert_int_equal(req->data.posix_gid.gid, 54321);
+ free_req_data(req);
+}
+
int main(int argc, const char *argv[])
{
const UnitTest tests[] = {
@@ -263,6 +400,9 @@ int main(int argc, const char *argv[])
unit_test(test_getgrgid_r_wrapper),
unit_test_setup_teardown(test_set_err_msg,
extdom_req_setup, extdom_req_teardown),
+ unit_test_setup_teardown(test_encode,
+ extdom_req_setup, extdom_req_teardown),
+ unit_test(test_decode),
};
return run_tests(tests);
diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
index 4452d456b..2c08e56d6 100644
--- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
+++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
@@ -464,7 +464,7 @@ static int add_kv_list(BerElement *ber, struct sss_nss_kv *kv_list)
return LDAP_SUCCESS;
}
-static int pack_ber_sid(const char *sid, struct berval **berval)
+int pack_ber_sid(const char *sid, struct berval **berval)
{
BerElement *ber = NULL;
int ret;
@@ -491,13 +491,13 @@ static int pack_ber_sid(const char *sid, struct berval **berval)
#define SSSD_SYSDB_SID_STR "objectSIDString"
-static int pack_ber_user(struct ipa_extdom_ctx *ctx,
- enum response_types response_type,
- const char *domain_name, const char *user_name,
- uid_t uid, gid_t gid,
- const char *gecos, const char *homedir,
- const char *shell, struct sss_nss_kv *kv_list,
- struct berval **berval)
+int pack_ber_user(struct ipa_extdom_ctx *ctx,
+ enum response_types response_type,
+ const char *domain_name, const char *user_name,
+ uid_t uid, gid_t gid,
+ const char *gecos, const char *homedir,
+ const char *shell, struct sss_nss_kv *kv_list,
+ struct berval **berval)
{
BerElement *ber = NULL;
int ret;
@@ -610,10 +610,10 @@ done:
return ret;
}
-static int pack_ber_group(enum response_types response_type,
- const char *domain_name, const char *group_name,
- gid_t gid, char **members, struct sss_nss_kv *kv_list,
- struct berval **berval)
+int pack_ber_group(enum response_types response_type,
+ const char *domain_name, const char *group_name,
+ gid_t gid, char **members, struct sss_nss_kv *kv_list,
+ struct berval **berval)
{
BerElement *ber = NULL;
int ret;
@@ -694,8 +694,8 @@ done:
return ret;
}
-static int pack_ber_name(const char *domain_name, const char *name,
- struct berval **berval)
+int pack_ber_name(const char *domain_name, const char *name,
+ struct berval **berval)
{
BerElement *ber = NULL;
int ret;
diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_tests.c b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_tests.c
deleted file mode 100644
index 1467e2566..000000000
--- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_tests.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This program is free software; you can redistribute it and/or modify
- * 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/>.
- *
- * Additional permission under GPLv3 section 7:
- *
- * In the following paragraph, "GPL" means the GNU General Public
- * License, version 3 or any later version, and "Non-GPL Code" means
- * code that is governed neither by the GPL nor a license
- * compatible with the GPL.
- *
- * You may link the code of this Program with Non-GPL Code and convey
- * linked combinations including the two, provided that such Non-GPL
- * Code only links to the code of this Program through those well
- * defined interfaces identified in the file named EXCEPTION found in
- * the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline
- * functions from the Approved Interfaces without causing the resulting
- * work to be covered by the GPL. Only the copyright holders of this
- * Program may make changes or additions to the list of Approved
- * Interfaces.
- *
- * Authors:
- * Sumit Bose <sbose@redhat.com>
- *
- * Copyright (C) 2011 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#include <check.h>
-
-#include "ipa_extdom.h"
-#include "util.h"
-
-char req_sid[] = {0x30, 0x11, 0x0a, 0x01, 0x01, 0x0a, 0x01, 0x01, 0x04, 0x09, \
- 0x53, 0x2d, 0x31, 0x2d, 0x32, 0x2d, 0x33, 0x2d, 0x34};
-char req_nam[] = {0x30, 0x16, 0x0a, 0x01, 0x02, 0x0a, 0x01, 0x01, 0x30, 0x0e, \
- 0x04, 0x06, 0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x04, 0x04, \
- 0x74, 0x65, 0x73, 0x74};
-char req_uid[] = {0x30, 0x14, 0x0a, 0x01, 0x03, 0x0a, 0x01, 0x01, 0x30, 0x0c, \
- 0x04, 0x06, 0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x02, 0x02, \
- 0x30, 0x39};
-char req_gid[] = {0x30, 0x15, 0x0a, 0x01, 0x04, 0x0a, 0x01, 0x01, 0x30, 0x0d, \
- 0x04, 0x06, 0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x02, 0x03, \
- 0x00, 0xd4, 0x31};
-
-char res_sid[] = {0x30, 0x0e, 0x0a, 0x01, 0x01, 0x04, 0x09, 0x53, 0x2d, 0x31, \
- 0x2d, 0x32, 0x2d, 0x33, 0x2d, 0x34};
-char res_nam[] = {0x30, 0x13, 0x0a, 0x01, 0x02, 0x30, 0x0e, 0x04, 0x06, 0x44, \
- 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x04, 0x04, 0x74, 0x65, 0x73, \
- 0x74};
-char res_uid[] = {0x30, 0x17, 0x0a, 0x01, 0x03, 0x30, 0x12, 0x04, 0x06, 0x44, \
- 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x04, 0x04, 0x74, 0x65, 0x73, \
- 0x74, 0x02, 0x02, 0x30, 0x39};
-char res_gid[] = {0x30, 0x1e, 0x0a, 0x01, 0x04, 0x30, 0x19, 0x04, 0x06, 0x44, \
- 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x04, 0x0a, 0x74, 0x65, 0x73, \
- 0x74, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x02, 0x03, 0x00, \
- 0xd4, 0x31};
-
-#define TEST_SID "S-1-2-3-4"
-#define TEST_DOMAIN_NAME "DOMAIN"
-
-START_TEST(test_encode)
-{
- int ret;
- struct extdom_res res;
- struct berval *resp_val;
-
- res.response_type = RESP_SID;
- res.data.sid = TEST_SID;
-
- ret = pack_response(&res, &resp_val);
-
- fail_unless(ret == LDAP_SUCCESS, "pack_response() failed.");
- fail_unless(sizeof(res_sid) == resp_val->bv_len &&
- memcmp(res_sid, resp_val->bv_val, resp_val->bv_len) == 0,
- "Unexpected BER blob.");
- ber_bvfree(resp_val);
-
- res.response_type = RESP_NAME;
- res.data.name.domain_name = TEST_DOMAIN_NAME;
- res.data.name.object_name = "test";
-
- ret = pack_response(&res, &resp_val);
-
- fail_unless(ret == LDAP_SUCCESS, "pack_response() failed.");
- fail_unless(sizeof(res_nam) == resp_val->bv_len &&
- memcmp(res_nam, resp_val->bv_val, resp_val->bv_len) == 0,
- "Unexpected BER blob.");
- ber_bvfree(resp_val);
-}
-END_TEST
-
-START_TEST(test_decode)
-{
- struct berval req_val;
- struct extdom_req *req;
- int ret;
-
- req_val.bv_val = req_sid;
- req_val.bv_len = sizeof(req_sid);
-
- ret = parse_request_data(&req_val, &req);
-
- fail_unless(ret == LDAP_SUCCESS, "parse_request_data() failed.");
- fail_unless(req->input_type == INP_SID,
- "parse_request_data() returned unexpected input type");
- fail_unless(req->request_type == REQ_SIMPLE,
- "parse_request_data() returned unexpected request type");
- fail_unless(strcmp(req->data.sid, "S-1-2-3-4") == 0,
- "parse_request_data() returned unexpected sid");
- free_req_data(req);
-
- req_val.bv_val = req_nam;
- req_val.bv_len = sizeof(req_nam);
-
- ret = parse_request_data(&req_val, &req);
-
- fail_unless(ret == LDAP_SUCCESS,
- "parse_request_data() failed.");
- fail_unless(req->input_type == INP_NAME,
- "parse_request_data() returned unexpected input type");
- fail_unless(req->request_type == REQ_SIMPLE,
- "parse_request_data() returned unexpected request type");
- fail_unless(strcmp(req->data.name.domain_name, "DOMAIN") == 0,
- "parse_request_data() returned unexpected domain name");
- fail_unless(strcmp(req->data.name.object_name, "test") == 0,
- "parse_request_data() returned unexpected object name");
- free_req_data(req);
-
- req_val.bv_val = req_uid;
- req_val.bv_len = sizeof(req_uid);
-
- ret = parse_request_data(&req_val, &req);
-
- fail_unless(ret == LDAP_SUCCESS,
- "parse_request_data() failed.");
- fail_unless(req->input_type == INP_POSIX_UID,
- "parse_request_data() returned unexpected input type");
- fail_unless(req->request_type == REQ_SIMPLE,
- "parse_request_data() returned unexpected request type");
- fail_unless(strcmp(req->data.posix_uid.domain_name, "DOMAIN") == 0,
- "parse_request_data() returned unexpected domain name");
- fail_unless(req->data.posix_uid.uid == 12345,
- "parse_request_data() returned unexpected uid [%d]",
- req->data.posix_uid.uid);
- free_req_data(req);
-
- req_val.bv_val = req_gid;
- req_val.bv_len = sizeof(req_gid);
-
- ret = parse_request_data(&req_val, &req);
-
- fail_unless(ret == LDAP_SUCCESS,
- "parse_request_data() failed.");
- fail_unless(req->input_type == INP_POSIX_GID,
- "parse_request_data() returned unexpected input type");
- fail_unless(req->request_type == REQ_SIMPLE,
- "parse_request_data() returned unexpected request type");
- fail_unless(strcmp(req->data.posix_gid.domain_name, "DOMAIN") == 0,
- "parse_request_data() returned unexpected domain name");
- fail_unless(req->data.posix_gid.gid == 54321,
- "parse_request_data() returned unexpected gid [%d]",
- req->data.posix_gid.gid);
- free_req_data(req);
-}
-END_TEST
-
-Suite * ipa_extdom_suite(void)
-{
- Suite *s = suite_create("IPA extdom");
-
- TCase *tc_core = tcase_create("Core");
- tcase_add_test(tc_core, test_decode);
- tcase_add_test(tc_core, test_encode);
- /* TODO: add test for create_response() */
- suite_add_tcase(s, tc_core);
-
- return s;
-}
-
-int main(void)
-{
- int number_failed;
-
- Suite *s = ipa_extdom_suite ();
- SRunner *sr = srunner_create (s);
- srunner_run_all (sr, CK_VERBOSE);
- number_failed = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}