Commit Graph

6272 Commits

Author SHA1 Message Date
Christopher Faylor e09c8fde55 * pinfo.cc (set_myself): Use a more foolproof method for determining if the
current process was started from another cygiwn process.
2006-12-18 21:28:31 +00:00
Corinna Vinschen c21efb9a85 * libc/minires-os-if.c (cygwin_query): Remove ERROR_PROC_NOT_FOUND case.
(get_dns_info): Verify DnsQuery exists. Use autoloaded GetNetworkParams.
2006-12-15 09:50:32 +00:00
Corinna Vinschen 1fd82398bb * winsup.h (clear_procimptoken): Close hProcImpToken in a safer way. 2006-12-13 11:18:39 +00:00
Corinna Vinschen 56face1741 * security.cc (lsaauth): Initialize lsa to INVALID_HANDLE_VALUE to
avoid potential access violation.
2006-12-13 09:53:42 +00:00
Corinna Vinschen 524e6a5ad9 * Makefile.in (subauth): Drop rule.
* configure.in: Remove subauth related check.
	* configure: Regenerate.
2006-12-12 20:26:27 +00:00
Corinna Vinschen 67f85328b2 Remove subauth directory. 2006-12-12 19:22:07 +00:00
Corinna Vinschen 26684e48d2 * environ.cc (subauth_id_init): Remove.
(parse_thing): Drop "subauth_id" option.
	* security.cc (get_token_group_sidlist): Drop comments concerning
	subauthentication.
	(create_token): Back out subauthentication related changes.
	(subauth): Remove.
	* security.h (create_token): Remove declaration.
	(subauth): Ditto.
	* syscalls.cc (seteuid32): Drop subauthentication handling entirely.
2006-12-12 19:18:56 +00:00
Corinna Vinschen 31fdd91f9b * cygwinenv.sgml: Drop description of "traverse" option. 2006-12-12 18:48:35 +00:00
Corinna Vinschen a889232410 * environ.cc (set_traverse): Remove.
(parse_thing): Drop "traverse" option.
	* path.cc (fs_info::update): Don't request SE_CHANGE_NOTIFY_PRIV
	privilege.
	* sec_helper.cc (set_cygwin_privileges): Ditto.
	* security.cc (allow_traverse): Remove.
	(alloc_sd): Drop special allow_traverse code.
	* security.h (allow_traverse): Drop declaration.
	* syscalls.cc (statvfs): Don't request SE_CHANGE_NOTIFY_PRIV privilege.
2006-12-12 18:47:25 +00:00
Corinna Vinschen 5684cfebba Partially revert change from 2005-04-03, always running under an
impersonation token, which collides with Vista UAC.
	* cygheap.h (deimpersonate): revert to self instead of impersonating
	hProcImpToken.
	(reimpersonate): Only impersonate if setuid.
	* dcrt0.cc (dll_crt0_0): Don't initialize hProcImpToken here.
	(dll_crt0_1): Set privileges on hProcToken.
	* fork.cc (frok::child): Set privileges on hProcToken.  Close handle to
	hProcImpToken.
	* grp.cc (internal_getgroups): Use hProcToken instead of hProcImpToken.
	* security.cc (check_access): Create hProcImpToken on demand here.
	* security.h (set_process_privilege): Set privileges on hProcToken.
	(_push_thread_privilege): Use hProcToken instead of hProcImpToken.
	(pop_thread_privilege): If not setuid'ed, revert to self.
	* syscalls.cc (setegid32): Drop setting primary group on hProcImpToken.
	Close handle to hProcImpToken.
	* uinfo.cc (internal_getlogin): Ditto.
	* winsup.h (clear_procimptoken): New inline function.
