nss_printer.c revision 355b4669e025ff377602b6fc7caaf30dbc218371
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <nss_dbdefs.h>
#include <syslog.h>
#include <ns.h>
#ifndef NSS_DBNAM__PRINTERS /* not in nss_dbdefs.h because it's private */
#define NSS_DBNAM__PRINTERS "_printers"
#endif
static DEFINE_NSS_DB_ROOT(db_root);
static DEFINE_NSS_GETENT(context);
static int printers_stayopen;
static char *private_ns = NULL;
static char initialized = 0;
static void
nss_db_params_t *p;
{
if (private_ns != NULL) {
/*
* because we need to support a legacy interface that allows
* us to select a specific name service, we need to dummy up
* the parameters to use a private nsswitch database and set
* the * default_config entry to the name service we are
* looking into.
*/
private_ns = NULL;
} else if (initialized == 0) {
/* regular behaviour */
initialized = 1;
}
}
/*
* 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.
*/
/* ARGSUSED */
static int
{
return (NSS_STR_PARSE_ERANGE);
/*
* We copy the input string into the output buffer
*/
return (NSS_STR_PARSE_SUCCESS);
}
int
{
initialized = 0;
private_ns = ns;
return (0);
}
int
{
printers_stayopen = 0;
initialized = 0;
return (0);
}
/* ARGSUSED2 */
int
{
(void) NSS_XbyY_FINI(&arg);
}
int
{
private_ns = ns;
(void) NSS_XbyY_FINI(&arg);
}