server: Map the Unix user id to a local user SID instead of the interactive SID.

This commit is contained in:
Hans Leidekker 2011-03-02 10:46:12 +01:00 committed by Alexandre Julliard
parent d523dee76b
commit c65bcce589
5 changed files with 17 additions and 15 deletions

View File

@ -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);

View File

@ -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));

View File

@ -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, &current_user_str );
current_user_path = format_user_registry_path( security_local_user_sid, &current_user_str );
if (!current_user_path ||
!(hkcu = create_key_recursive( root_key, &current_user_str, current_time )))
fatal_error( "could not create HKEY_CURRENT_USER registry key\n" );

View File

@ -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;

View File

@ -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;
}