2006-12-12 16:27:32 +00:00
Christopher Faylor 815122d842 Add missing ChangeLog. 2006-12-12 15:59:26 +00:00
Christopher Faylor a10c6f0312 * sigproc.cc (child_info::child_info): Initialize msv_count. 2006-12-12 15:58:08 +00:00
Corinna Vinschen 46b51548b1 Revert erroneous checkin. 2006-12-12 15:10:56 +00:00
Corinna Vinschen d6a6da338b * libc/minires.c (res_ninit): Drop handling for LOCALDOMAIN environment
variable.
2006-12-12 08:29:37 +00:00
Corinna Vinschen 0c365c631f * Makefile.in (DLL_OFILES): Add minires-os-if.o and minires.o.
(SUBLIBS): Add libresolv.a.
	Add rule for libresolv.a.
	* autoload.cc: Fix return code handling for IP Helper API in case
	of being unable to load iphlpapi.dll.
	(DnsQuery_A): Define.
	(DnsRecordListFree): Define.
	* cygwin.din: Export resolver functions.
	* include/resolv.h: New header.
	* include/arpa/nameser.h: New header.
	* include/arpa/nameser_compat.h: New header.
	* include/cygwin/version.h: Bump API minor number.
	* libc/minires-os-if.c: New file.
	* libc/minires.c: New file.
	* libc/minires.h: New file.
2006-12-11 19:59:06 +00:00
Christopher Faylor 7dfad3a0c6 * sigproc.cc (child_info::child_info): Move old comment about msv_count here.
Edit it slightly to reflect new sensibilities.
2006-12-11 19:17:20 +00:00
Christopher Faylor 6dcb2ec441 * dumper.cc: Add an include to accommodate new include/elf usage. 2006-12-11 19:17:17 +00:00
Christopher Faylor fc32d70841 correct email address 2006-12-11 18:58:40 +00:00
Christopher Faylor c16548b2a2 * child_info.h (child_info_spawn::__stdin): New element.
(child_info_spawn::__stdin): Ditto.
(CURR_CHILD_INFO_MAGIC): Regenerate.
* dcrt0.cc (check_sanity_and_sync): Minor cleanup.
(child_info_spawn::handle_spawn): Handle new __std* elements by calling
move_fd.
* dtable.cc (dtable::move_fd): Define new function.
* dtable.h (dtable::move_fd): Declare new function.
* fhandler.h (fhandler_pipe::popen_pid): Declare new element.
* fhandler.h (fhandler_pipe::get_popen_pid): Define new function.
* fhandler.h (fhandler_pipe::set_popen_pid): Ditto.
* pipe.cc (fhandler_pipe::fhandler_pipe): Zero popen_pid.
(fhandler_pipe::dup): Ditto.
* spawn.cc (handle): Change second argument to bool.
(spawn_guts): Accept __stdin/__stdout arguments and set them appropriately in
child_info structure and in STARTUPINFO structure.
* syscalls.cc (popen): New cygwin-specific implementation using spawn.
(pclose): Ditto.
* winsup.h (spawn_guts): Accommodate new arguments for spawn_guts.
* fhandler.cc (fhandler_base::set_no_inheritance): Make second arg a bool.
* fhandler.h (fhandler_base::set_no_inheritance): Ditto for declaration.
* child_info.h (child_info::msv_count): Rename from the now-inappropriate
"zero".
(child_info_spawn::filler): Add filler to work around Vista bug.
(child_info_fork::filler): Ditto.
* dcrt0.cc (get_cygwin_startup_info): Remove "zero" check since it is now
always filled out.
* fork.cc (frok::parent): Move ch.zero manipulation to constructor.
* spawn.cc (spawn_guts): Ditto.  Remove _ch wrapper.
* sigproc.cc (child_info::child_info): Initialize starter[].
* shared.cc (shared_info::heap_slop_size): Remove noisy system_printfs.
* shared_info.h (CURR_SHARED_MAGIC): Regenerate.
2006-12-11 18:55:29 +00:00
Corinna Vinschen e79c01f84e * fhandler.cc (rootdir): Fix typo in comment.
* syscalls.cc (try_to_bin): Ditto.
2006-12-11 09:07:22 +00:00
Christopher Faylor c2b8862303 * mount.cc (do_mount): Avoid unnecessary cygwin_conv_to_win32_path and pass
POSIX path directly - this avoids a cygwin DLL warning.
2006-12-10 21:50:06 +00:00
Corinna Vinschen cbfb7b1b23 * autoload.cc (SHFileOperationA): Drop definition.
* ntdll.h (struct _FILE_RENAME_INFORMATION): Define.
	* path.cc (fs_info::update): Note length of rootdir prefix in
	root_len.
	(get_nt_native_path): New function, taking over functionality of
	path_conv::get_nt_native_path.
	(path_conv::get_nt_native_path): Just call get_nt_native_path.
	* path.h (get_nt_native_path): Declare.
	(struct fs_info): New member root_len.
	(fs_info::length): New inline method returning root_len.
	(path_conv::rootdir): New inline method returning rootdir prefix.
	* syscalls.cc (try_to_bin): Rewrite using only system calls.
	(unlink_nt): Call try_to_bin with additional handle to open file
	parameter.
	(statvfs): Use path_conv::rootdir method.
	* wincap.h: Define has_recycle_dot_bin throughout.
	* wincap.cc: Ditto.
