FreeRDP/FreeRDP — Issue #228: disk dr: IRP_MJ_DIRECTORY_CONTROL does not support wildcards
Author: atong-tcs
Created: 2011-11-25 16:29:12+00:00
State: open

The result is that disk_file_query_directory() will look at the wrong file (return wrong stat() information), or segfault (if it tells Windows that a file is a directory, then Windows later requests recursing into it).

Here's one scenario:
% mkdir /tmp/testdr; cd /tmp/testdr # create test directory
% mkdir a b c
% echo HELLO > test1.text
% echo FOOBAR > test2.text
% mkdir d e f

% xfreerdp --plugin rdpdr --data disk:tmp:/tmp -- <...>

Now open the redirected testdr folder with explorer. The items will show up with the correct stats, but when you right click a file and select properties, it will show the wrong info (eg. file size) or crash.

IRP_MJ_DIRECTORY_CONTROL is called with IRP_MN_QUERY_DIRECTORY & SL_RESTART_SCAN with IrpSp->Parameters.QueryDirectory.FileName. disk_file_query_directory() grabs information for the first file from readdir() but does not look at the filename, so it returns info for the wrong file.

The filename match for this test case should be easy; but to be correct it needs to support the Windows style wildcards mentioned here.

http://download.microsoft.com/download/4/3/8/43889780-8d45-4b2e-9d3a-c696a890309f/File%20System%20Behavior%20Overview.pdf