%{
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <acl_common.h>
#include <aclutils.h>
extern int yyinteractive;
%}
%union {
char *str;
int val;
struct acl_perm_type acl_perm;
}
%%
{
yyacl = $1;
return (0);
}
/* This seems illegal, but the old aclfromtext() allows it */
{
yyacl = $1;
return (0);
}
{
yyacl = $1;
return (0);
}
{
yycleanup();
return (EACL_MEM_ERROR);
}
}
$$ = yyacl;
"Cannot have POSIX draft ACL entries"
yycleanup();
return (EACL_DIFF_TYPE);
}
yycleanup();
return (EACL_MEM_ERROR);
}
$$->acl_cnt++;
yycleanup();
}
| aclent
{
yycleanup();
return (EACL_MEM_ERROR);
}
}
$$ = yyacl;
" with POSIX draft ACL entries.\n"));
yycleanup();
return (EACL_DIFF_TYPE);
}
yycleanup();
return (EACL_MEM_ERROR);
}
$$->acl_cnt++;
yycleanup();
}
{
int error;
int mask;
if (error) {
yycleanup();
return (EACL_INVALID_USER_GROUP);
}
if (error) {
yycleanup();
return (error);
}
$$.a_type = $4;
}
{
int error;
if (yyinteractive) {
"Extra fields on the end of "
"ACL specification.\n"));
yycleanup();
return (EACL_UNKNOWN_DATA);
}
if (error) {
} else {
}
if (error) {
yycleanup();
return (error);
}
$$.a_type = $4;
}
{
int error;
if (error) {
yycleanup();
return (EACL_INVALID_USER_GROUP);
}
if (error) {
yycleanup();
return (error);
}
$$.a_type = $5;
$$.a_flags |= $4;
}
{
int error;
if (yyinteractive) {
"Extra fields on the end of "
"ACL specification.\n"));
yycleanup();
return (EACL_UNKNOWN_DATA);
}
if (error) {
} else {
}
if (error) {
yycleanup();
return (error);
}
$$.a_type = $5;
$$.a_flags |= $4;
}
{
int error;
$$.a_who = -1;
if (error) {
yycleanup();
return (error);
}
$$.a_type = $3;
}
{
yycleanup();
if (yyinteractive) {
"Extra fields on the end of "
"ACL specification.\n"));
return (EACL_UNKNOWN_DATA);
}
return (EACL_ENTRY_ERROR);
}
{
int error;
$$.a_who = -1;
if (error) {
yycleanup();
return (error);
}
$$.a_type = $4;
$$.a_flags |= $3;
}
{
yycleanup();
if (yyinteractive) {
"Extra fields on the end of "
"ACL specification.\n"));
return (EACL_UNKNOWN_DATA);
}
return (EACL_ENTRY_ERROR);
}
{
int error;
if (error) {
yycleanup();
return (EACL_INVALID_USER_GROUP);
}
if (error) {
"Invalid permission(s) '%s' specified.\n"),
$3.perm_str);
yycleanup();
return (error);
}
if (error) {
"Invalid ACL entry type '%s' specified.\n"), $1);
yycleanup();
return (error);
}
}
{
int error;
if (error) {
"Invalid permission(s) '%s' specified.\n"),
$3.perm_str);
yycleanup();
return (error);
}
$$.a_id = -1;
if (error) {
"Invalid ACL entry type '%s' specified.\n"), $1);
yycleanup();
return (error);
}
}
{
yycleanup();
if (yyinteractive) {
"Extra fields on the end of ACL specification.\n"));
return (EACL_UNKNOWN_DATA);
}
return (EACL_ENTRY_ERROR);
}
{
int error;
if (yyinteractive) {
"Extra fields on the end of ACL specification.\n"));
yycleanup();
return (EACL_UNKNOWN_DATA);
}
if (error) {
"Invalid permission(s) '%s' specified.\n"),
$3.perm_str);
yycleanup();
return (error);
}
if (error) {
} else
if (error) {
"Invalid ACL entry type '%s' specified.\n"), $1);
yycleanup();
return (error);
}
}
{
int error;
if (error) {
"Invalid permission(s) '%s' specified.\n"),
$2.perm_str);
yycleanup();
return (error);
}
$$.a_id = -1;
if (error) {
"Invalid ACL entry type specified %d.\n"),
error);
yycleanup();
return (error);
}
}
{
yycleanup();
if (yyinteractive) {
"Extra fields on the end of ACL specification.\n"));
return (EACL_UNKNOWN_DATA);
}
return (EACL_ENTRY_ERROR);
}
| COLON {$$ = 0;}
{
int error;
if (error) {
"Invalid inheritance flags '%s' specified.\n"), $1);
yycleanup();
return (error);
}
$$ = iflags;
}
{
"Can't mix compact inherit flags with"
" verbose inheritance flags.\n"));
yycleanup();
return (EACL_INHERIT_ERROR);
}
{
"Can't mix verbose inherit flags with"
" compact inheritance flags.\n"));
yycleanup();
return (EACL_INHERIT_ERROR);
}
{
"Inheritance flags can't be mixed with access type.\n"));
yycleanup();
return (EACL_INHERIT_ERROR);
}
{
yycleanup();
return ($3);
}
{
$$.perm_style = PERM_TYPE_UNKNOWN;
$$.perm_str = $1;
$$.perm_val = 0;
}
{
"ACL entry permissions are incorrectly specified.\n"));
yycleanup();
return ($2);
}
| ERROR
{
yycleanup();
return ($1);
}
| SID {$$ = $1;}
| COLON
{
" should be a numeric value.\n"));
yycleanup();
return (EACL_UNKNOWN_DATA);
}
| ERROR
{
yycleanup();
return ($1);
}
| ERROR
{
yycleanup();
return ($1);
}
{
$$.perm_style = PERM_TYPE_ACE;
$$.perm_val |= $1;
}
{
$$.perm_style = PERM_TYPE_ACE;
}
{
"Can't mix verbose permissions with"
" compact permission.\n"));
yycleanup();
return (EACL_PERM_MASK_ERROR);
}
{
yycleanup();
return ($3);
}
| ERROR
{
yycleanup();
return ($1);
}
%%
static void
{
switch(toketype) {
case USER_TOK:
case DEFAULT_USER_TOK:
"Invalid user %s specified.\n"), str);
break;
case GROUP_TOK:
case DEFAULT_GROUP_TOK:
"Invalid group %s specified.\n"), str);
break;
case USER_SID_TOK:
"Invalid user SID %s specified.\n"), str);
break;
case GROUP_SID_TOK:
"Invalid group SID %s specified.\n"), str);
}
}