2006-12-10 16:43:30 +00:00
Corinna Vinschen 6c64fb2fda * fhandler.cc (rootdir): Clarify comment. 2006-12-10 16:20:43 +00:00
Corinna Vinschen 37ae69e8b1 * fhandler.cc (rootdir): Don't look for volume mount points on remote
shares.
2006-12-10 16:18:51 +00:00
Corinna Vinschen 30cf835f7e * fhandler.cc (rootdir): Drop useless post-increment. Take volume
mount points into account.
	(check_posix_perm): Allocate space for root directory big enough.
2006-12-10 12:56:50 +00:00
Corinna Vinschen 8af19fdb25 * syscalls.cc (try_to_bin): Add comment that this is not possibly
the final version.
2006-12-09 09:29:47 +00:00
Corinna Vinschen e563a4d5b8 * syscalls.cc (unlink_nt): Open native symlinks with
FILE_OPEN_REPARSE_POINT flag.
2006-12-07 17:53:05 +00:00
Corinna Vinschen 1c9b2968fa * ntdll.h (STATUS_DELETE_PENDING): Define.
(struct _FILE_DISPOSITION_INFORMATION): Define.
	* syscalls.cc (unlink_9x): new function to delete file on 9x.
	* syscalls.cc (unlink_nt): new function to delete file on NT.
	(unlink): Simplify.  Move OS dependent stuff into aforementioned
	functions.  Also handle FILE_ATTRIBUTE_HIDDEN as R/O-like flag.
2006-12-07 17:40:24 +00:00
Corinna Vinschen 398e28fbbc * autoload.cc (SHFileOperationA): Define.
* syscalls.cc (try_to_bin): New function trying to move a file to
	the recycle bin.
	(unlink): Fix arguments used in CreateFile for delete on close.
	Before closing the handle, try to move the file to the recycle bin.
2006-12-07 11:53:46 +00:00
Corinna Vinschen 2ffc166d07 * cygheap.h (struct cwdstuff): Add "sync" member and accompanying
"keep_in_sync" methods.
	* external.cc (cygwin_internal): Call above keep_in_sync method when
	CW_SYNC_WINENV is requested.
	* path.cc (cwdstuff::init): Don't change to windows_system_directory
	if keep_in_sync is requested.
	(cwdstuff::keep_in_sync): New method.
	(cwdstuff::set): Take sync flag into account.
2006-12-07 10:04:52 +00:00
Corinna Vinschen 63f33caadc * termios.cc: Change include order to accomodate change to sys/ioctl.h. 2006-12-06 19:44:07 +00:00
Corinna Vinschen 8b8273781b * fhandler_mem.cc (fhandler_dev_mem::open): Fix comment.
* wincap.cc (has_physical_mem_access): Reflect the fact that physical
	memory access has been made a protected operation beginning with
	2003 Server.
