summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/cygheap.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/cygheap.cc')
-rw-r--r--winsup/cygwin/cygheap.cc54
1 files changed, 17 insertions, 37 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 723fde2ff..8f76b5b85 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -445,54 +445,34 @@ cygheap_user::set_name (const char *new_name)
pname = cstrdup (new_name ? new_name : "");
homedrive = NULL;
homepath = NULL;
-}
-
-void
-cygheap_user::set_logsrv (const char *new_logsrv)
-{
if (plogsrv)
- cfree (plogsrv - 2);
- if (!new_logsrv || !*new_logsrv)
- plogsrv = NULL;
- else
- {
- plogsrv = (char *) cmalloc (HEAP_STR, strlen (new_logsrv) + 3) + 2;
- strcpy (plogsrv, new_logsrv);
- }
-}
-
-void
-cygheap_user::set_domain (const char *new_domain)
-{
+ cfree (plogsrv);
if (pdomain)
cfree (pdomain);
- pdomain = (new_domain && *new_domain) ? cstrdup (new_domain) : NULL;
+ plogsrv = pdomain = NULL;
}
BOOL
cygheap_user::set_sid (PSID new_sid)
{
- if (!new_sid)
+ if (new_sid)
{
+ if (!psid)
+ psid = cmalloc (HEAP_STR, MAX_SID_LEN);
if (psid)
- cfree (psid);
- if (orig_psid)
- cfree (orig_psid);
- psid = NULL;
- orig_psid = NULL;
- return TRUE;
+ return CopySid (MAX_SID_LEN, psid, new_sid);
}
- else
+ return FALSE;
+}
+
+BOOL
+cygheap_user::set_orig_sid ()
+{
+ if (psid)
{
- if (!psid)
- {
- if (!orig_psid)
- {
- orig_psid = cmalloc (HEAP_STR, MAX_SID_LEN);
- CopySid (MAX_SID_LEN, orig_psid, new_sid);
- }
- psid = cmalloc (HEAP_STR, MAX_SID_LEN);
- }
- return CopySid (MAX_SID_LEN, psid, new_sid);
+ if (!orig_psid) orig_psid = cmalloc (HEAP_STR, MAX_SID_LEN);
+ if (orig_psid)
+ return CopySid (MAX_SID_LEN, orig_psid, psid);
}
+ return FALSE;
}