4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  * Copyright 2012 Milan Jurik. All rights reserved.
  25  */
  26 
  27 
  28 /*
  29  * Token processing for auditreduce.
  30  */
  31 
  32 #include <locale.h>
  33 #include <sys/zone.h>
  34 #include "auditr.h"
  35 #include "toktable.h"
  36 
  37 extern int      re_exec2(char *);
  38 
  39 static void     anchor_path(char *path);
  40 static char     *collapse_path(char *s);
  41 static void     get_string(adr_t *adr, char **p);
  42 static int      ipc_type_match(int flag, char type);
  43 static void     skip_string(adr_t *adr);
  44 static int      xgeneric(adr_t *adr);
 
 
1997 
1998         return (-1);
1999 }
2000 
2001 
2002 /*
2003  * Format of useofpriv token:
2004  *      success/failure         adr_char
2005  *      privilege(s)            adr_string
2006  */
2007 /* ARGSUSED */
2008 int
2009 useofpriv_token(adr_t *adr)
2010 {
2011         char    flag;
2012 
2013         adrm_char(adr, &flag, 1);
2014         skip_string(adr);
2015         return (-1);
2016 }
 | 
 
 
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  *
  25  * Copyright 2012 Milan Jurik. All rights reserved.
  26  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  27  */
  28 
  29 
  30 /*
  31  * Token processing for auditreduce.
  32  */
  33 
  34 #include <locale.h>
  35 #include <sys/zone.h>
  36 #include "auditr.h"
  37 #include "toktable.h"
  38 
  39 extern int      re_exec2(char *);
  40 
  41 static void     anchor_path(char *path);
  42 static char     *collapse_path(char *s);
  43 static void     get_string(adr_t *adr, char **p);
  44 static int      ipc_type_match(int flag, char type);
  45 static void     skip_string(adr_t *adr);
  46 static int      xgeneric(adr_t *adr);
 
 
1999 
2000         return (-1);
2001 }
2002 
2003 
2004 /*
2005  * Format of useofpriv token:
2006  *      success/failure         adr_char
2007  *      privilege(s)            adr_string
2008  */
2009 /* ARGSUSED */
2010 int
2011 useofpriv_token(adr_t *adr)
2012 {
2013         char    flag;
2014 
2015         adrm_char(adr, &flag, 1);
2016         skip_string(adr);
2017         return (-1);
2018 }
2019 
2020 /*
2021  * Format of access_mask token:
2022  *      access_mask             adr_u_int32
2023  */
2024 int
2025 access_mask_token(adr_t *adr)
2026 {
2027         uint32_t access;
2028 
2029         adrm_u_int32(adr, &access, 1);
2030         return (-1);
2031 }
2032 
2033 /*
2034  * Format of wsid token:
2035  *      wsid                    adr_string
2036  */
2037 int
2038 wsid_token(adr_t *adr)
2039 {
2040         if ((flags & M_OBJECT) != 0 && (obj_flag == OBJ_WSID)) {
2041                 char *sid;
2042 
2043                 get_string(adr, &sid);
2044                 if (strncmp(wsid, sid, 256) == 0) /* SMB_SID_STRSZ */
2045                         checkflags |= M_OBJECT;
2046                 free(sid);
2047         } else {
2048                 skip_string(adr);
2049         }
2050         return (-1);
2051 }
 |