Compare commits
34 Commits
release-0.
...
release-0.
Author | SHA1 | Date | |
---|---|---|---|
386ce0e60a | |||
9fe4172f0d | |||
61f2cdd02b | |||
f87c63da41 | |||
afebbe187d | |||
3951df25be | |||
4b0f175a89 | |||
633a8ada9e | |||
ce723a8c39 | |||
83ace3b486 | |||
23d3c43022 | |||
00470cbfea | |||
4c1abdf2bd | |||
f7842518fb | |||
d756551385 | |||
ced02f5903 | |||
819e3218f6 | |||
c874a159e2 | |||
a68e108333 | |||
da23a8166c | |||
cbb376a137 | |||
3852621bc0 | |||
0ff4cb34ed | |||
d863451771 | |||
78308eea24 | |||
0ab2b8260c | |||
a30bd36a81 | |||
3814396b08 | |||
f88d8a76b0 | |||
6bc1395e15 | |||
6bf538ff40 | |||
c992687200 | |||
9cfa55345e | |||
d9a11a3b8d |
@ -1,12 +1,12 @@
|
||||
Vreixo Formoso <metalpain2002@yahoo.es>,
|
||||
Mario Danic <mario.danic@gmail.com>,
|
||||
Thomas Schmitt <scdbackup@gmx.net>
|
||||
Copyright (C) 2007-2008 Vreixo Formoso, Mario Danic, Thomas Schmitt
|
||||
Copyright (C) 2007-2010 Vreixo Formoso, Mario Danic, Thomas Schmitt
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2 as
|
||||
published by the Free Software Foundation.
|
||||
it under the terms of the GNU General Public License version 2 or later
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -261,6 +261,7 @@ EXTRA_DIST = \
|
||||
doc/susp_aaip_2_0.txt \
|
||||
doc/susp_aaip_isofs_names.txt \
|
||||
doc/zisofs_format.txt \
|
||||
doc/checksums.txt \
|
||||
libisofs/aaip-os-dummy.c \
|
||||
libisofs/aaip-os-linux.c \
|
||||
libisofs/aaip-os-freebsd.c
|
||||
|
260
README
260
README
@ -4,15 +4,17 @@
|
||||
|
||||
Released under GPL (see COPYING file for details).
|
||||
|
||||
Copyright (C) 2008 Vreixo Formoso, Mario Danic, Thomas Schmitt
|
||||
Copyright (C) 2008 - 2010 Vreixo Formoso, Mario Danic, Thomas Schmitt
|
||||
|
||||
libisofs is part of the libburnia project (libburnia-project.org)
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
libisofs is a library to create an ISO-9660 filesystem, and supports extensions
|
||||
like RockRidge or Joliet. It is also a full featured ISO-9660 editor, allowing
|
||||
you to modify an ISO image or multisession disc, including file addition and
|
||||
removal, change of file names and attributes, etc
|
||||
libisofs is a library to create an ISO-9660 filesystem, supports extensions
|
||||
like RockRidge or Joliet, and introduces an own extension AAIP.
|
||||
It is a full featured ISO-9660 editor which composes and changes the directory
|
||||
tree of an ISO image. This tree and its newly imported data file contents get
|
||||
then written as independent single-session image or as add-on session for the
|
||||
image from where the tree was originally loaded.
|
||||
|
||||
Features:
|
||||
---------
|
||||
@ -20,24 +22,45 @@ Features:
|
||||
- Image creation
|
||||
- Creates ISO-9660 images from local files.
|
||||
- Support for RockRidge and Joliet extensions.
|
||||
- Support for ISO-9660:1999 (version 2)
|
||||
- Support for ISO-9660:1999 (version 2).
|
||||
- Support for El-Torito bootable images.
|
||||
- Full featured edition of file names and attributes on the image.
|
||||
- Several options to relax ISO-9660 constraints.
|
||||
- Special options for images intended for distribution (suitable default
|
||||
modes for files, hiding of real timestamps...)
|
||||
- Multisession
|
||||
- Support for growing an existing image
|
||||
- Support for multi-extent data files up to 400 GB (level 3).
|
||||
- Full-featured edition of the image files, including: addition of new
|
||||
files, removing of existent files, moving files, renaming files,
|
||||
change file attributes (permissions, timestamps...)
|
||||
- Support for "emulated multisession" or image growing, suitable for non
|
||||
multisession media such as DVD+RW
|
||||
- Optional recording per file of non-ISO 9660 features:
|
||||
ACL, xattr, content MD5, hard link relations.
|
||||
They do not hamper image readability by operating systems but can be
|
||||
retrieved only via libisofs.
|
||||
- Optional zisofs compression, gzip compression, external filter
|
||||
processes.
|
||||
- Several options to relax ISO-9660 constraints.
|
||||
- Special options for images intended for distribution (suitable
|
||||
default modes for files, hiding of real timestamps...).
|
||||
- Image reading
|
||||
- Image tree and data heap can be verified by stream reading and
|
||||
eventually recorded MD5 tags.
|
||||
- Directory tree and file attributes of ISO 9660 session get loaded
|
||||
into memory for editing or for extraction into local filesystem.
|
||||
- File content can be read by applications.
|
||||
- Automatic zisofs decompression.
|
||||
- Optional application of gzip decompression or external filter
|
||||
processes.
|
||||
- Eventually recorded MD5 of data file can be obtained, MD5 of data
|
||||
stream can be computed and compared.
|
||||
- Helper functions for restoring ACL and/or xattr to the local
|
||||
filesystem.
|
||||
- Multisession
|
||||
- Support for growing an existing image on multi-session media.
|
||||
- Support for "emulated multisession" on overwriteable media such as
|
||||
DVD+RW, USB sticks, regular files.
|
||||
- Support for blindly prepared add-on sessions (mkisofs style -M -C)
|
||||
suitable for pipes which lead to an external burn program.
|
||||
- Image modification
|
||||
- It can create a completely new image from files on another image.
|
||||
- Full-featured edition of image contents
|
||||
- Creates a completely new image from files out of another image and
|
||||
eventual editing operations. Suitable for any target medium.
|
||||
- Others
|
||||
- Handling of different input and output charset
|
||||
- Handling of different input and output charset.
|
||||
- Good integration with libburn for image burning.
|
||||
- Reliable, good handling of different kind of errors.
|
||||
|
||||
@ -56,9 +79,8 @@ a) Images with unsupported features, such as:
|
||||
- UDF.
|
||||
- HSF/HFS+ or other Mac extensions.
|
||||
- El-Torito with multiple entries.
|
||||
- ECMA-119 with extended attributes, multiple extends per file.
|
||||
- ECMA-119 with extended attributes.
|
||||
- Non El-Torito boot info.
|
||||
- zisofs compressed images.
|
||||
- ...
|
||||
In all these cases, the resulting new image (or new session) could lack some
|
||||
features of the original image.
|
||||
@ -123,178 +145,11 @@ To make the libraries accessible for running resp. developing applications
|
||||
See INSTALL file for further details.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Overview of libburnia-project.org
|
||||
|
||||
libburnia-project.org is an open-source software project for reading, mastering
|
||||
and writing optical discs.
|
||||
For now this means only CD media and all single layer DVD media except DVD+R.
|
||||
|
||||
The project comprises of several more or less interdependent parts which
|
||||
together strive to be a usable foundation for application development.
|
||||
These are libraries, language bindings, and middleware binaries which emulate
|
||||
classical (and valuable) Linux tools.
|
||||
|
||||
Our scope is currently Linux 2.4 and 2.6 only. For ports to other systems
|
||||
we would need : login on a development machine resp. a live OS on CD or DVD,
|
||||
advise from a system person about the equivalent of Linux sg or FreeBSD CAM,
|
||||
volunteers for testing of realistic use cases.
|
||||
|
||||
We have a workable code base for burning CD and most single layer DVD.
|
||||
The burn API is quite comprehensively documented and can be used to build a
|
||||
presentable application.
|
||||
We have a functional binary which emulates parts of cdrecord in order to
|
||||
prove that usability, and in order to allow you to explore libburnia's scope
|
||||
by help of existing cdrecord frontends.
|
||||
|
||||
The project components (list subject to growth, hopefully):
|
||||
|
||||
- libburn is the library by which preformatted data get onto optical media.
|
||||
It uses either /dev/sgN (e.g. on kernel 2.4 with ide-scsi) or
|
||||
/dev/hdX (e.g. on kernel 2.6).
|
||||
libburn is the foundation of our cdrecord emulation. Its code is
|
||||
independent of cdrecord. Its DVD capabilities are learned from
|
||||
studying the code of dvd+rw-tools and MMC-5 specs. No code but only
|
||||
the pure SCSI knowledge has been taken from dvd+rw-tools, though.
|
||||
|
||||
- libisofs is the library to pack up hard disk files and directories into a
|
||||
ISO 9660 disk image. This may then be brought to media via libburn.
|
||||
libisofs is to be the foundation of our upcoming mkisofs emulation.
|
||||
|
||||
- cdrskin is a limited cdrecord compatibility wrapper for libburn.
|
||||
Cdrecord is a powerful GPL'ed burn program included in Joerg
|
||||
Schilling's cdrtools. cdrskin strives to be a second source for
|
||||
the services traditionally provided by cdrecord. Additionally it
|
||||
provides libburn's DVD capabilities, where only -sao is compatible
|
||||
with cdrecord.
|
||||
cdrskin does not contain any bytes copied from cdrecord's sources.
|
||||
Many bytes have been copied from the message output of cdrecord
|
||||
runs, though.
|
||||
See cdrskin/README and man cdrskin/cdrskin.1 for more.
|
||||
|
||||
- test is a collection of application gestures and examples given by the
|
||||
authors of the library features. The main API example for libburn
|
||||
is test/libburner.c .
|
||||
Explore these examples if you look for inspiration.
|
||||
|
||||
We plan to be a responsive upstream. Bear with us. We are still practicing.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
Project history as far as known to me:
|
||||
|
||||
- Founded in 2002 as it seems. See mailing list archives
|
||||
http://lists.freedesktop.org/archives/libburn/
|
||||
The site of this founder team is reachable and offers download of a
|
||||
(somewhat outdated) tarball and from CVS :
|
||||
http://icculus.org/burn/
|
||||
Copyright holders and most probably founders:
|
||||
Derek Foreman and Ben Jansens.
|
||||
|
||||
- I came to using libburn in 2005. Founded the cdrskin project and submitted
|
||||
necessary patches which were accepted or implemented better. Except one
|
||||
remaining patch which prevented cdrskin from using vanilla libburn from CVS.
|
||||
The cdrskin project site is reachable and offers download of the heavily
|
||||
patched (elsewise outdated) tarball under the name cdrskin-0.1.2 :
|
||||
http://scdbackup.sourceforge.net/cdrskin_eng.html
|
||||
It has meanwhile moved to use vanilla libburn.pykix.org , though.
|
||||
Version 0.1.4 constitutes the first release of this kind.
|
||||
|
||||
- In July 2006 our team mate Mario Danic announced a revival of libburn
|
||||
which by about nearly everybody else was perceived as unfriendly fork.
|
||||
Derek Foreman four days later posted a message which expressed his
|
||||
discontent.
|
||||
The situation first caused me to publically regret it and then - after i
|
||||
got the opportunity to move in with cdrskin - gave me true reason to
|
||||
personally apologize to Derek Foreman, Ben Jansens and the contibutors at
|
||||
icculus.org/burn. Posted to both projects:
|
||||
http://lists.freedesktop.org/archives/libburn/2006-August/000446.html
|
||||
http://mailman-mail1.webfaction.com/pipermail/libburn-hackers/2006-August/000024.html
|
||||
|
||||
- Mid August 2006 project cdrskin established a branch office in
|
||||
libburn.pykix.org so that all maintainers of our tools have one single place
|
||||
to get the current (at least slightely) usable coordinated versions of
|
||||
everything.
|
||||
Project cdrskin will live forth independendly for a while but it is committed
|
||||
to stay in sync with libburn.pykix.org (or some successor, if ever).
|
||||
cdrskin is also committed to support icculus.org/burn if the pending fork
|
||||
is made reality by content changes in that project. It will cease to maintain
|
||||
a patched version of icculus.org/burn though. Precondition for a new
|
||||
release of cdrskin on base of icculus.org/burn would be the pending
|
||||
"whitelist patch" therefore.
|
||||
I would rather prefer if both projects find consense and merge, or at least
|
||||
cooperate. I have not given up hope totally, yet.
|
||||
I, personally, will honor any approach.
|
||||
|
||||
- 2nd September 2006 the decision is made to strive for a consolidation of
|
||||
copyright and a commitment to GPL in a reasonable and open minded way.
|
||||
This is to avoid long term problems with code of unknown origin and
|
||||
with finding consense among the not so clearly defined group of copyright
|
||||
claimers and -holders.
|
||||
libisofs is already claimed sole copyright Mario Danic.
|
||||
cdrskin and libburner are already claimed sole copyright Thomas Schmitt.
|
||||
Rewrites of other components will follow and concluded by claiming full
|
||||
copyright within the group of libburn.pykix.org-copyright holders.
|
||||
|
||||
- 16th September 2006 feature freeze for release of libburn-0.2.2 .
|
||||
|
||||
- 20th September 2006 release of libburn-0.2.2 .
|
||||
|
||||
- 26th October 2006 feature freeze for cdrskin-0.2.4 based on libburn-0.2.3 .
|
||||
This version of cdrskin is much more cdrecord compatible in repect
|
||||
to drive addressing and audio features.
|
||||
|
||||
- 30th October 2006 release of cdrskin-0.2.4 .
|
||||
|
||||
- 13th November 2006 splitting releases of libburn+cdrskin from libisofs.
|
||||
|
||||
- 24th November 2006 release of libburn-0.2.6 and cdrskin-0.2.6 . cdrskin has
|
||||
become suitable for unaware frontends as long as they perform only the core
|
||||
of cdrecord use cases (including open-ended input streams, audio, and
|
||||
multi-session).
|
||||
|
||||
- 28th November 2006 the umbrella project which encloses both, libisofs and
|
||||
libburn, is now called libburnia. For the origin of this name, see
|
||||
http://en.wikipedia.org/wiki/Liburnians .
|
||||
|
||||
- 16th January 2007 release of libburn-0.3.0 and cdrskin-0.3.0 . Now the scope
|
||||
is widened to a first class of DVD media: overwriteable single layer types
|
||||
DVD-RAM, DVD+RW, DVD-RW. This is not a cdrecord emulation but rather inspired
|
||||
by dvd+rw-tools' "poor man" writing facility for this class of media.
|
||||
Taking a bow towards Andy Polyakov.
|
||||
|
||||
- 11th February 2007 version 0.3.2 covers sequential DVD-RW and DVD-R with
|
||||
multi-session and with DAO.
|
||||
|
||||
- 12th March 2007 version 0.3.4 supports DVD+R and thus covers all single layer
|
||||
DVD media. Code for double layer DVD+/-R is implemented but awaits a tester
|
||||
yet.
|
||||
|
||||
- 23th April 2007 version 0.3.6 follows the unanimous opinion of Linux kernel
|
||||
people that one should not use /dev/sg on kernel 2.6.
|
||||
|
||||
- 31st July 2007 version 0.3.8 marks the first anniversary of libburn revival.
|
||||
We look back on improved stability, a substantially extended list of media
|
||||
and write modes, and better protection against typical user mishaps.
|
||||
|
||||
- 24th October 2007 version 0.4.0 is the foundation of new library libisoburn
|
||||
and an upcomming integrated application for manipulating and writing
|
||||
ISO 9660 + Rock Ridge images. cdrskin-0.4.0 got capabilities like growisofs
|
||||
by these enhancements: growing of overwriteable media and disk files.
|
||||
Taking again a bow towards Andy Polyakov.
|
||||
|
||||
- 26th Januar 2008 version 0.4.2 rectifies the version numbering so that we
|
||||
reliably release libburn.so.4 as should have been done since libburn-0.3.2.
|
||||
cdrskin now is by default linked dynamically and does a runtime check
|
||||
to ensure not to be started with a libburn which is older than itself.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation. To be exact: version 2 of that License.
|
||||
it under the terms of the GNU General Public License version 2 or later
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ -309,19 +164,19 @@ Project history as far as known to me:
|
||||
Clarification in my name and in the name of Mario Danic, upcoming copyright
|
||||
holders on toplevel of libburnia. To be fully in effect after the remaining
|
||||
other copyrighted code has been replaced by ours and by copyright-free
|
||||
contributions of our friends:
|
||||
contributions of our friends.
|
||||
|
||||
Note:
|
||||
In the particular case of libisofs there is no foreign copyright involved.
|
||||
As of 2010 foreign copyright is only in component libburn.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
We, the copyright holders, agree on the interpretation that
|
||||
dynamical linking of our libraries constitutes "use of" and
|
||||
not "derivation from" our work in the sense of GPL, provided
|
||||
those libraries are compiled from our unaltered code.
|
||||
|
||||
Thus you may link our libraries dynamically with applications
|
||||
which are not under GPL. You may distribute our libraries and
|
||||
application tools in binary form, if you fulfill the usual
|
||||
condition of GPL to offer a copy of the source code -altered
|
||||
or unaltered- under GPL.
|
||||
We will not raise any legal protest to dynamic linking of our libraries
|
||||
with applications that are not under GPL, as long as they fulfill
|
||||
the condition of offering the library source code used, whether
|
||||
altered or unaltered, under the GPLv2+, along with the application.
|
||||
Nevertheless, the safest legal position is not to link libburn with
|
||||
non-GPL compatible programs.
|
||||
|
||||
We ask you politely to use our work in open source spirit
|
||||
and with the due reference to the entire open source community.
|
||||
@ -335,7 +190,10 @@ It is the open source idea of responsible freedom which will be
|
||||
decisive and you will have to prove that you exhausted all own
|
||||
means to qualify for GPL.
|
||||
|
||||
For now we are firmly committed to maintain one single license: GPL.
|
||||
We are firmly committed to allow GPLv2+ now and with future releases.
|
||||
|
||||
signed: Mario Danic, Thomas Schmitt
|
||||
Signed: Mario Danic, Thomas Schmitt
|
||||
Agreement joined later by: Vreixo Formoso
|
||||
|
||||
Public contact: <libburn-hackers@pykix.org>
|
||||
|
||||
|
11
acinclude.m4
11
acinclude.m4
@ -1,3 +1,14 @@
|
||||
AC_DEFUN([LIBBURNIA_SET_FLAGS],
|
||||
[
|
||||
case $target_os in
|
||||
freebsd*)
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([TARGET_SHIZZLE],
|
||||
[
|
||||
ARCH=""
|
||||
|
22
configure.ac
22
configure.ac
@ -1,10 +1,12 @@
|
||||
AC_INIT([libisofs], [0.6.22], [http://libburnia-project.org])
|
||||
AC_INIT([libisofs], [0.6.28], [http://libburnia-project.org])
|
||||
AC_PREREQ([2.50])
|
||||
dnl AC_CONFIG_HEADER([config.h])
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
LIBBURNIA_SET_FLAGS
|
||||
|
||||
AM_INIT_AUTOMAKE([subdir-objects])
|
||||
|
||||
dnl A61101 This breaks Linux build (makes 32 bit off_t)
|
||||
@ -37,14 +39,14 @@ dnl iso_lib_version(). It returns the major, minor and micro revision of the
|
||||
dnl library. This means LIBISOFS_*_VERSION kept its second job which does not
|
||||
dnl comply to the usual ways of configure.ac . I.e. now *officially* this is
|
||||
dnl the source code release version as announced to the public. It has no
|
||||
dnl conection to SONAME or libtool version numbering.
|
||||
dnl connection to SONAME or libtool version numbering.
|
||||
dnl It rather feeds the API function iso_lib_version().
|
||||
dnl
|
||||
dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match.
|
||||
dnl
|
||||
LIBISOFS_MAJOR_VERSION=0
|
||||
LIBISOFS_MINOR_VERSION=6
|
||||
LIBISOFS_MICRO_VERSION=22
|
||||
LIBISOFS_MICRO_VERSION=28
|
||||
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
|
||||
|
||||
AC_SUBST(LIBISOFS_MAJOR_VERSION)
|
||||
@ -54,11 +56,11 @@ AC_SUBST(LIBISOFS_VERSION)
|
||||
|
||||
dnl Libtool versioning
|
||||
LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION
|
||||
# 2009.08.25 development jump has not yet happened
|
||||
# SONAME = 24 - 18 = 6 . Library name = libisofs.6.18.0
|
||||
LT_CURRENT=24
|
||||
# 2010.02.10 development jump has not yet happened
|
||||
# SONAME = 30 - 24 = 6 . Library name = libisofs.6.24.0
|
||||
LT_CURRENT=30
|
||||
LT_AGE=24
|
||||
LT_REVISION=0
|
||||
LT_AGE=18
|
||||
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
|
||||
|
||||
AC_SUBST(LT_RELEASE)
|
||||
@ -196,9 +198,11 @@ AC_ARG_ENABLE(zlib,
|
||||
if test "x$enable_zlib" = xyes; then
|
||||
dnl Check whether there is the header for zlib.
|
||||
dnl If not, erase this macro which would enable use of compress2() and others.
|
||||
dnl The empty parameter after "compress2" causes -lz.
|
||||
dnl Linking fails on SuSE 9.0 because zlib has compress2() but lacks
|
||||
dnl compressBound(). So compressBound is the more modern thing to test.
|
||||
dnl The empty parameter after "compressBound" causes -lz.
|
||||
ZLIB_DEF="-DLibisofs_with_zliB"
|
||||
AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, compress2, , ZLIB_DEF= ), ZLIB_DEF= )
|
||||
AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, compressBound, , ZLIB_DEF= ), ZLIB_DEF= )
|
||||
else
|
||||
ZLIB_DEF=
|
||||
fi
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "libisofs.h"
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "libisofs.h"
|
||||
|
11
demo/demo.c
11
demo/demo.c
@ -3,9 +3,9 @@
|
||||
* Copyright (c) 2007 - 2009 Vreixo Formoso, 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
static char helptext[][80] = {
|
||||
@ -65,6 +65,11 @@ static char helptext[][80] = {
|
||||
#include <fcntl.h>
|
||||
#include <err.h>
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
/* ------------------------- from demo/tree.c ----------------------- */
|
||||
|
||||
static void
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -10,6 +10,12 @@
|
||||
|
||||
#include "libisofs.h"
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
print_permissions(mode_t mode)
|
||||
{
|
||||
|
11
demo/lsl.c
11
demo/lsl.c
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "libisofs.h"
|
||||
@ -13,6 +14,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Little test program to test filesystem implementations.
|
||||
*
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
by Thomas Schmitt - mailto:scdbackup@gmx.net
|
||||
Libburnia project - mailto:libburn-hackers@pykix.org
|
||||
16 Aug 2009
|
||||
26 Aug 2009
|
||||
|
||||
|
||||
MD5 is a 128 bit message digest with a very low probability to be the same for
|
||||
@ -59,7 +59,7 @@ Entry number N + 1 holds the MD5 checksum of entries 0 to N.
|
||||
|
||||
Because the inquiry of AAIP attributes demands loading of the image tree,
|
||||
there are also checksum tags which can be detected on the fly when reading
|
||||
and checksumming the session from the start point as learned from a media
|
||||
and checksumming the session from its start point as learned from a media
|
||||
table-of-content.
|
||||
|
||||
The superblock checksum tag is written after the ECMA-119 volume descriptors.
|
||||
@ -67,8 +67,8 @@ The tree checksum tag is written after the ECMA-119 directory entries.
|
||||
The session checksum tag is written after all payload including the checksum
|
||||
array. (Then follows eventual padding.)
|
||||
|
||||
The tags are a single lines of printable text, padded by 0 bytes. They have
|
||||
the following format:
|
||||
The tags are single lines of printable text at the very beginning of a block
|
||||
of 2048 bytes. They have the following format:
|
||||
|
||||
Tag_id pos=# range_start=# range_size=# [session_start|next=#] md5=# self=#\n
|
||||
|
||||
@ -79,16 +79,15 @@ Tag_id distinguishes the following tag types
|
||||
"libisofs_checksum_tag_v1" Session tag
|
||||
|
||||
A relocated superblock may appear at LBA 0 of an image which was produced for
|
||||
being stored in a disk file or on overwriteable media (e.g. DVD+R, BD-RE).
|
||||
being stored in a disk file or on overwriteable media (e.g. DVD+RW, BD-RE).
|
||||
Typically there is a first session recorded with a superblock at LBA 32 and
|
||||
the next session may follow shortly after its session tag. (There may be a gap
|
||||
of padding, often 150 blocks, and aligning to the next address that is
|
||||
divisible by 32.) Normally no session starts after the address given by
|
||||
parameter session_start=.
|
||||
the next session may follow shortly after its session tag. (Typically at the
|
||||
next block address which is divisible by 32.) Normally no session starts after
|
||||
the address given by parameter session_start=.
|
||||
|
||||
Session oriented media like CD-R[W], DVD+R, BD-R will have no relocated
|
||||
superblock but rather bear a table-of-content on media level (to be inquired
|
||||
by MMC commands(.
|
||||
by MMC commands).
|
||||
|
||||
|
||||
Example:
|
||||
@ -162,9 +161,14 @@ checksums as strings of 32 hex digits.
|
||||
The MD5 checksum of the tag itself up to and including the last hex digit of
|
||||
parameter "md5=".
|
||||
|
||||
The newline character at the end is mandatory. For now all bytes of the
|
||||
block after that newline shall be zero. There may arise future extensions.
|
||||
The newline character at the end is mandatory. After that newline there may
|
||||
follow more lines. Their meaning is not necessarily described in this document.
|
||||
|
||||
One such line type is the scdbackup checksum tag, an ancestor of libisofs tags
|
||||
which is suitable only for single session images which begin at LBA 0. It bears
|
||||
a checksum record which by its MD5 covers all bytes from LBA 0 up to the
|
||||
newline character preceding the scdbackup tag. See scdbackup/README appendix
|
||||
VERIFY for details.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
@ -183,11 +187,11 @@ whether its MD5 matches the MD5 of the data blocks which were read before.
|
||||
|
||||
With tag type 2:
|
||||
|
||||
Keep the original MD5 context of the data blocks and clone
|
||||
one for obtaining the MD5 bytes.
|
||||
If the MD5s match, then compute the checksum block into the kept MD5 context
|
||||
and go on with reading and computing for the tree checksum tag. This will be
|
||||
found at block address next_tag, verified and parsed by:
|
||||
Keep the original MD5 context of the data blocks and clone one for obtaining
|
||||
the MD5 bytes.
|
||||
If the MD5s match, then compute the checksum block and all folowing ones into
|
||||
the kept MD5 context and go on with reading and computing for the tree checksum
|
||||
tag. This will be found at block address next_tag, verified and parsed by:
|
||||
iso_util_decode_md5_tag(block, &tag_type, &pos,
|
||||
&range_start, &range_size, &next_tag, md5, 3);
|
||||
|
||||
@ -200,14 +204,12 @@ With tag type 4:
|
||||
End the MD5 context and start a new context for the session which you will
|
||||
read next.
|
||||
|
||||
You may look for the first session by starting to read at LBA 32, or you may
|
||||
look for the last session by starting to read at the address given by parameter
|
||||
session_start=. The former is suitable for a check of the whole image, the
|
||||
latter is the shortest way to ensure that the tree of the last session is
|
||||
not corrupted.
|
||||
Then look for the actual session by starting to read at the address given by
|
||||
parameter session_start= which is returned by iso_util_decode_md5_tag() as
|
||||
next_tag. Go on by looking for tag type 2 and follow above prescription.
|
||||
|
||||
|
||||
Checking a Whole Session
|
||||
Checking the Data Part of the Session
|
||||
|
||||
In order to check the trustworthyness of a whole session, continue reading
|
||||
and checksumming after the tree was verified.
|
||||
@ -224,6 +226,20 @@ bytes in parameter md5 match the MD5 computed from the data blocks which were
|
||||
read before the tag block.
|
||||
|
||||
|
||||
Checking All Sessions
|
||||
|
||||
If the media is sequentially recordable, obtain a table of content and check
|
||||
the first track of each session as prescribed above in Checking Before Image
|
||||
Tree Loading and in Checking the Data Part of the Session.
|
||||
|
||||
With disk files or overwriteable media, look for a relocated superblock tag
|
||||
but do not hop to address next_tag (given by session_start=). Instead look at
|
||||
LBA 32 for the first session and check it as prescribed above.
|
||||
After reaching its end, round up the read address to the next multiple of 32
|
||||
and check whether it is smaller than session_start= from the super block.
|
||||
If so, expect another session to start there.
|
||||
|
||||
|
||||
Checking Single Files in a Loaded Image
|
||||
|
||||
An image may consist of many sessions wherein many data blocks may not belong
|
||||
@ -264,3 +280,28 @@ to iso_image_import() when reading the image. If this source is associated
|
||||
to a libburn drive, then libburn function burn_read_data() can read directly
|
||||
from it.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
scdbackup Checksum Tags
|
||||
|
||||
The session checksum tag does not occupy its whole block. So there is room to
|
||||
store a scdbackup stream checksum tag, which is an ancestor format of the tags
|
||||
described here. This feature allows scdbackup to omit its own checksum filter
|
||||
if using xorriso as ISO 9660 formatter program.
|
||||
Such a tag makes only sense if the session begins at LBA 0.
|
||||
|
||||
See scdbackup-*/README, appendix VERIFY for a specification.
|
||||
|
||||
Example of a scdbackup checksum tag:
|
||||
scdbackup_checksum_tag_v0.1 2456606865 61 2_2 B00109.143415 2456606865 485bbef110870c45754d7adcc844a72c c2355d5ea3c94d792ff5893dfe0d6d7b
|
||||
|
||||
The tag is located at byte position 2456606865, contains 61 bytes of scdbackup
|
||||
checksum record (the next four words):
|
||||
Name of the backup volume is "2_2".
|
||||
Written in year B0 = 2010 (A9 = 2009, B1 = 2011), January (01), 9th (09),
|
||||
14:34:15 local time.
|
||||
The size of the volume is 2456606865 bytes, which have a MD5 sum of
|
||||
485bbef110870c45754d7adcc844a72c.
|
||||
The checksum of "2_2 B00109.143415 2456606865 485bbef110870c45754d7adcc844a72c"
|
||||
is c2355d5ea3c94d792ff5893dfe0d6d7b.
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef Libisofs_with_aaip_acL
|
||||
/* It seems ACL is fixely integrated in FreeBSD libc. There is no libacl. */
|
||||
@ -37,13 +38,14 @@
|
||||
finally has to be freed by a call to this function
|
||||
with bit15 of flag.
|
||||
@param flag Bitfield for control purposes
|
||||
bit0= obtain default ACL rather than access ACL
|
||||
(bit0= obtain default ACL rather than access ACL)
|
||||
bit4= set *text = NULL and return 2
|
||||
if the ACL matches st_mode permissions.
|
||||
bit5= in case of symbolic link: inquire link target
|
||||
bit15= free text and return 1
|
||||
@return > 0 ok
|
||||
0 ACL support not enabled at compile time
|
||||
or filesystem does not support ACL
|
||||
-1 failure of system ACL service (see errno)
|
||||
-2 attempt to inquire ACL of a symbolic
|
||||
link without bit4 or bit5
|
||||
@ -88,8 +90,18 @@ int aaip_get_acl_text(char *path, char **text, int flag)
|
||||
|
||||
acl= acl_get_file(path, ACL_TYPE_ACCESS);
|
||||
|
||||
if(acl == NULL)
|
||||
if(acl == NULL) {
|
||||
if(errno == EOPNOTSUPP) {
|
||||
/* filesystem does not support ACL */
|
||||
if(flag & 16)
|
||||
return(2);
|
||||
|
||||
/* >>> ??? fake ACL from POSIX permissions ? */;
|
||||
|
||||
return(0);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
*text= acl_to_text(acl, NULL);
|
||||
acl_free(acl);
|
||||
|
||||
@ -181,10 +193,8 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
|
||||
|
||||
if(flag & 1) { /* Obtain ACL */
|
||||
/* access-ACL */
|
||||
ret= aaip_get_acl_text(path, &acl_text, flag & (16 | 32));
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
if(ret == 2)
|
||||
aaip_get_acl_text(path, &acl_text, flag & (16 | 32));
|
||||
if(acl_text == NULL)
|
||||
{ret= 1; goto ex;} /* empty ACL / only st_mode info was found in ACL */
|
||||
ret= aaip_encode_acl(acl_text, (mode_t) 0, &a_acl_len, &a_acl, flag & 2);
|
||||
if(ret <= 0)
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
#ifdef Libisofs_with_aaip_acL
|
||||
#include <sys/acl.h>
|
||||
@ -46,6 +48,7 @@
|
||||
2 only st_mode permissions exist and bit 4 is set
|
||||
or empty ACL and bit0 is set
|
||||
0 ACL support not enabled at compile time
|
||||
or filesystem does not support ACL
|
||||
-1 failure of system ACL service (see errno)
|
||||
-2 attempt to inquire ACL of a symbolic link without
|
||||
bit4 or bit5 resp. with no suitable link target
|
||||
@ -79,8 +82,18 @@ int aaip_get_acl_text(char *path, char **text, int flag)
|
||||
}
|
||||
|
||||
acl= acl_get_file(path, (flag & 1) ? ACL_TYPE_DEFAULT : ACL_TYPE_ACCESS);
|
||||
if(acl == NULL)
|
||||
if(acl == NULL) {
|
||||
if(errno == ENOTSUP) {
|
||||
/* filesystem does not support ACL */
|
||||
if(flag & 16)
|
||||
return(2);
|
||||
|
||||
/* >>> ??? fake ACL from POSIX permissions ? */;
|
||||
|
||||
return(0);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
*text= acl_to_text(acl, NULL);
|
||||
acl_free(acl);
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef LIBISO_BUFFER_H_
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* libisofs.h defines aaip_xinfo_func */
|
||||
@ -21,6 +22,11 @@
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void iso_node_builder_ref(IsoNodeBuilder *builder)
|
||||
{
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef LIBISO_BUILDER_H_
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "libisofs.h"
|
||||
|
@ -4,8 +4,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -31,11 +32,13 @@
|
||||
#include "md5.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include <langinfo.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* TODO #00011 : guard against bad path table usage with more than 65535 dirs
|
||||
@ -921,7 +924,12 @@ void *write_function(void *arg)
|
||||
#endif
|
||||
|
||||
iso_ring_buffer_writer_close(target->buffer, 0);
|
||||
|
||||
#ifdef Libisofs_with_pthread_exiT
|
||||
pthread_exit(NULL);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
write_error: ;
|
||||
if (res == ISO_CANCELED) {
|
||||
@ -936,12 +944,19 @@ void *write_function(void *arg)
|
||||
|
||||
#ifdef Libisofs_with_checksumS
|
||||
|
||||
/* Transplant checksum buffer from Ecma119Image to IsoImage */
|
||||
/* Transplant checksum buffer away from Ecma119Image */
|
||||
transplant_checksum_buffer(target, 0);
|
||||
/* Invalidate the transplanted checksum buffer in IsoImage */
|
||||
iso_image_free_checksums(target->image, 0);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef Libisofs_with_pthread_exiT
|
||||
pthread_exit(NULL);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1048,7 +1063,7 @@ int checksum_prepare_nodes(Ecma119Image *target, IsoNode *node, int flag)
|
||||
static
|
||||
int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
{
|
||||
int ret, i, voldesc_size, nwriters, image_checksums_mad = 0;
|
||||
int ret, i, voldesc_size, nwriters, image_checksums_mad = 0, tag_pos;
|
||||
Ecma119Image *target;
|
||||
int el_torito_writer_index = -1, file_src_writer_index= -1;
|
||||
|
||||
@ -1132,6 +1147,8 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
|
||||
target->md5_file_checksums = opts->md5_file_checksums;
|
||||
target->md5_session_checksum = opts->md5_session_checksum;
|
||||
strcpy(target->scdbackup_tag_parm, opts->scdbackup_tag_parm);
|
||||
target->scdbackup_tag_written = opts->scdbackup_tag_written;
|
||||
target->checksum_idx_counter = 0;
|
||||
target->checksum_ctx = NULL;
|
||||
target->checksum_counter = 0;
|
||||
@ -1363,8 +1380,9 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
#ifdef Libisofs_with_checksumS
|
||||
|
||||
/* Write relocated superblock checksum tag */
|
||||
tag_pos = voldesc_size / BLOCK_SIZE + 16 + 1;
|
||||
if (target->md5_session_checksum) {
|
||||
target->checksum_rlsb_tag_pos = voldesc_size / BLOCK_SIZE + 16 + 1;
|
||||
target->checksum_rlsb_tag_pos = tag_pos;
|
||||
if (target->checksum_rlsb_tag_pos < 32) {
|
||||
ret = iso_md5_start(&(target->checksum_ctx));
|
||||
if (ret < 0)
|
||||
@ -1377,6 +1395,20 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
if (ret < 0)
|
||||
goto target_cleanup;
|
||||
}
|
||||
tag_pos++;
|
||||
}
|
||||
|
||||
/* Clean out eventual checksum tags */
|
||||
for (i = tag_pos; i < 32; i++) {
|
||||
int tag_type;
|
||||
uint32_t pos, range_start, range_size, next_tag;
|
||||
char md5[16];
|
||||
|
||||
ret = iso_util_decode_md5_tag((char *)(opts->overwrite + i * 2048),
|
||||
&tag_type, &pos, &range_start,
|
||||
&range_size, &next_tag, md5, 0);
|
||||
if (ret > 0)
|
||||
opts->overwrite[i * 2048] = 0;
|
||||
}
|
||||
|
||||
#endif /* Libisofs_with_checksumS */
|
||||
@ -1627,6 +1659,7 @@ int iso_write_opts_new(IsoWriteOpts **opts, int profile)
|
||||
if (wopts == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
wopts->scdbackup_tag_written = NULL;
|
||||
|
||||
switch (profile) {
|
||||
case 0:
|
||||
@ -1866,6 +1899,44 @@ int iso_write_opts_set_record_md5(IsoWriteOpts *opts, int session, int files)
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
int iso_write_opts_set_scdbackup_tag(IsoWriteOpts *opts,
|
||||
char *name, char *timestamp,
|
||||
char *tag_written)
|
||||
{
|
||||
|
||||
#ifdef Libisofs_with_checksumS
|
||||
|
||||
char eff_name[81], eff_time[19];
|
||||
int i;
|
||||
|
||||
for (i = 0; name[i] != 0 && i < 80; i++)
|
||||
if (isspace((int) ((unsigned char *) name)[i]))
|
||||
eff_name[i] = '_';
|
||||
else
|
||||
eff_name[i] = name[i];
|
||||
if (i == 0)
|
||||
eff_name[i++] = '_';
|
||||
eff_name[i] = 0;
|
||||
for (i = 0; timestamp[i] != 0 && i < 18; i++)
|
||||
if (isspace((int) ((unsigned char *) timestamp)[i]))
|
||||
eff_time[i] = '_';
|
||||
else
|
||||
eff_time[i] = timestamp[i];
|
||||
if (i == 0)
|
||||
eff_time[i++] = '_';
|
||||
eff_time[i] = 0;
|
||||
|
||||
sprintf(opts->scdbackup_tag_parm, "%s %s", eff_name, eff_time);
|
||||
|
||||
opts->scdbackup_tag_written = tag_written;
|
||||
if (tag_written != NULL)
|
||||
tag_written[0] = 0;
|
||||
|
||||
#endif /* Libisofs_with_checksumS */
|
||||
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
int iso_write_opts_set_replace_mode(IsoWriteOpts *opts, int dir_mode,
|
||||
int file_mode, int uid, int gid)
|
||||
{
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef LIBISO_ECMA119_H_
|
||||
@ -281,6 +282,22 @@ struct iso_write_opts {
|
||||
*/
|
||||
uint32_t data_start_lba;
|
||||
|
||||
/**
|
||||
* If not empty: A text holding parameters "name" and "timestamp" for
|
||||
* a scdbackup stream checksum tag. See scdbackup/README appendix VERIFY.
|
||||
* It makes sense only for single session images which start at LBA 0.
|
||||
* Such a tag may be part of a libisofs checksum tag block after the
|
||||
* session tag line. It then covers the whole session up to its own start
|
||||
* position.
|
||||
*/
|
||||
char scdbackup_tag_parm[100];
|
||||
|
||||
/* If not NULL: A pointer to an application provided array with
|
||||
at least 512 characters. The effectively written scdbackup tag
|
||||
will be copied to this memory location.
|
||||
*/
|
||||
char *scdbackup_tag_written;
|
||||
|
||||
};
|
||||
|
||||
typedef struct ecma119_image Ecma119Image;
|
||||
@ -464,6 +481,9 @@ struct ecma119_image
|
||||
is submitted with ecma119_image_new() ?
|
||||
*/
|
||||
|
||||
char scdbackup_tag_parm[100];
|
||||
char *scdbackup_tag_written;
|
||||
|
||||
#endif /* Libisofs_with_checksumS */
|
||||
|
||||
/* Buffer for communication between burn_source and writer thread */
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "ecma119_tree.h"
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef LIBISO_ECMA119_TREE_H_
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "eltorito.h"
|
||||
@ -407,7 +408,7 @@ int iso_image_set_boot_image(IsoImage *image, const char *image_path,
|
||||
}
|
||||
|
||||
/* creates the catalog with the given image */
|
||||
catalog = malloc(sizeof(struct el_torito_boot_catalog));
|
||||
catalog = calloc(1, sizeof(struct el_torito_boot_catalog));
|
||||
if (catalog == NULL) {
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto boot_image_cleanup;
|
||||
@ -702,11 +703,11 @@ int catalog_stream_new(Ecma119Image *target, IsoStream **stream)
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
str = malloc(sizeof(IsoStream));
|
||||
str = calloc(1, sizeof(IsoStream));
|
||||
if (str == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
data = malloc(sizeof(struct catalog_stream));
|
||||
data = calloc(1, sizeof(struct catalog_stream));
|
||||
if (str == NULL) {
|
||||
free(str);
|
||||
return ISO_OUT_OF_MEM;
|
||||
@ -740,7 +741,7 @@ int el_torito_catalog_file_src_create(Ecma119Image *target, IsoFileSrc **src)
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
file = malloc(sizeof(IsoFileSrc));
|
||||
file = calloc(1, sizeof(IsoFileSrc));
|
||||
if (file == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
@ -753,6 +754,7 @@ int el_torito_catalog_file_src_create(Ecma119Image *target, IsoFileSrc **src)
|
||||
|
||||
/* fill fields */
|
||||
file->prev_img = 0; /* TODO allow copy of old img catalog???? */
|
||||
file->checksum_index = 0;
|
||||
file->nsections = 1;
|
||||
file->sections = calloc(1, sizeof(struct iso_file_section));
|
||||
file->sort_weight = 1000; /* slightly high */
|
||||
@ -839,7 +841,7 @@ int eltorito_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
IsoStream *new = NULL;
|
||||
IsoStream *original = t->bootimg->stream;
|
||||
size = (size_t) iso_stream_get_size(original);
|
||||
buf = malloc(size);
|
||||
buf = calloc(1, size);
|
||||
if (buf == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
@ -921,7 +923,7 @@ int eltorito_writer_create(Ecma119Image *target)
|
||||
IsoFile *bootimg;
|
||||
IsoFileSrc *src;
|
||||
|
||||
writer = malloc(sizeof(IsoImageWriter));
|
||||
writer = calloc(1, sizeof(IsoImageWriter));
|
||||
if (writer == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "filesrc.h"
|
||||
@ -23,6 +24,11 @@
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
int iso_file_src_cmp(const void *n1, const void *n2)
|
||||
{
|
||||
int ret;
|
||||
@ -132,11 +138,11 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
|
||||
|
||||
if ((img->md5_file_checksums & 1) && !no_md5) {
|
||||
img->checksum_idx_counter++;
|
||||
if (img->checksum_idx_counter < 0x80000000) {
|
||||
if (img->checksum_idx_counter < 0x7fffffff) {
|
||||
fsrc->checksum_index = img->checksum_idx_counter;
|
||||
} else {
|
||||
fsrc->checksum_index= 0;
|
||||
img->checksum_idx_counter= 0x80000000; /* keep from rolling over */
|
||||
img->checksum_idx_counter= 0x7fffffff; /* keep from rolling over */
|
||||
}
|
||||
cret = iso_file_set_isofscx(file, (*src)->checksum_index, 0);
|
||||
if (cret < 0)
|
||||
@ -499,7 +505,8 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
||||
|
||||
#ifdef Libisofs_with_checksumS
|
||||
|
||||
if (file->checksum_index > 0) {
|
||||
if (file->checksum_index > 0 &&
|
||||
file->checksum_index <= t->checksum_idx_counter) {
|
||||
/* Obtain checksum and dispose checksum context */
|
||||
res = iso_md5_end(&ctx, md5);
|
||||
if (res <= 0)
|
||||
@ -550,7 +557,7 @@ int iso_file_src_writer_create(Ecma119Image *target)
|
||||
{
|
||||
IsoImageWriter *writer;
|
||||
|
||||
writer = malloc(sizeof(IsoImageWriter));
|
||||
writer = calloc(1, sizeof(IsoImageWriter));
|
||||
if (writer == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
#ifndef LIBISO_FILESRC_H_
|
||||
#define LIBISO_FILESRC_H_
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "libisofs.h"
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2008 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
#ifndef LIBISO_FILTER_H_
|
||||
#define LIBISO_FILTER_H_
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*
|
||||
* It implements a filter facility which can pipe a IsoStream into an external
|
||||
* process, read its output and forward it as IsoStream output to an IsoFile.
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*
|
||||
* It implements a filter facility which can pipe a IsoStream into gzip
|
||||
* compression resp. uncompression, read its output and forward it as IsoStream
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2008 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "../libisofs.h"
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*
|
||||
* It implements a filter facility which can pipe a IsoStream into zisofs
|
||||
* compression resp. uncompression, read its output and forward it as IsoStream
|
||||
@ -912,6 +913,8 @@ int ziso_filter_get_uncompressor(FilterContext *filter, IsoStream *original,
|
||||
}
|
||||
|
||||
|
||||
#ifdef Libisofs_with_zliB
|
||||
|
||||
/* Produce a parameter object suitable for iso_file_add_filter().
|
||||
* It may be disposed by free() after all those calls are made.
|
||||
*
|
||||
@ -938,6 +941,7 @@ int ziso_create_context(FilterContext **filter, int flag)
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
#endif /* Libisofs_with_zliB */
|
||||
|
||||
/*
|
||||
* @param flag bit0= if_block_reduction rather than if_reduction
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2008 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "libisofs.h"
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -30,6 +31,11 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Options for image reading.
|
||||
* There are four kind of options:
|
||||
@ -2127,15 +2133,34 @@ int read_pvm(_ImageFsData *data, uint32_t block)
|
||||
|
||||
/* fill volume attributes */
|
||||
/* TODO take care of input charset */
|
||||
data->volset_id = strcopy((char*)pvm->vol_set_id, 128);
|
||||
data->volume_id = strcopy((char*)pvm->volume_id, 32);
|
||||
data->publisher_id = strcopy((char*)pvm->publisher_id, 128);
|
||||
data->data_preparer_id = strcopy((char*)pvm->data_prep_id, 128);
|
||||
data->system_id = strcopy((char*)pvm->system_id, 32);
|
||||
data->application_id = strcopy((char*)pvm->application_id, 128);
|
||||
data->copyright_file_id = strcopy((char*)pvm->copyright_file_id, 37);
|
||||
data->abstract_file_id = strcopy((char*)pvm->abstract_file_id, 37);
|
||||
data->biblio_file_id = strcopy((char*)pvm->bibliographic_file_id, 37);
|
||||
data->volset_id = iso_util_strcopy_untail((char*)pvm->vol_set_id, 128);
|
||||
data->volume_id = iso_util_strcopy_untail((char*)pvm->volume_id, 32);
|
||||
data->publisher_id =
|
||||
iso_util_strcopy_untail((char*)pvm->publisher_id, 128);
|
||||
data->data_preparer_id =
|
||||
iso_util_strcopy_untail((char*)pvm->data_prep_id, 128);
|
||||
data->system_id = iso_util_strcopy_untail((char*)pvm->system_id, 32);
|
||||
data->application_id =
|
||||
iso_util_strcopy_untail((char*)pvm->application_id, 128);
|
||||
data->copyright_file_id =
|
||||
iso_util_strcopy_untail((char*) pvm->copyright_file_id, 37);
|
||||
data->abstract_file_id =
|
||||
iso_util_strcopy_untail((char*) pvm->abstract_file_id, 37);
|
||||
data->biblio_file_id =
|
||||
iso_util_strcopy_untail((char*) pvm->bibliographic_file_id, 37);
|
||||
if (data->copyright_file_id[0] == '_' && data->copyright_file_id[1] == 0 &&
|
||||
data->abstract_file_id[0] == '_' && data->abstract_file_id[1] == 0 &&
|
||||
data->biblio_file_id[0] == '_' && data->biblio_file_id[1] == 0) {
|
||||
/* This is bug output from libisofs <= 0.6.23 . The texts mean file
|
||||
names and should have been empty to indicate that there are no such
|
||||
files. It is obvious that not all three roles can be fulfilled by
|
||||
one file "_" so that one cannot spoil anything by assuming them
|
||||
empty now.
|
||||
*/
|
||||
data->copyright_file_id[0] = 0;
|
||||
data->abstract_file_id[0] = 0;
|
||||
data->biblio_file_id[0] = 0;
|
||||
}
|
||||
|
||||
data->nblocks = iso_read_bb(pvm->vol_space_size, 4, NULL);
|
||||
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "fsource.h"
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef LIBISO_FSOURCE_H_
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "libisofs.h"
|
||||
@ -213,6 +214,8 @@ void iso_image_set_volset_id(IsoImage *image, const char *volset_id)
|
||||
|
||||
const char *iso_image_get_volset_id(const IsoImage *image)
|
||||
{
|
||||
if (image->volset_id == NULL)
|
||||
return "";
|
||||
return image->volset_id;
|
||||
}
|
||||
|
||||
@ -224,6 +227,8 @@ void iso_image_set_volume_id(IsoImage *image, const char *volume_id)
|
||||
|
||||
const char *iso_image_get_volume_id(const IsoImage *image)
|
||||
{
|
||||
if (image->volume_id == NULL)
|
||||
return "";
|
||||
return image->volume_id;
|
||||
}
|
||||
|
||||
@ -235,6 +240,8 @@ void iso_image_set_publisher_id(IsoImage *image, const char *publisher_id)
|
||||
|
||||
const char *iso_image_get_publisher_id(const IsoImage *image)
|
||||
{
|
||||
if (image->publisher_id == NULL)
|
||||
return "";
|
||||
return image->publisher_id;
|
||||
}
|
||||
|
||||
@ -247,6 +254,8 @@ void iso_image_set_data_preparer_id(IsoImage *image,
|
||||
|
||||
const char *iso_image_get_data_preparer_id(const IsoImage *image)
|
||||
{
|
||||
if (image->data_preparer_id == NULL)
|
||||
return "";
|
||||
return image->data_preparer_id;
|
||||
}
|
||||
|
||||
@ -258,6 +267,8 @@ void iso_image_set_system_id(IsoImage *image, const char *system_id)
|
||||
|
||||
const char *iso_image_get_system_id(const IsoImage *image)
|
||||
{
|
||||
if (image->system_id == NULL)
|
||||
return "";
|
||||
return image->system_id;
|
||||
}
|
||||
|
||||
@ -269,6 +280,8 @@ void iso_image_set_application_id(IsoImage *image, const char *application_id)
|
||||
|
||||
const char *iso_image_get_application_id(const IsoImage *image)
|
||||
{
|
||||
if (image->application_id == NULL)
|
||||
return "";
|
||||
return image->application_id;
|
||||
}
|
||||
|
||||
@ -281,6 +294,8 @@ void iso_image_set_copyright_file_id(IsoImage *image,
|
||||
|
||||
const char *iso_image_get_copyright_file_id(const IsoImage *image)
|
||||
{
|
||||
if (image->copyright_file_id == NULL)
|
||||
return "";
|
||||
return image->copyright_file_id;
|
||||
}
|
||||
|
||||
@ -293,6 +308,8 @@ void iso_image_set_abstract_file_id(IsoImage *image,
|
||||
|
||||
const char *iso_image_get_abstract_file_id(const IsoImage *image)
|
||||
{
|
||||
if (image->abstract_file_id == NULL)
|
||||
return "";
|
||||
return image->abstract_file_id;
|
||||
}
|
||||
|
||||
@ -304,6 +321,8 @@ void iso_image_set_biblio_file_id(IsoImage *image, const char *biblio_file_id)
|
||||
|
||||
const char *iso_image_get_biblio_file_id(const IsoImage *image)
|
||||
{
|
||||
if (image->biblio_file_id == NULL)
|
||||
return "";
|
||||
return image->biblio_file_id;
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
#ifndef LIBISO_IMAGE_H_
|
||||
#define LIBISO_IMAGE_H_
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "iso1999.h"
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2007 Mario Danic
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "joliet.h"
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2007 Mario Danic
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* libiso_msgs (generated from libdax_msgs : Fri Feb 22 19:42:52 CET 2008)
|
||||
Message handling facility of libisofs.
|
||||
Copyright (C) 2006 - 2008 Thomas Schmitt <scdbackup@gmx.net>,
|
||||
provided under GPL version 2
|
||||
provided under GPL version 2 or later
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* libiso_msgs (generated from libdax_msgs : Fri Feb 22 19:42:52 CET 2008)
|
||||
Message handling facility of libisofs.
|
||||
Copyright (C) 2006-2008 Thomas Schmitt <scdbackup@gmx.net>,
|
||||
provided under GPL version 2
|
||||
provided under GPL version 2 or later
|
||||
*/
|
||||
|
||||
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -483,7 +484,7 @@ struct IsoFileSource_Iface
|
||||
int version;
|
||||
|
||||
/**
|
||||
* Get the path, relative to the filesystem this file source belongs to.
|
||||
* Get the absolute path in the filesystem this file source belongs to.
|
||||
*
|
||||
* @return
|
||||
* the path of the FileSource inside the filesystem, it should be
|
||||
@ -1090,7 +1091,7 @@ int iso_lib_is_compatible(int major, int minor, int micro);
|
||||
*/
|
||||
#define iso_lib_header_version_major 0
|
||||
#define iso_lib_header_version_minor 6
|
||||
#define iso_lib_header_version_micro 22
|
||||
#define iso_lib_header_version_micro 28
|
||||
|
||||
/**
|
||||
* Usage discussion:
|
||||
@ -1446,11 +1447,38 @@ int iso_write_opts_set_sort_files(IsoWriteOpts *opts, int sort);
|
||||
*/
|
||||
int iso_write_opts_set_record_md5(IsoWriteOpts *opts, int session, int files);
|
||||
|
||||
/**
|
||||
* Set the parameters "name" and "timestamp" for a scdbackup checksum tag.
|
||||
* It will be appended to the libisofs session tag if the image starts at
|
||||
* LBA 0 (see iso_write_opts_set_ms_block()). The scdbackup tag can be used
|
||||
* to verify the image by command scdbackup_verify <device> -auto_end.
|
||||
* See scdbackup/README appendix VERIFY for its inner details.
|
||||
*
|
||||
* @param name
|
||||
* A word of up to 80 characters. Typically <volno>_<totalno> telling
|
||||
* that this is volume <volno> of a total of <totalno> volumes.
|
||||
* @param timestamp
|
||||
* A string of 13 characters YYMMDD.hhmmss (e.g. A90831.190324).
|
||||
* A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ...
|
||||
* @param tag_written
|
||||
* Either NULL or the address of an array with at least 512 characters.
|
||||
* In the latter case the eventually produced scdbackup tag will be
|
||||
* copied to this array when the image gets written. This call sets
|
||||
* scdbackup_tag_written[0] = 0 to mark its preliminary invalidity.
|
||||
* @return
|
||||
* 1 indicates success, <0 is error
|
||||
*
|
||||
* @since 0.6.24
|
||||
*/
|
||||
int iso_write_opts_set_scdbackup_tag(IsoWriteOpts *opts,
|
||||
char *name, char *timestamp,
|
||||
char *tag_written);
|
||||
|
||||
/**
|
||||
* Whether to set default values for files and directory permissions, gid and
|
||||
* uid. All these take one of three values: 0, 1 or 2.
|
||||
*
|
||||
* If 0, the corresponding attribute will be kept as setted in the IsoNode.
|
||||
* If 0, the corresponding attribute will be kept as set in the IsoNode.
|
||||
* Unless you have changed it, it corresponds to the value on disc, so it
|
||||
* is suitable for backup purposes. If set to 1, the corresponding attrib.
|
||||
* will be changed by a default suitable value. Finally, if you set it to
|
||||
@ -2175,8 +2203,8 @@ const char *iso_image_get_biblio_file_id(const IsoImage *image);
|
||||
* The image to make bootable. If it was already bootable this function
|
||||
* returns an error and the image remains unmodified.
|
||||
* @param image_path
|
||||
* The path on the image tree of a regular file to use as default boot
|
||||
* image.
|
||||
* The absolute path on the image tree of a regular file to use as
|
||||
* default boot image.
|
||||
* @param type
|
||||
* The boot media type. This can be one of 3 types:
|
||||
* - Floppy emulation: Boot image file must be exactly
|
||||
@ -2186,9 +2214,9 @@ const char *iso_image_get_biblio_file_id(const IsoImage *image);
|
||||
* - No emulation. You should specify load segment and load size
|
||||
* of image.
|
||||
* @param catalog_path
|
||||
* The path on the image tree where the catalog will be stored. The
|
||||
* directory component of this path must be a directory existent on the
|
||||
* image tree, and the filename component must be unique among all
|
||||
* The absolute path in the image tree where the catalog will be stored.
|
||||
* The directory component of this path must be a directory existent on
|
||||
* the image tree, and the filename component must be unique among all
|
||||
* children of that directory on image. Otherwise a correspodent error
|
||||
* code will be returned. This function will add an IsoBoot node that acts
|
||||
* as a placeholder for the real catalog, that will be generated at image
|
||||
@ -2303,7 +2331,7 @@ void el_torito_patch_isolinux_image(ElToritoBootImage *bootimg);
|
||||
* @param options
|
||||
* bitmask style flag. The following values are defined:
|
||||
*
|
||||
* bit 0 -> 1 to path the image, 0 to not
|
||||
* bit 0 -> 1 to patch the image, 0 to not
|
||||
* Patching the image involves the writing of a 56 bytes
|
||||
* boot information table at offset 8 of the boot image file.
|
||||
* The original boot image file will not be modified. This is
|
||||
@ -3319,8 +3347,8 @@ void iso_tree_set_ignore_special(IsoImage *image, int skip);
|
||||
int iso_tree_get_ignore_special(IsoImage *image);
|
||||
|
||||
/**
|
||||
* Add a excluded path. These are paths that won't never added to image,
|
||||
* and will be excluded even when adding recursively its parent directory.
|
||||
* Add a excluded path. These are paths that won't never added to image, and
|
||||
* will be excluded even when adding recursively its parent directory.
|
||||
*
|
||||
* For example, in
|
||||
*
|
||||
@ -3412,7 +3440,9 @@ void iso_tree_set_report_callback(IsoImage *image,
|
||||
* @param parent
|
||||
* The directory in the image tree where the node will be added.
|
||||
* @param path
|
||||
* The path of the file to add in the filesystem.
|
||||
* The absolute path of the file in the local filesystem.
|
||||
* The node will have the same leaf name as the file on disk.
|
||||
* Its directory path depends on the parent node.
|
||||
* @param node
|
||||
* place where to store a pointer to the newly added file. No
|
||||
* extra ref is addded, so you will need to call iso_node_ref() if you
|
||||
@ -3442,9 +3472,10 @@ int iso_tree_add_node(IsoImage *image, IsoDir *parent, const char *path,
|
||||
* @param parent
|
||||
* The directory in the image tree where the node will be added.
|
||||
* @param name
|
||||
* The name that the node will have on image.
|
||||
* The leaf name that the node will have on image.
|
||||
* Its directory path depends on the parent node.
|
||||
* @param path
|
||||
* The path of the file to add in the filesystem.
|
||||
* The absolute path of the file in the local filesystem.
|
||||
* @param node
|
||||
* place where to store a pointer to the newly added file. No
|
||||
* extra ref is addded, so you will need to call iso_node_ref() if you
|
||||
@ -3463,24 +3494,25 @@ int iso_tree_add_new_node(IsoImage *image, IsoDir *parent, const char *name,
|
||||
const char *path, IsoNode **node);
|
||||
|
||||
/**
|
||||
* Add a new node to the image tree, from an existing file, and with the
|
||||
* given name, that must not exist on dir. The node will be cut-out to the
|
||||
* submitted size, and its contents will be read from the given offset. This
|
||||
* function is thus suitable for adding only a piece of a file to the image.
|
||||
* Add a new node to the image tree with the given name that must not exist
|
||||
* on dir. The node data content will be a byte interval out of the data
|
||||
* content of a file in the local filesystem.
|
||||
*
|
||||
* @param image
|
||||
* The image
|
||||
* @param parent
|
||||
* The directory in the image tree where the node will be added.
|
||||
* @param name
|
||||
* The name that the node will have on image.
|
||||
* The leaf name that the node will have on image.
|
||||
* Its directory path depends on the parent node.
|
||||
* @param path
|
||||
* The path of the file to add in the filesystem. For now only regular
|
||||
* files and symlinks to regular files are supported.
|
||||
* The absolute path of the file in the local filesystem. For now
|
||||
* only regular files and symlinks to regular files are supported.
|
||||
* @param offset
|
||||
* Offset on the given file from where to start reading data.
|
||||
* Byte number in the given file from where to start reading data.
|
||||
* @param size
|
||||
* Max size of the file.
|
||||
* Max size of the file. This may be more than actually available from
|
||||
* byte offset to the end of the file in the local filesystem.
|
||||
* @param node
|
||||
* place where to store a pointer to the newly added file. No
|
||||
* extra ref is addded, so you will need to call iso_node_ref() if you
|
||||
@ -3523,7 +3555,7 @@ int iso_tree_add_new_cut_out_node(IsoImage *image, IsoDir *parent,
|
||||
int iso_tree_add_dir_rec(IsoImage *image, IsoDir *parent, const char *dir);
|
||||
|
||||
/**
|
||||
* Locate a node by its path on image.
|
||||
* Locate a node by its absolute path on image.
|
||||
*
|
||||
* @param node
|
||||
* Location for a pointer to the node, it will filled with NULL if the
|
||||
@ -3540,7 +3572,7 @@ int iso_tree_add_dir_rec(IsoImage *image, IsoDir *parent, const char *dir);
|
||||
int iso_tree_path_to_node(IsoImage *image, const char *path, IsoNode **node);
|
||||
|
||||
/**
|
||||
* Get the path on image of the given node.
|
||||
* Get the absolute path on image of the given node.
|
||||
*
|
||||
* @return
|
||||
* The path on the image, that must be freed when no more needed. If the
|
||||
@ -3566,11 +3598,10 @@ void iso_data_source_unref(IsoDataSource *src);
|
||||
|
||||
/**
|
||||
* Create a new IsoDataSource from a local file. This is suitable for
|
||||
* accessing regular .iso images, or to acces drives via its block device
|
||||
* and standard POSIX I/O calls.
|
||||
* accessing regular files or block devices with ISO images.
|
||||
*
|
||||
* @param path
|
||||
* The path of the file
|
||||
* The absolute path of the file
|
||||
* @param src
|
||||
* Will be filled with the pointer to the newly created data source.
|
||||
* @return
|
||||
@ -3805,8 +3836,7 @@ void iso_file_source_unref(IsoFileSource *src);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the path, relative to the filesystem this file source
|
||||
* belongs to.
|
||||
* Get the absolute path in the filesystem this file source belongs to.
|
||||
*
|
||||
* @return
|
||||
* the path of the FileSource inside the filesystem, it should be
|
||||
@ -4522,7 +4552,7 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names,
|
||||
* Get an ACL of the given file in the local filesystem in long text form.
|
||||
*
|
||||
* @param disk_path
|
||||
* Path to the file
|
||||
* Absolute path to the file
|
||||
* @param text
|
||||
* Will return a pointer to the ACL text. If not NULL the text will be
|
||||
* 0 terminated and finally has to be disposed by a call to this function
|
||||
@ -4537,7 +4567,7 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names,
|
||||
* @return
|
||||
* 1 ok
|
||||
* 2 ok, trivial ACL found while bit4 is set, *text is NULL
|
||||
* 0 no ACL manipulation adapter available
|
||||
* 0 no ACL manipulation adapter available / ACL not supported on fs
|
||||
* -1 failure of system ACL service (see errno)
|
||||
* -2 attempt to inquire ACL of a symbolic link without bit4 or bit5
|
||||
* resp. with no suitable link target
|
||||
@ -4552,7 +4582,7 @@ int iso_local_get_acl_text(char *disk_path, char **text, int flag);
|
||||
* in long text form.
|
||||
*
|
||||
* @param disk_path
|
||||
* Path to the file
|
||||
* Absolute path to the file
|
||||
* @param text
|
||||
* The input text (0 terminated, ACL long text form)
|
||||
* @param flag
|
||||
@ -4577,7 +4607,7 @@ int iso_local_set_acl_text(char *disk_path, char *text, int flag);
|
||||
* necessary if the permissions of a disk file with ACL shall be copied to
|
||||
* an object which has no ACL.
|
||||
* @param disk_path
|
||||
* Path to the local file which may have an "access" ACL or not.
|
||||
* Absolute path to the local file which may have an "access" ACL or not.
|
||||
* @param flag
|
||||
* Bitfield for control purposes
|
||||
* bit5= in case of symbolic link: inquire link target
|
||||
@ -4602,7 +4632,7 @@ int iso_local_get_perms_wo_acl(char *disk_path, mode_t *st_mode, int flag);
|
||||
* will not be put into the result.
|
||||
*
|
||||
* @param disk_path
|
||||
* Path to the file
|
||||
* Absolute path to the file
|
||||
* @param num_attrs
|
||||
* Will return the number of name-value pairs
|
||||
* @param names
|
||||
@ -4635,7 +4665,7 @@ int iso_local_get_attrs(char *disk_path, size_t *num_attrs, char ***names,
|
||||
* Eventual ACLs have to be encoded as attribute pair with empty name.
|
||||
*
|
||||
* @param disk_path
|
||||
* Path to the file
|
||||
* Absolute path to the file
|
||||
* @param num_attrs
|
||||
* Number of attributes
|
||||
* @param names
|
||||
@ -4660,6 +4690,11 @@ int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names,
|
||||
size_t *value_lengths, char **values, int flag);
|
||||
|
||||
|
||||
/* Default in case that the compile environment has no macro PATH_MAX.
|
||||
*/
|
||||
#define Libisofs_default_path_maX 4096
|
||||
|
||||
|
||||
/* --------------------------- Filters in General -------------------------- */
|
||||
|
||||
/*
|
||||
@ -5522,6 +5557,13 @@ int iso_md5_match(char first_md5[16], char second_md5[16]);
|
||||
*/
|
||||
#define ISO_MD5_STREAM_CHANGE 0xE430FE9A
|
||||
|
||||
/**
|
||||
* Session does not start at LBA 0. scdbackup checksum tag not written.
|
||||
* (WARNING, HIGH, -359)
|
||||
* @since 0.6.24
|
||||
*/
|
||||
#define ISO_SCDBACKUP_TAG_NOT_0 0xD030FE99
|
||||
|
||||
|
||||
/* ! PLACE NEW ERROR CODES HERE ! */
|
||||
|
||||
|
101
libisofs/md5.c
101
libisofs/md5.c
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
@ -698,6 +699,69 @@ int checksum_writer_create(Ecma119Image *target)
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
int iso_md5_write_scdbackup_tag(Ecma119Image *t, char *tag_block, int flag)
|
||||
{
|
||||
|
||||
#ifdef Libisofs_with_checksumS
|
||||
|
||||
void *ctx = NULL;
|
||||
off_t pos = 0, line_start;
|
||||
int record_len, block_len, res, i;
|
||||
char postext[40], md5[16], record[160];
|
||||
|
||||
line_start = strlen(tag_block);
|
||||
iso_md5_compute(t->checksum_ctx, tag_block, line_start);
|
||||
res = iso_md5_clone(t->checksum_ctx, &ctx);
|
||||
if (res < 0)
|
||||
goto ex;
|
||||
res = iso_md5_end(&ctx, md5);
|
||||
|
||||
pos = (off_t) t->checksum_tag_pos * (off_t) 2048 + line_start;
|
||||
if(pos >= 1000000000)
|
||||
sprintf(postext, "%u%9.9u", (unsigned int) (pos / 1000000000),
|
||||
(unsigned int) (pos % 1000000000));
|
||||
else
|
||||
sprintf(postext, "%u", (unsigned int) pos);
|
||||
sprintf(record, "%s %s ", t->scdbackup_tag_parm, postext);
|
||||
record_len = strlen(record);
|
||||
for (i = 0; i < 16; i++)
|
||||
sprintf(record + record_len + 2 * i,
|
||||
"%2.2x", ((unsigned char *) md5)[i]);
|
||||
record_len += 32;
|
||||
|
||||
res = iso_md5_start(&ctx);
|
||||
if (res < 0)
|
||||
goto ex;
|
||||
iso_md5_compute(ctx, record, record_len);
|
||||
iso_md5_end(&ctx, md5);
|
||||
|
||||
sprintf(tag_block + line_start, "scdbackup_checksum_tag_v0.1 %s %d %s ",
|
||||
postext, record_len, record);
|
||||
block_len = strlen(tag_block);
|
||||
for (i = 0; i < 16; i++)
|
||||
sprintf(tag_block + block_len + 2 * i,
|
||||
"%2.2x", ((unsigned char *) md5)[i]);
|
||||
block_len+= 32;
|
||||
tag_block[block_len++]= '\n';
|
||||
|
||||
if (t->scdbackup_tag_written != NULL)
|
||||
strncpy(t->scdbackup_tag_written, tag_block + line_start,
|
||||
block_len - line_start);
|
||||
res = ISO_SUCCESS;
|
||||
ex:;
|
||||
if (ctx != NULL)
|
||||
iso_md5_end(&ctx, md5);
|
||||
return res;
|
||||
|
||||
#else
|
||||
|
||||
return ISO_SUCCESS;
|
||||
|
||||
#endif /* Libisofs_with_checksumS */
|
||||
}
|
||||
|
||||
|
||||
/* Write stream detectable checksum tag to extra block.
|
||||
* @flag bit0-7= tag type
|
||||
* 1= session tag (End checksumming.)
|
||||
@ -719,11 +783,16 @@ int iso_md5_write_tag(Ecma119Image *t, int flag)
|
||||
start = t->checksum_range_start;
|
||||
memset(tag_block, 0, 2048);
|
||||
mode = flag & 255;
|
||||
if (mode < 1 || mode > 4)
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
res = iso_md5_clone(t->checksum_ctx, &ctx);
|
||||
if (res < 0)
|
||||
return res;
|
||||
res = iso_md5_end(&ctx, md5);
|
||||
if (mode == 1) {
|
||||
res = iso_md5_end(&(t->checksum_ctx), md5);
|
||||
size = t->checksum_range_size;
|
||||
pos = t->checksum_tag_pos;
|
||||
} else if (mode >= 2 && mode <= 4) {
|
||||
} else {
|
||||
if (mode == 2) {
|
||||
pos = t->checksum_sb_tag_pos;
|
||||
} else if (mode == 3) {
|
||||
@ -733,17 +802,12 @@ int iso_md5_write_tag(Ecma119Image *t, int flag)
|
||||
start = pos - (pos % 32);
|
||||
}
|
||||
size = pos - start;
|
||||
res = iso_md5_clone(t->checksum_ctx, &ctx);
|
||||
if (res < 0)
|
||||
return res;
|
||||
res = iso_md5_end(&ctx, md5);
|
||||
} else {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
if (res > 0) {
|
||||
if (res < 0)
|
||||
goto ex;
|
||||
|
||||
iso_util_tag_magic(mode, &tag_id, &tag_id_len, 0);
|
||||
sprintf(tag_block,
|
||||
"%s pos=%u range_start=%u range_size=%u",
|
||||
sprintf(tag_block, "%s pos=%u range_start=%u range_size=%u",
|
||||
tag_id, pos, start, size);
|
||||
|
||||
l = strlen(tag_block);
|
||||
@ -772,7 +836,17 @@ int iso_md5_write_tag(Ecma119Image *t, int flag)
|
||||
((unsigned char *) md5)[i]);
|
||||
}
|
||||
tag_block[l + 32] = '\n';
|
||||
|
||||
if (mode == 1 && t->scdbackup_tag_parm[0]) {
|
||||
if (t->ms_block > 0) {
|
||||
iso_msg_submit(t->image->id, ISO_SCDBACKUP_TAG_NOT_0, 0, NULL);
|
||||
} else {
|
||||
res = iso_md5_write_scdbackup_tag(t, tag_block, 0);
|
||||
if (res < 0)
|
||||
goto ex;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == 4) {
|
||||
if (t->opts_overwrite != NULL)
|
||||
memcpy(t->opts_overwrite + pos * 2048, tag_block, 2048);
|
||||
@ -783,6 +857,7 @@ int iso_md5_write_tag(Ecma119Image *t, int flag)
|
||||
goto ex;
|
||||
}
|
||||
}
|
||||
|
||||
res = ISO_SUCCESS;
|
||||
ex:;
|
||||
if (ctx != NULL)
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef LIBISO_MD5_H_
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
@ -274,6 +275,8 @@ const char *iso_error_to_msg(int errcode)
|
||||
return "Checksum tag with unexpected address range encountered";
|
||||
case ISO_MD5_STREAM_CHANGE:
|
||||
return "Detected file content changes while it was written into the image";
|
||||
case ISO_SCDBACKUP_TAG_NOT_0:
|
||||
return "Session does not start at LBA 0. scdbackup checksum tag not written.";
|
||||
default:
|
||||
return "Unknown error";
|
||||
}
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "libisofs.h"
|
||||
@ -22,6 +23,12 @@
|
||||
#include <limits.h>
|
||||
#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 */
|
||||
@ -201,6 +208,7 @@ int iso_node_get_xinfo(IsoNode *node, iso_node_xinfo_func proc, void **data)
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
|
||||
*data = NULL;
|
||||
pos = node->xinfo;
|
||||
while (pos != NULL) {
|
||||
if (pos->process == proc) {
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
#ifndef LIBISO_NODE_H_
|
||||
#define LIBISO_NODE_H_
|
||||
|
@ -4,8 +4,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "rockridge.h"
|
||||
|
@ -4,8 +4,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -302,7 +303,7 @@ int read_rr_NM(struct susp_sys_user_entry *nm, char **name, int *cont)
|
||||
*name = realloc(*name, strlen(*name) + nm->len_sue[0] - 5 + 1);
|
||||
strncat(*name, (char*)nm->data.NM.name, nm->len_sue[0] - 5);
|
||||
} else {
|
||||
*name = strcopy((char*)nm->data.NM.name, nm->len_sue[0] - 5);
|
||||
*name = iso_util_strcopy((char*)nm->data.NM.name, nm->len_sue[0] - 5);
|
||||
}
|
||||
if (*name == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
@ -380,7 +381,7 @@ int read_rr_SL(struct susp_sys_user_entry *sl, char **dest, int *cont)
|
||||
/* we don't have to add the '/' */
|
||||
strncat(*dest, comp, len);
|
||||
} else {
|
||||
*dest = strcopy(comp, len);
|
||||
*dest = iso_util_strcopy(comp, len);
|
||||
}
|
||||
if (*dest == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "libisofs.h"
|
||||
@ -17,6 +18,12 @@
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
ino_t serial_id = (ino_t)1;
|
||||
ino_t mem_serial_id = (ino_t)1;
|
||||
ino_t cut_out_serial_id = (ino_t)1;
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
#ifndef LIBISO_STREAM_H_
|
||||
#define LIBISO_STREAM_H_
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2008 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "system_area.h"
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2008 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -25,6 +26,12 @@
|
||||
#include <stdio.h>
|
||||
#include <fnmatch.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX Libisofs_default_path_maX
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Add a new directory to the iso tree.
|
||||
*
|
||||
@ -914,7 +921,7 @@ int iso_tree_path_to_node(IsoImage *image, const char *path, IsoNode **node)
|
||||
int result;
|
||||
IsoNode *n;
|
||||
IsoDir *dir;
|
||||
char *ptr, *brk_info, *component;
|
||||
char *ptr, *brk_info = NULL, *component;
|
||||
|
||||
if (image == NULL || path == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
#ifndef LIBISO_IMAGE_TREE_H_
|
||||
#define LIBISO_IMAGE_TREE_H_
|
||||
|
@ -1,10 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
* Copyright (c) 2007 Mario Danic
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "util.h"
|
||||
@ -1381,21 +1383,33 @@ int iso_eaccess(const char *path)
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
char *strcopy(const char *buf, size_t len)
|
||||
char *iso_util_strcopy(const char *buf, size_t len)
|
||||
{
|
||||
char *str;
|
||||
|
||||
str = malloc((len + 1) * sizeof(char));
|
||||
str = calloc(len + 1, 1);
|
||||
if (str == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
strncpy(str, buf, len);
|
||||
str[len] = '\0';
|
||||
return str;
|
||||
}
|
||||
|
||||
char *iso_util_strcopy_untail(const char *buf, size_t len)
|
||||
{
|
||||
char *str;
|
||||
|
||||
str = iso_util_strcopy(buf, len);
|
||||
if (str == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
/* remove trailing spaces */
|
||||
for (len = len-1; str[len] == ' ' && len > 0; --len)
|
||||
str[len] = '\0';
|
||||
|
||||
for (len = len-1; len >= 0; --len) {
|
||||
if (str[len] != ' ')
|
||||
break;
|
||||
str[len] = 0;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
* Copyright (c) 2009 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef LIBISO_UTIL_H_
|
||||
@ -250,7 +252,14 @@ int iso_eaccess(const char *path);
|
||||
* Copy up to \p len chars from \p buf and return this newly allocated
|
||||
* string. The new string is null-terminated.
|
||||
*/
|
||||
char *strcopy(const char *buf, size_t len);
|
||||
char *iso_util_strcopy(const char *buf, size_t len);
|
||||
|
||||
/**
|
||||
* Copy up to \p len chars from \p buf and return this newly allocated
|
||||
* string. The new string is null-terminated.
|
||||
* Any trailing blanks will be removed.
|
||||
*/
|
||||
char *iso_util_strcopy_untail(const char *buf, size_t len);
|
||||
|
||||
/**
|
||||
* Copy up to \p max characters from \p src to \p dest. If \p src has less than
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "util.h"
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "util.h"
|
||||
|
@ -2,8 +2,9 @@
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* 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 as
|
||||
* published by the Free Software Foundation. See COPYING file for details.
|
||||
* 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.
|
||||
*/
|
||||
#ifndef LIBISO_IMAGE_WRITER_H_
|
||||
#define LIBISO_IMAGE_WRITER_H_
|
||||
|
Reference in New Issue
Block a user