[PATCH] for "testparm should check for invalid vfs objects"

Amit amitkuma at redhat.com
Tue Aug 28 05:13:48 UTC 2018


Dear Metze/volker,

Can you please look at the patch and suggest.

# cat /usr/local/samba/etc/smb.conf | grep vfs
    vfs objects = fruit1   23     worm2112
 # /usr/local/samba/bin/testparm
Load smb config files from /usr/local/samba/etc/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[myshare]"
Loaded services file OK.
Error loading module '/usr/local/samba/lib/vfs/fruit1.so':
/usr/local/samba/lib/vfs/fruit1.so: cannot open shared object file: No
such file or directory
WARNING: Wrong vfs module: fruit1

Error loading module '/usr/local/samba/lib/vfs/23.so':
/usr/local/samba/lib/vfs/23.so: cannot open shared object file: No such
file or directory
WARNING: Wrong vfs module: 23

Error loading module '/usr/local/samba/lib/vfs/worm2112.so':
/usr/local/samba/lib/vfs/worm2112.so: cannot open shared object file: No
such file or directory
WARNING: Wrong vfs module: worm2112

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions
^C
#

Thanks

Amit


On 08/27/2018 12:34 PM, Amit wrote:
>
> Hello All,
>
> New patch. PFA
>
> Thanks
> Amit
>
>
> On 08/21/2018 07:20 PM, Stefan Metzmacher wrote:
>> Hello Amit,
>>
>>> I tried using getting vfs_object list as done in smbd_vfs_init(), Since
>>> I donot have connection_struct i used #define GLOBAL_SECTION_SNUM    
>>> (-1). But values are not retrieved.
>> Testparm should have the snum for the section it is checking.
>> do_per_share_checks(int s), 's' is the one you need.
>>
>>>         int test = -1, o=0;
>>>         char **vfs_objects_test = lp_vfs_objects(test);
>>>         while(vfs_objects_test[o]){
>>>                 printf("vfs_objects_test=%s\n",vfs_objects_test[o]);
>>>                 o++;
>>>         }
>> Within the loop you need a logic like vfs_init_custom(), you need the
>> logic that converts the string 'vfs_object' into module_path and
>> module_name and then the following check:
>>
>>         entry = vfs_find_backend_entry(module_name);
>>         if (!entry) {
>>                 NTSTATUS status;
>>
>>                 status = smb_load_module("vfs", module_path);
>>                 if (!NT_STATUS_IS_OK(status)) {
>>                         DEBUG(0, ("error probing vfs module '%s': %s\n",
>>                                   module_path, nt_errstr(status)));
>>                         goto fail;
>>                 }
>>
>>                 entry = vfs_find_backend_entry(module_name);
>>                 if (!entry) {
>>                         DEBUG(0,("Can't find a vfs module
>> [%s]\n",vfs_object));
>>                         goto fail;
>>                 }
>>         }
>>
>>> Also have do we have any module extracted using 'waf' which can refereed
>>> as for reference.
>> It could get a list, but only with internal modules, at buildtime.
>>
>> If a packager moved some modules to separate rpm/deb packages and those
>> are not installed, the list would still be wrong.
>>
>> I hope that helps...
>>
>> metze
>
> -- 
> Thanks
> Amit Kumar
> !!If you stumble, get back up. 
> What happened yesterday, no longer matters.
> Today is another day to move closer to your GOAL!!

-- 
Thanks
Amit Kumar
!!If you stumble, get back up. 
What happened yesterday, no longer matters.
Today is another day to move closer to your GOAL!!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: invalid_vfs_object.patch
Type: text/x-patch
Size: 1444 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180828/9b6bcab7/invalid_vfs_object.bin>


More information about the samba-technical mailing list