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

Stefan Metzmacher metze at samba.org
Tue Aug 21 13:50:27 UTC 2018

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
                        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...


More information about the samba-technical mailing list