Commit Graph

436 Commits

Author SHA1 Message Date
Christopher Faylor b2e5367846 * Makefile.in (ALL_LDFLAGS): Link libgcc statically for everything here. 2008-10-29 13:13:26 +00:00
Christopher Faylor 423fd4f2f4 fix typo 2008-10-13 00:57:47 +00:00
Christopher Faylor 6e9b938063 * mingw: Set sawcfile when -xc* is detected. Extend list of detected source
filew.
2008-10-13 00:56:09 +00:00
Christopher Faylor 391f2a8eed * mingw: Add more checks to allow more varied use. 2008-10-12 23:54:03 +00:00
Christopher Faylor 12c819e204 * mingw: Use a better method to find where mingw directory lives. 2008-10-12 03:20:37 +00:00
Christopher Faylor fd49ac277f * Makefile.in: Tweak to work better with new utils/mingw front-end.
In utils:
2008-10-12 03:06:12 +00:00
Christopher Faylor a35d9f1a67 * cygcheck.cc (pathlike::check_existence): Remove class name from declaration.
(display_internet_error): Use proper format specifier for DWORD.
(environ): Remove unneeded declaration.
(main): Use brace around nested if to avoid an overly-helpful compiler warning.
* dump_setup.cc (parse_filename): Reorganize nested if to avoid an
overly-helpful compiler warning.
* path.cc (GUID_shortcut): Use braces around part of initializer which needs
them.
(conv_fstab_spaces): Parenthesize assignment in while loop to avoid a compiler
warning.
(struct opt): Make static.
* ps.cc (main): Reorganize nested if to avoid an overly-helpful compiler
warning.
* regtool.cc: Make some anonymous structs static to avoid a compiler warning.
* ssp.c (lookup_thread_id): Initialize *tix to zero to avoid potential
uninitialized use.
* strace.cc (add_child): Use proper format specifier for DWORD.
(remove_child): Ditto.
(proc_child): Ditto.
2008-09-12 22:43:10 +00:00
Christopher Faylor 25687b0f76 * cygcheck.cc (nuke): Use malloc rather than alloca for environment variables.
(load_cygwin): Ditto.
* dump_setup.cc (parse_filename): Cosmetic changes.
(get_packages): Ditto.
2008-08-27 20:11:11 +00:00
Corinna Vinschen 328b090f29 * mkgroup.c (enum_local_groups): Don't skip printing groups when
print_current is set and group SID is not curr_pgrp.
	(enum_groups): Ditto.
	(main): Fix condition when SYSTEM group gets printed.
	* mkpasswd.c (enum_users): Don't skip printing users when print_current
	is set and user SID is not curr_user.
	(main): Allow printing standard accounts even when print_current is set.
2008-08-25 09:38:14 +00:00
Corinna Vinschen bba4895394 * mkgroup.c (enum_local_groups): Use NetLocalGroupGetInfo to find out
if a group exists, rather than just allocating a buffer and going ahead.
2008-08-18 12:56:59 +00:00
Corinna Vinschen 2d1bfd524d * mkgroup.c (enum_local_groups): Call print_win_error with GetLastError
as argument when LookupAccountXXX failed.
	(enum_groups): Ditto.
2008-08-18 12:42:44 +00:00
Corinna Vinschen 5a62582162 * mkgroup.c (enum_local_groups): Return failure if looking for a single
group succeeded.  Add comment.
2008-08-18 08:58:21 +00:00
Corinna Vinschen 096df1774b * mkgroup.c (main): Keep correctly track of optional arguments.
* mkpasswd.c (main): Ditto.
2008-08-18 08:52:49 +00:00
Corinna Vinschen 01dd3162ff * mkgroup.c (main): Always unset environment variable POSIXLY_CORRECT.
Keep track of optional argumnts and fix up optind afterwards.
	* mkpasswd.c (main): Ditto.
