]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
15 years agoUnbreak build on Linux; correct second argument of futimens().
Michihiro NAKAJIMA [Wed, 13 Apr 2011 16:24:55 +0000 (12:24 -0400)] 
Unbreak build on Linux; correct second argument of futimens().

SVN-Revision: 3225

15 years agoOn Windows, this command line systemf("echo f | bsdcpio -pd copy >copy.out 2>copy...
Michihiro NAKAJIMA [Wed, 13 Apr 2011 13:54:59 +0000 (09:54 -0400)] 
On Windows, this command line systemf("echo f | bsdcpio -pd copy >copy.out 2>copy.err"),
bsdcpio will get a wrong filename "f ". this "echo f| bsdcpio ...." can correctly pass
a intended filename to bsdcpio.

SVN-Revision: 3224

15 years agor3216 was insufficient. It needs father changes.
Michihiro NAKAJIMA [Wed, 13 Apr 2011 13:43:46 +0000 (09:43 -0400)] 
r3216 was insufficient. It needs father changes.
Windows "\\.\" prefix path mechanism does not allow "../" or "./" components.
So if GetLastError() returns ERROR_INVALID_NAME we retry the operation with the corrected name
renamed through __la_win_permissive_name_w(), which returns a canonical path.

SVN-Revision: 3223

15 years agoConsider the large i-node number for the tests using cpio newc format.
Michihiro NAKAJIMA [Wed, 13 Apr 2011 10:43:55 +0000 (06:43 -0400)] 
Consider the large i-node number for the tests using cpio newc format.
Some cpio tests on Cygwin 1.7.x always failed because of the large i-node number.

SVN-Revision: 3222

15 years agoRevert path separator conversion for CYGWIN. I deleted it by mistake when removing...
Michihiro NAKAJIMA [Wed, 13 Apr 2011 04:36:14 +0000 (00:36 -0400)] 
Revert path separator conversion for CYGWIN. I deleted it by mistake when removing Windows support code.

SVN-Revision: 3221

15 years agoFix a fiex existence test for a pattern "../../fileXX".
Michihiro NAKAJIMA [Wed, 13 Apr 2011 03:48:10 +0000 (23:48 -0400)] 
Fix a fiex existence test for a pattern "../../fileXX".

SVN-Revision: 3220

15 years agoApply the default string conversion(mostly OEMCP ==> ACP) to cab reader.
Michihiro NAKAJIMA [Tue, 12 Apr 2011 15:02:35 +0000 (11:02 -0400)] 
Apply the default string conversion(mostly OEMCP ==> ACP) to cab reader.
As you know, it works for Windows platform only.

SVN-Revision: 3219

15 years agoProperly report string conversion failure.
Michihiro NAKAJIMA [Tue, 12 Apr 2011 14:19:25 +0000 (10:19 -0400)] 
Properly report string conversion failure.

SVN-Revision: 3218

15 years agoAllow to apply the charset specified by the hdrcharset option to PAX reader only...
Michihiro NAKAJIMA [Tue, 12 Apr 2011 13:32:57 +0000 (09:32 -0400)] 
Allow to apply the charset specified by the hdrcharset option to PAX reader only when
the the charset described in PAX attribute is BINARY because BINARY means
the the character-set of a bunch of metadata(filname/uname/gname) is unknown.
It might be useful users can specify charset for 'BINARY' metadata, the users
may know a proper charset or try to find what kind of charset correctly convert.

SVN-Revision: 3217

15 years agoFix the problem about full-pathnames handling with the path multiple dirs in one...
Michihiro NAKAJIMA [Tue, 12 Apr 2011 08:39:09 +0000 (04:39 -0400)] 
Fix the problem about full-pathnames handling with the path multiple dirs in one entry.

SVN-Revision: 3216

15 years agoClearly archive_write_disk object on Windows cannot handle Mac MetaData.
Michihiro NAKAJIMA [Tue, 12 Apr 2011 03:50:31 +0000 (23:50 -0400)] 
Clearly archive_write_disk object on Windows cannot handle Mac MetaData.

SVN-Revision: 3215

15 years agoIn archive_write_disk_windows.c, Use the Windows file handle 'HANDLE' instead of...
Michihiro NAKAJIMA [Tue, 12 Apr 2011 03:39:48 +0000 (23:39 -0400)] 
In archive_write_disk_windows.c, Use the Windows file handle 'HANDLE' instead of the POSIX file descriptor.

SVN-Revision: 3214

15 years agoImprove archive_write_disk_windows.c.
Michihiro NAKAJIMA [Mon, 11 Apr 2011 16:46:37 +0000 (12:46 -0400)] 
Improve archive_write_disk_windows.c.
 - Use WCS to pathname. This has made following changes.
 - FindFirstFileW and GetFileInformationByHandle instead of stat/lstat.
 - Move __la_chmod and __la_ftruncate used only in the file from archive_windows.c
   and change it to wide char version.
 - Remove __la_mkdir and directly use CreateDirectoryW in the file.
 - Remove  __la_rmdir and use _wrmdir in the file.
 - Remove __la_unlink and use _wunlink in the file.
 - Remove __la_link and Move la_CreateHardLinkW into the file to use it directly.
 - Use _wopen instead of __la_open.

Unfortunately, at this time we cannot use full-pathname through __la_win_permissive_name_w()
completely at the file because __la_win_permissive_name_w() trim "../". For example, the path
"abc/a/../b../c", which is multi dirs in one entry, will be converted to "<parent-dir>/abc/c",
so we could not make both abc/a and abc/b directories if we applied __la_win_permissive_name_w()
to the path at _archive_write_disk_header().

SVN-Revision: 3213

15 years agoRemove non Windows platform code from archive_write_disk_windows.c
Michihiro NAKAJIMA [Mon, 11 Apr 2011 10:15:14 +0000 (06:15 -0400)] 
Remove non Windows platform code from archive_write_disk_windows.c

SVN-Revision: 3212

15 years agoRemove Windows platform code from archive_write_disk_posix.c
Michihiro NAKAJIMA [Mon, 11 Apr 2011 09:35:51 +0000 (05:35 -0400)] 
Remove Windows platform code from archive_write_disk_posix.c

SVN-Revision: 3211

15 years agoMake two version of archive_write_disk.c by copying and renaming it;
Michihiro NAKAJIMA [Mon, 11 Apr 2011 09:23:29 +0000 (05:23 -0400)] 
Make two version of archive_write_disk.c by copying and renaming it;
one is for POSIX platform, other one is for Windows platform.
The Windows version will be cleaned up and some part of it will be
reimplemented by Win32 API for reducing the overhead simulates POSIX API.

SVN-Revision: 3210

15 years agoDo not compile archive_read_disk_windows.c on POSIX platform.
Michihiro NAKAJIMA [Mon, 11 Apr 2011 05:15:25 +0000 (01:15 -0400)] 
Do not compile archive_read_disk_windows.c on POSIX platform.

SVN-Revision: 3209

15 years agoAdd a wide character version of archive_entry_sourcepath() and archive_entry_copy_sou...
Michihiro NAKAJIMA [Mon, 11 Apr 2011 05:05:52 +0000 (01:05 -0400)] 
Add a wide character version of archive_entry_sourcepath() and archive_entry_copy_sourcepath().

SVN-Revision: 3208

15 years agoRename archive_string_append_from_wcs_to_mbs function to archive_string_append_from_wcs.
Michihiro NAKAJIMA [Mon, 11 Apr 2011 04:30:34 +0000 (00:30 -0400)] 
Rename archive_string_append_from_wcs_to_mbs function to archive_string_append_from_wcs.

SVN-Revision: 3207

15 years agoRemove first argument of archive_wstring_append_from_mbs/archive_string_append_from_w...
Michihiro NAKAJIMA [Mon, 11 Apr 2011 04:25:41 +0000 (00:25 -0400)] 
Remove first argument of archive_wstring_append_from_mbs/archive_string_append_from_wcs_to_mbs.
It is no longer needed for WCS<==>MBS conversion.

SVN-Revision: 3206

15 years agoCorrectly convert charset names, both "CP_ACP" and "CP_OEMCP", to current ACP and...
Michihiro NAKAJIMA [Mon, 11 Apr 2011 04:03:09 +0000 (00:03 -0400)] 
Correctly convert charset names, both "CP_ACP" and "CP_OEMCP", to current ACP and OEMCP.

SVN-Revision: 3205

15 years agoReduce a string buffer copy in the wctomb/wcrtomb version of
Michihiro NAKAJIMA [Mon, 11 Apr 2011 03:38:46 +0000 (23:38 -0400)] 
Reduce a string buffer copy in the wctomb/wcrtomb version of
archive_string_append_from_wcs_to_mbs().

SVN-Revision: 3204

15 years agoUse wcsnrtombs() at archive_string_append_from_wcs_to_mbs() if available.
Michihiro NAKAJIMA [Sun, 10 Apr 2011 15:57:06 +0000 (11:57 -0400)] 
Use wcsnrtombs() at archive_string_append_from_wcs_to_mbs() if available.
It's faster than use of wcrtomb/wctomb.

SVN-Revision: 3203

15 years agoAdd and update comments in archive_string.c.
Michihiro NAKAJIMA [Sun, 10 Apr 2011 14:27:46 +0000 (10:27 -0400)] 
Add and update comments in archive_string.c.

SVN-Revision: 3202

15 years agoAdd some CP932 filename tests.
Michihiro NAKAJIMA [Sun, 10 Apr 2011 13:48:22 +0000 (09:48 -0400)] 
Add some CP932 filename tests.

SVN-Revision: 3201

15 years agoAdd a filename encoding test for ustar.
Michihiro NAKAJIMA [Sun, 10 Apr 2011 13:09:30 +0000 (09:09 -0400)] 
Add a filename encoding test for ustar.

SVN-Revision: 3200

15 years agoAdd a test storing a CP1251 filename in zip file on non Windows Platform.
Michihiro NAKAJIMA [Sun, 10 Apr 2011 12:53:43 +0000 (08:53 -0400)] 
Add a test storing a CP1251 filename in zip file on non Windows Platform.

SVN-Revision: 3199

15 years agoAdd a filename encoding test for gnutar.
Michihiro NAKAJIMA [Sun, 10 Apr 2011 12:22:05 +0000 (08:22 -0400)] 
Add a filename encoding test for gnutar.

SVN-Revision: 3198

15 years agoAdd locale CP1251 and CP932 tests to test_pax_filename_encoding.
Michihiro NAKAJIMA [Sun, 10 Apr 2011 11:17:54 +0000 (07:17 -0400)] 
Add locale CP1251 and CP932 tests to test_pax_filename_encoding.

SVN-Revision: 3197

15 years agotorture test archive_read_support_format_XXX as well
Roman Neuhauser [Sun, 10 Apr 2011 09:13:52 +0000 (05:13 -0400)] 
torture test archive_read_support_format_XXX as well

SVN-Revision: 3196

15 years agoplug crashes in archive_read_support_filter_XXX
Roman Neuhauser [Sun, 10 Apr 2011 09:13:35 +0000 (05:13 -0400)] 
plug crashes in archive_read_support_filter_XXX

these functions lacked protection by archive_check_magic.

SVN-Revision: 3195

15 years agoSimplify a check of de_DE.UTF-8 locale in libarchive test suite on Windows.
Michihiro NAKAJIMA [Sun, 10 Apr 2011 07:49:18 +0000 (03:49 -0400)] 
Simplify a check of de_DE.UTF-8 locale in libarchive test suite on Windows.

SVN-Revision: 3194

15 years agoImprove test_read_format_zip_filename for Windows platform.
Michihiro NAKAJIMA [Sun, 10 Apr 2011 07:21:45 +0000 (03:21 -0400)] 
Improve test_read_format_zip_filename for Windows platform.
 - some tests work on both POSIX and Windows platform.
 - add test_read_format_zip_filename_CP866_CP1251_win to check the automatic filename translation.

SVN-Revision: 3193

15 years agoFix the automatic filename translation on Windows and add a test for it.
Michihiro NAKAJIMA [Sun, 10 Apr 2011 07:16:21 +0000 (03:16 -0400)] 
Fix the automatic filename translation on Windows and add a test for it.

When reading CP866 filenames in the zip file on Russian Windows platform,
which its ACP is not equal to its OEMCP, We should automatically translate
CP866(OEMCP of Russian) filenames to CP1251(ACP of Russian) filenames because
other archiver application on Windows have stored the filenames in CP866
through WideCharToMultiByte() with CP_OEMCP.

SVN-Revision: 3192

15 years agoremove stuff covered by #if ARCHIVE_VERSION_NUMBER < 3000000
Roman Neuhauser [Sat, 9 Apr 2011 08:07:11 +0000 (04:07 -0400)] 
remove stuff covered by #if ARCHIVE_VERSION_NUMBER < 3000000

archive.h says #define ARCHIVE_VERSION_NUMBER 3000000, and it's
not going to decrease.

SVN-Revision: 3191

15 years agotest.h: leave __LIBARCHIVE_TEST up to individual test files
Roman Neuhauser [Sat, 9 Apr 2011 08:07:04 +0000 (04:07 -0400)] 
test.h: leave __LIBARCHIVE_TEST up to individual test files

per Tim's request, tests should be very explicit about using
libarchive's internals.

SVN-Revision: 3190

15 years agotest_archive_string.c: drop assertEqualArchiveString
Roman Neuhauser [Sat, 9 Apr 2011 08:06:57 +0000 (04:06 -0400)] 
test_archive_string.c: drop assertEqualArchiveString

the interesting bit about the archive_string* returning functions
is the returned address (these must return their first argument),
the value pointed at is tested separately.

SVN-Revision: 3189

15 years agoAdd a filename encoding test for zip.
Michihiro NAKAJIMA [Sat, 9 Apr 2011 06:52:32 +0000 (02:52 -0400)] 
Add a filename encoding test for zip.

SVN-Revision: 3188

15 years agoChoose the charset described in the archive file when it's available even if hdrchars...
Michihiro NAKAJIMA [Sat, 9 Apr 2011 04:10:02 +0000 (00:10 -0400)] 
Choose the charset described in the archive file when it's available even if hdrcharset option is used.

SVN-Revision: 3187

15 years agoCorrectly get the OEM CodePage(OEMCP) of the current locale set by setlocale().
Michihiro NAKAJIMA [Sat, 9 Apr 2011 03:23:24 +0000 (23:23 -0400)] 
Correctly get the OEM CodePage(OEMCP) of the current locale set by setlocale().
GetOEMCP() returns system default OEMCP not current locale's.

SVN-Revision: 3186

15 years agoUse of mbrtowc/wcrtomb is slower than use of WideCharToMultiByte/MultiByteToWideChar.
Michihiro NAKAJIMA [Fri, 8 Apr 2011 14:53:15 +0000 (10:53 -0400)] 
Use of mbrtowc/wcrtomb is slower than use of WideCharToMultiByte/MultiByteToWideChar.
So we should use WideCharToMultiByte/MultiByteToWideChar and
simulate CRT mbrtowc/wcrtomb handling in "C" locale.

SVN-Revision: 3185

15 years agoPax format uses only both BINARY and UTF-8 to its header data.
Michihiro NAKAJIMA [Fri, 8 Apr 2011 14:41:17 +0000 (10:41 -0400)] 
Pax format uses only both BINARY and UTF-8 to its header data.
So we should not overwrite it by the hdrcharset option.

SVN-Revision: 3184

15 years agoFollowing tests are now for all platform not only Windows.
Michihiro NAKAJIMA [Fri, 8 Apr 2011 11:58:02 +0000 (07:58 -0400)] 
Following tests are now for all platform not only Windows.
  test_read_format_zip_filename_CP932_CP932
  test_read_format_zip_filename_UTF8_CP932
  test_read_format_zip_filename_CP866_CP1251
  test_read_format_zip_filename_KOI8R_CP1251
  test_read_format_zip_filename_UTF8_CP1251

SVN-Revision: 3183

15 years agoSimplify sparse test code.
Michihiro NAKAJIMA [Fri, 8 Apr 2011 09:44:52 +0000 (05:44 -0400)] 
Simplify sparse test code.
Avoid the effect of current locale state to the current working directory in multi-byte name
for the directory traversals on Windows.

SVN-Revision: 3182

15 years agoUse of archive_strcat() in archive_string_append_from_wcs_to_mbs() is slightly ineffi...
Michihiro NAKAJIMA [Fri, 8 Apr 2011 08:59:20 +0000 (04:59 -0400)] 
Use of archive_strcat() in archive_string_append_from_wcs_to_mbs() is slightly inefficient.
We can trust a contents of buffer, so we should use archive_string_append() instead.

SVN-Revision: 3181

15 years agoOn Windows Correctly handle a directory file at archive_read_disk_entry_from_file().
Michihiro NAKAJIMA [Fri, 8 Apr 2011 08:23:15 +0000 (04:23 -0400)] 
On Windows Correctly handle a directory file at archive_read_disk_entry_from_file().

SVN-Revision: 3180

15 years agoUse mbstowcs() at __la_win_permissive_name() instead of MultiByteToWideChar() with...
Michihiro NAKAJIMA [Fri, 8 Apr 2011 07:45:20 +0000 (03:45 -0400)] 
Use mbstowcs() at __la_win_permissive_name() instead of MultiByteToWideChar() with CP_ACP, and
Reduce the effect of locale from the functions which used __la_win_permissive_name().

SVN-Revision: 3179

15 years agoOn Windows, Improve a conversion MBS<==>WCS to be related with setlocale().
Michihiro NAKAJIMA [Fri, 8 Apr 2011 06:37:01 +0000 (02:37 -0400)] 
On Windows, Improve a conversion MBS<==>WCS to be related with setlocale().
use of _get_current_locale() was good but msys does not provide, use of CP_ACP
mostly worked well but it ignored the locale set by setlocale().
I was finding the best solution for that issue and I finally found that
setlocale(LC_CTYPE, NULL) always returned current CodePage like this
"English_United States.1252", so we can get the current CodePage through
setlocale().

SVN-Revision: 3178

15 years agoAdd filenames conversion tests for Windows.
Michihiro NAKAJIMA [Thu, 7 Apr 2011 16:26:12 +0000 (12:26 -0400)] 
Add filenames conversion tests for Windows.
We have to check WCS(UTF-16) filenames for those tests because MBS
byte sequence cab be different if the current locale is different.
For example, MBS in CP932 can together describe CP866 by using
escape sequence so you can see a CP866 specific character in non
CP866 CodePage but cannot compare byte sequence to formal CP866 byte
sequence because of the escape sequence.

SVN-Revision: 3177

15 years agoAdd some test for zip reader.
Michihiro NAKAJIMA [Thu, 7 Apr 2011 14:17:14 +0000 (10:17 -0400)] 
Add some test for zip reader.
 - read Russian filenames in KOI8-R.
 - read Russian filenames in CP866.
 - read Russian filenames in UTF-8.

SVN-Revision: 3176

15 years agoThe filenames in pax should be written in UTF-8 without hdrcharset=UTF-8 option.
Michihiro NAKAJIMA [Thu, 7 Apr 2011 12:01:19 +0000 (08:01 -0400)] 
The filenames in pax should be written in UTF-8 without hdrcharset=UTF-8 option.

SVN-Revision: 3175

15 years agoRemove old, redundant test code.
Michihiro NAKAJIMA [Thu, 7 Apr 2011 11:49:02 +0000 (07:49 -0400)] 
Remove old, redundant test code.

SVN-Revision: 3174

15 years agoUpdate Windows CodePage look-up table.
Michihiro NAKAJIMA [Thu, 7 Apr 2011 10:27:14 +0000 (06:27 -0400)] 
Update Windows CodePage look-up table.

SVN-Revision: 3173

15 years agoIntroduce
Michihiro NAKAJIMA [Thu, 7 Apr 2011 09:52:51 +0000 (05:52 -0400)] 
Introduce
   archive_string_default_conversion_for_read() and
   archive_string_default_conversion_for_write()
for conversion CP_ACP <==> CP_OEMCP(as charset for archive file) on Windows platform.
Those functions on non-Windows platform always return NULL.

SVN-Revision: 3172

15 years agoDrop a use of CRL function _get_current_locale(), which msys does not provide.
Michihiro NAKAJIMA [Thu, 7 Apr 2011 06:14:23 +0000 (02:14 -0400)] 
Drop a use of CRL function _get_current_locale(), which msys does not provide.
We should use GetACP() instead. This is simple and fast, and would work well
for the application using libarchive.
I changed my idea it is better that a use of GetOEMCP() is only in reader and writer.

SVN-Revision: 3171

15 years agoAllow hdrcharset=UTF-8 to pax writer because libarchive_test needs that for its test...
Michihiro NAKAJIMA [Thu, 7 Apr 2011 05:47:08 +0000 (01:47 -0400)] 
Allow hdrcharset=UTF-8 to pax writer because libarchive_test needs that for its test to check
if the running platform support the string conversion or not.

SVN-Revision: 3170

15 years agoUnbreak build on msys.
Michihiro NAKAJIMA [Wed, 6 Apr 2011 13:04:12 +0000 (09:04 -0400)] 
Unbreak build on msys.

SVN-Revision: 3169

15 years agoCopy lib-link.m4,lib-prefix.m4 and lib-ld.m4 from
Michihiro NAKAJIMA [Wed, 6 Apr 2011 10:42:46 +0000 (06:42 -0400)] 
Copy lib-link.m4,lib-prefix.m4 and lib-ld.m4 from
http://git.savannah.gnu.org/cgit/gnulib.git/tree/m4 into build/autoconf
so that iconv.m4 can be used without error on Ubuntu or other platforms.

SVN-Revision: 3168

15 years agoRename archive_string_append_from_unicode_to_mbs back to archive_string_append_from_w...
Michihiro NAKAJIMA [Wed, 6 Apr 2011 05:25:24 +0000 (01:25 -0400)] 
Rename archive_string_append_from_unicode_to_mbs back to archive_string_append_from_wcs_to_mbs
since we have changed the handling of WCS. we are free from WCS format.

SVN-Revision: 3167

15 years agoSimply choose a header encoding on pax writer.
Michihiro NAKAJIMA [Wed, 6 Apr 2011 05:07:14 +0000 (01:07 -0400)] 
Simply choose a header encoding on pax writer.
Do not initialize a string conversion object if unneeded.

SVN-Revision: 3166

15 years agoRename "charset" option to "hdrcharset" since the name "charset" is not clear,
Michihiro NAKAJIMA [Wed, 6 Apr 2011 04:31:40 +0000 (00:31 -0400)] 
Rename "charset" option to "hdrcharset" since the name "charset" is not clear,
in particular reading or writing pax format, the "charset" option can be used to
a content of the file stored in pax archive file, and then "hdrcharset" described
for its metadata such as filename.

SVN-Revision: 3165

15 years agotest_archive_string.c tests archive_string_sprintf a bit
Roman Neuhauser [Mon, 4 Apr 2011 22:32:58 +0000 (18:32 -0400)] 
test_archive_string.c tests archive_string_sprintf a bit

mostly concerned with storage allocation

SVN-Revision: 3164

15 years agotest_archive_string.c tests archive_strncpy
Roman Neuhauser [Mon, 4 Apr 2011 22:32:52 +0000 (18:32 -0400)] 
test_archive_string.c tests archive_strncpy

SVN-Revision: 3163

15 years agotest_archive_string.c: tests for some archive_string operations
Roman Neuhauser [Mon, 4 Apr 2011 11:36:36 +0000 (07:36 -0400)] 
test_archive_string.c: tests for some archive_string operations

SVN-Revision: 3162

15 years agoarchive_read_support_format_xar.c: multiple fixes based on Tim's comments
Roman Neuhauser [Mon, 4 Apr 2011 11:36:14 +0000 (07:36 -0400)] 
archive_read_support_format_xar.c: multiple fixes based on Tim's comments

* various helper functions take archive_read* so that they can
  call archive_set_error()
* the expat-based TOC parser should now behave correctly on errors

SVN-Revision: 3161

15 years agoarchive_read_support_format_tar.c: fix looming buffer overflow
Roman Neuhauser [Mon, 4 Apr 2011 11:35:46 +0000 (07:35 -0400)] 
archive_read_support_format_tar.c: fix looming buffer overflow

plus:

* archive_set_error right at failure
* gnu_add_sparse_entry is a function again

SVN-Revision: 3160

15 years agoarchive_read_support_format_cpio.c: archive_set_error right at failure
Roman Neuhauser [Mon, 4 Apr 2011 11:35:35 +0000 (07:35 -0400)] 
archive_read_support_format_cpio.c: archive_set_error right at failure

record_hardlink() calls archive_set_error() itself

SVN-Revision: 3159

15 years agoarchive_read_support_format_iso9660.c: plug looming buffer overflows
Roman Neuhauser [Mon, 4 Apr 2011 11:35:09 +0000 (07:35 -0400)] 
archive_read_support_format_iso9660.c: plug looming buffer overflows

all heap_add_entry(), add_entry() and relocate_dir() calls are
checked now.

heap_add_entry() takes archive_read* and calls archive_set_error()
itself so that error reporting sits right next to the error cause.

SVN-Revision: 3158

15 years agoremove archive_read_get_bidder macro again
Roman Neuhauser [Mon, 4 Apr 2011 11:34:24 +0000 (07:34 -0400)] 
remove archive_read_get_bidder macro again

Tim dislikes the hidden return statement

SVN-Revision: 3157

15 years agoGive the API caller a memory allocation failure of a string conversion object by...
Michihiro NAKAJIMA [Mon, 4 Apr 2011 07:12:16 +0000 (03:12 -0400)] 
Give the API caller a memory allocation failure of a string conversion object by returning ARCHIVE_FATAL
instead of use of __archive_errx().

SVN-Revision: 3156

15 years agoThis change almost revert r3148,r3149 because of my misunderstanding.
Michihiro NAKAJIMA [Mon, 4 Apr 2011 05:54:44 +0000 (01:54 -0400)] 
This change almost revert r3148,r3149 because of my misunderstanding.
We should use both BINARY and UTF-8(default) only to a charset for PAX header.
- Pax writer allow charset=BINARY option only.
- For Reader side, Pax header encoding does not affect other tar header, and
  Pax header parser allow only both BINARY and "ISO-IR 10646 2000 UTF-8" for hdrcharset.

SVN-Revision: 3155

15 years agoIf someone disables ENABLE_ACL or ENABLE_XATTR, we need
Tim Kientzle [Sun, 3 Apr 2011 18:31:04 +0000 (14:31 -0400)] 
If someone disables ENABLE_ACL or ENABLE_XATTR, we need
to override the cached values for the various ACL orn
xattr functions.

SVN-Revision: 3154

15 years agoChange the charset to codepage translation to be
Tim Kientzle [Sun, 3 Apr 2011 17:46:04 +0000 (13:46 -0400)] 
Change the charset to codepage translation to be
(mostly) just a lookup table.

SVN-Revision: 3153

15 years agoAdd a few charset to be translated into Windows codepage.
Michihiro NAKAJIMA [Sun, 3 Apr 2011 13:25:34 +0000 (09:25 -0400)] 
Add a few charset to be translated into Windows codepage.

SVN-Revision: 3152

15 years agoProperly check a character-set name in hdrcharset of pax header.
Michihiro NAKAJIMA [Sat, 2 Apr 2011 05:37:48 +0000 (01:37 -0400)] 
Properly check a character-set name in hdrcharset of pax header.

SVN-Revision: 3149

15 years agoAccording to IEEE Std 1003.1-2001, we can use following charset to pax writer.
Michihiro NAKAJIMA [Sat, 2 Apr 2011 05:10:30 +0000 (01:10 -0400)] 
According to IEEE Std 1003.1-2001, we can use following charset to pax writer.
 UTF-8
 BINARY
 ISO-8859-1  ISO8859-1
 ISO-8859-2  ISO8859-2
 ISO-8859-3  ISO8859-3
 ISO-8859-4  ISO8859-4
 ISO-8859-5  ISO8859-5
 ISO-8859-6  ISO8859-6
 ISO-8859-7  ISO8859-7
 ISO-8859-8  ISO8859-8
 ISO-8859-9  ISO8859-9
 ISO-8859-10 ISO8859-10
 ISO-8859-13 ISO8859-13
 ISO-8859-14 ISO8859-14
 ISO-8859-15 ISO8859-15

We should not allow other charset to a charset option of pax writer.

SVN-Revision: 3148

15 years agoFix a replacement of Windows path separator in CP932 locale.
Michihiro NAKAJIMA [Fri, 1 Apr 2011 12:07:43 +0000 (08:07 -0400)] 
Fix a replacement of Windows path separator in CP932 locale.
And update related comment.

SVN-Revision: 3147

15 years agoAdd a new line to the end of archive_read_disk_entry_from_file.c to avoid build error.
Michihiro NAKAJIMA [Fri, 1 Apr 2011 08:21:30 +0000 (04:21 -0400)] 
Add a new line to the end of archive_read_disk_entry_from_file.c to avoid build error.

SVN-Revision: 3146

15 years agoImprove the windows version of archive_read_disk_entry_from_file() to avoid using...
Michihiro NAKAJIMA [Fri, 1 Apr 2011 06:04:40 +0000 (02:04 -0400)] 
Improve the windows version of archive_read_disk_entry_from_file() to avoid using stat() family.
- Transfer the windows version of archive_read_disk_entry_from_file() into
  archive_read_disk_windows.c because there are same utility functions in
  archive_read_disk_windows.c and calling archive_read_disk_entry_from_file() from
  directory traversals is inefficient through its API.
- Use WCS for pathname to exceed the PATH_MAX limitation.
- Properly detect if the file is symbolic linked file like lstat().

SVN-Revision: 3145

15 years agoCorrect a type of a file offset;s/off_t/int64_t/
Michihiro NAKAJIMA [Fri, 1 Apr 2011 05:30:18 +0000 (01:30 -0400)] 
Correct a type of a file offset;s/off_t/int64_t/

SVN-Revision: 3144

15 years agoIf futimens() defined in POSIX.1-2008 is available, use it for linux.
Michihiro NAKAJIMA [Thu, 31 Mar 2011 05:29:45 +0000 (01:29 -0400)] 
If futimens() defined in POSIX.1-2008 is available, use it for linux.

SVN-Revision: 3140

15 years agoDetect futimesat.
Michihiro NAKAJIMA [Thu, 31 Mar 2011 02:05:06 +0000 (22:05 -0400)] 
Detect futimesat.

SVN-Revision: 3139

15 years agoarchive_write_set_format_pax.c: s/__archive_errx/archive_set_error/
Roman Neuhauser [Wed, 30 Mar 2011 21:43:11 +0000 (17:43 -0400)] 
archive_write_set_format_pax.c: s/__archive_errx/archive_set_error/

SVN-Revision: 3138

15 years agoarchive_write_set_format_pax.c: s/__archive_errx/archive_set_error/
Roman Neuhauser [Wed, 30 Mar 2011 21:43:05 +0000 (17:43 -0400)] 
archive_write_set_format_pax.c: s/__archive_errx/archive_set_error/

SVN-Revision: 3137

15 years agoarchive_read_support_format_tar.c: s/__archive_errx/archive_set_error/
Roman Neuhauser [Wed, 30 Mar 2011 21:42:58 +0000 (17:42 -0400)] 
archive_read_support_format_tar.c: s/__archive_errx/archive_set_error/

SVN-Revision: 3136

15 years agoarchive_write_set_format_shar.c: s/__archive_errx/archive_set_error/
Roman Neuhauser [Wed, 30 Mar 2011 21:42:52 +0000 (17:42 -0400)] 
archive_write_set_format_shar.c: s/__archive_errx/archive_set_error/

SVN-Revision: 3135

15 years agoarchive_read_support_format_iso9660.c: s/__archive_errx/archive_set_error/
Roman Neuhauser [Wed, 30 Mar 2011 21:42:45 +0000 (17:42 -0400)] 
archive_read_support_format_iso9660.c: s/__archive_errx/archive_set_error/

SVN-Revision: 3134

15 years agoarchive_read_support_format_cpio.c: s/__archive_errx/archive_set_error/
Roman Neuhauser [Wed, 30 Mar 2011 21:42:38 +0000 (17:42 -0400)] 
archive_read_support_format_cpio.c: s/__archive_errx/archive_set_error/

SVN-Revision: 3133

15 years agoarchive_read.c: s/__archive_errx/archive_set_error/
Roman Neuhauser [Wed, 30 Mar 2011 21:42:29 +0000 (17:42 -0400)] 
archive_read.c: s/__archive_errx/archive_set_error/

the last two calls were in __archive_read_get_bidder() and
__archive_read_register_format().  __archive_read_get_bidder()
required a change in interface (not really, but if it calls
archive_set_error(), it should return ARCHIVE_*); i added
a wrapper macro ala archive_check_magic() to keep it DRY.

some but not all archive_read_support_compression_*() functions
called archive_clear_error() right after __archive_read_get_bidder.
the reason isn't clear to me and no tests break without these
calls, so i've removed them.

SVN-Revision: 3132

15 years agoarchive_read.c: s/__archive_errx/archive_set_error/ in tested code
Roman Neuhauser [Wed, 30 Mar 2011 21:42:24 +0000 (17:42 -0400)] 
archive_read.c: s/__archive_errx/archive_set_error/ in tested code

'Fatal Internal Error' abort -> ARCHIVE_FATAL

SVN-Revision: 3131

15 years agotest argument handling in archive_read_open2
Roman Neuhauser [Wed, 30 Mar 2011 21:42:16 +0000 (17:42 -0400)] 
test argument handling in archive_read_open2

results in aborts when archive_read_callback == NULL

SVN-Revision: 3130

15 years agoconfig.h.in~ should not be versioned
Roman Neuhauser [Wed, 30 Mar 2011 21:42:10 +0000 (17:42 -0400)] 
config.h.in~ should not be versioned

SVN-Revision: 3129

15 years agoCorrect a print format of test failure log for file times. its type is `long long...
Michihiro NAKAJIMA [Wed, 30 Mar 2011 12:55:58 +0000 (08:55 -0400)] 
Correct a print format of test failure log for file times. its type is `long long' not `long'.

SVN-Revision: 3128

15 years agoarchive_string.c: 2x uninitialized variable in utf16 conversions
Roman Neuhauser [Wed, 30 Mar 2011 08:43:16 +0000 (04:43 -0400)] 
archive_string.c: 2x uninitialized variable in utf16 conversions

hopefully this is the right fix; tests pass here

SVN-Revision: 3127

15 years agoOn Windows, use _fseeki64() instead of fseek() for 64 bits file access.
Michihiro NAKAJIMA [Tue, 29 Mar 2011 11:13:48 +0000 (07:13 -0400)] 
On Windows, use _fseeki64() instead of fseek() for 64 bits file access.

SVN-Revision: 3123

15 years agoRemove unused definitions in archive_windows.h
Michihiro NAKAJIMA [Tue, 29 Mar 2011 10:56:21 +0000 (06:56 -0400)] 
Remove unused definitions in archive_windows.h

SVN-Revision: 3122

15 years agoGet the current codepage through _get_current_locale() and use it for
Michihiro NAKAJIMA [Tue, 29 Mar 2011 10:35:13 +0000 (06:35 -0400)] 
Get the current codepage through _get_current_locale() and use it for
MultiByteToWideChar and WideCharToMultiByte instead of CP_OEMCP or CP_ACP.
This simulates the CRT version of mbrtowc/wcrtomb.

SVN-Revision: 3121

15 years agoSpace ==> Tab.
Michihiro NAKAJIMA [Tue, 29 Mar 2011 09:12:07 +0000 (05:12 -0400)] 
Space ==> Tab.

SVN-Revision: 3120

15 years agoOn Windows, improve a replacement of '\' character to reduce use of mbrtowc.
Michihiro NAKAJIMA [Tue, 29 Mar 2011 09:11:10 +0000 (05:11 -0400)] 
On Windows, improve a replacement of  '\' character to reduce use of mbrtowc.

SVN-Revision: 3119

15 years agoUse of mbrtowc is wasteful to check if all MBS can be converted to WCS On Windows.
Michihiro NAKAJIMA [Tue, 29 Mar 2011 08:56:45 +0000 (04:56 -0400)] 
Use of mbrtowc is wasteful to check if all MBS can be converted to WCS On Windows.
So we should directly use MultiByteToWideChar for performance.

SVN-Revision: 3118