xref: /freebsd/sbin/ipf/libipf/load_url.c (revision 44bc30192139b0b3c95510ab3b35802bcc6d63e4)
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 *
load_url(char * url)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