Making mknod work with the CIFS client.

Jeremy Allison jra at samba.org
Mon Jul 12 22:42:23 GMT 2004


Hi Steve,

	I've just committed some changes to make the SMB_SET_FILE_UNIX_BASIC
call working correctly for mknod again - I'm hoping to persuade Jerry to get
this into 3.0.5 official (it's fairly benign).

The only problem is that your client code doesn't set the file type
in the mknod call. The cifs_mknod() function calls down to 
CIFSSMBUnixSetPerms() which then calls the SMB_SET_FILE_UNIX_BASIC,
but never sets the __u32 Type field in the FILE_UNIX_BASIC_INFO
struct on the stack.

It needs to be set from mode field by splitting out the 
S_IFIFO, S_IFSOCK, S_IFCHR, S_IFBLK bits from the mode
and mapping them to the Samba constants in the type field :

#define UNIX_TYPE_CHARDEV 3
#define UNIX_TYPE_BLKDEV 4
#define UNIX_TYPE_FIFO 5
#define UNIX_TYPE_SOCKET 6

In addition, I've noticed a couple of calls to CIFSSMBUnixSetPerms()
with uid/gid pairs of the current client values, not -1. I think
all calls to SMB_SET_FILE_UNIX_BASIC should have uid/gid as -1
unless it's a chown call, as the server, not the client, determines
the uid/gid pairs to set on a file.

Jeremy.


More information about the samba-technical mailing list