Let's just cast here, the 2 calls have different allocation mechanisms.
authoridra <idra@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Sun, 15 Apr 2007 23:58:39 +0000 (23:58 +0000)
committeridra <idra@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Sun, 15 Apr 2007 23:58:39 +0000 (23:58 +0000)
We just let domname and name hang on the mem ctx until the call returns,
and the context will be destroyed.

Simo.

git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_3_0@22230 0c0555d6-39d7-0310-84fc-f1cc0bd64818

source/nsswitch/idmap.c

index dac1eb0..8859508 100644 (file)
@@ -811,7 +811,7 @@ static NTSTATUS idmap_new_mapping(TALLOC_CTX *ctx, struct id_map *map)
 {
        NTSTATUS ret;
        struct idmap_domain *dom;
-       const char *domname, *name;
+       char *domname, *name;
        enum lsa_SidType sid_type;
        BOOL wbret;
 
@@ -825,14 +825,16 @@ static NTSTATUS idmap_new_mapping(TALLOC_CTX *ctx, struct id_map *map)
                /* by default calls to winbindd are disabled
                   the following call will not recurse so this is safe */
                winbind_on();
-               wbret = winbind_lookup_sid(ctx, map->sid, &domname, &name, &sid_type);
+               wbret = winbind_lookup_sid(ctx, map->sid,
+                                               (const char **)&domname,
+                                               (const char **)&name,
+                                               &sid_type);
                winbind_off();
        } else {
-               char *tmp_dom, *tmp_name;
-               wbret = winbindd_lookup_name_by_sid(ctx, map->sid, &tmp_dom,
-                                                   &tmp_name, &sid_type);
-               domname = tmp_dom;
-               name = tmp_name;
+               wbret = winbindd_lookup_name_by_sid(ctx, map->sid,
+                                                       &domname,
+                                                       &name,
+                                                       &sid_type);
        }
 
        /* check if this is a valid SID and then map it */