Takashi Yano [Sat, 16 Jun 2018 12:59:30 +0000 (21:59 +0900)]
Fix the issue that login command with -f flag fails to switch user account.
* login.c (main): Use getpwnam_r() instead of getpwnam() to prevent
the area pointed to by pwd from being overwritten by other calls of
getpw*() family functions.
* login.c (isROOT_UID): Remove checking SeIncreaseQuotaPrivilege
privilege because the account cyg_server created by csih does not
have this privilege.
* winsec.c (getUserInfoForUID): Fix the first argument of the second
NetUserGetInfo() call so that it can check user information locally
if the machine is on a domain.
Refer to the following post for detail.
https://cygwin.com/ml/cygwin/2018-06/msg00146.html
Corinna Vinschen [Wed, 15 Oct 2014 18:56:06 +0000 (18:56 +0000)]
* login.c: Minor cleanups. Avoid compiler warnings.
(sccsid): Mark as used.
(testUserRightsByUID): Move declaration down to isROOT_UID function.
(getstr): Remove unused function.
(currentUserIsLocalSystem): Drop declaration of unused external
function.
(currentUserIsMemberOfLocalAdministrators): Ditto.
(uidIsMemberOfLocalAdministrators): Enable declaration.
(testUserRightsByUID): Declare.
(isROOT_UID): Drop SeCreateTokenPrivilege as required privilege.
Ignore old Windows versions. Align comments.
Yaakov Selkowitz [Wed, 15 Oct 2014 01:44:34 +0000 (01:44 +0000)]
* winsec.c: Throughout, remove autoloading of advapi32 and
netapi32 symbols and use direct function calls instead.
* Makefile (login.exe): Add -lnetapi32.
(test_winsec.exe): Ditto.
Yaakov Selkowitz [Tue, 14 Oct 2014 00:19:24 +0000 (00:19 +0000)]
Drop support for Windows 9x.
* Makefile (login.exe): Remove -lcrypt.
(test_winsec.exe): Ditto.
* login.c (is_winnt): Remove definition.
(main): Make is_winnt code path unconditional.