Commit 4c763a41 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Allow the object attributes to be omitted in requests.

parent 9504e2ad
...@@ -86,13 +86,7 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a ...@@ -86,13 +86,7 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a
*ret = NULL; *ret = NULL;
*ret_len = 0; *ret_len = 0;
if (!attr) if (!attr) return STATUS_SUCCESS;
{
*ret = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
if (!*ret) return STATUS_NO_MEMORY;
*ret_len = len;
return STATUS_SUCCESS;
}
if ((sd = attr->SecurityDescriptor)) if ((sd = attr->SecurityDescriptor))
{ {
......
...@@ -6171,6 +6171,6 @@ union generic_reply ...@@ -6171,6 +6171,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply; struct terminate_job_reply terminate_job_reply;
}; };
#define SERVER_PROTOCOL_VERSION 493 #define SERVER_PROTOCOL_VERSION 494
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -169,9 +169,17 @@ void *set_reply_data_size( data_size_t size ) ...@@ -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, const struct object_attributes *get_req_object_attributes( const struct security_descriptor **sd,
struct unicode_str *name ) struct unicode_str *name )
{ {
static const struct object_attributes empty_attributes;
const struct object_attributes *attr = get_req_data(); const struct object_attributes *attr = get_req_data();
data_size_t size = get_req_data_size(); 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) || if ((size < sizeof(*attr)) || (size - sizeof(*attr) < attr->sd_len) ||
(size - sizeof(*attr) - attr->sd_len < attr->name_len)) (size - sizeof(*attr) - attr->sd_len < attr->name_len))
{ {
......
...@@ -1074,20 +1074,27 @@ static void dump_varargs_object_attributes( const char *prefix, data_size_t size ...@@ -1074,20 +1074,27 @@ static void dump_varargs_object_attributes( const char *prefix, data_size_t size
const struct object_attributes *objattr = cur_data; const struct object_attributes *objattr = cur_data;
fprintf( stderr,"%s{", prefix ); fprintf( stderr,"%s{", prefix );
if (size >= sizeof(struct object_attributes)) if (size)
{ {
const WCHAR *str; const WCHAR *str;
fprintf( stderr, "rootdir=%04x,attributes=%08x", objattr->rootdir, objattr->attributes );
if (objattr->sd_len > size - sizeof(*objattr) || if (size < sizeof(*objattr) ||
objattr->name_len > size - sizeof(*objattr) - objattr->sd_len) (size - sizeof(*objattr) < objattr->sd_len) ||
(size - sizeof(*objattr) - objattr->sd_len < objattr->name_len))
{
fprintf( stderr, "***invalid***}" );
remove_data( size );
return; 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 ); 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); str = (const WCHAR *)objattr + (sizeof(*objattr) + objattr->sd_len) / sizeof(WCHAR);
fprintf( stderr, ",name=L\"" ); fprintf( stderr, ",name=L\"" );
dump_strW( str, objattr->name_len / sizeof(WCHAR), stderr, "\"\"" ); dump_strW( str, objattr->name_len / sizeof(WCHAR), stderr, "\"\"" );
fputc( '\"', stderr ); fputc( '\"', stderr );
remove_data( ((sizeof(*objattr) + objattr->sd_len) / sizeof(WCHAR)) * sizeof(WCHAR) + remove_data( ((sizeof(*objattr) + objattr->sd_len) / sizeof(WCHAR)) * sizeof(WCHAR) +
objattr->name_len ); (objattr->name_len / sizeof(WCHAR)) * sizeof(WCHAR) );
} }
fputc( '}', stderr ); fputc( '}', stderr );
} }
...@@ -3928,10 +3935,7 @@ static void dump_get_directory_entry_reply( const struct get_directory_entry_rep ...@@ -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 ) static void dump_create_symlink_request( const struct create_symlink_request *req )
{ {
fprintf( stderr, " access=%08x", req->access ); fprintf( stderr, " access=%08x", req->access );
fprintf( stderr, ", attributes=%08x", req->attributes ); dump_varargs_object_attributes( ", objattr=", cur_size );
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_unicode_str( ", target_name=", cur_size ); dump_varargs_unicode_str( ", target_name=", cur_size );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment