1113595Snectar/*-
2113595Snectar * Copyright (c) 2003 Networks Associates Technology, Inc.
3113595Snectar * All rights reserved.
4113595Snectar *
5113595Snectar * This software was developed for the FreeBSD Project by
6113595Snectar * Jacques A. Vidrine, Safeport Network Services, and Network
7113595Snectar * Associates Laboratories, the Security Research Division of Network
8113595Snectar * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
9113595Snectar * ("CBOSS"), as part of the DARPA CHATS research program.
10113595Snectar *
11113595Snectar * Redistribution and use in source and binary forms, with or without
12113595Snectar * modification, are permitted provided that the following conditions
13113595Snectar * are met:
14113595Snectar * 1. Redistributions of source code must retain the above copyright
15113595Snectar *    notice, this list of conditions and the following disclaimer.
16113595Snectar * 2. Redistributions in binary form must reproduce the above copyright
17113595Snectar *    notice, this list of conditions and the following disclaimer in the
18113595Snectar *    documentation and/or other materials provided with the distribution.
19113595Snectar *
20113595Snectar * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21113595Snectar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22113595Snectar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23113595Snectar * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24113595Snectar * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25113595Snectar * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26113595Snectar * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27113595Snectar * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28113595Snectar * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29113595Snectar * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30113595Snectar * SUCH DAMAGE.
31113595Snectar *
32113595Snectar * $FreeBSD$
33113595Snectar *
34113595Snectar * Compatibility header for the GNU C Library-style nsswitch interface.
35113595Snectar */
36113595Snectar#ifndef _NSS_H_
37113595Snectar#define _NSS_H_
38113595Snectar
39113595Snectar#include <nsswitch.h>
40113595Snectar
41113595Snectarenum nss_status {
42113595Snectar	NSS_STATUS_TRYAGAIN = -2,
43113595Snectar	NSS_STATUS_UNAVAIL,
44113595Snectar	NSS_STATUS_NOTFOUND,
45113595Snectar	NSS_STATUS_SUCCESS,
46113595Snectar	NSS_STATUS_RETURN
47113595Snectar};
48113595Snectar
49124289Snectar#define __nss_compat_result(rv, err)		\
50124289Snectar((rv == NSS_STATUS_TRYAGAIN && err == ERANGE) ? NS_RETURN : \
51124289Snectar (rv == NSS_STATUS_TRYAGAIN) ? NS_TRYAGAIN :	\
52113595Snectar (rv == NSS_STATUS_UNAVAIL)  ? NS_UNAVAIL  :	\
53113595Snectar (rv == NSS_STATUS_NOTFOUND) ? NS_NOTFOUND :	\
54113595Snectar (rv == NSS_STATUS_SUCCESS)  ? NS_SUCCESS  :	\
55113595Snectar (rv == NSS_STATUS_RETURN)   ? NS_RETURN   : 0)
56113595Snectar
57113595Snectar#endif
58