Compare commits

...

21 Commits

Author SHA1 Message Date
4d8a467e1a Updated changelog. 2019-10-26 15:46:31 +02:00
65c4dce69a Version leap to 1.5.2 2019-10-26 15:44:16 +02:00
fe98b35afb Made sure that iso_image_get_bootcat() cannot return non-zero size with NULL content 2019-08-13 10:13:18 +02:00
130b46cf71 New flag bit2 of iso_node_set_acl_text() to be verbous about failures 2019-07-24 16:11:50 +02:00
eb7dc408e0 Added Alpha to table of content of boot sectors description 2019-07-24 16:06:21 +02:00
a5e209265d Putting doc/boot_sectors.txt into release tarball 2019-04-22 10:30:02 +02:00
458ab43ecd New API call iso_nowtime() 2019-04-18 10:56:01 +02:00
4b21386e82 Bug fix: SIGSEGV happened if options bit 14 of iso_write_opts_set_system_area() is set and no El Torito boot image is defined 2019-04-18 10:49:40 +02:00
c62d9d7b1b Replaced inclusion of version numbers from autotools by those from libisofs.h 2019-04-07 17:31:38 +02:00
3aab1cafc5 Disabled autotools macro AM_MAINTAINER_MODE on advise of Ross Burton 2019-04-07 10:41:49 +02:00
8fbc2fcdfd Made libisofs ready for building out-of-source. Thanks Ross Burton. 2019-04-05 18:04:46 +02:00
aed8bda955 New API calls iso_write_opts_set_part_type_guid(), iso_write_opts_set_iso_type_guid() 2019-02-18 12:47:09 +01:00
e1097dbb5d Changed interface of helper function iso_tell_max_part_range() 2019-01-15 19:07:01 +01:00
a1e75003b5 Bug fix: Appending partitions 5 to 8 caused damaged ISO filesystems if not for SUN disk label 2019-01-15 16:26:56 +01:00
4064a7e0ee Bug fix: Multi-session emulation spoiled GPT production "GPT partitions ... overlap". Regression towards 1.4.8 2019-01-10 20:15:44 +01:00
96261585f1 Bug fix: Appended GPT partitions were not covered by the protective MBR partition 2019-01-10 09:21:43 +01:00
01415ae208 New report line with iso_image_report_el_torito() "El Torito hdsiz/512:" 2018-11-05 14:06:09 +01:00
241b9ea832 Corrected and updated copyright statements 2018-10-06 20:40:08 +02:00
6a6343c146 Updated copyright dates in COPYING and README 2018-09-24 10:13:12 +02:00
a63b16f7da Updated change log 2018-09-16 15:01:42 +02:00
31c4c26567 Version leap to 1.5.1 2018-09-16 15:00:17 +02:00
27 changed files with 637 additions and 88 deletions

View File

@ -2,7 +2,7 @@ Vreixo Formoso <metalpain2002@yahoo.es>,
Mario Danic <mario.danic@gmail.com>,
Vladimir Serbinenko <phcoder@gmail.com>
Thomas Schmitt <scdbackup@gmx.net>
Copyright (C) 2007-2016
Copyright (C) 2007-2018
Vreixo Formoso, Mario Danic, Vladimir Serbinenko, Thomas Schmitt

View File

@ -1,3 +1,20 @@
libisofs-1.5.0.tar.gz Sat Oct 26 2019
===============================================================================
* New API calls iso_write_opts_set_part_type_guid(),
iso_write_opts_set_iso_type_guid()
* New API call iso_nowtime()
* New flag bit2 of iso_node_set_acl_text() to be verbous about failures
* Made libisofs ready for building out-of-source. Thanks Ross Burton.
* Bug fix: Appended GPT partitions were not covered by the protective MBR
partition
* Bug fix: Multi-session emulation spoiled GPT production.
"GPT partitions ... overlap". Regression towards 1.4.8
* Bug fix: Appending partitions 5 to 8 caused damaged ISO filesystems if not
for SUN disk label
* Bug fix: SIGSEGV happened if options bit 14 of
iso_write_opts_set_system_area() is set and no El Torito boot image
is defined
libisofs-1.5.0.tar.gz Sat Sep 15 2018
===============================================================================
* New API call iso_image_get_ignore_aclea(),

View File

@ -1,4 +1,8 @@
# Copyright (c) 2007 Vreixo Formoso
# Copyright (c) 2009 - 2019 Thomas Schmitt
# Provided under the terms of the GNU General Public License version 2 or later.
# ts A90315 : LIBBURNIA_PKGCONFDIR is defined OS specific in acinclude.m4
# was: pkgconfigdir=$(libdir)/pkgconfig
pkgconfigdir=$(LIBBURNIA_PKGCONFDIR)
@ -8,6 +12,9 @@ libincludedir=$(includedir)/libisofs
lib_LTLIBRARIES = libisofs/libisofs.la
ACLOCAL_AMFLAGS = -I ./
# Enable this if the source includes generated files like version.h
# AM_CPPFLAGS = -I $(top_builddir)/libisofs
## ========================================================================= ##
# Build libraries
@ -113,8 +120,8 @@ noinst_PROGRAMS = \
# ts A90807
# Consolidated demo code for having less linker mesages with a make run.
demo_demo_CPPFLAGS = -Ilibisofs
# Consolidated demo code for having less linker messages with a make run.
demo_demo_CPPFLAGS = -I $(top_srcdir)/libisofs
demo_demo_LDADD = $(libisofs_libisofs_la_OBJECTS) $(libisofs_libisofs_la_LIBADD)
demo_demo_SOURCES = demo/demo.c
@ -279,6 +286,7 @@ EXTRA_DIST = \
doc/susp_aaip_isofs_names.txt \
doc/zisofs_format.txt \
doc/checksums.txt \
doc/boot_sectors.txt \
libisofs/libisofs.ver \
libisofs/aaip-os-dummy.c \
libisofs/aaip-os-linux.c \

5
README
View File

@ -2,9 +2,10 @@
libisofs
------------------------------------------------------------------------------
Released under GPL (see COPYING file for details).
Released under GNU General Public License version 2 or later.
See COPYING file for details.
Copyright (C) 2008 - 2016 Vreixo Formoso,
Copyright (C) 2008 - 2018 Vreixo Formoso,
Mario Danic,
Vladimir Serbinenko,
Thomas Schmitt

View File

