Commit Graph

6211 Commits

Author SHA1 Message Date
Corinna Vinschen 2fd2ddf3f5 * sec_helper.cc (sid_auth): Remove.
(well_known_this_org_sid): New well known sid.
	(SECURITY_MANDATORY_INTEGRITY_AUTHORITY): Define.
	(mandatory_medium_integrity_sid): New well known sid.
	(mandatory_high_integrity_sid): Ditto.
	(mandatory_system_integrity_sid): Ditto.
	(cygsid::get_sid): Use local SID_IDENTIFIER_AUTHORITY.  Allow all
	authorities fitting in a UCHAR.
	* security.cc (get_token_group_sidlist): Always add the local
	group to the token.  Add comment.  Add "This Organization" group
	if available in incoming group list.
	(get_server_groups): Only add world and authenticated users groups
	if not already in list.
	(create_token): Add matching mandatory integrity SID to group list
	on systems supporting Mandatory Integrity Control.
	* security.h (well_known_this_org_sid): Define.
	(mandatory_medium_integrity_sid): Define.
	(mandatory_high_integrity_sid): Define.
	(mandatory_system_integrity_sid): Define.
	* wincap.h: Define has_mandatory_integrity_control throughout.
	* wincap.cc: Ditto.
2006-11-08 11:38:05 +00:00
Corinna Vinschen 86bc8fadff * fhandler.cc (check_posix_perm): Moved here from syscalls.cc.
(fhandler_base::fpathconf): New method implementing (f)pathconf.
	* fhandler.h (class fhandler_base): Declare fpathconf method.
	* path.cc (path_conv::check): Replace MAX_LINK_DEPTH with SYMLOOP_MAX.
	* path.h (MAX_LINK_DEPTH): Delete.
	* syscalls.cc (check_posix_perm): Move to fhandler.cc.
	(fpathconf): Call fhandler's fpathconf method.
	(pathconf): Build fhandler and call fhandler's fpathconf method.
	* sysconf.cc (sysconf): Reorder switch according to order of flags
	in sys/unistd.h.  Add handling for some missing flags.
	* include/limits.h: Reorder according to SUSv3 description.  Add some
	missing definitions.  Add comments.
	* include/sys/syslimits.h: New file overriding newlib's syslimits.h
	file.
2006-11-07 17:59:54 +00:00
Corinna Vinschen cc9dbc905c * dtable.cc (build_fh_pc): Add missing DEV_SD1_MAJOR case (Thanks to
Joe Loh for noticing).
2006-11-06 13:46:24 +00:00
Corinna Vinschen 2228ff0267 * path.cc (symlink_info::posixify): Fix comment. 2006-11-02 13:39:44 +00:00
Corinna Vinschen 4521c4bd0c * path.cc (symlink_info::check): Eliminate PATH_REP bit from pflags. 2006-11-02 12:19:16 +00:00
Corinna Vinschen 5fc8f227dc * path.cc (symlink_info::posixify): New mothod converting NT and DOS
paths in symlinks to POSIX.
	(symlink_info::check_shortcut): Allocate buf allowing for a trailing 0.
	Call posixify on the result.
	(symlink_info::check_sysfile): Read from file into local buffer.
	Eliminate old b16 considerations.  Call posixify on the result.
	(symlink_info::check_reparse_point): Don't use PrintName but
	SubstituteName which is relevant for Windows' path handling.
	Call posixify on the result.
2006-11-02 11:45:03 +00:00
Danny Smith a45b9181ea * include/winuser.h (LR_DEFAULTSIZE): Remove duplicate.
C99 'extern inline' patrol.
	* include/winnt.h (GetCurrentFiber): Remove extern declaration.  Make
	inline static.
	(GetFiberData): Likewise.
	* lib/kernel32.c: Remove.
	* lib/Makefile.in: Remove reference to kernel32.[co].
2006-11-02 00:54:46 +00:00
Corinna Vinschen b904c35100 * security.h (cygpriv_idx): Add privileges new in Vista.
* security.cc (sys_privs): Ditto.
	* sec_helper.cc (cygpriv): Ditto.  Fix comment.
