Commit Graph

34 Commits

Author SHA1 Message Date
Corinna Vinschen e7fca6f867 Cygwin: utils: convert usage() to proper noreturn function throughout
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-08-07 15:09:56 +02:00
Corinna Vinschen 79edb254ac passwd: Fix potential buffer overflow
Fixes Coverity CID 66956

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 17:16:30 +02:00
Corinna Vinschen db8bda4b47 Remove unreachable code from passwd(1)
Fixed Coverity CID 66966

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22 21:20:28 +02:00
Corinna Vinschen 472e5439e7 Fix passwd getting error 1265 when running on newer Windows
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>
2016-08-31 12:08:34 +02:00
Corinna Vinschen 6e623e9320 Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option
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>
2016-06-23 10:09:17 +02:00
Corinna Vinschen cfd6979c39 * passwd.c (GetPW): If server is NULL, and the user is not a local
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.
2014-11-24 11:07:32 +00:00
Corinna Vinschen 5528975705 * passwd.c (usage): Rename DAYS to MINDAYS and MAXDAYS.
* utils.xml (passwd): Ditto.
2014-08-06 19:24:57 +00:00
Corinna Vinschen 1f4923ae73 * passwd.c (main): Fix typo in error output. 2014-06-16 13:27:08 +00:00
Corinna Vinschen 61522196c7 * Merge in cygwin-64bit-branch. 2013-04-23 09:44:36 +00:00
Christopher Faylor df0f949cfd Update copyrights 2013-01-21 16:28:27 +00:00
Corinna Vinschen a442c9cddc * passwd.cc: Add -v option to print version information as well, since
it's used in older csih.
2012-02-09 10:11:26 +00:00
Christopher Faylor 1b23b30b29 Clean up whitespace. 2011-12-17 23:39:47 +00:00
Corinna Vinschen 92b499acff * Align usage output, version output, as well as usage and version
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.
2011-10-10 14:57:48 +00:00
Corinna Vinschen ff73fd1ec1 * passwd.c (main): Add the ability to specify a username for the -R
command.
	* utils.sgml: Document the aforementioned change.
2011-04-04 09:09:43 +00:00
Corinna Vinschen 73535010d7 * cygpath.cc (main): Only setlocale for LC_CTYPE category. Fallback
to UTF-8 if locale is "C".
	* ldd.cc (main): Ditto.
	* mkgroup.c (main): Ditto.
	* mkpasswd.c (main): Ditto.
	* passwd.c (main): Ditto.
2009-05-15 11:30:18 +00:00
Corinna Vinschen 6199f417ab * passwd.c (usage): Change description for -d option according to
previous change.
	(main): Fix typo.
	* utils.sgml: Add missing description for passwd -d option.
2009-03-23 20:40:17 +00:00
Corinna Vinschen 0e0f5748e0 * passwd.c (caller_is_admin): New function to test if calling user
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.
2009-03-23 16:37:49 +00:00
Corinna Vinschen a26691a67c * passwd.c (main): Always get logonserver from environment and
use when fetching user info for caller.
2009-03-22 19:18:26 +00:00
Corinna Vinschen 35aeac58b0 * ldd.cc: Fix compiler warning.
* passwd.c: Use mbstowcs instead of MultiByteToWideChar throughout.
	(main): Call setlocale.  Fix a bug in fetching the logon server from
	the environment.
2009-03-22 10:09:01 +00:00
Corinna Vinschen 7ffaa17c80 ChangeLog:
* configure.in: Remove --enable-server option.  Allways add the
	cygserver directory to $SUBDIRS.
	* configure: Regenerate.

cygwin/ChangeLog:

	Remove USE_SERVER define.  Accommodate throughout.
	* configure.in: Remove --enable-server option.
	* configure: Regenerate.
	* environ.cc: Remove CYGWIN=server setting.

cygserver/ChangeLog:

	* client.cc (allow_server): Remove variable.
	(client_request_get_version::client_request_get_version): Drop checking
	allow_server.

utils/ChangeLog:

	* passwd.c: Remove CYGWIN=server requirement from usage text.

doc/ChangeLog:

	* cygserver.sgml: Remove the "How to use the Cygserver services"
	section.
	* cygwinenv.sgml: Move "(no)server" to the removed options section.
	* faq-programming.xml: Remove CYGWIN=server requirement for running
	the Cygwin testsuite.
	* ntsec.sgml: Ditto for using `passwd -R'.
2009-01-21 17:14:39 +00:00
Corinna Vinschen 8d12bd32cd * passwd.c (main): Put how to delete the registry password on its own
line in passwd -R output.
2008-12-15 17:33:08 +00:00
Corinna Vinschen d865502063 * passwd.c (longopts): Add --reg-store-pwd option.
(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.
2008-11-26 10:19:09 +00:00
Corinna Vinschen 4fa0a39865 * passwd.c (longopts): Add --logonserver 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.
2005-08-18 20:25:43 +00:00
Corinna Vinschen 508682370b * mkgroup.c: Avoid compiler warnings throughout.
* mkpasswd.c: Ditto.
	* passwd.c: Ditto.
2003-11-14 19:14:43 +00:00
Corinna Vinschen 02bd05e386 * passwd.c (PrintPW): Turn around meaning printed for "Password not
required" option to be in line with Windows meaning.
	(main): Use more appropriate 1008 option when calling
	NetUserSetInfo to change flag values.
2003-11-04 10:54:47 +00:00
Corinna Vinschen 1f4e5e1571 * passwd.c (UF_LOCKOUT): Remove (defined in lmaccess.h).
(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.
2003-11-04 10:30:35 +00:00
Joshua Daniel Franklin aa275fe010 * cygcheck.cc (usage) Add description output. 2003-04-26 21:52:03 +00:00
Joshua Daniel Franklin 98467dae59 Add final newlines to utils 2002-09-15 19:24:37 +00:00
Corinna Vinschen 94a23f4860 * passwd.c: Rearrange includes to avoid unnecessary warnings.
(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, ...).
2002-06-14 11:31:33 +00:00
Corinna Vinschen f59faec485 * passwd.c (prog_name): New global variable.
(longopts): Ditto.
	(opts): Ditto.
	(usage): Standardize output. Accomodate new options.
	(print_version): New function.
	(main): Accomodate longopts and new --help, --version options.
2002-05-29 07:13:09 +00:00
Christopher Faylor 7a9f3efb1b * mkgroup.c (usage): Use one just fprintf + string concatenation for output
message.
(print_version): Add void to function type and update copyright.
2002-03-19 15:48:40 +00:00
Corinna Vinschen 9783296270 * passwd.cc (ChangePW): Add parameter to differ between called for
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.
2002-01-30 11:57:16 +00:00
Corinna Vinschen deb2b467e9 * passwd.c (main): Initialize oldpwd before beeing used. 2000-07-31 13:35:39 +00:00
Christopher Faylor 1fd5e000ac import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00