diff options
-rw-r--r-- | docs-xml/smbdotconf/filename/hidenewfilestimeout.xml | 15 | ||||
-rw-r--r-- | source3/smbd/dir.c | 18 |
2 files changed, 32 insertions, 1 deletions
diff --git a/docs-xml/smbdotconf/filename/hidenewfilestimeout.xml b/docs-xml/smbdotconf/filename/hidenewfilestimeout.xml new file mode 100644 index 00000000000..ca93e726c33 --- /dev/null +++ b/docs-xml/smbdotconf/filename/hidenewfilestimeout.xml @@ -0,0 +1,15 @@ +<samba:parameter name="hide new files timeout" + context="S" + type="integer" + xmlns:samba="http://www.samba.org/samba/DTD/samba-doc"> + <description> + <para>Setting this parameter to something but 0 hides files + that have been modified less than N seconds ago.</para> + <para>It can be used for ingest/process queue style workloads. A + processing application should only see files that are definitely + finished. As many applications do not have proper external workflow + control, this can be a way to make sure processing does not + interfere with file ingest.</para> +</description> +<value type="default">0</value> +</samba:parameter> diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index c3af5233e98..f05d7a290e5 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -1536,6 +1536,7 @@ bool is_visible_file(connection_struct *conn, const char *dir_path, bool hide_unreadable = lp_hide_unreadable(SNUM(conn)); bool hide_unwriteable = lp_hide_unwriteable_files(SNUM(conn)); bool hide_special = lp_hide_special_files(SNUM(conn)); + int hide_new_files_timeout = lp_hide_new_files_timeout(SNUM(conn)); char *entry = NULL; struct smb_filename *smb_fname_base = NULL; bool ret = false; @@ -1550,7 +1551,11 @@ bool is_visible_file(connection_struct *conn, const char *dir_path, return False; } - if (hide_unreadable || hide_unwriteable || hide_special) { + if (hide_unreadable || + hide_unwriteable || + hide_special || + (hide_new_files_timeout != 0)) + { entry = talloc_asprintf(talloc_tos(), "%s/%s", dir_path, name); if (!entry) { ret = false; @@ -1603,6 +1608,17 @@ bool is_visible_file(connection_struct *conn, const char *dir_path, ret = false; goto out; } + + if (hide_new_files_timeout != 0) { + + double age = timespec_elapsed( + &smb_fname_base->st.st_ex_mtime); + + if (age < (double)hide_new_files_timeout) { + ret = false; + goto out; + } + } } ret = true; |