2008-08-18 08:33:48 +00:00
Christopher Faylor c7aa4aec42 * cygcheck.cc (print_version): Update copyright dates. 2008-08-17 17:15:41 +00:00
Christopher Faylor 95141e7835 * mkpasswd.c (main): Avoid printing system accounts when a single user name has
been requested.
2008-08-17 17:00:50 +00:00
Christopher Faylor 6510edf4bc * Makefile.in (ALL_LDFLAGS): Add --enable-auto-import option to quiet ld
warnings.
* mkgroup.c: Change all global variables and most functions to static.
(enum_local_groups): Add a print_current parameter to control whether entries
for everything should be printed or just the current user.
(enum_groups): Ditto.
(main): Move call fetch_current_pgrp_sid earlier to avoid a NULL deference when
no command line arguments are specified.  Accommodate argument changes to above
functions.  Avoid printing SYSTEM account when print_current is specified.
Issue error when extra stuff is found on the command line.
* mkpasswd.c: Change all global variables and most functions to static.
(enum_users): Add a print_current parameter to control whether entries for
everything should be printed or just the current user.
(main): Move call fetch_current_user_sid earlier to avoid a NULL deference when
no command line arguments are specified.  Accommodate argument change to above
function.  Avoid printing standard accounts when print_current is specified.
Issue error when extra stuff is found on the command line.
2008-08-17 16:45:44 +00:00
Corinna Vinschen 9258eca9d4 * mkgroup.c (fetch_current_pgrp_sid): New function to fetch primary
group SID from user token.
	(current_group): Move up in file.  Move fetching primary group SID to
	fetch_current_pgrp_sid.
	(enum_local_groups): Check if current SID is the same as current user's
	primary group SID.
	(enum_groups): Ditto.
	(main): Call fetch_current_pgrp_sid before enumerating groups.  Call
	current_group only if current group hasn't been enumerated already.
	* mkpasswd.c (fetch_current_user_sid): New function to fetch current
	user SID from user token.
	(current_user): Move fetching current user SID to
	fetch_current_user_sid.
	(enum_users): Check if current SID is the same as current user's SID.
	(main): Call fetch_current_user_sid before enumerating users.  Call
	current_user only if current user hasn't been enumerated already.
2008-08-15 13:08:47 +00:00
Corinna Vinschen 56d8179570 * mount.cc (NT_MAX_PATH): Define.
(longopts): Rename mount-commands option to mount-entries.
	(opts): Remove removed options.
	(struct opt): Move up in file to allow using it in usage.
	(usage): Change text for --mount-entries option.  Remove
	-X option.  Add valid options output.
	(main): Remove handling -b option.
	(convert_spaces): New static function to convert spaces to "\040"
	string.
	(mount_entries): Renamed from mount_commands.  Rewrite to emit
	/etc/fstab compatible output.
	(show_cygdrive_info): Print "nouser" rather than "system".
	* umount.cc (longopts): Remove remove-all-mounts,
	remove-cygdrive-prefix, remove-system-mounts, system and user options.
	(opts): Remove A, c, s, S, u options.
	(usage): Remove text for all removed options.
	(main): Remove handling for all removed options.
	(remove_all_mounts): Remove.
	(remove_all_system_mounts): Remove.
	(remove_cygdrive_prefix): Remove.
	* utils.sgml: Fix mount and umount documentation.  Move description
	of (cyg,not)exec options to mount table section.
2008-08-13 16:35:04 +00:00
Christopher Faylor ea8432dfb1 * cygcheck.cc (load_cygwin): Duplicate argv list since it disappears when
cygwin1.dll is unloaded.
2008-08-04 15:30:06 +00:00
Christopher Faylor e3e942ac00 * Makefile.in: Link cygcheck with -lntdll even without mingw-zlib. 2008-07-30 06:07:42 +00:00
Christopher Faylor 34aa62035b * cygcheck.cc (load_cygwin): Free the cygwin dll after we're done with it. 2008-07-27 14:53:42 +00:00
Christopher Faylor 5f853b3fc5 * mount.cc: Remove non-unix-like options (-x,-t,b) throughout.
(oopts): Use boolean constants for slightly increased clarity.
* configure.in: Remove apparently unneeded program_transfer_name code.
* configure: Regenerate.
2008-07-25 15:03:25 +00:00
Corinna Vinschen e93f946aa7 * utils.sgml: Remove useless text. 2008-07-25 07:08:56 +00:00
Corinna Vinschen f36c78a487 * mkgroup.c (main): Fix test for duplicate domain/machine request.
* mkpasswd.c (main): Ditto.
2008-07-23 20:12:12 +00:00
Corinna Vinschen f9519bcd1a * mkgroup.c: Rework to allow per-domain/per-machine id_offset.
Add -b option to skip builtin groups.
	(main): Simplify code.
	* mkpasswd.c: Rework to allow per-domain/per-machine id_offset.
	(main): Simplify code.
	* utils.sgml: Explain changed mkgroup/mkpasswd -d/-D/-l/-L options.
	Add mkgroup -b option.
