Re: [Freeipa-devel] [PATCHES 145-148] ipa-kdb: add unit-test for filter_logon_info()

2015-07-07 Thread Tomas Babej


On 07/07/2015 03:49 PM, Sumit Bose wrote:
 On Tue, May 26, 2015 at 01:36:35PM +0200, Martin Kosek wrote:
 On 05/26/2015 01:33 PM, Sumit Bose wrote:
 Hi,

 these patches add some unit tests and some additional improvements
 related to the issues described in
 https://bugzilla.redhat.com/show_bug.cgi?id=1222475 . The original issue
 is fixed by a patch from Alexander attached to the ticket.

 The first patch converts the existing check-based test to cmocka. If I
 see it correctly all check-based test are converted now.

 Cool! Before pushing, we should also reference ticket
 https://fedorahosted.org/freeipa/ticket/4922
 in the patch (no need to rebase right now).


 The second adds tests for filter_logon_info() where the original issue
 occurred. The wrong behavior in filter_logon_info() caused a crash in
 dom_sid_string() which is made a bit more robust together with
 string_to_sid() in the 3rd patch. The last patch add unit tests for
 those two calls as well.
 
 New version rebased on one-way trust patches attached.
 
 Please note that the unit-test will fail with the initial version of the
 one-way trust patches which does not allow an empty group list in the
 PAC.
 
 bye,
 Sumit
 
 
 

ACK.

Pushed to master: 5017726ebaf6eea3dedb1325efe00c0d6c4b6187

Tomas

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCHES 145-148] ipa-kdb: add unit-test for filter_logon_info()

2015-07-07 Thread Sumit Bose
On Tue, May 26, 2015 at 01:36:35PM +0200, Martin Kosek wrote:
 On 05/26/2015 01:33 PM, Sumit Bose wrote:
 Hi,
 
 these patches add some unit tests and some additional improvements
 related to the issues described in
 https://bugzilla.redhat.com/show_bug.cgi?id=1222475 . The original issue
 is fixed by a patch from Alexander attached to the ticket.
 
 The first patch converts the existing check-based test to cmocka. If I
 see it correctly all check-based test are converted now.
 
 Cool! Before pushing, we should also reference ticket
 https://fedorahosted.org/freeipa/ticket/4922
 in the patch (no need to rebase right now).
 
 
 The second adds tests for filter_logon_info() where the original issue
 occurred. The wrong behavior in filter_logon_info() caused a crash in
 dom_sid_string() which is made a bit more robust together with
 string_to_sid() in the 3rd patch. The last patch add unit tests for
 those two calls as well.

New version rebased on one-way trust patches attached.

Please note that the unit-test will fail with the initial version of the
one-way trust patches which does not allow an empty group list in the
PAC.

bye,
Sumit
From 4a31cfdd848e0ef51ee32817e634340d1e90c97f Mon Sep 17 00:00:00 2001
From: Sumit Bose sb...@redhat.com
Date: Wed, 20 May 2015 18:31:19 +0200
Subject: [PATCH 145/148] ipa-kdb: convert test to cmocka

---
 daemons/ipa-kdb/Makefile.am   |   6 +-
 daemons/ipa-kdb/tests/ipa_kdb_tests.c | 129 --
 2 files changed, 48 insertions(+), 87 deletions(-)

diff --git a/daemons/ipa-kdb/Makefile.am b/daemons/ipa-kdb/Makefile.am
index 
80747491f8315a9cb0b38965423ba5d160946278..a4ea366b01b248d3f0fbc0b694e02d00c2e4c3d1
 100644
--- a/daemons/ipa-kdb/Makefile.am
+++ b/daemons/ipa-kdb/Makefile.am
@@ -55,7 +55,7 @@ ipadb_la_LIBADD = \
$(NSS_LIBS) \
$(NULL)
 
-if HAVE_CHECK
+if HAVE_CMOCKA
 TESTS = ipa_kdb_tests
 check_PROGRAMS = ipa_kdb_tests
 endif
@@ -73,9 +73,9 @@ ipa_kdb_tests_SOURCES =\
ipa_kdb_audit_as.c  \
$(KRB5_UTIL_SRCS)   \
$(NULL)
-ipa_kdb_tests_CFLAGS = $(CHECK_CFLAGS)
+ipa_kdb_tests_CFLAGS = $(CMOCKA_CFLAGS)
 ipa_kdb_tests_LDADD =  \
-   $(CHECK_LIBS)   \
+   $(CMOCKA_LIBS)  \
$(KRB5_LIBS)\
$(LDAP_LIBS)\
$(NDRPAC_LIBS)  \
diff --git a/daemons/ipa-kdb/tests/ipa_kdb_tests.c 
b/daemons/ipa-kdb/tests/ipa_kdb_tests.c
index 
e1ae06a6e359e65873241116581f028f1a4e1bf3..1ff1cd49a4e409545ee908f0f7842520ae82e0a0
 100644
