To: vim-dev@vim.org Subject: Patch 6.0.268 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.268 (extra) (depends on patch 6.0.255) Problem: Win32: ACL check crashes when using forward slash in file name. Solution: Improve the check for the path in the file name. Files: src/os_win32.c *** ../vim60.267/src/os_win32.c Thu Feb 21 20:34:10 2002 --- src/os_win32.c Fri Feb 22 16:48:07 2002 *************** *** 4054,4095 **** * GetEffectiveRightsFromAcl() (Vince Negri) */ static int ! do_acl_check(char* n) { ! DWORD max_comp_len; ! DWORD file_sys_flags; ! static char* file_root = NULL; ! static int file_root_len = 0; ! int new_file_root_len; ! char* file_root_end; /* Extract file root path */ ! file_root_end = vim_strrchr(n, '\\'); ! new_file_root_len = file_root_end - n + 1; if (new_file_root_len > file_root_len) { vim_free(file_root); ! file_root = (char*)alloc(new_file_root_len + 1); file_root_len = new_file_root_len; } STRNCPY(file_root, n, new_file_root_len); ! file_root[new_file_root_len] = '\0'; /* Check #1 - can we get volume information in the first place? */ if (!GetVolumeInformation(file_root, NULL, 0, NULL, &max_comp_len, ! &file_sys_flags, NULL, 0)) return FALSE; /* Check #2 - does the file system support ACLs at all? */ ! if (!(file_sys_flags&FS_PERSISTENT_ACLS)) return FALSE; /* Check #3 - does it look like a Samba file system? Current guess is that * they are the only ones that are case sensitive/preserving but do not * support Unicode file names. */ ! if ((file_sys_flags& ! (FS_CASE_IS_PRESERVED|FS_CASE_SENSITIVE|FS_UNICODE_STORED_ON_DISK)) ! == (FS_CASE_IS_PRESERVED|FS_CASE_SENSITIVE)) return FALSE; /* The file system supports ACLs - do the check */ --- 4054,4093 ---- * GetEffectiveRightsFromAcl() (Vince Negri) */ static int ! do_acl_check(char *n) { ! DWORD max_comp_len; ! DWORD file_sys_flags; ! static char *file_root = NULL; ! static int file_root_len = -1; ! int new_file_root_len; /* Extract file root path */ ! new_file_root_len = gettail(n) - n; if (new_file_root_len > file_root_len) { vim_free(file_root); ! file_root = (char *)alloc(new_file_root_len + 1); file_root_len = new_file_root_len; } STRNCPY(file_root, n, new_file_root_len); ! file_root[new_file_root_len] = NUL; /* Check #1 - can we get volume information in the first place? */ if (!GetVolumeInformation(file_root, NULL, 0, NULL, &max_comp_len, ! &file_sys_flags, NULL, 0)) return FALSE; /* Check #2 - does the file system support ACLs at all? */ ! if (!(file_sys_flags & FS_PERSISTENT_ACLS)) return FALSE; /* Check #3 - does it look like a Samba file system? Current guess is that * they are the only ones that are case sensitive/preserving but do not * support Unicode file names. */ ! if ((file_sys_flags ! & (FS_CASE_IS_PRESERVED|FS_CASE_SENSITIVE|FS_UNICODE_STORED_ON_DISK)) ! == (FS_CASE_IS_PRESERVED|FS_CASE_SENSITIVE)) return FALSE; /* The file system supports ACLs - do the check */ *** ../vim60.267/src/version.c Fri Feb 22 20:51:21 2002 --- src/version.c Fri Feb 22 20:53:37 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 268, /**/ -- hundred-and-one symptoms of being an internet addict: 7. You finally do take that vacation, but only after buying a cellular modem and a laptop. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///