2008-07-23 18:09:50 +00:00
Corinna Vinschen 0bdab5c8a9 * mkgroup.c: Consolidate variable names.
(enum_unix_groups): New function.
	(print_special): Use LookupAccountSidW instead of LookupAccountSidA.
	(current_group): Ditto.
	(usage): Add -U option.
	(longopts): Add --unix option.
	(opts): Add -U option.
	(main): Handle -U option.  Call enum_unix_groups if set.
	* mkpasswd.c: Consolidate variable names.
	(current_user): Use LookupAccountSidW instead of LookupAccountSidA.
	(enum_unix_users): New function.
	(usage): Add -U option.
	(longopts): Add --unix option.
	(opts): Add -U option.
	(main): Handle -U option.  Call enum_unix_groups if set.
	* utils.sgml: Add -U option text to mkgroup and mkpasswd description.
2008-07-23 11:41:10 +00:00
Corinna Vinschen 7e1fdc9e2c * mkgroup.c (enum_groups): Create full qualified groupname using
domain or servername, depending on printing domain or machine accounts.
	* mkpasswd.c (enum_users): Ditto for users.
2008-07-22 20:47:14 +00:00
Corinna Vinschen 4aeb44ee37 * mkgroup.c (main): Remove special root group code. Only print
SYSTEM group in case of printing local machine or local domain groups.
2008-07-22 20:12:02 +00:00
Corinna Vinschen a1e1990348 * Makefile.in (cygcheck.exe): Link against ntdll.
* bloda.cc: Use statically linked functions throughout.
	* cygpath.cc: Drop 9x considerations.
	* mkgroup.c: Revamp.  Redefine -l and -d options to take optional
	machine and domain parameters.  Redefine -c to work always, using
	token information.  Add -L, -D, -C to create unique groupnames in
	domain\group syntax.  Add -S option to define domain\group separator
	char.  Ignore -u and -s options.
	* mkpasswd.c: Revamp.  Redefine -l and -d options to take optional
	machine and domain parameters.  Redefine -c to work always, using
	token information.  Add -L, -D, -C to create unique usernames in
	domain\user syntax.  Add -S option to define domain\user separator
	char.  Ignore -g and -s options.  Prefer to take homedir from $HOME
	over $HOMEDRIVE/$HOMEPATH.
	* path.cc (oopts): Add "acl", "noacl", "posix=0" and "posix=1" options.
	(getmntent): Accomodate throughout.
	* ps.cc: Fix copyright dates.
	* utils.sgml: Fix text for mkgroup and mkpasswd.
2008-07-22 14:40:05 +00:00
Corinna Vinschen 874149c80c * mount.cc (do_mount): Remove MOUNT_ENC code.
(oopts): Remove "managed" option.
	(mount_commands): Drop "managed" handling.
	* path.cc (oopts): Remove "managed" option.
	(getmntent): Remove MOUNT_ENC code.