2006-11-01 09:00:14 +00:00
Corinna Vinschen 87abdb3df9 * include/winnt.h (SE_RELABEL_NAME): Define.
(SE_INCREASE_WORKING_SET_NAME): Define.
	(SE_TIME_ZONE_NAME): Define.
	(SE_CREATE_SYMBOLIC_LINK_NAME): Define.
2006-11-01 08:57:57 +00:00
Corinna Vinschen c2b10dc4d8 * cygheap.h (struct user_heap_info): Add slop member.
* heap.cc (heap_init): Add slop factor to heap allocation.  Add
	comment.
	* mmap.cc (MapViewNT): Allocate memory maps top down.
	(fhandler_dev_zero::mmap): Ditto.
	* shared.cc (shared_info::heap_slop_size): New method.
	(shared_info::heap_chunk_size): Don't use debug_printf at early stage.
	* shared_info.h (SHARED_INFO_CB): Accomodate change to shared_info.
	(CURR_SHARED_MAGIC): Ditto.
	(class shared_info): Add heap_slop member.  Declare heap_slop_size.
	* wincap.h: Define heapslop throughout.
	* wincap.cc: Ditto.
2006-10-31 18:41:16 +00:00
Corinna Vinschen 9740f34d11 * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Drop
directory attribute for reparse points to avoid mistreating.
	(fhandler_base::fstat_by_name): Ditto.
	* path.cc (symlink_info::check_reparse_point): New method testing
	reparse points for symbolic links.
	(symlink_info::check_shortcut): Move file attribute tesat to calling
	function.
	(symlink_info::check): Add handling for reparse points.
	* path.h (enum path_types): Add PATH_REP to denote reparse point based
	symlinks.
	(path_conv::is_rep_symlink): New method.
	* syscalls.cc (unlink): Handle reparse points.
2006-10-31 11:40:47 +00:00
Corinna Vinschen 3ddf69712b * include/winnt.h (IO_REPARSE_TAG_SYMLINK): Define.
(struct _REPARSE_DATA_BUFFER): Add missing Flags field to
	SymbolicLinkReparseBuffer substructure.
2006-10-31 11:39:58 +00:00
Danny Smith cf8c18dd47 2006-10-29 Daniel Atallah <datallah@users.sourceforge.net>
* lib/ws2_32.def (WSANSPIoctl): Add to lib.
2006-10-29 22:37:10 +00:00
Corinna Vinschen fa9e684236 * shared.cc (open_shared): Drop useless attempt from 2006-08-11. 2006-10-27 10:51:25 +00:00
Corinna Vinschen 17f3068d4e * dcrt0.cc (__api_fatal): Drop spare argument to __small_sprintf.
* smallprint.c (__small_vsprintf): Preserve GetLastError value.
	* winsup.h (api_fatal): Simplify.  Drop duplicate filename arg.
2006-10-27 10:41:51 +00:00
Chris Sutcliffe 6aea277648 2006-10-26 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* lib/Makefile.in: Fix order for 'all' rule.
2006-10-27 01:02:29 +00:00
Corinna Vinschen 74cab745fc * fhandler_disk_file.cc (fhandler_disk_file::rewinddir): Fix comment. 2006-10-23 16:41:10 +00:00
Corinna Vinschen 7a229db654 * fhandler_disk_file.cc (fhandler_disk_file::rewinddir): Accomodate
buggy RestartScan behaviour of Windows 2000.
	* wincap.h: Define has_buggy_restart_scan throughout.
	* wincap.cc: Ditto.
2006-10-23 15:13:55 +00:00
Corinna Vinschen fc545fe933 * fhandler_disk_file.cc (fhandler_disk_file::facl): Fix whitespace.
* external.cc: Update copyright.
	* fhandler.cc: Ditto.
	* sec_helper.cc: Ditto.
	* security.h: Ditto.
	* security.cc: Ditto.
	(check_registry_access): Return -1 if W_OK is requested.
