Compare commits

...
16 Commits
Author SHA1 Message Date
Mukund Sivaraman 4b64de4c31 Change wording in NEWS 2010-06-05 09:29:58 +05:30
Mukund Sivaraman 7fa544c3d8 Bump version in configure.ac 2010-06-02 10:40:23 +05:30
Mukund Sivaraman a5a3741291 Add BB#74 to NEWS 2010-06-02 10:39:56 +05:30
Mukund Sivaraman 784d458b82 [BB#74] Create log and pid files after we drop privs 2010-06-02 10:19:49 +05:30
Mukund Sivaraman 94edc4f4c5 Remove excessive code 2010-06-02 10:11:10 +05:30
Mukund Sivaraman be63d2ca19 Add BB#89 to NEWS 2010-06-02 05:05:30 +05:30
Mukund Sivaraman a905437242 Add NEWS for 1.8.2 2010-06-01 08:12:29 +05:30
John van der Kamp 3127e726d0 [BB#89] Don't recompile regular expressions
This is a modification of a patch originally written by
John van der Kamp <john@kirika.demon.nl> at
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=579427#12>

The modification was done by the committer.
2010-06-01 07:58:02 +05:30
Mukund Sivaraman 5bb184c54d Fix typo in manpage 2010-05-30 10:02:45 +05:30
Jordi Mallach 505ff803e9 [BB#83] Use output of id instead of $USER 2010-04-21 21:01:59 +05:30
Dmitry Semyonov d03e3a52e5 Fix crash in send_stored_logs() 2010-04-21 20:32:41 +05:30
Mukund Sivaraman fe9444d585 Fix compiler warning about dereferencing type-punned pointers
This is a backport of commit 19b9bff888
from the master branch.
2010-04-21 20:21:22 +05:30
Mukund Sivaraman b37135524d Revert "main: drop privileges right after reading the config"
This reverts commit 965664798c. It should
fix the issue in bug #87.
2010-04-21 20:09:20 +05:30
Mukund Sivaraman 7f053670c0 Just fix the support URLs
These should always point to the top-level Tinyproxy homepage.
2010-03-28 10:29:56 +05:30
Mukund Sivaraman b28e438cdf Revert "Update Tinyproxy website URLs"
This reverts commit e495bdf129.
2010-03-28 10:27:45 +05:30
Mukund Sivaraman e495bdf129 Update Tinyproxy website URLs 2010-03-27 08:19:53 +05:30
9 changed files with 109 additions and 54 deletions

No files matched your search

+26
View File
@@ -1,6 +1,32 @@
Tinyproxy NEWS Tinyproxy NEWS
============== ==============
Version 1.8.2
-------------
* Minor formatting changes and typo fixes were made.
Bugs resolved since version 1.8.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* BB#69: INET6 not available when configured to Listen and Bind in v4,
and vice versa
* BB#74: tinyproxy unable to reopen log files after receiving HUP
* BB#78: Warn if configuration results in an open proxy
* BB#82: https access not working
* BB#83: run_tests.sh relies on $USER
* BB#84: Unaligned access error on ia64 and alpha
* BB#87: Unable to listen on ports less than 1024 (regression in 1.8.1)
* BB#88: Crashes when reloading configuration
* BB#89: tinyproxy leaks memory over time
Contributors
~~~~~~~~~~~~
Dmitry Semyonov, John van der Kamp, Jordi Mallach, Michael Adam,
Mukund Sivaraman.
Version 1.8.1 Version 1.8.1
------------- -------------
+3 -3
View File
@@ -5,13 +5,13 @@ AC_PREREQ(2.54)
m4_define([tinyproxy_major_version], [1]) m4_define([tinyproxy_major_version], [1])
m4_define([tinyproxy_minor_version], [8]) m4_define([tinyproxy_minor_version], [8])
m4_define([tinyproxy_micro_version], [1]) m4_define([tinyproxy_micro_version], [2])
m4_define([tinyproxy_real_version], m4_define([tinyproxy_real_version],
[tinyproxy_major_version.tinyproxy_minor_version.tinyproxy_micro_version]) [tinyproxy_major_version.tinyproxy_minor_version.tinyproxy_micro_version])
m4_define([tinyproxy_version], [tinyproxy_real_version]) m4_define([tinyproxy_version], [tinyproxy_real_version])
# For overriding the version string. Comment out if not needed. # For overriding the version string. Comment out if not needed.
# m4_define([tinyproxy_version], [1.8.0]) # m4_define([tinyproxy_version], [1.8.2])
m4_define([tinyproxy_unstable], m4_define([tinyproxy_unstable],
m4_if(m4_eval(tinyproxy_minor_version % 2), [1], [yes], [no])) m4_if(m4_eval(tinyproxy_minor_version % 2), [1], [yes], [no]))
@@ -19,7 +19,7 @@ m4_define([tinyproxy_stable],
m4_if(m4_eval(tinyproxy_minor_version % 2), [0], [yes], [no])) m4_if(m4_eval(tinyproxy_minor_version % 2), [0], [yes], [no]))
AC_INIT([Tinyproxy], [tinyproxy_version], AC_INIT([Tinyproxy], [tinyproxy_version],
[https://www.banu.com/bugzilla/enter_bug.cgi?product=tinyproxy], [https://www.banu.com/tinyproxy/],
[tinyproxy]) [tinyproxy])
AC_CANONICAL_TARGET AC_CANONICAL_TARGET
+2 -2
View File
@@ -147,7 +147,7 @@ The possible keywords and their descriptions are as follows:
*No Upstream*:: *No Upstream*::
This option allows you to set up a set of rules for deciding This option allows you to set up a set of rules for deciding
whether an upstream a proxy server is to be used, based on the whether an upstream proxy server is to be used, based on the
host or domain of the site being accessed. The rules are stored host or domain of the site being accessed. The rules are stored
in the order encountered in the configuration file and the in the order encountered in the configuration file and the
LAST matching rule wins. There are three possible forms for LAST matching rule wins. There are three possible forms for
@@ -343,7 +343,7 @@ BUGS
---- ----
To report bugs in Tinyproxy, please visit To report bugs in Tinyproxy, please visit
<https://www.banu.com/tinyproxy/support/[https://www.banu.com/tinyproxy/support/]>. <https://www.banu.com/tinyproxy/[https://www.banu.com/tinyproxy/]>.
SEE ALSO SEE ALSO
+1 -1
View File
@@ -136,7 +136,7 @@ BUGS
---- ----
To report bugs in Tinyproxy, please visit To report bugs in Tinyproxy, please visit
<https://www.banu.com/tinyproxy/support/[https://www.banu.com/tinyproxy/support/]>. <https://www.banu.com/tinyproxy/[https://www.banu.com/tinyproxy/]>.
SEE ALSO SEE ALSO
+42 -17
View File
@@ -163,6 +163,8 @@ static HANDLE_FUNC (handle_upstream);
static HANDLE_FUNC (handle_upstream_no); static HANDLE_FUNC (handle_upstream_no);
#endif #endif
static void config_free_regex (void);
/* /*
* This macro can be used to make standard directives in the form: * This macro can be used to make standard directives in the form:
* directive arguments [arguments ...] * directive arguments [arguments ...]
@@ -317,7 +319,8 @@ static void free_config (struct config_s *conf)
* *
* Returns 0 on success; negative upon failure. * Returns 0 on success; negative upon failure.
*/ */
static int config_compile (void) int
config_compile_regex (void)
{ {
unsigned int i, r; unsigned int i, r;
@@ -335,9 +338,30 @@ static int config_compile (void)
if (r) if (r)
return r; return r;
} }
atexit (config_free_regex);
return 0; return 0;
} }
/*
* Frees pre-compiled regular expressions used by the configuration
* file. This function is registered to be automatically called at exit.
*/
static void
config_free_regex (void)
{
unsigned int i;
for (i = 0; i < ndirectives; i++) {
if (directives[i].cre) {
regfree (directives[i].cre);
safefree (directives[i].cre);
directives[i].cre = NULL;
}
}
}
/* /*
* Attempt to match the supplied line with any of the configuration * Attempt to match the supplied line with any of the configuration
* regexes defined above. If a match is found, call the handler * regexes defined above. If a match is found, call the handler
@@ -397,7 +421,7 @@ static int load_config_file (const char *config_fname, struct config_s *conf)
goto done; goto done;
} }
if (config_compile () || config_parse (conf, config_file)) { if (config_parse (conf, config_file)) {
fprintf (stderr, "Unable to parse config file. " fprintf (stderr, "Unable to parse config file. "
"Not starting.\n"); "Not starting.\n");
goto done; goto done;
@@ -617,8 +641,8 @@ set_bool_arg (unsigned int *var, const char *line, regmatch_t * match)
return 0; return 0;
} }
static unsigned long int static unsigned long
get_int_arg (const char *line, regmatch_t * match) get_long_arg (const char *line, regmatch_t * match)
{ {
assert (line); assert (line);
assert (match && match->rm_so != -1); assert (match && match->rm_so != -1);
@@ -627,13 +651,13 @@ get_int_arg (const char *line, regmatch_t * match)
} }
static int static int
set_int_arg (unsigned long int *var, const char *line, regmatch_t * match) set_int_arg (unsigned int *var, const char *line, regmatch_t * match)
{ {
assert (var); assert (var);
assert (line); assert (line);
assert (match); assert (match);
*var = get_int_arg (line, match); *var = (unsigned int) get_long_arg (line, match);
return 0; return 0;
} }
@@ -755,49 +779,50 @@ static HANDLE_FUNC (handle_bindsame)
static HANDLE_FUNC (handle_port) static HANDLE_FUNC (handle_port)
{ {
return set_int_arg ((unsigned long int *) &conf->port, line, &match[2]); return set_int_arg (&conf->port, line, &match[2]);
} }
static HANDLE_FUNC (handle_maxclients) static HANDLE_FUNC (handle_maxclients)
{ {
child_configure (CHILD_MAXCLIENTS, get_int_arg (line, &match[2])); child_configure (CHILD_MAXCLIENTS, get_long_arg (line, &match[2]));
return 0; return 0;
} }
static HANDLE_FUNC (handle_maxspareservers) static HANDLE_FUNC (handle_maxspareservers)
{ {
child_configure (CHILD_MAXSPARESERVERS, get_int_arg (line, &match[2])); child_configure (CHILD_MAXSPARESERVERS,
get_long_arg (line, &match[2]));
return 0; return 0;
} }
static HANDLE_FUNC (handle_minspareservers) static HANDLE_FUNC (handle_minspareservers)
{ {
child_configure (CHILD_MINSPARESERVERS, get_int_arg (line, &match[2])); child_configure (CHILD_MINSPARESERVERS,
get_long_arg (line, &match[2]));
return 0; return 0;
} }
static HANDLE_FUNC (handle_startservers) static HANDLE_FUNC (handle_startservers)
{ {
child_configure (CHILD_STARTSERVERS, get_int_arg (line, &match[2])); child_configure (CHILD_STARTSERVERS, get_long_arg (line, &match[2]));
return 0; return 0;
} }
static HANDLE_FUNC (handle_maxrequestsperchild) static HANDLE_FUNC (handle_maxrequestsperchild)
{ {
child_configure (CHILD_MAXREQUESTSPERCHILD, child_configure (CHILD_MAXREQUESTSPERCHILD,
get_int_arg (line, &match[2])); get_long_arg (line, &match[2]));
return 0; return 0;
} }
static HANDLE_FUNC (handle_timeout) static HANDLE_FUNC (handle_timeout)
{ {
return set_int_arg ((unsigned long int *) &conf->idletimeout, line, return set_int_arg (&conf->idletimeout, line, &match[2]);
&match[2]);
} }
static HANDLE_FUNC (handle_connectport) static HANDLE_FUNC (handle_connectport)
{ {
add_connect_port_allowed (get_int_arg (line, &match[2]), add_connect_port_allowed (get_long_arg (line, &match[2]),
&conf->connect_ports); &conf->connect_ports);
return 0; return 0;
} }
@@ -866,7 +891,7 @@ static HANDLE_FUNC (handle_errorfile)
* present. This is why the "string" is located at * present. This is why the "string" is located at
* match[4] (rather than the more intuitive match[3]. * match[4] (rather than the more intuitive match[3].
*/ */
unsigned long int err = get_int_arg (line, &match[2]); unsigned long int err = get_long_arg (line, &match[2]);
char *page = get_string_arg (line, &match[4]); char *page = get_string_arg (line, &match[4]);
add_new_errorpage (page, err); add_new_errorpage (page, err);
@@ -1019,7 +1044,7 @@ static HANDLE_FUNC (handle_upstream)
ip = get_string_arg (line, &match[2]); ip = get_string_arg (line, &match[2]);
if (!ip) if (!ip)
return -1; return -1;
port = (int) get_int_arg (line, &match[7]); port = (int) get_long_arg (line, &match[7]);
if (match[9].rm_so != -1) { if (match[9].rm_so != -1) {
domain = get_string_arg (line, &match[9]); domain = get_string_arg (line, &match[9]);
+3 -1
View File
@@ -40,7 +40,7 @@ struct config_s {
char *logf_name; char *logf_name;
char *config_file; char *config_file;
unsigned int syslog; /* boolean */ unsigned int syslog; /* boolean */
int port; unsigned int port;
char *stathost; char *stathost;
unsigned int godaemon; /* boolean */ unsigned int godaemon; /* boolean */
unsigned int quit; /* boolean */ unsigned int quit; /* boolean */
@@ -115,4 +115,6 @@ struct config_s {
extern int reload_config_file (const char *config_fname, struct config_s *conf, extern int reload_config_file (const char *config_fname, struct config_s *conf,
struct config_s *defaults); struct config_s *defaults);
int config_compile_regex (void);
#endif #endif
+3 -2
View File
@@ -206,11 +206,12 @@ void send_stored_logs (void)
{ {
char *string; char *string;
char *ptr; char *ptr;
int level; int level;
size_t i; size_t i;
if (log_message_storage == NULL)
return;
log_message(LOG_DEBUG, "sending stored logs"); log_message(LOG_DEBUG, "sending stored logs");
for (i = 0; (ssize_t) i != vector_length (log_message_storage); ++i) { for (i = 0; (ssize_t) i != vector_length (log_message_storage); ++i) {
+28 -27
View File
@@ -172,7 +172,7 @@ display_usage (void)
printf ("\n" printf ("\n"
"For bug reporting instructions, please see:\n" "For bug reporting instructions, please see:\n"
"<https://www.banu.com/tinyproxy/support/>.\n"); "<https://www.banu.com/tinyproxy/>.\n");
} }
static int static int
@@ -355,8 +355,6 @@ done:
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
int ret;
/* Only allow u+rw bits. This may be required for some versions /* Only allow u+rw bits. This may be required for some versions
* of glibc so that mkstemp() doesn't make us vulnerable. * of glibc so that mkstemp() doesn't make us vulnerable.
*/ */
@@ -364,26 +362,16 @@ main (int argc, char **argv)
log_message (LOG_INFO, "Initializing " PACKAGE " ..."); log_message (LOG_INFO, "Initializing " PACKAGE " ...");
initialize_config_defaults (&config_defaults); if (config_compile_regex()) {
process_cmdline (argc, argv, &config_defaults);
ret = reload_config_file (config_defaults.config_file,
&config,
&config_defaults);
if (ret != 0) {
exit (EX_SOFTWARE); exit (EX_SOFTWARE);
} }
/* Switch to a different user if we're running as root */ initialize_config_defaults (&config_defaults);
if (geteuid () == 0) { process_cmdline (argc, argv, &config_defaults);
change_user (argv[0]);
} else {
log_message (LOG_WARNING,
"Not running as root, so not changing UID/GID.");
}
ret = setup_logging (); if (reload_config_file (config_defaults.config_file,
if (ret != 0) { &config,
&config_defaults)) {
exit (EX_SOFTWARE); exit (EX_SOFTWARE);
} }
@@ -401,14 +389,6 @@ main (int argc, char **argv)
if (config.godaemon == TRUE) if (config.godaemon == TRUE)
makedaemon (); makedaemon ();
if (config.pidpath) {
if (pidfile_create (config.pidpath) < 0) {
fprintf (stderr, "%s: Could not create PID file.\n",
argv[0]);
exit (EX_OSERR);
}
}
if (set_signal_handler (SIGPIPE, SIG_IGN) == SIG_ERR) { if (set_signal_handler (SIGPIPE, SIG_IGN) == SIG_ERR) {
fprintf (stderr, "%s: Could not set the \"SIGPIPE\" signal.\n", fprintf (stderr, "%s: Could not set the \"SIGPIPE\" signal.\n",
argv[0]); argv[0]);
@@ -427,6 +407,27 @@ main (int argc, char **argv)
exit (EX_OSERR); exit (EX_OSERR);
} }
/* Switch to a different user if we're running as root */
if (geteuid () == 0)
change_user (argv[0]);
else
log_message (LOG_WARNING,
"Not running as root, so not changing UID/GID.");
/* Create log file after we drop privileges */
if (setup_logging ()) {
exit (EX_SOFTWARE);
}
/* Create pid file after we drop privileges */
if (config.pidpath) {
if (pidfile_create (config.pidpath) < 0) {
fprintf (stderr, "%s: Could not create PID file.\n",
argv[0]);
exit (EX_OSERR);
}
}
if (child_pool_create () < 0) { if (child_pool_create () < 0) {
fprintf (stderr, fprintf (stderr,
"%s: Could not create the pool of children.\n", "%s: Could not create the pool of children.\n",
+1 -1
View File
@@ -26,7 +26,7 @@ LOG_DIR=$TESTENV_DIR/var/log
TINYPROXY_IP=127.0.0.2 TINYPROXY_IP=127.0.0.2
TINYPROXY_PORT=12321 TINYPROXY_PORT=12321
TINYPROXY_USER=$USER TINYPROXY_USER=$(id -un)
TINYPROXY_PID_DIR=$TESTENV_DIR/var/run/tinyproxy TINYPROXY_PID_DIR=$TESTENV_DIR/var/run/tinyproxy
TINYPROXY_PID_FILE=$TINYPROXY_PID_DIR/tinyproxy.pid TINYPROXY_PID_FILE=$TINYPROXY_PID_DIR/tinyproxy.pid
TINYPROXY_LOG_DIR=$LOG_DIR/tinyproxy TINYPROXY_LOG_DIR=$LOG_DIR/tinyproxy