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

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-01-15 18:25:58 +09:00
parent 9504e2addf
commit 4c763a41ee
4 changed files with 23 additions and 17 deletions

View File

@ -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))
{

View File

@ -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 */

View File

@ -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))
{

View File

@ -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 );
}