File: nsswitch.h

package info (click to toggle)
autofs 5.1.9-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,724 kB
  • sloc: ansic: 36,118; yacc: 1,821; lex: 1,126; sh: 627; makefile: 541
file content (69 lines) | stat: -rw-r--r-- 1,937 bytes parent folder | download
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
/* ----------------------------------------------------------------------- *
 *
 *  nsswitch.h - header file for module to call parser for nsswitch
 *		 config and store result into a struct.
 *
 *   Copyright 2006 Ian Kent <raven@themaw.net>
 *
 *   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, Inc., 675 Mass Ave, Cambridge MA 02139,
 *   USA; 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.
 *
 * ----------------------------------------------------------------------- */

#ifndef __NSSWITCH_H
#define __NSSWITCH_H

#include <netdb.h>
#include "list.h"

#ifndef _PATH_NSSWITCH_CONF
#define _PATH_NSSWITCH_CONF "/dev/null"
#endif

#define NSSWITCH_FILE _PATH_NSSWITCH_CONF

enum nsswitch_status {
	NSS_STATUS_UNKNOWN = -1,
	NSS_STATUS_SUCCESS,
	NSS_STATUS_NOTFOUND,
	NSS_STATUS_UNAVAIL,
	NSS_STATUS_TRYAGAIN,
	NSS_STATUS_MAX
};

/* Internal NSS STATUS for map inclusion lookups */
#define NSS_STATUS_COMPLETED    NSS_STATUS_MAX

enum nsswitch_action {
	NSS_ACTION_UNKNOWN = 0,
	NSS_ACTION_CONTINUE,
	NSS_ACTION_RETURN
};

struct nss_action {
	enum nsswitch_action action;
	int negated;
};

struct nss_source {
	char *source;
	struct nss_action action[NSS_STATUS_MAX];
	struct list_head list;
}; 

int set_action(struct nss_action *a, char *status, char *action, int negated);
int check_nss_result(struct nss_source *this, enum nsswitch_status result);
struct nss_source *add_source(struct list_head *head, char *source);
int free_sources(struct list_head *list);

int nsswitch_parse(struct list_head *list);

#endif