Alexandre Julliard : server: Allow the object attributes to be omitted in requests.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jan 15 10:48:55 CST 2016
Module: wine
Branch: master
Commit: 4c763a41ee0915d33398f7244952e5fff0c758b9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4c763a41ee0915d33398f7244952e5fff0c758b9
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Jan 15 18:25:58 2016 +0900
server: Allow the object attributes to be omitted in requests.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/sync.c | 8 +-------
include/wine/server_protocol.h | 2 +-
server/request.c | 8 ++++++++
server/trace.c | 22 +++++++++++++---------
4 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index bbbcfba..36a9c86 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -86,13 +86,7 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a
*ret = NULL;
*ret_len = 0;
- if (!attr)
- {
- *ret = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
- if (!*ret) return STATUS_NO_MEMORY;
- *ret_len = len;
- return STATUS_SUCCESS;
- }
+ if (!attr) return STATUS_SUCCESS;
if ((sd = attr->SecurityDescriptor))
{
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 65f0536..8dd4994 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -6171,6 +6171,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
-#define SERVER_PROTOCOL_VERSION 493
+#define SERVER_PROTOCOL_VERSION 494
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/request.c b/server/request.c
index 7b7d8b1..2debf6d 100644
--- a/server/request.c
+++ b/server/request.c
@@ -169,9 +169,17 @@ void *set_reply_data_size( data_size_t size )
const struct object_attributes *get_req_object_attributes( const struct security_descriptor **sd,
struct unicode_str *name )
{
+ static const struct object_attributes empty_attributes;
const struct object_attributes *attr = get_req_data();
data_size_t size = get_req_data_size();
+ if (!size)
+ {
+ *sd = NULL;
+ name->len = 0;
+ return &empty_attributes;
+ }
+
if ((size < sizeof(*attr)) || (size - sizeof(*attr) < attr->sd_len) ||
(size - sizeof(*attr) - attr->sd_len < attr->name_len))
{
diff --git a/server/trace.c b/server/trace.c
index e02b8c3..edfcaf5 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1074,20 +1074,27 @@ static void dump_varargs_object_attributes( const char *prefix, data_size_t size
const struct object_attributes *objattr = cur_data;
fprintf( stderr,"%s{", prefix );
- if (size >= sizeof(struct object_attributes))
+ if (size)
{
const WCHAR *str;
- fprintf( stderr, "rootdir=%04x,attributes=%08x", objattr->rootdir, objattr->attributes );
- if (objattr->sd_len > size - sizeof(*objattr) ||
- objattr->name_len > size - sizeof(*objattr) - objattr->sd_len)
+
+ if (size < sizeof(*objattr) ||
+ (size - sizeof(*objattr) < objattr->sd_len) ||
+ (size - sizeof(*objattr) - objattr->sd_len < objattr->name_len))
+ {
+ fprintf( stderr, "***invalid***}" );
+ remove_data( size );
return;
+ }
+
+ fprintf( stderr, "rootdir=%04x,attributes=%08x", objattr->rootdir, objattr->attributes );
dump_inline_security_descriptor( ",sd=", (const struct security_descriptor *)(objattr + 1), objattr->sd_len );
str = (const WCHAR *)objattr + (sizeof(*objattr) + objattr->sd_len) / sizeof(WCHAR);
fprintf( stderr, ",name=L\"" );
dump_strW( str, objattr->name_len / sizeof(WCHAR), stderr, "\"\"" );
fputc( '\"', stderr );
remove_data( ((sizeof(*objattr) + objattr->sd_len) / sizeof(WCHAR)) * sizeof(WCHAR) +
- objattr->name_len );
+ (objattr->name_len / sizeof(WCHAR)) * sizeof(WCHAR) );
}
fputc( '}', stderr );
}
@@ -3928,10 +3935,7 @@ static void dump_get_directory_entry_reply( const struct get_directory_entry_rep
static void dump_create_symlink_request( const struct create_symlink_request *req )
{
fprintf( stderr, " access=%08x", req->access );
- fprintf( stderr, ", attributes=%08x", req->attributes );
- fprintf( stderr, ", rootdir=%04x", req->rootdir );
- fprintf( stderr, ", name_len=%u", req->name_len );
- dump_varargs_unicode_str( ", name=", min(cur_size,req->name_len) );
+ dump_varargs_object_attributes( ", objattr=", cur_size );
dump_varargs_unicode_str( ", target_name=", cur_size );
}
More information about the wine-cvs
mailing list