Back to index

nagios-nrpe  2.13
acl.h
Go to the documentation of this file.
00001 /*-
00002  * acl.c - header file for acl.c
00003  * Copyright (c) 2011 Kaspersky Lab ZAO
00004  * Last Modified: 08-10-2011 by Konstantin Malov with Oleg Koreshkov's help 
00005  *
00006  * License: GPL
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021  */
00022 
00023 #ifndef ACL_H_INCLUDED
00024 #define ACL_H_INCLUDED 1
00025 
00026 #include <sys/types.h>
00027 #include <sys/socket.h>
00028 
00029 #include <netinet/in.h>
00030 #include <arpa/inet.h>
00031 
00032 #include <stdio.h>
00033 #include <stdlib.h>
00034 #include <string.h>
00035 #include <ctype.h>
00036 #include <netdb.h>
00037 #include <syslog.h>
00038 #include <stdarg.h>
00039 
00040 #define CHAR_TO_NUMBER(c)   ((c) - '0')
00041 
00042 struct ip_acl {
00043         struct in_addr  addr;
00044         struct in_addr  mask;
00045         struct ip_acl   *next;
00046 };
00047 
00048 struct dns_acl {
00049         char domain[255];
00050         struct dns_acl *next;
00051 };
00052 
00053 /* Poiters to head ACL structs */
00054 static struct ip_acl *ip_acl_head, *ip_acl_prev;
00055 static struct dns_acl *dns_acl_head, *dns_acl_prev;
00056 
00057 /* Functions */
00058 void parse_allowed_hosts(char *allowed_hosts);
00059 int add_ipv4_to_acl(char *ipv4);
00060 int add_domain_to_acl(char *domain);
00061 int is_an_allowed_host(struct in_addr);
00062 unsigned int prefix_from_mask(struct in_addr mask);
00063 void show_acl_lists(void);
00064 
00065 #endif /* ACL_H_INCLUDED */