xref: /freebsd/sbin/ipf/libipf/load_url.c (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1 /*
2  * Copyright (C) 2012 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id: load_url.c,v 1.3.2.2 2012/07/22 08:04:24 darren_r Exp $
7  */
8 
9 #include "ipf.h"
10 
11 alist_t *
12 load_url(char *url)
13 {
14 	alist_t *hosts = NULL;
15 
16 	if (strncmp(url, "file://", 7) == 0) {
17 		/*
18 		 * file:///etc/passwd
19 		 *        ^------------s
20 		 */
21 		hosts = load_file(url);
22 
23 	} else if (*url == '/' || *url == '.') {
24 		hosts = load_file(url);
25 
26 	} else if (strncmp(url, "http://", 7) == 0) {
27 		hosts = load_http(url);
28 	}
29 
30 	return (hosts);
31 }
32