diff options
author | Jeremy Allison <jra@samba.org> | 2018-04-06 13:35:05 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-05-05 01:39:40 +0200 |
commit | abb80ce44c41759306be3ff1cca6bea532bdf45f (patch) | |
tree | b99b99bbcacb4b05d906534448c4772e5fe2085f | |
parent | 30e6b5999bf0be297de74dc991beeccfe4af6088 (diff) | |
download | samba-abb80ce44c41759306be3ff1cca6bea532bdf45f.tar.gz |
s3: client: Add btime_ts to struct finfo.
Fill it in when available, else return it as zero.
Based on a patch from Puran Chand <pchand@vmware.com>.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
-rw-r--r-- | examples/fuse/clifuse.c | 1 | ||||
-rw-r--r-- | source3/include/client.h | 1 | ||||
-rw-r--r-- | source3/libsmb/cli_smb2_fnum.c | 1 | ||||
-rw-r--r-- | source3/libsmb/clilist.c | 19 |
4 files changed, 22 insertions, 0 deletions
diff --git a/examples/fuse/clifuse.c b/examples/fuse/clifuse.c index da9dd4d3e82..3c7e4982475 100644 --- a/examples/fuse/clifuse.c +++ b/examples/fuse/clifuse.c @@ -484,6 +484,7 @@ static NTSTATUS parse_finfo_id_both_directory_info(uint8_t *dir_data, return NT_STATUS_INFO_LENGTH_MISMATCH; } + finfo->btime_ts = interpret_long_date((const char *)dir_data + 8); finfo->atime_ts = interpret_long_date((const char *)dir_data + 16); finfo->mtime_ts = interpret_long_date((const char *)dir_data + 24); finfo->ctime_ts = interpret_long_date((const char *)dir_data + 32); diff --git a/source3/include/client.h b/source3/include/client.h index 1fe3f1cb960..0cb21384f17 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -108,6 +108,7 @@ struct file_info { uid_t uid; gid_t gid; /* these times are normally kept in GMT */ + struct timespec btime_ts; /* Birth-time if supported by system */ struct timespec mtime_ts; struct timespec atime_ts; struct timespec ctime_ts; diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index c397b29b381..1eb1bea7a72 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -803,6 +803,7 @@ static NTSTATUS parse_finfo_id_both_directory_info(uint8_t *dir_data, return NT_STATUS_INFO_LENGTH_MISMATCH; } + finfo->btime_ts = interpret_long_date((const char *)dir_data + 8); finfo->atime_ts = interpret_long_date((const char *)dir_data + 16); finfo->mtime_ts = interpret_long_date((const char *)dir_data + 24); finfo->ctime_ts = interpret_long_date((const char *)dir_data + 32); diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index 41f585120b9..5cb1fce4338 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -77,6 +77,14 @@ static size_t interpret_long_filename(TALLOC_CTX *ctx, if (pdata_end - base < 27) { return pdata_end - base; } + /* + * What we're returning here as ctime_ts is + * actually the server create time. + */ + finfo->btime_ts = convert_time_t_to_timespec( + make_unix_date2(p+4, + smb1cli_conn_server_time_zone( + cli->conn))); finfo->ctime_ts = convert_time_t_to_timespec( make_unix_date2(p+4, smb1cli_conn_server_time_zone(cli->conn))); finfo->atime_ts = convert_time_t_to_timespec( @@ -128,6 +136,14 @@ static size_t interpret_long_filename(TALLOC_CTX *ctx, if (pdata_end - base < 31) { return pdata_end - base; } + /* + * What we're returning here as ctime_ts is + * actually the server create time. + */ + finfo->btime_ts = convert_time_t_to_timespec( + make_unix_date2(p+4, + smb1cli_conn_server_time_zone( + cli->conn))); finfo->ctime_ts = convert_time_t_to_timespec( make_unix_date2(p+4, smb1cli_conn_server_time_zone(cli->conn))); finfo->atime_ts = convert_time_t_to_timespec( @@ -250,6 +266,9 @@ static bool interpret_short_filename(TALLOC_CTX *ctx, finfo->mode = CVAL(p,21); + /* We don't get birth time. */ + finfo->btime_ts.tv_sec = 0; + finfo->btime_ts.tv_nsec = 0; /* this date is converted to GMT by make_unix_date */ finfo->ctime_ts.tv_sec = make_unix_date(p+22, smb1cli_conn_server_time_zone(cli->conn)); finfo->ctime_ts.tv_nsec = 0; |