2006-10-22 19:31:33 +00:00
Corinna Vinschen 2be593d961 * external.cc (cygwin_internal): Use security_descriptor::copy method.
* sec_helper.cc (security_descriptor::malloc): Use own free method.
	Set type.
	(security_descriptor::realloc): Handle the case that psd has been
	allocated using LocalAlloc.  Set type.
	(security_descriptor::free): Ditto.
	* security.cc (get_nt_attribute): Remove.
	(get_reg_security): Remove.
	(get_nt_object_security): Use GetSecurityInfo which handles all
	securable objects.
	(get_nt_object_attribute): Remove.
	(get_object_attribute): Call get_nt_object_security instead of
	get_nt_object_attribute.
	(get_file_attribute): Ditto.
	(check_registry_access): Call get_nt_object_security instead of
	get_reg_security.
	* security.h (cygpsid::operator PSID): Make method const, not the
	result.
	(class security_descriptor): Add type member.  Accomodate throughout.
	(security_descriptor::copy): New method.
	(security_descriptor::operator PSECURITY_DESCRIPTOR *): New operator.
2006-10-22 14:57:43 +00:00
Corinna Vinschen 2b26c2fc41 * fhandler.cc (fhandler_base::fhaccess): Check if opening registry
actually created a handle.  This handles the registry root dir.
	* fhandler_registry.cc (fhandler_registry::open): Set io_handle in
	case of opening one of the predefined registry keys.
2006-10-22 09:38:47 +00:00
Corinna Vinschen 70158cafd7 * regtool.cc (key_type): Drop.
(REG_AUTO): Define.
	(value_type): Replace key_type.  Use REG_xxx values directly.
	Accomodate change throughout.
	(longopts): Add --dword, --dword-le, --none, --qword and --hex options.
	(opts): Add -d, -D, -n, -Q and -x options.
	(types): Array to convert REG_xxx into strings.
	(hex): New variable to keep value of --hex option.
	(usage): Accomodate new options.  Print only the necessary by default.
	Only be verbose in case of -h/--help option.
	(cmd_list): Use key separator from -K option when printing.
	Print value type when verbose option is given.  Handle so far not
	handled REG_xxx types.
	(cmd_set): Avoid SEGV due to missing argument.  Handle so far not
	handled REG_xxx types.
	(cmd_get): Handle --binary option type agnostic.  Handle so far not
	handled REG_xxx types.
	(main): Handle new options.
2006-10-21 17:19:29 +00:00
Corinna Vinschen 1b4153db74 * fhandler.cc (fhandler_base::fhaccess): Call check_registry_access
for registry keys/values if ntsec is on.
	* security.cc (check_access): New static function derived from
	check_file_access, but object type agnostic.
	(check_file_access): Only do file specific stuff.  Call check_access.
	(check_registry_access): New access check function for registry keys/
	values.
	* security.h (check_registry_access): Declare.
2006-10-21 11:05:32 +00:00
Corinna Vinschen 9367c0dcff * fhandler_registry.cc (fhandler_registry::fstat): Set restrictive
permission and ownership if key can't be opened for reading security.
	(open_key): If opening key fails, retry opening with backup intent.
2006-10-21 10:58:35 +00:00
Corinna Vinschen d698e833cd * net.cc (cygwin_getnameinfo): Fix typo in comment. 2006-10-20 12:57:25 +00:00
Corinna Vinschen 20f9af5348 * fhandler.h (fhandler_base::set_name): Make virtual.
(class fhandler_registry): Add wow64 and prefix_len members.
	Declare set_name method.
	* fhandler_proc.cc (PROC_REGISTRY32): Define.
	(PROC_REGISTRY64): Define.
	(proc_listing): Add "registry32" and "registry64" elements.
	(proc_fhandlers): Add corresponding FH_REGISTRY values.
	* fhandler_registry.cc (registry_len): Drop static value in favor of
	class member prefix_len.  Use preifx_len instead of registry_len
	throughout.
	(fhandler_registry::set_name): Define.  Set wow64 and prefix_len
	according to directory prefix.
	(fhandler_registry::fhandler_registry): Set wow64 and prefix_len to
	default values.
	(open_key): Add wow64 argument.  Handle wow64 in call to RegOpenKeyEx.
	Use fhandler_registry member wow64 in this place throughout.
