Module: wine Branch: master Commit: c65bcce5899ba81226295303ed3df73a7be86c09 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c65bcce5899ba81226295303ed...
Author: Hans Leidekker hans@codeweavers.com Date: Wed Mar 2 10:46:12 2011 +0100
server: Map the Unix user id to a local user SID instead of the interactive SID.
---
dlls/advapi32/tests/security.c | 12 +++--------- dlls/kernel32/tests/environ.c | 3 +-- server/registry.c | 2 +- server/security.h | 2 +- server/token.c | 13 +++++++++++-- 5 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 4ba244f..3dae81b 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -1674,10 +1674,7 @@ static void test_LookupAccountSid(void) user_sizeA = MAX_PATH; ret = GetUserNameA(usernameA , &user_sizeA); ok(ret, "GetUserNameA() Expected TRUE, got FALSE\n"); - todo_wine - { - ok(lstrcmpA(usernameA, accountA) == 0, "LookupAccountSidA() Expected account name: %s got: %s\n", usernameA, accountA ); - } + ok(lstrcmpA(usernameA, accountA) == 0, "LookupAccountSidA() Expected account name: %s got: %s\n", usernameA, accountA ); } HeapFree(GetProcessHeap(), 0, ptiUser);
@@ -1912,11 +1909,8 @@ static void test_LookupAccountName(void) get_sid_info(psid, &account, &sid_dom); ok(ret, "Failed to lookup account name\n"); ok(sid_size == GetLengthSid(psid), "Expected %d, got %d\n", GetLengthSid(psid), sid_size); - todo_wine - { - ok(!lstrcmp(account, user_name), "Expected %s, got %s\n", user_name, account); - ok(!lstrcmp(domain, sid_dom), "Expected %s, got %s\n", sid_dom, domain); - } + ok(!lstrcmp(account, user_name), "Expected %s, got %s\n", user_name, account); + ok(!lstrcmp(domain, sid_dom), "Expected %s, got %s\n", sid_dom, domain); ok(domain_size == domain_save - 1, "Expected %d, got %d\n", domain_save - 1, domain_size); ok(strlen(domain) == domain_size, "Expected %d, got %d\n", lstrlen(domain), domain_size); ok(sid_use == SidTypeUser, "Expected SidTypeUser (%d), got %d\n", SidTypeUser, sid_use); diff --git a/dlls/kernel32/tests/environ.c b/dlls/kernel32/tests/environ.c index 0a7eef9..3ac86cd 100644 --- a/dlls/kernel32/tests/environ.c +++ b/dlls/kernel32/tests/environ.c @@ -72,8 +72,7 @@ static void test_Predefined(void) ok(NoErr, "Failed to open token, error %u\n", GetLastError()); DataSize = sizeof(Data); NoErr = pGetUserProfileDirectoryA(Token, Data, &DataSize); - todo_wine ok(NoErr, "Failed to get user profile dir, error %u\n", - GetLastError()); + ok(NoErr, "Failed to get user profile dir, error %u\n", GetLastError()); if (NoErr) { EnvSize = GetEnvironmentVariableA("USERPROFILE", Env, sizeof(Env)); diff --git a/server/registry.c b/server/registry.c index 2aea747..a144c26 100644 --- a/server/registry.c +++ b/server/registry.c @@ -1718,7 +1718,7 @@ void init_registry(void) /* load user.reg into HKEY_CURRENT_USER */
/* FIXME: match default user in token.c. should get from process token instead */ - current_user_path = format_user_registry_path( security_interactive_sid, ¤t_user_str ); + current_user_path = format_user_registry_path( security_local_user_sid, ¤t_user_str ); if (!current_user_path || !(hkcu = create_key_recursive( root_key, ¤t_user_str, current_time ))) fatal_error( "could not create HKEY_CURRENT_USER registry key\n" ); diff --git a/server/security.h b/server/security.h index 33cf5da..d5f629d 100644 --- a/server/security.h +++ b/server/security.h @@ -40,7 +40,7 @@ extern const LUID SeImpersonatePrivilege; extern const LUID SeCreateGlobalPrivilege;
extern const PSID security_world_sid; -extern const PSID security_interactive_sid; +extern const PSID security_local_user_sid; extern const PSID security_local_system_sid;
diff --git a/server/token.c b/server/token.c index 69ffab7..e8e85fc 100644 --- a/server/token.c +++ b/server/token.c @@ -70,11 +70,20 @@ static const SID interactive_sid = { SID_REVISION, 1, { SECURITY_NT_AUTHORITY }, static const SID anonymous_logon_sid = { SID_REVISION, 1, { SECURITY_NT_AUTHORITY }, { SECURITY_ANONYMOUS_LOGON_RID } }; static const SID authenticated_user_sid = { SID_REVISION, 1, { SECURITY_NT_AUTHORITY }, { SECURITY_AUTHENTICATED_USER_RID } }; static const SID local_system_sid = { SID_REVISION, 1, { SECURITY_NT_AUTHORITY }, { SECURITY_LOCAL_SYSTEM_RID } }; +static const struct /* same fields as struct SID */ +{ + BYTE Revision; + BYTE SubAuthorityCount; + SID_IDENTIFIER_AUTHORITY IdentifierAuthority; + DWORD SubAuthority[5]; +} local_user_sid = { SID_REVISION, 5, { SECURITY_NT_AUTHORITY }, { SECURITY_NT_NON_UNIQUE, 0, 0, 0, 1000 } }; + const PSID security_world_sid = (PSID)&world_sid; static const PSID security_local_sid = (PSID)&local_sid; -const PSID security_interactive_sid = (PSID)&interactive_sid; +static const PSID security_interactive_sid = (PSID)&interactive_sid; static const PSID security_authenticated_user_sid = (PSID)&authenticated_user_sid; const PSID security_local_system_sid = (PSID)&local_system_sid; +const PSID security_local_user_sid = (PSID)&local_user_sid;
static luid_t prev_luid_value = { 1000, 0 };
@@ -194,7 +203,7 @@ const SID *security_unix_uid_to_sid( uid_t uid ) { /* very simple mapping: either the current user or not the current user */ if (uid == getuid()) - return &interactive_sid; + return (const SID *)&local_user_sid; else return &anonymous_logon_sid; }