@ -1,3 +1,8 @@
dnl Copyright (c) 2009 - 2019 Thomas Schmitt
dnl Provided under the terms of the GNU General Public License version 2 or later.
AC_DEFUN([LIBBURNIA_SET_FLAGS],
[
case $target_os in
@ -144,12 +149,12 @@ dnl It tests whether -Wl,--version-script=... works with the compiler
AC_DEFUN([LIBISOFS_ASSERT_VERS_LIBS],
[
libburnia_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--version-script=libisofs/libisofs.ver"
LDFLAGS="$LDFLAGS -Wl,--version-script=$srcdir/libisofs/libisofs.ver"
AC_TRY_LINK([#include <stdio.h>], [printf("Hello\n");],
[vers_libs_test="yes"], [vers_libs_test="no"])
if test x$vers_libs_test = xyes
then
LIBLDFLAGS="-Wl,--version-script=libisofs/libisofs.ver"
LIBLDFLAGS="-Wl,--version-script=$srcdir/libisofs/libisofs.ver"
fi
LDFLAGS="$libburnia_save_LDFLAGS"
AC_SUBST(LIBLDFLAGS)

View File

@ -1,4 +1,4 @@
AC_INIT([libisofs], [1.4.9], [http://libburnia-project.org])
AC_INIT([libisofs], [1.5.2], [http://libburnia-project.org])
AC_PREREQ([2.50])
dnl AC_CONFIG_HEADER([config.h])
@ -40,8 +40,8 @@ dnl
dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match.
dnl
LIBISOFS_MAJOR_VERSION=1
LIBISOFS_MINOR_VERSION=4
LIBISOFS_MICRO_VERSION=9
LIBISOFS_MINOR_VERSION=5
LIBISOFS_MICRO_VERSION=2
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
AC_SUBST(LIBISOFS_MAJOR_VERSION)
@ -51,10 +51,10 @@ AC_SUBST(LIBISOFS_VERSION)
dnl Libtool versioning
LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION
# 2017.09.12 development jump has not yet happened
# SONAME = 90 - 84 = 6 . Library name = libisofs.6.84.0
LT_CURRENT=90
LT_AGE=84
# 2019.10.24 development jump has not yet happened
# SONAME = 94 - 88 = 6 . Library name = libisofs.6.88.0
LT_CURRENT=94
LT_AGE=88
LT_REVISION=0
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
@ -67,7 +67,8 @@ AC_SUBST(LT_CURRENT_MINUS_AGE)
AC_PREFIX_DEFAULT([/usr/local])
test "$prefix" = "NONE" && prefix=$ac_default_prefix
AM_MAINTAINER_MODE
dnl ts B90405 : Disabled on advise of Ross Burton
dnl AM_MAINTAINER_MODE
AM_PROG_CC_C_O
AC_C_CONST

View File

@ -38,6 +38,8 @@ Common Hardware Reference Platform (CHRP), for IBM PowerPC
HP-PA via PALO header version 4
HP-PA via PALO header version 5
DEC Alpha SRM boot sector, for Alpha architecture
Combinations of boot mechanisms:
- SYSLINUX isohybrid MBR
- SYSLINUX isohybrid for MBR, UEFI and x86-Mac

View File

@ -224,13 +224,13 @@ Registered:
-------------------------------------------------------------------------------
This text is under
Copyright (c) 2009 - 2011 Thomas Schmitt <scdbackup@gmx.net>
Copyright (c) 2009 - 2015 Thomas Schmitt <scdbackup@gmx.net>
It shall only be modified in sync with libisofs and other software which
makes use of AAIP. Please mail change requests to mailing list
<bug-xorriso@gnu.org> or to the copyright holder in private.
Only if you cannot reach the copyright holder for at least one month it is
permissible to modify this text under the same license as the affected
copy of libisofs.
copy of libisofs. Currently: GNU General Public License version 2 or later.
If you do so, you commit yourself to taking reasonable effort to stay in
sync with the other interested users of this text.

View File

@ -11,7 +11,12 @@
To be included by aaip_0_2.c
Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+
Copyright (c) 2009 - 2011 Thomas Schmitt
This file is part of the libisofs project; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
or later as published by the Free Software Foundation.
See COPYING file for details.
*/

View File

@ -7,7 +7,12 @@
To be included by aaip_0_2.c for FreeBSD, NetBSD, and OpenBSD
Copyright (c) 2009 - 2016 Thomas Schmitt, libburnia project, GPLv2+
Copyright (c) 2009 - 2016 Thomas Schmitt
This file is part of the libisofs project; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
or later as published by the Free Software Foundation.
See COPYING file for details.
*/

View File

@ -7,7 +7,12 @@
To be included by aaip_0_2.c for Linux
Copyright (c) 2009 - 2018 Thomas Schmitt, libburnia project, GPLv2+
Copyright (c) 2009 - 2018 Thomas Schmitt
This file is part of the libisofs project; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
or later as published by the Free Software Foundation.
See COPYING file for details.
*/

View File

@ -7,7 +7,12 @@
See libisofs/aaip_0_2.h
http://libburnia-project.org/wiki/AAIP
Copyright (c) 2009 - 2016 Thomas Schmitt, libburnia project, GPLv2+
Copyright (c) 2009 - 2019 Thomas Schmitt
This file is part of the libisofs project; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
or later as published by the Free Software Foundation.
See COPYING file for details.
*/
@ -27,6 +32,7 @@
#include "libisofs.h"
#include "util.h"
#include "messages.h"
/*
#define Aaip_encode_debuG 1
@ -275,6 +281,7 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
bit2= this is a default ACL, prepend SWITCH_MARK
bit3= check for completeness of list and eventually
fill up with entries deduced from st_mode
bit4= be verbous about failure causes
@return >0 means ok
<=0 means error
-1= out of memory
@ -290,7 +297,7 @@ int aaip_encode_acl(char *acl_text, mode_t st_mode,
*result= NULL;
*result_len= 0;
bytes= aaip_encode_acl_text(acl_text, st_mode,
(size_t) 0, NULL, 1 | (flag & (2 | 4 | 8)));
(size_t) 0, NULL, 1 | (flag & (2 | 4 | 8 | 16)));
if(bytes < -2)
return(bytes);
if(bytes < 0)
@ -305,7 +312,7 @@ int aaip_encode_acl(char *acl_text, mode_t st_mode,
(*result)[bytes]= 0;
*result_len= bytes;
bytes= aaip_encode_acl_text(acl_text, st_mode, *result_len, *result,
(flag & (2 | 4 | 8)));
(flag & (2 | 4 | 8 | 16)));
if(bytes < -2)
return(bytes);
if(bytes < 0)
@ -357,6 +364,7 @@ static int aaip_make_aaip_perms(int r, int w, int x)
bit2= this is a default ACL, prepend SWITCH_MARK 1
bit3= check for completeness of list and eventually
fill up with entries deduced from st_mode
bit4= be verbous about failure causes
@return >=0 number of bytes produced resp. counted
<0 means error
-1: result size overflow
@ -383,7 +391,7 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
/* set SWITCH_MARK to indicate a default ACL */;
if(!(flag & 1)) {
if((size_t) count >= result_size)
{ret= -1; goto ex;}
goto result_size_overflow;
result[count]= (Aaip_SWITCH_MARK << 4) | Aaip_EXEC;
}
count++;
@ -412,6 +420,9 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
/* >>> Duplicate u:: entry. */;
/* >>> ??? If it matches the previous one: ignore */
if(flag & 16)
iso_msg_submit(-1, ISO_AAIP_ACL_MULT_OBJ, 0,
"Duplicate u:: entry detected in ACL text");
ret = ISO_AAIP_ACL_MULT_OBJ;
goto ex;
}
@ -429,6 +440,9 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
num= aaip_numeric_id(name, 0);
if(num <= 0) {
/* ACL_USER is not part of AAIP 2.0 */
if(flag & 16)
iso_msg_submit(-1, ISO_AAIP_BAD_ACL_TEXT, 0,
"Unknown user name found in ACL text: '%s'", name);
{ret= -2; goto ex;}
}
uid= huid= num;
@ -458,6 +472,9 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
/* >>> Duplicate g:: entry. */;
/* >>> ??? If it matches the previous one: ignore */
if(flag & 16)
iso_msg_submit(-1, ISO_AAIP_ACL_MULT_OBJ, 0,
"Duplicate g:: entry detected in ACL text");
ret = ISO_AAIP_ACL_MULT_OBJ;
goto ex;
}
@ -475,6 +492,9 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
num= aaip_numeric_id(name, 0);
if(num <= 0) {
/* ACL_GROUP is not part of AAIP 2.0 */
if(flag & 16)
iso_msg_submit(-1, ISO_AAIP_BAD_ACL_TEXT, 0,
"Unknown group name found in ACL text: '%s'", name);
{ret= -2; goto ex;}
}
gid= hgid= num;
@ -503,6 +523,9 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
/* >>> Duplicate o:: entry. */;
/* >>> ??? If it matches the previous one: ignore */
if(flag & 16)
iso_msg_submit(-1, ISO_AAIP_ACL_MULT_OBJ, 0,
"Duplicate o:: entry detected in ACL text");
ret = ISO_AAIP_ACL_MULT_OBJ;
goto ex;
}
@ -519,7 +542,7 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
if(!(flag & 1)) {
if((size_t) count >= result_size)
{ret= -1; goto ex;}
goto result_size_overflow;
result[count]= perms | ((!!qualifier) << 3) | (type << 4);
}
count++;
@ -528,7 +551,7 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
num_recs= (qualifier_len / 127) + !!(qualifier_len % 127);
if(!(flag & 1)) {
if((size_t) (count + 1) > result_size)
{ret= -1; goto ex;}
goto result_size_overflow;
for(i= 0; i < num_recs; i++) {
if(i < num_recs - 1)
result[count++]= 255;
@ -538,7 +561,7 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
result[count - 1]= 127;
}
if((size_t) (count + (result[count - 1] & 127)) > result_size)
{ret= -1; goto ex;}
goto result_size_overflow;
memcpy(result + count, name + i * 127, result[count - 1] & 127);
count+= result[count - 1] & 127;
}
@ -553,7 +576,7 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
count+= needed;
else {
if((size_t) (count + needed) > result_size)
{ret= -1; goto ex;}
goto result_size_overflow;
}
}
if ((flag & 8) && needed > 0 && !(flag & 1)) {
@ -582,6 +605,13 @@ static ssize_t aaip_encode_acl_text(char *acl_text, mode_t st_mode,
ex:;
LIBISO_FREE_MEM(name);
return(ret);
result_size_overflow:;
if(flag & 16)
iso_msg_submit(-1, ISO_ASSERT_FAILURE, 0,
"Program error: Text to ACL conversion result size overflow");
ret= -1;
goto ex;
}
@ -593,13 +623,14 @@ int aaip_encode_both_acl(char *a_acl_text, char *d_acl_text, mode_t st_mode,
unsigned char *a_acl= NULL, *d_acl= NULL, *acl= NULL;
if(a_acl_text != NULL) {
ret= aaip_encode_acl(a_acl_text, st_mode, &a_acl_len, &a_acl, flag & 11);
ret= aaip_encode_acl(a_acl_text, st_mode, &a_acl_len, &a_acl,
flag & (1 | 2 | 8 | 16));
if(ret <= 0)
goto ex;
}
if(d_acl_text != NULL) {
ret= aaip_encode_acl(d_acl_text, (mode_t) 0, &d_acl_len, &d_acl,
(flag & 3) | 4);
(flag & (1 | 2 | 16)) | 4);
if(ret <= 0)
goto ex;
}

View File

@ -9,7 +9,12 @@
test/aaip_0_2.h - Public declarations
Copyright (c) 2009 - 2016 Thomas Schmitt, libburnia project, GPLv2+
Copyright (c) 2009 - 2016 Thomas Schmitt
This file is part of the libisofs project; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
or later as published by the Free Software Foundation.
See COPYING file for details.
*/

View File

@ -347,7 +347,6 @@ Updated change log
libisofs/aaip-os-freebsd.c
Fixed failure to build on NetBSD because of undeclared variable
------------------------------------ release - libisofs-1.5.0 - 15 Sep 2018
* New API call iso_image_get_ignore_aclea(),
new iso_image_set_ignore_aclea() and iso_file_source_get_aa_string()
@ -364,3 +363,142 @@ Fixed failure to build on NetBSD because of undeclared variable
* Bug fix: Reading beyond array end for HFS+ production caused SIGSEGV with
FreeBSD 11 CLANG -O2. Thanks ASX of GhostBSD.
16 Sep 2018 [31c4c26]
configure.ac
libisofs/libisofs.h
Version leap to 1.5,1
16 Sep 2018 [a63b16f]
ChangeLog
libisofs/changelog.txt
Updated change log
24 Sep 2018 [6a6343c]
COPYRIGHT
README
Updated copyright dates in COPYING and README
06 Oct 2018 [241b9ea]
README
Makefile.am
acinclude.m4
libisofs/make_isohybrid_mbr.c
libisofs/aaip-os-dummy.c
libisofs/aaip-os-freebsd.c
libisofs/aaip-os-linux.c
libisofs/aaip_0_2.h
libisofs/aaip_0_2.c
doc/susp_aaip_isofs_names.txt
Corrected and updated copyright statements
05 Nov 2018 [01415ae]
libisofs/libisofs.h
libisofs/eltorito.h
libisofs/fs_image.c
New report line with iso_image_report_el_torito() "El Torito hdsiz/512:"
10 Jan 2019 [9626158]
libisofs/system_area.c
Bug fix: Appended GPT partitions were not covered by the protective MBR partition
10 Jan 2019 [4064a7e]
libisofs/ecma119.c
libisofs/system_area.h
libisofs/system_area.c
Bug fix: Multi-session emulation spoiled GPT production "GPT partitions ... overlap". Regression towards 1.4.8
15 Jan 2019 [a1e7500]
libisofs/ecma119.h
libisofs/ecma119.c
libisofs/system_area.c
Bug fix: Appending partitions 5 to 8 caused damaged ISO filesystems if not for SUN disk label
15 Jan 2019 [e1097db]
libisofs/ecma119.h
libisofs/ecma119.c
libisofs/system_area.c
Changed interface of helper function iso_tell_max_part_range()
18 Feb 2019 [aed8bda]
libisofs/libisofs.h
libisofs/ecma119.h
libisofs/ecma119.c
libisofs/system_area.c
libisofs/libisofs.ver
New API calls iso_write_opts_set_part_type_guid(), iso_write_opts_set_iso_type_guid()
05 Apr 2019 [8fbc2fc]
acinclude.m4
Makefile.am
Made libisofs ready for building out-of-source. Thanks Ross Burton.
07 Apr 2019 [3aab1ca]
configure.ac
Disabled autotools macro AM_MAINTAINER_MODE on advise of Ross Burton.
07 Apr 2019 [c62d9d7]
Makefile.am
libisofs/util.c
Replaced inclusion of version numbers from autotools by those from libisofs.h
18 Apr 2019 [4b21386]
libisofs/system_area.c
Bug fix: SIGSEGV happened if options bit 14 of iso_write_opts_set_system_area()
is set and no El Torito boot image is defined
18 Apr 2019 [458ab43]
libisofs/libisofs.h
libisofs/libisofs.ver
libisofs/ecma119.c
libisofs/node.c
libisofs/tree.c
libisofs/eltorito.c
libisofs/util.c
New API call iso_nowtime()
22 Apr 2019 [a5e2092]
Makefile.am
Putting doc/boot_sectors.txt into release tarball
24 Jul 2019 [eb7dc40]
doc/boot_sectors.txt
Added Alpha to table of content of boot sectors description
24 Jul 2019 [130b46c]
libisofs/libisofs.h
libisofs/node.c
libisofs/aaip_0_2.c
New flag bit2 of iso_node_set_acl_text() to be verbous about failures
13 Aug 2019 [fe98b35]
libisofs/eltorito.c
Made sure that iso_image_get_bootcat() cannot return non-zero size with NULL content
26 Oct 2019 [65c4dce]
configure.ac
libisofs/libisofs.h
Version leap to 1.5.2.
26 Oct 2019 []
ChangeLog
libisofs/changelog.txt
Updated change log
------------------------------------ release - libisofs-1.5.2 - 26 Oct 2019
* New API calls iso_write_opts_set_part_type_guid(),
iso_write_opts_set_iso_type_guid()
* New API call iso_nowtime()
* New flag bit2 of iso_node_set_acl_text() to be verbous about failures
* Made libisofs ready for building out-of-source. Thanks Ross Burton.
* Bug fix: Appended GPT partitions were not covered by the protective MBR
partition
* Bug fix: Multi-session emulation spoiled GPT production.
"GPT partitions ... overlap". Regression towards 1.4.8
* Bug fix: Appending partitions 5 to 8 caused damaged ISO filesystems if not
for SUN disk label
* Bug fix: SIGSEGV happened if options bit 14 of
iso_write_opts_set_system_area() is set and no El Torito boot image
is defined
------------------------------------ release - libisofs- -

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2007 Mario Danic
* Copyright (c) 2009 - 2018 Thomas Schmitt
* Copyright (c) 2009 - 2019 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -2418,7 +2418,7 @@ void ecma119_determine_now_time(Ecma119Image *target)
uint8_t time_text[18];
int i;
t0 = time(NULL);
iso_nowtime(&t0, 0);
o = target->opts;
if (o->vol_uuid[0]) {
for(i = 0; i < 16; i++)
@ -3189,6 +3189,9 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
goto target_cleanup;
}
/* Delete the filler partitions of GPT and APM so that write_function()
can insert new ones for a possibly different total_size */;
iso_delete_gpt_apm_fillers(target, 0);
}
/* This was possibly altered by above overwrite buffer production */
@ -3585,11 +3588,15 @@ int iso_write_opts_new(IsoWriteOpts **opts, int profile)
wopts->appended_partitions[i] = NULL;
wopts->appended_part_types[i] = 0;
wopts->appended_part_flags[i] = 0;
memset(wopts->appended_part_type_guids[i], 0, 16);
wopts->appended_part_gpt_flags[i] = 0;
}
wopts->appended_as_gpt = 0;
wopts->appended_as_apm = 0;
wopts->part_like_isohybrid = 0;
wopts->iso_mbr_part_type = -1;
memset(wopts->iso_gpt_type_guid, 0, 16);
wopts->iso_gpt_flag= 0;
wopts->ascii_disc_label[0] = 0;
wopts->will_cancel = 0;
wopts->allow_dir_id_ext = 0;
@ -4307,6 +4314,20 @@ int iso_write_opts_set_partition_img(IsoWriteOpts *opts, int partition_number,
return ISO_SUCCESS;
}
int iso_write_opts_set_part_type_guid(IsoWriteOpts *opts, int partition_number,
uint8_t guid[16], int valid)
{
if (partition_number < 1 || partition_number > ISO_MAX_PARTITIONS)
return ISO_BAD_PARTITION_NO;
if (valid)
memcpy(opts->appended_part_type_guids[partition_number - 1], guid, 16);
if (valid)
opts->appended_part_gpt_flags[partition_number - 1]|= 1;
else
opts->appended_part_gpt_flags[partition_number - 1]&= ~1;
return ISO_SUCCESS;
}
int iso_write_opts_set_appended_as_gpt(IsoWriteOpts *opts, int gpt)
{
opts->appended_as_gpt = !!gpt;
@ -4333,6 +4354,15 @@ int iso_write_opts_set_iso_mbr_part_type(IsoWriteOpts *opts, int part_type)
return ISO_SUCCESS;
}
int iso_write_opts_set_iso_type_guid(IsoWriteOpts *opts, uint8_t guid[16],
int valid)
{
if (valid)
memcpy(opts->iso_gpt_type_guid, guid, 16);
opts->iso_gpt_flag = (opts->iso_gpt_flag & ~1) | !!valid;
return ISO_SUCCESS;
}
int iso_write_opts_set_disc_label(IsoWriteOpts *opts, char *label)
{
strncpy(opts->ascii_disc_label, label, ISO_DISC_LABEL_SIZE - 1);
@ -4598,15 +4628,16 @@ ex: /* LIBISO_ALLOC_MEM failed */
}
/* Obtains start and end number of appended partition range and returns
the number of valid entries in the list of appended partitions.
/* Determines the range of valid partition numbers depending on partition
table type.
*/
int iso_count_appended_partitions(Ecma119Image *target,
int *first_partition, int *last_partition)
void iso_tell_max_part_range(IsoWriteOpts *opts,
int *first_partition, int *last_partition,
int flag)
{
int sa_type, i, count= 0;
int sa_type;
sa_type = (target->system_area_options >> 2) & 0x3f;
sa_type = (opts->system_area_options >> 2) & 0x3f;
if (sa_type == 3) { /* SUN Disk Label */
*first_partition = 2;
*last_partition = 8;
@ -4614,6 +4645,18 @@ int iso_count_appended_partitions(Ecma119Image *target,
*first_partition = 1;
*last_partition = 4;
}
}
/* Obtains start and end number of appended partition range and returns
the number of valid entries in the list of appended partitions.
*/
int iso_count_appended_partitions(Ecma119Image *target,
int *first_partition, int *last_partition)
{
int i, count= 0;
iso_tell_max_part_range(target->opts, first_partition, last_partition, 0);
for (i = *first_partition - 1; i <= *last_partition - 1; i++) {
if (target->opts->appended_partitions[i] == NULL)
continue;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2018 Thomas Schmitt
* Copyright (c) 2009 - 2019 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -476,12 +476,19 @@ struct iso_write_opts {
char *efi_boot_partition;
int efi_boot_part_flag;
/* Eventual disk file paths of prepared images which shall be appended
after the ISO image and described by partiton table entries in a MBR
/* Disk file paths of prepared images which shall be appended
after the ISO image and described by partiton table entries in a MBR.
NULL means unused.
*/
char *appended_partitions[ISO_MAX_PARTITIONS];
uint8_t appended_part_types[ISO_MAX_PARTITIONS];
int appended_part_flags[ISO_MAX_PARTITIONS];
uint8_t appended_part_type_guids[ISO_MAX_PARTITIONS][16];
/* Flags in case that appended partitions show up in GPT:
bit0= appended_part_type_guids is valid
*/
uint8_t appended_part_gpt_flags[ISO_MAX_PARTITIONS];
/* If 1: With appended partitions: create protective MBR and mark by GPT
*/
@ -504,6 +511,14 @@ struct iso_write_opts {
*/
int iso_mbr_part_type;
/* iso_write_opts_set_iso_type_guid
*/
uint8_t iso_gpt_type_guid[16];
/* bit0= iso_gpt_type_guid is valid
*/
int iso_gpt_flag;
/* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label.
*/
char ascii_disc_label[ISO_DISC_LABEL_SIZE];
@ -1055,4 +1070,11 @@ int iso_interval_reader_start_size(Ecma119Image *t, char *path,
int iso_count_appended_partitions(Ecma119Image *target,
int *first_partition, int *last_partition);
/* Determines the range of valid partition numbers depending on partition
table type.
*/
void iso_tell_max_part_range(IsoWriteOpts *opts,
int *first_partition, int *last_partition,
int flag);
#endif /*LIBISO_ECMA119_H_*/

View File

@ -312,7 +312,7 @@ int iso_tree_add_boot_node(IsoDir *parent, const char *name, IsoBoot **boot)
node->node.hidden = parent->node.hidden;
/* current time */
now = time(NULL);
iso_nowtime(&now, 0);
node->node.atime = now;
node->node.ctime = now;
node->node.mtime = now;
@ -711,13 +711,14 @@ int iso_image_get_bootcat(IsoImage *image, IsoBoot **catnode, uint32_t *lba,
return 0;
*catnode = bootcat;
*lba = bootcat->lba;
*size = bootcat->size;
if (bootcat->size > 0 && bootcat->content != NULL) {
*content = calloc(1, bootcat->size);
if (*content == NULL)
return ISO_OUT_OF_MEM;
memcpy(*content, bootcat->content, bootcat->size);
}
if (*content != NULL)
*size = bootcat->size;
return 1;
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2010 - 2014 Thomas Schmitt
* Copyright (c) 2010 - 2018 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -81,8 +81,15 @@ struct el_torito_boot_image {
* bit8= Mention in isohybrid Apple partition map
*/
unsigned int isolinux_options;
unsigned char type; /**< The type of image */
unsigned char type; /**< The type of image :
0=no emulation , 1=fd 1.2 MB , 2=fd 1.4 MB
3=fd 3.8 MB , 4=hdd (size in partition table)
*/
unsigned char partition_type; /**< type of partition for HD-emul images */
uint32_t emul_hdd_size; /* 512-bytes LBA after highest partition end from
HD-emul partition table
*/
uint16_t load_seg; /**< Load segment for the initial boot image. */
uint16_t load_size; /**< Number of sectors to load. */
int load_size_full; /* 1= override load_size by image size */

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2016 Thomas Schmitt
* Copyright (c) 2009 - 2018 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -4946,7 +4946,7 @@ void iso_impsysa_report_blockpath(IsoImage *image,
return;
size = next_above - start_block;
/* Replace in msg "path" by "blks", report number in bytes */
/* Replace in msg "path" by "blks", report number in blocks of 2048 */
cpt = strstr(msg, "path");
if (cpt == NULL)
return;
@ -5352,6 +5352,35 @@ int iso_report_help(char **doc, char ***result, int *line_count, int flag)
return ISO_SUCCESS;
}
static
uint32_t iso_impsysa_hdd_emul_size(IsoImage *image, IsoDataSource *src,
uint32_t lba, int flag)
{
uint32_t max_size = 0, start_lba, num_blocks;
int i, ret;
uint8_t *buffer = NULL;
/* Obtain first block of image */
LIBISO_ALLOC_MEM(buffer, uint8_t, 2048);
ret = src->read_block(src, lba, buffer);
if (ret < 0)
goto ex;
/* Check for magic number of MBR */
if (buffer[510] != 0x55 || buffer[511] != 0xaa)
goto ex;
for (i = 0; i < 4; i++) {
start_lba = iso_read_lsb(buffer + 454 + 16 * i, 4);
num_blocks = iso_read_lsb(buffer + 458 + 16 * i, 4);
if (start_lba + num_blocks > max_size)
max_size = start_lba + num_blocks;
}
ex:;
LIBISO_FREE_MEM(buffer);
return max_size;
}
static
int iso_eltorito_report(IsoImage *image, struct iso_impsysa_result *target,
int flag)
@ -5428,6 +5457,11 @@ int iso_eltorito_report(IsoImage *image, struct iso_impsysa_result *target,
if (lba_mem[i] != 0xffffffff) {
sprintf(msg, "El Torito img path : %3d ", i + 1);
iso_impsysa_report_blockpath(image, target, msg, lba_mem[i], 1);
if (img->type == 4 && img->emul_hdd_size > 0) {
sprintf(msg, "El Torito hdsiz/512: %3d %u",
i + 1, (unsigned int) img->emul_hdd_size);
iso_impsysa_line(target, msg);
}
}
sprintf(msg, "El Torito img opts : %3d ", i + 1);
if (img->seems_boot_info_table)
@ -5886,6 +5920,13 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
memcpy(boot_image->selection_crit, data->selection_crits, 20);
boot_image->appended_idx = -1;
boot_image->appended_start = data->bootblocks[idx];
if (boot_image->type == 4) {
boot_image->emul_hdd_size = iso_impsysa_hdd_emul_size(
image, src,
data->bootblocks[idx], 0);
} else {
boot_image->emul_hdd_size = 0;
}
catalog->bootimages[catalog->num_bootimages] = boot_image;
boot_image = NULL;

View File

@ -4,7 +4,7 @@
/*
* Copyright (c) 2007-2008 Vreixo Formoso, Mario Danic
* Copyright (c) 2009-2017 Thomas Schmitt
* Copyright (c) 2009-2019 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -94,7 +94,7 @@ extern "C" {
*/
#define iso_lib_header_version_major 1
#define iso_lib_header_version_minor 5
#define iso_lib_header_version_micro 0
#define iso_lib_header_version_micro 2
/**
* Get version of the libisofs library at runtime.
@ -1251,6 +1251,27 @@ int iso_set_local_charset(char *name, int flag);
*/
char *iso_get_local_charset(int flag);
/**
* Inquire and maybe define the time which is considered to be "now" and
* used for timestamps of freshly created ISO nodes and as default of
* image timestamps.
* If ever, this should normally be enabled and defined before iso_image_new().
* If it is disabled, time(NULL) is considered to be "now".
*
* @param now
* Returns the "now" value and maybe submits it as definition.
* @param flag
* Bitfield for control purposes
* bit0= *now contains the time to be set as nowtime override.
Enable the override if not bit1 is set, too.
* bit1= Disable the nowtime override
* @return 1= *now is not overridden , 2= *now is overridden
*
* @since 1.5.2
*/
int iso_nowtime(time_t *now, int flag);
/**
* Create a new image, empty.
*
@ -2626,9 +2647,10 @@ int iso_write_opts_set_efi_bootp(IsoWriteOpts *opts, char *image_path,
* @param opts
* The option set to be manipulated.
* @param guid
* 16 bytes of user supplied GUID. Readily byte-swapped as prescribed by
* UEFI specs: 4 byte, 2 byte, 2 byte as little-endian. The rest as
* big-endian.
* 16 bytes of user supplied GUID. Readily byte-swapped from the text
* form as prescribed by UEFI specs:
* 4 byte, 2 byte, 2 byte as little-endian.
* 2 byte, 6 byte as big-endian.
* The upper 4 bit of guid[7] should bear the value 4 to express the
* RFC 4122 version 4. Bit 7 of byte[8] should be set to 1 and bit 6
* be set to 0, in order to express the RFC 4122 variant of UUID,
@ -2721,6 +2743,32 @@ int iso_write_opts_set_partition_img(IsoWriteOpts *opts, int partition_number,
*/
int iso_write_opts_set_appended_as_gpt(IsoWriteOpts *opts, int gpt);
/**
* Set the GPT Type GUID for a partition defined by
* iso_write_opts_set_partition_img().
*
* @param opts
* The option set to be manipulated.
* @param partition_number
* Depicts the partition table entry which shall get the Type GUID.
* @param guid
* 16 bytes of user supplied GUID. Readily byte-swapped from the text
* form as prescribed by UEFI specs:
* 4 byte, 2 byte, 2 byte as little-endian.
* 2 byte, 6 byte as big-endian.
* @param valid
* Set to 1 to make this Type GUID valid.
* Set to 0 in order to invalidate a previously made setting. In this
* case MBR type 0xEF will become the EFI Type GUID. All others will
* become the Basic Data Partition Type GUID.
* @return
* ISO_SUCCESS or error
*
* @since 1.5.2
*/
int iso_write_opts_set_part_type_guid(IsoWriteOpts *opts, int partition_number,
uint8_t guid[16], int valid);
/**
* Control whether partitions created by iso_write_opts_set_partition_img()
* are to be represented in Apple Partition Map.
@ -2780,10 +2828,35 @@ int iso_write_opts_set_part_like_isohybrid(IsoWriteOpts *opts, int alike);
* 0x00 to 0xff as desired partition type.
* Any other value (e.g. -1) enables the default types of the various
* occasions.
* @return
* ISO_SUCCESS or error
* @since 1.4.8
*/
int iso_write_opts_set_iso_mbr_part_type(IsoWriteOpts *opts, int part_type);
/**
* Set the GPT Type GUID for the partition which represents the ISO 9660
* filesystem, if such a partition emerges in GPT.
* @param opts
* The option set to be manipulated.
* @param guid
* 16 bytes of user supplied GUID. Readily byte-swapped from the text
* form as prescribed by UEFI specs:
* 4 byte, 2 byte, 2 byte as little-endian.
* 2 byte, 6 byte as big-endian.
* @param valid
* Set to 1 to make this Type GUID valid.
* Set to 0 in order to invalidate a previously made setting. In this
* case the setting of iso_write_opts_set_iso_mbr_part_type() or its
* default will get into effect.
* @return
* ISO_SUCCESS or error
*
* @since 1.5.2
*/
int iso_write_opts_set_iso_type_guid(IsoWriteOpts *opts, uint8_t guid[16],
int valid);
/**
* Inquire the start address of the file data blocks after having used
* IsoWriteOpts with iso_image_create_burn_source().
@ -4440,6 +4513,12 @@ int iso_image_report_system_area(IsoImage *image,
" The boot image is supposed to end before the start block of any", \
" other entity of the ISO filesystem.", \
" (This line is not reported if no limiting entity is found.)", \
" El Torito hdsiz/512: X decimal", \
" gives with a boot image of emulation type \"hd\" the lowest block", \
" number which is above any partition end in the boot image's MBR", \
" partition table. This can be considered the claimed size of the", \
" emulated hard disk given in blocks of 512 bytes.", \
" (This line is not reported if no partition is found in the image.)", \
""
/**
@ -7337,9 +7416,13 @@ int iso_node_get_acl_text(IsoNode *node,
* the permissions of newly created files.)
* @param flag
* Bitfield for control purposes
* bit1= ignore text parameters but rather update eventual "access" ACL
* bit0= Do not change the stat(2) permissions.
* Caution: This can make the node's permission set inconsistent.
* bit1= Ignore text parameters but rather update the "access" ACL
* to the stat(2) permissions of node. If no "access" ACL exists,
* then do nothing and return success.
* bit2= Be verbous about failure causes.
* @since 1.5.2
* @return
* > 0 success
* < 0 failure

View File

@ -226,6 +226,7 @@ iso_node_unref;
iso_node_xinfo_get_cloner;
iso_node_xinfo_make_clonable;
iso_node_zf_by_magic;
iso_nowtime;
iso_obtain_msgs;
iso_read_image_features_destroy;
iso_read_image_features_get_size;
@ -334,6 +335,7 @@ iso_write_opts_set_hfsplus;
iso_write_opts_set_iso1999;
iso_write_opts_set_iso_level;
iso_write_opts_set_iso_mbr_part_type;
iso_write_opts_set_iso_type_guid;
iso_write_opts_set_joliet;
iso_write_opts_set_joliet_long_names;
iso_write_opts_set_joliet_longer_paths;
@ -347,6 +349,7 @@ iso_write_opts_set_output_charset;
iso_write_opts_set_overwrite_buf;
iso_write_opts_set_part_offset;
iso_write_opts_set_part_like_isohybrid;
iso_write_opts_set_part_type_guid;
iso_write_opts_set_partition_img;
iso_write_opts_set_prep_img;
iso_write_opts_set_pvd_times;

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2002 - 2008 H. Peter Anvin
* Copyright (c) 2008 - 2015 Thomas Schmitt
* with special credits to H. Peter Anvin for isohybrid
* and to Matthew Garrett for isohybrid with GPT and APM
* with special credits to Matthew Garrett for isohybrid with GPT and APM
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2016 Thomas Schmitt
* Copyright (c) 2009 - 2019 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -1460,6 +1460,7 @@ void iso_notify_dir_iters(IsoNode *node, int flag)
int iso_node_new_root(IsoDir **root)
{
IsoDir *dir;
time_t now;
dir = calloc(1, sizeof(IsoDir));
if (dir == NULL) {
@ -1467,7 +1468,8 @@ int iso_node_new_root(IsoDir **root)
}
dir->node.refcount = 1;
dir->node.type = LIBISO_DIR;
dir->node.atime = dir->node.ctime = dir->node.mtime = time(NULL);
iso_nowtime(&now, 0);
dir->node.atime = dir->node.ctime = dir->node.mtime = now;
dir->node.mode = S_IFDIR | 0555;
/* set parent to itself, to prevent root to be added to another dir */
@ -2259,12 +2261,14 @@ int iso_node_set_acl_text(IsoNode *node, char *access_text, char *default_text,
goto ex;
}
ret = aaip_encode_both_acl(a_text, d_text, st_mode,
&acl_len, &acl, 2 | 8);
&acl_len, &acl,
2 | 8 | ((flag & 4) << 2));
} else {
ret = 1;
if (access_text != NULL || default_text != NULL)
ret = aaip_encode_both_acl(access_text, default_text, st_mode,
&acl_len, &acl, 2 | 8);
&acl_len, &acl,
2 | 8 | ((flag & 4) << 2));
}
if (ret == -1)
ret = ISO_OUT_OF_MEM;
@ -2323,7 +2327,8 @@ int iso_node_set_acl_text(IsoNode *node, char *access_text, char *default_text,
goto ex;
}
ret = aaip_encode_both_acl(access_text, default_text,
st_mode, &acl_len, &acl, 2 | 8);
st_mode, &acl_len, &acl,
2 | 8 | ((flag & 4) << 2));
if (ret < -3)
goto ex;
if (ret <= 0) {

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2008 Vreixo Formoso
* Copyright (c) 2010 - 2018 Thomas Schmitt
* Copyright (c) 2010 - 2019 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -153,8 +153,10 @@ static int compute_partition_size(Ecma119Image *t, char *disk_path,
int iso_compute_append_partitions(Ecma119Image *t, int flag)
{
int ret, i, sa_type, cyl_align, cyl_size = 0;
int first_partition, last_partition;
uint32_t pos, size, add_pos = 0;
off_t start_byte, byte_count;
char msg[128];
sa_type = (t->system_area_options >> 2) & 0x3f;
cyl_align = (t->system_area_options >> 8) & 0x3;
@ -176,11 +178,20 @@ int iso_compute_append_partitions(Ecma119Image *t, int flag)
#endif
iso_tell_max_part_range(t->opts, &first_partition, &last_partition, 0);
for (i = 0; i < ISO_MAX_PARTITIONS; i++) {
if (t->opts->appended_partitions[i] == NULL)
continue;
if (t->opts->appended_partitions[i][0] == 0)
continue;
if (i + 1 > last_partition || i + 1 < first_partition) {
sprintf(msg,
"Partition number %d of appended partition is out of range [%d - %d]",
i + 1, first_partition, last_partition);
iso_msgs_submit(0, msg, 0, "FAILURE", 0);
return ISO_BAD_PARTITION_NO;
}
ret = compute_partition_size(t, t->opts->appended_partitions[i], &size,
t->opts->appended_part_flags[i]);
if (ret < 0)
@ -1031,6 +1042,7 @@ int iso_quick_apm_entry(struct iso_apm_partition_request **req_array,
entry->block_count = block_count;
strncpy((char *) entry->name, name, 32);
strncpy((char *) entry->type, type, 32);
entry->req_status = 0;
ret = iso_register_apm_entry(req_array, apm_req_count, entry, 0);
free(entry);
return ret;
@ -1076,6 +1088,7 @@ int iso_quick_gpt_entry(struct iso_gpt_partition_request **req_array,
memcpy(entry->partition_guid, partition_guid, 16);
entry->flags = flags;
memcpy(entry->name, name, 72);
entry->req_status = 0;
ret = iso_register_gpt_entry(req_array, gpt_req_count, entry, 0);
free(entry);
return ret;
@ -1287,6 +1300,8 @@ static int fill_apm_gaps(Ecma119Image *t, uint32_t img_blocks)
gap_name, "ISO9660_data");
if (ret < 0)
return ret;
/* Mark as automatically placed filler request */
t->apm_req[t->apm_req_count - 1]->req_status |= 1;
}
}
@ -1711,6 +1726,7 @@ static int iso_write_gpt(Ecma119Image *t, uint32_t img_blocks, uint8_t *buf)
struct iso_gpt_partition_request *req;
uint8_t gpt_name[72];
static uint8_t zero_uuid[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static uint8_t *type_guid;
static uint64_t gpt_flags = (((uint64_t) 1) << 60) | 1;
if (t->gpt_req_count == 0)
@ -1759,19 +1775,25 @@ static int iso_write_gpt(Ecma119Image *t, uint32_t img_blocks, uint8_t *buf)
}
} else if (part_end < goal) {
memset(gpt_name, 0, 72);
type_guid = basic_data_uuid;
if (goal == t->vol_space_size * (uint64_t) 4 &&
part_end == t->opts->partition_offset * (uint64_t) 4)
part_end == t->opts->partition_offset * (uint64_t) 4) {
sprintf((char *) gpt_name, "ISO9660");
else
if (t->opts->iso_gpt_flag & 1)
type_guid = t->opts->iso_gpt_type_guid;
} else {
sprintf((char *) gpt_name, "Gap%d", gap_counter);
}
iso_ascii_utf_16le(gpt_name);
gap_counter++;
ret = iso_quick_gpt_entry(t->gpt_req, &(t->gpt_req_count),
part_end, goal - part_end,
basic_data_uuid, zero_uuid,
type_guid, zero_uuid,
gpt_flags, gpt_name);
if (ret < 0)
return ret;
/* Mark as automatically placed filler request */
t->gpt_req[t->gpt_req_count - 1]->req_status |= 1;
}
}
/* Merge list of gap partitions with list of already sorted entries */
@ -1856,10 +1878,8 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
memset(buf, 0, 16 * BLOCK_SIZE);
sa_type = (t->system_area_options >> 2) & 0x3f;
if (sa_type == 3) {
first_partition = 2;
last_partition = 8;
}
iso_tell_max_part_range(t->opts, &first_partition, &last_partition, 0);
for (i = first_partition - 1; i <= last_partition - 1; i++)
if (t->opts->appended_partitions[i] != NULL) {
will_append = 1;
@ -2079,6 +2099,21 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
}
}
/* Check for protective MBR in mbr_req and adjust to GPT size */
if (t->gpt_req_count > 0 && sa_type == 0 && t->mbr_req_count == 1) {
if (t->mbr_req[0]->type_byte == 0xee && buf[450] == 0xee &&
t->mbr_req[0]->desired_slot <= 1) {
part_type = 0xee;
risk_of_ee = 1;
ret = write_mbr_partition_entry(1, part_type,
(uint64_t) 1, ((uint64_t) gpt_blocks) * 4 - 1,
t->partition_secs_per_head, t->partition_heads_per_cyl,
buf, 2);
if (ret < 0)
return ret;
}
}
if (t->opts->partition_offset > 0 && sa_type == 0 &&
t->mbr_req_count == 0) {
/* Adjust partition table to partition offset.
@ -2110,7 +2145,7 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
return ISO_ASSERT_FAILURE;
}
/* This eventually overwrites the non-mbr_req partition table entries
/* This possibly overwrites the non-mbr_req partition table entries
made so far. Overwriting those from t->mbr_req is not allowed.
*/
if (sa_type == 3 || !t->opts->appended_as_gpt) {
@ -2140,6 +2175,9 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
if (sa_type == 0 && (t->system_area_options & 0x4000) && !do_isohybrid) {
/* Patch MBR for GRUB2 */
if (t->num_bootsrc <= 0)
return iso_msg_submit(t->image->id, ISO_BOOT_IMAGE_NOT_VALID, 0,
"No boot image found as jump target for GRUB2 MBR.");
if (t->bootsrc[0] == NULL)
return iso_msg_submit(t->image->id, ISO_BOOT_IMAGE_NOT_VALID, 0,
"Cannot refer by GRUB2 MBR to data outside of ISO 9660 filesystem.");
@ -2634,7 +2672,9 @@ int assess_appended_gpt(Ecma119Image *t, int flag)
memset(gpt_name, 0, 72);
sprintf((char *) gpt_name, "Appended%d", i + 1);
iso_ascii_utf_16le(gpt_name);
if (t->opts->appended_part_types[i] == 0xef)
if (t->opts->appended_part_gpt_flags[i] & 1)
type_uuid = t->opts->appended_part_type_guids[i];
else if (t->opts->appended_part_types[i] == 0xef)
type_uuid = efi_sys_uuid;
else
type_uuid = basic_data_uuid;
@ -3169,20 +3209,15 @@ static int partappend_writer_write_vol_desc(IsoImageWriter *writer)
static int partappend_writer_write_data(IsoImageWriter *writer)
{
Ecma119Image *target;
int res, first_partition = 1, last_partition = 0, sa_type;
int res, first_partition = 1, last_partition = 0;
int i;
target = writer->target;
/* Append partition data */
sa_type = (target->system_area_options >> 2) & 0x3f;
if (sa_type == 0) { /* MBR */
first_partition = 1;
last_partition = 4;
} else if (sa_type == 3) { /* SUN Disk Label */
first_partition = 2;
last_partition = 8;
}
iso_tell_max_part_range(target->opts,
&first_partition, &last_partition, 0);
for (i = first_partition - 1; i <= last_partition - 1; i++) {
if (target->opts->appended_partitions[i] == NULL)
continue;
@ -3231,3 +3266,42 @@ int partappend_writer_create(Ecma119Image *target)
#endif /* Libisofs_appended_partitions_inlinE */
void iso_delete_gpt_apm_fillers(Ecma119Image *target, int flag)
{
int i, widx;
/* Dispose the requests with req_status bit0 */
for (i = 0; i < target->gpt_req_count; i++) {
if (target->gpt_req[i]->req_status & 1) {
free(target->gpt_req[i]);
target->gpt_req[i] = NULL;
}
}
/* Densify the request arrays */
widx = 0;
for (i = 0; i < target->gpt_req_count; i++) {
if (target->gpt_req[i] != NULL) {
target->gpt_req[widx] = target->gpt_req[i];
widx++;
}
}
target->gpt_req_count = widx;
/* And again for APM */
for (i = 0; i < target->apm_req_count; i++) {
if (target->apm_req[i]->req_status & 1) {
free(target->apm_req[i]);
target->apm_req[i] = NULL;
}
}
widx = 0;
for (i = 0; i < target->apm_req_count; i++) {
if (target->apm_req[i] != NULL) {
target->apm_req[widx] = target->apm_req[i];
widx++;
}
}
target->apm_req_count = widx;
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2008 Vreixo Formoso
* Copyright (c) 2012 - 2015 Thomas Schmitt
* Copyright (c) 2012 - 2019 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -155,6 +155,11 @@ struct iso_apm_partition_request {
*/
uint8_t name[32];
uint8_t type[32];
/* Status of the request object itself:
bit0= this is an automatically placed filler partition
*/
uint32_t req_status;
};
/* Copies the content of req and registers it in t.apm_req[].
@ -239,6 +244,11 @@ struct iso_gpt_partition_request {
/* Only if read from imported image: Table index of partition (first = 1)
*/
uint32_t idx;
/* Status of the request object itself:
bit0= this is an automatically placed filler partition
*/
uint32_t req_status;
};
/* Copies the content of req and registers it in t.gpt_req[].
@ -258,6 +268,11 @@ int iso_quick_gpt_entry(struct iso_gpt_partition_request **req_array,
uint8_t type_guid[16], uint8_t partition_guid[16],
uint64_t flags, uint8_t name[72]);
/* Deletes the partition requests for gap filling in GPT and APM.
Purpose is to get the request list clean again after a multi-session
emulation superblock was created and handed to the application.
*/
void iso_delete_gpt_apm_fillers(Ecma119Image *target, int flag);
/* Internal helper that will be used by system_area.c and make_isohybrid_mbr.c
*/

View File

@ -87,7 +87,7 @@ int iso_tree_add_new_dir(IsoDir *parent, const char *name, IsoDir **dir)
iso_node_set_hidden((IsoNode*)node, parent->node.hidden);
/* current time */
now = time(NULL);
iso_nowtime(&now, 0);
iso_node_set_atime((IsoNode*)node, now);
iso_node_set_ctime((IsoNode*)node, now);
iso_node_set_mtime((IsoNode*)node, now);
@ -175,7 +175,7 @@ int iso_tree_add_new_symlink(IsoDir *parent, const char *name,
iso_node_set_hidden((IsoNode*)node, parent->node.hidden);
/* current time */
now = time(NULL);
iso_nowtime(&now, 0);
iso_node_set_atime((IsoNode*)node, now);
iso_node_set_ctime((IsoNode*)node, now);
iso_node_set_mtime((IsoNode*)node, now);
@ -278,7 +278,7 @@ int iso_tree_add_new_special(IsoDir *parent, const char *name, mode_t mode,
iso_node_set_hidden((IsoNode*)node, parent->node.hidden);
/* current time */
now = time(NULL);
iso_nowtime(&now, 0);
iso_node_set_atime((IsoNode*)node, now);
iso_node_set_ctime((IsoNode*)node, now);
iso_node_set_mtime((IsoNode*)node, now);
@ -367,7 +367,7 @@ int iso_tree_add_new_file(IsoDir *parent, const char *name, IsoStream *stream,
iso_node_set_hidden((IsoNode*)node, parent->node.hidden);
/* current time */
now = time(NULL);
iso_nowtime(&now, 0);
iso_node_set_atime((IsoNode*)node, now);
iso_node_set_ctime((IsoNode*)node, now);
iso_node_set_mtime((IsoNode*)node, now);

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2007 Mario Danic
* Copyright (c) 2009 - 2015 Thomas Schmitt
* Copyright (c) 2009 - 2019 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -18,7 +18,6 @@
#include "messages.h"
#include "joliet.h"
#include "node.h"
#include "../version.h"
#include <stdlib.h>
#include <wchar.h>
@ -1978,9 +1977,18 @@ ex:;
void iso_lib_version(int *major, int *minor, int *micro)
{
*major = iso_lib_header_version_major;
*minor = iso_lib_header_version_minor;
*micro = iso_lib_header_version_micro;
/* No more: values from version.h generated from version.h.in and
macro values defined in configure.ac
*major = LIBISOFS_MAJOR_VERSION;
*minor = LIBISOFS_MINOR_VERSION;
*micro = LIBISOFS_MICRO_VERSION;
*/
}
int iso_lib_is_compatible(int major, int minor, int micro)
@ -2448,3 +2456,27 @@ int iso_truncate_leaf_name(int mode, int length, char *name, int flag)
return ret;
}
/* API */
/* @param flag bit0= *now contains the time to be set as nowtime override
bit1= disable the nowtime override
@return 1= *now is not overridden , 2= *now is overridden
*/
int iso_nowtime(time_t *now, int flag)
{
static int now_time_overridden = 0;
static time_t now_time_override = 0;
if (flag & 1) {
now_time_overridden = 1;
now_time_override = *now;
}
if (flag & 2) {
now_time_overridden = 0;
}
*now = time(NULL);
if (!now_time_overridden)
return 1;
*now = now_time_override;
return 2;
}