Steve saw a crash on 64-bit system and pointed me to the right direction.
Here is the correcting patch.
Worked fine of 32-bit...

Thanks
Dmitri

Dmitri Pal wrote:
> Hello,
>
> The following patches introduce the meta data interface as it was
> discussed earlier on the list.
> The whole work is split into 4 patches.
> It is done just for simplicity of the review.
> Each of the patches applies and runs on top of previous one.
> As I developed I saw some issues with the code so I corrected them
> (mostly in the last patch).
> The names of the patches speck for themselves.
> The comments in the patches are pretty thorough.
>
> Tickets addressed by the effort (tickets are not updated yet with some
> comments about the alternative ways the patches solve the problem
> expressed in the ticket):
> https://fedorahosted.org/sssd/ticket/405 <- interfaces now allow the
> caller to do it.
> https://fedorahosted.org/sssd/ticket/442 <- done
> https://fedorahosted.org/sssd/ticket/173 <- done differently but now
> available to the caller
> https://fedorahosted.org/sssd/ticket/82 <-security checks interfaces are
> added. The recommended approach is presented in the unit test.
> https://fedorahosted.org/sssd/ticket/140 <- the approach changed. This
> is the best we can do at the moment. But we can enhance meta data and
> add other checks as the need emerges.
>
> It still does not fix the lines collection. It just turns off the
> creation of it.
> I just do not know what to do with the lines collcetion at the moment.
> It will be needed for the grammar validation but until this part is
> built I am not sure which format for it is the best.
> So I know it will be needed but it is not needed now. Thus it is ifdefed
> at the moment.
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> sssd-devel mailing list
> sssd-devel@lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/sssd-devel


-- 
Thank you,
Dmitri Pal

Engineering Manager IPA project,
Red Hat Inc.


-------------------------------
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/

From ca87c0aa2343210fd37d7cd3c9cf2dbe730c2704 Mon Sep 17 00:00:00 2001
From: Dmitri Pal <d...@redhat.com>
Date: Tue, 6 Apr 2010 17:21:37 -0400
Subject: [PATCH] [INI] Fixing crash detected on 64-bit system

This patch corrects original code to be
more on the safe side and check parameters
before using.
Instead of dereferencing metadata it is now
passed as reference to the next level.
It is not used there yet so no other new changes
needed so far.
---
 common/ini/ini_config.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/common/ini/ini_config.c b/common/ini/ini_config.c
index 60fffba..1bfc46f 100644
--- a/common/ini/ini_config.c
+++ b/common/ini/ini_config.c
@@ -583,7 +583,7 @@ static int config_with_metadata(const char *application,
                                 int error_level,
                                 struct collection_item **error_list,
                                 uint32_t metaflags,
-                                struct collection_item *metadata)
+                                struct collection_item **metadata)
 {
     int error;
     int created = 0;
@@ -733,15 +733,17 @@ int config_from_fd_with_metadata(const char *application,
     }
 
 
-    /* Collect meta data before actually parsing the file */
-    error = collect_metadata(metaflags,
-                             metadata,
-                             config_file,
-                             abs_name);
-    if(error) {
-        TRACE_ERROR_NUMBER("Failed to collect metadata", error);
-        fclose(config_file);
-        return error;
+    if (metadata) {
+        /* Collect meta data before actually parsing the file */
+        error = collect_metadata(metaflags,
+                                 metadata,
+                                 config_file,
+                                 abs_name);
+        if(error) {
+            TRACE_ERROR_NUMBER("Failed to collect metadata", error);
+            fclose(config_file);
+            return error;
+        }
     }
 
     if (!(metaflags & INI_META_ACTION_NOPARSE)) {
@@ -753,7 +755,7 @@ int config_from_fd_with_metadata(const char *application,
                                      error_level,
                                      error_list,
                                      metaflags,
-                                     *metadata);
+                                     metadata);
     }
 
     /* We opened the file we close it */
-- 
1.5.5.6

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to