winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
November 2008
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
734 discussions
Start a n
N
ew thread
Alexandre Julliard : Release 1.1.8.
by Alexandre Julliard
07 Nov '08
07 Nov '08
Module: wine Branch: master Commit: 1d612e03e0d27b92abde718002175a66a994752e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1d612e03e0d27b92abde71800…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Nov 7 17:09:33 2008 +0100 Release 1.1.8. --- ANNOUNCE | 1303 ++++++++++++++++++++++++++----------------------------------- VERSION | 2 +- configure | 18 +- 3 files changed, 557 insertions(+), 766 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=1d612e03e0d27b92abde7…
1
0
0
0
Paul Vriens : winmm/tests: Fix a test failure on Vista and W2K8.
by Alexandre Julliard
07 Nov '08
07 Nov '08
Module: wine Branch: master Commit: 47dddefbb2ff0190232e35e2c947a31a7425eac0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=47dddefbb2ff0190232e35e2c…
Author: Paul Vriens <Paul.Vriens.Wine(a)gmail.com> Date: Fri Nov 7 13:40:21 2008 +0100 winmm/tests: Fix a test failure on Vista and W2K8. --- dlls/winmm/tests/capture.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/winmm/tests/capture.c b/dlls/winmm/tests/capture.c index fb02d40..f6155e9 100644 --- a/dlls/winmm/tests/capture.c +++ b/dlls/winmm/tests/capture.c @@ -359,9 +359,10 @@ static void wave_in_test_device(int device) dev_name(device),wave_in_error(rc)); rc=waveInGetDevCapsW(device,&capsW,4); - ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_NOTSUPPORTED, - "waveInGetDevCapsW(%s): MMSYSERR_NOERROR or MMSYSERR_NOTSUPPORTED " - "expected, got %s\n",dev_name(device),wave_in_error(rc)); + ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_NOTSUPPORTED || + rc==MMSYSERR_INVALPARAM, /* Vista, W2K8 */ + "waveInGetDevCapsW(%s): unexpected return value %s\n", + dev_name(device),wave_in_error(rc)); nameA=NULL; rc=waveInMessage((HWAVEIN)device, DRV_QUERYDEVICEINTERFACESIZE,
1
0
0
0
Paul Vriens : user32/tests: Skip GetMenuItemInfo tests on NT4 and below.
by Alexandre Julliard
07 Nov '08
07 Nov '08
Module: wine Branch: master Commit: 4f5460ffcfa702781d6f19fddbb39d30b35abbc1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4f5460ffcfa702781d6f19fdd…
Author: Paul Vriens <Paul.Vriens.Wine(a)gmail.com> Date: Fri Nov 7 11:46:20 2008 +0100 user32/tests: Skip GetMenuItemInfo tests on NT4 and below. --- dlls/user32/tests/menu.c | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-) diff --git a/dlls/user32/tests/menu.c b/dlls/user32/tests/menu.c index e4c4cea..adc9410 100644 --- a/dlls/user32/tests/menu.c +++ b/dlls/user32/tests/menu.c @@ -57,6 +57,33 @@ static void init_function_pointers(void) #undef GET_PROC } +static BOOL correct_behavior(void) +{ + HMENU hmenu; + MENUITEMINFO info; + BOOL rc; + + hmenu = CreateMenu(); + + memset(&info, 0, sizeof(MENUITEMINFO)); + info.cbSize= sizeof(MENUITEMINFO); + SetLastError(0xdeadbeef); + rc = GetMenuItemInfo(hmenu, 0, TRUE, &info); + /* Win9x : 0xdeadbeef + * NT4 : ERROR_INVALID_PARAMETER + * >= W2K : ERROR_MENU_ITEM_NOT_FOUND + */ + if (!rc && GetLastError() != ERROR_MENU_ITEM_NOT_FOUND) + { + win_skip("NT4 and below can't handle a bigger MENUITEMINFO struct\n"); + DestroyMenu(hmenu); + return FALSE; + } + + DestroyMenu(hmenu); + return TRUE; +} + static LRESULT WINAPI menu_check_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch (msg) @@ -2351,13 +2378,23 @@ START_TEST(menu) { init_function_pointers(); + /* Wine defines MENUITEMINFO for W2K and above. NT4 and below can't + * handle that. + */ + if (correct_behavior()) + { + test_menu_add_string(); + test_menu_iteminfo(); + test_menu_search_bycommand(); + test_CheckMenuRadioItem(); + test_menu_resource_layout(); + test_InsertMenu(); + } + register_menu_check_class(); test_menu_locked_by_window(); test_menu_ownerdraw(); - test_menu_add_string(); - test_menu_iteminfo(); - test_menu_search_bycommand(); test_menu_bmp_and_string(); if( !pSendInput) @@ -2367,7 +2404,4 @@ START_TEST(menu) test_menu_flags(); test_menu_hilitemenuitem(); - test_CheckMenuRadioItem(); - test_menu_resource_layout(); - test_InsertMenu(); }
1
0
0
0
Paul Vriens : user32/tests: Set last error if the menu item cannot be found .
by Alexandre Julliard
07 Nov '08
07 Nov '08
Module: wine Branch: master Commit: 80d3604947f6aaeba5ed437753d8a59cffc0d5f8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=80d3604947f6aaeba5ed43775…
Author: Paul Vriens <Paul.Vriens.Wine(a)gmail.com> Date: Fri Nov 7 11:45:38 2008 +0100 user32/tests: Set last error if the menu item cannot be found. --- dlls/user32/menu.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 928a9eb..ed93eff 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -4423,8 +4423,10 @@ static BOOL GetMenuItemInfo_common ( HMENU hmenu, UINT item, BOOL bypos, debug_print_menuitem("GetMenuItemInfo_common: ", menu, ""); - if (!menu) - return FALSE; + if (!menu) { + SetLastError( ERROR_MENU_ITEM_NOT_FOUND); + return FALSE; + } if( lpmii->fMask & MIIM_TYPE) { if( lpmii->fMask & ( MIIM_STRING | MIIM_FTYPE | MIIM_BITMAP)) {
1
0
0
0
Alexandre Julliard : advapi32/tests: Avoid sizeof in traces.
by Alexandre Julliard
07 Nov '08
07 Nov '08
Module: wine Branch: master Commit: adc09cc1b4b41daebd5fe500ff61435ec7332b0c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=adc09cc1b4b41daebd5fe500f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Nov 7 13:34:11 2008 +0100 advapi32/tests: Avoid sizeof in traces. --- dlls/advapi32/tests/security.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 7e2e3f2..f8cd6b8 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -750,8 +750,7 @@ static void test_FileSecurity(void) "was expected to fail for '%s'\n", file); ok (GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetFileSecurityA " "returned %d; expected ERROR_INSUFFICIENT_BUFFER\n", GetLastError()); - ok (retSize > sizeof (SECURITY_DESCRIPTOR), "GetFileSecurityA " - "returned size %d; expected > %d\n", retSize, sizeof (SECURITY_DESCRIPTOR)); + ok (retSize > sizeof (SECURITY_DESCRIPTOR), "GetFileSecurityA returned size %d\n", retSize); sdSize = retSize; sd = HeapAlloc (GetProcessHeap (), 0, sdSize); @@ -787,8 +786,7 @@ static void test_FileSecurity(void) "was expected to fail for '%s'\n", path); ok (GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetFileSecurityA " "returned %d; expected ERROR_INSUFFICIENT_BUFFER\n", GetLastError()); - ok (retSize > sizeof (SECURITY_DESCRIPTOR), "GetFileSecurityA " - "returned size %d; expected > %d\n", retSize, sizeof (SECURITY_DESCRIPTOR)); + ok (retSize > sizeof (SECURITY_DESCRIPTOR), "GetFileSecurityA returned size %d\n", retSize); sdSize = retSize; sd = HeapAlloc (GetProcessHeap (), 0, sdSize);
1
0
0
0
Krzysztof Kotlenga : winex11: Make pens of width = 1 scalable.
by Alexandre Julliard
07 Nov '08
07 Nov '08
Module: wine Branch: master Commit: 1c3e81bf5e930f7c3f68b6850d1d1fbdd161847c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1c3e81bf5e930f7c3f68b6850…
Author: Krzysztof Kotlenga <pocek(a)users.sf.net> Date: Fri Nov 7 12:07:10 2008 +0100 winex11: Make pens of width = 1 scalable. --- dlls/winex11.drv/pen.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/winex11.drv/pen.c b/dlls/winex11.drv/pen.c index 96d9043..cd29294 100644 --- a/dlls/winex11.drv/pen.c +++ b/dlls/winex11.drv/pen.c @@ -71,7 +71,7 @@ HPEN X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen ) physDev->pen.linejoin = logpen.lopnStyle & PS_JOIN_MASK; physDev->pen.width = logpen.lopnWidth.x; - if ((logpen.lopnStyle & PS_GEOMETRIC) || (physDev->pen.width > 1)) + if ((logpen.lopnStyle & PS_GEOMETRIC) || (physDev->pen.width >= 1)) { physDev->pen.width = X11DRV_XWStoDS( physDev, physDev->pen.width ); if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
1
0
0
0
Paul Bryan Roberts : server: Clone file_get_sd() and file_set_fd() for directories.
by Alexandre Julliard
07 Nov '08
07 Nov '08
Module: wine Branch: master Commit: 6435a5ddabda596d1c60d94a8f99ce19be95ac6d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6435a5ddabda596d1c60d94a8…
Author: Paul Bryan Roberts <pbronline-wine(a)yahoo.co.uk> Date: Mon Nov 3 22:37:17 2008 +0000 server: Clone file_get_sd() and file_set_fd() for directories. --- dlls/advapi32/tests/security.c | 37 +++++++++++++++ server/change.c | 99 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 134 insertions(+), 2 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index d3efa0b..7e2e3f2 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -777,6 +777,43 @@ static void test_FileSecurity(void) HeapFree (GetProcessHeap (), 0, sd); + /* Repeat for the temporary directory ... */ + + /* Get size needed */ + retSize = 0; + SetLastError (NO_ERROR); + rc = pGetFileSecurityA (path, request, NULL, 0, &retSize); + ok (!rc, "GetFileSecurityA " + "was expected to fail for '%s'\n", path); + ok (GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetFileSecurityA " + "returned %d; expected ERROR_INSUFFICIENT_BUFFER\n", GetLastError()); + ok (retSize > sizeof (SECURITY_DESCRIPTOR), "GetFileSecurityA " + "returned size %d; expected > %d\n", retSize, sizeof (SECURITY_DESCRIPTOR)); + + sdSize = retSize; + sd = HeapAlloc (GetProcessHeap (), 0, sdSize); + + /* Get security descriptor for real */ + retSize = 0; + SetLastError (NO_ERROR); + rc = pGetFileSecurityA (path, request, sd, sdSize, &retSize); + ok (rc, "GetFileSecurityA " + "was not expected to fail '%s'\n", path); + ok (GetLastError () == NO_ERROR, "GetFileSecurityA " + "returned %d; expected NO_ERROR\n", GetLastError ()); + ok (retSize == sdSize, "GetFileSecurityA " + "returned size %d; expected %d\n", retSize, sdSize); + + /* Use it to set security descriptor */ + SetLastError (NO_ERROR); + rc = pSetFileSecurityA (path, request, sd); + ok (rc, "SetFileSecurityA " + "was not expected to fail '%s'\n", path); + ok (GetLastError () == NO_ERROR, "SetFileSecurityA " + "returned %d; expected NO_ERROR\n", GetLastError ()); + + HeapFree (GetProcessHeap (), 0, sd); + /* Remove temporary file and directory */ DeleteFileA (file); RemoveDirectoryA (path); diff --git a/server/change.c b/server/change.c index 2c690e0..aded849 100644 --- a/server/change.c +++ b/server/change.c @@ -44,6 +44,8 @@ #include "handle.h" #include "thread.h" #include "request.h" +#include "process.h" +#include "security.h" #include "winternl.h" /* dnotify support */ @@ -146,6 +148,8 @@ struct dir { struct object obj; /* object header */ struct fd *fd; /* file descriptor to the directory */ + mode_t mode; /* file stat.st_mode */ + uid_t uid; /* file stat.st_uid */ struct list entry; /* entry in global change notifications list */ unsigned int filter; /* notification filter */ int notified; /* SIGIO counter */ @@ -157,6 +161,9 @@ struct dir }; static struct fd *dir_get_fd( struct object *obj ); +static struct security_descriptor *dir_get_sd( struct object *obj ); +static int dir_set_sd( struct object *obj, const struct security_descriptor *sd, + unsigned int set_info ); static void dir_dump( struct object *obj, int verbose ); static void dir_destroy( struct object *obj ); @@ -172,8 +179,8 @@ static const struct object_ops dir_ops = no_signal, /* signal */ dir_get_fd, /* get_fd */ default_fd_map_access, /* map_access */ - default_get_sd, /* get_sd */ - default_set_sd, /* set_sd */ + dir_get_sd, /* get_sd */ + dir_set_sd, /* set_sd */ no_lookup_name, /* lookup_name */ no_open_file, /* open_file */ fd_close_handle, /* close_handle */ @@ -291,6 +298,94 @@ static struct fd *dir_get_fd( struct object *obj ) return (struct fd *)grab_object( dir->fd ); } +static int get_dir_unix_fd( struct dir *dir ) +{ + return get_unix_fd( dir->fd ); +} + +static struct security_descriptor *dir_get_sd( struct object *obj ) +{ + struct dir *dir = (struct dir *)obj; + int unix_fd; + struct stat st; + struct security_descriptor *sd; + assert( obj->ops == &dir_ops ); + + unix_fd = get_dir_unix_fd( dir ); + + if (unix_fd == -1 || fstat( unix_fd, &st ) == -1) + return obj->sd; + + /* mode and uid the same? if so, no need to re-generate security descriptor */ + if (obj->sd && + (st.st_mode & (S_IRWXU|S_IRWXO)) == (dir->mode & (S_IRWXU|S_IRWXO)) && + (st.st_uid == dir->uid)) + return obj->sd; + + sd = mode_to_sd( st.st_mode, + security_unix_uid_to_sid( st.st_uid ), + token_get_primary_group( current->process->token )); + if (!sd) return obj->sd; + + dir->mode = st.st_mode; + dir->uid = st.st_uid; + free( obj->sd ); + obj->sd = sd; + return sd; +} + +static int dir_set_sd( struct object *obj, const struct security_descriptor *sd, + unsigned int set_info ) +{ + struct dir *dir = (struct dir *)obj; + const SID *owner; + mode_t mode; + int unix_fd; + + assert( obj->ops == &dir_ops ); + + unix_fd = get_dir_unix_fd( dir ); + + if (unix_fd == -1) return 1; + + if (set_info & OWNER_SECURITY_INFORMATION) + { + owner = sd_get_owner( sd ); + if (!owner) + { + set_error( STATUS_INVALID_SECURITY_DESCR ); + return 0; + } + if (!obj->sd || !security_equal_sid( owner, sd_get_owner( obj->sd ) )) + { + /* FIXME: get Unix uid and call fchown */ + } + } + else if (obj->sd) + owner = sd_get_owner( obj->sd ); + else + owner = token_get_user( current->process->token ); + + if (set_info & DACL_SECURITY_INFORMATION) + { + /* keep the bits that we don't map to access rights in the ACL */ + mode = dir->mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXG); + mode |= sd_to_mode( sd, owner ); + + if (dir->mode != mode) + { + if (fchmod( unix_fd, mode ) == -1) + { + file_set_error(); + return 0; + } + + dir->mode = mode; + } + } + return 1; +} + static struct change_record *get_first_change_record( struct dir *dir ) { struct list *ptr = list_head( &dir->change_records );
1
0
0
0
Paul Bryan Roberts : server: Refactor server side implementation of GetFileSecurity().
by Alexandre Julliard
07 Nov '08
07 Nov '08
Module: wine Branch: master Commit: d87af3dfb23dcb016a9eeaf6266d7f81976655b6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d87af3dfb23dcb016a9eeaf62…
Author: Paul Bryan Roberts <pbronline-wine(a)yahoo.co.uk> Date: Mon Nov 3 22:25:37 2008 +0000 server: Refactor server side implementation of GetFileSecurity(). --- server/file.c | 102 +++++++++++++++++++++++++++++--------------------------- server/file.h | 2 + 2 files changed, 55 insertions(+), 49 deletions(-) diff --git a/server/file.c b/server/file.c index 5224e85..dc93b4b 100644 --- a/server/file.c +++ b/server/file.c @@ -75,7 +75,6 @@ static void file_destroy( struct object *obj ); static int file_get_poll_events( struct fd *fd ); static void file_flush( struct fd *fd, struct event **event ); static enum server_fd_type file_get_fd_type( struct fd *fd ); -static mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner ); static const struct object_ops file_ops = { @@ -291,14 +290,9 @@ static unsigned int generic_file_map_access( unsigned int access ) return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); } -static struct security_descriptor *file_get_sd( struct object *obj ) +struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID *group ) { - struct file *file = (struct file *)obj; - struct stat st; - int unix_fd; struct security_descriptor *sd; - const SID *user; - const SID *group; size_t dacl_size; ACE_HEADER *current_ace; ACCESS_ALLOWED_ACE *aaa; @@ -308,34 +302,17 @@ static struct security_descriptor *file_get_sd( struct object *obj ) const SID *world_sid = security_world_sid; const SID *local_system_sid = security_local_system_sid; - assert( obj->ops == &file_ops ); - - unix_fd = get_file_unix_fd( file ); - - if (unix_fd == -1) return obj->sd; - - if (fstat( unix_fd, &st ) == -1) - return obj->sd; - - /* mode and uid the same? if so, no need to re-generate security descriptor */ - if (obj->sd && (st.st_mode & (S_IRWXU|S_IRWXO)) == (file->mode & (S_IRWXU|S_IRWXO)) && - (st.st_uid == file->uid)) - return obj->sd; - - user = security_unix_uid_to_sid( st.st_uid ); - group = token_get_primary_group( current->process->token ); - dacl_size = sizeof(ACL) + FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + FIELD_OFFSET(SID, SubAuthority[local_system_sid->SubAuthorityCount]); - if (st.st_mode & S_IRWXU) + if (mode & S_IRWXU) dacl_size += FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + FIELD_OFFSET(SID, SubAuthority[user->SubAuthorityCount]); - if ((!(st.st_mode & S_IRUSR) && (st.st_mode & (S_IRGRP|S_IROTH))) || - (!(st.st_mode & S_IWUSR) && (st.st_mode & (S_IWGRP|S_IWOTH))) || - (!(st.st_mode & S_IXUSR) && (st.st_mode & (S_IXGRP|S_IXOTH)))) + if ((!(mode & S_IRUSR) && (mode & (S_IRGRP|S_IROTH))) || + (!(mode & S_IWUSR) && (mode & (S_IWGRP|S_IWOTH))) || + (!(mode & S_IXUSR) && (mode & (S_IXGRP|S_IXOTH)))) dacl_size += FIELD_OFFSET(ACCESS_DENIED_ACE, SidStart) + FIELD_OFFSET(SID, SubAuthority[user->SubAuthorityCount]); - if (st.st_mode & S_IRWXO) + if (mode & S_IRWXO) dacl_size += FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + FIELD_OFFSET(SID, SubAuthority[world_sid->SubAuthorityCount]); @@ -343,7 +320,7 @@ static struct security_descriptor *file_get_sd( struct object *obj ) FIELD_OFFSET(SID, SubAuthority[user->SubAuthorityCount]) + FIELD_OFFSET(SID, SubAuthority[group->SubAuthorityCount]) + dacl_size ); - if (!sd) return obj->sd; + if (!sd) return sd; sd->control = SE_DACL_PRESENT; sd->owner_len = FIELD_OFFSET(SID, SubAuthority[user->SubAuthorityCount]); @@ -361,10 +338,10 @@ static struct security_descriptor *file_get_sd( struct object *obj ) dacl->AclRevision = ACL_REVISION; dacl->Sbz1 = 0; dacl->AclSize = dacl_size; - dacl->AceCount = 1 + (st.st_mode & S_IRWXU ? 1 : 0) + (st.st_mode & S_IRWXO ? 1 : 0); - if ((!(st.st_mode & S_IRUSR) && (st.st_mode & (S_IRGRP|S_IROTH))) || - (!(st.st_mode & S_IWUSR) && (st.st_mode & (S_IWGRP|S_IWOTH))) || - (!(st.st_mode & S_IXUSR) && (st.st_mode & (S_IXGRP|S_IXOTH)))) + dacl->AceCount = 1 + (mode & S_IRWXU ? 1 : 0) + (mode & S_IRWXO ? 1 : 0); + if ((!(mode & S_IRUSR) && (mode & (S_IRGRP|S_IROTH))) || + (!(mode & S_IWUSR) && (mode & (S_IWGRP|S_IWOTH))) || + (!(mode & S_IXUSR) && (mode & (S_IXGRP|S_IXOTH)))) dacl->AceCount++; dacl->Sbz2 = 0; @@ -379,7 +356,7 @@ static struct security_descriptor *file_get_sd( struct object *obj ) sid = (SID *)&aaa->SidStart; memcpy( sid, local_system_sid, FIELD_OFFSET(SID, SubAuthority[local_system_sid->SubAuthorityCount]) ); - if (st.st_mode & S_IRWXU) + if (mode & S_IRWXU) { /* appropriate access rights for the user */ aaa = (ACCESS_ALLOWED_ACE *)ace_next( current_ace ); @@ -389,18 +366,18 @@ static struct security_descriptor *file_get_sd( struct object *obj ) aaa->Header.AceSize = FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + FIELD_OFFSET(SID, SubAuthority[user->SubAuthorityCount]); aaa->Mask = WRITE_DAC | WRITE_OWNER; - if (st.st_mode & S_IRUSR) + if (mode & S_IRUSR) aaa->Mask |= FILE_GENERIC_READ; - if (st.st_mode & S_IWUSR) + if (mode & S_IWUSR) aaa->Mask |= FILE_GENERIC_WRITE | DELETE; - if (st.st_mode & S_IXUSR) + if (mode & S_IXUSR) aaa->Mask |= FILE_GENERIC_EXECUTE; sid = (SID *)&aaa->SidStart; memcpy( sid, user, FIELD_OFFSET(SID, SubAuthority[user->SubAuthorityCount]) ); } - if ((!(st.st_mode & S_IRUSR) && (st.st_mode & (S_IRGRP|S_IROTH))) || - (!(st.st_mode & S_IWUSR) && (st.st_mode & (S_IWGRP|S_IWOTH))) || - (!(st.st_mode & S_IXUSR) && (st.st_mode & (S_IXGRP|S_IXOTH)))) + if ((!(mode & S_IRUSR) && (mode & (S_IRGRP|S_IROTH))) || + (!(mode & S_IWUSR) && (mode & (S_IWGRP|S_IWOTH))) || + (!(mode & S_IXUSR) && (mode & (S_IXGRP|S_IXOTH)))) { /* deny just in case the user is a member of the group */ ACCESS_DENIED_ACE *ada = (ACCESS_DENIED_ACE *)ace_next( current_ace ); @@ -410,17 +387,17 @@ static struct security_descriptor *file_get_sd( struct object *obj ) ada->Header.AceSize = FIELD_OFFSET(ACCESS_DENIED_ACE, SidStart) + FIELD_OFFSET(SID, SubAuthority[user->SubAuthorityCount]); ada->Mask = 0; - if (!(st.st_mode & S_IRUSR) && (st.st_mode & (S_IRGRP|S_IROTH))) + if (!(mode & S_IRUSR) && (mode & (S_IRGRP|S_IROTH))) ada->Mask |= FILE_GENERIC_READ; - if (!(st.st_mode & S_IWUSR) && (st.st_mode & (S_IWGRP|S_IROTH))) + if (!(mode & S_IWUSR) && (mode & (S_IWGRP|S_IROTH))) ada->Mask |= FILE_GENERIC_WRITE | DELETE; - if (!(st.st_mode & S_IXUSR) && (st.st_mode & (S_IXGRP|S_IXOTH))) + if (!(mode & S_IXUSR) && (mode & (S_IXGRP|S_IXOTH))) ada->Mask |= FILE_GENERIC_EXECUTE; ada->Mask &= ~STANDARD_RIGHTS_ALL; /* never deny standard rights */ sid = (SID *)&ada->SidStart; memcpy( sid, user, FIELD_OFFSET(SID, SubAuthority[user->SubAuthorityCount]) ); } - if (st.st_mode & S_IRWXO) + if (mode & S_IRWXO) { /* appropriate access rights for Everyone */ aaa = (ACCESS_ALLOWED_ACE *)ace_next( current_ace ); @@ -430,16 +407,43 @@ static struct security_descriptor *file_get_sd( struct object *obj ) aaa->Header.AceSize = FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + FIELD_OFFSET(SID, SubAuthority[world_sid->SubAuthorityCount]); aaa->Mask = 0; - if (st.st_mode & S_IROTH) + if (mode & S_IROTH) aaa->Mask |= FILE_GENERIC_READ; - if (st.st_mode & S_IWOTH) + if (mode & S_IWOTH) aaa->Mask |= FILE_GENERIC_WRITE | DELETE; - if (st.st_mode & S_IXOTH) + if (mode & S_IXOTH) aaa->Mask |= FILE_GENERIC_EXECUTE; sid = (SID *)&aaa->SidStart; memcpy( sid, world_sid, FIELD_OFFSET(SID, SubAuthority[world_sid->SubAuthorityCount]) ); } + return sd; +} + +static struct security_descriptor *file_get_sd( struct object *obj ) +{ + struct file *file = (struct file *)obj; + struct stat st; + int unix_fd; + struct security_descriptor *sd; + + assert( obj->ops == &file_ops ); + + unix_fd = get_file_unix_fd( file ); + + if (unix_fd == -1 || fstat( unix_fd, &st ) == -1) + return obj->sd; + + /* mode and uid the same? if so, no need to re-generate security descriptor */ + if (obj->sd && (st.st_mode & (S_IRWXU|S_IRWXO)) == (file->mode & (S_IRWXU|S_IRWXO)) && + (st.st_uid == file->uid)) + return obj->sd; + + sd = mode_to_sd( st.st_mode, + security_unix_uid_to_sid( st.st_uid ), + token_get_primary_group( current->process->token )); + if (!sd) return obj->sd; + file->mode = st.st_mode; file->uid = st.st_uid; free( obj->sd ); @@ -447,7 +451,7 @@ static struct security_descriptor *file_get_sd( struct object *obj ) return sd; } -static mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner ) +mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner ) { mode_t new_mode = 0; mode_t denied_mode = 0; diff --git a/server/file.h b/server/file.h index 26d1702..2d1d047 100644 --- a/server/file.h +++ b/server/file.h @@ -112,6 +112,8 @@ extern struct file *grab_file_unless_removable( struct file *file ); extern int grow_file( struct file *file, file_pos_t size ); extern struct file *create_temp_file( int access ); extern void file_set_error(void); +extern struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID *group ); +extern mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner ); /* change notification functions */
1
0
0
0
Paul Bryan Roberts : advapi32: Add TRACE to GetFileSecurity().
by Alexandre Julliard
07 Nov '08
07 Nov '08
Module: wine Branch: master Commit: 27037218604d3846c853bb36ded2213c208eea3b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=27037218604d3846c853bb36d…
Author: Paul Bryan Roberts <pbronline-wine(a)yahoo.co.uk> Date: Mon Nov 3 20:42:45 2008 +0000 advapi32: Add TRACE to GetFileSecurity(). --- dlls/advapi32/security.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index f57136d..67c410f 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -1915,6 +1915,10 @@ GetFileSecurityW( LPCWSTR lpFileName, NTSTATUS status; DWORD access = 0; + TRACE("(%s,%d,%p,%d,%p)\n", debugstr_w(lpFileName), + RequestedInformation, pSecurityDescriptor, + nLength, lpnLengthNeeded); + if (RequestedInformation & (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION| DACL_SECURITY_INFORMATION)) access |= READ_CONTROL;
1
0
0
0
Paul Bryan Roberts : advapi32/tests: Simple tests of GetFileSecurity()/ SetFileSecurity().
by Alexandre Julliard
07 Nov '08
07 Nov '08
Module: wine Branch: master Commit: fa9c9f0e4c052bbf1d828dd053b1a1a4d29400c6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fa9c9f0e4c052bbf1d828dd05…
Author: Paul Bryan Roberts <pbronline-wine(a)yahoo.co.uk> Date: Wed Nov 5 07:01:46 2008 +0000 advapi32/tests: Simple tests of GetFileSecurity()/SetFileSecurity(). --- dlls/advapi32/tests/security.c | 105 +++++++++++++++++++++++++++++++++------- 1 files changed, 88 insertions(+), 17 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index db955cd..d3efa0b 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -87,6 +87,8 @@ static BOOL (WINAPI *pConvertSecurityDescriptorToStringSecurityDescriptorA)(PSEC SECURITY_INFORMATION, LPSTR *, PULONG ); typedef BOOL (WINAPI *fnGetFileSecurityA)(LPCSTR, SECURITY_INFORMATION, PSECURITY_DESCRIPTOR, DWORD, LPDWORD); +typedef BOOL (WINAPI *fnSetFileSecurityA)(LPCSTR, SECURITY_INFORMATION, + PSECURITY_DESCRIPTOR); static DWORD (WINAPI *pGetNamedSecurityInfoA)(LPSTR, SE_OBJECT_TYPE, SECURITY_INFORMATION, PSID*, PSID*, PACL*, PACL*, PSECURITY_DESCRIPTOR*); @@ -119,6 +121,7 @@ fnMakeSelfRelativeSD pMakeSelfRelativeSD; fnConvertSidToStringSidA pConvertSidToStringSidA; fnConvertStringSidToSidA pConvertStringSidToSidA; fnGetFileSecurityA pGetFileSecurityA; +fnSetFileSecurityA pSetFileSecurityA; fnRtlAdjustPrivilege pRtlAdjustPrivilege; fnCreateWellKnownSid pCreateWellKnownSid; fnDuplicateTokenEx pDuplicateTokenEx; @@ -150,6 +153,8 @@ static void init(void) (void *)GetProcAddress(hmod, "ConvertStringSecurityDescriptorToSecurityDescriptorW" ); pConvertSecurityDescriptorToStringSecurityDescriptorA = (void *)GetProcAddress(hmod, "ConvertSecurityDescriptorToStringSecurityDescriptorA" ); + pGetFileSecurityA = (fnGetFileSecurityA)GetProcAddress(hmod, "GetFileSecurityA" ); + pSetFileSecurityA = (fnSetFileSecurityA)GetProcAddress(hmod, "SetFileSecurityA" ); pCreateWellKnownSid = (fnCreateWellKnownSid)GetProcAddress( hmod, "CreateWellKnownSid" ); pGetNamedSecurityInfoA = (void *)GetProcAddress(hmod, "GetNamedSecurityInfoA"); pMakeSelfRelativeSD = (void *)GetProcAddress(hmod, "MakeSelfRelativeSD"); @@ -694,29 +699,95 @@ static void test_luid(void) static void test_FileSecurity(void) { - char directory[MAX_PATH]; - DWORD retval, outSize; - BOOL result; - BYTE buffer[0x40]; - - pGetFileSecurityA = (fnGetFileSecurityA) - GetProcAddress( hmod, "GetFileSecurityA" ); - if( !pGetFileSecurityA ) + char wintmpdir [MAX_PATH]; + char path [MAX_PATH]; + char file [MAX_PATH]; + BOOL rc; + HANDLE fh; + DWORD sdSize; + DWORD retSize; + BYTE *sd; + SECURITY_INFORMATION const request = OWNER_SECURITY_INFORMATION + | GROUP_SECURITY_INFORMATION + | DACL_SECURITY_INFORMATION; + + if (!pGetFileSecurityA) { + win_skip ("GetFileSecurity is not available\n"); return; + } - retval = GetTempPathA(sizeof(directory), directory); - if (!retval) { - trace("GetTempPathA failed\n"); + if (!pSetFileSecurityA) { + win_skip ("SetFileSecurity is not available\n"); return; } - strcpy(directory, "\\Should not exist"); + if (!GetTempPathA (sizeof (wintmpdir), wintmpdir)) { + win_skip ("GetTempPathA failed\n"); + return; + } - SetLastError(NO_ERROR); - result = pGetFileSecurityA( directory,OWNER_SECURITY_INFORMATION,buffer,0x40,&outSize); - ok(!result, "GetFileSecurityA should fail for not existing directories/files\n"); - ok( (GetLastError() == ERROR_FILE_NOT_FOUND ) || - (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) , + /* Create a temporary directory and in it a temporary file */ + strcat (strcpy (path, wintmpdir), "rary"); + SetLastError (NO_ERROR); + rc = CreateDirectoryA (path, NULL); + ok (rc || GetLastError() == ERROR_ALREADY_EXISTS, "CreateDirectoryA " + "failed for '%s' with %d\n", path, GetLastError()); + + strcat (strcpy (file, path), "\\ess"); + SetLastError (NO_ERROR); + fh = CreateFileA (file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); + ok (fh != INVALID_HANDLE_VALUE, "CreateFileA " + "failed for '%s' with %d\n", file, GetLastError()); + CloseHandle (fh); + + /* For the temporary file ... */ + + /* Get size needed */ + retSize = 0; + SetLastError (NO_ERROR); + rc = pGetFileSecurityA (file, request, NULL, 0, &retSize); + ok (!rc, "GetFileSecurityA " + "was expected to fail for '%s'\n", file); + ok (GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetFileSecurityA " + "returned %d; expected ERROR_INSUFFICIENT_BUFFER\n", GetLastError()); + ok (retSize > sizeof (SECURITY_DESCRIPTOR), "GetFileSecurityA " + "returned size %d; expected > %d\n", retSize, sizeof (SECURITY_DESCRIPTOR)); + + sdSize = retSize; + sd = HeapAlloc (GetProcessHeap (), 0, sdSize); + + /* Get security descriptor for real */ + retSize = 0; + SetLastError (NO_ERROR); + rc = pGetFileSecurityA (file, request, sd, sdSize, &retSize); + ok (rc, "GetFileSecurityA " + "was not expected to fail '%s'\n", file); + ok (GetLastError () == NO_ERROR, "GetFileSecurityA " + "returned %d; expected NO_ERROR\n", GetLastError ()); + ok (retSize == sdSize, "GetFileSecurityA " + "returned size %d; expected %d\n", retSize, sdSize); + + /* Use it to set security descriptor */ + SetLastError (NO_ERROR); + rc = pSetFileSecurityA (file, request, sd); + ok (rc, "SetFileSecurityA " + "was not expected to fail '%s'\n", file); + ok (GetLastError () == NO_ERROR, "SetFileSecurityA " + "returned %d; expected NO_ERROR\n", GetLastError ()); + + HeapFree (GetProcessHeap (), 0, sd); + + /* Remove temporary file and directory */ + DeleteFileA (file); + RemoveDirectoryA (path); + + /* Old test */ + strcpy (wintmpdir, "\\Should not exist"); + SetLastError (NO_ERROR); + rc = pGetFileSecurityA (wintmpdir, OWNER_SECURITY_INFORMATION, NULL, 0, &sdSize); + ok (!rc, "GetFileSecurityA should fail for not existing directories/files\n"); + ok ((GetLastError() == ERROR_FILE_NOT_FOUND ) || + (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), "last error ERROR_FILE_NOT_FOUND / ERROR_CALL_NOT_IMPLEMENTED (98) " "expected, got %d\n", GetLastError()); }
1
0
0
0
← Newer
1
...
53
54
55
56
57
58
59
...
74
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Results per page:
10
25
50
100
200