cfgfile.c (ziproxy-3.3.1) | : | cfgfile.c (ziproxy-3.3.2.tar.bz2) | ||
---|---|---|---|---|
/* cfgfile.c | /* cfgfile.c | |||
* Configuration file parsing functions. | * Configuration file parsing functions. | |||
* | * | |||
* Ziproxy - the HTTP acceleration proxy | * Ziproxy - the HTTP acceleration proxy | |||
* This code is under the following conditions: | * This code is under the following conditions: | |||
* | * | |||
* --------------------------------------------------------------------- | * --------------------------------------------------------------------- | |||
* Copyright (c)2005-2014 Daniel Mealha Cabrita | * Copyright (c)2005-2021 Daniel Mealha Cabrita | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
* | * | |||
* This program is distributed in the hope that it will be useful, | * This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
skipping to change at line 112 | skipping to change at line 112 | |||
char *URLReplaceData; | char *URLReplaceData; | |||
char *URLReplaceDataCT; | char *URLReplaceDataCT; | |||
char *URLDeny; | char *URLDeny; | |||
char *tmpBindOutgoingExList; | char *tmpBindOutgoingExList; | |||
char *tmpBindOutgoingExAddr; | char *tmpBindOutgoingExAddr; | |||
t_st_strtable *BindOutgoingExList; | t_st_strtable *BindOutgoingExList; | |||
in_addr_t *BindOutgoingExAddr; | in_addr_t *BindOutgoingExAddr; | |||
in_addr_t *BindOutgoing; | in_addr_t *BindOutgoing; | |||
int BindOutgoing_entries; | int BindOutgoing_entries; | |||
int TOSFlagsDefault; | int TOSFlagsDefault_cfg; | |||
int TOSFlagsDiff; | int TOSFlagsDiff_cfg; | |||
char *TOSMarkAsDiffURL; | char *TOSMarkAsDiffURL_cfg; | |||
char *TOSMarkAsDiffCT; | char *TOSMarkAsDiffCT; | |||
int TOSMarkAsDiffSizeBT; | int TOSMarkAsDiffSizeBT_cfg; | |||
int MaxActiveUserConnections; | int MaxActiveUserConnections; | |||
char *PIDFile; | char *PIDFile; | |||
char *cli_PIDFile; | char *cli_PIDFile; | |||
char *RunAsUser; | char *RunAsUser; | |||
char *cli_RunAsUser; | char *cli_RunAsUser; | |||
char *RunAsGroup; | char *RunAsGroup; | |||
char *cli_RunAsGroup; | char *cli_RunAsGroup; | |||
skipping to change at line 160 | skipping to change at line 160 | |||
#endif | #endif | |||
int LoadParmMatrix(int *destarray, t_qp_configfile *conf_handler, const char *co nf_key, const int *dvalues, const int min_entries, const int max_entries, const int min_value, const int max_value); | int LoadParmMatrix(int *destarray, t_qp_configfile *conf_handler, const char *co nf_key, const int *dvalues, const int min_entries, const int max_entries, const int min_value, const int max_value); | |||
const t_st_strtable *LoadParmMatrixStr(t_qp_configfile *conf_handler, const char *conf_key, const char **dvalues, int dvalues_len, const int min_entries, const int max_entries); | const t_st_strtable *LoadParmMatrixStr(t_qp_configfile *conf_handler, const char *conf_key, const char **dvalues, int dvalues_len, const int min_entries, const int max_entries); | |||
const t_ut_urltable *load_URLtable (const char *urltable_filename); | const t_ut_urltable *load_URLtable (const char *urltable_filename); | |||
const t_ct_cttable *LoadParmMatrixCT (t_qp_configfile *conf_handler, const char *conf_key, const char **dvalues, int dvalues_len, const int min_entries, const i nt max_entries, const int subtype_add_x_prefix); | const t_ct_cttable *LoadParmMatrixCT (t_qp_configfile *conf_handler, const char *conf_key, const char **dvalues, int dvalues_len, const int min_entries, const i nt max_entries, const int subtype_add_x_prefix); | |||
int check_int_ranges (const char *conf_key, const int inval, const int vlow, con st int vhigh); | int check_int_ranges (const char *conf_key, const int inval, const int vlow, con st int vhigh); | |||
int check_int_minimum (const char *conf_key, const int inval, const int vlow); | int check_int_minimum (const char *conf_key, const int inval, const int vlow); | |||
int check_directory (const char *conf_key, const char *dirname); | int check_directory (const char *conf_key, const char *dirname); | |||
const t_ut_urltable *tos_markasdiff_url; | const t_ut_urltable *tos_markasdiff_url_cfg; | |||
const t_ct_cttable *tos_maskasdiff_ct; | const t_ct_cttable *tos_maskasdiff_ct_cfg; | |||
const t_ut_urltable *urltable_noprocessing; | const t_ut_urltable *urltable_noprocessing; | |||
const t_ut_urltable *urltable_replacedata; | const t_ut_urltable *urltable_replacedata; | |||
const t_ut_urltable *urltable_replacedatact; | const t_ut_urltable *urltable_replacedatact; | |||
const t_ct_cttable *urltable_replacedatactlist; | const t_ct_cttable *urltable_replacedatactlist; | |||
const t_ut_urltable *urltable_deny; | const t_ut_urltable *urltable_deny; | |||
const t_ct_cttable *lossless_compress_ct; | const t_ct_cttable *lossless_compress_ct; | |||
/* dump parsing errors (if any) to stderr | /* dump parsing errors (if any) to stderr | |||
skipping to change at line 291 | skipping to change at line 291 | |||
URLReplaceData = NULL; | URLReplaceData = NULL; | |||
URLReplaceDataCT = NULL; | URLReplaceDataCT = NULL; | |||
URLReplaceDataCTListAlsoXST = QP_TRUE; | URLReplaceDataCTListAlsoXST = QP_TRUE; | |||
URLDeny = NULL; | URLDeny = NULL; | |||
urltable_noprocessing = NULL; | urltable_noprocessing = NULL; | |||
urltable_replacedata = NULL; | urltable_replacedata = NULL; | |||
urltable_replacedatact = NULL; | urltable_replacedatact = NULL; | |||
urltable_replacedatactlist = NULL; | urltable_replacedatactlist = NULL; | |||
InterceptCrashes = QP_FALSE; | InterceptCrashes = QP_FALSE; | |||
TOSMarking = QP_FALSE; | TOSMarking = QP_FALSE; | |||
TOSFlagsDefault = -1; | TOSFlagsDefault_cfg = -1; | |||
TOSFlagsDiff = -1; | TOSFlagsDiff_cfg = -1; | |||
TOSMarkAsDiffURL = NULL; | TOSMarkAsDiffURL_cfg = NULL; | |||
TOSMarkAsDiffSizeBT = -1; | TOSMarkAsDiffSizeBT_cfg = -1; | |||
tos_markasdiff_url = NULL; | tos_markasdiff_url_cfg = NULL; | |||
tos_maskasdiff_ct = NULL; | tos_maskasdiff_ct_cfg = NULL; | |||
TOSMarkAsDiffCTAlsoXST = QP_TRUE; | TOSMarkAsDiffCTAlsoXST = QP_TRUE; | |||
MaxActiveUserConnections = 0; | MaxActiveUserConnections = 0; | |||
PIDFile = cli_PIDFile; /* defaults to CLI parameter, if specifie d */ | PIDFile = cli_PIDFile; /* defaults to CLI parameter, if specifie d */ | |||
RunAsUser = cli_RunAsUser; /* defaults to CLI parameter, if specifie d */ | RunAsUser = cli_RunAsUser; /* defaults to CLI parameter, if specifie d */ | |||
RunAsGroup = cli_RunAsGroup; /* defaults to CLI parameter, if specifie d */ | RunAsGroup = cli_RunAsGroup; /* defaults to CLI parameter, if specifie d */ | |||
AuthMode = AUTH_NONE; | AuthMode = AUTH_NONE; | |||
AuthPasswdFile = NULL; | AuthPasswdFile = NULL; | |||
AlphaRemovalMinAvgOpacity = 1000000; | AlphaRemovalMinAvgOpacity = 1000000; | |||
#ifdef SASL | #ifdef SASL | |||
AuthSASLConfPath = NULL; | AuthSASLConfPath = NULL; | |||
skipping to change at line 394 | skipping to change at line 394 | |||
qp_getconf_str (conf_handler, "BindOutgoingExList", &tmpBindOutgoingExLis t, QP_FLAG_NONE); | qp_getconf_str (conf_handler, "BindOutgoingExList", &tmpBindOutgoingExLis t, QP_FLAG_NONE); | |||
qp_getconf_str (conf_handler, "URLNoProcessing", &URLNoProcessing, QP_FLA G_NONE); | qp_getconf_str (conf_handler, "URLNoProcessing", &URLNoProcessing, QP_FLA G_NONE); | |||
qp_getconf_str (conf_handler, "URLReplaceData", &URLReplaceData, QP_FLAG_ NONE); | qp_getconf_str (conf_handler, "URLReplaceData", &URLReplaceData, QP_FLAG_ NONE); | |||
qp_getconf_str (conf_handler, "URLReplaceDataCT", &URLReplaceDataCT, QP_F LAG_NONE); | qp_getconf_str (conf_handler, "URLReplaceDataCT", &URLReplaceDataCT, QP_F LAG_NONE); | |||
qp_getconf_array_str (conf_handler, "URLReplaceDataCTList", 0, NULL, QP_F LAG_NONE); | qp_getconf_array_str (conf_handler, "URLReplaceDataCTList", 0, NULL, QP_F LAG_NONE); | |||
qp_getconf_bool (conf_handler, "URLReplaceDataCTListAlsoXST", &URLReplace DataCTListAlsoXST, QP_FLAG_NONE); | qp_getconf_bool (conf_handler, "URLReplaceDataCTListAlsoXST", &URLReplace DataCTListAlsoXST, QP_FLAG_NONE); | |||
qp_getconf_str (conf_handler, "URLDeny", &URLDeny, QP_FLAG_NONE); | qp_getconf_str (conf_handler, "URLDeny", &URLDeny, QP_FLAG_NONE); | |||
qp_getconf_array_int (conf_handler, "RestrictOutPortHTTP", 0, NULL, QP_FL AG_NONE); | qp_getconf_array_int (conf_handler, "RestrictOutPortHTTP", 0, NULL, QP_FL AG_NONE); | |||
qp_getconf_array_int (conf_handler, "RestrictOutPortCONNECT", 0, NULL, QP _FLAG_NONE); | qp_getconf_array_int (conf_handler, "RestrictOutPortCONNECT", 0, NULL, QP _FLAG_NONE); | |||
qp_getconf_bool (conf_handler, "TOSMarking", &TOSMarking, QP_FLAG_NONE); | qp_getconf_bool (conf_handler, "TOSMarking", &TOSMarking, QP_FLAG_NONE); | |||
qp_getconf_int (conf_handler, "TOSFlagsDefault", &TOSFlagsDefault, QP_FLA | qp_getconf_int (conf_handler, "TOSFlagsDefault", &TOSFlagsDefault_cfg, QP | |||
G_NONE); | _FLAG_NONE); | |||
qp_getconf_int (conf_handler, "TOSFlagsDiff", &TOSFlagsDiff, QP_FLAG_NONE | qp_getconf_int (conf_handler, "TOSFlagsDiff", &TOSFlagsDiff_cfg, QP_FLAG_ | |||
); | NONE); | |||
qp_getconf_str (conf_handler, "TOSMarkAsDiffURL", &TOSMarkAsDiffURL, QP_F | qp_getconf_str (conf_handler, "TOSMarkAsDiffURL", &TOSMarkAsDiffURL_cfg, | |||
LAG_NONE); | QP_FLAG_NONE); | |||
qp_getconf_array_str (conf_handler, "TOSMarkAsDiffCT", 0, NULL, QP_FLAG_N ONE); | qp_getconf_array_str (conf_handler, "TOSMarkAsDiffCT", 0, NULL, QP_FLAG_N ONE); | |||
qp_getconf_bool (conf_handler, "TOSMarkAsDiffCTAlsoXST", &TOSMarkAsDiffCT AlsoXST, QP_FLAG_NONE); | qp_getconf_bool (conf_handler, "TOSMarkAsDiffCTAlsoXST", &TOSMarkAsDiffCT AlsoXST, QP_FLAG_NONE); | |||
qp_getconf_int (conf_handler, "TOSMarkAsDiffSizeBT", &TOSMarkAsDiffSizeBT , QP_FLAG_NONE); | qp_getconf_int (conf_handler, "TOSMarkAsDiffSizeBT", &TOSMarkAsDiffSizeBT _cfg, QP_FLAG_NONE); | |||
qp_getconf_int (conf_handler, "MaxActiveUserConnections", &MaxActiveUserC onnections, QP_FLAG_NONE); | qp_getconf_int (conf_handler, "MaxActiveUserConnections", &MaxActiveUserC onnections, QP_FLAG_NONE); | |||
qp_getconf_str (conf_handler, "PIDFile", &PIDFile, QP_FLAG_NONE); | qp_getconf_str (conf_handler, "PIDFile", &PIDFile, QP_FLAG_NONE); | |||
qp_getconf_str (conf_handler, "RunAsUser", &RunAsUser, QP_FLAG_NONE); | qp_getconf_str (conf_handler, "RunAsUser", &RunAsUser, QP_FLAG_NONE); | |||
qp_getconf_str (conf_handler, "RunAsGroup", &RunAsGroup, QP_FLAG_NONE); | qp_getconf_str (conf_handler, "RunAsGroup", &RunAsGroup, QP_FLAG_NONE); | |||
qp_getconf_int (conf_handler, "AuthMode", &AuthMode, QP_FLAG_NONE); | qp_getconf_int (conf_handler, "AuthMode", &AuthMode, QP_FLAG_NONE); | |||
qp_getconf_str (conf_handler, "AuthPasswdFile", &AuthPasswdFile, QP_FLAG_ NONE); | qp_getconf_str (conf_handler, "AuthPasswdFile", &AuthPasswdFile, QP_FLAG_ NONE); | |||
#ifdef SASL | #ifdef SASL | |||
qp_getconf_str (conf_handler, "AuthSASLConfPath", &AuthSASLConfPath, QP_F LAG_NONE); | qp_getconf_str (conf_handler, "AuthSASLConfPath", &AuthSASLConfPath, QP_F LAG_NONE); | |||
#else | #else | |||
qp_set_parameter_status (conf_handler, QP_PARM_STATUS_NOT_SUPPORTED, "Aut hSASLConfPath"); /* no SASL support */ | qp_set_parameter_status (conf_handler, QP_PARM_STATUS_NOT_SUPPORTED, "Aut hSASLConfPath"); /* no SASL support */ | |||
skipping to change at line 602 | skipping to change at line 602 | |||
} | } | |||
#else | #else | |||
error_log_puts (LOGMT_FATALERROR, LOGSS_CONFIG, | error_log_puts (LOGMT_FATALERROR, LOGSS_CONFIG, | |||
"Specified AuthMode requires SASL, which is not supported ."); | "Specified AuthMode requires SASL, which is not supported ."); | |||
return (1); | return (1); | |||
#endif | #endif | |||
} | } | |||
auth_set_mode (AuthMode); | auth_set_mode (AuthMode); | |||
if (TOSMarkAsDiffURL != NULL) { | if (TOSMarkAsDiffURL_cfg != NULL) { | |||
if((tos_markasdiff_url = load_URLtable (TOSMarkAsDiffURL)) == NUL | if((tos_markasdiff_url_cfg = load_URLtable (TOSMarkAsDiffURL_cfg) | |||
L) | ) == NULL) | |||
return (1); | return (1); | |||
} | } | |||
/* TODO: make the 'x-' preffix addition optional (see last parameter of L oadParmMatrixCT() | /* TODO: make the 'x-' preffix addition optional (see last parameter of L oadParmMatrixCT() | |||
it is currently hardcoded to ENABLED */ | it is currently hardcoded to ENABLED */ | |||
if (qp_get_array_size (conf_handler, "TOSMarkAsDiffCT") > 0) | if (qp_get_array_size (conf_handler, "TOSMarkAsDiffCT") > 0) | |||
tos_maskasdiff_ct = LoadParmMatrixCT (conf_handler, "TOSMarkAsDif fCT", NULL, 0, 1, -1, TOSMarkAsDiffCTAlsoXST); | tos_maskasdiff_ct_cfg = LoadParmMatrixCT (conf_handler, "TOSMarkA sDiffCT", NULL, 0, 1, -1, TOSMarkAsDiffCTAlsoXST); | |||
if (check_int_ranges ("TOSFlagsDefault", TOSFlagsDefault, -1, 255)) | if (check_int_ranges ("TOSFlagsDefault", TOSFlagsDefault_cfg, -1, 255)) | |||
return (1); | return (1); | |||
if (check_int_ranges ("TOSFlagsDiff", TOSFlagsDiff, -1, 255)) | if (check_int_ranges ("TOSFlagsDiff", TOSFlagsDiff_cfg, -1, 255)) | |||
return (1); | return (1); | |||
if (check_int_minimum ("TOSMarkAsDiffSizeBT", TOSMarkAsDiffSizeBT, -1)) | if (check_int_minimum ("TOSMarkAsDiffSizeBT", TOSMarkAsDiffSizeBT_cfg, -1 )) | |||
return (1); | return (1); | |||
if (check_int_minimum ("MaxActiveUserConnections", MaxActiveUserConnectio ns, 0)) | if (check_int_minimum ("MaxActiveUserConnections", MaxActiveUserConnectio ns, 0)) | |||
return (1); | return (1); | |||
if (check_int_ranges ("AlphaRemovalMinAvgOpacity", AlphaRemovalMinAvgOpac ity, 0, 1000000)) | if (check_int_ranges ("AlphaRemovalMinAvgOpacity", AlphaRemovalMinAvgOpac ity, 0, 1000000)) | |||
return (1); | return (1); | |||
n = qp_get_array_size (conf_handler, "BindOutgoing"); | n = qp_get_array_size (conf_handler, "BindOutgoing"); | |||
if(n){ | if(n){ | |||
End of changes. 12 change blocks. | ||||
27 lines changed or deleted | 27 lines changed or added |