r22230: Let's just cast here, the 2 calls have different allocation mechanisms.
authorSimo Sorce <idra@samba.org>
Sun, 15 Apr 2007 23:58:39 +0000 (23:58 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:19:21 +0000 (12:19 -0500)
We just let domname and name hang on the mem ctx until the call returns,
and the context will be destroyed.

Simo.

source/nsswitch/idmap.c

index dac1eb0521ee982760b848537da5270518ce10c2..885950830eb6ab6e4e3dc7d85b878dbe5f85f886 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 */