--- a/daemons/ipa-kdb/tests/ipa_kdb_tests.c
+++ b/daemons/ipa-kdb/tests/ipa_kdb_tests.c
@@ -1,49 +1,30 @@
-/** 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 sb...@redhat.com
- *
- * Copyright (C) 2013 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
+/*
+Authors:
+Sumit Bose sb...@redhat.com
 
-#include check.h
-#include stdlib.h
+Copyright (C) 2015 Red Hat
+
+ipa-kdb tests
+
+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
+

[Freeipa-devel] [PATCHES 145-148] ipa-kdb: add unit-test for filter_logon_info()

2015-05-26 Thread Sumit Bose
Hi,

these patches add some unit tests and some additional improvements
related to the issues described in
https://bugzilla.redhat.com/show_bug.cgi?id=1222475 . The original issue
is fixed by a patch from Alexander attached to the ticket.

The first patch converts the existing check-based test to cmocka. If I
see it correctly all check-based test are converted now.

The second adds tests for filter_logon_info() where the original issue
occurred. The wrong behavior in filter_logon_info() caused a crash in
dom_sid_string() which is made a bit more robust together with
string_to_sid() in the 3rd patch. The last patch add unit tests for
those two calls as well.

bye,
Sumit
From ddd3ac0a38521ae9450f9dee46fbd8434ac85870 Mon Sep 17 00:00:00 2001
From: Sumit Bose sb...@redhat.com
Date: Wed, 20 May 2015 18:31:19 +0200
Subject: [PATCH 145/148] ipa-kdb: convert test to cmocka

---
 daemons/ipa-kdb/Makefile.am   |   6 +-
 daemons/ipa-kdb/tests/ipa_kdb_tests.c | 129 --
 2 files changed, 48 insertions(+), 87 deletions(-)

diff --git a/daemons/ipa-kdb/Makefile.am b/daemons/ipa-kdb/Makefile.am
index 
80747491f8315a9cb0b38965423ba5d160946278..a4ea366b01b248d3f0fbc0b694e02d00c2e4c3d1
 100644
--- a/daemons/ipa-kdb/Makefile.am
+++ b/daemons/ipa-kdb/Makefile.am
@@ -55,7 +55,7 @@ ipadb_la_LIBADD = \
$(NSS_LIBS) \
$(NULL)
 
-if HAVE_CHECK
+if HAVE_CMOCKA
 TESTS = ipa_kdb_tests
 check_PROGRAMS = ipa_kdb_tests
 endif
@@ -73,9 +73,9 @@ ipa_kdb_tests_SOURCES =\
ipa_kdb_audit_as.c  \
$(KRB5_UTIL_SRCS)   \
$(NULL)
-ipa_kdb_tests_CFLAGS = $(CHECK_CFLAGS)
+ipa_kdb_tests_CFLAGS = $(CMOCKA_CFLAGS)
 ipa_kdb_tests_LDADD =  \
-   $(CHECK_LIBS)   \
+   $(CMOCKA_LIBS)  \
$(KRB5_LIBS)\
$(LDAP_LIBS)\
$(NDRPAC_LIBS)  \
diff --git a/daemons/ipa-kdb/tests/ipa_kdb_tests.c 
b/daemons/ipa-kdb/tests/ipa_kdb_tests.c
index 
e1ae06a6e359e65873241116581f028f1a4e1bf3..1ff1cd49a4e409545ee908f0f7842520ae82e0a0
 100644
--- a/daemons/ipa-kdb/tests/ipa_kdb_tests.c
+++ b/daemons/ipa-kdb/tests/ipa_kdb_tests.c
@@ -1,49 +1,30 @@
-/** 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 sb...@redhat.com
- *
- * Copyright (C) 2013 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
+/*
+Authors:
+Sumit Bose sb...@redhat.com
 
-#include check.h
-#include stdlib.h
+Copyright (C) 2015 Red Hat
+
+ipa-kdb tests
+
+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/.
+*/
+
+#include errno.h
 #include stdarg.h
-#include stdio.h
-#include stdbool.h
-#include krb5/krb5.h
-#include kdb.h
+#include stddef.h
+#include setjmp.h
+#include cmocka.h
 
 #include ipa-kdb/ipa_kdb.h
 
@@ -74,7 +55,7 @@ int 

Re: [Freeipa-devel] [PATCHES 145-148] ipa-kdb: add unit-test for filter_logon_info()

2015-05-26 Thread Martin Kosek

On 05/26/2015 01:33 PM, Sumit Bose wrote:

Hi,

these patches add some unit tests and some additional improvements
related to the issues described in
https://bugzilla.redhat.com/show_bug.cgi?id=1222475 . The original issue
is fixed by a patch from Alexander attached to the ticket.

The first patch converts the existing check-based test to cmocka. If I
see it correctly all check-based test are converted now.


Cool! Before pushing, we should also reference ticket
https://fedorahosted.org/freeipa/ticket/4922
in the patch (no need to rebase right now).



The second adds tests for filter_logon_info() where the original issue
occurred. The wrong behavior in filter_logon_info() caused a crash in
dom_sid_string() which is made a bit more robust together with
string_to_sid() in the 3rd patch. The last patch add unit tests for
those two calls as well.

bye,
Sumit




--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code