From 094d51931173d399d5719411554e1c61af500bfe Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 29 Jun 2002 02:36:08 +0000 Subject: * cygheap.h (cygheap_user): Reorg to accommodate environment caching. (cygheap_user::logsrv): New method. (cygheap_user::winname): Ditto. (cygheap_user::domain): Ditto. (cygheap_user::test_uid): Ditto. * cygheap.cc (cygheap_user::set_name): Reflect name "pwinname" name change. * environ.cc (getwinenveq): New function. (spenv::from_cygheap): Change arguments. (spenv::retrieve): Ditto for call. Use getwinenveq to retrieve info from environment. Always return value from cygwin environment, if it exists. * environ.h (getwinenveq): Declare. * uinfo.cc (cygheap_user::ontherange): Use logsrv() rather than env_logsrv(). (cygheap_user::test_uid): Define new method. (cygheap_user::env_logsrv): Accept environment arguments. Use test_uid to find info. (cygheap_user::env_domain): Ditto. (cygheap_user::env_userprofile): Ditto. (cygheap_user::env_homepath): Ditto. (cygheap_user::env_homedrive): Ditto. (cygheap_user::env_name): Ditto. --- winsup/cygwin/cygheap.h | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'winsup/cygwin/cygheap.h') diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h index e2fcaec31..63585d91a 100644 --- a/winsup/cygwin/cygheap.h +++ b/winsup/cygwin/cygheap.h @@ -93,6 +93,7 @@ enum homebodies }; struct passwd; + class cygheap_user { /* Extendend user information. @@ -103,7 +104,7 @@ class cygheap_user char *pdomain; /* Logon domain of the user */ char *homedrive; /* User's home drive */ char *homepath; /* User's home path */ - char *winname; /* User's name as far as Windows knows it */ + char *pwinname; /* User's name as far as Windows knows it */ char *puserprof; /* User profile */ PSID psid; /* buffer for user's SID */ PSID orig_psid; /* Remains intact even after impersonation */ @@ -134,13 +135,25 @@ public: void set_name (const char *new_name); const char *name () const { return pname; } - const char *env_logsrv (); - const char *env_homepath (); - const char *env_homedrive (); - const char *env_userprofile (); - const char *env_domain (); - const char *env_name (); + const char *env_logsrv (const char *, size_t); + const char *env_homepath (const char *, size_t); + const char *env_homedrive (const char *, size_t); + const char *env_userprofile (const char *, size_t); + const char *env_domain (const char *, size_t); + const char *env_name (const char *, size_t); + const char *logsrv () + { + return env_logsrv ("LOGONSERVER=", sizeof ("LOGONSERVER=") - 1); + } + const char *winname () + { + return env_name ("USERNAME=", sizeof ("USERNAME=") - 1); + } + const char *domain () + { + return env_domain ("USERDOMAIN=", sizeof ("USERDOMAIN=") - 1); + } BOOL set_sid (PSID new_sid); BOOL set_orig_sid (); PSID sid () const { return psid; } @@ -150,6 +163,8 @@ public: { return impersonated && token != INVALID_HANDLE_VALUE; } + const char *cygheap_user::test_uid (char *&, const char *, size_t) + __attribute__ ((regparm (3))); }; /* cwd cache stuff. */ -- cgit v1.2.3