]> git.ipfire.org Git - thirdparty/glibc.git/blob - nss/nss_files/files-init.c
4ae51a89e45f4e7d1bb945d57051d7f80e095dea
[thirdparty/glibc.git] / nss / nss_files / files-init.c
1 /* Initialization in nss_files module.
2 Copyright (C) 2011-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19 #ifdef USE_NSCD
20
21 #include <string.h>
22 #include <nscd/nscd.h>
23
24 #define PWD_FILENAME "/etc/passwd"
25 define_traced_file (pwd, PWD_FILENAME);
26
27 #define GRP_FILENAME "/etc/group"
28 define_traced_file (grp, GRP_FILENAME);
29
30 #define HST_FILENAME "/etc/hosts"
31 define_traced_file (hst, HST_FILENAME);
32
33 #define RESOLV_FILENAME "/etc/resolv.conf"
34 define_traced_file (resolv, RESOLV_FILENAME);
35
36 #define SERV_FILENAME "/etc/services"
37 define_traced_file (serv, SERV_FILENAME);
38
39 #define NETGR_FILENAME "/etc/netgroup"
40 define_traced_file (netgr, NETGR_FILENAME);
41
42 void
43 _nss_files_init (void (*cb) (size_t, struct traced_file *))
44 {
45 init_traced_file (&pwd_traced_file.file, PWD_FILENAME, 0);
46 cb (pwddb, &pwd_traced_file.file);
47
48 init_traced_file (&grp_traced_file.file, GRP_FILENAME, 0);
49 cb (grpdb, &grp_traced_file.file);
50
51 init_traced_file (&hst_traced_file.file, HST_FILENAME, 0);
52 cb (hstdb, &hst_traced_file.file);
53
54 init_traced_file (&resolv_traced_file.file, RESOLV_FILENAME, 1);
55 cb (hstdb, &resolv_traced_file.file);
56
57 init_traced_file (&serv_traced_file.file, SERV_FILENAME, 0);
58 cb (servdb, &serv_traced_file.file);
59
60 init_traced_file (&netgr_traced_file.file, NETGR_FILENAME, 0);
61 cb (netgrdb, &netgr_traced_file.file);
62 }
63
64 #endif