This file is indexed.

/usr/include/dar/header_version.hpp is in libdar-dev 2.4.8-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2052 Denis Corbin
//
// 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; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
// to contact the author : http://dar.linux.free.fr/email.html
/*********************************************************************/

    /// \file header_version.hpp
    /// \brief archive global header structure is defined here
    /// \ingroup Private

#ifndef HEADER_LIBDAR_VERSION_HPP
#define HEADER_LIBDAR_VERSION_HPP

#include "/usr/include/dar/libdar_my_config.h"
#include "/usr/include/dar/infinint.hpp"
#include "/usr/include/dar/generic_file.hpp"
#include "/usr/include/dar/tools.hpp"
#include "/usr/include/dar/archive_version.hpp"

namespace libdar
{

	/// \addtogroup Private
	/// @{

    const U_I LIBDAR_VERSION_FLAG_SAVED_EA_ROOT = 0x80;      //< no more used since version "05"
    const U_I LIBDAR_VERSION_FLAG_SAVED_EA_USER = 0x40;      //< no more used since version "05"
    const U_I LIBDAR_VERSION_FLAG_SCRAMBLED     = 0x20;      //< scrambled or strong encryption used
    const U_I LIBDAR_VERSION_FLAG_SEQUENCE_MARK = 0x10;      //< escape sequence marks present for sequential reading
    const U_I LIBDAR_VERSION_FLAG_INITIAL_OFFSET = 0x08;     //< whether the header contains the initial offset (size of clear data before encrypted) NOTE : This value is set internally by header_version, no need to set flag with it! But that's OK to set it or not, it will be updated according to initial_offset's value.
    const U_I LIBDAR_VERSION_FLAG_HAS_AN_EXTENDED_SIZE = 0x01; //< reserved for future use
    const U_I LIBDAR_VERSION_SIZE = 3;                       //< size of the version field
    const U_I HEADER_CRC_SIZE = 2;                    //< size of the CRC (deprecated, now only used when reading old archives)


	/// manages of the archive header and trailer
    struct header_version
    {
        archive_version edition;
        char algo_zip;
        std::string cmd_line; // used long ago to store cmd_line, then abandonned, then recycled as a user comment field
        unsigned char flag; // added at edition 02
	infinint initial_offset; // not dropped to archive if set to zero (at dump() time, the flag is also updated with LIBDAR_VERSION_FLAG_INITIAL_OFFSET accordingly to this value)

	header_version()
	{
	    algo_zip = ' ';
	    cmd_line = "";
	    flag = 0;
	    initial_offset = 0;
	}

        void read(generic_file &f)
	{
	    crc *ctrl = NULL;

	    f.reset_crc(HEADER_CRC_SIZE);
	    edition.read(f);
	    f.read(&algo_zip, sizeof(algo_zip));
	    tools_read_string(f, cmd_line);
	    if(edition > 1)
		f.read((char *)&flag, 1);
	    else
		flag = 0;
	    if((flag & LIBDAR_VERSION_FLAG_INITIAL_OFFSET) != 0)
		initial_offset.read(f);
	    else
		initial_offset = 0;

	    ctrl = f.get_crc();
	    if(ctrl == NULL)
		throw SRC_BUG;
	    try
	    {
		if((edition == empty_archive_version()))
		    throw Erange("header_version::read", gettext("Consistency check failed for archive header"));
		if(edition > 7)
		{
		    crc *coh = create_crc_from_file(f);

		    if(coh == NULL)
			throw SRC_BUG;
		    try
		    {
			if(typeid(*coh) != typeid(*ctrl))
			{
			    if(coh->get_size() != ctrl->get_size())
				throw SRC_BUG;
			    else
				throw SRC_BUG; // both case lead to a bug, but we need to know which one is met
			}
			if(*coh != *ctrl)
			    throw Erange("header_version::read", gettext("Consistency check failed for archive header"));
		    }
		    catch(...)
		    {
			if(coh != NULL)
			    delete coh;
			throw;
		    }
		    if(coh != NULL)
			delete coh;
		}
		if(initial_offset == 0)
		    initial_offset = f.get_position();
	    }
	    catch(...)
	    {
		if(ctrl != NULL)
		    delete ctrl;
		throw;
	    }

	    if(ctrl != NULL)
		delete ctrl;
	};

        void write(generic_file &f)
	{
	    crc *ctrl = NULL;

		// preparing the data

	    if(initial_offset != 0)
		flag |= LIBDAR_VERSION_FLAG_INITIAL_OFFSET; // adding it to the flag
	    else
		flag &= ~LIBDAR_VERSION_FLAG_INITIAL_OFFSET; // removing it from the flag

		// writing down the data

	    f.reset_crc(HEADER_CRC_SIZE);
	    edition.dump(f);
	    f.write(&algo_zip, sizeof(algo_zip));
	    tools_write_string(f, cmd_line);
	    f.write((char *)&flag, 1);
	    if(initial_offset != 0)
		initial_offset.dump(f);

	    ctrl = f.get_crc();
	    if(ctrl == NULL)
		throw SRC_BUG;
	    try
	    {
		ctrl->dump(f);
	    }
	    catch(...)
	    {
		if(ctrl != NULL)
		    delete ctrl;
		throw;
	    }
	    if(ctrl != NULL)
		delete ctrl;
	};
    };

} // end of namespace

#endif