Index: src/OFMutableTarArchiveEntry.h ================================================================== --- src/OFMutableTarArchiveEntry.h +++ src/OFMutableTarArchiveEntry.h @@ -32,11 +32,21 @@ @property (readwrite, nonatomic, copy) OFString *fileName; /*! * The mode of the entry. */ -@property (readwrite, nonatomic) uint32_t mode; +@property (readwrite, nonatomic) uint16_t mode; + +/*! + * The UID of the owner. + */ +@property (readwrite, nonatomic) uint16_t UID; + +/*! + * The GID of the group. + */ +@property (readwrite, nonatomic) uint16_t GID; /*! * The size of the file. */ @property (readwrite, nonatomic) uint64_t size; Index: src/OFMutableTarArchiveEntry.m ================================================================== --- src/OFMutableTarArchiveEntry.m +++ src/OFMutableTarArchiveEntry.m @@ -17,11 +17,11 @@ #include "config.h" #import "OFMutableTarArchiveEntry.h" @implementation OFMutableTarArchiveEntry -@dynamic fileName, mode, size, modificationDate, type, targetFileName; +@dynamic fileName, mode, UID, GID, size, modificationDate, type, targetFileName; @dynamic owner, group, deviceMajor, deviceMinor; - copy { OFMutableTarArchiveEntry *copy = [self mutableCopy]; @@ -36,14 +36,24 @@ OFString *old = _fileName; _fileName = [fileName copy]; [old release]; } -- (void)setMode: (uint32_t)mode +- (void)setMode: (uint16_t)mode { _mode = mode; } + +- (void)setUID: (uint16_t)UID +{ + _UID = UID; +} + +- (void)setGID: (uint16_t)GID +{ + _GID = GID; +} - (void)setSize: (uint64_t)size { _size = size; } Index: src/OFTarArchiveEntry.h ================================================================== --- src/OFTarArchiveEntry.h +++ src/OFTarArchiveEntry.h @@ -48,12 +48,13 @@ * @brief A class which represents an entry of a tar archive. */ @interface OFTarArchiveEntry: OFObject { OFString *_fileName; - uint32_t _mode; + uint16_t _mode; uint64_t _size; + uint16_t _UID, _GID; OFDate *_modificationDate; of_tar_archive_entry_type_t _type; OFString *_targetFileName; OFString *_owner, *_group; uint32_t _deviceMajor, _deviceMinor; @@ -65,11 +66,21 @@ @property (readonly, nonatomic) OFString *fileName; /*! * The mode of the entry. */ -@property (readonly, nonatomic) uint32_t mode; +@property (readonly, nonatomic) uint16_t mode; + +/*! + * The UID of the owner. + */ +@property (readonly, nonatomic) uint16_t UID; + +/*! + * The GID of the group. + */ +@property (readonly, nonatomic) uint16_t GID; /*! * The size of the file. */ @property (readonly, nonatomic) uint64_t size; Index: src/OFTarArchiveEntry.m ================================================================== --- src/OFTarArchiveEntry.m +++ src/OFTarArchiveEntry.m @@ -79,12 +79,16 @@ @try { void *pool = objc_autoreleasePoolPush(); OFString *targetFileName; _fileName = [stringFromBuffer(header, 100) copy]; - _mode = (uint32_t)octalValueFromBuffer( - header + 100, 8, UINT32_MAX); + _mode = (uint16_t)octalValueFromBuffer( + header + 100, 8, UINT16_MAX); + _UID = (uint16_t)octalValueFromBuffer( + header + 108, 8, UINT16_MAX); + _GID = (uint16_t)octalValueFromBuffer( + header + 116, 8, UINT16_MAX); _size = (uint64_t)octalValueFromBuffer( header + 124, 12, UINT64_MAX); _modificationDate = [[OFDate alloc] initWithTimeIntervalSince1970: (of_time_interval_t)octalValueFromBuffer( @@ -186,14 +190,24 @@ - (OFString *)fileName { return _fileName; } -- (uint32_t)mode +- (uint16_t)mode { return _mode; } + +- (uint16_t)UID +{ + return _UID; +} + +- (uint16_t)GID +{ + return _GID; +} - (uint64_t)size { return _size; } @@ -237,21 +251,24 @@ { void *pool = objc_autoreleasePoolPush(); OFString *ret = [OFString stringWithFormat: @"<%@:\n" @"\tFile name = %@\n" @"\tMode = %06o\n" + @"\tUID = %u\n", + @"\tGID = %u\n", @"\tSize = %" PRIu64 @"\n" @"\tModification date = %@\n" @"\tType = %u\n" @"\tTarget file name = %@\n" @"\tOwner = %@\n" @"\tGroup = %@\n" @"\tDevice major = %" PRIu32 @"\n" @"\tDevice minor = %" PRIu32 @"\n" @">", - [self class], _fileName, _mode, _size, _modificationDate, _type, - _targetFileName, _owner, _group, _deviceMajor, _deviceMinor]; + [self class], _fileName, _mode, _UID, _GID, _size, + _modificationDate, _type, _targetFileName, _owner, _group, + _deviceMajor, _deviceMinor]; [ret retain]; objc_autoreleasePoolPop(pool); @@ -264,12 +281,15 @@ uint64_t modificationDate; uint16_t checksum = 0; stringToBuffer(buffer, _fileName, 100); stringToBuffer(buffer + 100, - [OFString stringWithFormat: @"%06" PRIo32 " ", _mode], 8); - memcpy(buffer + 108, "000000 \0" "000000 \0", 16); + [OFString stringWithFormat: @"%06" PRIo16 " ", _mode], 8); + stringToBuffer(buffer + 108, + [OFString stringWithFormat: @"%06" PRIo16 " ", _UID], 8); + stringToBuffer(buffer + 116, + [OFString stringWithFormat: @"%06" PRIo16 " ", _GID], 8); stringToBuffer(buffer + 124, [OFString stringWithFormat: @"%011" PRIo64 " ", _size], 12); modificationDate = [_modificationDate timeIntervalSince1970]; stringToBuffer(buffer + 136, [OFString stringWithFormat: @"%011" PRIo64 " ", modificationDate], Index: utils/ofzip/TarArchive.m ================================================================== --- utils/ofzip/TarArchive.m +++ utils/ofzip/TarArchive.m @@ -91,19 +91,31 @@ localDateStringWithFormat: @"%Y-%m-%d %H:%M:%S"]; OFString *size = [OFString stringWithFormat: @"%" PRIu64, [entry size]]; OFString *mode = [OFString stringWithFormat: @"%06o", [entry mode]]; + OFString *UID = [OFString stringWithFormat: + @"%u", [entry UID]]; + OFString *GID = [OFString stringWithFormat: + @"%u", [entry GID]]; [of_stdout writeString: @"\t"]; [of_stdout writeLine: OF_LOCALIZED(@"list_size", @"Size: %[size] bytes", @"size", size)]; [of_stdout writeString: @"\t"]; [of_stdout writeLine: OF_LOCALIZED(@"list_mode", @"Mode: %[mode]", @"mode", mode)]; + [of_stdout writeString: @"\t"]; + [of_stdout writeLine: OF_LOCALIZED(@"list_uid", + @"UID: %[uid]", + @"uid", UID)]; + [of_stdout writeString: @"\t"]; + [of_stdout writeLine: OF_LOCALIZED(@"list_gid", + @"GID: %[gid]", + @"gid", GID)]; if ([entry owner] != nil) { [of_stdout writeString: @"\t"]; [of_stdout writeLine: OF_LOCALIZED( @"list_owner",