From 5e44fc4cd47108245c567b9e676a5d8c09787d96 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Sat, 2 Sep 2006 21:47:56 +0000 Subject: r18009: Fixes bug 4026. This completes the work Jeremy began last week, disambiguating the meaning of c_time. (In POSIX terminology, c_time means "status Change time", not "create time".) All uses of c_time, a_time and m_time have now been replaced with change_time, access_time, and write_time, and when creation time is intended, create_time is used. Additionally, the capability of setting and retrieving the create time have been added to the smbc_setxattr() and smbc_getxattr() functions. An example of setting all four times can be seen with the program examples/libsmbclient/testacl with the following command line similar to: testacl -f -S "system.*:CREATE_TIME:1000000000,ACCESS_TIME:1000000060,WRITE_TIME:1000000120,CHANGE_TIME:1000000180" 'smb://server/share/testfile.txt' The -f option turns on the new mode which uses full time names in the attribute specification (e.g. ACCESS_TIME vs A_TIME). (This used to be commit 8e119b64f1d92026dda855d904be09912a40601c) --- source3/libsmb/clifile.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'source3/libsmb/clifile.c') diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 3cf8cae320..ad84ec0324 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1179,7 +1179,9 @@ BOOL cli_posix_getlock(struct cli_state *cli, int fnum, SMB_BIG_UINT *poffset, S BOOL cli_getattrE(struct cli_state *cli, int fd, uint16 *attr, SMB_OFF_T *size, - time_t *c_time, time_t *a_time, time_t *m_time) + time_t *change_time, + time_t *access_time, + time_t *write_time) { memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); @@ -1209,16 +1211,16 @@ BOOL cli_getattrE(struct cli_state *cli, int fd, *attr = SVAL(cli->inbuf,smb_vwv10); } - if (c_time) { - *c_time = cli_make_unix_date2(cli, cli->inbuf+smb_vwv0); + if (change_time) { + *change_time = cli_make_unix_date2(cli, cli->inbuf+smb_vwv0); } - if (a_time) { - *a_time = cli_make_unix_date2(cli, cli->inbuf+smb_vwv2); + if (access_time) { + *access_time = cli_make_unix_date2(cli, cli->inbuf+smb_vwv2); } - if (m_time) { - *m_time = cli_make_unix_date2(cli, cli->inbuf+smb_vwv4); + if (write_time) { + *write_time = cli_make_unix_date2(cli, cli->inbuf+smb_vwv4); } return True; @@ -1229,7 +1231,7 @@ BOOL cli_getattrE(struct cli_state *cli, int fd, ****************************************************************************/ BOOL cli_getatr(struct cli_state *cli, const char *fname, - uint16 *attr, SMB_OFF_T *size, time_t *t) + uint16 *attr, SMB_OFF_T *size, time_t *write_time) { char *p; @@ -1261,8 +1263,8 @@ BOOL cli_getatr(struct cli_state *cli, const char *fname, *size = IVAL(cli->inbuf, smb_vwv3); } - if (t) { - *t = cli_make_unix_date3(cli, cli->inbuf+smb_vwv1); + if (write_time) { + *write_time = cli_make_unix_date3(cli, cli->inbuf+smb_vwv1); } if (attr) { @@ -1278,7 +1280,9 @@ BOOL cli_getatr(struct cli_state *cli, const char *fname, ****************************************************************************/ BOOL cli_setattrE(struct cli_state *cli, int fd, - time_t c_time, time_t a_time, time_t m_time) + time_t change_time, + time_t access_time, + time_t write_time) { char *p; @@ -1293,9 +1297,9 @@ BOOL cli_setattrE(struct cli_state *cli, int fd, cli_setup_packet(cli); SSVAL(cli->outbuf,smb_vwv0, fd); - cli_put_dos_date2(cli, cli->outbuf,smb_vwv1, c_time); - cli_put_dos_date2(cli, cli->outbuf,smb_vwv3, a_time); - cli_put_dos_date2(cli, cli->outbuf,smb_vwv5, m_time); + cli_put_dos_date2(cli, cli->outbuf,smb_vwv1, change_time); + cli_put_dos_date2(cli, cli->outbuf,smb_vwv3, access_time); + cli_put_dos_date2(cli, cli->outbuf,smb_vwv5, write_time); p = smb_buf(cli->outbuf); *p++ = 4; -- cgit