Compare commits
27 Commits
release-1.
...
release-1.
Author | SHA1 | Date | |
---|---|---|---|
8a752b50fa | |||
c38b1a3a3a | |||
73c9c7f244 | |||
0b9f03bb23 | |||
d1c3a017e3 | |||
b200feceed | |||
7958b2ea22 | |||
c0bdf4d3b5 | |||
71efc996e3 | |||
61383dea2d | |||
270cd1cad5 | |||
559e9b564d | |||
d8a56f60ef | |||
10e3b2939a | |||
ba67523278 | |||
f09964cf51 | |||
e4a70a823d | |||
655d86b97a | |||
f2f780115b | |||
b6be8457f7 | |||
1238c19494 | |||
2caf527f67 | |||
43eae7502b | |||
e035146e01 | |||
de3e21629f | |||
d79a3fcec4 | |||
de079cec42 |
@ -1,7 +1,7 @@
|
||||
Vreixo Formoso <metalpain2002@yahoo.es>,
|
||||
Mario Danic <mario.danic@gmail.com>,
|
||||
Thomas Schmitt <scdbackup@gmx.net>
|
||||
Copyright (C) 2007-2010 Vreixo Formoso, Mario Danic, Thomas Schmitt
|
||||
Copyright (C) 2007-2011 Vreixo Formoso, Mario Danic, Thomas Schmitt
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
17
ChangeLog
17
ChangeLog
@ -1,8 +1,17 @@
|
||||
bzr branch lp:libisofs/for-libisoburn (to become libisofs-1.0.2.tar.gz)
|
||||
===============================================================================
|
||||
- no novelties yet
|
||||
|
||||
libisofs-1.0.2.tar.gz Tue Wed 23 2011
|
||||
libisofs-1.0.6.tar.gz Sat Apr 09 2011
|
||||
===============================================================================
|
||||
* New API call iso_write_opts_set_joliet_long_names()
|
||||
* New error codes for oversized file addresses
|
||||
|
||||
libisofs-1.0.4.tar.gz Thu Mar 10 2011
|
||||
===============================================================================
|
||||
* Bug fix: Compilation failed if --disable-zlib was configured
|
||||
* Bug fix: isohybrid image size was not aligned to cylinder boundary.
|
||||
* New no_md5 value 2 for API call iso_read_opts_set_no_md5()
|
||||
* New option bits 8 and 9 with iso_write_opts_set_system_area()
|
||||
|
||||
libisofs-1.0.2.tar.gz Tue Feb 23 2011
|
||||
===============================================================================
|
||||
* Bug fix: iso_write_opts_set_aaip(opts, 1) could cause fatal miscalculation
|
||||
of the root directory size. This eventually truncated directory
|
||||
|
1
README
1
README
@ -54,6 +54,7 @@ applications which use it. This dependency can be avoided by configure options
|
||||
--disable-libacl avoid use of ACL functions like acl_to_text()
|
||||
--disable-xattr avoid use of xattr functions like listxattr()
|
||||
--disable-zlib avoid use of zlib functions like compress2()
|
||||
--disable-libjte avoid use of libjte functions
|
||||
|
||||
See INSTALL file for general options of ./configure.
|
||||
|
||||
|
12
configure.ac
12
configure.ac
@ -1,4 +1,4 @@
|
||||
AC_INIT([libisofs], [1.0.2], [http://libburnia-project.org])
|
||||
AC_INIT([libisofs], [1.0.6], [http://libburnia-project.org])
|
||||
AC_PREREQ([2.50])
|
||||
dnl AC_CONFIG_HEADER([config.h])
|
||||
|
||||
@ -40,7 +40,7 @@ dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match.
|
||||
dnl
|
||||
LIBISOFS_MAJOR_VERSION=1
|
||||
LIBISOFS_MINOR_VERSION=0
|
||||
LIBISOFS_MICRO_VERSION=2
|
||||
LIBISOFS_MICRO_VERSION=6
|
||||
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
|
||||
|
||||
AC_SUBST(LIBISOFS_MAJOR_VERSION)
|
||||
@ -50,10 +50,10 @@ AC_SUBST(LIBISOFS_VERSION)
|
||||
|
||||
dnl Libtool versioning
|
||||
LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION
|
||||
# 2011.02.23 development jump has not yet happened
|
||||
# SONAME = 46 - 40 = 6 . Library name = libisofs.6.40.0
|
||||
LT_CURRENT=46
|
||||
LT_AGE=40
|
||||
# 2011.04.09 development jump has not yet happened
|
||||
# SONAME = 50 - 44 = 6 . Library name = libisofs.6.44.0
|
||||
LT_CURRENT=50
|
||||
LT_AGE=44
|
||||
LT_REVISION=0
|
||||
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
|
||||
|
||||
|
27
demo/demo.c
27
demo/demo.c
@ -50,6 +50,7 @@ static char helptext[][80] = {
|
||||
#include <fcntl.h>
|
||||
#include <err.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
@ -372,7 +373,11 @@ int gesture_iso(int argc, char **argv)
|
||||
iso_write_opts_free(opts);
|
||||
|
||||
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
||||
fwrite(buf, 1, 2048, fp);
|
||||
result = fwrite(buf, 1, 2048, fp);
|
||||
if (result < 2048) {
|
||||
printf ("Cannot write block. errno= %d\n", errno);
|
||||
goto ex;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
burn_src->free_data(burn_src);
|
||||
@ -537,7 +542,7 @@ int gesture_iso_read(int argc, char **argv)
|
||||
|
||||
int gesture_iso_cat(int argc, char **argv)
|
||||
{
|
||||
int res;
|
||||
int res, write_ret;
|
||||
IsoFilesystem *fs;
|
||||
IsoFileSource *file;
|
||||
struct stat info;
|
||||
@ -596,7 +601,11 @@ int gesture_iso_cat(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
while ((res = iso_file_source_read(file, buf, 1024)) > 0) {
|
||||
fwrite(buf, 1, res, stdout);
|
||||
write_ret = fwrite(buf, 1, res, stdout);
|
||||
if (write_ret < res) {
|
||||
printf ("Cannot write block to stdout. errno= %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "Error reading, err = %d\n", res);
|
||||
@ -700,7 +709,11 @@ int gesture_iso_modify(int argc, char **argv)
|
||||
iso_write_opts_free(opts);
|
||||
|
||||
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
||||
fwrite(buf, 1, 2048, fp);
|
||||
result = fwrite(buf, 1, 2048, fp);
|
||||
if (result < 2048) {
|
||||
printf ("Cannot write block. errno= %d\n", errno);
|
||||
goto ex;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
burn_src->free_data(burn_src);
|
||||
@ -814,7 +827,11 @@ int gesture_iso_ms(int argc, char **argv)
|
||||
iso_write_opts_free(opts);
|
||||
|
||||
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
||||
fwrite(buf, 1, 2048, fp);
|
||||
result = fwrite(buf, 1, 2048, fp);
|
||||
if (result < 2048) {
|
||||
printf ("Cannot write block. errno= %d\n", errno);
|
||||
goto ex;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
burn_src->free_data(burn_src);
|
||||
|
@ -26,10 +26,6 @@
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void iso_node_builder_ref(IsoNodeBuilder *builder)
|
||||
@ -75,6 +71,8 @@ int default_create_file(IsoNodeBuilder *builder, IsoImage *image,
|
||||
iso_file_source_ref(src);
|
||||
|
||||
name = iso_file_source_get_name(src);
|
||||
if (strlen(name) > LIBISOFS_NODE_NAME_MAX)
|
||||
name[LIBISOFS_NODE_NAME_MAX] = 0;
|
||||
ret = iso_node_new_file(name, stream, &node);
|
||||
if (ret < 0) {
|
||||
iso_stream_unref(stream);
|
||||
@ -122,6 +120,8 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
}
|
||||
|
||||
name = iso_file_source_get_name(src);
|
||||
if (strlen(name) > LIBISOFS_NODE_NAME_MAX)
|
||||
name[LIBISOFS_NODE_NAME_MAX] = 0;
|
||||
fs = iso_file_source_get_filesystem(src);
|
||||
new = NULL;
|
||||
|
||||
@ -157,10 +157,10 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
case S_IFLNK:
|
||||
{
|
||||
/* source is a symbolic link */
|
||||
char dest[PATH_MAX];
|
||||
char dest[LIBISOFS_NODE_PATH_MAX];
|
||||
IsoSymlink *link;
|
||||
|
||||
ret = iso_file_source_readlink(src, dest, PATH_MAX);
|
||||
ret = iso_file_source_readlink(src, dest, LIBISOFS_NODE_PATH_MAX);
|
||||
if (ret < 0) {
|
||||
break;
|
||||
}
|
||||
|
@ -1108,7 +1108,36 @@ int zero_writer_free_data(IsoImageWriter *writer)
|
||||
}
|
||||
|
||||
static
|
||||
int zero_writer_create(Ecma119Image *target, uint32_t num_blocks)
|
||||
int tail_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
{
|
||||
int ret;
|
||||
Ecma119Image *target;
|
||||
struct iso_zero_writer_data_struct *data;
|
||||
char msg[160];
|
||||
|
||||
target = writer->target;
|
||||
ret = iso_align_isohybrid(target, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
data = (struct iso_zero_writer_data_struct *) writer->data;
|
||||
if (data->num_blocks != target->tail_blocks) {
|
||||
sprintf(msg, "Aligned image size to cylinder size by %d blocks",
|
||||
target->tail_blocks - data->num_blocks);
|
||||
iso_msgs_submit(0, msg, 0, "NOTE", 0);
|
||||
data->num_blocks = target->tail_blocks;
|
||||
}
|
||||
if (target->tail_blocks <= 0)
|
||||
return ISO_SUCCESS;
|
||||
ret = zero_writer_compute_data_blocks(writer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@param flag bit0= use tail_writer_compute_data_blocks rather than
|
||||
zero_writer_compute_data_blocks
|
||||
*/
|
||||
static
|
||||
int zero_writer_create(Ecma119Image *target, uint32_t num_blocks, int flag)
|
||||
{
|
||||
IsoImageWriter *writer;
|
||||
struct iso_zero_writer_data_struct *data;
|
||||
@ -1124,7 +1153,11 @@ int zero_writer_create(Ecma119Image *target, uint32_t num_blocks)
|
||||
}
|
||||
data->num_blocks = num_blocks;
|
||||
|
||||
writer->compute_data_blocks = zero_writer_compute_data_blocks;
|
||||
if (flag & 1) {
|
||||
writer->compute_data_blocks = tail_writer_compute_data_blocks;
|
||||
} else {
|
||||
writer->compute_data_blocks = zero_writer_compute_data_blocks;
|
||||
}
|
||||
writer->write_vol_desc = zero_writer_write_vol_desc;
|
||||
writer->write_data = zero_writer_write_data;
|
||||
writer->free_data = zero_writer_free_data;
|
||||
@ -1426,7 +1459,7 @@ void *write_function(void *arg)
|
||||
if (target->tree_end_block == 1) {
|
||||
iso_msgs_submit(0,
|
||||
"Image is most likely damaged. Calculated/written block address mismatch.",
|
||||
0, "WARNING", 0);
|
||||
0, "FATAL", 0);
|
||||
}
|
||||
|
||||
#ifdef Libisofs_with_pthread_exiT
|
||||
@ -1617,6 +1650,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
target->allow_full_ascii = opts->allow_full_ascii;
|
||||
target->relaxed_vol_atts = opts->relaxed_vol_atts;
|
||||
target->joliet_longer_paths = opts->joliet_longer_paths;
|
||||
target->joliet_long_names = opts->joliet_long_names;
|
||||
target->rrip_version_1_10 = opts->rrip_version_1_10;
|
||||
target->rrip_1_10_px_ino = opts->rrip_1_10_px_ino;
|
||||
target->aaip_susp_1_10 = opts->aaip_susp_1_10;
|
||||
@ -1666,7 +1700,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
system_area = src->system_area_data;
|
||||
system_area_options = src->system_area_options;
|
||||
} else {
|
||||
system_area_options = opts->system_area_options & 0xfc;
|
||||
system_area_options = opts->system_area_options & 0xfffffffc;
|
||||
}
|
||||
sa_type = (system_area_options >> 2) & 0x3f;
|
||||
if (sa_type != 0 && sa_type != 3)
|
||||
@ -1695,9 +1729,9 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
target->partition_secs_per_head = opts->partition_secs_per_head;
|
||||
target->partition_heads_per_cyl = opts->partition_heads_per_cyl;
|
||||
if (target->partition_secs_per_head == 0)
|
||||
target->partition_secs_per_head = 63;
|
||||
target->partition_secs_per_head = 32;
|
||||
if (target->partition_heads_per_cyl == 0)
|
||||
target->partition_heads_per_cyl = 255;
|
||||
target->partition_heads_per_cyl = 64;
|
||||
target->eff_partition_offset = 0;
|
||||
target->partition_root = NULL;
|
||||
target->partition_l_table_pos = 0;
|
||||
@ -1810,8 +1844,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
if (target->iso1999) {
|
||||
nwriters++;
|
||||
}
|
||||
if (target->tail_blocks > 0)
|
||||
nwriters++;
|
||||
nwriters++; /* Tail padding writer */
|
||||
if ((target->md5_file_checksums & 1) || target->md5_session_checksum) {
|
||||
nwriters++;
|
||||
image_checksums_mad = 1; /* from here on the loaded checksums are
|
||||
@ -1893,11 +1926,9 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
|
||||
|
||||
/* IMPORTANT: This must be the last writer before the checksum writer */
|
||||
if (target->tail_blocks > 0) {
|
||||
ret = zero_writer_create(target, target->tail_blocks);
|
||||
if (ret < 0)
|
||||
goto target_cleanup;
|
||||
}
|
||||
ret = zero_writer_create(target, target->tail_blocks, 1);
|
||||
if (ret < 0)
|
||||
goto target_cleanup;
|
||||
|
||||
if ((target->md5_file_checksums & 1) || target->md5_session_checksum) {
|
||||
ret = checksum_writer_create(target);
|
||||
@ -1951,8 +1982,8 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
if (i == el_torito_writer_index)
|
||||
continue;
|
||||
|
||||
/* Exposing address of data start to IsoWriteOpts iand memorizing
|
||||
this address for for all files which have no block address:
|
||||
/* Exposing address of data start to IsoWriteOpts and memorizing
|
||||
this address for all files which have no block address:
|
||||
symbolic links, device files, empty data files.
|
||||
filesrc_writer_compute_data_blocks() and filesrc_writer_write_data()
|
||||
will account resp. write this single block.
|
||||
@ -2611,6 +2642,15 @@ int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow)
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
int iso_write_opts_set_joliet_long_names(IsoWriteOpts *opts, int allow)
|
||||
{
|
||||
if (opts == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
opts->joliet_long_names = allow ? 1 : 0;
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
int iso_write_opts_set_rrip_version_1_10(IsoWriteOpts *opts, int oldvers)
|
||||
{
|
||||
if (opts == NULL) {
|
||||
@ -2880,7 +2920,7 @@ int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768],
|
||||
memcpy(opts->system_area_data, data, 32768);
|
||||
}
|
||||
if (!(flag & 4))
|
||||
opts->system_area_options = options & 0xff;
|
||||
opts->system_area_options = options & 0x3ff;
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -161,6 +161,11 @@ struct iso_write_opts {
|
||||
*/
|
||||
unsigned int joliet_longer_paths :1;
|
||||
|
||||
/**
|
||||
* Allow Joliet names up to 103 characters rather than 64.
|
||||
*/
|
||||
unsigned int joliet_long_names :1;
|
||||
|
||||
/**
|
||||
* Write Rock Ridge info as of specification RRIP-1.10 rather than
|
||||
* RRIP-1.12: signature "RRIP_1991A" rather than "IEEE_1282",
|
||||
@ -459,6 +464,9 @@ struct ecma119_image
|
||||
/** Allow paths on Joliet tree to be larger than 240 bytes */
|
||||
unsigned int joliet_longer_paths :1;
|
||||
|
||||
/** Allow Joliet names up to 103 characters rather than 64 */
|
||||
unsigned int joliet_long_names :1;
|
||||
|
||||
/** Write old fashioned RRIP-1.10 rather than RRIP-1.12 */
|
||||
unsigned int rrip_version_1_10 :1;
|
||||
|
||||
@ -575,19 +583,27 @@ struct ecma119_image
|
||||
*/
|
||||
char *system_area_data;
|
||||
/*
|
||||
* bit0= Only with PC-BIOS DOS MBR
|
||||
* bit0= Only with DOS MBR
|
||||
* Make bytes 446 - 512 of the system area a partition
|
||||
* table which reserves partition 1 from byte 63*512 to the
|
||||
* end of the ISO image. Assumed are 63 secs/hed, 255 head/cyl.
|
||||
* (GRUB protective msdos label.)
|
||||
* This works with and without system_area_data.
|
||||
* bit1= Only with PC-BIOS DOS MBR
|
||||
* bit1= Only with DOS MBR
|
||||
* Apply isohybrid MBR patching to the system area.
|
||||
* This works only with system_area_data plus ISOLINUX boot image
|
||||
* and only if not bit0 is set.
|
||||
* bit2-7= System area type
|
||||
* 0= DOS MBR
|
||||
* 1= MIPS Big Endian Volume Header
|
||||
* 2= DEC Boot Block for MIPS Little Endian
|
||||
* 3= SUN Disk Label for SUN SPARC
|
||||
* bit8-9= Only with DOS MBR
|
||||
* Cylinder alignment mode eventually pads the image to make it
|
||||
* end at a cylinder boundary.
|
||||
* 0 = auto (align if bit1)
|
||||
* 1 = always align to cylinder boundary
|
||||
* 2 = never align to cylinder boundary
|
||||
*/
|
||||
int system_area_options;
|
||||
|
||||
|
@ -239,6 +239,7 @@ int iso_tree_add_boot_node(IsoDir *parent, const char *name, IsoBoot **boot)
|
||||
IsoBoot *node;
|
||||
IsoNode **pos;
|
||||
time_t now;
|
||||
int ret;
|
||||
|
||||
if (parent == NULL || name == NULL || boot == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
@ -248,9 +249,9 @@ int iso_tree_add_boot_node(IsoDir *parent, const char *name, IsoBoot **boot)
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* find place where to insert */
|
||||
pos = &(parent->children);
|
||||
|
@ -534,6 +534,9 @@ IsoStream *gzip_get_input_stream(IsoStream *stream, int flag)
|
||||
static
|
||||
int gzip_clone_stream(IsoStream *old_stream, IsoStream **new_stream, int flag)
|
||||
{
|
||||
|
||||
#ifdef Libisofs_with_zliB
|
||||
|
||||
int ret;
|
||||
IsoStream *new_input_stream, *stream;
|
||||
GzipFilterStreamData *stream_data, *old_stream_data;
|
||||
@ -558,6 +561,13 @@ int gzip_clone_stream(IsoStream *old_stream, IsoStream **new_stream, int flag)
|
||||
stream->data = stream_data;
|
||||
*new_stream = stream;
|
||||
return ISO_SUCCESS;
|
||||
|
||||
#else /* Libisofs_with_zliB */
|
||||
|
||||
return ISO_STREAM_NO_CLONE;
|
||||
|
||||
#endif /* ! Libisofs_with_zliB */
|
||||
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -35,11 +35,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Options for image reading.
|
||||
* There are four kind of options:
|
||||
@ -72,7 +67,7 @@ struct iso_read_opts
|
||||
unsigned int nojoliet : 1; /*< Do not read Joliet extensions */
|
||||
unsigned int noiso1999 : 1; /*< Do not read ISO 9660:1999 enhanced tree */
|
||||
unsigned int noaaip : 1; /* Do not read AAIP extension for xattr and ACL */
|
||||
unsigned int nomd5 : 1; /* Do not read MD5 array */
|
||||
unsigned int nomd5 : 2; /* Do not read MD5 array */
|
||||
|
||||
/**
|
||||
* Hand out new inode numbers and overwrite eventually read PX inode
|
||||
@ -267,7 +262,7 @@ typedef struct
|
||||
int aaip_load;
|
||||
|
||||
/** Whether the MD5 array shall be read if available.
|
||||
* 1 = yes , 0 = no
|
||||
* 2 = yes, but do not check tags , 1 = yes , 0 = no
|
||||
*/
|
||||
int md5_load;
|
||||
|
||||
@ -953,6 +948,7 @@ int ifs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||
{
|
||||
char *dest;
|
||||
size_t len;
|
||||
int ret;
|
||||
ImageFileSourceData *data;
|
||||
|
||||
if (src == NULL || buf == NULL || src->data == NULL) {
|
||||
@ -971,14 +967,15 @@ int ifs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||
|
||||
dest = (char*)data->data.content;
|
||||
len = strlen(dest);
|
||||
if (bufsiz <= len) {
|
||||
|
||||
ret = ISO_SUCCESS;
|
||||
if (len >= bufsiz) {
|
||||
ret = ISO_RR_PATH_TOO_LONG;
|
||||
len = bufsiz - 1;
|
||||
}
|
||||
|
||||
strncpy(buf, dest, len);
|
||||
buf[len] = '\0';
|
||||
|
||||
return ISO_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
@ -2418,6 +2415,10 @@ int iso_src_check_sb_tree(IsoDataSource *src, uint32_t start_lba, int flag)
|
||||
ret = iso_util_eval_md5_tag(block, desired, start_lba + i,
|
||||
ctx, start_lba, &tag_type, &next_tag, 0);
|
||||
iso_md5_compute(ctx, block, 2048);
|
||||
if (ret == ISO_MD5_TAG_COPIED) { /* growing without emulated TOC */
|
||||
ret = 2;
|
||||
goto ex;
|
||||
}
|
||||
if (ret == ISO_MD5_AREA_CORRUPTED || ret == ISO_MD5_TAG_MISMATCH)
|
||||
ret = ISO_SB_TREE_CORRUPTED;
|
||||
if (ret < 0)
|
||||
@ -2504,7 +2505,12 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
|
||||
data->dir_mode = opts->dir_mode & ~S_IFMT;
|
||||
data->msgid = msgid;
|
||||
data->aaip_load = !opts->noaaip;
|
||||
data->md5_load = !opts->nomd5;
|
||||
if (opts->nomd5 == 0)
|
||||
data->md5_load = 1;
|
||||
else if (opts->nomd5 == 2)
|
||||
data->md5_load = 2;
|
||||
else
|
||||
data->md5_load = 0;
|
||||
data->aaip_version = -1;
|
||||
data->make_new_ino = opts->make_new_ino;
|
||||
data->num_bootimgs = 0;
|
||||
@ -2532,7 +2538,7 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
|
||||
ifs->free = ifs_fs_free;
|
||||
|
||||
/* read Volume Descriptors and ensure it is a valid image */
|
||||
if (data->md5_load) {
|
||||
if (data->md5_load == 1) {
|
||||
/* From opts->block on : check for superblock and tree tags */;
|
||||
ret = iso_src_check_sb_tree(src, opts->block, 0);
|
||||
if (ret < 0) {
|
||||
@ -2917,10 +2923,10 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
case S_IFLNK:
|
||||
{
|
||||
/* source is a symbolic link */
|
||||
char dest[PATH_MAX];
|
||||
char dest[LIBISOFS_NODE_PATH_MAX];
|
||||
IsoSymlink *link;
|
||||
|
||||
ret = iso_file_source_readlink(src, dest, PATH_MAX);
|
||||
ret = iso_file_source_readlink(src, dest, LIBISOFS_NODE_PATH_MAX);
|
||||
if (ret < 0) {
|
||||
free(name);
|
||||
return ret;
|
||||
@ -3234,6 +3240,8 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
||||
size_t size;
|
||||
void *ctx = NULL;
|
||||
char md5[16];
|
||||
struct el_torito_boot_catalog *catalog = NULL;
|
||||
ElToritoBootImage *boot_image = NULL;
|
||||
|
||||
if (image == NULL || src == NULL || opts == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
@ -3321,8 +3329,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
||||
|
||||
/* if old image has el-torito, add a new catalog */
|
||||
if (data->eltorito) {
|
||||
struct el_torito_boot_catalog *catalog;
|
||||
ElToritoBootImage *boot_image= NULL;
|
||||
|
||||
catalog = calloc(1, sizeof(struct el_torito_boot_catalog));
|
||||
if (catalog == NULL) {
|
||||
@ -3348,11 +3354,13 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
||||
memcpy(boot_image->selection_crit, data->selection_crits, 20);
|
||||
|
||||
catalog->bootimages[catalog->num_bootimages] = boot_image;
|
||||
boot_image = NULL;
|
||||
catalog->num_bootimages++;
|
||||
}
|
||||
for ( ; idx < Libisofs_max_boot_imageS; idx++)
|
||||
catalog->bootimages[idx] = NULL;
|
||||
image->bootcat = catalog;
|
||||
catalog = NULL; /* So it does not get freed */
|
||||
}
|
||||
|
||||
/* recursively add image */
|
||||
@ -3531,6 +3539,10 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
||||
image->fs = fsback;
|
||||
image->builder = blback;
|
||||
|
||||
if (catalog != NULL)
|
||||
el_torito_boot_catalog_free(catalog);
|
||||
if (boot_image != NULL)
|
||||
free((char *) boot_image);
|
||||
iso_file_source_unref(newroot);
|
||||
fs->close(fs);
|
||||
iso_filesystem_unref(fs);
|
||||
@ -3682,7 +3694,7 @@ int iso_read_opts_set_no_md5(IsoReadOpts *opts, int no_md5)
|
||||
if (opts == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
opts->nomd5 = no_md5 ? 1 : 0;
|
||||
opts->nomd5 = no_md5 == 2 ? 2 : no_md5 == 1 ? 1 : 0;
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ int lfs_readdir(IsoFileSource *src, IsoFileSource **child)
|
||||
static
|
||||
int lfs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||
{
|
||||
int size;
|
||||
int size, ret;
|
||||
_LocalFsFileSource *data;
|
||||
char *path;
|
||||
|
||||
@ -431,7 +431,7 @@ int lfs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||
* invoke readlink, with bufsiz -1 to reserve an space for
|
||||
* the NULL character
|
||||
*/
|
||||
size = readlink(path, buf, bufsiz - 1);
|
||||
size = readlink(path, buf, bufsiz);
|
||||
free(path);
|
||||
if (size < 0) {
|
||||
/* error */
|
||||
@ -455,8 +455,13 @@ int lfs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||
}
|
||||
|
||||
/* NULL-terminate the buf */
|
||||
ret = ISO_SUCCESS;
|
||||
if (size >= bufsiz) {
|
||||
ret = ISO_RR_PATH_TOO_LONG;
|
||||
size = bufsiz - 1;
|
||||
}
|
||||
buf[size] = '\0';
|
||||
return ISO_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -32,7 +32,7 @@
|
||||
* @param image
|
||||
* Location where the image pointer will be stored.
|
||||
* @return
|
||||
* 1 sucess, < 0 error
|
||||
* 1 success, < 0 error
|
||||
*/
|
||||
int iso_image_new(const char *name, IsoImage **image)
|
||||
{
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "filesrc.h"
|
||||
#include "eltorito.h"
|
||||
#include "libisofs.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -42,12 +43,11 @@ int get_joliet_name(Ecma119Image *t, IsoNode *iso, uint16_t **name)
|
||||
iso_msg_debug(t->image->id, "Can't convert %s", iso->name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* TODO #00022 : support relaxed constraints in joliet filenames */
|
||||
if (iso->type == LIBISO_DIR) {
|
||||
jname = iso_j_dir_id(ucs_name);
|
||||
jname = iso_j_dir_id(ucs_name, t->joliet_long_names << 1);
|
||||
} else {
|
||||
jname = iso_j_file_id(ucs_name, !!(t->no_force_dots & 2));
|
||||
jname = iso_j_file_id(ucs_name,
|
||||
(t->joliet_long_names << 1) | !!(t->no_force_dots & 2));
|
||||
}
|
||||
free(ucs_name);
|
||||
if (jname != NULL) {
|
||||
@ -303,8 +303,15 @@ int joliet_create_mangled_name(uint16_t *dest, uint16_t *src, int digits,
|
||||
int ret, pos;
|
||||
uint16_t *ucsnumber;
|
||||
char fmt[16];
|
||||
char nstr[72]; /* The only caller of this function allocates dest with 66
|
||||
elements and limits digits to < 8 */
|
||||
char nstr[72];
|
||||
/* was: The only caller of this function allocates dest
|
||||
with 66 elements and limits digits to < 8
|
||||
But this does not match the usage of nstr which has to take
|
||||
the decimal representation of an int.
|
||||
*/
|
||||
|
||||
if (digits >= 8)
|
||||
return ISO_ASSERT_FAILURE;
|
||||
|
||||
sprintf(fmt, "%%0%dd", digits);
|
||||
sprintf(nstr, fmt, number);
|
||||
@ -337,7 +344,7 @@ static
|
||||
int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
{
|
||||
int ret;
|
||||
int i, nchildren;
|
||||
int i, nchildren, maxchar = 64;
|
||||
JolietNode **children;
|
||||
IsoHTable *table;
|
||||
int need_sort = 0;
|
||||
@ -345,6 +352,9 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
nchildren = dir->info.dir->nchildren;
|
||||
children = dir->info.dir->children;
|
||||
|
||||
if (t->joliet_long_names)
|
||||
maxchar = 103;
|
||||
|
||||
/* a hash table will temporary hold the names, for fast searching */
|
||||
ret = iso_htable_create((nchildren * 100) / 80, iso_str_hash,
|
||||
(compare_function_t)ucscmp, &table);
|
||||
@ -361,7 +371,7 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
|
||||
for (i = 0; i < nchildren; ++i) {
|
||||
uint16_t *name, *ext;
|
||||
uint16_t full_name[66];
|
||||
uint16_t full_name[LIBISO_JOLIET_NAME_MAX];
|
||||
int max; /* computed max len for name, without extension */
|
||||
int j = i;
|
||||
int digits = 1; /* characters to change per name */
|
||||
@ -380,7 +390,7 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
* A max of 7 characters is good enought, it allows handling up to
|
||||
* 9,999,999 files with same name.
|
||||
*/
|
||||
/* Important: joliet_create_mangled_name() relies on digits < 72 */
|
||||
/* Important: joliet_create_mangled_name() relies on digits < 8 */
|
||||
|
||||
while (digits < 8) {
|
||||
int ok, k;
|
||||
@ -403,7 +413,7 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
ext = dot + 1;
|
||||
|
||||
extlen = ucslen(ext);
|
||||
max = 65 - extlen - 1 - digits;
|
||||
max = maxchar + 1 - extlen - 1 - digits;
|
||||
if (max <= 0) {
|
||||
/* this can happen if extension is too long */
|
||||
if (extlen + max > 3) {
|
||||
@ -413,7 +423,7 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
*/
|
||||
extlen = extlen + max - 1;
|
||||
ext[extlen] = 0;
|
||||
max = 66 - extlen - 1 - digits;
|
||||
max = maxchar + 2 - extlen - 1 - digits;
|
||||
} else {
|
||||
/*
|
||||
* error, we don't support extensions < 3
|
||||
@ -430,10 +440,10 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
} else {
|
||||
/* Directory, or file without extension */
|
||||
if (children[i]->type == JOLIET_DIR) {
|
||||
max = 65 - digits;
|
||||
max = maxchar + 1 - digits;
|
||||
dot = NULL; /* dots have no meaning in dirs */
|
||||
} else {
|
||||
max = 65 - digits;
|
||||
max = maxchar + 1 - digits;
|
||||
}
|
||||
name = full_name;
|
||||
if (max < ucslen(name)) {
|
||||
@ -446,7 +456,7 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
ok = 1;
|
||||
/* change name of each file */
|
||||
for (k = i; k <= j; ++k) {
|
||||
uint16_t tmp[66];
|
||||
uint16_t tmp[LIBISO_JOLIET_NAME_MAX];
|
||||
while (1) {
|
||||
ret = joliet_create_mangled_name(tmp, name, digits,
|
||||
change, ext);
|
||||
|
@ -18,6 +18,10 @@
|
||||
#include "libisofs.h"
|
||||
#include "ecma119.h"
|
||||
|
||||
/* was formerly 66 = 64 + 2. Now 105 = 103 + 2.
|
||||
*/
|
||||
#define LIBISO_JOLIET_NAME_MAX 105
|
||||
|
||||
enum joliet_node_type {
|
||||
JOLIET_FILE,
|
||||
JOLIET_DIR
|
||||
|
@ -1207,7 +1207,7 @@ int iso_lib_is_compatible(int major, int minor, int micro);
|
||||
*/
|
||||
#define iso_lib_header_version_major 1
|
||||
#define iso_lib_header_version_minor 0
|
||||
#define iso_lib_header_version_micro 2
|
||||
#define iso_lib_header_version_micro 6
|
||||
|
||||
/**
|
||||
* Usage discussion:
|
||||
@ -1585,6 +1585,15 @@ int iso_write_opts_set_relaxed_vol_atts(IsoWriteOpts *opts, int allow);
|
||||
*/
|
||||
int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow);
|
||||
|
||||
/**
|
||||
* Allow leaf names in the Joliet tree to have up to 103 characters.
|
||||
* Normal limit is 64.
|
||||
* This breaks Joliet specification. Use with caution.
|
||||
*
|
||||
* @since 1.0.6
|
||||
*/
|
||||
int iso_write_opts_set_joliet_long_names(IsoWriteOpts *opts, int allow);
|
||||
|
||||
/**
|
||||
* Write Rock Ridge info as of specification RRIP-1.10 rather than RRIP-1.12:
|
||||
* signature "RRIP_1991A" rather than "IEEE_1282", field PX without file
|
||||
@ -1959,7 +1968,13 @@ int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
|
||||
* iso_write_opts_set_partition_img() for partition numbers 2
|
||||
* to 8.
|
||||
* This will overwrite the first 512 bytes of the submitted
|
||||
* data.
|
||||
* bit8-9= Only with System area type 0 = MBR
|
||||
* @since 1.0.4
|
||||
* Cylinder alignment mode eventually pads the image to make it
|
||||
* end at a cylinder boundary.
|
||||
* 0 = auto (align if bit1)
|
||||
* 1 = always align to cylinder boundary
|
||||
* 2 = never align to cylinder boundary
|
||||
* @param flag
|
||||
* bit0 = invalidate any attached system area data. Same as data == NULL
|
||||
* (This re-activates eventually loaded image System Area data.
|
||||
@ -2069,9 +2084,9 @@ int iso_write_opts_set_part_offset(IsoWriteOpts *opts,
|
||||
tests. It can be prevented by ./configure option --disable-libjte .
|
||||
@since 0.6.38
|
||||
*/
|
||||
#define iso_libjte_req_major 0
|
||||
#define iso_libjte_req_minor 1
|
||||
#define iso_libjte_req_micro 1
|
||||
#define iso_libjte_req_major 1
|
||||
#define iso_libjte_req_minor 0
|
||||
#define iso_libjte_req_micro 0
|
||||
|
||||
/**
|
||||
* Associate a libjte environment object to the upcomming write run.
|
||||
@ -2331,8 +2346,10 @@ int iso_read_opts_set_no_aaip(IsoReadOpts *opts, int noaaip);
|
||||
* @param opts
|
||||
* The option set to be manipulated
|
||||
* @param no_md5
|
||||
* 0 = Read MD5 array if available, refuse on non-matching MD5 tags
|
||||
* 1 = Do not read MD5 checksum array
|
||||
* 0 = Read Md% array if available
|
||||
* 2 = Read MD5 array, but do not check MD5 tags
|
||||
* @since 1.0.4
|
||||
* All other values are reserved.
|
||||
*
|
||||
* @since 0.6.22
|
||||
@ -3120,6 +3137,8 @@ int el_torito_seems_boot_info_table(ElToritoBootImage *bootimg, int flag);
|
||||
* Specifies options for ISOLINUX or GRUB boot images. This should only be used
|
||||
* if the type of boot image is known.
|
||||
*
|
||||
* @param bootimg
|
||||
* The image to set options on
|
||||
* @param options
|
||||
* bitmask style flag. The following values are defined:
|
||||
*
|
||||
@ -3147,8 +3166,6 @@ int el_torito_seems_boot_info_table(ElToritoBootImage *bootimg, int flag);
|
||||
* For that you need isolinux.bin from SYSLINUX 3.72 or later.
|
||||
* IMPORTANT: The application has to take care that the image
|
||||
* on media gets padded up to the next full MB.
|
||||
* @param bootimg
|
||||
* The image to set options on
|
||||
* @param flag
|
||||
* Reserved for future usage, set to 0.
|
||||
* @return
|
||||
@ -5164,11 +5181,12 @@ int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child);
|
||||
* @param src
|
||||
* An IsoFileSource corresponding to a symbolic link.
|
||||
* @param buf
|
||||
* allocated buffer of at least bufsiz bytes.
|
||||
* The dest. will be copied there, and it will be NULL-terminated
|
||||
* Allocated buffer of at least bufsiz bytes.
|
||||
* The destination string will be copied there, and it will be 0-terminated
|
||||
* if the return value indicates success or ISO_RR_PATH_TOO_LONG.
|
||||
* @param bufsiz
|
||||
* characters to be copied. Destination link will be truncated if
|
||||
* it is larger than given size. This includes the 0x0 character.
|
||||
* Maximum number of buf characters + 1. The string will be truncated if
|
||||
* it is larger than bufsiz - 1 and ISO_RR_PATH_TOO_LONG. will be returned.
|
||||
* @return
|
||||
* 1 on success, < 0 on error
|
||||
* Error codes:
|
||||
@ -5179,6 +5197,7 @@ int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child);
|
||||
* ISO_OUT_OF_MEM
|
||||
* ISO_FILE_BAD_PATH
|
||||
* ISO_FILE_DOESNT_EXIST
|
||||
* ISO_RR_PATH_TOO_LONG (@since 1.0.6)
|
||||
*
|
||||
* @since 0.6.2
|
||||
*/
|
||||
@ -6808,6 +6827,19 @@ int iso_md5_match(char first_md5[16], char second_md5[16]);
|
||||
(FAILURE, HIGH, -375) */
|
||||
#define ISO_XINFO_NO_CLONE 0xE830FE89
|
||||
|
||||
/** Found copied superblock checksum tag (WARNING, HIGH, -376) */
|
||||
#define ISO_MD5_TAG_COPIED 0xD030FE88
|
||||
|
||||
/** Rock Ridge leaf name too long (FAILURE, HIGH, -377) */
|
||||
#define ISO_RR_NAME_TOO_LONG 0xE830FE87
|
||||
|
||||
/** Reserved Rock Ridge leaf name (FAILURE, HIGH, -378) */
|
||||
#define ISO_RR_NAME_RESERVED 0xE830FE86
|
||||
|
||||
/** Rock Ridge path too long (FAILURE, HIGH, -379) */
|
||||
#define ISO_RR_PATH_TOO_LONG 0xE830FE85
|
||||
|
||||
|
||||
|
||||
/* Internal developer note:
|
||||
Place new error codes directly above this comment.
|
||||
|
@ -282,6 +282,7 @@ iso_write_opts_set_hardlinks;
|
||||
iso_write_opts_set_iso1999;
|
||||
iso_write_opts_set_iso_level;
|
||||
iso_write_opts_set_joliet;
|
||||
iso_write_opts_set_joliet_long_names;
|
||||
iso_write_opts_set_joliet_longer_paths;
|
||||
iso_write_opts_set_max_37_char_filenames;
|
||||
iso_write_opts_set_ms_block;
|
||||
|
@ -386,21 +386,19 @@ int make_isolinux_mbr(int32_t *img_blocks, uint32_t boot_lba,
|
||||
int part_offset, int part_number, int fs_type,
|
||||
uint8_t *buf, int flag)
|
||||
{
|
||||
uint32_t spc, id, part, nominal_part_size;
|
||||
uint32_t id, part, nominal_part_size;
|
||||
off_t hd_img_blocks, hd_boot_lba;
|
||||
char *wpt;
|
||||
/* For generating a weak random number */
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
|
||||
/* Pad image_size to a multiple of sector_count*head_count
|
||||
*/
|
||||
spc = head_count * sector_count;
|
||||
hd_img_blocks = ((off_t) *img_blocks) * (off_t) 4;
|
||||
if (hd_img_blocks % spc) {
|
||||
hd_img_blocks += spc - (hd_img_blocks % spc);
|
||||
*img_blocks = hd_img_blocks / 4 + !!(hd_img_blocks % 4);
|
||||
}
|
||||
|
||||
/* Padding of image_size to a multiple of sector_count*head_count
|
||||
happens already at compute time and is implemented by
|
||||
an appropriate increase of Ecma119Image->tail_blocks.
|
||||
*/
|
||||
|
||||
wpt = (char *) buf + 432;
|
||||
|
||||
|
@ -453,6 +453,14 @@ const char *iso_error_to_msg(int errcode)
|
||||
return "Data file input stream object offers no cloning method";
|
||||
case ISO_XINFO_NO_CLONE:
|
||||
return "Extended information class offers no cloning method";
|
||||
case ISO_MD5_TAG_COPIED:
|
||||
return "Found copied superblock checksum tag";
|
||||
case ISO_RR_NAME_TOO_LONG:
|
||||
return "Rock Ridge leaf name too long";
|
||||
case ISO_RR_NAME_RESERVED:
|
||||
return "Reserved Rock Ridge leaf name";
|
||||
case ISO_RR_PATH_TOO_LONG:
|
||||
return "Rock Ridge path too long";
|
||||
default:
|
||||
return "Unknown error";
|
||||
}
|
||||
|
@ -28,11 +28,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
struct dir_iter_data
|
||||
{
|
||||
/* points to the last visited child, to NULL before start */
|
||||
@ -325,6 +320,7 @@ enum IsoNodeType iso_node_get_type(IsoNode *node)
|
||||
int iso_node_set_name(IsoNode *node, const char *name)
|
||||
{
|
||||
char *new;
|
||||
int ret;
|
||||
|
||||
if ((IsoNode*)node->parent == node) {
|
||||
/* you can't change name of the root node */
|
||||
@ -332,9 +328,9 @@ int iso_node_set_name(IsoNode *node, const char *name)
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (node->parent != NULL) {
|
||||
/* check if parent already has a node with same name */
|
||||
@ -1005,10 +1001,11 @@ const char *iso_symlink_get_dest(const IsoSymlink *link)
|
||||
int iso_symlink_set_dest(IsoSymlink *link, const char *dest)
|
||||
{
|
||||
char *d;
|
||||
if (!iso_node_is_valid_link_dest(dest)) {
|
||||
/* guard against null or empty dest */
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
int ret;
|
||||
|
||||
ret = iso_node_is_valid_link_dest(dest);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
d = strdup(dest);
|
||||
if (d == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
@ -1159,22 +1156,23 @@ int iso_node_is_valid_name(const char *name)
|
||||
{
|
||||
/* a name can't be NULL */
|
||||
if (name == NULL) {
|
||||
return 0;
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
/* guard against the empty string or big names... */
|
||||
if (name[0] == '\0' || strlen(name) > 255) {
|
||||
return 0;
|
||||
}
|
||||
if (name[0] == '\0')
|
||||
return ISO_RR_NAME_RESERVED;
|
||||
if (strlen(name) > LIBISOFS_NODE_NAME_MAX)
|
||||
return ISO_RR_NAME_TOO_LONG;
|
||||
|
||||
/* ...against "." and ".." names... */
|
||||
if (!strcmp(name, ".") || !strcmp(name, "..")) {
|
||||
return 0;
|
||||
return ISO_RR_NAME_RESERVED;
|
||||
}
|
||||
|
||||
/* ...and against names with '/' */
|
||||
if (strchr(name, '/') != NULL) {
|
||||
return 0;
|
||||
return ISO_RR_NAME_RESERVED;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -1192,13 +1190,14 @@ int iso_node_is_valid_link_dest(const char *dest)
|
||||
|
||||
/* a dest can't be NULL */
|
||||
if (dest == NULL) {
|
||||
return 0;
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
/* guard against the empty string or big dest... */
|
||||
if (dest[0] == '\0' || strlen(dest) > PATH_MAX) {
|
||||
return 0;
|
||||
}
|
||||
if (dest[0] == '\0')
|
||||
return ISO_RR_NAME_RESERVED;
|
||||
if (strlen(dest) > LIBISOFS_NODE_PATH_MAX)
|
||||
return ISO_RR_PATH_TOO_LONG;
|
||||
|
||||
/* check that all components are valid */
|
||||
if (!strcmp(dest, "/")) {
|
||||
@ -1208,7 +1207,7 @@ int iso_node_is_valid_link_dest(const char *dest)
|
||||
|
||||
ptr = strdup(dest);
|
||||
if (ptr == NULL) {
|
||||
return 0;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
@ -1216,7 +1215,7 @@ int iso_node_is_valid_link_dest(const char *dest)
|
||||
while (component) {
|
||||
if (strcmp(component, ".") && strcmp(component, "..")) {
|
||||
ret = iso_node_is_valid_name(component);
|
||||
if (ret == 0) {
|
||||
if (ret < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1375,15 +1374,16 @@ int iso_node_new_root(IsoDir **root)
|
||||
int iso_node_new_dir(char *name, IsoDir **dir)
|
||||
{
|
||||
IsoDir *new;
|
||||
int ret;
|
||||
|
||||
if (dir == NULL || name == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
new = calloc(1, sizeof(IsoDir));
|
||||
if (new == NULL) {
|
||||
@ -1400,15 +1400,16 @@ int iso_node_new_dir(char *name, IsoDir **dir)
|
||||
int iso_node_new_file(char *name, IsoStream *stream, IsoFile **file)
|
||||
{
|
||||
IsoFile *new;
|
||||
int ret;
|
||||
|
||||
if (file == NULL || name == NULL || stream == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
new = calloc(1, sizeof(IsoFile));
|
||||
if (new == NULL) {
|
||||
@ -1428,21 +1429,21 @@ int iso_node_new_file(char *name, IsoStream *stream, IsoFile **file)
|
||||
int iso_node_new_symlink(char *name, char *dest, IsoSymlink **link)
|
||||
{
|
||||
IsoSymlink *new;
|
||||
int ret;
|
||||
|
||||
if (link == NULL || name == NULL || dest == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* check if destination is valid */
|
||||
if (!iso_node_is_valid_link_dest(dest)) {
|
||||
/* guard against null or empty dest */
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_link_dest(dest);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
new = calloc(1, sizeof(IsoSymlink));
|
||||
if (new == NULL) {
|
||||
@ -1464,6 +1465,7 @@ int iso_node_new_special(char *name, mode_t mode, dev_t dev,
|
||||
IsoSpecial **special)
|
||||
{
|
||||
IsoSpecial *new;
|
||||
int ret;
|
||||
|
||||
if (special == NULL || name == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
@ -1473,9 +1475,9 @@ int iso_node_new_special(char *name, mode_t mode, dev_t dev,
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
ret = iso_node_is_valid_name(name);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
new = calloc(1, sizeof(IsoSpecial));
|
||||
if (new == NULL) {
|
||||
|
@ -30,6 +30,29 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Maximum length of a leaf name in the libisofs node tree. This is currently
|
||||
restricted by the implemented maximum length of a Rock Ridge name.
|
||||
This might later become larger and may then be limited to smaller values.
|
||||
|
||||
Rock Ridge specs do not impose an explicit limit on name length.
|
||||
But 255 is also specified by
|
||||
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
|
||||
which says
|
||||
NAME_MAX >= _XOPEN_NAME_MAX = 255
|
||||
*/
|
||||
#define LIBISOFS_NODE_NAME_MAX 255
|
||||
|
||||
|
||||
/* Maximum length of a path in the libisofs node tree.
|
||||
Rock Ridge specs do not impose an explicit limit on path length.
|
||||
|
||||
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
|
||||
says
|
||||
PATH_MAX >= _XOPEN_PATH_MAX = 1024
|
||||
*/
|
||||
#define LIBISOFS_NODE_PATH_MAX 1024
|
||||
|
||||
|
||||
/**
|
||||
* The extended information is a way to attach additional information to each
|
||||
* IsoNode. External applications may want to use this extension system to
|
||||
@ -286,7 +309,7 @@ int iso_node_new_special(char *name, mode_t mode, dev_t dev,
|
||||
* Check if a given name is valid for an iso node.
|
||||
*
|
||||
* @return
|
||||
* 1 if yes, 0 if not
|
||||
* 1 if yes, <0 if not. The value is a specific ISO_* error code.
|
||||
*/
|
||||
int iso_node_is_valid_name(const char *name);
|
||||
|
||||
|
@ -337,7 +337,12 @@ static
|
||||
int rrip_add_NM(Ecma119Image *t, struct susp_info *susp, char *name, int size,
|
||||
int flags, int ce)
|
||||
{
|
||||
uint8_t *NM = malloc(size + 5);
|
||||
uint8_t *NM;
|
||||
|
||||
if (size > 250)
|
||||
return ISO_ASSERT_FAILURE;
|
||||
|
||||
NM = malloc(size + 5);
|
||||
if (NM == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
@ -945,6 +950,7 @@ int aaip_xinfo_cloner(void *old_data, void **new_data, int flag)
|
||||
* (*su_size and *ce stay unaltered in this case)
|
||||
* <0= error:
|
||||
* -1= not enough SUA space for 28 bytes of CE entry
|
||||
* -2= out of memory
|
||||
*/
|
||||
static
|
||||
int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
|
||||
@ -981,6 +987,9 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
|
||||
if (!(flag & 1))
|
||||
goto unannounced_ca;
|
||||
namelen = namelen - (space - *su_size - 5);
|
||||
|
||||
/* >>> Need to handle lengths > 250 */;
|
||||
|
||||
*ce = 5 + namelen;
|
||||
*su_size = space;
|
||||
}
|
||||
@ -993,6 +1002,8 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
|
||||
int cew = (*ce != 0); /* are we writing to CA ? */
|
||||
|
||||
dest = get_rr_fname(t, ((IsoSymlink*)n->node)->dest);
|
||||
if (dest == NULL)
|
||||
return -2;
|
||||
prev = dest;
|
||||
cur = strchr(prev, '/');
|
||||
while (1) {
|
||||
@ -1021,8 +1032,10 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
|
||||
* TODO this can be handled better, but for now SL
|
||||
* will be completelly moved into the CA
|
||||
*/
|
||||
if (!(flag & 1))
|
||||
if (!(flag & 1)) {
|
||||
free(dest);
|
||||
goto unannounced_ca;
|
||||
}
|
||||
cew = 1;
|
||||
} else {
|
||||
sl_len += clen;
|
||||
@ -1236,7 +1249,9 @@ size_t rrip_calc_len(Ecma119Image *t, Ecma119Node *n, int type, size_t used_up,
|
||||
/* Try without CE */
|
||||
ret = susp_calc_nm_sl_al(t, n, space, &su_size, ce, 0);
|
||||
if (ret == 0) /* Retry with CE */
|
||||
susp_calc_nm_sl_al(t, n, space, &su_size, ce, 1);
|
||||
ret = susp_calc_nm_sl_al(t, n, space, &su_size, ce, 1);
|
||||
if (ret == -2)
|
||||
return ISO_OUT_OF_MEM;
|
||||
|
||||
} else {
|
||||
|
||||
@ -1447,10 +1462,14 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
|
||||
ce_len_pd = ce_len;
|
||||
ret = susp_calc_nm_sl_al(t, n, space, &su_size_pd, &ce_len_pd, 0);
|
||||
if (ret == 0) { /* Have to use CA. 28 bytes of CE are necessary */
|
||||
susp_calc_nm_sl_al(t, n, space, &su_size_pd, &ce_len_pd, 1);
|
||||
ret = susp_calc_nm_sl_al(t, n, space, &su_size_pd, &ce_len_pd, 1);
|
||||
sua_free -= 28;
|
||||
ce_is_predicted = 1;
|
||||
}
|
||||
if (ret == -2) {
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto add_susp_cleanup;
|
||||
}
|
||||
|
||||
/* NM entry */
|
||||
if (5 + namelen <= sua_free) {
|
||||
@ -1648,6 +1667,9 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
|
||||
/*
|
||||
* ..and the part that goes to continuation area.
|
||||
*/
|
||||
|
||||
/* >>> Need a loop to handle lengths > 250 */;
|
||||
|
||||
ret = rrip_add_NM(t, info, name + namelen, strlen(name + namelen),
|
||||
0, 1);
|
||||
if (ret < 0) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "stream.h"
|
||||
#include "fsource.h"
|
||||
#include "util.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -769,7 +770,7 @@ IsoStreamIface mem_stream_class = {
|
||||
* When the Stream refcount reach 0, the buffer is free(3).
|
||||
*
|
||||
* @return
|
||||
* 1 sucess, < 0 error
|
||||
* 1 success, < 0 error
|
||||
*/
|
||||
int iso_memory_stream_new(unsigned char *buf, size_t size, IsoStream **stream)
|
||||
{
|
||||
@ -868,7 +869,8 @@ void iso_stream_get_file_name(IsoStream *stream, char *name)
|
||||
if (!strncmp(type, "fsrc", 4)) {
|
||||
FSrcStreamData *data = stream->data;
|
||||
char *path = iso_file_source_get_path(data->src);
|
||||
strncpy(name, path, PATH_MAX);
|
||||
strncpy(name, path, PATH_MAX - 1);
|
||||
name[PATH_MAX - 1] = 0;
|
||||
free(path);
|
||||
} else if (!strncmp(type, "boot", 4)) {
|
||||
strcpy(name, "BOOT CATALOG");
|
||||
|
@ -29,7 +29,8 @@ typedef struct
|
||||
/**
|
||||
* Get an identifier for the file of the source, for debug purposes
|
||||
* @param name
|
||||
* Should provide at least PATH_MAX bytes
|
||||
* Must provide at least PATH_MAX bytes. If no PATH_MAX is defined
|
||||
* then assume PATH_MAX = Libisofs_default_path_maX from libisofs.h
|
||||
*/
|
||||
void iso_stream_get_file_name(IsoStream *stream, char *name);
|
||||
|
||||
|
@ -809,3 +809,118 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
||||
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
/* Choose *heads_per_cyl so that
|
||||
- *heads_per_cyl * secs_per_head * 1024 >= imgsize / 512
|
||||
- *heads_per_cyl * secs_per_head is divisible by 4
|
||||
- it is as small as possible (to reduce aligment overhead)
|
||||
- it is <= 255
|
||||
@return 1= success , 0= cannot achieve goals
|
||||
*/
|
||||
static
|
||||
int try_sph(off_t imgsize, int secs_per_head, int *heads_per_cyl, int flag)
|
||||
{
|
||||
off_t hd_blocks, hpc;
|
||||
|
||||
hd_blocks= imgsize / 512;
|
||||
hpc = hd_blocks / secs_per_head / 1024;
|
||||
if (hpc * secs_per_head * 1024 < hd_blocks)
|
||||
hpc++;
|
||||
if ((secs_per_head % 4) == 0) {
|
||||
;
|
||||
} else if ((secs_per_head % 2) == 0) {
|
||||
hpc += (hpc % 2);
|
||||
} else if(hpc % 4) {
|
||||
hpc += 4 - (hpc % 4);
|
||||
}
|
||||
if (hpc > 255)
|
||||
return 0;
|
||||
*heads_per_cyl = hpc;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int iso_align_isohybrid(Ecma119Image *t, int flag)
|
||||
{
|
||||
int sa_type, ret, always_align;
|
||||
uint32_t img_blocks;
|
||||
off_t imgsize, cylsize = 0, frac;
|
||||
char msg[160];
|
||||
|
||||
sa_type = (t->system_area_options >> 2) & 0x3f;
|
||||
if (sa_type != 0)
|
||||
return ISO_SUCCESS;
|
||||
always_align = (t->system_area_options >> 8) & 3;
|
||||
|
||||
img_blocks = t->curblock;
|
||||
imgsize = ((off_t) img_blocks) * (off_t) 2048;
|
||||
if (((t->system_area_options & 3) || always_align)
|
||||
&& (off_t) (t->partition_heads_per_cyl * t->partition_secs_per_head
|
||||
* 1024) * (off_t) 512 < imgsize) {
|
||||
/* Choose small values which can represent the image size */
|
||||
/* First try 32 sectors per head */
|
||||
ret = try_sph(imgsize, 32, &(t->partition_heads_per_cyl), 0);
|
||||
if (ret == 1) {
|
||||
t->partition_secs_per_head = 32;
|
||||
} else {
|
||||
/* Did not work with 32. Try 63 */
|
||||
t->partition_secs_per_head = 63;
|
||||
ret = try_sph(imgsize, 63, &(t->partition_heads_per_cyl), 0);
|
||||
if (ret != 1)
|
||||
t->partition_heads_per_cyl = 255;
|
||||
}
|
||||
cylsize = t->partition_heads_per_cyl * t->partition_secs_per_head *512;
|
||||
frac = imgsize % cylsize;
|
||||
sprintf(msg, "Automatically adjusted MBR geometry to %d/%d/%d",
|
||||
(int) (imgsize / cylsize + !!frac),
|
||||
t->partition_heads_per_cyl, t->partition_secs_per_head);
|
||||
iso_msgs_submit(0, msg, 0, "NOTE", 0);
|
||||
}
|
||||
|
||||
if (always_align >= 2)
|
||||
return ISO_SUCCESS;
|
||||
|
||||
cylsize = 0;
|
||||
if (t->catalog != NULL &&
|
||||
(t->catalog->bootimages[0]->isolinux_options & 0x0a) == 0x02) {
|
||||
/* Check for isolinux image with magic number of 3.72 and produce
|
||||
an MBR from our built-in template. (Deprecated since 31 Mar 2010)
|
||||
*/
|
||||
if (img_blocks >= 0x40000000)
|
||||
return ISO_SUCCESS;
|
||||
cylsize = 64 * 32 * 512;
|
||||
} else if ((t->system_area_options & 2) || always_align) {
|
||||
/* Patch externally provided system area as isohybrid MBR */
|
||||
if (t->catalog == NULL || t->system_area_data == NULL) {
|
||||
/* isohybrid makes only sense together with ISOLINUX boot image
|
||||
and externally provided System Area.
|
||||
*/
|
||||
return ISO_ISOLINUX_CANT_PATCH;
|
||||
}
|
||||
cylsize = t->partition_heads_per_cyl * t->partition_secs_per_head
|
||||
* 512;
|
||||
}
|
||||
if (cylsize == 0)
|
||||
return ISO_SUCCESS;
|
||||
if (((double) imgsize) / (double) cylsize > 1024.0) {
|
||||
iso_msgs_submit(0,
|
||||
"Image size exceeds 1024 cylinders. Cannot align partition.",
|
||||
0, "WARNING", 0);
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
frac = imgsize % cylsize;
|
||||
imgsize += (frac > 0 ? cylsize - frac : 0);
|
||||
|
||||
frac = imgsize - ((off_t) img_blocks) * (off_t) 2048;
|
||||
if (frac == 0)
|
||||
return ISO_SUCCESS;
|
||||
if (frac % 2048) {
|
||||
sprintf(msg,
|
||||
"Cylinder size %d not divisible by 2048. Cannot align partition.",
|
||||
(int) cylsize);
|
||||
iso_msgs_submit(0, msg, 0, "WARNING", 0);
|
||||
} else {
|
||||
t->tail_blocks += frac / 2048;
|
||||
}
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
@ -46,6 +46,11 @@ int make_isohybrid_mbr(int bin_lba, int *img_blocks, char *mbr, int flag);
|
||||
*/
|
||||
int iso_write_system_area(Ecma119Image *t, uint8_t *buf);
|
||||
|
||||
/**
|
||||
* Adjust t->tail_blocks to the eventual alignment needs of isohybrid booting.
|
||||
*/
|
||||
int iso_align_isohybrid(Ecma119Image *t, int flag);
|
||||
|
||||
|
||||
/**
|
||||
* Read the necessary ELF information from the first MIPS boot file.
|
||||
|
@ -32,11 +32,6 @@
|
||||
#include <fnmatch.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Add a new directory to the iso tree.
|
||||
*
|
||||
@ -980,18 +975,24 @@ char *iso_tree_get_node_path(IsoNode *node)
|
||||
if ((IsoNode*)node->parent == node) {
|
||||
return strdup("/");
|
||||
} else {
|
||||
char path[PATH_MAX];
|
||||
char *parent_path = iso_tree_get_node_path((IsoNode*)node->parent);
|
||||
char *path = NULL, *parent_path;
|
||||
parent_path = iso_tree_get_node_path((IsoNode*)node->parent);
|
||||
if (parent_path == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (strlen(parent_path) == 1) {
|
||||
snprintf(path, PATH_MAX, "/%s", node->name);
|
||||
path = calloc(1, strlen(node->name) + 2);
|
||||
if (path == NULL)
|
||||
return NULL;
|
||||
sprintf(path, "/%s", node->name);
|
||||
} else {
|
||||
snprintf(path, PATH_MAX, "%s/%s", parent_path, node->name);
|
||||
path = calloc(1, strlen(parent_path) + strlen(node->name) + 2);
|
||||
if (path == NULL)
|
||||
return NULL;
|
||||
sprintf(path, "%s/%s", parent_path, node->name);
|
||||
}
|
||||
free(parent_path);
|
||||
return strdup(path);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "util.h"
|
||||
#include "libisofs.h"
|
||||
#include "messages.h"
|
||||
#include "joliet.h"
|
||||
#include "../version.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -916,16 +917,20 @@ ex:;
|
||||
|
||||
/*
|
||||
bit0= no_force_dots
|
||||
bit1= allow 103 characters rather than 64
|
||||
*/
|
||||
uint16_t *iso_j_file_id(const uint16_t *src, int flag)
|
||||
{
|
||||
uint16_t *dot;
|
||||
size_t lname, lext, lnname, lnext, pos, i;
|
||||
uint16_t dest[66]; /* 66 = 64 (name + ext) + 1 (.) + 1 (\0) */
|
||||
size_t lname, lext, lnname, lnext, pos, i, maxchar = 64;
|
||||
uint16_t dest[LIBISO_JOLIET_NAME_MAX];
|
||||
/* was: 66 = 64 (name + ext) + 1 (.) + 1 (\0) */
|
||||
|
||||
if (src == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (flag & 2)
|
||||
maxchar = 103;
|
||||
|
||||
dot = ucsrchr(src, '.');
|
||||
|
||||
@ -937,14 +942,15 @@ uint16_t *iso_j_file_id(const uint16_t *src, int flag)
|
||||
*/
|
||||
if (dot == NULL || cmp_ucsbe(dot + 1, '\0') == 0) {
|
||||
lname = ucslen(src);
|
||||
lnname = (lname > 64) ? 64 : lname;
|
||||
lnname = (lname > maxchar) ? maxchar : lname;
|
||||
lext = lnext = 0;
|
||||
} else {
|
||||
lext = ucslen(dot + 1);
|
||||
lname = ucslen(src) - lext - 1;
|
||||
lnext = (ucslen(src) > 65 && lext > 3) ? (lname < 61 ? 64 - lname : 3)
|
||||
lnext = (ucslen(src) > maxchar + 1 && lext > 3)
|
||||
? (lname < maxchar - 3 ? maxchar - lname : 3)
|
||||
: lext;
|
||||
lnname = (ucslen(src) > 65) ? 64 - lnext : lname;
|
||||
lnname = (ucslen(src) > maxchar + 1) ? maxchar - lnext : lname;
|
||||
}
|
||||
|
||||
if (lnname == 0 && lnext == 0) {
|
||||
@ -986,18 +992,22 @@ is_done:;
|
||||
return ucsdup(dest);
|
||||
}
|
||||
|
||||
uint16_t *iso_j_dir_id(const uint16_t *src)
|
||||
/* @param flag bit1= allow 103 characters rather than 64
|
||||
*/
|
||||
uint16_t *iso_j_dir_id(const uint16_t *src, int flag)
|
||||
{
|
||||
size_t len, i;
|
||||
uint16_t dest[65]; /* 65 = 64 + 1 (\0) */
|
||||
size_t len, i, maxchar = 64;
|
||||
uint16_t dest[LIBISO_JOLIET_NAME_MAX]; /* was: 65 = 64 + 1 (\0) */
|
||||
|
||||
if (src == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (flag & 2)
|
||||
maxchar = 103;
|
||||
|
||||
len = ucslen(src);
|
||||
if (len > 64) {
|
||||
len = 64;
|
||||
if (len > maxchar) {
|
||||
len = maxchar;
|
||||
}
|
||||
for (i = 0; i < len; i++) {
|
||||
uint16_t c = src[i];
|
||||
@ -1840,10 +1850,24 @@ unexpected_type:;
|
||||
iso_msg_submit(-1, ISO_MD5_TAG_UNEXPECTED, 0, NULL);
|
||||
ret = 0;
|
||||
goto ex;
|
||||
} else if(pos != lba) {
|
||||
} else if (pos != lba) {
|
||||
if (*tag_type == 2) { /* Superblock tag */
|
||||
if (lba < 32) {
|
||||
/* Check whether this is a copied superblock */
|
||||
range_start -= (off_t) pos - (off_t) lba;
|
||||
if (range_start != ctx_start_lba) {
|
||||
|
||||
/* >>> check for matching MD5 ? */;
|
||||
|
||||
ret = ISO_MD5_TAG_MISPLACED;
|
||||
} else
|
||||
ret = ISO_MD5_TAG_COPIED;
|
||||
goto ex;
|
||||
}
|
||||
}
|
||||
ret = ISO_MD5_TAG_MISPLACED;
|
||||
goto ex;
|
||||
} else if(range_start != ctx_start_lba) {
|
||||
} else if (range_start != ctx_start_lba) {
|
||||
ret = ISO_MD5_TAG_MISPLACED;
|
||||
}
|
||||
ret = iso_md5_clone(ctx, &cloned_ctx);
|
||||
|
@ -153,13 +153,15 @@ char *iso_r_fileid(const char *src, size_t len, int relaxed, int forcedot);
|
||||
|
||||
/**
|
||||
* Create a Joliet file identifier that consists of name and extension. The
|
||||
* combined name and extension length will not exceed 128 bytes, and the
|
||||
* name and extension will be separated (.). All characters consist of
|
||||
* 2 bytes and the resulting string is NULL-terminated by a 2-byte NULL.
|
||||
* combined name and extension length will normally not exceed 64 characters
|
||||
* (= 128 bytes). The name and the extension will be separated (.).
|
||||
* All characters consist of 2 bytes and the resulting string is
|
||||
* NULL-terminated by a 2-byte NULL.
|
||||
*
|
||||
* Note that version number and (;1) is not appended.
|
||||
* @param flag
|
||||
* bit0= no_force_dots
|
||||
* bit1= allow 103 characters rather than 64
|
||||
* @return
|
||||
* NULL if the original name and extension both are of length 0.
|
||||
*/
|
||||
@ -171,10 +173,12 @@ uint16_t *iso_j_file_id(const uint16_t *src, int flag);
|
||||
* and the name and extension will be separated (.). All characters consist of
|
||||
* 2 bytes and the resulting string is NULL-terminated by a 2-byte NULL.
|
||||
*
|
||||
* @param flag
|
||||
* bit1= allow 103 characters rather than 64
|
||||
* @return
|
||||
* NULL if the original name and extension both are of length 0.
|
||||
*/
|
||||
uint16_t *iso_j_dir_id(const uint16_t *src);
|
||||
uint16_t *iso_j_dir_id(const uint16_t *src, int flag);
|
||||
|
||||
/**
|
||||
* Like strlen, but for Joliet strings.
|
||||
|
Reference in New Issue
Block a user