Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-06-16 09:26:14 +0400
committerChristopher Faylor <me@cgf.cx>2002-06-16 09:26:14 +0400
commit5f25e1d11a9760dd4728ae3a82c23884f50e244e (patch)
tree636eb589c7afe0357881d1276b272b9f7231cca9 /winsup/cygwin/uinfo.cc
parent5c8bce24b36e8cbbc107a43d8dfff0a9402ba5fd (diff)
* 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().
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r--winsup/cygwin/uinfo.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index eeec27566..ad61dd3ed 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -207,11 +207,13 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
memcpy (homedrive_env_buf, p, 2);
homedrive = homedrive_env_buf;
}
+
if ((p = getenv ("HOMEPATH")))
{
strcpy (homepath_env_buf, p);
homepath = homepath_env_buf;
}
+
if ((p = getenv ("HOME")))
debug_printf ("HOME is already in the environment %s", p);
else
@@ -307,6 +309,9 @@ cygheap_user::env_logsrv ()
if (plogsrv)
return plogsrv;
+ if (strcasematch (env_name (), "SYSTEM"))
+ return NULL;
+
char logsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3];
if (!get_logon_server (env_domain (), logsrv, NULL))
return NULL;
@@ -331,19 +336,21 @@ cygheap_user::env_domain ()
__seterrno ();
return NULL;
}
+ if (winname)
+ cfree (winname);
+ winname = cstrdup (username);
return pdomain = cstrdup (userdomain);
}
const char *
cygheap_user::env_userprofile ()
{
- if (strcasematch (name (), "SYSTEM") || !env_domain () || !env_logsrv ())
- return NULL;
-
- if (get_registry_hive_path (sid (), userprofile_env_buf))
+ /* FIXME: Should this just be setting a puserprofile like everything else? */
+ if (!strcasematch (env_name (), "SYSTEM")
+ && get_registry_hive_path (sid (), userprofile_env_buf))
return userprofile_env_buf;
- else
- return NULL;
+
+ return NULL;
}
const char *
@@ -361,5 +368,6 @@ cygheap_user::env_homedrive ()
const char *
cygheap_user::env_name ()
{
- return name ();
+ (void) env_domain ();
+ return winname;
}