/*
* 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
*/
/*
*
* nis/getspent.c -- "nis" backend for nsswitch "shadow" database
*/
#include <shadow.h>
#include <string.h>
#include "nis_common.h"
/*
* Most of the information in a struct spwd simply isn't available from the
* YP maps, we dummy out all the numeric fields and just get sp_namp and
* sp_pwdp (name and password) from the YP passwd map. Thus we don't
* use the str2ent() routine that's passed to us, but instead have our
* own dummy routine:
*
* Return values: 0 = success, 1 = parse error, 2 = erange ...
* The structure pointer passed in is a structure in the caller's space
* wherein the field pointers would be set to areas in the buffer if
* need be. instring and buffer should be separate areas. Let's not
* fight over crumbs.
*/
static int
int buflen)
{
char *p, *q, *r;
/*
* We know that instr != 0 because we're in 'nis', not 'files'
*/
return (NSS_STR_PARSE_PARSE);
}
return (NSS_STR_PARSE_PARSE);
}
/* Don't bother checking the rest of the YP passwd entry... */
return (NSS_STR_PARSE_ERANGE);
}
/*
* "name:password" is copied
*/
if (spwd) {
} else {
/*
* NSS2: nscd is running. Return files format.
*
* name:password:::::::
*/
*r = '\0';
return (NSS_STR_PARSE_ERANGE);
}
return (NSS_STR_PARSE_SUCCESS);
}
typedef int (*cstr2ent_t)(const char *, int, void *, char *, int);
static nss_status_t
{
char *p;
/*
* check for the C2 security flag "##" in the passwd field.
* If the first 2 chars in the passwd field is "##", get
* the user's passwd from passwd.adjunct.byname map.
* The lookup to this passwd.adjunct.byname map will only
* succeed if the caller's uid is 0 because only root user
* can use privilege port.
*/
if (res == NSS_SUCCESS) {
if (spwd) {
/*
* Clear "##" entry from return result
* before query. In the event nothing is
* found, NULL value will be passed to
* getspnam_r().
*/
}
/* get password from passwd.adjunct.byname */
"passwd.adjunct.byname",
}
} else {
/*
* getent request from nscd
*/
return (NSS_STR_PARSE_PARSE);
/* get password from passwd.adjunct.byname */
"passwd.adjunct.byname",
if (res == NSS_SUCCESS) {
}
}
}
return (res);
}
#define NIS_SP_GETENT
#ifdef NIS_SP_GETENT
static nss_status_t
{
char *p;
/*
* check for the C2 security flag "##" in the passwd field.
* If the first 2 chars in the passwd field is "##", get
* the user's passwd from passwd.adjunct.byname map.
* The lookup to this passwd.adjunct.byname map will only
* succeed if the caller's uid is 0 because only root user
* can use privilege port.
*/
if (res == NSS_SUCCESS) {
if (spwd) {
/*
* Clear "##" entry from return result
* before query. In the event nothing is
* found, NULL value will be passed to
* getspent_r().
*/
}
/* get password from passwd.adjunct.byname */
"passwd.adjunct.byname",
}
} else {
/*
* getent request from nscd
*/
return (NSS_STR_PARSE_PARSE);
/* need the name for the next search */
*p = '\0';
/* get password from passwd.adjunct.byname */
"passwd.adjunct.byname", p, 0);
}
if (res == NSS_SUCCESS) {
}
}
}
return (res);
}
#endif /* NIS_SP_GETENT */
#ifdef NIS_SP_GETENT
#else
0,
#endif /* NIS_SP_GETENT */
};
/*ARGSUSED*/
const char *dummy3)
{
return (_nss_nis_constr(shadow_ops,
}