s3: Use talloc_tos() in idmap_nss_sids_to_unixids
authorVolker Lendecke <vl@samba.org>
Tue, 8 Mar 2011 19:59:59 +0000 (20:59 +0100)
committerVolker Lendecke <vlendec@samba.org>
Tue, 8 Mar 2011 20:51:58 +0000 (21:51 +0100)
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue Mar  8 21:51:58 CET 2011 on sn-devel-104

source3/winbindd/idmap_nss.c

index a4ef61b37c30e92bc51ac3bce37989165f9d7f44..bfef7bb399fe5930bf818bbb48fc18ef8596d80a 100644 (file)
@@ -124,7 +124,6 @@ static NTSTATUS idmap_nss_unixids_to_sids(struct idmap_domain *dom, struct id_ma
 
 static NTSTATUS idmap_nss_sids_to_unixids(struct idmap_domain *dom, struct id_map **ids)
 {
-       TALLOC_CTX *ctx;
        int i;
 
        /* initialize the status to avoid suprise */
@@ -132,22 +131,17 @@ static NTSTATUS idmap_nss_sids_to_unixids(struct idmap_domain *dom, struct id_ma
                ids[i]->status = ID_UNKNOWN;
        }
 
-       ctx = talloc_new(dom);
-       if ( ! ctx) {
-               DEBUG(0, ("Out of memory!\n"));
-               return NT_STATUS_NO_MEMORY;
-       }
-
        for (i = 0; ids[i]; i++) {
                struct group *gr;
                enum lsa_SidType type;
-               const char *name = NULL;
+               char *name = NULL;
                bool ret;
 
                /* by default calls to winbindd are disabled
                   the following call will not recurse so this is safe */
                (void)winbind_on();
-               ret = winbind_lookup_sid(ctx, ids[i]->sid, NULL, &name, &type);
+               ret = winbind_lookup_sid(talloc_tos(), ids[i]->sid, NULL,
+                                        (const char **)&name, &type);
                (void)winbind_off();
 
                if (!ret) {
@@ -189,9 +183,8 @@ static NTSTATUS idmap_nss_sids_to_unixids(struct idmap_domain *dom, struct id_ma
                        ids[i]->status = ID_UNKNOWN;
                        break;
                }
+               TALLOC_FREE(name);
        }
-
-       talloc_free(ctx);
        return NT_STATUS_OK;
 }