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 */
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;
}
}
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;
*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);
{
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");
{
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");
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;
}
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;
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));
/* 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",
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)));
}
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;
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;
}
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;
}
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;
}
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;
}
}
/* 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;
}
/* 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;
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;
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;
/* 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;
}
/* 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;
/* 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;
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)",
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()),
*/
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] != '$')
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;
}
}
}
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);
}
/* 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;
}
}
/* 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;
}
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);
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;
}
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;
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)));
}
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 {
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 {
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"));
}
}
}
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());
}
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());
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;
}
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;
}
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);
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);
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 */
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)));
}
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)));
}
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;
}
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);
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;
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;
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;
}
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;
}