2008-07-17 15:07:48 +00:00
Corinna Vinschen b2dab9e8bc * utils.sgml: Add id's to all examples. 2008-07-17 10:32:03 +00:00
Corinna Vinschen 375a780e06 * mkgroup.c: Use statically linked functions throughout, except for
DsGetDcNameW.  Reformat.  Convert to use WCHAR for names throughout.
	Use defines instead of constants throughout.
	(MAX_SID_LEN): Define.
	(load_netapi): Just load DsGetDcNameW pointer.
	(psx_dir): Remove.
	(uni2ansi): Remove.
	(enum_local_users): Take server name and use in Net... call.
	(DBGSID): Define datastructure.
	(MAX_BUILTIN_SIDS): Define.
	(builtin_sid_list): Define global sid list.
	(builtin_sid_cnt): Define counter for global sid list.
	(enum_local_groups): Take server name and use in Net... and Lookup...
	calls.  Take offset argument.  Use MAX_PREFERRED_LENGTH in call to
	NetLocalGroupEnum.  Check for duplicate builtin groups.
	(enum_users): Take server name and use in Net... call.
	(usage): Change text slightly.
	(print_version): Fix copyright.
	(main): Call enum_local_groups for domains as well.
	* mkpasswd.c: Use statically linked functions throughout, except for
	DsGetDcNameW.  Reformat.  Convert to use WCHAR for names throughout.
	Use defines instead of constants throughout.
	(MAX_SID_LEN): Define.
	(load_netapi): Just load DsGetDcNameW pointer.
	(uni2ansi): Use wcstombs.
	(current_user): Replace "unused_by_nt/2000/xp" by
	just "unused".
	(enum_users): Ditto.
	(print_version): Fix copyright.
2008-07-09 14:32:29 +00:00
Corinna Vinschen 3ad8ec8546 * setfacl.c (setfacl): Change from void to int. Return 2 in case of
error.
	(main): Return with error code from setfacl.
2008-05-22 18:56:26 +00:00
Corinna Vinschen 43334bd027 * Makefile.in (CYGWIN_BINS): Remove ipcrm and ipcs.
* ipcrm.c: Remove.
	* ipcs.c: Remove.
2008-05-15 11:01:31 +00:00
Corinna Vinschen f7483b41e0 * mount.cc (usage): Mark -s and -u as ignored.
(print_version): Simplify printing copyright dates.
	(main): Remove default_flag.  Dont set flags on -s and -u options.
	(mount_commands): Drop handling -s and -u options.
2008-04-23 11:37:58 +00:00
Corinna Vinschen b677a99b34 * cygcheck.cc (dump_sysinfo): Fix multiple Cygwin DLL test.
* path.cc: Fetch mount points from fstab files instead of from
	registry.  Use adapted functions copied from Cygwin DLL.
	(mnt_t): Drop issys member.  Define as "mnt_t" instead of "struct mnt_t"
	subsequently.
	(max_mount_entry): New variable.
	(unconvert_slashes): Move to earlier location in file.  Make inline.
	(find2): Remove.
	(get_cygdrive0): Remove.
	(get_cygdrive): Remove.
	(skip_ws): New function.
	(find_ws): Ditto.
	(conv_fstab_spaces): Ditto.
	(read_flags): Ditto.
	(from_fstab_line): Ditto.
	(get_user): Ditto.
	(from_fstab): Ditto.
	(mnt_sort): Ditto.
	(read_mounts): Drop old registry code.  Fetch
	"Software\Cygwin\Setup\rootdir" value from HKCU or HKLM key.  Use
	rootdir extracted from module path as fallback.  Call from_fstab for
	nouser and user mount points.
	(setmntent): Check max_mount_entry to test if read_mounts must be
	called.
	(getmntent): Use MOUNT_SYSTEM flag instead of mnt_t's issys member.
2008-04-22 14:42:05 +00:00
Brian Dessent bff091bcfe * path.cc: Include malloc.h for alloca.
(is_symlink): Rewrite.  Just read the whole file in memory rather
	than by parts.  Account for an ITEMIDLIST if present, as well as
	the new style of Cygwin shortcut supporting targets > MAX_PATH.
2008-03-16 17:04:02 +00:00
Corinna Vinschen 2b2b42cf59 * cygpath.cc (do_sysfolders): Use cygwin_conv_path.
(do_pathconv): Use cygwin_conv_path and cygwin_conv_path_list.
	* dumper.cc (main): Use cygwin_conv_path.  Allocate target path
	dynamically.
	* mkpasswd.c (current_user): Use cygwin_conv_path.
	(enum_users): Ditto.
	* ps.cc (NT_MAX_PATH): Define.
	(main): Use cygwin_conv_path.
	* regtool.cc (find_key): Ditto. Allocate target path dynamically.
	(cmd_save): Ditto.
