in vfs-close, thee fsp->fsp_name field is empty, so, if i want to get the name of the file that was closed, i had to add extra data to the fsp on the web i see a lot of examples where fsp->fsp_name is used for getting the filename i only used samba 3.4 did not try it on other versions
I don't see how the fsp->fsp_name can be empty when vfs_close is called. fsp->fsp_name is not cleared until the file struct is talloc freed. Can you show me a backtrace with this occurring ? Jeremy.
Created attachment 4886 [details] extract from messages -> null pointer
Created attachment 4887 [details] the source file of the vfs module
I am going to see if I can reproduce this inside vfs_smb_traffic_analyzer.
fsp->fsp_name is a struct smb_filename. /* * smb_filename */ struct smb_filename { char *base_name; char *stream_name; char *original_lcomp; SMB_STRUCT_STAT st; }; If you intend to get the filename, you then use fsp->fsp_fname->base_name It works for my close VFS operation in smb_traffic_analyzer.
I am resolving this as WORKSFORME, feel free to reopen the bug if you think different.
I encountered this problem on samba 3.5. My vfs module got 0 or 0x10000 in fsp_name field in files_struct in close_fn handler. I found that the problem appears when i use my module with samba built with --with-cluster-support=yes and module is built with samba sources configured to disable cluster support. smb_filename offset depends on cluster support enabling: typedef struct files_struct { ................. struct lock_struct last_lock_failure ................. struct smb_filename *fsp_name; ................. } files_struct; struct lock_struct { struct lock_context context; ............ }; struct lock_context { uint32 smbpid; uint16 tid; struct server_id pid; }; struct server_id { pid_t pid; #ifdef CLUSTER_SUPPORT uint32 vnn; #endif }; It is not good for distributing compiled modules that samba VFS API can be different for one SMB_VFS_INTERFACE_VERSION.
Yes, this is a valid complaint. I'll look into removing this problem. Jeremy.