2006-12-06 16:33:03 +00:00
Corinna Vinschen bf8ea306ec * include/sys/ioctl.h: Pick up termios.h, for TIOCGWINSZ. 2006-12-06 14:08:08 +00:00
Corinna Vinschen 6acc178a24 * winsup.h (WINVER): Set to 0x0600 to cover Vista. 2006-12-06 14:06:38 +00:00
Corinna Vinschen ad7915ffca * fhandler_disk_file.cc (fhandler_disk_file::rmdir): Fix typo. 2006-12-06 14:05:59 +00:00
Corinna Vinschen 3c788ea42a * path.cc (cwdstuff::init): Don't change to windows_system_directory
if Cygwin DLL has been loaded dynamically.
2006-12-05 21:46:26 +00:00
Corinna Vinschen 2156546df2 * path.cc (cwdstuff::set): Don't try to open directory on systems not
supporting that.
2006-12-05 13:20:38 +00:00
Corinna Vinschen a83c59fbc3 * dcrt0.cc (get_cygwin_startup_info): Fix comment.
* wincap.cc (wincapc::init): Always reset needs_count_in_si_lpres2 to
	false on non 64-bit systems.
2006-12-05 13:16:24 +00:00
Corinna Vinschen 301cd37dda Fix date. 2006-12-05 11:07:12 +00:00
Corinna Vinschen c6674b53d3 * dcrt0.cc (get_cygwin_startup_info): Change zeros to DWORD array.
Expect first DWORD in child_info struct being set to non-zero if
	wincap.needs_count_in_si_lpres2 is set.  Add comment to explain why.
	* fork.cc (frok::parent): Set ch.zero[0] to a sensible count value
	if wincap.needs_count_in_si_lpres2 is set.
	* spawn.cc (spawn_guts): Ditto.  Add filler bytes after ch on stack
	to accomodate needs_count_in_si_lpres2.
	* wincap.h: Define needs_count_in_si_lpres2 throughout.
	* wincap.cc: Ditto.
2006-12-05 10:59:21 +00:00
Corinna Vinschen 8eca536272 * dir.cc (mkdir): Check last path component for "..".
(rmdir): Don't check last path component for "..".
	* fhandler_disk_file.cc (fhandler_disk_file::rmdir): Drop kludge
	which tries to allow deleting the current working directory.
	* path.cc (has_dot_last_component): Add parameter to indicate testing
	for "..".  Take trailing slash into account.
	(symlink_info::posixify): Rely on cygheap->cwd.win32 having a
	useful value.
	(cwdstuff::init): Initialize cygheap->cwd with current working
	directory.  Change to windows_system_directory afterwards.
	(cwdstuff::set): Never call SetCurrentDirectory here.  Just check
	if changing into target directory would be allowed.  Add comment to
	explain why.
	* path.h (has_dot_last_component): Declare with second parameter.
	* pinfo.cc (pinfo::zap_cwd): Remove.
	(pinfo::exit): Drop call to zap_cwd.
	* pinfo.h (class pinfo): Remove declaration of zap_cwd.
	* spawn.cc (spawn_guts): Set current working directory for non-Cygwin
	child applications.  Drop call to zap_cwd.
2006-11-30 10:17:24 +00:00
Corinna Vinschen 75bb63452d * security.cc (create_token): Revert erroneous change to test
subauth_token for INVAILD_HANDLE_VALUE.
	* syscalls.cc (seteuid32): Set create_token's subauth_token parameter
	back to NULL.
2006-11-28 23:15:01 +00:00
Corinna Vinschen 902716e599 * fhandler.cc (fhandler_base::open): Fix previous patch to handle the
SYSTEM attribute as well.
2006-11-28 09:57:01 +00:00
Corinna Vinschen ef26cc9307 * fhandler.cc (fhandler_base::open): Fix handling of files with
HIDDEN attribute set.
2006-11-27 19:14:24 +00:00
Christopher Faylor f64b151f59 * include/cygwin/signal.h: Add __extension__ to various anonymous unions and
structs.  (thanks to V.Haisman)
2006-11-27 16:43:34 +00:00
Corinna Vinschen 8e4735df6c Initial release of the Cygwin LSA authentication package.
* ChangeLog: New file.
	* Makefile.in: Ditto.
	* aclocal.m4: Ditto.
	* configure.in: Ditto.
	* configure: Ditto. Generated from configure.in.
	* cyglsa-config: Ditto.
	* cyglsa.c: Ditto.
	* cyglsa.din: Ditto.
	* cyglsa64.dll: Ditto.
	* make-64bit-version-with-visual-c.bat: Ditto.
	* mslsa.def: Ditto.
