* 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:
Christopher Faylor 2002-06-21 05:01:17 +00:00
parent a7b23a8f11
commit 7c02f861e3
7 changed files with 23 additions and 15 deletions

View File

@ -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>
* fhandler.cc (fhandler_base::set_flags): Change priority of "linked

View File

@ -460,7 +460,7 @@ cygheap_user::set_sid (PSID new_sid)
if (new_sid)
{
if (!psid)
psid = cmalloc (HEAP_STR, MAX_SID_LEN);
psid = cmalloc (HEAP_STR, MAX_SID_LEN);
if (psid)
return CopySid (MAX_SID_LEN, psid, new_sid);
}

View File

@ -25,6 +25,7 @@ details. */
#include "cygheap.h"
#include "registry.h"
#include "environ.h"
#include "child_info.h"
extern BOOL allow_daemon;
extern BOOL allow_glob;
@ -712,7 +713,7 @@ environ_init (char **envp, int envc)
char *eq;
if ((eq = strchr (newp, '=')) == NULL)
eq = strchr (newp, '\0');
if (!myself->ppid_handle)
if (!child_proc_info)
ucenv (newp, eq);
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
sawTERM = 1;
@ -765,8 +766,8 @@ char env_dontadd[] = "";
/* Keep this list in upper case and sorted */
static NO_COPY spenv spenvs[] =
{
{NL ("HOMEPATH="), &cygheap_user::env_homepath},
{NL ("HOMEDRIVE="), &cygheap_user::env_homedrive},
{NL ("HOMEPATH="), &cygheap_user::env_homepath},
{NL ("LOGONSERVER="), &cygheap_user::env_logsrv},
{NL ("SYSTEMDRIVE="), NULL},
{NL ("SYSTEMROOT="), NULL},
@ -809,7 +810,7 @@ spenv::retrieve (bool no_envblock, const char *const envname)
/* Calculate (potentially) value for given environment variable. */
p = (cygheap->user.*from_cygheap) ();
if (!p || (no_envblock && !envname))
return env_dontadd;
return env_dontadd;
char *s = (char *) cmalloc (HEAP_1_STR, namelen + strlen (p) + 1);
strcpy (s, name);
(void) strcpy (s + namelen, p);

View File

@ -234,7 +234,7 @@ cygwin_internal (cygwin_getinfo_types t, ...)
return p ? p->dwProcessId : 0;
}
case CW_EXTRACT_DOMAIN_AND_USER:
{
{
struct passwd *pw = va_arg (arg, struct passwd *);
char *domain = va_arg (arg, char *);
char *user = va_arg (arg, char *);

View File

@ -268,7 +268,7 @@ get_logon_server (const char *domain, char *server, WCHAR *wserver)
{
server[0] = server[1] = '\\';
if (wserver)
sys_mbstowcs (wserver, server, INTERNET_MAX_HOST_NAME_LENGTH + 1);
sys_mbstowcs (wserver, server, INTERNET_MAX_HOST_NAME_LENGTH + 1);
return TRUE;
}
@ -512,7 +512,7 @@ get_group_sidlist (cygsidlist &grp_list,
else
{
if (!get_logon_server (domain, server, wserver))
return FALSE;
return FALSE;
if (my_grps)
{
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;
}
if (!get_user_groups (wserver, grp_list, user, domain) ||
!get_user_local_groups (grp_list, usersid))
return FALSE;
!get_user_local_groups (grp_list, usersid))
return FALSE;
}
/* special_pgrp true if pgrpsid is not null and not in normal groups */
if (!pgrpsid)

View File

@ -1588,7 +1588,7 @@ __pthread_join (pthread_t *thread, void **return_val)
if ( joiner == *thread)
{
if (return_val)
*return_val = NULL;
*return_val = NULL;
return EDEADLK;
}
@ -1597,7 +1597,7 @@ __pthread_join (pthread_t *thread, void **return_val)
if((*thread)->attr.joinable == PTHREAD_CREATE_DETACHED)
{
if (return_val)
*return_val = NULL;
*return_val = NULL;
(*thread)->mutex.UnLock ();
return EINVAL;
}
@ -1608,7 +1608,7 @@ __pthread_join (pthread_t *thread, void **return_val)
(*thread)->mutex.UnLock ();
WaitForSingleObject ((*thread)->win32_obj_id, INFINITE);
if (return_val)
*return_val = (*thread)->return_ptr;
*return_val = (*thread)->return_ptr;
// cleanup
delete (*thread);
} /*End if */

View File

@ -49,7 +49,7 @@ internal_getlogin (cygheap_user &user)
else if (!GetTokenInformation (ptok, TokenUser, &tu, sizeof tu, &siz))
system_printf ("GetTokenInformation(): %E");
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.
If we have a SID, try to get the corresponding Cygwin
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];
sys_mbstowcs (wlogsrv, env_logsrv (),
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)))
{
char *p;
@ -304,7 +304,7 @@ cygheap_user::env_logsrv ()
if (plogsrv)
return plogsrv;
if (strcasematch (env_name (), "SYSTEM"))
if (!env_domain () || strcasematch (env_name (), "SYSTEM"))
return NULL;
char logsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3];