* `passwd' defaults to `compat', and `passwd_compat' defaults to `nis'

* constify ns_dtab defs
This commit is contained in:
lukem 1999-01-19 08:30:46 +00:00
parent c7e9373f32
commit b247a8eceb
4 changed files with 30 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: getgrent.c,v 1.30 1999/01/19 08:07:58 lukem Exp $ */
/* $NetBSD: getgrent.c,v 1.31 1999/01/19 08:30:46 lukem Exp $ */
/*
* Copyright (c) 1989, 1993
@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)getgrent.c 8.2 (Berkeley) 3/21/94";
#else
__RCSID("$NetBSD: getgrent.c,v 1.30 1999/01/19 08:07:58 lukem Exp $");
__RCSID("$NetBSD: getgrent.c,v 1.31 1999/01/19 08:30:46 lukem Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -428,7 +428,7 @@ __grscancompat(search, gid, name)
gid_t gid;
const char *name;
{
static ns_dtab dtab[] = {
static const ns_dtab dtab[] = {
NS_FILES_CB(_bad_grscan, "files")
NS_DNS_CB(_dns_grscan, NULL)
NS_NIS_CB(_nis_grscan, NULL)
@ -536,7 +536,7 @@ grscan(search, gid, name)
const char *name;
{
int r;
static ns_dtab dtab[] = {
static const ns_dtab dtab[] = {
NS_FILES_CB(_local_grscan, NULL)
NS_DNS_CB(_dns_grscan, NULL)
NS_NIS_CB(_nis_grscan, NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: getnetgrent.c,v 1.19 1999/01/19 08:07:58 lukem Exp $ */
/* $NetBSD: getnetgrent.c,v 1.20 1999/01/19 08:30:47 lukem Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: getnetgrent.c,v 1.19 1999/01/19 08:07:58 lukem Exp $");
__RCSID("$NetBSD: getnetgrent.c,v 1.20 1999/01/19 08:30:47 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -299,7 +299,7 @@ lookup(name, line, bywhat)
int bywhat;
{
int r;
static ns_dtab dtab[] = {
static const ns_dtab dtab[] = {
NS_FILES_CB(_local_lookup, NULL)
NS_DNS_CB(_nis_lookup, NULL)
{ 0 }

View File

@ -1,4 +1,4 @@
/* $NetBSD: getpwent.c,v 1.35 1999/01/19 08:04:27 lukem Exp $ */
/* $NetBSD: getpwent.c,v 1.36 1999/01/19 08:30:47 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)getpwent.c 8.2 (Berkeley) 4/27/95";
#else
__RCSID("$NetBSD: getpwent.c,v 1.35 1999/01/19 08:04:27 lukem Exp $");
__RCSID("$NetBSD: getpwent.c,v 1.36 1999/01/19 08:30:47 lukem Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -96,6 +96,10 @@ static int __hashpw __P((DBT *));
static int __initdb __P((void));
const char __yp_token[] = "__YP!"; /* Let pwd_mkdb pull this in. */
static const ns_src compatsrc[] = {
{ NSSRC_COMPAT, NS_SUCCESS },
{ 0 }
};
#ifdef YP
static char *__ypcurrent, *__ypdomain;
@ -667,24 +671,28 @@ __getpwcompat(type, uid, name)
uid_t uid;
const char *name;
{
static ns_dtab dtab[] = {
static const ns_dtab dtab[] = {
NS_FILES_CB(_bad_getpw, "files")
NS_DNS_CB(_dns_getpw, NULL)
NS_NIS_CB(_nis_getpw, NULL)
NS_COMPAT_CB(_bad_getpw, "compat")
{ 0 }
};
static const ns_src defaultnis[] = {
{ NSSRC_NIS, NS_SUCCESS },
{ 0 }
};
switch (type) {
case _PW_KEYBYNUM:
return nsdispatch(NULL, dtab, NSDB_PASSWD_COMPAT, "getpwcompat",
__nsdefaultsrc, type);
defaultnis, type);
case _PW_KEYBYNAME:
return nsdispatch(NULL, dtab, NSDB_PASSWD_COMPAT, "getpwcompat",
__nsdefaultsrc, type, name);
defaultnis, type, name);
case _PW_KEYBYUID:
return nsdispatch(NULL, dtab, NSDB_PASSWD_COMPAT, "getpwcompat",
__nsdefaultsrc, type, uid);
defaultnis, type, uid);
default:
abort();
}
@ -962,7 +970,7 @@ struct passwd *
getpwent()
{
int r;
static ns_dtab dtab[] = {
static const ns_dtab dtab[] = {
NS_FILES_CB(_local_getpw, NULL)
NS_DNS_CB(_dns_getpw, NULL)
NS_NIS_CB(_nis_getpw, NULL)
@ -971,7 +979,7 @@ getpwent()
};
_pw_none = 0;
r = nsdispatch(NULL, dtab, NSDB_PASSWD, "getpwent", __nsdefaultsrc,
r = nsdispatch(NULL, dtab, NSDB_PASSWD, "getpwent", compatsrc,
_PW_KEYBYNUM);
if (_pw_none || r != NS_SUCCESS)
return (struct passwd *)NULL;
@ -983,7 +991,7 @@ getpwnam(name)
const char *name;
{
int r;
static ns_dtab dtab[] = {
static const ns_dtab dtab[] = {
NS_FILES_CB(_local_getpw, NULL)
NS_DNS_CB(_dns_getpw, NULL)
NS_NIS_CB(_nis_getpw, NULL)
@ -994,7 +1002,7 @@ getpwnam(name)
if (name == NULL || name[0] == '\0')
return (struct passwd *)NULL;
r = nsdispatch(NULL, dtab, NSDB_PASSWD, "getpwnam", __nsdefaultsrc,
r = nsdispatch(NULL, dtab, NSDB_PASSWD, "getpwnam", compatsrc,
_PW_KEYBYNAME, name);
return (r == NS_SUCCESS ? &_pw_passwd : (struct passwd *)NULL);
}
@ -1004,7 +1012,7 @@ getpwuid(uid)
uid_t uid;
{
int r;
static ns_dtab dtab[] = {
static const ns_dtab dtab[] = {
NS_FILES_CB(_local_getpw, NULL)
NS_DNS_CB(_dns_getpw, NULL)
NS_NIS_CB(_nis_getpw, NULL)
@ -1012,7 +1020,7 @@ getpwuid(uid)
{ 0 }
};
r = nsdispatch(NULL, dtab, NSDB_PASSWD, "getpwuid", __nsdefaultsrc,
r = nsdispatch(NULL, dtab, NSDB_PASSWD, "getpwuid", compatsrc,
_PW_KEYBYUID, uid);
return (r == NS_SUCCESS ? &_pw_passwd : (struct passwd *)NULL);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: getusershell.c,v 1.14 1999/01/19 08:07:58 lukem Exp $ */
/* $NetBSD: getusershell.c,v 1.15 1999/01/19 08:30:48 lukem Exp $ */
/*
* Copyright (c) 1985, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getusershell.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: getusershell.c,v 1.14 1999/01/19 08:07:58 lukem Exp $");
__RCSID("$NetBSD: getusershell.c,v 1.15 1999/01/19 08:30:48 lukem Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -257,7 +257,7 @@ _nis_initshells(rv, cb_data, ap)
static const char *const *
initshells()
{
static ns_dtab dtab[] = {
static const ns_dtab dtab[] = {
NS_FILES_CB(_local_initshells, NULL)
NS_DNS_CB(_dns_initshells, NULL)
NS_NIS_CB(_nis_initshells, NULL)