2006-11-27 13:05:54 +00:00
Corinna Vinschen c6caaa3429 * Makefile.in: Add dependencies for lsaauth.
* configure.in: Disable building subauth.  Add building lsaauth.
	* configure: Regenerate.
2006-11-27 13:01:36 +00:00
Corinna Vinschen b825c587ba * cyglsa.h: New header file.
* environ.cc: Disable subauth settings.
	* grp.cc: Accomodate cygsidlist's count now being a method.
	* sec_helper.cc (SECURITY_MANDATORY_INTEGRITY_AUTHORITY): Remove.
	(mandatory_medium_integrity_sid): Remove.
	(mandatory_high_integrity_sid): Remove.
	(mandatory_system_integrity_sid): Remove.
	(fake_logon_sid): Add.
	(cygsid::get_sid): Add well_known parameter.  Set well_known_sid
	accordingly.
	(cygsid::getfromstr): Ditto.
	(cygsidlist::alloc_sids): Move here from security.cc.
	(cygsidlist::free_sids): Ditto.
	(cygsidlist::add): Move here from security.h.  Add well_known parameter.
	Set well_known_sid accordingly.  Don't allow duplicate SIDs.
	* security.cc: Include cyglsa.h and cygwin/version.h.  Throughout
	accomodate cygsidlist's count now being a method.  Throughout drop
	redundant "contains" tests.
	(get_user_local_groups): Add local groups as well known SIDs.
	(get_token_group_sidlist): Add well known groups as well known SIDs.
	(get_server_groups): Ditto.  Only call get_unix_group_sidlist after
	get_user_local_groups to maintain "well_known_sid" attribute.
	(get_initgroups_sidlist): Add well known groups as well known SIDs.
	(get_setgroups_sidlist): Add usersid and struct passwd parameter to
	allow calling get_server_groups from here.
	(get_system_priv_list): Make static.  Return size of TOKEN_PRIVILEGES
	structure.
	(get_priv_list): Ditto.
	(create_token): Accomodate above changes.  Drop misguided attempt to
	add MIC SIDs to created user token.  Print returned token as hex value.
	(subauth): Disable.
	(lsaauth): New function implementing client side of LSA authentication.
	* security.h (class cygsid): Add well_known_sid attribute.  Accomodate
	throughout.  Add *= operator to create a well known SID.
	(class cygsidlist): Rename count to cnt.  Make count a method.
	(cygsidlist::add): Move to sec_helper.cc.
	(cygsidlist::operator *=): New method to add well known SID.
	(cygsidlist::non_well_known_count): New method returning number of
	non well known SIDs in list.
	(cygsidlist::next_non_well_known_sid): New method returning next non
	well known SID by index.
	(mandatory_medium_integrity_sid): Drop declaration.
	(mandatory_high_integrity_sid): Drop declaration.
	(mandatory_system_integrity_sid): Drop declaration.
	(fake_logon_sid): Add declaration.
	(subauth): Disable declaration.
	(lsaauth): Add declaration.
	* syscalls.cc (seteuid32): Disable subauthentication.  Add LSA
	authentication.
	* wincap.h: Define needs_logon_sid_in_sid_list throughout.
	* wincap.cc: Ditto.
2006-11-27 12:59:59 +00:00
Keith Marshall b6bb405954 configure.in: Update to autoconf 2.5x syntax; fix macro argument quoting;
remove invalid use of AC_ALLOCA; remove redundant use of AC_SUBST.
2006-11-25 15:55:05 +00:00
Corinna Vinschen 124b187f16 * security.h (DBGSID): Define for debugging purposes.
(MKSID): Rename from SID so as to not hide SID definition from winnt.h.
	* sec_helper.cc: Change SID to MKSID throughout.
2006-11-23 16:44:55 +00:00