[PATCH] Samba VirusFilter (version 12)

Jeremy Allison jra at samba.org
Tue Jan 2 23:26:15 UTC 2018


On Tue, Jan 02, 2018 at 10:34:47AM -0700, Trever L. Adams via samba-technical wrote:
> Thank you to all who have been most helpful it getting things cleaned
> up. Hopefully this is ready for merging.

Will still need a few README.Coding changes, but closer !

Can you explain what this code does ?

                q_filepath = talloc_asprintf(talloc_tos(), "%s/%s%s%s", q_dir,
                                             q_prefix, base_name, q_suffix);

                TALLOC_FREE(q_dir);
                TALLOC_FREE(q_prefix);
                TALLOC_FREE(q_suffix);

                become_root();

                q_smb_fname = synthetic_smb_fname(mem_ctx, q_filepath,
                                                  smb_fname->stream_name, NULL,
                                                  smb_fname->flags);
                if (q_smb_fname == NULL) {
>>>>>>>>>>>>>           unlink(q_filepath);
                        unbecome_root();
                        return VIRUSFILTER_ACTION_DO_NOTHING;
                }

                int_ok = virusfilter_vfs_next_move(handle, smb_fname,
                                                   q_smb_fname);
                if (int_ok == -1)
                {
                        unbecome_root();
                        DBG_ERR("Rename failed: %s/%s: Rename failed: %s\n",
                                cwd_fname, fname,
                                strerror(errno));
                        return VIRUSFILTER_ACTION_DO_NOTHING;
                }
                unbecome_root();

Why are you unlinking q_filepath under root protections here ?

Once I understand that, I'll send you a README.coding fix
you can merge in and then I'll do a final review.

Thanks !

Jeremy.



More information about the samba-technical mailing list