On Windows 8.1 and later, the NetUserChangePassword call apparently
doesn't accept the usual "\\server" string anymore, but requires to
use the "domain" instead, otherwise it emits en error code 1265,
ERROR_DOWNGRADE_DETECTED. Since this is accepted by pre-8.1 as well,
use the domain indiscriminately when calling NetUserChangePassword
from passwd(1).
While at it, do some minor cleanup in passwd.c.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause.
Everything else stays under GPLv3+.
New Linking Exception exempts resulting executables from LGPLv3 section 4.
Add CONTRIBUTORS file to keep track of licensing.
Remove 'Copyright Red Hat Inc' comments.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
user, try to fetch the DC to use as server.
(ChangePW): Get Windows username via extra parameter.
(usage): Reduce -d help text to reflect above change.
(main): Fix typo in comment. Call GetPW and ChangePW as per the
changes above.
option handling to use the same style throughout all Cygwin utils.
Throughout use program_invocation_short_name to refer to current
process name in Cygwin executables.
* utils.sgml: Align documentation to above change. Add missing
sections for getconf, ldd, and setmetamode.
* strace.cc (proc_child): Avoid compiler warning.
is an administrator by inspecting user token.
(main): Drop fetching caller info from logonserver. Only fetch
server from environment when trying to change password for own
account. Drop admin check entirely in case of doing account
maintainance. Otherwise replace check for admin by result of
caller_is_admin call.
* passwd.c: Use mbstowcs instead of MultiByteToWideChar throughout.
(main): Call setlocale. Fix a bug in fetching the logon server from
the environment.
(opts): Add -R option.
(usage): Add text for -R/--reg-store-pwd option.
(main): Fix size of local user and password string arrays.
Handle -R option.
* utils.sgml: Add text for passwd -R/--reg-store-pwd option.
(opts): Add -d option.
(GetPW): Add server parameter which is given to Net functions.
(ChangePW): Ditto.
(PrintPW): Ditto.
(SetModals): Ditto.
(usage): Add description for -d/--logonserver option.
(main): Add option handling for -d/--logonserver. Use LOGONSERVER
environment variable content for server to contact, unless
-d/--logonserver option is given. If both is missing, use NULL.
(version): Bump version number to 1.5.
(longopts): Add -c, -C, -e, -E, -p, -P options.
(opts): Ditto.
(PrintPW): Print values of UF_PASSWD_CANT_CHANGE and
UF_DONT_EXPIRE_PASSWD flags. Slightly reformat output. Don't suppress
correct system password settings just because the account has admin
privileges.
(usage): Define as "noreturn" function. Restructure and rephrase
output. Accomodate new options.
(print_version): Fix copyright dates.
(main): Accomodate new options for setting UF_PASSWD_CANT_CHANGE,
UF_DONT_EXPIRE_PASSWD and UF_PASSWD_NOTREQD settings.
(GetPW): Add parameter to (dis)allow printing of Windows username.
Use defines instead of numerical constants where possible.
Try avoiding impersonation problem. Rearrange to print Windows
username only if it's different from Cygwin username.
(ChangePW): Use defines instead of numerical constants where possible.
(main): Call GetPW with additional parameter. Change error text.
* passwd.c (GetPW): Handle case of user-edited /etc/passwd
with cygwin_internal (CW_EXTRACT_DOMAIN_AND_USER, ...).
checking old password and called for changing password. If called
for checking old password, return non-zero only if password is surely
incorrect.
(main): Call ChangePW() with additional parameter.