/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* lib/nsswitch/compat/getspent.c -- name-service-switch backend for getspnam()
* with "+" or "-", it consults other services. By default it uses NIS (YP),
* but the user can override this with a "passwd_compat" entry in
* /etc/nsswitch.conf, e.g.
* passwd_compat: ldap
* The main criterion for this code is that it behave in the same way as
* the code for getpwnam() and friends (in getpwent.c). Note that it uses
* the same nsswitch.conf entry, not a separate entry for "shadow_compat".
*
* Caveats:
* - More than one source may be specified, with the usual switch semantics,
* but having multiple sources here is definitely odd.
* - People who recursively specify "compat" deserve what they get.
* - Entries that begin with "+@" or "-@" are interpreted using
* getnetgrent() and innetgr(), which use the "netgroup" entry in
* /etc/nsswitch.conf. If the sources for "passwd_compat" and "netgroup"
* differ, everything should work fine, but the semantics will be pretty
* confusing.
*/
#include <shadow.h>
#include <string.h>
#include <stdlib.h>
#include "compat_common.h"
static DEFINE_NSS_DB_ROOT(db_root);
static void
nss_db_params_t *p;
{
p->name = NSS_DBNAM_SHADOW;
}
static const char *
{
return (s->sp_namp);
}
static int
{
}
static nss_status_t
void *a;
{
}
/*ARGSUSED*/
static int
const char **fields;
{
/*
* Don't allow overriding of the username; apart from that,
* anything is fair game.
*/
if (fields[1] != 0) {
/* ===> Probably merits an explanation... */
return (NSS_STR_PARSE_ERANGE);
}
}
}
if ((field) != 0) { \
char *end; \
\
if (*end == '\0') { \
} else { \
return (NSS_STR_PARSE_PARSE); \
} \
}
/* do not override last changed date, it never gets reset. */
/* override(fields[2], &sp->sp_lstchg); */
/*
* if asked, return the data in /etc file format
*/
int n;
char b[16 * 7];
/* reset the result ptr to the original value */
return (NSS_STR_PARSE_ERANGE);
else {
return (NSS_SUCCESS);
}
} else
return (NSS_STR_PARSE_SUCCESS);
}
static compat_backend_op_t shadow_ops[] = {
};
/*ARGSUSED*/
{
return (_nss_compat_constr(shadow_ops,
sizeof (shadow_ops) / sizeof (shadow_ops[0]),
&db_root,
1,
merge_spents));
}