Debian Codegraph @

include/nsswitch.h

raw
1 /* ----------------------------------------------------------------------- *
2 *
3 * nsswitch.h - header file for module to call parser for nsswitch
4 * config and store result into a struct.
5 *
6 * Copyright 2006 Ian Kent <[email protected]>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
11 * USA; either version 2 of the License, or (at your option) any later
12 * version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * ----------------------------------------------------------------------- */
20
21 #ifndef __NSSWITCH_H
22 #define __NSSWITCH_H
23
24 #include <netdb.h>
25 #include "list.h"
26
27 #ifndef _PATH_NSSWITCH_CONF
28 #define _PATH_NSSWITCH_CONF "/dev/null"
29 #endif
30
31 #define NSSWITCH_FILE _PATH_NSSWITCH_CONF
32
33 enum nsswitch_status {
34 NSS_STATUS_UNKNOWN = -1,
35 NSS_STATUS_SUCCESS,
36 NSS_STATUS_NOTFOUND,
37 NSS_STATUS_UNAVAIL,
38 NSS_STATUS_TRYAGAIN,
39 NSS_STATUS_MAX
40 };
41
42 /* Internal NSS STATUS for map inclusion lookups */
43 #define NSS_STATUS_COMPLETED NSS_STATUS_MAX
44
45 enum nsswitch_action {
46 NSS_ACTION_UNKNOWN = 0,
47 NSS_ACTION_CONTINUE,
48 NSS_ACTION_RETURN
49 };
50
51 struct nss_action {
52 enum nsswitch_action action;
53 int negated;
54 };
55
56 struct nss_source {
57 char *source;
58 struct nss_action action[NSS_STATUS_MAX];
59 struct list_head list;
60 };
61
62 int set_action(struct nss_action *a, char *status, char *action, int negated);
63 int check_nss_result(struct nss_source *this, enum nsswitch_status result);
64 struct nss_source *add_source(struct list_head *head, char *source);
65 int free_sources(struct list_head *list);
66
67 int nsswitch_parse(struct list_head *list);
68
69 #endif