summaryrefslogtreecommitdiff
path: root/source3/winbindd/idmap_tdb.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-01-23 00:52:28 +0100
committerMichael Adam <obnox@samba.org>2009-02-06 10:20:06 +0100
commita9184d5c62c2c89cf473e189c8beeed6fa7da1b2 (patch)
tree0309b613ee1a0143cc8cccdda0a3948098c5725f /source3/winbindd/idmap_tdb.c
parent61f1747441ff43c1d9c99bbf69e218c1984834c7 (diff)
downloadsamba-a9184d5c62c2c89cf473e189c8beeed6fa7da1b2.tar.gz
samba-a9184d5c62c2c89cf473e189c8beeed6fa7da1b2.tar.bz2
samba-a9184d5c62c2c89cf473e189c8beeed6fa7da1b2.zip
s3:idmap_tdb: add tmp talloc ctx to idmap_tdb_sid_to_id and remove an fstring
Michael
Diffstat (limited to 'source3/winbindd/idmap_tdb.c')
-rw-r--r--source3/winbindd/idmap_tdb.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c
index 481ac1b9ad..f2557cc2e6 100644
--- a/source3/winbindd/idmap_tdb.c
+++ b/source3/winbindd/idmap_tdb.c
@@ -694,10 +694,10 @@ static NTSTATUS idmap_tdb_sid_to_id(struct idmap_tdb_context *ctx, struct id_map
TDB_DATA data;
char *keystr;
unsigned long rec_id = 0;
- fstring tmp;
+ TALLOC_CTX *tmp_ctx = talloc_stackframe();
- if ((keystr = talloc_asprintf(
- ctx, "%s", sid_to_fstring(tmp, 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;
@@ -706,7 +706,7 @@ static NTSTATUS idmap_tdb_sid_to_id(struct idmap_tdb_context *ctx, struct id_map
DEBUG(10,("Fetching record %s\n", keystr));
/* Check if sid is present in database */
- data = dbwrap_fetch_bystring(ctx->db, NULL, keystr);
+ data = dbwrap_fetch_bystring(ctx->db, tmp_ctx, keystr);
if (!data.dptr) {
DEBUG(10,("Record %s not found\n", keystr));
ret = NT_STATUS_NONE_MAPPED;
@@ -730,8 +730,6 @@ static NTSTATUS idmap_tdb_sid_to_id(struct idmap_tdb_context *ctx, struct id_map
DEBUG(2, ("Found INVALID record %s -> %s\n", keystr, (const char *)data.dptr));
ret = NT_STATUS_INTERNAL_DB_ERROR;
}
-
- TALLOC_FREE(data.dptr);
/* apply filters before returning result */
if ((ctx->filter_low_id && (map->xid.id < ctx->filter_low_id)) ||
@@ -742,7 +740,7 @@ static NTSTATUS idmap_tdb_sid_to_id(struct idmap_tdb_context *ctx, struct id_map
}
done:
- talloc_free(keystr);
+ talloc_free(tmp_ctx);
return ret;
}