@@ -84,11 +84,12 @@ { self = [super init]; @try { _type = OFTarArchiveEntryTypeFile; - _mode = [[OFNumber alloc] initWithUnsignedShort: 0644]; + _POSIXPermissions = + [[OFNumber alloc] initWithUnsignedShort: 0644]; } @catch (id e) { [self release]; @throw e; } @@ -103,15 +104,16 @@ @try { void *pool = objc_autoreleasePoolPush(); OFString *targetFileName; _fileName = [stringFromBuffer(header, 100, encoding) copy]; - _mode = [[OFNumber alloc] initWithUnsignedLongLong: + _POSIXPermissions = [[OFNumber alloc] initWithUnsignedLongLong: octalValueFromBuffer(header + 100, 8, ULONG_MAX)]; - _UID = [[OFNumber alloc] initWithUnsignedLongLong: + _ownerAccountID = [[OFNumber alloc] initWithUnsignedLongLong: octalValueFromBuffer(header + 108, 8, ULONG_MAX)]; - _GID = [[OFNumber alloc] initWithUnsignedLongLong: + _groupOwnerAccountID = [[OFNumber alloc] + initWithUnsignedLongLong: octalValueFromBuffer(header + 116, 8, ULONG_MAX)]; _uncompressedSize = (unsigned long long)octalValueFromBuffer( header + 124, 12, ULLONG_MAX); _compressedSize = _uncompressedSize + (512 - _uncompressedSize % 512); @@ -129,14 +131,14 @@ _type = OFTarArchiveEntryTypeFile; if (memcmp(header + 257, "ustar\0" "00", 8) == 0) { OFString *prefix; - _owner = [stringFromBuffer(header + 265, 32, encoding) - copy]; - _group = [stringFromBuffer(header + 297, 32, encoding) - copy]; + _ownerAccountName = + [stringFromBuffer(header + 265, 32, encoding) copy]; + _groupOwnerAccountName = [stringFromBuffer(header + 297, + 32, encoding) copy]; _deviceMajor = (unsigned long)octalValueFromBuffer( header + 329, 8, ULONG_MAX); _deviceMinor = (unsigned long)octalValueFromBuffer( header + 337, 8, ULONG_MAX); @@ -161,17 +163,17 @@ } - (void)dealloc { [_fileName release]; - [_mode release]; - [_UID release]; - [_GID release]; + [_POSIXPermissions release]; + [_ownerAccountID release]; + [_groupOwnerAccountID release]; [_modificationDate release]; [_targetFileName release]; - [_owner release]; - [_group release]; + [_ownerAccountName release]; + [_groupOwnerAccountName release]; [super dealloc]; } - (id)copy @@ -183,18 +185,20 @@ { OFTarArchiveEntry *copy = [[OFMutableTarArchiveEntry alloc] initWithFileName: _fileName]; @try { - copy->_mode = _mode; + copy->_POSIXPermissions = [_POSIXPermissions retain]; + copy->_ownerAccountID = [_ownerAccountID retain]; + copy->_groupOwnerAccountID = [_groupOwnerAccountID retain]; copy->_compressedSize = _compressedSize; copy->_uncompressedSize = _uncompressedSize; copy->_modificationDate = [_modificationDate copy]; copy->_type = _type; copy->_targetFileName = [_targetFileName copy]; - copy->_owner = [_owner copy]; - copy->_group = [_group copy]; + copy->_ownerAccountName = [_ownerAccountName copy]; + copy->_groupOwnerAccountName = [_groupOwnerAccountName copy]; copy->_deviceMajor = _deviceMajor; copy->_deviceMinor = _deviceMinor; } @catch (id e) { [copy release]; @throw e; @@ -206,23 +210,23 @@ - (OFString *)fileName { return _fileName; } -- (OFNumber *)mode +- (OFNumber *)POSIXPermissions { - return _mode; + return _POSIXPermissions; } -- (OFNumber *)UID +- (OFNumber *)ownerAccountID { - return _UID; + return _ownerAccountID; } -- (OFNumber *)GID +- (OFNumber *)groupOwnerAccountID { - return _GID; + return _groupOwnerAccountID; } - (unsigned long long)compressedSize { return _compressedSize; @@ -246,18 +250,18 @@ - (OFString *)targetFileName { return _targetFileName; } -- (OFString *)owner +- (OFString *)ownerAccountName { - return _owner; + return _ownerAccountName; } -- (OFString *)group +- (OFString *)groupOwnerAccountName { - return _group; + return _groupOwnerAccountName; } - (unsigned long)deviceMajor { return _deviceMajor; @@ -269,28 +273,36 @@ } - (OFString *)description { void *pool = objc_autoreleasePoolPush(); - OFString *ret = [OFString stringWithFormat: @"<%@:\n" + OFString *POSIXPermissions = nil, *ret; + + if (_POSIXPermissions != nil) + POSIXPermissions = [OFString stringWithFormat: @"%ho", + _POSIXPermissions.unsignedShortValue]; + + ret = [OFString stringWithFormat: @"<%@:\n" @"\tFile name = %@\n" - @"\tMode = %06o\n" - @"\tUID = %u\n" - @"\tGID = %u\n" + @"\tPOSIX permissions = %@\n" + @"\tOwner account ID = %@\n" + @"\tGroup owner account ID = %@\n" @"\tCompressed size = %llu\n" @"\tUncompressed size = %llu\n" @"\tModification date = %@\n" @"\tType = %u\n" @"\tTarget file name = %@\n" - @"\tOwner = %@\n" - @"\tGroup = %@\n" + @"\tOwner account name = %@\n" + @"\tGroup owner account name = %@\n" @"\tDevice major = %" PRIu32 @"\n" @"\tDevice minor = %" PRIu32 @"\n" @">", - self.class, _fileName, _mode, _UID, _GID, _compressedSize, - _uncompressedSize, _modificationDate, _type, _targetFileName, - _owner, _group, _deviceMajor, _deviceMinor]; + self.class, _fileName, POSIXPermissions, _ownerAccountID, + _groupOwnerAccountID, _compressedSize, _uncompressedSize, + _modificationDate, _type, _targetFileName, + _ownerAccountName, _groupOwnerAccountName, _deviceMajor, + _deviceMinor]; [ret retain]; objc_autoreleasePoolPop(pool); @@ -304,18 +316,18 @@ unsigned long long modificationDate; uint16_t checksum = 0; stringToBuffer(buffer, _fileName, 100, encoding); stringToBuffer(buffer + 100, - [OFString stringWithFormat: @"%06" PRIo16 " ", _mode], 8, - OFStringEncodingASCII); + [OFString stringWithFormat: @"%06o ", + _POSIXPermissions.unsignedShortValue], 8, OFStringEncodingASCII); stringToBuffer(buffer + 108, - [OFString stringWithFormat: @"%06" PRIo16 " ", _UID], 8, - OFStringEncodingASCII); + [OFString stringWithFormat: @"%06o ", + _ownerAccountID.unsignedShortValue], 8, OFStringEncodingASCII); stringToBuffer(buffer + 116, - [OFString stringWithFormat: @"%06" PRIo16 " ", _GID], 8, - OFStringEncodingASCII); + [OFString stringWithFormat: @"%06o ", + _groupOwnerAccountID.unsignedShortValue], 8, OFStringEncodingASCII); stringToBuffer(buffer + 124, [OFString stringWithFormat: @"%011llo ", _uncompressedSize], 12, OFStringEncodingASCII); modificationDate = _modificationDate.timeIntervalSince1970; stringToBuffer(buffer + 136, @@ -331,12 +343,12 @@ buffer[156] = _type; stringToBuffer(buffer + 157, _targetFileName, 100, encoding); /* ustar */ memcpy(buffer + 257, "ustar\0" "00", 8); - stringToBuffer(buffer + 265, _owner, 32, encoding); - stringToBuffer(buffer + 297, _group, 32, encoding); + stringToBuffer(buffer + 265, _ownerAccountName, 32, encoding); + stringToBuffer(buffer + 297, _groupOwnerAccountName, 32, encoding); stringToBuffer(buffer + 329, [OFString stringWithFormat: @"%06" PRIo32 " ", _deviceMajor], 8, OFStringEncodingASCII); stringToBuffer(buffer + 337, [OFString stringWithFormat: @"%06" PRIo32 " ", _deviceMinor], 8,