/*
* 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
*/
/*
*/
#include <stdlib.h>
#include "files_common.h"
#include <time.h>
#include <exec_attr.h>
#include <strings.h>
#include <ctype.h>
#include <synch.h>
#include <unistd.h>
/*
* files/getexecattr.c -- "files" backend for nsswitch "exec_attr" database
*
* _execattr_files_read_line and _execattr_files_XY_all code based on
* nss_files_read_line and nss_files_XY_all respectively, from files_common.c
*/
/* externs from libnsl */
extern int _doexeclist(nss_XbyY_args_t *);
extern int _readbufline(char *, int, char *, int, int *);
extern char *_exec_wild_id(char *, const char *);
/*
* check_match: returns 1 if matching entry found, else returns 0.
*/
static int
{
int i;
/* No need to check attr field */
for (i = 0; i < 6; i++) {
keyp = exec_field[i];
if (keyp) {
/* compare field */
keyp++;
linep++;
}
return (0);
} else {
/* skip field */
linep++;
}
linep++;
}
return (1);
}
static nss_status_t
int getby_flag)
{
int parse_stat = 0;
int lastlen = 0;
int exec_fd = 0;
int f_size = 0;
char *first;
char *last;
return (NSS_UNAVAIL);
}
/*
* check the size and the time stamp on the file
*/
(void) _nss_files_endent(be, 0);
return (NSS_UNAVAIL);
}
/*
* file has been modified since we last read it
* or we never read it or memory allocation
* failed before.
* read it into the buffer with rw lock.
*/
(void) _nss_files_endent(be, 0);
return (NSS_UNAVAIL);
}
(void) _nss_files_endent(be, 0);
return (NSS_UNAVAIL);
}
(void) _nss_files_endent(be, 0);
return (NSS_UNAVAIL);
}
(void) _nss_files_endent(be, 0);
return (NSS_UNAVAIL);
}
/*
* verify that the file did not change after
* we read it.
*/
(void) _nss_files_endent(be, 0);
return (NSS_UNAVAIL);
}
(void) _nss_files_endent(be, 0);
return (NSS_UNAVAIL);
}
}
res = NSS_NOTFOUND;
/*CONSTCOND*/
while (1) {
int linelen = 0;
&lastlen);
if (linelen < 0) {
/* End of file */
break;
}
/*
* If the entry doesn't contain the filter string then
* it can't be the entry we want, so don't bother looking
* more closely at it.
*/
switch (getby_flag) {
case NSS_DBOP_EXECATTR_BYNAME:
continue;
break;
case NSS_DBOP_EXECATTR_BYID:
continue;
break;
continue;
break;
default:
break;
}
continue;
/*
* Get rid of white spaces, comments etc.
*/
/*
* Skip leading whitespace. Normally there isn't any,
* so it's not worth calling strspn().
*/
;
if (*first == '\0')
continue;
/*
* Found something non-blank on the line. Skip back
* over any trailing whitespace; since we know there's
* non-whitespace earlier in the line, checking for
* termination is easy.
*/
--last;
/* Check the entry */
continue;
/* Marshall the data */
if (parse_stat == NSS_STR_PARSE_SUCCESS) {
res = NSS_SUCCESS;
break;
} else if (_doexeclist(argp) == 0) {
res = NSS_UNAVAIL;
break;
}
} else if (parse_stat == NSS_STR_PARSE_ERANGE) {
break;
} /* else if (parse_stat == NSS_STR_PARSE_PARSE) don't care ! */
}
(void) _nss_files_endent(be, 0);
return (res);
}
/*
* If search for exact match for id failed, get_wild checks if we have
* a wild-card entry for that id.
*/
static nss_status_t
{
if (res == NSS_SUCCESS)
break;
}
if (old_id)
return (res);
}
static nss_status_t
{
return (res);
}
static nss_status_t
{
/*LINTED*/
if (res != NSS_SUCCESS)
return (res);
}
static nss_status_t
{
/*LINTED*/
if (res != NSS_SUCCESS)
return (res);
}
};
/*ARGSUSED*/
const char *dummy2,
const char *dummy3,
const char *dummy4,
const char *dummy5,
const char *dummy6,
const char *dummy7)
{
return (_nss_files_constr(execattr_ops,
sizeof (execattr_ops)/sizeof (execattr_ops[0]),
}