1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

clitar: cope with functions of older versions of libarchive

the feature of automatic decompression in extract mode is only supported in
libarchive 3, so we use this only when available now.

The changed config checks for that also fix this bug:

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11296

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Thu Dec  3 16:09:08 CET 2015 on sn-devel-104
This commit is contained in:
Björn Jacke 2015-05-28 14:55:28 +02:00 committed by Bjoern Jacke
parent f25d09a6eb
commit c118fbc680
3 changed files with 16 additions and 5 deletions

View File

@ -720,7 +720,11 @@ out_close:
}
}
out:
#ifdef HAVE_ARCHIVE_READ_FREE
archive_write_free(t->archive);
#else
archive_write_finish(t->archive);
#endif
talloc_free(ctx);
return err;
}
@ -1002,7 +1006,9 @@ static int tar_extract(struct tar *t)
t->archive = archive_read_new();
archive_read_support_format_all(t->archive);
#ifdef HAVE_ARCHIVE_READ_SUPPORT_FILTER_ALL
archive_read_support_filter_all(t->archive);
#endif
if (strequal(t->tar_path, "-")) {
r = archive_read_open_fd(t->archive, STDIN_FILENO, bsize);
@ -1053,7 +1059,11 @@ static int tar_extract(struct tar *t)
}
out:
#ifdef HAVE_ARCHIVE_READ_FREE
r = archive_read_free(t->archive);
#else
r = archive_read_finish(t->archive);
#endif
if (r != ARCHIVE_OK) {
DBG(0, ("Can't close %s : %s\n", t->tar_path,
archive_error_string(t->archive)));

View File

@ -212,14 +212,14 @@ main() {
# check for libarchive (tar command in smbclient)
# None means autodetect, True/False means enable/disable
conf.env['archive_lib'] = ''
conf.SET_TARGET_TYPE('archive', 'EMPTY')
if Options.options.with_libarchive is not False:
libarchive_mandatory = Options.options.with_libarchive == True
Logs.info("Checking for libarchive existence")
if conf.CHECK_BUNDLED_SYSTEM('libarchive', minversion='3.1.2'):
conf.env['archive_lib'] = 'libarchive'
if conf.CHECK_HEADERS('archive.h') and conf.CHECK_LIB('archive', shlib=True):
conf.CHECK_FUNCS_IN('archive_read_support_filter_all archive_read_free', 'archive')
elif libarchive_mandatory:
conf.fatal('libarchive support requested, but no suitable pkgconfig found')
conf.fatal('libarchive support requested, but not found')
# check for DMAPI libs
if Options.options.with_dmapi == False:

View File

@ -1071,7 +1071,8 @@ bld.SAMBA3_BINARY('client/smbclient',
msrpc3
RPC_NDR_SRVSVC
cli_smb_common
''' + bld.env['archive_lib'])
archive
''')
bld.SAMBA3_BINARY('net',
source='''utils/net.c