From 0e28448a780cf231ae38fe03a85cf6e1ea9dded0 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 24 Aug 2011 13:08:13 +0200 Subject: s3:dbwrap: convert dbwrap_fetch(), dbwrap_fetch_bystring() and dbwrap_fetch_bystring_upper() to NTSTATUS --- source3/winbindd/idmap_autorid.c | 10 ++++++---- source3/winbindd/idmap_tdb.c | 8 ++++---- source3/winbindd/idmap_tdb2.c | 12 ++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) (limited to 'source3/winbindd') diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 85ddca2242..780f533c56 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -136,6 +136,7 @@ static NTSTATUS idmap_autorid_id_to_sid(struct autorid_global_config *cfg, TDB_DATA data; char *keystr; struct dom_sid sid; + NTSTATUS status; /* can this be one of our ids? */ if (map->xid.id < cfg->minvalue) { @@ -160,10 +161,10 @@ static NTSTATUS idmap_autorid_id_to_sid(struct autorid_global_config *cfg, return NT_STATUS_NO_MEMORY; } - data = dbwrap_fetch_bystring(autorid_db, talloc_tos(), keystr); + status = dbwrap_fetch_bystring(autorid_db, talloc_tos(), keystr, &data); TALLOC_FREE(keystr); - if (!data.dptr) { + if (!NT_STATUS_IS_OK(status)) { DEBUG(4, ("id %d belongs to range %d which does not have " "domain mapping, ignoring mapping request\n", map->xid.id, range)); @@ -383,10 +384,11 @@ static struct autorid_global_config *idmap_autorid_loadconfig(TALLOC_CTX * ctx) TDB_DATA data; struct autorid_global_config *cfg; unsigned long minvalue, rangesize, maxranges; + NTSTATUS status; - data = dbwrap_fetch_bystring(autorid_db, ctx, CONFIGKEY); + status = dbwrap_fetch_bystring(autorid_db, ctx, CONFIGKEY, &data); - if (!data.dptr) { + if (!NT_STATUS_IS_OK(status)) { DEBUG(10, ("No saved config found\n")); return NULL; } diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c index 5e3e9c08b6..c1fa42d27d 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -723,9 +723,9 @@ static NTSTATUS idmap_tdb_id_to_sid(struct idmap_domain *dom, struct id_map *map DEBUG(10,("Fetching record %s\n", keystr)); /* Check if the mapping exists */ - data = dbwrap_fetch_bystring(ctx->db, NULL, keystr); + ret = dbwrap_fetch_bystring(ctx->db, NULL, keystr, &data); - if (!data.dptr) { + if (!NT_STATUS_IS_OK(ret)) { DEBUG(10,("Record %s not found\n", keystr)); ret = NT_STATUS_NONE_MAPPED; goto done; @@ -772,8 +772,8 @@ static NTSTATUS idmap_tdb_sid_to_id(struct idmap_domain *dom, struct id_map *map DEBUG(10,("Fetching record %s\n", keystr)); /* Check if sid is present in database */ - data = dbwrap_fetch_bystring(ctx->db, tmp_ctx, keystr); - if (!data.dptr) { + ret = dbwrap_fetch_bystring(ctx->db, tmp_ctx, keystr, &data); + if (!NT_STATUS_IS_OK(ret)) { DEBUG(10,("Record %s not found\n", keystr)); ret = NT_STATUS_NONE_MAPPED; goto done; diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index 07b91e5b00..456bb8f509 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -355,8 +355,8 @@ static NTSTATUS idmap_tdb2_set_mapping_action(struct db_context *db, DEBUG(10, ("Storing %s <-> %s map\n", state->ksidstr, state->kidstr)); /* check wheter sid mapping is already present in db */ - data = dbwrap_fetch_bystring(db, tmp_ctx, state->ksidstr); - if (data.dptr) { + ret = dbwrap_fetch_bystring(db, tmp_ctx, state->ksidstr, &data); + if (!NT_STATUS_IS_OK(ret)) { ret = NT_STATUS_OBJECT_NAME_COLLISION; goto done; } @@ -585,9 +585,9 @@ static NTSTATUS idmap_tdb2_id_to_sid(struct idmap_domain *dom, struct id_map *ma DEBUG(10,("Fetching record %s\n", keystr)); /* Check if the mapping exists */ - data = dbwrap_fetch_bystring(ctx->db, keystr, keystr); + status = dbwrap_fetch_bystring(ctx->db, keystr, keystr, &data); - if (!data.dptr) { + if (!NT_STATUS_IS_OK(status)) { char *sidstr; struct idmap_tdb2_set_mapping_context store_state; @@ -659,8 +659,8 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_domain *dom, struct id_map *ma DEBUG(10,("Fetching record %s\n", keystr)); /* Check if sid is present in database */ - data = dbwrap_fetch_bystring(ctx->db, tmp_ctx, keystr); - if (!data.dptr) { + ret = dbwrap_fetch_bystring(ctx->db, tmp_ctx, keystr, &data); + if (!NT_STATUS_IS_OK(ret)) { char *idstr; struct idmap_tdb2_set_mapping_context store_state; -- cgit