2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#include <sys/types.h>
2N/A#include <stdlib.h>
2N/A#include <string.h>
2N/A#include <bsm/libbsm.h>
2N/A#include "compat_common.h"
2N/A
2N/Astatic DEFINE_NSS_DB_ROOT(db_root);
2N/A
2N/Astatic void
2N/A_nss_initf_auuser_compat(nss_db_params_t *p)
2N/A{
2N/A p->name = NSS_DBNAM_AUDITUSER;
2N/A p->config_name = NSS_DBNAM_PASSWD_COMPAT;
2N/A p->default_config = NSS_DEFCONF_PASSWD_COMPAT;
2N/A}
2N/A
2N/Astatic const char *
2N/Aget_auname(nss_XbyY_args_t *argp)
2N/A{
2N/A au_user_str_t *au_user = (au_user_str_t *)argp->returnval;
2N/A
2N/A return (au_user->au_name);
2N/A}
2N/A
2N/Astatic int
2N/Acheck_name(nss_XbyY_args_t *argp)
2N/A{
2N/A au_user_str_t *au_user = (au_user_str_t *)argp->returnval;
2N/A const char *name = argp->key.name;
2N/A
2N/A#ifdef DEBUG
2N/A (void) fprintf(stdout,
2N/A "\n[getauuser.c: check_name %s with %s]\n", au_user->au_name, name);
2N/A#endif /* DEBUG */
2N/A
2N/A if (strcmp(au_user->au_name, name) == 0) {
2N/A return (1);
2N/A }
2N/A return (0);
2N/A}
2N/A
2N/Astatic nss_status_t
2N/Agetbynam(compat_backend_ptr_t be, void *a)
2N/A{
2N/A nss_status_t res;
2N/A nss_XbyY_args_t *argp = (nss_XbyY_args_t *)a;
2N/A
2N/A#ifdef DEBUG
2N/A (void) fprintf(stdout, "\n[getauuser.c: getbynam]\n");
2N/A#endif /* DEBUG */
2N/A
2N/A res = _attrdb_compat_XY_all(be,
2N/A argp, 1, check_name, NSS_DBOP_AUDITUSER_BYNAME);
2N/A
2N/A return (res);
2N/A}
2N/A
2N/Astatic compat_backend_op_t auuser_ops[] = {
2N/A _nss_compat_destr,
2N/A _nss_compat_endent,
2N/A _nss_compat_setent,
2N/A _nss_compat_getent,
2N/A getbynam
2N/A};
2N/A
2N/A/*ARGSUSED*/
2N/Anss_backend_t *
2N/A_nss_compat_audit_user_constr(const char *dummy1,
2N/A const char *dummy2,
2N/A const char *dummy3,
2N/A const char *dummy4,
2N/A const char *dummy5)
2N/A{
2N/A return (_nss_compat_constr(auuser_ops,
2N/A sizeof (auuser_ops)/sizeof (auuser_ops[0]),
2N/A AUDITUSER_FILENAME,
2N/A NSS_LINELEN_AUDITUSER,
2N/A &db_root,
2N/A _nss_initf_auuser_compat,
2N/A 0,
2N/A get_auname,
2N/A NULL));
2N/A}