From 3ea64e0ad86c35e5f0018ac60571e7a31a968543 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 10 Jan 2010 17:39:27 +0100 Subject: s3: Replace most calls to sid_append_rid() by sid_compose() --- source3/passdb/util_unixsids.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'source3/passdb/util_unixsids.c') diff --git a/source3/passdb/util_unixsids.c b/source3/passdb/util_unixsids.c index ad51253058..afda253c70 100644 --- a/source3/passdb/util_unixsids.c +++ b/source3/passdb/util_unixsids.c @@ -37,14 +37,12 @@ bool sid_check_is_in_unix_users(const DOM_SID *sid) bool uid_to_unix_users_sid(uid_t uid, DOM_SID *sid) { - sid_copy(sid, &global_sid_Unix_Users); - return sid_append_rid(sid, (uint32_t)uid); + return sid_compose(sid, &global_sid_Unix_Users, uid); } bool gid_to_unix_groups_sid(gid_t gid, DOM_SID *sid) { - sid_copy(sid, &global_sid_Unix_Groups); - return sid_append_rid(sid, (uint32_t)gid); + return sid_compose(sid, &global_sid_Unix_Groups, gid); } const char *unix_users_domain_name(void) @@ -55,17 +53,20 @@ const char *unix_users_domain_name(void) bool lookup_unix_user_name(const char *name, DOM_SID *sid) { struct passwd *pwd; + bool ret; pwd = getpwnam_alloc(talloc_autofree_context(), name); if (pwd == NULL) { return False; } - sid_copy(sid, &global_sid_Unix_Users); - sid_append_rid(sid, (uint32_t)pwd->pw_uid); /* For 64-bit uid's we have enough - * space ... */ + /* + * For 64-bit uid's we have enough space in the whole SID, + * should they become necessary + */ + ret = sid_compose(sid, &global_sid_Unix_Users, pwd->pw_uid); TALLOC_FREE(pwd); - return True; + return ret; } bool sid_check_is_unix_groups(const DOM_SID *sid) @@ -98,8 +99,9 @@ bool lookup_unix_group_name(const char *name, DOM_SID *sid) return False; } - sid_copy(sid, &global_sid_Unix_Groups); - sid_append_rid(sid, (uint32_t)grp->gr_gid); /* For 64-bit uid's we have enough - * space ... */ - return True; + /* + * For 64-bit gid's we have enough space in the whole SID, + * should they become necessary + */ + return sid_compose(sid, &global_sid_Unix_Groups, grp->gr_gid); } -- cgit