|
Open SCAP Library
|
00001 /* 00002 * Copyright 2010 Red Hat Inc., Durham, North Carolina. 00003 * All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * Authors: 00020 * "Daniel Kopecek" <dkopecek@redhat.com> 00021 */ 00022 #ifndef OVAL_FTS_H 00023 #define OVAL_FTS_H 00024 00025 #include <sexp.h> 00026 #if defined(__SVR4) && defined(__sun) 00027 #include "fts_sun.h" 00028 #else 00029 #include <fts.h> 00030 #endif 00031 #include <pcre.h> 00032 #include "fsdev.h" 00033 00034 #define ENT_GET_AREF(ent, dst, attr_name, mandatory) \ 00035 do { \ 00036 if (((dst) = probe_ent_getattrval(ent, attr_name)) == NULL) { \ 00037 if (mandatory) { \ 00038 _F("Attribute `%s' is missing!\n", attr_name); \ 00039 return (NULL); \ 00040 } \ 00041 } \ 00042 } while(0) 00043 00044 #define ENT_GET_STRVAL(ent, dst, dstlen, zerolen_exp) \ 00045 do { \ 00046 SEXP_t *___r; \ 00047 \ 00048 if ((___r = probe_ent_getval(ent)) == NULL) { \ 00049 _W("entity has no value!\n"); \ 00050 return (NULL); \ 00051 } else { \ 00052 if (!SEXP_stringp(___r)) { \ 00053 _F("invalid type\n"); \ 00054 SEXP_free(___r); \ 00055 return (NULL); \ 00056 } \ 00057 if (SEXP_string_length(___r) == 0) { \ 00058 SEXP_free(___r); \ 00059 zerolen_exp; \