Imported Upstream version 1.8.7
[debian/sudo] / plugins / sudoers / sudo_nss.h
1 /*
2  * Copyright (c) 2007-2011, 2013 Todd C. Miller <Todd.Miller@courtesan.com>
3  *
4  * Permission to use, copy, modify, and distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef _SUDOERS_NSS_H
18 #define _SUDOERS_NSS_H
19
20 struct lbuf;
21 struct passwd;
22
23 struct sudo_nss {
24     struct sudo_nss *prev;
25     struct sudo_nss *next;
26     int (*open)(struct sudo_nss *nss);
27     int (*close)(struct sudo_nss *nss);
28     int (*parse)(struct sudo_nss *nss);
29     int (*setdefs)(struct sudo_nss *nss);
30     int (*lookup)(struct sudo_nss *nss, int, int);
31     int (*display_cmnd)(struct sudo_nss *nss, struct passwd *);
32     int (*display_defaults)(struct sudo_nss *nss, struct passwd *, struct lbuf *);
33     int (*display_bound_defaults)(struct sudo_nss *nss, struct passwd *, struct lbuf *);
34     int (*display_privs)(struct sudo_nss *nss, struct passwd *, struct lbuf *);
35     void *handle;
36     short ret_if_found;
37     short ret_if_notfound;
38 };
39
40 TQ_DECLARE(sudo_nss)
41
42 struct sudo_nss_list *sudo_read_nss(void);
43
44 #endif /* _SUDOERS_NSS_H */