diff options
-rw-r--r-- | source3/auth/auth_util.c | 12 | ||||
-rw-r--r-- | source3/auth/token_util.c | 7 | ||||
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/passdb/util_unixsids.c | 16 |
4 files changed, 19 insertions, 20 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 32f9d13aac..16fa421f8b 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -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); diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c index 660fcf6192..3a288ddcf2 100644 --- a/source3/auth/token_util.c +++ b/source3/auth/token_util.c @@ -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)) { diff --git a/source3/include/proto.h b/source3/include/proto.h index 860e19d2c3..c0ff722684 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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); diff --git a/source3/passdb/util_unixsids.c b/source3/passdb/util_unixsids.c index 08c887e9fa..0894804c5b 100644 --- a/source3/passdb/util_unixsids.c +++ b/source3/passdb/util_unixsids.c @@ -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) |