10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*2830Sdjl * Common Development and Distribution License (the "License"). 6*2830Sdjl * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*2830Sdjl * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23*2830Sdjl * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 270Sstevel@tonic-gate 280Sstevel@tonic-gate #include <sys/types.h> 290Sstevel@tonic-gate #include <stdlib.h> 300Sstevel@tonic-gate #include <string.h> 310Sstevel@tonic-gate #include <bsm/libbsm.h> 320Sstevel@tonic-gate #include "compat_common.h" 330Sstevel@tonic-gate 340Sstevel@tonic-gate static DEFINE_NSS_DB_ROOT(db_root); 350Sstevel@tonic-gate 36*2830Sdjl static void 370Sstevel@tonic-gate _nss_initf_auuser_compat(nss_db_params_t *p) 380Sstevel@tonic-gate { 390Sstevel@tonic-gate p->name = NSS_DBNAM_AUDITUSER; 400Sstevel@tonic-gate p->config_name = NSS_DBNAM_PASSWD_COMPAT; 410Sstevel@tonic-gate p->default_config = NSS_DEFCONF_PASSWD_COMPAT; 420Sstevel@tonic-gate } 430Sstevel@tonic-gate 440Sstevel@tonic-gate static const char * 450Sstevel@tonic-gate get_auname(nss_XbyY_args_t *argp) 460Sstevel@tonic-gate { 470Sstevel@tonic-gate au_user_str_t *au_user = (au_user_str_t *)argp->returnval; 480Sstevel@tonic-gate 490Sstevel@tonic-gate return (au_user->au_name); 500Sstevel@tonic-gate } 510Sstevel@tonic-gate 520Sstevel@tonic-gate static int 530Sstevel@tonic-gate check_name(nss_XbyY_args_t *argp) 540Sstevel@tonic-gate { 550Sstevel@tonic-gate au_user_str_t *au_user = (au_user_str_t *)argp->returnval; 560Sstevel@tonic-gate const char *name = argp->key.name; 570Sstevel@tonic-gate 580Sstevel@tonic-gate #ifdef DEBUG 590Sstevel@tonic-gate (void) fprintf(stdout, 600Sstevel@tonic-gate "\n[getauuser.c: check_name %s with %s]\n", au_user->au_name, name); 610Sstevel@tonic-gate #endif /* DEBUG */ 620Sstevel@tonic-gate 630Sstevel@tonic-gate if (strcmp(au_user->au_name, name) == 0) { 640Sstevel@tonic-gate return (1); 650Sstevel@tonic-gate } 660Sstevel@tonic-gate return (0); 670Sstevel@tonic-gate } 680Sstevel@tonic-gate 690Sstevel@tonic-gate static nss_status_t 700Sstevel@tonic-gate getbynam(compat_backend_ptr_t be, void *a) 710Sstevel@tonic-gate { 720Sstevel@tonic-gate nss_status_t res; 730Sstevel@tonic-gate nss_XbyY_args_t *argp = (nss_XbyY_args_t *)a; 740Sstevel@tonic-gate 750Sstevel@tonic-gate #ifdef DEBUG 760Sstevel@tonic-gate (void) fprintf(stdout, "\n[getauuser.c: getbynam]\n"); 770Sstevel@tonic-gate #endif /* DEBUG */ 780Sstevel@tonic-gate 790Sstevel@tonic-gate res = _attrdb_compat_XY_all(be, 800Sstevel@tonic-gate argp, 1, check_name, NSS_DBOP_AUDITUSER_BYNAME); 810Sstevel@tonic-gate 820Sstevel@tonic-gate return (res); 830Sstevel@tonic-gate } 840Sstevel@tonic-gate 850Sstevel@tonic-gate static compat_backend_op_t auuser_ops[] = { 860Sstevel@tonic-gate _nss_compat_destr, 870Sstevel@tonic-gate _nss_compat_endent, 880Sstevel@tonic-gate _nss_compat_setent, 890Sstevel@tonic-gate _nss_compat_getent, 900Sstevel@tonic-gate getbynam 910Sstevel@tonic-gate }; 920Sstevel@tonic-gate 93*2830Sdjl /*ARGSUSED*/ 940Sstevel@tonic-gate nss_backend_t * 950Sstevel@tonic-gate _nss_compat_audit_user_constr(const char *dummy1, 960Sstevel@tonic-gate const char *dummy2, 970Sstevel@tonic-gate const char *dummy3, 980Sstevel@tonic-gate const char *dummy4, 990Sstevel@tonic-gate const char *dummy5) 1000Sstevel@tonic-gate { 1010Sstevel@tonic-gate return (_nss_compat_constr(auuser_ops, 1020Sstevel@tonic-gate sizeof (auuser_ops)/sizeof (auuser_ops[0]), 1030Sstevel@tonic-gate AUDITUSER_FILENAME, 1040Sstevel@tonic-gate NSS_LINELEN_AUDITUSER, 1050Sstevel@tonic-gate &db_root, 1060Sstevel@tonic-gate _nss_initf_auuser_compat, 1070Sstevel@tonic-gate 0, 1080Sstevel@tonic-gate get_auname, 1090Sstevel@tonic-gate NULL)); 1100Sstevel@tonic-gate } 111