* pinfo.cc (pinfo_init): Add missing initializers.

* uinfo.cc (internal_getlogin): Request domain infos only
        when ntsec is ON.
This commit is contained in:
Corinna Vinschen 2000-06-17 11:34:33 +00:00
parent e962f3c5f7
commit 9bbb81a443
3 changed files with 31 additions and 28 deletions

View File

@ -1,3 +1,9 @@
Sat Jun 17 13:29:00 2000 Corinna Vinschen <corinna@vinschen.de>
* pinfo.cc (pinfo_init): Add missing initializers.
* uinfo.cc (internal_getlogin): Request domain infos only
when ntsec is ON.
Fri Jun 16 19:27:27 2000 Christopher Faylor <cgf@cygnus.com>
* Makefile.in: Just use library files from this tree when building
@ -5,7 +11,7 @@ Fri Jun 16 19:27:27 2000 Christopher Faylor <cgf@cygnus.com>
* path.cc (chdir): Don't set cache to offending chdir. Change comment
to reflect current reality.
Thu Jun 16 20:55:00 2000 Corinna Vinschen <corinna@vinschen.de>
Fri Jun 16 20:55:00 2000 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din: Define symbols for `cygwin_logon_user' and
`cygwin_set_impersonation_token'.

View File

@ -99,6 +99,8 @@ pinfo_init (LPBYTE info)
myself->ppid = myself->pgid = myself->sid = myself->pid;
myself->ctty = -1;
myself->uid = USHRT_MAX;
myself->logsrv[0] = '\0';
myself->domain[0] = '\0';
environ_init (0); /* call after myself has been set up */
}

View File

@ -27,15 +27,14 @@ char *
internal_getlogin (struct pinfo *pi)
{
DWORD username_len = MAX_USER_NAME;
LPWKSTA_USER_INFO_1 ui = NULL;
if (! pi)
api_fatal ("pinfo pointer is NULL!\n");
if (os_being_run == winNT)
{
int ret = NetWkstaUserGetInfo (NULL, 1, (LPBYTE *)&ui);
if (! ret)
LPWKSTA_USER_INFO_1 ui;
if (allow_ntsec && !NetWkstaUserGetInfo (NULL, 1, (LPBYTE *)&ui))
{
wcstombs (pi->domain,
ui->wkui1_logon_domain,
@ -56,7 +55,7 @@ internal_getlogin (struct pinfo *pi)
(wcslen (logon_srv) + 1) * sizeof (WCHAR));
if (logon_srv)
NetApiBufferFree (logon_srv);
debug_printf ("AnyDC Server: %s", pi->logsrv);
debug_printf ("DC Server: %s", pi->logsrv);
}
else
debug_printf ("Logon Server: %s", pi->logsrv);
@ -66,32 +65,28 @@ internal_getlogin (struct pinfo *pi)
debug_printf ("Windows Username: %s", pi->username);
NetApiBufferFree (ui);
}
else
else if (! GetUserName (pi->username, &username_len))
strcpy (pi->username, "unknown");
if (!lookup_name (pi->username, pi->logsrv, pi->psid))
{
debug_printf ("%d = NetWkstaUserGetInfo ()\n", ret);
if (! GetUserName (pi->username, &username_len))
strcpy (pi->username, "unknown");
debug_printf ("myself->psid = NULL");
pi->psid = NULL;
}
if (!lookup_name (pi->username, pi->logsrv, pi->psid))
{
debug_printf ("myself->psid = NULL");
pi->psid = NULL;
}
else if (allow_ntsec)
{
extern BOOL get_pw_sid (PSID, struct passwd*);
struct passwd *pw;
char psidbuf[40];
PSID psid = (PSID) psidbuf;
else if (allow_ntsec)
{
extern BOOL get_pw_sid (PSID, struct passwd*);
struct passwd *pw;
char psidbuf[40];
PSID psid = (PSID) psidbuf;
while ((pw = getpwent ()) != NULL)
if (get_pw_sid (psid, pw) && EqualSid (pi->psid, psid))
{
strcpy (pi->username, pw->pw_name);
break;
}
endpwent ();
}
while ((pw = getpwent ()) != NULL)
if (get_pw_sid (psid, pw) && EqualSid (pi->psid, psid))
{
strcpy (pi->username, pw->pw_name);
break;
}
endpwent ();
}
}
else
{