* cygheap.cc (cygheap_user::set_saved_sid): Rename from set_orig_sid.
* cygheap.h (class cygheap_user): Rename orig_psid, orig_uid and orig_gid to saved_psid, saved_uid and saved_gid respectively. Rename methods orig_sid and set_orig_sid to saved_sid and set_saved_sid respectively. * sec_helper.cc (sec_acl): Accomodate above changes. * spawn.cc (spawn_guts): Ditto. * uinfo.cc (uinfo_init): Ditto.
This commit is contained in:
parent
c429c346d8
commit
1498189ca8
|
@ -1,3 +1,14 @@
|
||||||
|
2003-09-16 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* cygheap.cc (cygheap_user::set_saved_sid): Rename from set_orig_sid.
|
||||||
|
* cygheap.h (class cygheap_user): Rename orig_psid, orig_uid and
|
||||||
|
orig_gid to saved_psid, saved_uid and saved_gid respectively.
|
||||||
|
Rename methods orig_sid and set_orig_sid to saved_sid and set_saved_sid
|
||||||
|
respectively.
|
||||||
|
* sec_helper.cc (sec_acl): Accomodate above changes.
|
||||||
|
* spawn.cc (spawn_guts): Ditto.
|
||||||
|
* uinfo.cc (uinfo_init): Ditto.
|
||||||
|
|
||||||
2003-09-15 Christopher Faylor <cgf@redhat.com>
|
2003-09-15 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* getopt.c (opterr): Reinstate initialization.
|
* getopt.c (opterr): Reinstate initialization.
|
||||||
|
|
|
@ -458,13 +458,14 @@ cygheap_user::set_sid (PSID new_sid)
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
cygheap_user::set_orig_sid ()
|
cygheap_user::set_saved_sid ()
|
||||||
{
|
{
|
||||||
if (psid)
|
if (psid)
|
||||||
{
|
{
|
||||||
if (!orig_psid) orig_psid = cmalloc (HEAP_STR, MAX_SID_LEN);
|
if (!saved_psid)
|
||||||
if (orig_psid)
|
saved_psid = cmalloc (HEAP_STR, MAX_SID_LEN);
|
||||||
return CopySid (MAX_SID_LEN, orig_psid, psid);
|
if (saved_psid)
|
||||||
|
return CopySid (MAX_SID_LEN, saved_psid, psid);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,10 +107,10 @@ class cygheap_user
|
||||||
char *pwinname; /* User's name as far as Windows knows it */
|
char *pwinname; /* User's name as far as Windows knows it */
|
||||||
char *puserprof; /* User profile */
|
char *puserprof; /* User profile */
|
||||||
PSID psid; /* buffer for user's SID */
|
PSID psid; /* buffer for user's SID */
|
||||||
PSID orig_psid; /* Remains intact even after impersonation */
|
PSID saved_psid; /* Remains intact even after impersonation */
|
||||||
public:
|
public:
|
||||||
__uid32_t orig_uid; /* Remains intact even after impersonation */
|
__uid32_t saved_uid; /* Remains intact even after impersonation */
|
||||||
__gid32_t orig_gid; /* Ditto */
|
__gid32_t saved_gid; /* Ditto */
|
||||||
__uid32_t real_uid; /* Remains intact on seteuid, replaced by setuid */
|
__uid32_t real_uid; /* Remains intact on seteuid, replaced by setuid */
|
||||||
__gid32_t real_gid; /* Ditto */
|
__gid32_t real_gid; /* Ditto */
|
||||||
user_groups groups; /* Primary and supp SIDs */
|
user_groups groups; /* Primary and supp SIDs */
|
||||||
|
@ -128,7 +128,7 @@ public:
|
||||||
I've removed the constructor entirely. Please reinstate this f this
|
I've removed the constructor entirely. Please reinstate this f this
|
||||||
situation ever changes.
|
situation ever changes.
|
||||||
cygheap_user () : pname (NULL), plogsrv (NULL), pdomain (NULL),
|
cygheap_user () : pname (NULL), plogsrv (NULL), pdomain (NULL),
|
||||||
homedrive (NULL), homepath (NULL), psid (NULL),
|
homedrive (NULL), homepath (NULL),
|
||||||
token (INVALID_HANDLE_VALUE) {}
|
token (INVALID_HANDLE_VALUE) {}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -161,9 +161,9 @@ public:
|
||||||
return (p == almost_null) ? NULL : p;
|
return (p == almost_null) ? NULL : p;
|
||||||
}
|
}
|
||||||
BOOL set_sid (PSID new_sid);
|
BOOL set_sid (PSID new_sid);
|
||||||
BOOL set_orig_sid ();
|
BOOL set_saved_sid ();
|
||||||
PSID sid () const { return psid; }
|
PSID sid () const { return psid; }
|
||||||
PSID orig_sid () const { return orig_psid; }
|
PSID saved_sid () const { return saved_psid; }
|
||||||
const char *ontherange (homebodies what, struct passwd * = NULL);
|
const char *ontherange (homebodies what, struct passwd * = NULL);
|
||||||
bool issetuid () const { return current_token != INVALID_HANDLE_VALUE; }
|
bool issetuid () const { return current_token != INVALID_HANDLE_VALUE; }
|
||||||
HANDLE token () { return current_token; }
|
HANDLE token () { return current_token; }
|
||||||
|
|
|
@ -386,7 +386,7 @@ sec_acl (PACL acl, bool original, bool admins, PSID sid1, PSID sid2, DWORD acces
|
||||||
if (!AddAccessAllowedAce (acl, ACL_REVISION,
|
if (!AddAccessAllowedAce (acl, ACL_REVISION,
|
||||||
GENERIC_ALL, sid1))
|
GENERIC_ALL, sid1))
|
||||||
debug_printf ("AddAccessAllowedAce(sid1) %E");
|
debug_printf ("AddAccessAllowedAce(sid1) %E");
|
||||||
if (original && (psid = cygheap->user.orig_sid ())
|
if (original && (psid = cygheap->user.saved_sid ())
|
||||||
&& psid != sid1 && psid != well_known_system_sid)
|
&& psid != sid1 && psid != well_known_system_sid)
|
||||||
if (!AddAccessAllowedAce (acl, ACL_REVISION,
|
if (!AddAccessAllowedAce (acl, ACL_REVISION,
|
||||||
GENERIC_ALL, psid))
|
GENERIC_ALL, psid))
|
||||||
|
|
|
@ -625,11 +625,11 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
||||||
/* When ruid != euid we create the new process under the current original
|
/* When ruid != euid we create the new process under the current original
|
||||||
account and impersonate in child, this way maintaining the different
|
account and impersonate in child, this way maintaining the different
|
||||||
effective vs. real ids.
|
effective vs. real ids.
|
||||||
FIXME: If ruid != euid and ruid != orig_uid we currently give
|
FIXME: If ruid != euid and ruid != saved_uid we currently give
|
||||||
up on ruid. The new process will have ruid == euid. */
|
up on ruid. The new process will have ruid == euid. */
|
||||||
if (!cygheap->user.issetuid ()
|
if (!cygheap->user.issetuid ()
|
||||||
|| (cygheap->user.orig_uid == cygheap->user.real_uid
|
|| (cygheap->user.saved_uid == cygheap->user.real_uid
|
||||||
&& cygheap->user.orig_gid == cygheap->user.real_gid
|
&& cygheap->user.saved_gid == cygheap->user.real_gid
|
||||||
&& !cygheap->user.groups.issetgroups ()))
|
&& !cygheap->user.groups.issetgroups ()))
|
||||||
{
|
{
|
||||||
PSECURITY_ATTRIBUTES sec_attribs = sec_user_nih (sa_buf);
|
PSECURITY_ATTRIBUTES sec_attribs = sec_user_nih (sa_buf);
|
||||||
|
|
|
@ -128,8 +128,8 @@ uinfo_init ()
|
||||||
/* Conditions must match those in spawn to allow starting child
|
/* Conditions must match those in spawn to allow starting child
|
||||||
processes with ruid != euid and rgid != egid. */
|
processes with ruid != euid and rgid != egid. */
|
||||||
else if (cygheap->user.issetuid ()
|
else if (cygheap->user.issetuid ()
|
||||||
&& cygheap->user.orig_uid == cygheap->user.real_uid
|
&& cygheap->user.saved_uid == cygheap->user.real_uid
|
||||||
&& cygheap->user.orig_gid == cygheap->user.real_gid
|
&& cygheap->user.saved_gid == cygheap->user.real_gid
|
||||||
&& !cygheap->user.groups.issetgroups ())
|
&& !cygheap->user.groups.issetgroups ())
|
||||||
{
|
{
|
||||||
cygheap->user.reimpersonate ();
|
cygheap->user.reimpersonate ();
|
||||||
|
@ -138,12 +138,12 @@ uinfo_init ()
|
||||||
else
|
else
|
||||||
cygheap->user.close_impersonation_tokens ();
|
cygheap->user.close_impersonation_tokens ();
|
||||||
|
|
||||||
cygheap->user.orig_uid = cygheap->user.real_uid = myself->uid;
|
cygheap->user.saved_uid = cygheap->user.real_uid = myself->uid;
|
||||||
cygheap->user.orig_gid = cygheap->user.real_gid = myself->gid;
|
cygheap->user.saved_gid = cygheap->user.real_gid = myself->gid;
|
||||||
cygheap->user.external_token = INVALID_HANDLE_VALUE;
|
cygheap->user.external_token = INVALID_HANDLE_VALUE;
|
||||||
cygheap->user.internal_token = INVALID_HANDLE_VALUE;
|
cygheap->user.internal_token = INVALID_HANDLE_VALUE;
|
||||||
cygheap->user.current_token = INVALID_HANDLE_VALUE;
|
cygheap->user.current_token = INVALID_HANDLE_VALUE;
|
||||||
cygheap->user.set_orig_sid (); /* Update the original sid */
|
cygheap->user.set_saved_sid (); /* Update the original sid */
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char *
|
extern "C" char *
|
||||||
|
|
Loading…
Reference in New Issue