-
Notifications
You must be signed in to change notification settings - Fork 25
/
nss_cache.h
79 lines (71 loc) · 2.02 KB
/
nss_cache.h
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
/* Copyright 2009 Google Inc.
*
* This library is free software; you can redistribute it and/or
* 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.
*
* This 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA
*/
#include <errno.h>
#include <grp.h>
#include <nss.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#ifndef BSD
#include <gshadow.h>
#include <shadow.h>
#endif /* ifndef BSD */
#ifndef NSS_CACHE_H
#define NSS_CACHE_H
#ifdef DEBUG
#undef DEBUG
#define DEBUG(fmt, ...) \
do { \
fprintf(stderr, fmt, ##__VA_ARGS__); \
} while (0)
#else
#define DEBUG(fmt, ...) \
do { \
} while (0)
#endif /* DEBUG */
#define NSS_CACHE_PATH_LENGTH 255
extern char *_nss_cache_setpwent_path(const char *path);
extern char *_nss_cache_setgrent_path(const char *path);
#ifndef BSD
extern char *_nss_cache_setspent_path(const char *path);
extern char *_nss_cache_setsgent_path(const char *path);
#endif /* ifndef BSD */
enum nss_cache_match {
NSS_CACHE_EXACT = 0,
NSS_CACHE_HIGH = 1,
NSS_CACHE_LOW = 2,
NSS_CACHE_ERROR = 3
};
struct nss_cache_args {
char *system_filename;
char *sorted_filename;
void *lookup_function;
void *lookup_value;
void *lookup_result;
char *buffer;
size_t buflen;
char *lookup_key;
size_t lookup_key_length;
};
#endif /* NSS_CACHE_H */