summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>1999-01-15 12:21:16 +0000
committerlukem <lukem@NetBSD.org>1999-01-15 12:21:16 +0000
commitf649503d997cbf39b71f9a9ff07192b7b815779b (patch)
tree435139b8acae1acd17d785dc359674ece95b2f2e /include
parent45a22daf1097cd6ba0761b45de2f15f4b7e5bd3b (diff)
merge nsswitch into main branch
Diffstat (limited to 'include')
-rw-r--r--include/Makefile13
-rw-r--r--include/hesiod.h58
-rw-r--r--include/nsswitch.h186
3 files changed, 251 insertions, 6 deletions
diff --git a/include/Makefile b/include/Makefile
index fd335fdee41..7422835c691 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.72 1999/01/12 03:08:14 kleink Exp $
+# $NetBSD: Makefile,v 1.73 1999/01/15 12:29:16 lukem Exp $
# @(#)Makefile 8.2 (Berkeley) 1/4/94
# Doing a make includes builds /usr/include
@@ -7,12 +7,13 @@
INCS= a.out.h ar.h assert.h bitstring.h bm.h cpio.h ctype.h db.h dirent.h \
disktab.h dlfcn.h err.h errno.h fnmatch.h fstab.h fts.h glob.h grp.h \
- ieeefp.h iso646.h kvm.h langinfo.h libgen.h limits.h locale.h \
+ hesiod.h ieeefp.h iso646.h kvm.h langinfo.h libgen.h limits.h locale.h \
malloc.h math.h md4.h memory.h mpool.h ndbm.h netdb.h netgroup.h \
- nlist.h nl_types.h paths.h pwd.h ranlib.h re_comp.h regex.h regexp.h \
- resolv.h rmt.h search.h setjmp.h sgtty.h signal.h stab.h stddef.h \
- stdio.h stdlib.h string.h strings.h stringlist.h struct.h sysexits.h \
- tar.h time.h ttyent.h tzfile.h unistd.h util.h utime.h utmp.h vis.h
+ nlist.h nl_types.h nsswitch.h paths.h pwd.h ranlib.h re_comp.h regex.h \
+ regexp.h resolv.h rmt.h search.h setjmp.h sgtty.h signal.h stab.h \
+ stddef.h stdio.h stdlib.h string.h strings.h stringlist.h struct.h \
+ sysexits.h tar.h time.h ttyent.h tzfile.h unistd.h util.h utime.h \
+ utmp.h vis.h
INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/telnet.h arpa/tftp.h
INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \
protocols/talkd.h protocols/timed.h
diff --git a/include/hesiod.h b/include/hesiod.h
new file mode 100644
index 00000000000..e686772acd8
--- /dev/null
+++ b/include/hesiod.h
@@ -0,0 +1,58 @@
+/* $NetBSD: hesiod.h,v 1.2 1999/01/15 12:28:26 lukem Exp $ */
+
+/* This file contains definitions for use by the Hesiod name service and
+ * applications.
+ *
+ * Copyright (C) 1989 by the Massachusetts Institute of Technology
+ *
+ * Export of software employing encryption from the United States of
+ * America is assumed to require a specific license from the United
+ * States Government. It is the responsibility of any person or
+ * organization contemplating export to obtain such a license before
+ * exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ *
+ * Original version by Steve Dyer, IBM/Project Athena.
+ *
+ */
+#ifndef _HESIOD_H_
+#define _HESIOD_H_
+
+/* Configuration information. */
+
+#ifndef _PATH_HESIOD_CONF /* Configuration file. */
+#define _PATH_HESIOD_CONF "/etc/hesiod.conf"
+#endif
+
+#define DEF_RHS "" /* Defaults if HESIOD_CONF */
+#define DEF_LHS "" /* file is not present. */
+
+/* Error codes. */
+
+#define HES_ER_UNINIT -1 /* uninitialized */
+#define HES_ER_OK 0 /* no error */
+#define HES_ER_NOTFOUND 1 /* Hesiod name not found by server */
+#define HES_ER_CONFIG 2 /* local problem (no config file?) */
+#define HES_ER_NET 3 /* network problem */
+
+/* Declaration of routines */
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+char *hes_to_bind __P((char *, char *));
+char **hes_resolve __P((char *, char *));
+int hes_error __P((void));
+void hes_free __P((char **));
+__END_DECLS
+
+#endif /* ! _HESIOD_H_ */
diff --git a/include/nsswitch.h b/include/nsswitch.h
new file mode 100644
index 00000000000..40f802fbc2c
--- /dev/null
+++ b/include/nsswitch.h
@@ -0,0 +1,186 @@
+/* $NetBSD: nsswitch.h,v 1.2 1999/01/15 12:21:16 lukem Exp $ */
+
+/*-
+ * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _NSSWITCH_H
+#define _NSSWITCH_H 1
+
+#include <sys/types.h>
+
+#if __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#ifndef _PATH_NS_CONF
+#define _PATH_NS_CONF "/etc/nsswitch.conf"
+#endif
+
+#define NS_CONTINUE 0
+#define NS_RETURN 1
+
+#define NS_SUCCESS (1<<0) /* entry was found */
+#define NS_UNAVAIL (1<<1) /* source not responding, or corrupt */
+#define NS_NOTFOUND (1<<2) /* source responded 'no such entry' */
+#define NS_TRYAGAIN (1<<3) /* source busy, may respond to retrys */
+#define NS_STATUSMASK 0x000000ff /* bitmask to get the status flags */
+
+/*
+ * currently implemented sources
+ */
+#define NSSRC_FILES "files" /* local files */
+#define NSSRC_DNS "dns" /* DNS; IN for hosts, HS for others */
+#define NSSRC_NIS "nis" /* yp/nis */
+#define NSSRC_NISPLUS "nisplus" /* nis+ */
+#define NSSRC_COMPAT "compat" /* passwd,group in yp compat mode */
+
+/*
+ * currently implemented databases
+ */
+#define NSDB_HOSTS "hosts"
+#define NSDB_GROUP "group"
+#define NSDB_GROUP_COMPAT "group_compat"
+#define NSDB_NETGROUP "netgroup"
+#define NSDB_PASSWD "passwd"
+#define NSDB_PASSWD_COMPAT "passwd_compat"
+#define NSDB_SHELLS "shells"
+
+/*
+ * suggested databases to implement
+ */
+#define NSDB_ALIASES "aliases"
+#define NSDB_AUTH "auth"
+#define NSDB_AUTOMOUNT "automount"
+#define NSDB_BOOTPARAMS "bootparams"
+#define NSDB_ETHERS "ethers"
+#define NSDB_EXPORTS "exports"
+#define NSDB_NETMASKS "netmasks"
+#define NSDB_NETWORKS "networks"
+#define NSDB_PHONES "phones"
+#define NSDB_PRINTCAP "printcap"
+#define NSDB_PROTOCOLS "protocols"
+#define NSDB_REMOTE "remote"
+#define NSDB_RPC "rpc"
+#define NSDB_SENDMAILVARS "sendmailvars"
+#define NSDB_SERVICES "services"
+#define NSDB_TERMCAP "termcap"
+#define NSDB_TTYS "ttys"
+
+/*
+ * ns_dtab - `nsswitch dispatch table'
+ * contains an entry for each source and the appropriate function to call
+ */
+typedef struct ns_dtab {
+ const char *src;
+ int (*callback)(void *retval, void *cb_data, va_list ap);
+ void *cb_data;
+} ns_dtab;
+
+/*
+ * macros to help build an ns_dtab[]
+ */
+#define NS_FILES_CB(F,C) { NSSRC_FILES, F, NULL }
+
+#ifdef HESIOD
+# define NS_DNS_CB(F,C) { NSSRC_DNS, F, NULL }
+#else
+# define NS_DNS_CB(F,C) { NSSRC_DNS, NULL, NULL }
+#endif
+
+#ifdef YP
+# define NS_NIS_CB(F,C) { NSSRC_NIS, F, NULL }
+#else
+# define NS_NIS_CB(F,C) { NSSRC_NIS, NULL, NULL }
+#endif
+
+#if defined(HESIOD) || defined(YP)
+# define NS_COMPAT_CB(F,C) { NSSRC_COMPAT, F, NULL }
+#else
+# define NS_COMPAT_CB(F,C) { NSSRC_COMPAT, NULL, NULL }
+#endif
+
+
+#ifdef _NS_PRIVATE
+
+/*
+ * private data structures for back-end nsswitch implementation
+ */
+
+/*
+ * ns_src - `nsswitch source'
+ * used by the nsparser routines to store a mapping between a source
+ * and its dispatch control flags for a given database.
+ */
+typedef struct ns_src {
+ const char *name;
+ u_int32_t flags;
+} ns_src;
+
+/*
+ * ns_dbt - `nsswitch database thang'
+ * for each database in /etc/nsswitch.conf there is a ns_dbt, with its
+ * name and a list of ns_src's containing the source information.
+ */
+typedef struct ns_dbt {
+ const char *name; /* name of database */
+ ns_src *srclist; /* list of sources */
+ int srclistsize; /* size of srclist */
+} ns_dbt;
+
+#endif /* _NS_PRIVATE */
+
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+extern int nsdispatch __P((void *, const ns_dtab [], const char *,
+ ...));
+
+#ifdef _NS_PRIVATE
+extern void _nsdbtaddsrc __P((ns_dbt *, const ns_src *));
+extern void _nsdbtdump __P((const ns_dbt *));
+extern const ns_dbt *_nsdbtget __P((const char *));
+extern void _nsdbtput __P((const ns_dbt *));
+extern void _nsyyerror __P((const char *));
+extern int _nsyylex __P((void));
+extern int _nsyylineno;
+#endif /* _NS_PRIVATE */
+
+__END_DECLS
+
+#endif /* !_NSSWITCH_H */