[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Wed Jan 27 19:27:01 UTC 2021


The branch, master has been updated
       via  1e47c04aade clitar: restore mtime on files
      from  9883ac45939 script/autobuild.py: let cleanup() ignore errors from rmdir_force() by default

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 1e47c04aade72934a832359fce0e11d328255a25
Author: Steven Price <steven at ecrips.co.uk>
Date:   Sat Oct 24 11:56:09 2020 +0100

    clitar: restore mtime on files
    
    The documentation for smbclient states that when extracting a tar
    archive:
    
      Restored files have their creation times (mtime) set to the
      date saved in the tar file.
    
    However this behaviour was lost in commit 2945596011cc ("clitar.c: fresh
    new compilable file.").
    
    Add a call to cli_setatr() to set both the mtime and the mode of files
    after they have been extracted.
    
    Signed-off-by: Steven Price <steven at ecrips.co.uk>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Noel Power <noel.power at suse.com>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Wed Jan 27 19:26:03 UTC 2021 on sn-devel-184

-----------------------------------------------------------------------

Summary of changes:
 source3/client/clitar.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 7348420db5e..d62b53d2b17 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -1126,7 +1126,9 @@ static int tar_send_file(struct tar *t, struct archive_entry *entry)
 	uint16_t remote_fd = (uint16_t) -1;
 	int err = 0;
 	int flags = O_RDWR | O_CREAT | O_TRUNC;
-	mode_t mode = archive_entry_filetype(entry);
+	mode_t filetype = archive_entry_filetype(entry);
+	mode_t mode = archive_entry_mode(entry);
+	time_t mtime = archive_entry_mtime(entry);
 	int rc;
 	TALLOC_CTX *ctx = talloc_new(NULL);
 	if (ctx == NULL) {
@@ -1156,7 +1158,7 @@ static int tar_send_file(struct tar *t, struct archive_entry *entry)
 		goto out;
 	}
 
-	if (mode != AE_IFREG && mode != AE_IFDIR) {
+	if (filetype != AE_IFREG && filetype != AE_IFDIR) {
 		d_printf("Skipping non-dir & non-regular file %s\n", full_path);
 		goto out;
 	}
@@ -1167,7 +1169,7 @@ static int tar_send_file(struct tar *t, struct archive_entry *entry)
 		goto out;
 	}
 
-	if (mode == AE_IFDIR) {
+	if (filetype == AE_IFDIR) {
 		goto out;
 	}
 
@@ -1215,6 +1217,13 @@ close_out:
 		err = 1;
 	}
 
+	status = cli_setatr(cli, full_path, mode, mtime);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("Error setting attributes on remote file %s: %s\n",
+				full_path, nt_errstr(status));
+		err = 1;
+	}
+
 out:
 	talloc_free(ctx);
 	return err;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list