* cygheap.h (cygheap_user::winname): New field.
* cygheap.cc (cygheap_user::set_name): Clear winname when name changes. * uinfo.cc (cygheap_user::env_logsrv): Avoid calculating server when Windows user == SYSTEM. (cygheap_user::env_domain): Set winname here too. (cygheap_user::env_userprofile): Eliminate superfluous tests. (cygheap_user::env_name): Seed winname by calling env_domain().
This commit is contained in:
parent
5c8bce24b3
commit
5f25e1d11a
|
@ -1,3 +1,13 @@
|
||||||
|
2002-06-16 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* cygheap.h (cygheap_user::winname): New field.
|
||||||
|
* cygheap.cc (cygheap_user::set_name): Clear winname when name changes.
|
||||||
|
* uinfo.cc (cygheap_user::env_logsrv): Avoid calculating server when
|
||||||
|
Windows user == SYSTEM.
|
||||||
|
(cygheap_user::env_domain): Set winname here too.
|
||||||
|
(cygheap_user::env_userprofile): Eliminate superfluous tests.
|
||||||
|
(cygheap_user::env_name): Seed winname by calling env_domain().
|
||||||
|
|
||||||
2002-06-12 Pierre Humblet <pierre.humblet@ieee.org>
|
2002-06-12 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
* spawn.cc (spawn_guts): Revert removal of ciresrv.moreinfo->uid =
|
* spawn.cc (spawn_guts): Revert removal of ciresrv.moreinfo->uid =
|
||||||
|
|
|
@ -449,7 +449,9 @@ cygheap_user::set_name (const char *new_name)
|
||||||
cfree (plogsrv);
|
cfree (plogsrv);
|
||||||
if (pdomain)
|
if (pdomain)
|
||||||
cfree (pdomain);
|
cfree (pdomain);
|
||||||
plogsrv = pdomain = NULL;
|
if (winname)
|
||||||
|
cfree (winname);
|
||||||
|
plogsrv = pdomain = winname = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
|
|
|
@ -103,6 +103,7 @@ class cygheap_user
|
||||||
char *pdomain; /* Logon domain of the user */
|
char *pdomain; /* Logon domain of the user */
|
||||||
char *homedrive; /* User's home drive */
|
char *homedrive; /* User's home drive */
|
||||||
char *homepath; /* User's home path */
|
char *homepath; /* User's home path */
|
||||||
|
char *winname; /* User's name as far as Windows knows it */
|
||||||
PSID psid; /* buffer for user's SID */
|
PSID psid; /* buffer for user's SID */
|
||||||
PSID orig_psid; /* Remains intact even after impersonation */
|
PSID orig_psid; /* Remains intact even after impersonation */
|
||||||
static char homedrive_env_buf[3]; /* Where the HOMEDRIVE environment variable
|
static char homedrive_env_buf[3]; /* Where the HOMEDRIVE environment variable
|
||||||
|
|
|
@ -207,11 +207,13 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
|
||||||
memcpy (homedrive_env_buf, p, 2);
|
memcpy (homedrive_env_buf, p, 2);
|
||||||
homedrive = homedrive_env_buf;
|
homedrive = homedrive_env_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p = getenv ("HOMEPATH")))
|
if ((p = getenv ("HOMEPATH")))
|
||||||
{
|
{
|
||||||
strcpy (homepath_env_buf, p);
|
strcpy (homepath_env_buf, p);
|
||||||
homepath = homepath_env_buf;
|
homepath = homepath_env_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p = getenv ("HOME")))
|
if ((p = getenv ("HOME")))
|
||||||
debug_printf ("HOME is already in the environment %s", p);
|
debug_printf ("HOME is already in the environment %s", p);
|
||||||
else
|
else
|
||||||
|
@ -307,6 +309,9 @@ cygheap_user::env_logsrv ()
|
||||||
if (plogsrv)
|
if (plogsrv)
|
||||||
return plogsrv;
|
return plogsrv;
|
||||||
|
|
||||||
|
if (strcasematch (env_name (), "SYSTEM"))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
char logsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3];
|
char logsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3];
|
||||||
if (!get_logon_server (env_domain (), logsrv, NULL))
|
if (!get_logon_server (env_domain (), logsrv, NULL))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -331,19 +336,21 @@ cygheap_user::env_domain ()
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (winname)
|
||||||
|
cfree (winname);
|
||||||
|
winname = cstrdup (username);
|
||||||
return pdomain = cstrdup (userdomain);
|
return pdomain = cstrdup (userdomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
cygheap_user::env_userprofile ()
|
cygheap_user::env_userprofile ()
|
||||||
{
|
{
|
||||||
if (strcasematch (name (), "SYSTEM") || !env_domain () || !env_logsrv ())
|
/* FIXME: Should this just be setting a puserprofile like everything else? */
|
||||||
return NULL;
|
if (!strcasematch (env_name (), "SYSTEM")
|
||||||
|
&& get_registry_hive_path (sid (), userprofile_env_buf))
|
||||||
if (get_registry_hive_path (sid (), userprofile_env_buf))
|
|
||||||
return userprofile_env_buf;
|
return userprofile_env_buf;
|
||||||
else
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
@ -361,5 +368,6 @@ cygheap_user::env_homedrive ()
|
||||||
const char *
|
const char *
|
||||||
cygheap_user::env_name ()
|
cygheap_user::env_name ()
|
||||||
{
|
{
|
||||||
return name ();
|
(void) env_domain ();
|
||||||
|
return winname;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue