mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
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 c501e84d41
)
This commit is contained in:
parent
4830a87845
commit
f5974dfaae
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)",
|
||||
|
@ -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()),
|
||||
|
@ -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] != '$')
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user