1 /* $Id: urlcheck.h,v 1.15 2012/09/20 08:31:49 manu Exp $ */ 2 3 /* 4 * Copyright (c) 2006-2007 Emmanuel Dreyfus 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by Emmanuel Dreyfus 18 * 19 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 20 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 * OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 #include <curl/curl.h> 33 #include "prop.h" 34 35 struct urlcheck_cnx { 36 CURL *uc_hdl; 37 int uc_pipe_req[2]; 38 int uc_pipe_rep[2]; 39 pid_t uc_pid; 40 time_t uc_old; 41 pthread_mutex_t uc_lock; 42 }; 43 44 struct urlcheck_entry { 45 char u_name[QSTRLEN + 1]; 46 char u_url[QSTRLEN + 1]; 47 int u_maxcnx; 48 int u_flags; 49 struct urlcheck_cnx *u_cnxpool; 50 LIST_ENTRY(urlcheck_entry) u_list; 51 }; 52 53 /* For u_flags */ 54 #define U_POSTMSG 0x01 55 #define U_GETPROP 0x02 56 #define U_CLEARPROP 0x04 57 #define U_FORK 0x10 58 #define U_NOENCODE 0x20 59 60 #define URLCHECK_HELPER_TIMEOUT 60 61 62 extern int urlcheck_gflags; 63 64 struct urlcheck_entry *urlcheck_byname(char *); 65 void urlcheck_init(void); 66 void urlcheck_def_add(char *, char *, int, int); 67 void urlcheck_clear(void); 68 int urlcheck_validate(acl_data_t *, acl_stage_t, 69 struct acl_param *, struct mlfi_priv *); 70