/* * AIDE (Advanced Intrusion Detection Environment) * * Copyright (C) 2016, 2020-2022,2024,2025 Hannes von Haugwitz * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include "file.h" #include "rx_rule.h" #include "util.h" static int generate_restriction_string(rx_restriction_t r, char *str) { int n = 0; if (r.f_type == FT_NULL #ifdef HAVE_FSTYPE && r.fs_type == 0 #endif ) { const char *no_restriction_string = "(none)"; size_t length = strlen(no_restriction_string); if (str) { sprintf(&str[n], "%s", no_restriction_string); } n = length+1; } else { FT_TYPE f_types = r.f_type; unsigned int i = 0; while (f_types) { FT_TYPE t = (1U<