Found out a good number of NT_STATUS_IS_ERR used the wrong way.
authorSimo Sorce <idra@samba.org>
Sun, 22 Jun 2003 10:09:52 +0000 (10:09 +0000)
committerSimo Sorce <idra@samba.org>
Sun, 22 Jun 2003 10:09:52 +0000 (10:09 +0000)
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.

22 files changed:
source/auth/auth_rhosts.c
source/auth/auth_util.c
source/modules/vfs_extd_audit.c
source/modules/vfs_recycle.c
source/nsswitch/winbindd_group.c
source/nsswitch/winbindd_passdb.c
source/nsswitch/winbindd_sid.c
source/nsswitch/winbindd_user.c
source/pam_smbpass/pam_smb_passwd.c
source/pam_smbpass/support.c
source/passdb/passdb.c
source/passdb/pdb_interface.c
source/passdb/pdb_ldap.c
source/rpc_server/srv_samr_nt.c
source/rpc_server/srv_util.c
source/sam/idmap.c
source/sam/idmap_util.c
source/smbd/mangle_hash.c
source/smbd/ntquotas.c
source/smbd/nttrans.c
source/smbd/posix_acls.c
source/utils/pdbedit.c

index 2f0de6b81e5e3dda89b94f34a43741a1610dac5a..8fec760e212532c30756e31d1ff332e31082bc65 100644 (file)
@@ -139,7 +139,7 @@ static BOOL check_hosts_equiv(SAM_ACCOUNT *account)
        char *fname = NULL;
 
        fname = lp_hosts_equiv();
-       if (NT_STATUS_IS_ERR(sid_to_uid(pdb_get_user_sid(account), &uid)))
+       if (!NT_STATUS_IS_OK(sid_to_uid(pdb_get_user_sid(account), &uid)))
                return False;
 
        /* note: don't allow hosts.equiv on root */
