2000-01-02 04:20:21 +00:00
|
|
|
/* Common database open/close routines for nss_db.
|
2022-01-01 18:54:23 +00:00
|
|
|
Copyright (C) 1999-2022 Free Software Foundation, Inc.
|
2000-01-02 04:20:21 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2000-01-02 04:20:21 +00:00
|
|
|
|
|
|
|
The GNU C Library 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
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
2000-01-02 04:20:21 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2000-01-02 04:20:21 +00:00
|
|
|
|
|
|
|
#ifndef _NSS_DB_H
|
|
|
|
#define _NSS_DB_H 1
|
|
|
|
|
2000-05-08 04:50:45 +00:00
|
|
|
#include <nss.h>
|
2000-01-02 04:20:21 +00:00
|
|
|
#include <stdint.h>
|
2015-09-08 21:11:03 +00:00
|
|
|
#include <libc-lock.h>
|
2000-01-02 04:20:21 +00:00
|
|
|
|
2020-02-12 10:47:26 +00:00
|
|
|
NSS_DECLARE_MODULE_FUNCTIONS (db)
|
2000-01-08 05:28:22 +00:00
|
|
|
|
2011-06-15 02:21:51 +00:00
|
|
|
/* String table index type. */
|
|
|
|
typedef uint32_t stridx_t;
|
2000-05-08 04:50:45 +00:00
|
|
|
|
2011-06-15 02:21:51 +00:00
|
|
|
/* Database file header. */
|
|
|
|
struct nss_db_header
|
2000-05-08 04:50:45 +00:00
|
|
|
{
|
2011-06-15 02:21:51 +00:00
|
|
|
uint32_t magic;
|
|
|
|
#define NSS_DB_MAGIC 0xdd110601
|
|
|
|
uint32_t ndbs;
|
|
|
|
uint64_t valstroffset;
|
|
|
|
uint64_t valstrlen;
|
|
|
|
uint64_t allocate;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
char id;
|
|
|
|
char pad[sizeof (uint32_t) - 1];
|
|
|
|
uint32_t hashsize;
|
|
|
|
uint64_t hashoffset;
|
|
|
|
uint64_t keyidxoffset;
|
|
|
|
uint64_t keystroffset;
|
|
|
|
} dbs[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Information about mapped database. */
|
|
|
|
struct nss_db_map
|
2000-01-02 08:45:58 +00:00
|
|
|
{
|
2011-06-15 02:21:51 +00:00
|
|
|
struct nss_db_header *header;
|
|
|
|
size_t len;
|
|
|
|
};
|
2000-01-02 08:45:58 +00:00
|
|
|
|
2000-01-02 04:20:21 +00:00
|
|
|
|
2000-05-08 04:50:45 +00:00
|
|
|
/* Open the database stored in FILE. If succesful, store the database
|
2011-06-15 02:21:51 +00:00
|
|
|
handle in *MAPPINGP or a file descriptor for the file in *FDP and
|
|
|
|
return NSS_STATUS_SUCCESS. On failure, return the appropriate
|
2000-05-08 04:50:45 +00:00
|
|
|
lookup status. */
|
2011-06-15 02:21:51 +00:00
|
|
|
enum nss_status internal_setent (const char *file,
|
|
|
|
struct nss_db_map *mappingp);
|
|
|
|
|
|
|
|
/* Close the database FD. */
|
|
|
|
extern void internal_endent (struct nss_db_map *mapping);
|
2000-01-08 05:28:22 +00:00
|
|
|
|
2000-01-02 04:20:21 +00:00
|
|
|
#endif /* nss_db.h */
|