summaryrefslogtreecommitdiffstats
path: root/ini
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2010-12-20 19:28:43 -0500
committerStephen Gallagher <sgallagh@redhat.com>2010-12-21 11:16:09 -0500
commitd83a94bc34b995789e038174a3b878c2f28e694d (patch)
tree62e70706a45412ffd641b94e4ff8e7a02be4a58b /ini
parent0c08053b6a7ebca2401a67a5beb16be8fa0665c7 (diff)
downloadding-libs-d83a94bc34b995789e038174a3b878c2f28e694d.tar.gz
ding-libs-d83a94bc34b995789e038174a3b878c2f28e694d.tar.xz
ding-libs-d83a94bc34b995789e038174a3b878c2f28e694d.zip
Additional tests
I investigated the coverity issue 10043. Reading code did not reveal the issue. I added the test just to be sure and ran valgrind again. It does not seem to leak despite the Coverity concerns.
Diffstat (limited to 'ini')
-rw-r--r--ini/ini.d/real.conf1
-rw-r--r--ini/ini_config_ut.c42
2 files changed, 43 insertions, 0 deletions
diff --git a/ini/ini.d/real.conf b/ini/ini.d/real.conf
index c426ec5..4d5a319 100644
--- a/ini/ini.d/real.conf
+++ b/ini/ini.d/real.conf
@@ -32,6 +32,7 @@ command = ./sbin/sssd_info
[domains]
domainsOrder = , LOCAL, , EXAMPLE.COM, , SOMEOTHER.COM , ,
+badarray = , , , , ,
[domains/LOCAL]
description = Reserved domain for local configurations
diff --git a/ini/ini_config_ut.c b/ini/ini_config_ut.c
index 79c4738..cbd4d4f 100644
--- a/ini/ini_config_ut.c
+++ b/ini/ini_config_ut.c
@@ -946,6 +946,48 @@ int get_test(void)
free_string_config_array(strarray);
+ /**********************************************************/
+
+ COLOUT(printf("Get bad string array \n"));
+
+ item = NULL;
+ error = get_config_item("domains", "badarray", ini_config, &item);
+ if(error) {
+ printf("Expected success but got error! %d\n",error);
+ free_ini_config(ini_config);
+ return error;
+ }
+
+ /* Item should be found */
+ if (item == NULL) {
+ printf("Expected success but got NULL.\n");
+ free_ini_config(ini_config);
+ return -1;
+ }
+
+ COLOUT(col_debug_item(item));
+
+ COLOUT(printf("Get bad str array without size.\n"));
+
+ error = 0;
+ strarray = get_string_config_array(item, ",", NULL, &error);
+ if (error) {
+ printf("Expect success got error %d.\n", error);
+ free_ini_config(ini_config);
+ return error;
+ }
+
+ /* Can be used with this cycle */
+ strptr = strarray;
+ while (*strptr != NULL) {
+ COLOUT(printf("[%s]\n",*strptr));
+ strptr++;
+ }
+
+ free_string_config_array(strarray);
+
+ /**********************************************************/
+
COLOUT(printf("Get long array item\n"));
item = NULL;