index f7b46465f7377083c73fb148eac71cfafda2bc16..7d0f44f1d1f4e4eef39f8a3566e2413cb24b7bad 100644 (file)
@@ -607,10 +607,10 @@ NT_USER_TOKEN *create_nt_token(uid_t uid, gid_t gid, int ngroups, gid_t *groups,
        NT_USER_TOKEN *token;
        int i;
 
-       if (NT_STATUS_IS_ERR(uid_to_sid(&user_sid, uid))) {
+       if (!NT_STATUS_IS_OK(uid_to_sid(&user_sid, uid))) {
                return NULL;
        }
-       if (NT_STATUS_IS_ERR(gid_to_sid(&group_sid, gid))) {
+       if (!NT_STATUS_IS_OK(gid_to_sid(&group_sid, gid))) {
                return NULL;
        }
 
@@ -621,7 +621,7 @@ NT_USER_TOKEN *create_nt_token(uid_t uid, gid_t gid, int ngroups, gid_t *groups,
        }
 
        for (i = 0; i < ngroups; i++) {
-               if (NT_STATUS_IS_ERR(gid_to_sid(&(group_sids)[i], (groups)[i]))) {
+               if (!NT_STATUS_IS_OK(gid_to_sid(&(group_sids)[i], (groups)[i]))) {
                        DEBUG(1, ("create_nt_token: failed to convert gid %ld to a sid!\n", (long int)groups[i]));
                        SAFE_FREE(group_sids);
                        return NULL;
@@ -695,7 +695,7 @@ static NTSTATUS get_user_groups_from_local_sam(const char *username, uid_t uid,
        *n_groups = n_unix_groups;
 
        for (i = 0; i < *n_groups; i++) {
-               if (NT_STATUS_IS_ERR(gid_to_sid(&(*groups)[i], (*unix_groups)[i]))) {
+               if (!NT_STATUS_IS_OK(gid_to_sid(&(*groups)[i], (*unix_groups)[i]))) {
                        DEBUG(1, ("get_user_groups_from_local_sam: failed to convert gid %ld to a sid!\n", (long int)(*unix_groups)[i+1]));
                        SAFE_FREE(*groups);
                        SAFE_FREE(*unix_groups);
index e677552eeae49f722a4b6ed1fe644422657c5645..06cddc78e43b0e2825f1696a469754991fa36b89 100644 (file)
@@ -328,7 +328,7 @@ NTSTATUS vfs_extd_audit_init(void)
 {
        NTSTATUS ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "extd_audit", audit_op_tuples);
        
-       if (NT_STATUS_IS_ERR(ret))
+       if (!NT_STATUS_IS_OK(ret))
                return ret;
 
        vfs_extd_audit_debug_level = debug_add_class("extd_audit");
index 80f243a1680909c32344b5da6b9bad441f5fdaa6..e725daedba43067010cffa982fa1149ebde1e703 100644 (file)
@@ -482,7 +482,7 @@ NTSTATUS vfs_recycle_init(void)
 {
        NTSTATUS ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "recycle", recycle_ops);
 
-       if (NT_STATUS_IS_ERR(ret))
+       if (!NT_STATUS_IS_OK(ret))
                return ret;
        
        vfs_recycle_debug_level = debug_add_class("recycle");
index bd9a50b3e0cd6ed09efd4c56f8478ca5b13cf754..41f594fe611b8dd1936c97a4c4ce4a15106d800c 100644 (file)
@@ -234,7 +234,7 @@ enum winbindd_result winbindd_getgrnam(struct winbindd_cli_state *state)
                return WINBINDD_ERROR;
        }
 
-       if (NT_STATUS_IS_ERR(sid_to_gid(&group_sid, &gid))) {
+       if (!NT_STATUS_IS_OK(sid_to_gid(&group_sid, &gid))) {
                DEBUG(1, ("error converting unix gid to sid\n"));
                return WINBINDD_ERROR;
        }
@@ -279,7 +279,7 @@ enum winbindd_result winbindd_getgrgid(struct winbindd_cli_state *state)
                return WINBINDD_ERROR;
 
        /* Get rid from gid */
-       if (NT_STATUS_IS_ERR(gid_to_sid(&group_sid, state->request.data.gid))) {
+       if (!NT_STATUS_IS_OK(gid_to_sid(&group_sid, state->request.data.gid))) {
                DEBUG(1, ("could not convert gid %d to rid\n", 
                          state->request.data.gid));
                return WINBINDD_ERROR;
@@ -591,7 +591,7 @@ enum winbindd_result winbindd_getgrent(struct winbindd_cli_state *state)
                sid_copy(&group_sid, &domain->sid);
                sid_append_rid(&group_sid, name_list[ent->sam_entry_index].rid);
 
-               if (NT_STATUS_IS_ERR(sid_to_gid(&group_sid, &group_gid))) {
+               if (!NT_STATUS_IS_OK(sid_to_gid(&group_sid, &group_gid))) {
                        
                        DEBUG(1, ("could not look up gid for group %s\n", 
                                  name_list[ent->sam_entry_index].acct_name));
@@ -903,7 +903,7 @@ enum winbindd_result winbindd_getgroups(struct winbindd_cli_state *state)
 
                        /* Map to a gid */
 
-                       if ( NT_STATUS_IS_ERR(sid_to_gid(&info3->other_sids[i].sid, 
+                       if (!NT_STATUS_IS_OK(sid_to_gid(&info3->other_sids[i].sid, 
                                &gid_list[num_gids])) )
                        {
                                DEBUG(10, ("winbindd_getgroups: could not map sid %s to gid\n",
@@ -928,7 +928,7 @@ enum winbindd_result winbindd_getgroups(struct winbindd_cli_state *state)
                        sid_copy( &group_sid, &domain->sid );
                        sid_append_rid( &group_sid, info3->gids[i].g_rid );
 
-                       if ( NT_STATUS_IS_ERR(sid_to_gid(&group_sid, &gid_list[num_gids])) ) {
+                       if (!NT_STATUS_IS_OK(sid_to_gid(&group_sid, &gid_list[num_gids])) ) {
                                DEBUG(10, ("winbindd_getgroups: could not map sid %s to gid\n",
                                           sid_string_static(&group_sid)));
                        }
@@ -951,7 +951,7 @@ enum winbindd_result winbindd_getgroups(struct winbindd_cli_state *state)
                        goto done;
 
                for (i = 0; i < num_groups; i++) {
-                       if (NT_STATUS_IS_ERR(sid_to_gid(user_grpsids[i], &gid_list[num_gids]))) {
+                       if (!NT_STATUS_IS_OK(sid_to_gid(user_grpsids[i], &gid_list[num_gids]))) {
                                DEBUG(1, ("unable to convert group sid %s to gid\n", 
                                          sid_string_static(user_grpsids[i])));
                                continue;
index 503b97899c418edd7e59d45c5985bacb1c25a192..401662b6a792c71491fbf8d8a6ac1a9b569a25af 100644 (file)
@@ -41,7 +41,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
 
        DEBUG(3,("pdb: query_user_list\n"));
 
-       if (NT_STATUS_IS_ERR(result = pdb_init_sam(&sam_account))) {
+       if (!NT_STATUS_IS_OK(result = pdb_init_sam(&sam_account))) {
                return result;
        }
 
@@ -84,7 +84,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
 
                        i++;
 
-                       if (NT_STATUS_IS_ERR(pdb_reset_sam(sam_account))) {
+                       if (!NT_STATUS_IS_OK(pdb_reset_sam(sam_account))) {
                                result = NT_STATUS_UNSUCCESSFUL;
                                break;
                        }
@@ -177,7 +177,7 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain,
 
        if (NT_STATUS_IS_OK(sid_to_uid(sid, &id))) { /* this is a user */
 
-               if (NT_STATUS_IS_ERR(result = pdb_init_sam(&sam_account))) {
+               if (!NT_STATUS_IS_OK(result = pdb_init_sam(&sam_account))) {
                        return result;
                }
        
@@ -217,7 +217,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
 
        DEBUG(3,("pdb: query_user sid=%s\n", sid_string_static(user_sid)));
 
-       if (NT_STATUS_IS_ERR(result = pdb_init_sam(&sam_account))) {
+       if (!NT_STATUS_IS_OK(result = pdb_init_sam(&sam_account))) {
                return result;
        }
        
index f5dd904dc16c12cb3bc432fbd3bdb41330086f0f..5d7741850c85d7a20a2c36d72ffc5a586b1440be 100644 (file)
@@ -137,7 +137,7 @@ enum winbindd_result winbindd_sid_to_uid(struct winbindd_cli_state *state)
        }
 
        /* Find uid for this sid and return it */
-       if (NT_STATUS_IS_ERR(sid_to_uid(&sid, &(state->response.data.uid)))) {
+       if (!NT_STATUS_IS_OK(sid_to_uid(&sid, &(state->response.data.uid)))) {
                DEBUG(1, ("Could not get uid for sid %s\n",
                          state->request.data.sid));
                return WINBINDD_ERROR;
@@ -166,7 +166,7 @@ enum winbindd_result winbindd_sid_to_gid(struct winbindd_cli_state *state)
        }
 
        /* Find gid for this sid and return it */
-       if (NT_STATUS_IS_ERR(sid_to_gid(&sid, &(state->response.data.gid)))) {
+       if (!NT_STATUS_IS_OK(sid_to_gid(&sid, &(state->response.data.gid)))) {
                DEBUG(1, ("Could not get gid for sid %s\n",
                          state->request.data.sid));
                return WINBINDD_ERROR;
@@ -192,7 +192,7 @@ enum winbindd_result winbindd_uid_to_sid(struct winbindd_cli_state *state)
                  state->request.data.uid));
 
        /* Lookup rid for this uid */
-       if (NT_STATUS_IS_ERR(uid_to_sid(&sid, state->request.data.uid))) {
+       if (!NT_STATUS_IS_OK(uid_to_sid(&sid, state->request.data.uid))) {
                DEBUG(1, ("Could not convert uid %d to rid\n",
                          state->request.data.uid));
                return WINBINDD_ERROR;
@@ -221,7 +221,7 @@ enum winbindd_result winbindd_gid_to_sid(struct winbindd_cli_state *state)
                  state->request.data.gid));
 
        /* Lookup sid for this uid */
-       if (NT_STATUS_IS_ERR(gid_to_sid(&sid, state->request.data.gid))) {
+       if (!NT_STATUS_IS_OK(gid_to_sid(&sid, state->request.data.gid))) {
                DEBUG(1, ("Could not convert gid %d to sid\n",
                          state->request.data.gid));
                return WINBINDD_ERROR;
index 5c84c4cb82dd84ad97bf8ebd41785e8854a5eff5..ccfddc83bab928fa22c5dac46382a83602e25e42 100644 (file)
@@ -43,14 +43,14 @@ static BOOL winbindd_fill_pwent(char *dom_name, char *user_name,
        
        /* Resolve the uid number */
 
-       if (NT_STATUS_IS_ERR(sid_to_uid(user_sid, &(pw->pw_uid)))) {
+       if (!NT_STATUS_IS_OK(sid_to_uid(user_sid, &(pw->pw_uid)))) {
                DEBUG(1, ("error getting user id for sid %s\n", sid_to_string(sid_string, user_sid)));
                return False;
        }
        
        /* Resolve the gid number */   
 
-       if (NT_STATUS_IS_ERR(sid_to_gid(group_sid, &(pw->pw_gid)))) {
+       if (!NT_STATUS_IS_OK(sid_to_gid(group_sid, &(pw->pw_gid)))) {
                DEBUG(1, ("error getting group id for sid %s\n", sid_to_string(sid_string, group_sid)));
                return False;
        }
@@ -192,7 +192,7 @@ enum winbindd_result winbindd_getpwuid(struct winbindd_cli_state *state)
        
        /* Get rid from uid */
 
-       if (NT_STATUS_IS_ERR(uid_to_sid(&user_sid, state->request.data.uid))) {
+       if (!NT_STATUS_IS_OK(uid_to_sid(&user_sid, state->request.data.uid))) {
                DEBUG(1, ("could not convert uid %d to SID\n", 
                          state->request.data.uid));
                return WINBINDD_ERROR;
@@ -236,7 +236,7 @@ enum winbindd_result winbindd_getpwuid(struct winbindd_cli_state *state)
        
        /* Check group has a gid number */
 
-       if (NT_STATUS_IS_ERR(sid_to_gid(user_info.group_sid, &gid))) {
+       if (!NT_STATUS_IS_OK(sid_to_gid(user_info.group_sid, &gid))) {
                DEBUG(1, ("error getting group id for user %s\n", user_name));
                talloc_destroy(mem_ctx);
                return WINBINDD_ERROR;
index 78b89c60b76cb073895e10a04eb219b5705e0399..bef587a916cbdfd2bd7c1d823576a9530c2a87a5 100644 (file)
@@ -298,7 +298,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
            uid_t uid;
            
             /* password updated */
-               if (NT_STATUS_IS_ERR(sid_to_uid(pdb_get_user_sid(sampass), &uid))) {
+               if (!NT_STATUS_IS_OK(sid_to_uid(pdb_get_user_sid(sampass), &uid))) {
                        _log_err( LOG_NOTICE, "Unable to get uid for user %s",
                                pdb_get_username(sampass));
                        _log_err( LOG_NOTICE, "password for (%s) changed by (%s/%d)",
index 62cc866fae0792fad3d74e8c009d952711d8fe5d..8a0432c85501583b5476092e96373b836174c4df 100644 (file)
@@ -399,7 +399,7 @@ int _smb_verify_password( pam_handle_t * pamh, SAM_ACCOUNT *sampass,
                       service ? service : "**unknown**", name);
                     new->count = 1;
                 }
-               if (NT_STATUS_IS_ERR(sid_to_uid(pdb_get_user_sid(sampass), &(new->id)))) {
+               if (!NT_STATUS_IS_OK(sid_to_uid(pdb_get_user_sid(sampass), &(new->id)))) {
                     _log_err(LOG_NOTICE,
                       "failed auth request by %s for service %s as %s",
                       uidtoname(getuid()),
index e2e0758845fffec7554516ac40f75374b8294f83..ac3875e181ef6d2df70a588498be75f6b986fdff 100644 (file)
@@ -190,7 +190,7 @@ NTSTATUS pdb_fill_sam_pw(SAM_ACCOUNT *sam_account, const struct passwd *pwd)
        */
 
        ret = pdb_set_sam_sids(sam_account, pwd);
-       if (NT_STATUS_IS_ERR(ret)) return ret;
+       if (!NT_STATUS_IS_OK(ret)) return ret;
 
        /* check if this is a user account or a machine account */
        if (pwd->pw_name[strlen(pwd->pw_name)-1] != '$')
index 478cf6c06bbac8a3de9e25252f6c96442838dfe9..af913f3ff0f4b69bbd084c25d600dd6f2e1f8d0d 100644 (file)
@@ -566,13 +566,13 @@ static struct pdb_context *pdb_get_static_context(BOOL reload)
 
        if ((pdb_context) && (reload)) {
                pdb_context->free_fn(&pdb_context);
-               if (NT_STATUS_IS_ERR(make_pdb_context_list(&pdb_context, lp_passdb_backend()))) {
+               if (!NT_STATUS_IS_OK(make_pdb_context_list(&pdb_context, lp_passdb_backend()))) {
                        return NULL;
                }
        }
 
        if (!pdb_context) {
-               if (NT_STATUS_IS_ERR(make_pdb_context_list(&pdb_context, lp_passdb_backend()))) {
+               if (!NT_STATUS_IS_OK(make_pdb_context_list(&pdb_context, lp_passdb_backend()))) {
                        return NULL;
                }
        }
index 4cc1762a0df14c973ced4701ad665f227b3646b5..fe575d4e3e5bf37a26cba07a8e5249d19a4a9488 100644 (file)
@@ -2744,7 +2744,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO
        }
 
        ret = ldapsam_modify_entry(my_methods,newpwd,dn,mods,ldap_op, element_is_set_or_changed);
-       if (NT_STATUS_IS_ERR(ret)) {
+       if (!NT_STATUS_IS_OK(ret)) {
                DEBUG(0,("failed to modify/add user with uid = %s (dn = %s)\n",
                         pdb_get_username(newpwd),dn));
                ldap_mods_free(mods, True);
index 6039cac96ce84311efe88771422af8bfd4d8e42e..ebf483da660a2421270641ba9e0f2b632c9379de 100644 (file)
@@ -3430,7 +3430,7 @@ NTSTATUS _samr_add_aliasmem(pipes_struct *p, SAMR_Q_ADD_ALIASMEM *q_u, SAMR_R_AD
        }
 
        /* check a real user exist before we run the script to add a user to a group */
-       if (NT_STATUS_IS_ERR(sid_to_uid(pdb_get_user_sid(sam_user), &uid))) {
+       if (!NT_STATUS_IS_OK(sid_to_uid(pdb_get_user_sid(sam_user), &uid))) {
                pdb_free_sam(&sam_user);
                return NT_STATUS_NO_SUCH_USER;
        }
@@ -3590,7 +3590,7 @@ NTSTATUS _samr_add_groupmem(pipes_struct *p, SAMR_Q_ADD_GROUPMEM *q_u, SAMR_R_AD
        }
 
        /* check a real user exist before we run the script to add a user to a group */
-       if (NT_STATUS_IS_ERR(sid_to_uid(pdb_get_user_sid(sam_user), &uid))) {
+       if (!NT_STATUS_IS_OK(sid_to_uid(pdb_get_user_sid(sam_user), &uid))) {
                pdb_free_sam(&sam_user);
                return NT_STATUS_NO_SUCH_USER;
        }
index a97864dbdaee0710cd6b6fd4996d1c14f19d04b9..5040b094a8ce3716ddc508cdc6edfc29ad2e2538 100644 (file)
@@ -129,7 +129,7 @@ NTSTATUS get_alias_user_groups(TALLOC_CTX *ctx, DOM_SID *sid, int *numgroups, ui
 
        fstrcpy(user_name, pdb_get_username(sam_pass));
        grid=pdb_get_group_rid(sam_pass);
-       if (NT_STATUS_IS_ERR(sid_to_gid(pdb_get_group_sid(sam_pass), &gid))) {
+       if (!NT_STATUS_IS_OK(sid_to_gid(pdb_get_group_sid(sam_pass), &gid))) {
                /* this should never happen */
                DEBUG(2,("get_alias_user_groups: sid_to_gid failed!\n"));
                pdb_free_sam(&sam_pass);
index bf647da4eea90578a52cd4ee2aa266d02f0fd73c..d2f68acf6069d57e02e1a294f32f76c4a674e334 100644 (file)
@@ -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"));
                }
        }
index 3f36e701f67c87021535badfa70fdb388f01c712..7d7e7163978466b243362eef404513489a38898d 100644 (file)
@@ -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;
                }
index d2eb996899caef40ccb92be8675f3dd43ee1fa46..d4cf369f28765cd2c74d0495a33183d9b737d26c 100644 (file)
@@ -217,7 +217,7 @@ static NTSTATUS is_valid_name(const smb_ucs2_t *fname, BOOL allow_wildcards)
                return NT_STATUS_UNSUCCESSFUL;
        
        ret = has_valid_chars(fname, allow_wildcards);
-       if (NT_STATUS_IS_ERR(ret))
+       if (!NT_STATUS_IS_OK(ret))
                return ret;
 
        str = strdup_w(fname);
@@ -285,10 +285,10 @@ static NTSTATUS is_8_3_w(const smb_ucs2_t *fname, BOOL allow_wildcards)
        if (strcmp_wa(fname, ".") == 0 || strcmp_wa(fname, "..") == 0)
                return NT_STATUS_OK;
 
-       if (NT_STATUS_IS_ERR(is_valid_name(fname, allow_wildcards)))
+       if (!NT_STATUS_IS_OK(is_valid_name(fname, allow_wildcards)))
                goto done;
 
-       if (NT_STATUS_IS_ERR(mangle_get_prefix(fname, &pref, &ext, allow_wildcards)))
+       if (!NT_STATUS_IS_OK(mangle_get_prefix(fname, &pref, &ext, allow_wildcards)))
                goto done;
        plen = strlen_w(pref);
 
@@ -735,7 +735,7 @@ static void name_map(char *OutName, BOOL need83, BOOL cache83)
                return;
        }
 
-       if( !need83 && NT_STATUS_IS_ERR(is_valid_name(OutName_ucs2, False)))
+       if( !need83 && !NT_STATUS_IS_OK(is_valid_name(OutName_ucs2, False)))
                need83 = True;
 
        /* check if it's already in 8.3 format */
index 6a217a32587955d89cf0075443a56fc0bdf75da1..2e865000ecc333325004134d5eed441e77eaef4b 100644 (file)
@@ -84,7 +84,7 @@ int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, DOM_SID *psid,
 
        id.uid = -1;
 
-       if (psid && NT_STATUS_IS_ERR(sid_to_uid(psid, &id.uid))) {
+       if (psid && !NT_STATUS_IS_OK(sid_to_uid(psid, &id.uid))) {
                DEBUG(0,("sid_to_uid: failed, SID[%s]\n",
                        sid_string_static(psid)));      
        }
@@ -128,7 +128,7 @@ int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, DOM_SID *psid,
        D.isoftlimit = limit_blk2inodes(D.softlimit);
        D.ihardlimit = limit_blk2inodes(D.hardlimit);
 
-       if (psid && NT_STATUS_IS_ERR(sid_to_uid(psid, &id.uid))) {
+       if (psid && !NT_STATUS_IS_OK(sid_to_uid(psid, &id.uid))) {
                DEBUG(0,("sid_to_uid: failed, SID[%s]\n",
                        sid_string_static(psid)));      
        }
@@ -182,7 +182,7 @@ int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list)
                        continue;
                }
 
-               if (NT_STATUS_IS_ERR(uid_to_sid(&sid, usr->pw_uid))) {
+               if (!NT_STATUS_IS_OK(uid_to_sid(&sid, usr->pw_uid))) {
                        DEBUG(0,("uid_to_sid failed for %ld\n",(long)usr->pw_uid));
                        continue;
                }
index fa7b78ecc26f8c5640801d7da16844888edd1786..0030acc78bd70a68ab4fa4e8e2ed3b50f0bc8f81 100644 (file)
@@ -1797,7 +1797,7 @@ static int call_nt_transact_ioctl(connection_struct *conn, char *inbuf, char *ou
                sid_parse(pdata+4,sid_len,&sid);
                DEBUGADD(2,("SID: %s\n",sid_string_static(&sid)));
 
-               if (NT_STATUS_IS_ERR(sid_to_uid(&sid, &uid))) {
+               if (!NT_STATUS_IS_OK(sid_to_uid(&sid, &uid))) {
                        DEBUG(0,("sid_to_uid: failed, sid[%s]\n",
                                sid_string_static(&sid)));
                        uid = (-1);
index 396b955843a45c056c8c247f96bb3342eeb86796..c52139495c2146b6218381fcd2f9cdb59c6c32d7 100644 (file)
@@ -904,7 +904,7 @@ static BOOL unpack_nt_owners(SMB_STRUCT_STAT *psbuf, uid_t *puser, gid_t *pgrp,
 
        if (security_info_sent & OWNER_SECURITY_INFORMATION) {
                sid_copy(&owner_sid, psd->owner_sid);
-               if (NT_STATUS_IS_ERR(sid_to_uid(&owner_sid, puser))) {
+               if (!NT_STATUS_IS_OK(sid_to_uid(&owner_sid, puser))) {
 #if ACL_FORCE_UNMAPPABLE
                        /* this allows take ownership to work reasonably */
                        extern struct current_user current_user;
@@ -924,7 +924,7 @@ static BOOL unpack_nt_owners(SMB_STRUCT_STAT *psbuf, uid_t *puser, gid_t *pgrp,
 
        if (security_info_sent & GROUP_SECURITY_INFORMATION) {
                sid_copy(&grp_sid, psd->grp_sid);
-               if (NT_STATUS_IS_ERR(sid_to_gid( &grp_sid, pgrp))) {
+               if (!NT_STATUS_IS_OK(sid_to_gid( &grp_sid, pgrp))) {
 #if ACL_FORCE_UNMAPPABLE
                        /* this allows take group ownership to work reasonably */
                        extern struct current_user current_user;
index 571775a741205780567e3566363433f23d58c72f..aa11f2bfdf559df20f23e57c2c57df628bb515c3 100644 (file)
@@ -485,7 +485,7 @@ static int delete_user_entry (struct pdb_context *in, const char *username)
                return -1;
        }
 
-       if (NT_STATUS_IS_ERR(in->pdb_getsampwnam(in, samaccount, username))) {
+       if (!NT_STATUS_IS_OK(in->pdb_getsampwnam(in, samaccount, username))) {
                fprintf (stderr, "user %s does not exist in the passdb\n", username);
                return -1;
        }
@@ -511,7 +511,7 @@ static int delete_machine_entry (struct pdb_context *in, const char *machinename
                return -1;
        }
 
-       if (NT_STATUS_IS_ERR(in->pdb_getsampwnam(in, samaccount, name))) {
+       if (!NT_STATUS_IS_OK(in->pdb_getsampwnam(in, samaccount, name))) {
                fprintf (stderr, "machine %s does not exist in the passdb\n", name);
                return -1;
        }