2006-10-19 10:01:03 +00:00
Corinna Vinschen d145878a07 * fhandler_proc.cc: Drop superfluous definition of _WIN32_WINNT.
* miscfuncs.cc: Ditto.
	* sched.cc: Ditto.
2006-10-19 09:15:26 +00:00
Corinna Vinschen 3c256e38f9 * regtool.cc (longopts): Add --wow32 option.
(opts): Add -W option.
	(usage): Add text for --wow32/-W option.
	(main): Handle --wow32/-W option.
	* utils.sgml: Document the new -W option.
2006-10-19 09:08:44 +00:00
Corinna Vinschen 733c9ed374 * glob.c: Remove.
* glob.cc: New file.  Latest glob version from FreeBSD plus Cygwin
	specific changes (__stat64/__stat32, ignore_case_with_glob,
	drop collate functions).
	(glob3): Return GLOB_ABORTED in case directory is unreadable and
	GLOB_ERR is set, as demanded by SUSv3.
	* glob.h: Import latest version from FreeBSD.
2006-10-17 17:34:56 +00:00
Corinna Vinschen bf4875e4b0 * winsup.h (WINVER): Define instead of _WIN32_WINNT. Set to 0x0502.
(_NO_W32_PSEUDO_MODIFIERS): Define.
2006-10-17 13:55:05 +00:00
Corinna Vinschen 53930874cb * regtool.cc (KEY_WOW64_64KEY): Drop definition. Instead define
WINVER to 0x0502 before including windows.h.
2006-10-16 19:34:27 +00:00
Corinna Vinschen 40c60b89d5 * regtool.cc (KEY_WOW64_64KEY): Define.
(longopts): Add --wow64 option.
	(opts): Add -w option.
	(wow64): New variable to control usage of KEY_WOW64_64KEY access flag.
	(usage): Add text for --wow64/-w option.
	(print_version): Fix copyright.
	(find_key): Use wow64 value in calls to RegOpenKeyEx and RegCreateKeyEx.
	(cmd_add): Use wow64 value in call to RegCreateKeyEx.
	(regDeleteKeyEx): New function pointer to load RegDeleteKeyEx function
	dynamically.
	(cmd_remove): Load and use regDeleteKeyEx when wow64 is set.
	(main): Handle --wow64/-w option.
	* utils.sgml: Document the new -w option.
2006-10-16 18:00:06 +00:00
Corinna Vinschen 0b8affca5e * fhandler_disk_file.cc (fhandler_disk_file::opendir): Drop redundant
access check.
2006-10-16 13:11:29 +00:00
Corinna Vinschen c28fea1bdc * include/asm/byteorder.h: Fix copyright dates.
Fix typos in ChangeLog.
2006-10-16 12:34:34 +00:00
Corinna Vinschen b031f5c3c5 Fix pathnames. 2006-10-16 12:31:19 +00:00
Corinna Vinschen 2c1ffdbf5e * autoload.cc (PrivilegeCheck): Define.
* fhandler.cc (fhandler_base::open): Always try opening with backup
	resp. restore intent.
	* fhandler_disk_file.cc (fhandler_disk_file::opendir): Always try
	opening with backup intent.
	(fhandler_disk_file::readdir): Ditto when trying to retrieve file id
	explicitely.
	* security.cc (check_file_access): Replace pbuf with correctly
	PPRIVILEGE_SET typed pset.  Check explicitely for backup and/or restore
	privileges when AccessCheck fails, to circumvent AccessCheck
	shortcoming.  Add comment to explain.
2006-10-16 12:26:59 +00:00
Christopher Faylor 7af26e0cc0 * winsup.h: Turn off DEBUGGING. 2006-10-13 12:49:18 +00:00
Corinna Vinschen ace7360b45 * Makefile.in (CFLAGS): Drop -nostdinc.
* cygsuba.c: Reorder includes to allow building with VC++.
	* make-64bit-version-with-visual-c.bat: New file.