2008-03-12 12:47:09 +00:00
Brian Dessent 5b7296f637 * cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1
chars.
2008-03-11 18:43:11 +00:00
Brian Dessent 60efa4e546 * cygcheck.cc (dirname): New static function.
(find_app_on_path): Use SYMLINK_MAX.  Resolve symlink relative
	to link's location.  Adjust to the fact that cygpath already
	normalizes its return value.
	* path.cc (rel_vconcat): Add cwd parameter, and use it instead
	of calling GetCurrentDirectory() if possible.  Rename throughout.
	(vcygpath): Rename from cygpath and accept cwd and va_list.  Pass
	cwd on to rel_vconcat().
	(cygpath_rel): New front end for vcygpath.
	(cygpath): Ditto.
	* path.h (cygpath_rel): Declare.
	(SYMLINK_MAX): Define to 4095.
2008-03-11 17:20:02 +00:00
Brian Dessent 92108f4e26 * Makefile.in (install): Don't install the testsuite. 2008-03-09 09:41:42 +00:00
Brian Dessent 59fb00ae07 * Makefile.in: Add a 'check' target that builds and runs
testsuite.exe from path-testsuite.o and testsuite.o.
	* path.cc: Include testsuite.h.
	(struct mnt): Change to a mnt_t typedef and don't define
	mount_table when TESTSUITE is defined.
	(find2): Don't include when TESTSUITE is defined to avoid warning.
	(get_cygdrive0): Ditto.
	(get_cygdrive): Ditto.
	(read_mounts): Provide empty implementation when TESTSUITE is
	defined.
	(vconcat): Use the isslash macro.
	(unconvert_slashes): New helper to convert to backslashses.
	(rel_vconcat): Handle relative paths more gracefully.
	(cygpath): Skip a leading "./" sequence.  Avoid double-slashes.
	Normalize final output to backslashes and remove redundant path
	sequences.
	* testsuite.cc: New file implementing testsuite driver.
	* testsuite.h: New header implementing harness mount table and
	series of tests.
2008-03-09 04:10:10 +00:00
Brian Dessent 68d2dd03a3 * Makefile.in: Reorganize considerably, using GNU make's
static pattern rules and target-specific variables.
2008-03-08 17:52:49 +00:00
Corinna Vinschen 11cd2378b0 * mkpasswd.c (main): Simplify generating SYSTEM entry. Add entries
for LocalService and NetworkService accounts.  Change comments.
2008-02-28 11:11:12 +00:00
Corinna Vinschen 2652ae1036 * cygcheck.cc (dump_sysinfo): Always try to get a OSVERSIONINFOEX
first.  Load kernel32.dll earlier.  Make osname a buffer.  Simplify
	Non-NT code.  Use GetProductInfo in Vista/2008 case.  Clean up
	non-Vista version info.  Exit early if not on NT.
2008-01-13 13:41:45 +00:00
Dave Korn 9c4d008ca5 * bloda.cc (enum bad_app): Add BYTEMOBILE.
(dodgy_app_detects[]):  Add FILENAME entry to detect bmnet.dll.
	(big_list_of_dodgy_apps[]):  Add description for BYTEMOBILE.
2007-12-29 19:26:56 +00:00
Brian Dessent ec62ba9577 * Makefile.in (cygcheck.exe): Don't link to ntdll.
* bloda.cc (pNtQuerySystemInformation): Add.
	(pRtlAnsiStringToUnicodeString): Add.
	(get_process_list): Use function pointers for NT functions.
	(dump_dodgy_apps): Skip dodgy app check on non-NT platforms.
	Use GetProcAddress for NT-specific functions.
2007-12-21 03:32:46 +00:00
Corinna Vinschen 582bae5d10 * regtool.cc (opts): Add missing 'W'. 2007-12-07 09:37:46 +00:00
Corinna Vinschen 9408cf38dd * ps.cc: Include limits.h.
(main): Set file name buffer size to PATH_MAX.  Use progname or
	progname_long member of struct external_pinfo dependent of the value of
	the struct's version member.
2007-12-06 18:26:18 +00:00