libarchive-static 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/Makefile +6 -0
- data/ext/extconf.rb +61 -0
- data/ext/libarchive-0.1.1/COPYING.libarchive +60 -0
- data/ext/libarchive-0.1.1/LICENSE.libbzip2 +42 -0
- data/ext/libarchive-0.1.1/README.txt +143 -0
- data/ext/libarchive-0.1.1/ext/Makefile.in +0 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +31 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.c +32 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +29 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +32 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.h +6 -0
- data/ext/libarchive-0.1.1/ext/config.h.in +22 -0
- data/ext/libarchive-0.1.1/ext/configure +3904 -0
- data/ext/libarchive-0.1.1/ext/configure.in +11 -0
- data/ext/libarchive-0.1.1/ext/depend +19 -0
- data/ext/libarchive-0.1.1/ext/extconf.rb +6 -0
- data/ext/libarchive-0.1.1/ext/install-sh +250 -0
- data/ext/libarchive-0.1.1/ext/libarchive.c +89 -0
- data/ext/libarchive-0.1.1/ext/libarchive_archive.c +84 -0
- data/ext/libarchive-0.1.1/ext/libarchive_entry.c +1015 -0
- data/ext/libarchive-0.1.1/ext/libarchive_internal.h +155 -0
- data/ext/libarchive-0.1.1/ext/libarchive_reader.c +328 -0
- data/ext/libarchive-0.1.1/ext/libarchive_win32.h +52 -0
- data/ext/libarchive-0.1.1/ext/libarchive_writer.c +246 -0
- data/ext/libarchive-0.1.1/libarchive.c +1762 -0
- data/ext/libarchive-2.8.4/Makefile.in +7076 -0
- data/ext/libarchive-2.8.4/build/autoconf/check_stdcall_func.m4 +51 -0
- data/ext/libarchive-2.8.4/build/autoconf/compile +143 -0
- data/ext/libarchive-2.8.4/build/autoconf/config.guess +1502 -0
- data/ext/libarchive-2.8.4/build/autoconf/config.sub +1708 -0
- data/ext/libarchive-2.8.4/build/autoconf/depcomp +630 -0
- data/ext/libarchive-2.8.4/build/autoconf/install-sh +291 -0
- data/ext/libarchive-2.8.4/build/autoconf/la_uid_t.m4 +20 -0
- data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +8406 -0
- data/ext/libarchive-2.8.4/build/autoconf/missing +376 -0
- data/ext/libarchive-2.8.4/build/pkgconfig/libarchive.pc.in +10 -0
- data/ext/libarchive-2.8.4/config.h.in +772 -0
- data/ext/libarchive-2.8.4/configure +17916 -0
- data/ext/libarchive-2.8.4/libarchive/archive.h +741 -0
- data/ext/libarchive-2.8.4/libarchive/archive_check_magic.c +134 -0
- data/ext/libarchive-2.8.4/libarchive/archive_crc32.h +66 -0
- data/ext/libarchive-2.8.4/libarchive/archive_endian.h +162 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry.c +2202 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry.h +524 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_bhfi.c +74 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_stat.c +77 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_link_resolver.c +405 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_private.h +184 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_stat.c +118 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_strmode.c +87 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_xattr.c +158 -0
- data/ext/libarchive-2.8.4/libarchive/archive_hash.h +281 -0
- data/ext/libarchive-2.8.4/libarchive/archive_platform.h +165 -0
- data/ext/libarchive-2.8.4/libarchive/archive_private.h +124 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read.c +1249 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_data_into_fd.c +93 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +198 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +570 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_private.h +62 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_set_standard_lookup.c +303 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_extract.c +182 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_fd.c +190 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_file.c +165 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +272 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_memory.c +156 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_private.h +199 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_all.c +60 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c +353 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c +444 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c +465 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_none.c +40 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_program.c +459 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c +287 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c +627 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c +708 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_all.c +43 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_ar.c +584 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +777 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_empty.c +93 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_iso9660.c +2830 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +1304 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_raw.c +185 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_tar.c +2418 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_xar.c +3151 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +903 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string.c +453 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string.h +148 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string_sprintf.c +164 -0
- data/ext/libarchive-2.8.4/libarchive/archive_util.c +391 -0
- data/ext/libarchive-2.8.4/libarchive/archive_virtual.c +94 -0
- data/ext/libarchive-2.8.4/libarchive/archive_windows.c +1236 -0
- data/ext/libarchive-2.8.4/libarchive/archive_windows.h +347 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write.c +466 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +2628 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk_private.h +38 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk_set_standard_lookup.c +262 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_fd.c +141 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_file.c +105 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_filename.c +162 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_memory.c +126 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_private.h +122 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +408 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c +492 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +477 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +257 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +347 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +438 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format.c +72 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ar.c +550 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_by_name.c +76 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +344 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +295 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +1050 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_pax.c +1386 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_shar.c +626 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ustar.c +587 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +667 -0
- data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +154 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork.c +161 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork.h +41 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +113 -0
- data/ext/libarchive-static-makefile +80 -0
- data/ext/libarchive-static-wrapper-makefile +22 -0
- data/ext/zlib-1.2.5/Makefile.in +257 -0
- data/ext/zlib-1.2.5/adler32.c +169 -0
- data/ext/zlib-1.2.5/compress.c +80 -0
- data/ext/zlib-1.2.5/configure +596 -0
- data/ext/zlib-1.2.5/crc32.c +442 -0
- data/ext/zlib-1.2.5/crc32.h +441 -0
- data/ext/zlib-1.2.5/deflate.c +1834 -0
- data/ext/zlib-1.2.5/deflate.h +342 -0
- data/ext/zlib-1.2.5/example.c +565 -0
- data/ext/zlib-1.2.5/gzclose.c +25 -0
- data/ext/zlib-1.2.5/gzguts.h +132 -0
- data/ext/zlib-1.2.5/gzlib.c +537 -0
- data/ext/zlib-1.2.5/gzread.c +653 -0
- data/ext/zlib-1.2.5/gzwrite.c +531 -0
- data/ext/zlib-1.2.5/infback.c +632 -0
- data/ext/zlib-1.2.5/inffast.c +340 -0
- data/ext/zlib-1.2.5/inffast.h +11 -0
- data/ext/zlib-1.2.5/inffixed.h +94 -0
- data/ext/zlib-1.2.5/inflate.c +1480 -0
- data/ext/zlib-1.2.5/inflate.h +122 -0
- data/ext/zlib-1.2.5/inftrees.c +330 -0
- data/ext/zlib-1.2.5/inftrees.h +62 -0
- data/ext/zlib-1.2.5/minigzip.c +440 -0
- data/ext/zlib-1.2.5/trees.c +1244 -0
- data/ext/zlib-1.2.5/trees.h +128 -0
- data/ext/zlib-1.2.5/uncompr.c +59 -0
- data/ext/zlib-1.2.5/zconf.h +428 -0
- data/ext/zlib-1.2.5/zlib.h +1613 -0
- data/ext/zlib-1.2.5/zutil.c +318 -0
- data/ext/zlib-1.2.5/zutil.h +274 -0
- metadata +211 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
/*-
|
2
|
+
* Copyright (c) 2003-2007 Tim Kientzle
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
6
|
+
* modification, are permitted provided that the following conditions
|
7
|
+
* are met:
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
13
|
+
*
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
15
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
16
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
17
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
18
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
19
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
20
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
21
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
22
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
23
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24
|
+
*/
|
25
|
+
|
26
|
+
#include "archive_platform.h"
|
27
|
+
__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_data_into_fd.c,v 1.16 2008/05/23 05:01:29 cperciva Exp $");
|
28
|
+
|
29
|
+
#ifdef HAVE_SYS_TYPES_H
|
30
|
+
#include <sys/types.h>
|
31
|
+
#endif
|
32
|
+
#ifdef HAVE_ERRNO_H
|
33
|
+
#include <errno.h>
|
34
|
+
#endif
|
35
|
+
#ifdef HAVE_UNISTD_H
|
36
|
+
#include <unistd.h>
|
37
|
+
#endif
|
38
|
+
|
39
|
+
#include "archive.h"
|
40
|
+
#include "archive_private.h"
|
41
|
+
|
42
|
+
/* Maximum amount of data to write at one time. */
|
43
|
+
#define MAX_WRITE (1024 * 1024)
|
44
|
+
|
45
|
+
/*
|
46
|
+
* This implementation minimizes copying of data and is sparse-file aware.
|
47
|
+
*/
|
48
|
+
int
|
49
|
+
archive_read_data_into_fd(struct archive *a, int fd)
|
50
|
+
{
|
51
|
+
int r;
|
52
|
+
const void *buff;
|
53
|
+
size_t size, bytes_to_write;
|
54
|
+
ssize_t bytes_written, total_written;
|
55
|
+
off_t offset;
|
56
|
+
off_t output_offset;
|
57
|
+
|
58
|
+
__archive_check_magic(a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_DATA, "archive_read_data_into_fd");
|
59
|
+
|
60
|
+
total_written = 0;
|
61
|
+
output_offset = 0;
|
62
|
+
|
63
|
+
while ((r = archive_read_data_block(a, &buff, &size, &offset)) ==
|
64
|
+
ARCHIVE_OK) {
|
65
|
+
const char *p = buff;
|
66
|
+
if (offset > output_offset) {
|
67
|
+
output_offset = lseek(fd,
|
68
|
+
offset - output_offset, SEEK_CUR);
|
69
|
+
if (output_offset != offset) {
|
70
|
+
archive_set_error(a, errno, "Seek error");
|
71
|
+
return (ARCHIVE_FATAL);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
while (size > 0) {
|
75
|
+
bytes_to_write = size;
|
76
|
+
if (bytes_to_write > MAX_WRITE)
|
77
|
+
bytes_to_write = MAX_WRITE;
|
78
|
+
bytes_written = write(fd, p, bytes_to_write);
|
79
|
+
if (bytes_written < 0) {
|
80
|
+
archive_set_error(a, errno, "Write error");
|
81
|
+
return (ARCHIVE_FATAL);
|
82
|
+
}
|
83
|
+
output_offset += bytes_written;
|
84
|
+
total_written += bytes_written;
|
85
|
+
p += bytes_written;
|
86
|
+
size -= bytes_written;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
if (r != ARCHIVE_EOF)
|
91
|
+
return (r);
|
92
|
+
return (ARCHIVE_OK);
|
93
|
+
}
|
@@ -0,0 +1,198 @@
|
|
1
|
+
/*-
|
2
|
+
* Copyright (c) 2003-2009 Tim Kientzle
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
6
|
+
* modification, are permitted provided that the following conditions
|
7
|
+
* are met:
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
9
|
+
* notice, this list of conditions and the following disclaimer
|
10
|
+
* in this position and unchanged.
|
11
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer in the
|
13
|
+
* documentation and/or other materials provided with the distribution.
|
14
|
+
*
|
15
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
16
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
17
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
18
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
19
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
20
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
21
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
22
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
24
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#include "archive_platform.h"
|
28
|
+
__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk.c 189429 2009-03-06 04:35:31Z kientzle $");
|
29
|
+
|
30
|
+
#include "archive.h"
|
31
|
+
#include "archive_string.h"
|
32
|
+
#include "archive_entry.h"
|
33
|
+
#include "archive_private.h"
|
34
|
+
#include "archive_read_disk_private.h"
|
35
|
+
|
36
|
+
static int _archive_read_finish(struct archive *);
|
37
|
+
static int _archive_read_close(struct archive *);
|
38
|
+
static const char *trivial_lookup_gname(void *, gid_t gid);
|
39
|
+
static const char *trivial_lookup_uname(void *, uid_t uid);
|
40
|
+
|
41
|
+
static struct archive_vtable *
|
42
|
+
archive_read_disk_vtable(void)
|
43
|
+
{
|
44
|
+
static struct archive_vtable av;
|
45
|
+
static int inited = 0;
|
46
|
+
|
47
|
+
if (!inited) {
|
48
|
+
av.archive_finish = _archive_read_finish;
|
49
|
+
av.archive_close = _archive_read_close;
|
50
|
+
}
|
51
|
+
return (&av);
|
52
|
+
}
|
53
|
+
|
54
|
+
const char *
|
55
|
+
archive_read_disk_gname(struct archive *_a, gid_t gid)
|
56
|
+
{
|
57
|
+
struct archive_read_disk *a = (struct archive_read_disk *)_a;
|
58
|
+
if (a->lookup_gname != NULL)
|
59
|
+
return ((*a->lookup_gname)(a->lookup_gname_data, gid));
|
60
|
+
return (NULL);
|
61
|
+
}
|
62
|
+
|
63
|
+
const char *
|
64
|
+
archive_read_disk_uname(struct archive *_a, uid_t uid)
|
65
|
+
{
|
66
|
+
struct archive_read_disk *a = (struct archive_read_disk *)_a;
|
67
|
+
if (a->lookup_uname != NULL)
|
68
|
+
return ((*a->lookup_uname)(a->lookup_uname_data, uid));
|
69
|
+
return (NULL);
|
70
|
+
}
|
71
|
+
|
72
|
+
int
|
73
|
+
archive_read_disk_set_gname_lookup(struct archive *_a,
|
74
|
+
void *private_data,
|
75
|
+
const char * (*lookup_gname)(void *private, gid_t gid),
|
76
|
+
void (*cleanup_gname)(void *private))
|
77
|
+
{
|
78
|
+
struct archive_read_disk *a = (struct archive_read_disk *)_a;
|
79
|
+
__archive_check_magic(&a->archive, ARCHIVE_READ_DISK_MAGIC,
|
80
|
+
ARCHIVE_STATE_ANY, "archive_read_disk_set_gname_lookup");
|
81
|
+
|
82
|
+
if (a->cleanup_gname != NULL && a->lookup_gname_data != NULL)
|
83
|
+
(a->cleanup_gname)(a->lookup_gname_data);
|
84
|
+
|
85
|
+
a->lookup_gname = lookup_gname;
|
86
|
+
a->cleanup_gname = cleanup_gname;
|
87
|
+
a->lookup_gname_data = private_data;
|
88
|
+
return (ARCHIVE_OK);
|
89
|
+
}
|
90
|
+
|
91
|
+
int
|
92
|
+
archive_read_disk_set_uname_lookup(struct archive *_a,
|
93
|
+
void *private_data,
|
94
|
+
const char * (*lookup_uname)(void *private, uid_t uid),
|
95
|
+
void (*cleanup_uname)(void *private))
|
96
|
+
{
|
97
|
+
struct archive_read_disk *a = (struct archive_read_disk *)_a;
|
98
|
+
__archive_check_magic(&a->archive, ARCHIVE_READ_DISK_MAGIC,
|
99
|
+
ARCHIVE_STATE_ANY, "archive_read_disk_set_uname_lookup");
|
100
|
+
|
101
|
+
if (a->cleanup_uname != NULL && a->lookup_uname_data != NULL)
|
102
|
+
(a->cleanup_uname)(a->lookup_uname_data);
|
103
|
+
|
104
|
+
a->lookup_uname = lookup_uname;
|
105
|
+
a->cleanup_uname = cleanup_uname;
|
106
|
+
a->lookup_uname_data = private_data;
|
107
|
+
return (ARCHIVE_OK);
|
108
|
+
}
|
109
|
+
|
110
|
+
/*
|
111
|
+
* Create a new archive_read_disk object and initialize it with global state.
|
112
|
+
*/
|
113
|
+
struct archive *
|
114
|
+
archive_read_disk_new(void)
|
115
|
+
{
|
116
|
+
struct archive_read_disk *a;
|
117
|
+
|
118
|
+
a = (struct archive_read_disk *)malloc(sizeof(*a));
|
119
|
+
if (a == NULL)
|
120
|
+
return (NULL);
|
121
|
+
memset(a, 0, sizeof(*a));
|
122
|
+
a->archive.magic = ARCHIVE_READ_DISK_MAGIC;
|
123
|
+
/* We're ready to write a header immediately. */
|
124
|
+
a->archive.state = ARCHIVE_STATE_HEADER;
|
125
|
+
a->archive.vtable = archive_read_disk_vtable();
|
126
|
+
a->lookup_uname = trivial_lookup_uname;
|
127
|
+
a->lookup_gname = trivial_lookup_gname;
|
128
|
+
return (&a->archive);
|
129
|
+
}
|
130
|
+
|
131
|
+
static int
|
132
|
+
_archive_read_finish(struct archive *_a)
|
133
|
+
{
|
134
|
+
struct archive_read_disk *a = (struct archive_read_disk *)_a;
|
135
|
+
|
136
|
+
if (a->cleanup_gname != NULL && a->lookup_gname_data != NULL)
|
137
|
+
(a->cleanup_gname)(a->lookup_gname_data);
|
138
|
+
if (a->cleanup_uname != NULL && a->lookup_uname_data != NULL)
|
139
|
+
(a->cleanup_uname)(a->lookup_uname_data);
|
140
|
+
archive_string_free(&a->archive.error_string);
|
141
|
+
free(a);
|
142
|
+
return (ARCHIVE_OK);
|
143
|
+
}
|
144
|
+
|
145
|
+
static int
|
146
|
+
_archive_read_close(struct archive *_a)
|
147
|
+
{
|
148
|
+
(void)_a; /* UNUSED */
|
149
|
+
return (ARCHIVE_OK);
|
150
|
+
}
|
151
|
+
|
152
|
+
int
|
153
|
+
archive_read_disk_set_symlink_logical(struct archive *_a)
|
154
|
+
{
|
155
|
+
struct archive_read_disk *a = (struct archive_read_disk *)_a;
|
156
|
+
a->symlink_mode = 'L';
|
157
|
+
a->follow_symlinks = 1;
|
158
|
+
return (ARCHIVE_OK);
|
159
|
+
}
|
160
|
+
|
161
|
+
int
|
162
|
+
archive_read_disk_set_symlink_physical(struct archive *_a)
|
163
|
+
{
|
164
|
+
struct archive_read_disk *a = (struct archive_read_disk *)_a;
|
165
|
+
a->symlink_mode = 'P';
|
166
|
+
a->follow_symlinks = 0;
|
167
|
+
return (ARCHIVE_OK);
|
168
|
+
}
|
169
|
+
|
170
|
+
int
|
171
|
+
archive_read_disk_set_symlink_hybrid(struct archive *_a)
|
172
|
+
{
|
173
|
+
struct archive_read_disk *a = (struct archive_read_disk *)_a;
|
174
|
+
a->symlink_mode = 'H';
|
175
|
+
a->follow_symlinks = 1; /* Follow symlinks initially. */
|
176
|
+
return (ARCHIVE_OK);
|
177
|
+
}
|
178
|
+
|
179
|
+
/*
|
180
|
+
* Trivial implementations of gname/uname lookup functions.
|
181
|
+
* These are normally overridden by the client, but these stub
|
182
|
+
* versions ensure that we always have something that works.
|
183
|
+
*/
|
184
|
+
static const char *
|
185
|
+
trivial_lookup_gname(void *private_data, gid_t gid)
|
186
|
+
{
|
187
|
+
(void)private_data; /* UNUSED */
|
188
|
+
(void)gid; /* UNUSED */
|
189
|
+
return (NULL);
|
190
|
+
}
|
191
|
+
|
192
|
+
static const char *
|
193
|
+
trivial_lookup_uname(void *private_data, uid_t uid)
|
194
|
+
{
|
195
|
+
(void)private_data; /* UNUSED */
|
196
|
+
(void)uid; /* UNUSED */
|
197
|
+
return (NULL);
|
198
|
+
}
|