2006-10-13 11:55:05 +00:00
Corinna Vinschen fb7dc2480c * autoload.cc (Wow64DisableWow64FsRedirection): Define.
(Wow64RevertWow64FsRedirection): Define.
	* security.cc (cygsuba_installed): New shared variable to store result
	of cygsuba.dll installation test.
	(subauth): Check if cygsuba.dll has been installed and registered
	before issuing the (sub)authentication.
2006-10-13 11:10:28 +00:00
Corinna Vinschen 208e95c2f2 * security.cc (create_token): Fix condition for source identifier. 2006-10-12 15:38:26 +00:00
Danny Smith 0d94042d8f * include/winuser.h (LR_DEFAULTSIZE, LR_VGACOLOUR): Define. 2006-10-12 04:25:56 +00:00
Corinna Vinschen 9565e2333c * select.cc (struct socketinf): Convert ser_num and w4 to dynamically
allocated arrays.  Add max_w4 member to keep track.
	(thread_socket): Make timeout depending on number of sockets to wait
	for.  Loop WFMO over all sockets.
	(start_thread_socket): Handle any number of sockets.  Fix typo.  Don't
	close socket event in out of memory condition.
	(socket_cleanup): Free ser_num and w4.
2006-10-11 16:21:12 +00:00
Corinna Vinschen b9c7deed9a * path.cc (path_conv::get_nt_native_path): Properly detect \\?\ paths.
(mount_info::conv_to_win32_path): Update comment.
	* fhandler_disk_file.cc (path_conv::ndisk_links): Use backslashes
	to make NT kernel functions work for \\?\GLOBALROOT paths.
2006-10-09 14:01:52 +00:00
Corinna Vinschen 5623fbd4ca * devices.in: Raise number of handled serial ports to 64.
* devices.cc: Regenerate.
2006-10-09 08:27:23 +00:00
Christopher Faylor 16b6142ad4 . 2006-10-06 22:32:09 +00:00
Corinna Vinschen cea9b62102 * cygcheck.cc (get_word, get_dword): Move to path.cc.
(LINK_EXTENSION): New macro.
	(check_existence): New static function.
	(find_on_path): Check for symbolic links if asked.
	(dll_info): New error handling.
	(track_down): Only call dll_info() for executables, display
	an error for symlinks, and print magic number for others.
	(find_app_on_path): New static function.
	(cygcheck, dump_sysinfo): Call find_app_on_path() instead of
	find_on_path().
	* path.cc (cmp_shortcut_header): New static function.
	(get_word, get_dword): Moved from cygcheck.cc.
	(EXE_MAGIC, SHORTCUT_MAGIC, SYMLINK_COOKIE, SYMLINK_MAGIC): New
	macros.
	(is_exe, is_symlink, readlink): New functions.
	* path.h (is_exe, is_symlink, readlink): Declare.
	(get_word, get_dword): Ditto.
2006-10-05 17:24:13 +00:00
Danny Smith 66845c62b1 * include/winreg.h (RegDeleteKeyEx{A|W}): Add prototype and UNICODE
mappings.
	(KEY_WOW64_32KEY, KEY_WOW64_64KEY): Define.
	* lib/advapi.def (RegDeleteKeyEx{A|W}): Export.
2006-10-05 07:36:06 +00:00
Corinna Vinschen fbcc8bbe74 * Makefile.in: Semi-revert semi-reversion of 2006-08-30 change, now
correctly parenthesized.
2006-10-04 12:52:42 +00:00
Danny Smith e4aebff6e8 * include/winnt.h (CASSERT): Define.
[mingw-Bugs-1568067]
	* include/winuser.h: (DISP_CHANGE_BADDUALVIEW): Define.
	* include/wingdi.h: (DM_POSITION): Define.
2006-10-04 08:57:27 +00:00
Danny Smith b3fc0d3bf5 * lib/rpcrt4.def: Remove "_imp__"-prefixed export symbols.
* lib/user32.def: Likewise.
2006-10-03 08:43:40 +00:00