1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-29 13:49:30 +03:00

r5666: winxp will use a NTTIME of -1 to mean "don't change" in setfileinfo

basic_info. Add null_nttime() as the equivalent of the existing
null_time() call for cheecking for valid NTTIME values
(This used to be commit 439ce2efbf)
This commit is contained in:
Andrew Tridgell
2005-03-05 22:50:13 +00:00
committed by Gerald (Jerry) Carter
parent 2f9e1650f9
commit a52a6f1c42
3 changed files with 21 additions and 12 deletions

View File

@ -112,6 +112,15 @@ BOOL null_time(time_t t)
t == (time_t)-1; t == (time_t)-1;
} }
/****************************************************************************
check if it's a null NTTIME
****************************************************************************/
BOOL null_nttime(NTTIME t)
{
return t == 0 || t == (NTTIME)-1;
}
/******************************************************************* /*******************************************************************
create a 16 bit dos packed date create a 16 bit dos packed date
********************************************************************/ ********************************************************************/

View File

@ -301,18 +301,18 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
case RAW_SFILEINFO_BASIC_INFO: case RAW_SFILEINFO_BASIC_INFO:
case RAW_SFILEINFO_BASIC_INFORMATION: case RAW_SFILEINFO_BASIC_INFORMATION:
if (info->basic_info.in.create_time) { if (!null_nttime(info->basic_info.in.create_time)) {
newstats.dos.create_time = info->basic_info.in.create_time; newstats.dos.create_time = info->basic_info.in.create_time;
} }
if (info->basic_info.in.access_time) { if (!null_nttime(info->basic_info.in.access_time)) {
newstats.dos.access_time = info->basic_info.in.access_time; newstats.dos.access_time = info->basic_info.in.access_time;
} }
if (info->basic_info.in.write_time) { if (!null_nttime(info->basic_info.in.write_time)) {
newstats.dos.write_time = info->basic_info.in.write_time; newstats.dos.write_time = info->basic_info.in.write_time;
newstats.dos.flags |= XATTR_ATTRIB_FLAG_STICKY_WRITE_TIME; newstats.dos.flags |= XATTR_ATTRIB_FLAG_STICKY_WRITE_TIME;
h->sticky_write_time = True; h->sticky_write_time = True;
} }
if (info->basic_info.in.change_time) { if (!null_nttime(info->basic_info.in.change_time)) {
newstats.dos.change_time = info->basic_info.in.change_time; newstats.dos.change_time = info->basic_info.in.change_time;
} }
if (info->basic_info.in.attrib != 0) { if (info->basic_info.in.attrib != 0) {
@ -490,16 +490,16 @@ NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
case RAW_SFILEINFO_BASIC_INFO: case RAW_SFILEINFO_BASIC_INFO:
case RAW_SFILEINFO_BASIC_INFORMATION: case RAW_SFILEINFO_BASIC_INFORMATION:
if (info->basic_info.in.create_time) { if (!null_nttime(info->basic_info.in.create_time)) {
newstats.dos.create_time = info->basic_info.in.create_time; newstats.dos.create_time = info->basic_info.in.create_time;
} }
if (info->basic_info.in.access_time) { if (!null_nttime(info->basic_info.in.access_time)) {
newstats.dos.access_time = info->basic_info.in.access_time; newstats.dos.access_time = info->basic_info.in.access_time;
} }
if (info->basic_info.in.write_time) { if (!null_nttime(info->basic_info.in.write_time)) {
newstats.dos.write_time = info->basic_info.in.write_time; newstats.dos.write_time = info->basic_info.in.write_time;
} }
if (info->basic_info.in.change_time) { if (!null_nttime(info->basic_info.in.change_time)) {
newstats.dos.change_time = info->basic_info.in.change_time; newstats.dos.change_time = info->basic_info.in.change_time;
} }
if (info->basic_info.in.attrib != 0) { if (info->basic_info.in.attrib != 0) {

View File

@ -190,10 +190,10 @@ NTSTATUS pvfs_dosattrib_load(struct pvfs_state *pvfs, struct pvfs_filename *name
name->dos.alloc_size = name->dos.alloc_size =
pvfs_round_alloc_size(pvfs, info1->alloc_size); pvfs_round_alloc_size(pvfs, info1->alloc_size);
} }
if (info1->create_time != 0) { if (!null_nttime(info1->create_time)) {
name->dos.create_time = info1->create_time; name->dos.create_time = info1->create_time;
} }
if (info1->change_time != 0) { if (!null_nttime(info1->change_time)) {
name->dos.change_time = info1->change_time; name->dos.change_time = info1->change_time;
} }
name->dos.flags = 0; name->dos.flags = 0;
@ -207,10 +207,10 @@ NTSTATUS pvfs_dosattrib_load(struct pvfs_state *pvfs, struct pvfs_filename *name
name->dos.alloc_size = name->dos.alloc_size =
pvfs_round_alloc_size(pvfs, info2->alloc_size); pvfs_round_alloc_size(pvfs, info2->alloc_size);
} }
if (info2->create_time != 0) { if (!null_nttime(info2->create_time)) {
name->dos.create_time = info2->create_time; name->dos.create_time = info2->create_time;
} }
if (info2->change_time != 0) { if (!null_nttime(info2->change_time)) {
name->dos.change_time = info2->change_time; name->dos.change_time = info2->change_time;
} }
name->dos.flags = info2->flags; name->dos.flags = info2->flags;