Help - Search - Members - Calendar
Full Version: Pmview And Samba Plugin
PMView Pro Forums > PMView Pro Discussion > PMView - OS/2 Technical Support
psmedley
Hi Peter,

I notice the following in the release notes for v3.52:
"Problem with Icon Thumbnail (EA) creation on Samba drive: The Samba file system driver does not handle requests for EA data correctly. When PMView checks if a file has an Icon Thumbnail (Icon EA) attached, it uses a small buffer big enough only to hold the EA data length information. The Samba driver ignores the limited buffer size and if EA data exists, it will overwrite PMView's memory buffer which in turn results in PMView crashing. PMView v3.52 uses a full 64kB buffer (maximum possible EA data) to prevent this from happening"

Can you give me any more details that would help me fix the problems in the Samba plugin?

Thanks,

Paul.
Peter
THE PROBLEM
-----------
The problem reported to me:

"Recently I got my first NAS (Qnap). Most NAS servers don't support EAs at
all, you can't even use the OS/2 WPS filesystem browser because of this.
But because my NAS provides telnet access, I was able to manually activate
EA support in Samba and the file system (ext3 on embedded Linux).
Unfortunately ext3 only supports up to 4KB EAs per file. And here the
problem starts. In PMView Pro 3.51 I had the option enabled that
thumbnails are automatically created. Once I open the file open window,
PMView crashes."
... later more important info ...
"The steps to reproduce problem in PMView: 1. Remove EAs from the image
file. 2. Start PMView and show open dialog. 3. Popup-Menu
Icon-Thumnail->Create. EAs are written OK. 4. Repeat 3. Then it crashes."
... and more important info ...
"I don't use the Netdrive Samba-Plugin (3.0.31) but standard IBM LAN
Requester (eCS) because it is much faster. But I took the task and I tried
the same thing with Netdrive-Plugin. There seems to be no problem, the EAs
are written just fine. So it seems to be related to the IBM LAN Requester
filesystem driver."

Hopefully this lets you figure out what system setup is needed to see the
problem. (I never tried to set up my system this way, and I have not
repeated the problem here).

THE REASON
----------
The cause of the problem is that DosQueryFileInfo/FIL_QUERYEASFROMLIST is
showing an anomaly in the previously described file system setup.
According to the API documentation for DosQueryFileInfo, the function
should never write more data to the eaop.fpFEA2List buffer than what is
specified in eaop.fpFEA2List->cbList. If more data than
eaop.fpFEA2List->cbList is available, the function should write
eaop.fpFEA2List->cbList bytes and then return ERROR_BUFFER_OVERFLOW to
indicate that the buffer was not large enough to hold all data available.

This is what happened in PMView: If a file did *not* have an EA Thumbnail
(EA Icon), the call to DosQueryFileInfo went fine (because there was no
data to return in the buffer). However, once an EA Icon (EA Thumbnail) was
created, DosQueryFileInfo in the function "HasFileThumbnail" (see code
below) wrote more data than allowed in aop.fpFEA2List->cbList and trashed
the buffer.

Attached is the old code that I had in PMView. It relies on that a call to
DosQueryFileInfo (hfile, FIL_QUERYEASFROMLIST, &eaop, sizeof (EAOP2))
never writes more data to eaop.fpFEA2List than what is speficied in
eaop.fpFEA2List->cbList. The regular OS/2 file system drivers all work
correctly in this regard.

SOLUTION
--------
The solution in PMView v3.52 is to always use 64kB for eaop.fpFEA2List.
Then it does not matter if all EA data is written or not.

Fixing the underlying OS/2 bug would of course be very nice...

Please e-mail me (peter at pmview.com) if you need more info.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2019 Invision Power Services, Inc.