diff -uNr ffproxy-1.4/ChangeLog ffproxy-1.4.1/ChangeLog --- ffproxy-1.4/ChangeLog Sun Jul 20 10:55:34 2003 +++ ffproxy-1.4.1/ChangeLog Fri Aug 1 20:09:11 2003 @@ -1,3 +1,19 @@ +Version 1.4.1 +============= + +* HTTP fix: savannah.gnu.org (and possibly + other hosts) does not understand + a Host: header with port number + correctly. + Now :80 is omitted, port number is only added + if needed. + +* implemented SYSCONFDIR and DATADIR, + default location for ffproxy's working directory + (db/ and html/ path) is now /var/ffproxy + default location of ffproxy.conf is now + /etc/ffproxy.conf + Version 1.4 =========== diff -uNr ffproxy-1.4/Makefile ffproxy-1.4.1/Makefile --- ffproxy-1.4/Makefile Sun Jul 20 09:57:57 2003 +++ ffproxy-1.4.1/Makefile Fri Aug 1 20:24:07 2003 @@ -2,18 +2,22 @@ # change the following lines to fit your needs # #CC = gcc -DDEBUG -#CFLAGS = -W -Wall -Werror -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wbad-function-cast -ansi -pedantic-errors -O2 +#OCFLAGS = -W -Wall -Werror -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wbad-function-cast -ansi -pedantic-errors -O2 # # remove the # in front of the next line if you're using linux -#CFLAGS = -DLINUX +#OCFLAGS = -DLINUX SRCS = main.c print.c socket.c request.c http.c alloc.c filter.c db.c file.c dns.c signals.c access.c regex.c msg.c poll.c cache.c time.c OBJS = $(SRCS:.c=.o) MANPAGES = ffproxy.8 -PREFIX = /usr/local -CC = gcc +PREFIX?=/usr/local +CC?=cc + +DATADIR?=/var/ffproxy +SYSCONFDIR?=/etc +CFLAGS = ${OCFLAGS} -DCFGFILE="\"${SYSCONFDIR}/ffproxy.conf\"" -DDATADIR="\"${DATADIR}\"" all: proxy diff -uNr ffproxy-1.4/README ffproxy-1.4.1/README --- ffproxy-1.4/README Sun Jul 20 11:30:52 2003 +++ ffproxy-1.4.1/README Fri Aug 1 20:40:21 2003 @@ -16,7 +16,7 @@ =========== * Edit Makefile to fit your needs. - (uncomment CFLAGS = -DLINUX if you're using Linux) + (uncomment OCFLAGS = -DLINUX if you're using Linux) * After making your changes, compile ffproxy with make. (see section `Bugs' at the very end of the file if ffproxy won't compile or crashes) @@ -45,12 +45,13 @@ ffproxy's basic settings (like the port to bind to) are determined at program invocation by means of command line options, or by means -of a config file and the command line option `-f'. +of a config file and the command line option `-f'. If no config +file is given, /etc/ffproxy.conf is used. See file config.sample for a configuration template. -Filtering settings are read from directory db/ (in our example above -that would be precisely /var/ffproxy/db/). +Filtering settings are read from directory db/ in /var/ffproxy +by default (use -D or db_files_path in config file to change). These files do the following: The following three files are for filtering User Agent Headers: diff -uNr ffproxy-1.4/db.c ffproxy-1.4.1/db.c --- ffproxy-1.4/db.c Sun Jul 20 11:25:05 2003 +++ ffproxy-1.4.1/db.c Fri Aug 1 20:41:50 2003 @@ -3,7 +3,7 @@ * * http://faith.eu.org * - * $Id: db.c,v 1.15 2003/07/20 10:38:23 niklas Exp $ + * $Id: db.c,v 1.1 2003/08/01 20:41:49 niklas Exp niklas $ * * 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 the Free diff -uNr ffproxy-1.4/ffproxy.8 ffproxy-1.4.1/ffproxy.8 --- ffproxy-1.4/ffproxy.8 Sun Jul 20 11:25:10 2003 +++ ffproxy-1.4.1/ffproxy.8 Fri Aug 1 20:42:00 2003 @@ -1,7 +1,8 @@ -.\" $Id: ffproxy.8,v 1.3 2003/07/20 10:58:31 niklas Exp $ +.\" $Id: ffproxy.8,v 1.42 2003/08/01 20:41:49 niklas Exp niklas $ .\" Copyright (c) 2002, 2003 Niklas Olmes +.\" See COPYING for license (GNU GPL) .\" http://faith.eu.org -.Dd July 20, 2003 +.Dd August 1, 2003 .Dt ffproxy 8 .Sh NAME .Nm ffproxy @@ -40,7 +41,9 @@ Please notice that there is an alternative to command line options by using the command line option -f to specify a user configuration file to load. See sample.conf for details and description. It may -contain options that are not available on command line. +contain options that are not available on command line. Default +location for config file is /etc/ffproxy.conf, default location +for ffproxy's working directory is /var/ffproxy. .Pp .Bl -tag -width "message" .It Fl p Ar port @@ -129,8 +132,8 @@ Every entry is exact one line. Comments are not allowed. The location of the db/ directory may be specified by an argument to the command line option -D. -If this option is not used, ffproxy will search for db/ -and html/ in the current directory. +If this option and config file option db_files_path are not used, +ffproxy will search for db/ and html/ in /var/ffproxy. .Sh THE HTML/ DIRECTORY This directory contains HTML files that are sent to the user's browser if either an error occured or @@ -148,7 +151,7 @@ .Pa ffproxy.pid to the working directory, that is, the directory specified by db_path or the command line parameter -D. -It defaults to the current directory. +It defaults to /var/ffproxy. .Sh LOGGING By default, ffproxy logs incorrect and filtered requests. Connection attempts from disallowed hosts get logged, @@ -163,6 +166,7 @@ .It startup options given either on the command line or read from configuration files +(/etc/ffproxy.conf is loaded by default) .It the files in db/ which specify filtering options and who is allowed to connect and use ffproxy @@ -171,7 +175,7 @@ If daemonized, ffproxy writes the pid of its master process to the file named .Pa ffproxy.pid -in its working directory. +in its working directory (/var/ffproxy by default). .Sh SEE ALSO .Pa README file for some configuration examples and general explanation @@ -179,6 +183,9 @@ .Pa sample.config for a sample configuration file .Pp +.Pa /etc/ffproxy.conf +for default configuration file +.Pp .Pa http://faith.eu.org/programs.html for latest version and patches .Pp @@ -188,7 +195,7 @@ .Xr chroot 2 , .Xr kill 1 .Sh VERSION -This manual documents ffproxy 1.4 (2003-07-20). +This manual documents ffproxy 1.4.1 (2003-08-01). .Sh BUGS Although contacting IPv6 servers is supported since version 1.4, binding and listening to IPv6 is not yet supported. diff -uNr ffproxy-1.4/main.c ffproxy-1.4.1/main.c --- ffproxy-1.4/main.c Sun Jul 20 11:25:05 2003 +++ ffproxy-1.4.1/main.c Fri Aug 1 20:22:01 2003 @@ -3,7 +3,7 @@ * * http://faith.eu.org * - * $Id: main.c,v 1.19 2003/07/20 10:54:37 niklas Exp $ + * $Id: main.c,v 1.41 2003/08/01 20:11:05 niklas Exp niklas $ * * 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 the Free @@ -39,8 +39,8 @@ static void usage(void); static void drop_privileges(void); -static const char version[] = "1.4"; -static const char rcsid[] = "$Id: main.c,v 1.19 2003/07/20 10:54:37 niklas Exp $"; +static const char version[] = "1.4.1"; +static const char rcsid[] = "$Id: main.c,v 1.41 2003/08/01 20:11:05 niklas Exp niklas $"; char loop_header[100]; struct cfg config; @@ -60,8 +60,10 @@ config.uid = 0; config.gid = 0; *config.chroot = '\0'; - *config.dbdir = '\0'; - *config.file = '\0'; + (void) strncpy(config.dbdir, DATADIR, sizeof(config.dbdir) - 1); + config.dbdir[sizeof(config.dbdir) - 1] = '\0'; + (void) strncpy(config.file, CFGFILE, sizeof(config.file) - 1); + config.file[sizeof(config.file) - 1] = '\0'; *config.proxyhost = '\0'; config.proxyport = 0; config.syslog = 1; @@ -186,8 +188,9 @@ " -u uid change uid\n" " -g gid change gid\n" " -r dir chroot to dir\n" - " -D dir databases are in dir\n" - " -f file use config file\n"); + " -D dir databases are in dir (default is %s)\n" + " -f file use config file (default is %s)\n", + DATADIR, CFGFILE); exit(1); } diff -uNr ffproxy-1.4/request.c ffproxy-1.4.1/request.c --- ffproxy-1.4/request.c Sun Jul 20 11:25:05 2003 +++ ffproxy-1.4.1/request.c Fri Aug 1 20:11:13 2003 @@ -3,7 +3,7 @@ * * http://faith.eu.org * - * $Id: request.c,v 1.21 2003/07/20 10:38:23 niklas Exp $ + * $Id: request.c,v 1.41 2003/08/01 20:11:05 niklas Exp niklas $ * * 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 the Free @@ -306,14 +306,24 @@ if (r->vmajor >= 1 && r->vminor >= 0) r->vmajor = 1, r->vminor = 0; - len = snprintf(buf, sizeof(buf), - "%s %s HTTP/%d.%d\r\n" - "Host: %s:%d\r\n", - ((r->type == GET) ? "GET" - : ((r->type) == HEAD) ? "HEAD" : "POST"), - (*config.proxyhost && config.proxyport) != '\0' ? r->url : r->urlpath, - r->vmajor, r->vminor, - r->host, r->port); + if (r->port == 80) + len = snprintf(buf, sizeof(buf), + "%s %s HTTP/%d.%d\r\n" + "Host: %s\r\n", + ((r->type == GET) ? "GET" + : ((r->type) == HEAD) ? "HEAD" : "POST"), + (*config.proxyhost && config.proxyport) != '\0' ? r->url : r->urlpath, + r->vmajor, r->vminor, + r->host); + else + len = snprintf(buf, sizeof(buf), + "%s %s HTTP/%d.%d\r\n" + "Host: %s:%d\r\n", + ((r->type == GET) ? "GET" + : ((r->type) == HEAD) ? "HEAD" : "POST"), + (*config.proxyhost && config.proxyport) != '\0' ? r->url : r->urlpath, + r->vmajor, r->vminor, + r->host, r->port); i = 0; while (r->header[i] != NULL) { diff -uNr ffproxy-1.4/sample.config ffproxy-1.4.1/sample.config --- ffproxy-1.4/sample.config Sun Jul 20 09:51:38 2003 +++ ffproxy-1.4.1/sample.config Fri Aug 1 20:40:50 2003 @@ -57,25 +57,13 @@ forward_proxy_ipv6 yes # path to db/ and html/ directories -# (default: current directory (./)) +# (default: /var/ffproxy) # (Note: if ffproxy runs chrooted, # give a path name relative to new root, or, # if db_files_path is the same as root, use db_files_path ./ # You have to start ffproxy in the new root directory, # otherwise it won't find the database files) -#db_files_path /var/ffproxy -db_files_path ./ - -# use cache? (default: no) -#use_cache yes -use_cache no - -# don't store files greater than cache_max_file_size in cache -# (unit is kb; default: 2 MB = 2048 kb) -cache_max_file_size 2048 - -# backlog size (listen(2), accept(2)) -# normally you don't need to set that -#backlog_size 4 +#db_files_path ./ +db_files_path /var/ffproxy # end of file diff -uNr ffproxy-1.4/socket.c ffproxy-1.4.1/socket.c --- ffproxy-1.4/socket.c Sun Jul 20 11:25:05 2003 +++ ffproxy-1.4.1/socket.c Fri Aug 1 20:11:15 2003 @@ -3,7 +3,7 @@ * * http://faith.eu.org * - * $Id: socket.c,v 1.10 2003/07/20 10:38:23 niklas Exp $ + * $Id: socket.c,v 1.41 2003/08/01 20:11:05 niklas Exp niklas $ * * 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 the Free @@ -30,6 +30,7 @@ #endif #include +#include #include #include "req.h"