aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin
AgeCommit message (Collapse)AuthorFilesLines
2007-08-02 * fhandler_disk_file.cc (readdir_get_ino): Accommodate native symlinks.Corinna Vinschen3-3/+15
* syscalls.cc (rename): Ditto.
2007-08-02* lib/Makefile: Add missed file to accommodate below changes.Christopher Faylor1-0/+4
2007-08-02Add missing checkin.Christopher Faylor1-4/+4
2007-08-02* lib/cygwin_attach_dll.c: Fix compiler warning.Christopher Faylor3-0/+9
* lib/cygwin_crt0.c: Ditto.
2007-08-02* dcrt0.cc (codepage_type): Remove definition.Christopher Faylor4-32/+50
* strfuncs.cc: Move it here. New file with bits of miscfuncs.cc. * miscfuncs.cc: Remove wide character stuff.
2007-08-02 * syscalls.cc (rename): Move and add text to comment about testingCorinna Vinschen2-16/+31
oldpath and newpath referring to the same file. Test if oldpath has more than one hardlink before opening oldpath (idea by Eric Blake). Reorder test so that file id is tested before volume serial number.
2007-08-02 * path.h (struct fs_info): Drop root_len and name_hash members.Corinna Vinschen3-17/+10
(fsinfo::length): Remove. (path_conv::rootdir): Remove. * syscalls.cc (try_to_bin): Use rootdir function instead of path_conv::rootdir method.
2007-08-02 * fhandler_disk_file.cc (path_conv::ndisk_links): Fix typo in call toCorinna Vinschen2-1/+6
NtClose.
2007-08-01 * syscalls.cc (rename): Check if oldpath and newpath refer to theCorinna Vinschen2-1/+41
same file. If so, return successfully and perform no other action, as per SUSv3.
2007-08-01 * ntdll.h (STATUS_ACCESS_DENIED): Define.Corinna Vinschen3-25/+80
* syscalls.cc (check_dir_not_empty): New static function. (unlink_nt): Move code checking for non-empty dir to check_dir_not_empty and call check_dir_not_empty instead. (rename): Add fault handler. Check oldpath and newpath for trailing . and .. path components and return EINVAL if so. Check oldpath for being on a vrtual file system. If renaming a dir fails with STATUS_ACCESS_DENIED, check if the target dir is non-empty and return ENOTEMPTY if so.
2007-08-01 * localtime.cc (tzsetwall): Don't set TZ.Corinna Vinschen2-0/+8
2007-08-01 * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): DropCorinna Vinschen5-99/+135
usage of path_conv::volser(). (fhandler_base::fstat_by_name): Ditto. * ntdll.h (STATUS_NO_MEDIA_IN_DEVICE): Define. (STATUS_OBJECT_NAME_NOT_FOUND): Define. (FILE_REMOVABLE_MEDIA, FILE_READ_ONLY_DEVICE, FILE_FLOPPY_DISKETTE) (FILE_WRITE_ONCE_MEDIA, FILE_REMOTE_DEVICE, FILE_DEVICE_IS_MOUNTED) (FILE_VIRTUAL_VOLUME, FILE_AUTOGENERATED_DEVICE_NAME) FILE_DEVICE_SECURE_OPEN): Define Device Characteristics. (struct _FILE_FS_DEVICE_INFORMATION): Define. * path.cc (MAX_FS_INFO_CNT): Remove. (fsinfo): Remove. (fsinfo_cnt): Remove. (fs_info::update): Rewrite using native NT functions. Drop fs_info cashing since it's incorrect. (path_conv::fillin): Use NtQueryInformationFile. Drop setting serial number. (path_conv::check): Accommodate new fs_info::update parameters. (fillout_mntent): Ditto. * path.h (fs_info): Drop serial, has_ea and drive_type status flags. (fs_info::update): Declare with new parameters. (path_conf::drive_type): Remove. (path_conf::fs_has_ea): Remove. (path_conf::volser): Remove.
2007-08-01 * fhandler.cc (check_posix_perms): Remove.Corinna Vinschen2-26/+7
(fhandler_base::fpathconf): Return value of pc.has_acls () instead of calling check_posix_perms.
2007-08-01 * syscalls.cc (rename): Use unchanged path_conv in condition.Corinna Vinschen2-2/+6
2007-08-01 * smallprint.cc (__small_vsprintf): Add format specifier 'W' forCorinna Vinschen2-13/+26
PWCHAR arguments. Move wide char handling after char handling.
2007-07-31 * ntdll.h (RtlFreeAnsiString): Declare.Corinna Vinschen3-12/+63
* ntdll.h (RtlFreeOemString): Declare. * ntdll.h (RtlUnicodeStringToAnsiString): Declare. * ntdll.h (RtlUnicodeStringToOemString): Declare. * smallprint.cc: Renamed from smallprint.c. Drop unnecessary forward declarations. (__small_vsprintf): Add format specifiers 'C' for WCHAR arguments and 'S' for PUNICODE_STRING arguments.
2007-07-31 * fhandler_disk_file.cc (fhandler_disk_file::link): Revert to checkingCorinna Vinschen6-152/+190
for binary in case of .exe files. * ntdll.h (RtlPrefixUnicodeString): Declare. * path.cc (path_conv::is_binary): New method. * path.h (path_conv::is_binary): Declare. * syscalls.cc (rename_append_suffix): New static helper function for rename. (rename): Rewrite. New suffix tests. Use native NT functions.
2007-07-30 * fhandler_disk_file.cc (fhandler_disk_file::facl): If file can't beCorinna Vinschen4-2/+26
opened for reading the ACLs, fall back to faking them. * sec_acl.cc (acl_worker): Handle non-existing files. * security.cc (get_file_attribute): Return ILLEGAL_UID/ILLEGAL_GID as owner/group for non-readable ACLs on file systems supporting them.
2007-07-30 * syscalls.cc (stat_worker): Don't call build_fh_pc with invalid pc.Corinna Vinschen2-10/+15
2007-07-29* fhandler.cc (fhandler_base::wait_overlapped): Handle read EOF better andChristopher Faylor2-6/+26
issue a SIGPIPE when we get ERROR_NO_DATA.
2007-07-29 * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Don't allowCorinna Vinschen3-19/+38
FileAttributes set to 0 when calling NtSetInformationFile since it has a special meaning. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::link): Only set attributes after copying files. Use SetFileAttributesW. * syscalls.cc (unlink_nt): Only care for actual FILE_ATTRIBUTE_READONLY. Don't allow FileAttributes set to 0 when calling NtSetInformationFile. After marking for deletion, restore R/O attribute on files to accommodate hardlinks.
2007-07-29 * fhandler_disk_file.cc (fhandler_disk_file::link): Use FILE_ANY_ACCESS.Corinna Vinschen4-133/+134
(fhandler_base::utimes_fs): Fix white space. (fhandler_disk_file::lock): Remove 9x blurb from comment. (fhandler_disk_file::mkdir): Use NtCreateFile/NtClose instead of CreateDirectoryA. (fhandler_disk_file::rmdir): Accommodate changes to unlink_nt. Simplify post-delete SMB-related tests. Use NtQueryAttributesFile instead of GetFileAttributes. * ntdll.h (STATUS_DIRECTORY_NOT_EMPTY): Define. (NtQueryAttributesFile): Declare. * syscalls.cc (unlink_nt): Return NTSTATUS. Drop setattrs parameter. Never use FILE_DELETE_ON_CLOSE, always use NtSetInformationFile(FileDispositionInformation) instead. Check for R/O attributes and open file with FILE_WRITE_ATTRIBUTES access if any of them are set. Remove R/O attributes before marking for delete if necessary. Revert them afterwards if necessary. (unlink): Accommodate changes to unlink_nt.
2007-07-29 * fhandler_disk_file.cc: Use get_handle throughout.Corinna Vinschen3-43/+83
(fhandler_disk_file::fchmod): Always try to open file with required access rights. Use NtSetInformationFile instead of SetFileAttributes. (fhandler_disk_file::facl): Use NtSetInformationFile instead of SetFileAttributes. (fhandler_base::utimes_fs): Change lastaccess and lastwrite to LARGE_INTEGER. Drop 9x directory case. Use NtSetInformationFile instead of SetFileAttributes. Drop temporarily changing R/O attribute since NtSetInformationFile(FileBasicInformation) also works on R/O files. * ntdll.h (STATUS_NOT_SUPPORTED): Define.
2007-07-29* cygtls.h (_cygtls::inside_kernel): Move function declaration into _cygtlsChristopher Faylor6-23/+61
class. * exceptions.cc (_cygtls::inside_kernel): Move function definition into _cygtls class. * fhandler.cc (fhandler_base::wait_overlapped): Make return tri-state to detect when there is a EINTR situation. Add a pointer to a length parameter. Move GetOverlappedResult into this function. (fhandler_base::read_overlapped): Accommodate above changes and loop if we receive a restartable signal. (fhandler_base::write_overlapped): Ditto. * fhandler.h (fhandler_base::wait_overlapped): Reflect above changes. * fhandler_fifo.cc (fhandler_fifo::wait): Ditto.
2007-07-28 * ntdll.h (RtlEqualUnicodePathPrefix): Rename from RtlEqualPathPrefix.Corinna Vinschen3-10/+17
(RtlEqualUnicodePathSuffix): Rename from RtlEqualPathSuffix. * fhandler_disk_file.cc (fhandler_disk_file::link): Accommodate above change.
2007-07-28 * ntdll.h (RtlInitCountedUnicodeString): Swap order of string and lengthCorinna Vinschen3-22/+61
parameters to be the same as for RtlInitEmptyUnicodeString. (RtlEqualPathPrefix): New inline function. (RtlEqualPathSuffix): New inline function. * fhandler_disk_file.cc: Accommodate parameter order change of RtlInitEmptyUnicodeString throughout. (fhandler_disk_file::link): Do path checking in unicode. Call CopyFileW instead of CopyFileA.
2007-07-27 * autoload.cc (CreateHardLinkA): Remove.Corinna Vinschen4-118/+68
* fhandler_disk_file.cc (fhandler_disk_file::link): Drop GetBinaryType test. Just check exe suffix instead. Tune creating new file name. Implement creating hard link using native NT functions which works on all platforms. * ntdll.h (STATUS_INVALID_DEVICE_REQUEST): Define. (struct _FILE_LINK_INFORMATION): Define.
2007-07-27 * fhandler_disk_file.cc (fhandler_disk_file::ftruncate): UseCorinna Vinschen2-12/+20
NtQueryInformationFile instead of GetFileSize, NtFsControlFile instead of DeviceIoControl.
2007-07-27 * fhandler_disk_file.cc (fhandler_base::fstat_by_name): UseCorinna Vinschen3-36/+55
RtlSplitUnicodePath. (fhandler_disk_file::fstat): Rename oret to opened. Open file using NT functions right here. Try to open parent dir instead of root directory to avoid call to rootdir. Use NtFsControlFile. * ntdll.h (RtlSplitUnicodePath): Define.
2007-07-27 * fhandler_disk_file.cc (is_volume_mountpoint): New static inlineCorinna Vinschen2-40/+40
function. (path_conv::ndisk_links): Call is_volume_mountpoint. (fhandler_disk_file::readdir_helper): Ditto.
2007-07-27 * fhandler.h (enum query_state): Drop redundant query_stat_control.Corinna Vinschen4-20/+18
* fhandler.cc (fhandler_base::open): Ditto. Add READ_CONTROL to access and FILE_OPEN_FOR_BACKUP_INTENT to create_options when opening for writing. Always set security attributes to avoid calling has_acls. * fhandler_disk_file.cc (fhandler_base::fstat_fs): Don't try to open file twice.
2007-07-26 * dir.cc (readdir_worker): Drop dir parameter from call toCorinna Vinschen12-270/+573
readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-25 * autoload.cc (CreateToolhelp32Snapshot): Remove.Corinna Vinschen2-1/+4
2007-07-25 * autoload.cc (Process32First): Remove.Corinna Vinschen2-2/+5
(Process32Next): Remove.
2007-07-25 * autoload.cc (NetWkstaUserGetInfo): Remove.Corinna Vinschen2-5/+8
(CharToOemBuffA): Remove. (KillTimer): Remove. (OemToCharBuffA): Remove. (SetTimer): Remove.
2007-07-20 Fix ChangeLogCorinna Vinschen1-2/+0
2007-07-20 * fhandler.cc (fhandler_base::fhaccess): Accommodate interface changesCorinna Vinschen10-1381/+1287
of access control functions throughout. * fhandler_disk_file.cc: Ditto. * fhandler_registry.cc: Ditto. * sec_acl.cc: Drop unnecessary includes. (setacl): Take path_conv instead of file name as parameter. Accommodate interface changes of access control functions. (getacl): Ditto. * sec_auth.cc: New file, taking over all authentication related functions from security.cc. * sec_helper.cc: Drop unnecessary includes. * security.cc: Ditto. Move all authentication related functions to sec_auth.cc. (ALL_SECURITY_INFORMATION): New define. Use throughout. (set_file_sd): New function, replacing read_sd and the file related part of get_nt_object_security. (get_reg_sd): Rename from get_reg_security. Drop type parameter. (get_reg_attribute): New function, replacing the registry related part of get_nt_object_security. (get_file_attribute): Take path_conv instead of file name as parameter. Use new get_file_sd call. (set_file_attribute): Ditto plus new set_file_sd. Drop unnecessary implementation without uid/gid parameters. (check_file_access): Take path_conv instead of file name as parameter. Use new get_file_sd call. (check_registry_access): Use new get_reg_sd call. * security.h: Accommodate above interface changes.
2007-07-19 * security.cc (set_nt_attribute): Remove.Corinna Vinschen2-21/+16
(set_file_attribute): Do it yourself instead of calling set_nt_attribute.
2007-07-19 * fhandler_disk_file.cc (fhandler_base::fstat_by_name): UseCorinna Vinschen3-29/+43
NtQueryFullAttributesFile instead of FindFirstFile. (fhandler_base::fstat_fs): Drop check for exec_state. Drop check for invalid characters. * ntdll.h (struct _FILE_NETWORK_OPEN_INFORMATION): Define. (NtQueryFullAttributesFile): Declare.
2007-07-19 * fhandler.cc (fhandler_base::open): Drop local wpath and upathCorinna Vinschen6-24/+74
variables. Call pc.get_object_attr to create object attributes. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Ditto. * syscalls.cc (unlink_nt): Ditto. * path.cc (path_conv::set_normalized_path): Set wide_path to NULL. (path_conv::get_nt_native_path): Drop parameter. Create path in wide_path/uni_path members. (path_conv::get_object_attr): New method to create object attributes. (path_conv::get_wide_win32_path): New method to create Win32 wide path. (path_conv::check): Initialize wide_path to NULL. (path_conv::~path_conv): cfree wide_path. * path.h (class path_conv): New members wide_path and uni_path. Add declarations of get_object_attr and get_wide_win32_path. (path_conv::path_conv): Initialize wide_path to NULL. (path_conv::get_nt_native_path): Drop parameter.
2007-07-19 * sec_helper.cc: Remove unused code.Corinna Vinschen2-71/+4
2007-07-19 * autoload.cc (SetSecurityDescriptorControl): Drop.Corinna Vinschen5-22/+25
* security.cc (alloc_sd): Set security descriptor control flag without calling SetSecurityDescriptorControl function. * wincap.h (wincapc::has_dacl_protect): Rename from has_security_descriptor_control. * wincap.cc: Ditto throughout.
2007-07-19 * autoload.cc (SetUserObjectSecurity): Drop.Corinna Vinschen5-7/+24
* pinfo.cc (pinfo::set_acl): Use NtSetSecurityObject instead of SetKernelObjectSecurity. * spawn.cc (spawn_guts): Use NtSetSecurityObject instead of SetUserObjectSecurity. * uinfo.cc (cygheap_user::init): Ditto.
2007-07-19 * cygheap.h (init_cygheap::luid): Remove.Corinna Vinschen9-170/+302
* mmap.cc (mlock): Accommodate parameter change in call to push_thread_privilege. (munlock): Ditto. * ntdll.h (STATUS_NOT_ALL_ASSIGNED): Define. (NtAdjustPrivilegesToken): Declare. * sec_helper.cc (cygpriv): Reorder to match numerical privilege order. (privilege_luid): Take job of privilege_luid_by_name, using new cygpriv. (privilege_luid_by_name): Remove. (privilege_name): Accommodate new cygpriv array. (set_privilege): Call NtAdjustPrivilegesToken to avoid using advapi32. Accommodate changes to privilege_name. (set_cygwin_privileges): Simplify. Don't try to set SE_CREATE_GLOBAL_PRIVILEGE on systems not supporting it. * security.cc (sys_privs): Reorder to match numerical privilege order. Use real privilege values as defined in security.h. (get_system_priv_list): Drop unused grp_list argument. Create list of privileges according to new wincapc::max_sys_priv value. (get_priv_list): Call privilege_luid instead of privilege_luid_by_name. Make priv a local value instead of a pointer. (create_token): Accommodate parameter change in call to push_self_privilege. (lsaauth): Ditto. (check_access): Use privilege values directly instead of calling privilege_luid. * security.h: Define real privilege values. (cygpriv_idx): Remove. (privilege_luid): Change declaration. (privilege_luid_by_name): Drop declaration. (set_privilege): Change declaration. (set_process_privilege): Drop definition. (_push_thread_privilege): Accomodate new set_privilege parameters. * wincap.h (wincapc::max_sys_priv): New element. * wincap.cc: Implement above element throughout. (wincap_2000sp4): New wincaps structure. (wincap_xpsp1): Ditto. (wincap_xpsp2): Ditto. (wincapc::init): Use new wincaps. (wincapc::max_sys_priv): New element.
2007-07-19 * dcrt0.cc (dll_crt0_0): Call set_cygwin_privileges here, afterCorinna Vinschen3-2/+8
initializing hProcToken. * sec_helper.cc (init_global_security): Don't call set_cygwin_privileges here.
2007-07-18 * cygheap.h (shared_prefix): De-const.Corinna Vinschen3-2/+13
(shared_prefix_buf): Add static buffer for shared prefix to avoid additional allocation. * cygheap.cc (cygheap_init): Set cygheap->shared_prefix to cygheap->shared_prefix_buf and strcpy.
2007-07-17 * fhandler.cc (fhandler_base::fhaccess): Add check for R/O file system.Corinna Vinschen3-1/+16
* security.cc (check_registry_access): Set errno to EROFS when checking for W_OK.
2007-07-17 * fhandler_disk_file.cc (fhandler_disk_file::opendir): Move settingCorinna Vinschen2-3/+8
cfd->nohandle where it won't crash.
2007-07-16 * cygheap.h (cygheap_user::curr_imp_token): Rename from current_token.Corinna Vinschen7-16/+28
Accommodate changge throughout Cygwin. (cygheap_user::imp_token): Rename from token. Accommodate changge throughout Cygwin. (rcygheap_user::eimpersonate): Use primary token for impersonation. * grp.cc (internal_getgroups): Use primary impersonation token when impersonated. * security.h (_push_thread_privilege): Use primary impersonation token when impersonated.
2007-07-14* init.cc (in_dllentry): Delete.Christopher Faylor5-7/+10
(dll_entry): Remove assignment to deleted variable. * winsup.h (in_dllentry): Delete declaration. * exceptions.cc (inside_kernel): Use another method to see if we are in dll_entry phase.