* uinfo.cc (cygheap_user::ontherange): Use env_name for NetUserGetInfo.
(cygheap_user::env_logsrv): Verify env_domain is valid. * environ.cc: Include child_info.h and keep spenvs[] sorted. (environ_init): Check child_proc_info instead of myself->ppid_handle.
This commit is contained in:
parent
a7b23a8f11
commit
7c02f861e3
|
@ -1,3 +1,10 @@
|
||||||
|
2002-06-20 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
|
* uinfo.cc (cygheap_user::ontherange): Use env_name for NetUserGetInfo.
|
||||||
|
(cygheap_user::env_logsrv): Verify env_domain is valid.
|
||||||
|
* environ.cc: Include child_info.h and keep spenvs[] sorted.
|
||||||
|
(environ_init): Check child_proc_info instead of myself->ppid_handle.
|
||||||
|
|
||||||
2002-06-19 Christopher Faylor <cgf@redhat.com>
|
2002-06-19 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* fhandler.cc (fhandler_base::set_flags): Change priority of "linked
|
* fhandler.cc (fhandler_base::set_flags): Change priority of "linked
|
||||||
|
|
|
@ -460,7 +460,7 @@ cygheap_user::set_sid (PSID new_sid)
|
||||||
if (new_sid)
|
if (new_sid)
|
||||||
{
|
{
|
||||||
if (!psid)
|
if (!psid)
|
||||||
psid = cmalloc (HEAP_STR, MAX_SID_LEN);
|
psid = cmalloc (HEAP_STR, MAX_SID_LEN);
|
||||||
if (psid)
|
if (psid)
|
||||||
return CopySid (MAX_SID_LEN, psid, new_sid);
|
return CopySid (MAX_SID_LEN, psid, new_sid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ details. */
|
||||||
#include "cygheap.h"
|
#include "cygheap.h"
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
#include "environ.h"
|
#include "environ.h"
|
||||||
|
#include "child_info.h"
|
||||||
|
|
||||||
extern BOOL allow_daemon;
|
extern BOOL allow_daemon;
|
||||||
extern BOOL allow_glob;
|
extern BOOL allow_glob;
|
||||||
|
@ -712,7 +713,7 @@ environ_init (char **envp, int envc)
|
||||||
char *eq;
|
char *eq;
|
||||||
if ((eq = strchr (newp, '=')) == NULL)
|
if ((eq = strchr (newp, '=')) == NULL)
|
||||||
eq = strchr (newp, '\0');
|
eq = strchr (newp, '\0');
|
||||||
if (!myself->ppid_handle)
|
if (!child_proc_info)
|
||||||
ucenv (newp, eq);
|
ucenv (newp, eq);
|
||||||
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
|
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
|
||||||
sawTERM = 1;
|
sawTERM = 1;
|
||||||
|
@ -765,8 +766,8 @@ char env_dontadd[] = "";
|
||||||
/* Keep this list in upper case and sorted */
|
/* Keep this list in upper case and sorted */
|
||||||
static NO_COPY spenv spenvs[] =
|
static NO_COPY spenv spenvs[] =
|
||||||
{
|
{
|
||||||
{NL ("HOMEPATH="), &cygheap_user::env_homepath},
|
|
||||||
{NL ("HOMEDRIVE="), &cygheap_user::env_homedrive},
|
{NL ("HOMEDRIVE="), &cygheap_user::env_homedrive},
|
||||||
|
{NL ("HOMEPATH="), &cygheap_user::env_homepath},
|
||||||
{NL ("LOGONSERVER="), &cygheap_user::env_logsrv},
|
{NL ("LOGONSERVER="), &cygheap_user::env_logsrv},
|
||||||
{NL ("SYSTEMDRIVE="), NULL},
|
{NL ("SYSTEMDRIVE="), NULL},
|
||||||
{NL ("SYSTEMROOT="), NULL},
|
{NL ("SYSTEMROOT="), NULL},
|
||||||
|
@ -809,7 +810,7 @@ spenv::retrieve (bool no_envblock, const char *const envname)
|
||||||
/* Calculate (potentially) value for given environment variable. */
|
/* Calculate (potentially) value for given environment variable. */
|
||||||
p = (cygheap->user.*from_cygheap) ();
|
p = (cygheap->user.*from_cygheap) ();
|
||||||
if (!p || (no_envblock && !envname))
|
if (!p || (no_envblock && !envname))
|
||||||
return env_dontadd;
|
return env_dontadd;
|
||||||
char *s = (char *) cmalloc (HEAP_1_STR, namelen + strlen (p) + 1);
|
char *s = (char *) cmalloc (HEAP_1_STR, namelen + strlen (p) + 1);
|
||||||
strcpy (s, name);
|
strcpy (s, name);
|
||||||
(void) strcpy (s + namelen, p);
|
(void) strcpy (s + namelen, p);
|
||||||
|
|
|
@ -234,7 +234,7 @@ cygwin_internal (cygwin_getinfo_types t, ...)
|
||||||
return p ? p->dwProcessId : 0;
|
return p ? p->dwProcessId : 0;
|
||||||
}
|
}
|
||||||
case CW_EXTRACT_DOMAIN_AND_USER:
|
case CW_EXTRACT_DOMAIN_AND_USER:
|
||||||
{
|
{
|
||||||
struct passwd *pw = va_arg (arg, struct passwd *);
|
struct passwd *pw = va_arg (arg, struct passwd *);
|
||||||
char *domain = va_arg (arg, char *);
|
char *domain = va_arg (arg, char *);
|
||||||
char *user = va_arg (arg, char *);
|
char *user = va_arg (arg, char *);
|
||||||
|
|
|
@ -268,7 +268,7 @@ get_logon_server (const char *domain, char *server, WCHAR *wserver)
|
||||||
{
|
{
|
||||||
server[0] = server[1] = '\\';
|
server[0] = server[1] = '\\';
|
||||||
if (wserver)
|
if (wserver)
|
||||||
sys_mbstowcs (wserver, server, INTERNET_MAX_HOST_NAME_LENGTH + 1);
|
sys_mbstowcs (wserver, server, INTERNET_MAX_HOST_NAME_LENGTH + 1);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ get_group_sidlist (cygsidlist &grp_list,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!get_logon_server (domain, server, wserver))
|
if (!get_logon_server (domain, server, wserver))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (my_grps)
|
if (my_grps)
|
||||||
{
|
{
|
||||||
if (sid_in_token_groups (my_grps, well_known_local_sid))
|
if (sid_in_token_groups (my_grps, well_known_local_sid))
|
||||||
|
@ -544,8 +544,8 @@ get_group_sidlist (cygsidlist &grp_list,
|
||||||
auth_pos = grp_list.count - 1;
|
auth_pos = grp_list.count - 1;
|
||||||
}
|
}
|
||||||
if (!get_user_groups (wserver, grp_list, user, domain) ||
|
if (!get_user_groups (wserver, grp_list, user, domain) ||
|
||||||
!get_user_local_groups (grp_list, usersid))
|
!get_user_local_groups (grp_list, usersid))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* special_pgrp true if pgrpsid is not null and not in normal groups */
|
/* special_pgrp true if pgrpsid is not null and not in normal groups */
|
||||||
if (!pgrpsid)
|
if (!pgrpsid)
|
||||||
|
|
|
@ -1588,7 +1588,7 @@ __pthread_join (pthread_t *thread, void **return_val)
|
||||||
if ( joiner == *thread)
|
if ( joiner == *thread)
|
||||||
{
|
{
|
||||||
if (return_val)
|
if (return_val)
|
||||||
*return_val = NULL;
|
*return_val = NULL;
|
||||||
return EDEADLK;
|
return EDEADLK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1597,7 +1597,7 @@ __pthread_join (pthread_t *thread, void **return_val)
|
||||||
if((*thread)->attr.joinable == PTHREAD_CREATE_DETACHED)
|
if((*thread)->attr.joinable == PTHREAD_CREATE_DETACHED)
|
||||||
{
|
{
|
||||||
if (return_val)
|
if (return_val)
|
||||||
*return_val = NULL;
|
*return_val = NULL;
|
||||||
(*thread)->mutex.UnLock ();
|
(*thread)->mutex.UnLock ();
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -1608,7 +1608,7 @@ __pthread_join (pthread_t *thread, void **return_val)
|
||||||
(*thread)->mutex.UnLock ();
|
(*thread)->mutex.UnLock ();
|
||||||
WaitForSingleObject ((*thread)->win32_obj_id, INFINITE);
|
WaitForSingleObject ((*thread)->win32_obj_id, INFINITE);
|
||||||
if (return_val)
|
if (return_val)
|
||||||
*return_val = (*thread)->return_ptr;
|
*return_val = (*thread)->return_ptr;
|
||||||
// cleanup
|
// cleanup
|
||||||
delete (*thread);
|
delete (*thread);
|
||||||
} /*End if */
|
} /*End if */
|
||||||
|
|
|
@ -49,7 +49,7 @@ internal_getlogin (cygheap_user &user)
|
||||||
else if (!GetTokenInformation (ptok, TokenUser, &tu, sizeof tu, &siz))
|
else if (!GetTokenInformation (ptok, TokenUser, &tu, sizeof tu, &siz))
|
||||||
system_printf ("GetTokenInformation(): %E");
|
system_printf ("GetTokenInformation(): %E");
|
||||||
else if (!(ret = user.set_sid (tu)))
|
else if (!(ret = user.set_sid (tu)))
|
||||||
system_printf ("Couldn't retrieve SID from access token!");
|
system_printf ("Couldn't retrieve SID from access token!");
|
||||||
/* We must set the user name, uid and gid.
|
/* We must set the user name, uid and gid.
|
||||||
If we have a SID, try to get the corresponding Cygwin
|
If we have a SID, try to get the corresponding Cygwin
|
||||||
password entry. Set user name which can be different
|
password entry. Set user name which can be different
|
||||||
|
@ -251,7 +251,7 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
|
||||||
WCHAR wlogsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3];
|
WCHAR wlogsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3];
|
||||||
sys_mbstowcs (wlogsrv, env_logsrv (),
|
sys_mbstowcs (wlogsrv, env_logsrv (),
|
||||||
sizeof (wlogsrv) / sizeof(*wlogsrv));
|
sizeof (wlogsrv) / sizeof(*wlogsrv));
|
||||||
sys_mbstowcs (wuser, name (), sizeof (wuser) / sizeof (*wuser));
|
sys_mbstowcs (wuser, env_name (), sizeof (wuser) / sizeof (*wuser));
|
||||||
if (!(ret = NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui)))
|
if (!(ret = NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui)))
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
@ -304,7 +304,7 @@ cygheap_user::env_logsrv ()
|
||||||
if (plogsrv)
|
if (plogsrv)
|
||||||
return plogsrv;
|
return plogsrv;
|
||||||
|
|
||||||
if (strcasematch (env_name (), "SYSTEM"))
|
if (!env_domain () || strcasematch (env_name (), "SYSTEM"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
char logsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3];
|
char logsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3];
|
||||||
|
|
Loading…
Reference in New Issue