/usr/include/dar/user_group_bases.hpp is in libdar-dev 2.4.2-1.
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 | /*********************************************************************/
// 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
/*********************************************************************/
// $Id: user_group_bases.hpp,v 1.4 2011/01/09 17:25:58 edrusb Rel $
//
/*********************************************************************/
/// \file user_group_bases.hpp
/// \brief defines class that speed up the uid to username and gid to group name lookup
/// \ingroup Private
#ifndef USER_GROUP_BASES_HPP
#define USER_GROUP_BASES_HPP
#include "/usr/include/dar/libdar_my_config.h"
#ifdef __DYNAMIC__
extern "C"
{
#if LIBDAR_MUTEX_WORKS
#if LIBDAR_HAS_PTHREAD_H
#include <pthread.h>
#endif
#endif
}
#include <map>
#include <string>
#include "/usr/include/dar/infinint.hpp"
namespace libdar
{
/// \addtogroup Private
/// @{
class user_group_bases
{
public:
user_group_bases() : filled(false) {};
/// return the user name corresponding to the given uid
/// \note if the entry is not known, returns an empty string
const std::string & get_username(const infinint & uid) const;
/// return the group name corresponding to the given gid
/// \note if the entry is not known, returns an empty string
const std::string & get_groupname(const infinint & gid) const;
/// initialize mutex for the class, to be called only once for all and before any object instantiation
static void class_init();
private:
bool filled;
std::map<infinint, std::string> user_database;
std::map<infinint, std::string> group_database;
void fill() const;
static const std::string empty_string;
#if LIBDAR_MUTEX_WORKS
// the system call used to read the password and group database are not re-entrant, the mutex
// must block all other thread while a given thread is reading the databases
// the best solution would have to let the user provide such a database object already filled
// but that would rely on it not to destroy this object while threads are using it
// for this reason, here the mutex is 'static'
static pthread_mutex_t lock_fill;
#endif
static bool class_initialized;
};
/// @}
} // end of namespace
#endif
#endif
|