1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3: [ug]id_to_unix_... can not fail

Remove some silly failure checks
This commit is contained in:
Volker Lendecke 2010-07-11 17:30:53 +02:00
parent c6a6d884f9
commit c186f92437
4 changed files with 19 additions and 20 deletions

View File

@ -498,20 +498,14 @@ NTSTATUS create_local_token(struct auth_serversupplied_info *server_info)
* the nt token.
*/
if (!uid_to_unix_users_sid(server_info->utok.uid, &tmp_sid)) {
DEBUG(1,("create_local_token: Failed to create SID "
"for uid %u!\n", (unsigned int)server_info->utok.uid));
}
uid_to_unix_users_sid(server_info->utok.uid, &tmp_sid);
add_sid_to_array_unique(server_info->ptok, &tmp_sid,
&server_info->ptok->user_sids,
&server_info->ptok->num_sids);
for ( i=0; i<server_info->utok.ngroups; i++ ) {
if (!gid_to_unix_groups_sid( server_info->utok.groups[i], &tmp_sid ) ) {
DEBUG(1,("create_local_token: Failed to create SID "
"for gid %u!\n", (unsigned int)server_info->utok.groups[i]));
continue;
}
gid_to_unix_groups_sid(server_info->utok.groups[i], &tmp_sid);
add_sid_to_array_unique(server_info->ptok, &tmp_sid,
&server_info->ptok->user_sids,
&server_info->ptok->num_sids);

View File

@ -926,11 +926,8 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
if ( lp_idmap_gid(&low, &high) && (gids[i] >= low) && (gids[i] <= high) )
continue;
if ( !gid_to_unix_groups_sid( gids[i], &unix_group_sid ) ) {
DEBUG(1,("create_token_from_username: Failed to create SID "
"for gid %u!\n", (unsigned int)gids[i]));
continue;
}
gid_to_unix_groups_sid(gids[i], &unix_group_sid);
result = add_sid_to_array_unique(tmp_ctx, &unix_group_sid,
&group_sids, &num_group_sids);
if (!NT_STATUS_IS_OK(result)) {

View File

@ -4623,8 +4623,8 @@ bool sid_check_is_in_builtin(const struct dom_sid *sid);
bool sid_check_is_unix_users(const struct dom_sid *sid);
bool sid_check_is_in_unix_users(const struct dom_sid *sid);
bool uid_to_unix_users_sid(uid_t uid, struct dom_sid *sid);
bool gid_to_unix_groups_sid(gid_t gid, struct dom_sid *sid);
void uid_to_unix_users_sid(uid_t uid, struct dom_sid *sid);
void gid_to_unix_groups_sid(gid_t gid, struct dom_sid *sid);
const char *unix_users_domain_name(void);
bool lookup_unix_user_name(const char *name, struct dom_sid *sid);
bool sid_check_is_unix_groups(const struct dom_sid *sid);

View File

@ -35,14 +35,22 @@ bool sid_check_is_in_unix_users(const struct dom_sid *sid)
return sid_check_is_unix_users(&dom_sid);
}
bool uid_to_unix_users_sid(uid_t uid, struct dom_sid *sid)
void uid_to_unix_users_sid(uid_t uid, struct dom_sid *sid)
{
return sid_compose(sid, &global_sid_Unix_Users, uid);
/*
* This can never fail, we know that global_sid_Unix_Users is
* short enough for a domain sid.
*/
sid_compose(sid, &global_sid_Unix_Users, uid);
}
bool gid_to_unix_groups_sid(gid_t gid, struct dom_sid *sid)
void gid_to_unix_groups_sid(gid_t gid, struct dom_sid *sid)
{
return sid_compose(sid, &global_sid_Unix_Groups, gid);
/*
* This can never fail, we know that global_sid_Unix_Groups is
* short enough for a domain sid.
*/
sid_compose(sid, &global_sid_Unix_Groups, gid);
}
const char *unix_users_domain_name(void)