summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-01-24 23:52:23 +0100
committerMichael Adam <obnox@samba.org>2009-02-06 10:20:07 +0100
commit30d08223e65d4b610dbfa59e2486a41c37b3b8b1 (patch)
treeabd0837e8279b861412ea9d2454d1eea686e808f /source3/winbindd
parent9c626e37cf74f94a35c0b03feaf6bec6e3604811 (diff)
downloadsamba-30d08223e65d4b610dbfa59e2486a41c37b3b8b1.tar.gz
samba-30d08223e65d4b610dbfa59e2486a41c37b3b8b1.tar.bz2
samba-30d08223e65d4b610dbfa59e2486a41c37b3b8b1.zip
s3:idmap_tdb2: streamline idmap_tdb2_sid_to_id,
adding tmp talloc ctx and removing a variable Michael
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/idmap_tdb2.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c
index 8bde963c60..60b92c77ad 100644
--- a/source3/winbindd/idmap_tdb2.c
+++ b/source3/winbindd/idmap_tdb2.c
@@ -557,12 +557,13 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_m
TDB_DATA data;
char *keystr;
unsigned long rec_id = 0;
- NTSTATUS status;
+ TALLOC_CTX *tmp_ctx = talloc_stackframe();
- status = idmap_tdb2_open_db();
- NT_STATUS_NOT_OK_RETURN(status);
+ ret = idmap_tdb2_open_db();
+ NT_STATUS_NOT_OK_RETURN(ret);
- if ((keystr = sid_string_talloc(ctx, map->sid)) == NULL) {
+ keystr = sid_string_talloc(tmp_ctx, map->sid);
+ if (keystr == NULL) {
DEBUG(0, ("Out of memory!\n"));
ret = NT_STATUS_NO_MEMORY;
goto done;
@@ -571,7 +572,7 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_m
DEBUG(10,("Fetching record %s\n", keystr));
/* Check if sid is present in database */
- data = dbwrap_fetch_bystring(idmap_tdb2, keystr, keystr);
+ data = dbwrap_fetch_bystring(idmap_tdb2, tmp_ctx, keystr);
if (!data.dptr) {
fstring idstr;
@@ -626,7 +627,7 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_m
}
done:
- talloc_free(keystr);
+ talloc_free(tmp_ctx);
return ret;
}