Bug 665 - Bug in Samba v2.2.8a with Windows API GetFileAttributes ?
Bug in Samba v2.2.8a with Windows API GetFileAttributes ?
Status: CLOSED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: smbclient
3.0.0
All Solaris
: P2 normal
: none
Assigned To: Jeremy Allison
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2003-10-21 10:38 UTC by Bill Smith
Modified: 2005-11-14 09:30 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Smith 2003-10-21 10:38:30 UTC
I had this bug filed as 27096 in the old bug tracking system.  It looks like 
you switched to a new system so I'm refiling this bug.

Before my company was bought out by another company, we were using Samba
v1.9.3 and I'm pretty certain that the GetFileAttributes was working
properly but I can't be absolutely sure. Since the move, we're using v2.2.5
and just recently upgraded to v2.2.8a on Solaris 2.7.  I'm doing my testing
on an XP machine.

I'm seeing that GetFileAttributes is always returning 0 instead of a hex
value for any valid file pathname accessed via the samba server.  If I
access the same file locally or via another NT server, I get valid results:

Accessign a file locally:

D:\temp>test d:\temp\wyb.zip
 SUCCESS: pathname [d:\temp\wyb.zip] is a file! rc=2820

Accessing a file on an NT server:

D:\temp>test \\absolut\home\b\bsmith\xmas01.xls
 SUCCESS: pathname [\\absolut\home\b\bsmith\xmas01.xls] is a file! rc=20

Accessing a file via a solaris samba server

D:\temp>test \\crystal\h\crystal\16\du-crystal16
 FAILURE: pathname [\\crystal\h\crystal\16\du-crystal16] is not a file! rc=0

D:\temp>ls -al \\crystal\h\crystal\16\du-crystal16
-rwxrwxrwx   1 CRYSTAL\root    CRYSTAL\other    991546 Apr 10 02:34
\\crystal\h\
crystal\16\du-crystal16


Here the test program that I used with VC++ 6.0:

#include <windows.h>
#include <iostream.h>

int main (int argc, char** argv) {

  if (argc != 2) {
    cout << "Usage: test <pathname>" << endl;
    return 1;
  }

  const char* pn = argv[1];

  DWORD rc = GetFileAttributes(pn);
  if (0xFFFFFFFF != rc &&
      (rc &
(FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY)) &&
      !(rc & (FILE_ATTRIBUTE_DIRECTORY)))
    {
      cout << " SUCCESS: pathname [" << pn << "] is a file! rc=" << hex <<
rc << endl;
      return 0;
    }
  else {
    cout << " FAILURE: pathname [" << pn << "] is not a file! rc=" << hex <<
rc << endl;
    return 1;
  }
}

Thanks in advance for any advice or suggestions.

--Bill Smith
Comment 1 Gerald (Jerry) Carter 2004-02-17 08:53:24 UTC
moving to 3.0
Comment 2 Gerald (Jerry) Carter 2004-03-03 10:33:26 UTC
This looks like it would be up your alley Jeremy.  Might not be an 
issue in 3.0 though.  I'll let you decide.
Comment 3 Jeremy Allison 2004-03-03 16:41:38 UTC
Fixed in SAMBA_3_0 CVS (Can't reproduce).
Jeremy.
Comment 4 Gerald (Jerry) Carter 2005-08-24 10:27:27 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.
Comment 5 Gerald (Jerry) Carter 2005-11-14 09:30:55 UTC
database cleanup