s3: client: Add btime_ts to struct finfo.
authorJeremy Allison <jra@samba.org>
Fri, 6 Apr 2018 20:35:05 +0000 (13:35 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 4 May 2018 23:39:40 +0000 (01:39 +0200)
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>
examples/fuse/clifuse.c
source3/include/client.h
source3/libsmb/cli_smb2_fnum.c
source3/libsmb/clilist.c

index da9dd4d..3c7e498 100644 (file)
@@ -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);
index 1fe3f1c..0cb2138 100644 (file)
@@ -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;
index c397b29..1eb1bea 100644 (file)
@@ -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);
index 41f5851..5cb1fce 100644 (file)
@@ -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;