From f5974dfaae680d98b78d600cd1f1aaece332a085 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 22 Jun 2003 10:09:52 +0000 Subject: Found out a good number of NT_STATUS_IS_ERR used the wrong way. As abartlet rememberd me NT_STATUS_IS_ERR != !NT_STATUS_IS_OK This patch will cure the problem. Working on this one I found 16 functions where I think NT_STATUS_IS_ERR() is used correctly, but I'm not 100% sure, coders should check the use of NT_STATUS_IS_ERR() in samba is ok now. Simo. (This used to be commit c501e84d412563eb3f674f76038ec48c2b458687) --- source3/sam/idmap.c | 18 +++++++++--------- source3/sam/idmap_util.c | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'source3/sam') diff --git a/source3/sam/idmap.c b/source3/sam/idmap.c index bf647da4ee..d2f68acf60 100644 --- a/source3/sam/idmap.c +++ b/source3/sam/idmap.c @@ -105,7 +105,7 @@ BOOL idmap_init(void) return False; } - if (NT_STATUS_IS_ERR(local_map->init( NULL ))) { + if (!NT_STATUS_IS_OK(local_map->init( NULL ))) { DEBUG(0, ("idmap_init: could not load or create local backend!\n")); return False; } @@ -146,7 +146,7 @@ NTSTATUS idmap_set_mapping(const DOM_SID *sid, unid_t id, int id_type) lazy_initialize_idmap(); ret = local_map->set_mapping(sid, id, id_type); - if (NT_STATUS_IS_ERR(ret)) { + if (!NT_STATUS_IS_OK(ret)) { DEBUG (0, ("idmap_set_mapping: Error, unable to modify local cache!\n")); DEBUGADD(0, ("Error: %s", nt_errstr(ret))); return ret; @@ -156,7 +156,7 @@ NTSTATUS idmap_set_mapping(const DOM_SID *sid, unid_t id, int id_type) Generally this is a forbidden operation. */ if (!(id_type & ID_CACHE) && (remote_map != NULL)) { remote_map->set_mapping(sid, id, id_type); - if (NT_STATUS_IS_ERR(ret)) { + if (!NT_STATUS_IS_OK(ret)) { DEBUG (0, ("idmap_set_mapping: Error, unable to modify remote cache!\n")); DEBUGADD(0, ("Error: %s", nt_errstr(ret))); } @@ -178,10 +178,10 @@ NTSTATUS idmap_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid) loc_type |= ID_NOMAP; } ret = local_map->get_id_from_sid(id, &loc_type, sid); - if (NT_STATUS_IS_ERR(ret)) { + if (!NT_STATUS_IS_OK(ret)) { if (remote_map) { ret = remote_map->get_id_from_sid(id, id_type, sid); - if (NT_STATUS_IS_ERR(ret)) { + if (!NT_STATUS_IS_OK(ret)) { DEBUG(3, ("idmap_get_id_from_sid: error fetching id!\n")); return ret; } else { @@ -209,10 +209,10 @@ NTSTATUS idmap_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type) loc_type = id_type | ID_NOMAP; } ret = local_map->get_sid_from_id(sid, id, loc_type); - if (NT_STATUS_IS_ERR(ret)) { + if (!NT_STATUS_IS_OK(ret)) { if (remote_map) { ret = remote_map->get_sid_from_id(sid, id, id_type); - if (NT_STATUS_IS_ERR(ret)) { + if (!NT_STATUS_IS_OK(ret)) { DEBUG(3, ("idmap_get_sid_from_id: unable to fetch sid!\n")); return ret; } else { @@ -231,13 +231,13 @@ NTSTATUS idmap_close(void) NTSTATUS ret; ret = local_map->close(); - if (NT_STATUS_IS_ERR(ret)) { + if (!NT_STATUS_IS_OK(ret)) { DEBUG(3, ("idmap_close: failed to close local cache!\n")); } if (remote_map) { ret = remote_map->close(); - if (NT_STATUS_IS_ERR(ret)) { + if (!NT_STATUS_IS_OK(ret)) { DEBUG(3, ("idmap_close: failed to close remote idmap repository!\n")); } } diff --git a/source3/sam/idmap_util.c b/source3/sam/idmap_util.c index 3f36e701f6..7d7e716397 100644 --- a/source3/sam/idmap_util.c +++ b/source3/sam/idmap_util.c @@ -150,7 +150,7 @@ NTSTATUS uid_to_sid(DOM_SID *sid, uid_t uid) } id.uid = uid; - if (NT_STATUS_IS_ERR(ret = idmap_get_sid_from_id(sid, id, flags))) { + if (!NT_STATUS_IS_OK(ret = idmap_get_sid_from_id(sid, id, flags))) { DEBUG(10, ("uid_to_sid: Failed to map uid = [%u]\n", (unsigned int)uid)); if (flags & ID_NOMAP) { sid_copy(sid, get_global_sam_sid()); @@ -186,7 +186,7 @@ NTSTATUS gid_to_sid(DOM_SID *sid, gid_t gid) } id.gid = gid; - if (NT_STATUS_IS_ERR(ret = idmap_get_sid_from_id(sid, id, flags))) { + if (!NT_STATUS_IS_OK(ret = idmap_get_sid_from_id(sid, id, flags))) { DEBUG(10, ("gid_to_sid: Failed to map gid = [%u]\n", (unsigned int)gid)); if (flags & ID_NOMAP) { sid_copy(sid, get_global_sam_sid()); @@ -341,7 +341,7 @@ BOOL idmap_init_wellknown_sids(void) id.uid = pass->pw_uid; sid_copy(&sid, get_global_sam_sid()); sid_append_rid(&sid, DOMAIN_USER_RID_GUEST); - if (NT_STATUS_IS_ERR(idmap_set_mapping(&sid, id, flags))) { + if (!NT_STATUS_IS_OK(idmap_set_mapping(&sid, id, flags))) { passwd_free(&pass); return False; } @@ -362,10 +362,10 @@ BOOL idmap_init_wellknown_sids(void) flags = ID_GROUPID | ID_NOMAP; sid_copy(&sid, get_global_sam_sid()); sid_append_rid(&sid, DOMAIN_GROUP_RID_GUESTS); - if (NT_STATUS_IS_ERR(idmap_get_id_from_sid(&id, &flags, &sid))) { + if (!NT_STATUS_IS_OK(idmap_get_id_from_sid(&id, &flags, &sid))) { flags = ID_GROUPID; id.gid = pass->pw_gid; - if (NT_STATUS_IS_ERR(idmap_set_mapping(&sid, id, flags))) { + if (!NT_STATUS_IS_OK(idmap_set_mapping(&sid, id, flags))) { passwd_free(&pass); return False; } -- cgit