getexecattr.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 1999-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mt.h"
#include <stdio.h>
#include <stdlib.h>
#include <nss_dbdefs.h>
#include <string.h>
#include <strings.h>
#include <sys/systeminfo.h>
#include <thread.h>
#include <synch.h>
#include <nsswitch.h>
#include <prof_attr.h>
#include <exec_attr.h>
/* externs from libc */
extern void _nss_db_state_destr(struct nss_db_state *);
/* externs from parse.c */
extern char *_strtok_escape(char *, char *, char **);
extern char *_strdup_null(char *);
/* extern from getprofattr.c */
extern int str2profattr(const char *, int, void *, char *, int);
char *_exec_wild_id(char *, const char *);
void _free_execstr(execstr_t *);
static char *_nsw_search_path = NULL;
/*
* Unsynchronized, but it affects only efficiency, not correctness
*/
static DEFINE_NSS_DB_ROOT(exec_root);
static DEFINE_NSS_GETENT(context);
void
{
p->name = NSS_DBNAM_EXECATTR;
}
void
{
p->name = NSS_DBNAM_EXECATTR;
p->flags |= NSS_USE_DEFAULT_CONFIG;
}
void
{
p->name = NSS_DBNAM_PROFATTR;
p->flags |= NSS_USE_DEFAULT_CONFIG;
}
/*
* 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.
*/
int
{
char *sep = KV_TOKEN_DELIMIT;
return (NSS_STR_PARSE_PARSE);
}
return (NSS_STR_PARSE_PARSE);
}
return (NSS_STR_PARSE_ERANGE);
}
/*
* Remove newline that nis (yp_match) puts at the
* end of the entry it retrieves from the map.
*/
}
return (NSS_STR_PARSE_SUCCESS);
}
void
_setexecattr(void)
{
trace1(TR_setexecattr, 0);
trace1(TR_setexecattr, 0);
}
void
_endexecattr(void)
{
trace1(TR_endexecattr, 0);
trace1(TR_endexecattr, 0);
}
{
}
_getexecprof(char *name,
char *type,
char *id,
int search_flag,
char *buffer,
int buflen,
int *errnop)
{
int getby_flag;
char policy_buf[BUFSIZ];
#ifdef SI_SECPOLICY
#endif /* SI_SECPOLICY */
}
switch (getby_flag) {
case NSS_DBOP_EXECATTR_BYID:
&arg);
break;
case NSS_DBOP_EXECATTR_BYNAME:
{
char pbuf[NSS_BUFLEN_PROFATTR];
enum __nsw_parse_err pserr;
goto out;
do {
/*
* search the exec_attr entry only in the scope
* that we find the profile in.
* if conf = NULL, search in local files only,
* as we were not able to read nsswitch.conf.
*/
if (mutex_lock(&_nsw_exec_lock) != 0)
goto out;
: lookups->service_name;
if (pres == NSS_SUCCESS) {
&arg);
}
(void) mutex_unlock(&_nsw_exec_lock);
break;
}
break;
default:
break;
}
out:
/*
* If we can't find an entry for the current default policy
* fall back to the old "suser" policy. The nameservice is
* shared between different OS releases.
*/
goto retry_policy;
}
}
int
{
int status = 1;
else
status = 0;
} else {
else
status = 0;
}
return (status);
}
/*
* Converts id to a wildcard string. e.g.:
* For type = KV_ACTION: Dtfile;*;*;*;0 ---> *;*;*;*;*
*
* Returns NULL if id is already a wild-card.
*/
char *
{
char c_id = '/';
return (NULL);
/*
* id = \*
*/
return (NULL);
else if (*(++pchar) == KV_WILDCHAR)
/*
*/
return (pchar);
/*
*/
return (id);
}
return (NULL);
}
{
}
}
return (new_exec);
}
void
{
}
}
void
{
if (res == NSS_SUCCESS) {
}
} else {
}
}