File sarg.spec of Package sarg

#
# spec file for package sarg (Version 2.2.5)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           sarg
Summary:        Squid Analysis Report Generator
Version:        2.2.5
Release:        46
License:        GPL v2 or later
Url:            http://sarg.sourceforge.net/sarg.php
Group:          Productivity/Networking/Web/Utilities
%if 0%{?suse_version} >= 1010
Recommends:     http_proxy cron
%endif
AutoReqProv:    on
PreReq:         %fillup_prereq
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source0:        http://web.onda.com.br/orso/%{name}-%{version}.tar.bz2
Source1:        sarg.conf
Source2:        http://www.initzero.it/products/opensource/sarg-reports/download/sarg-reports
Source3:        sarg.hosts
Source4:        sysconfig.sarg
Source5:        cron.daily.sarg
Source6:        cron.weekly.sarg
Source7:        cron.monthly.sarg
Source8:        sarg-reports.1.gz
# Patch0:       http://sarg.sourceforge.net/sarg-2.0.1-largeurl.patch.gz
Patch0:         sarg-2.2.3.1-config.patch
Patch1:         sarg-2.2.3.1-description.patch
Patch2:         sarg-2.2.5-getword_boundary_limit.patch
Patch3:         sarg-2.2.5-enlarge_report_buffers.patch
Patch4:         sarg-2.2.5-too_small_font_buffer.patch
Patch5:         sarg-2.2.5-enlarge_log_buffer.patch
Patch6:         sarg-2.2.5-limit_sprintf.patch
Patch7:         sarg-2.2.5-limit_useragent_sprintf.patch
Patch8:         sarg-2.2.5-year_assertion.patch

%description
Sarg -- Squid Analysis Report Generator is a tool that allows you to
view "where" your users are going to on the Internet. Sarg generate
reports in html, with fields such as: users, IP Addresses, bytes,
sites, and times.



Authors:
--------
    Alp <support@x5.net>
    Andreas Piesk <a.piesk@gmx.net>
    Andrew <andrew@extrim.ru>
    Andrew Barnes <a.barnes@kaldor.com.au>
    Carlos Canau <canau@ionia.EUnet.pt>
    Carlos Santillana <carlos@los-fresnos-cons.k12.tx.us>
    Csaba Kabai <ckabai@icnpharm.com>
    Dima I. Allaverdov <allav@ur.rags.ru>
    Eugeny Kuzakov <CoreDumped@CoreDumped.null.ru>
    Evren Yurtesen <yurtesen@ispro.net.tr>
    Hanni Daniel <daniel.haenni@softlab.ch>
    Ilya V. Komarov <mur@mur.lynx.ru>
    Jose Luiz <jluiz@projesom.com.br>
    Lee Shakespeare <lee@webfoundry.co.uk>
    Leonardo A. D'Angelo <ldangelo@san-cayetano.com>
    Manon Goo <manon@manon.de>
    Matteo Colombo <matteo@calcol.it>
    Maxim Berlin <mak@unesco.mitht.rssi.ru>
    Palamarchuk Eugen <eugen@cit.od.ukrtel.net>
    Patrick Darden <darden@server2.armc.org>
    Rick_Barzilli@xircom.com
    Ryan Roehrich <ryanscott@mindless.com>
    Steve Chan <Steve.Chan@lucasfilm.com>
    Tony Lorimes <alorimes@csc.com>
    Wayne Bastow <wbastow@ccahs.health.nsw.gov.au>
    drdivano@mail.axon.ru
    Seth Mos <stimpy@stimpy.multiweb.nl>
    Carlo Marcelo Arenas Belon <carenas@chasqui.lared.net.pe>
    Milos Prudek <prudek@nembv.cz>
    Pavel Jezek <Pavel.Jezek@i.cz>
    Kenneth Ingham <ingham@i-pi.com>
    Schlosser, Carsten ECOFIS <c.schlosser@ecofis.de>
    Andrew Katkov <askat@crimea.net>
    Andy Parfenov <andy@nursat.net>
    Bernd Kossmann <bko@shd.de>
    Ivan Minchev <vanko@uni-svishtov.bg>
    Olivier Rousselot <olivier.rousselot@ssti.fr>
    Akira Kitamura <click@anet.ne.jp>
    Radovan Drobnjakovic <admin.rts@rts.co.yu>
    Brad Guillory <proxyadm@baileylink.net>
    Andrew Okhmat <andy@crgu.com>
    Nikolai V. Ivanyushin <koko@infocenter.bryansk.ru>

%prep
%setup
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1

%build
%{?suse_update_config:%{suse_update_config -f cfgaux}}
CFLAGS="$RPM_OPT_FLAGS" \
./configure \
	--prefix=/usr \
	--enable-bindir=%{_bindir} \
	--enable-sysconfdir=%{_datadir}/%{name} \
	--enable-htmldir=/srv/www/htdocs \
	--enable-mandir=%{_mandir}/man1
make
# ---------------------------------------------------------------------------

%install
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
mkdir -p $RPM_BUILD_ROOT/%{_datadir}
mkdir -p $RPM_BUILD_ROOT/etc
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/
make \
	BINDIR=$RPM_BUILD_ROOT/%{_bindir} \
	SYSCONFDIR=$RPM_BUILD_ROOT/%{_datadir}/%{name} \
	MANDIR=$RPM_BUILD_ROOT/%{_mandir}/man1 \
	install
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/sarg.conf
ln -sf ../../../etc/sarg.conf $RPM_BUILD_ROOT/%{_datadir}/%{name}/sarg.conf 
chmod a-x CONTRIBUTORS COPYING ChangeLog DONATIONS LICENSE README
chmod a-x $RPM_BUILD_ROOT/%{_mandir}/man1/*
chmod a-x $RPM_BUILD_ROOT/%{_datadir}/%{name}/%{name}-php/locale/*/LC_MESSAGES/*
# might be temporary, please remove in next version:
rm $RPM_BUILD_ROOT/%{_datadir}/%{name}/languages/.new
mkdir -p $RPM_BUILD_ROOT/%{_sbindir}
install -m 755 %SOURCE2 $RPM_BUILD_ROOT/%{_sbindir}
install -m 644 %SOURCE3 $RPM_BUILD_ROOT/%{_datadir}/%{name}/sarg.hosts
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/var/adm/fillup-templates
mkdir -p $RPM_BUILD_ROOT/etc/cron.daily
install -m 755 %{SOURCE5} $RPM_BUILD_ROOT/etc/cron.daily/suse.de-sarg
mkdir -p $RPM_BUILD_ROOT/etc/cron.weekly
install -m 755 %{SOURCE6} $RPM_BUILD_ROOT/etc/cron.weekly/suse.de-sarg
mkdir -p $RPM_BUILD_ROOT/etc/cron.monthly
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/etc/cron.monthly/suse.de-sarg
install -d -m755 $RPM_BUILD_ROOT/%{_mandir}/man8
install -m644 %{SOURCE8} $RPM_BUILD_ROOT/%{_mandir}/man8
# ---------------------------------------------------------------------------

%clean
# Clear up the mess
[ "$RPM_BUILD_ROOT" != "" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;

%post
%{fillup_only -n sarg}

%files
%defattr(-, root, root)
%config(noreplace) /etc/sarg.conf
/etc/cron.*/suse.de-sarg
%{_bindir}/sarg
%{_sbindir}/sarg-reports
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/css.tpl
%{_datadir}/%{name}/fonts
%{_datadir}/%{name}/images
%{_datadir}/%{name}/sarg-php
%{_datadir}/%{name}/exclude_codes
%{_datadir}/%{name}/languages
%{_datadir}/%{name}/sarg.conf
%{_datadir}/%{name}/sarg.hosts
%{_datadir}/%{name}/user_limit_block
/var/adm/fillup-templates/sysconfig.sarg
%doc %{_mandir}/man1/%{name}*
%doc %{_mandir}/man8/%{name}-report*
%doc CONTRIBUTORS COPYING ChangeLog DONATIONS LICENSE README

%changelog
* Tue Feb 03 2009 kssingvo@suse.de
- purified specfile
- added manpage for sarg-report
- fixed wrong permissions of various files
* Tue Sep 09 2008 kssingvo@suse.de
- fix for buffer check assertion in make_index (bnc#416077)
* Thu Apr 24 2008 kssingvo@suse.de
- fix for buffer size in log.c: fun[]  CVE-2008-???
- fix for sprintf() calls through use of snprintf() calls CVE-2008-???
- fix for font buffer size CVE-2008-???
* Tue Apr 22 2008 kssingvo@suse.de
- getword3() needs also to be checked CVE-2008-1922 (bugzilla#382255)
* Mon Apr 21 2008 kssingvo@suse.de
- added suse_version check: old distributions don't support Recommends:
* Mon Apr 21 2008 kssingvo@suse.de
- fix for buffer size in report.c (bugzilla#209273)
- buffer checks for getword() introduced (bugzilla#209273)
* Tue Apr 08 2008 crrodriguez@suse.de
- Reccommend cron, otherwise it may not work properly.
* Thu Mar 06 2008 kssingvo@suse.de
- update to version 2.2.5:
  * new fix to the script insertion vulnerability via user-agent
  report. javascript can still be executed via e.g. the "<BODY
  onload=function();>" scheme.
* Mon Mar 03 2008 kssingvo@suse.de
- update to version 2.2.4:
  * a issue to be execute arbitrary code when sarg is used with
  malicious input files.
  * French language fixed.
  * Fixed: Segfault in x86_64
- removed static buffer fix in util.c, now in upstream
* Wed Dec 05 2007 kssingvo@suse.de
- added daily,weekly,monthly cronjobs for sarg reports
- added sarg-reports tool
- adapted configuration to SUSE paths
- fixed default config file
- fixed issue in util.c (bugzilla#342529)
- fixed wrong description (bugzilla#334146)
- http_proxy is no longer Requires:, using instead Recommends:
* Wed Jan 31 2007 kssingvo@suse.de
- upgrade to version 2.2.3.1:
  * fidex -m option to show all the used tags
  * date period invalid in download reports
  * wrong results when userid contain '%%20' character
  * previous reports info wrong in index.html
  * gd graph font change from FreeSans.ttf to DejaVuSans.ttf
  * minor fixes when only denied records in access.log file.
  * ulimit tag changed. If you run sarg with a low privilege user,
  set to 'none' to disable ulimit.
  * Russian_UTF-8 language fixed by Igor Ageikin
  <iageikin@lipen.elektra.ru>
  * realtime_unauthenticated_records tag changed to show by
  default.
  * chmod 755 in sarg-php due to errors in rpmbuild.
  * when the keyword "anonymous" is used in squidGuard.conf, Sarg
  does
  * when the keyword "anonymous" is used in squidGuard.conf, Sarg
  does not find the log-files anymore.
  * after reading the squidGuard configuration, the data read from
  the usertab file was corrupted.
  * milisec values showed as bytes.
  * with squidGuard, you can log groups in only one log file. We
  must parse each log files only one time.
  * error message(removetmp) Cannot open /tmp/sarg_tmp/../general
  when sending report by email.
  * incorrect off_t size in printf. In FreeBSD off_t is 64bit long
  long, but sarg always use %%d to display off_t in log
  processing. This cause garbage while reading log files on a
  freebsd, and possible crash.
  * squid24 on/off tag added in sarg.conf to implement
  compatibility if using squid <= 2.4 and using squid common
  logs.
  * exclude_hosts and some code errors fixed by Alexander Kozlov
  <avk@post.eao.ru>. Many thanks.
  * temporary file names changed to sarg-... to avoid conflicts
  with usernames.
  * SARG support Japanese wordset but not support charset. submited
  by anonymous at sourceforge.net  Many thanks.
  * support for utf-8 character set added by Peter Warasin
  <peter-endian@users.sourceforge.net>. Many thanks.
  * if all the data is at the hour each day, totaliza_day() treates
  it all as being on the last day. This is observed for users
  which only download via a cron job at the same time each day.
  Now the date and time will be checked to see if changed.
  * greport_day() doesn't add the volume for the first hour of each
  day to the total.
  * Russian_koi8 and Russian_windows1251 languages updated by Stas
  Degteff <stas.grumbler@gmail.com>. Many thanks
  * realtime reporting is sorted by URL, and not by Date/Time.
* Fri Nov 10 2006 kssingvo@suse.de
- fixed build issue with permission check of docs and manuals
* Tue Aug 29 2006 kssingvo@suse.de
- update to version 2.2.2
  * malloc test implemented to avoid high-memory consuming.
  Thanks to Rodrigo Rubira Branco <rodrigo@kernelhacking.com>
  * Czech UTF8 language added by Josef Karliak <karliak@ajetaci.cz>
  * fixed: parsed mismatch in realtime_access_log_lines and
  access_log_lines tags.
  Thanks to Kuznetsov Andrey <pm_kan@mail.ru>
  * changed: realtime report sort changed by date/time
  Thanks to Leonardo Buonsanti <leonardo.buonsanti@gmail.com>
  * GD minor fixes added.
  * bug fixed. *** buffer overflow detected ***: sarg terminated
  in Fedora Core 5 when using -D FORTIFY_SOURCE in gcc or in kernel
* Thu Aug 10 2006 kssingvo@suse.de
- update to version 2.2.1
  * iconv problems fixed in Freebsd and Slackware.
  Thanks to Grigory Trenin <gtrenin@gmail.com>.
  * new word added to languages: Topuser
  * missing fclose fp-in in css.c
  Thanks to Renato Botelho <rbgarga@gmail.com>.
  * index.c fixed. Missing -r in reverse sort.
  Thanks to Fernando Lemes da Silva <fernando@koho.com.br>
  * wrong values in columns in-cache and out-cache.
  Thanks to Hugo P S Costa <hpcosta@nutron.com.br>
  * sarg ported to 64 bits.
  Thanks to Antonio F. Zago <zagolinux@uol.com.br>
  to share your Fedora Core 5 64 bits with me.
  * fixed conflict types for 'saverecs2' in .configure
  * fixed no index.html when lastlog tag is greather then 0,
  caused by some debug messages.
  * removed some development debug message
  * user_limit_block script added to block users when limit exceeded
  * fixed wrong sort in index.html
  * removed '+' argument to sort utility.
  Thanks to Julio Cesar Covolato <julio@psi.com.br>
  * fixed "file too long" messages when using long_url
  Thanks to Fabio Lo Votrico <fabio@link.it>
  * fixes and improvements from Oleg <xsov@mail.ru> - Tanks.
  . fprintf faster than sprintf+fputs (fixed in some places);
  . strcpy+strcat is faster than sprintf (fixed in some places);
  . unused variables removed;
  . fixed headers look and feel (<th class="header3">);
  . fixed word 'BYTES' localisation for datetime user report;
  . fixed corrupted top header on index, denied, download and tt-reports;
  . fixed "No" table header in topsites;
  . fixed user report table look;
  . fixed floating point exception on long url (added checks
  for division by zero);
  . fixed incorrect long url view;
  . fixed too wide table entries in user report by adding url_limit
  internal parameter in html.c (default 40);
  . fixed charset.c file (was in MS-DOS text format);
  . also included all previous fixes by other people (from
  datafile.patch and lastlog.patch files).
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Jan 11 2006 kssingvo@suse.de
- update to 2.1
- remove of memory leak patch (already included)
* Wed Aug 17 2005 kssingvo@suse.de
- fixed memory problems (at least under x86_64)
* Wed Jul 27 2005 kssingvo@suse.de
- update to 2.0.8
* Fri Jun 17 2005 meissner@suse.de
- use RPM_OPT_FLAGS.
* Wed Feb 16 2005 kssingvo@suse.de
- update to 2.0.3
- adaptions for new version
- introduced norootforbuild
* Thu Nov 25 2004 ro@suse.de
- run suse_update_config also in cfgaux dir
* Tue Nov 16 2004 kssingvo@suse.de
- updated to 2.0.1
- added htmldir option
- added manual page
- added official largeurl patch
* Tue Jul 22 2003 kssingvo@suse.de
- updated to 1.4.1
- removed unnecessary string patch, fixed minor problems in spec file
* Tue Jan 14 2003 nadvornik@suse.cz
- fixed multi-line string literals
* Thu Dec 05 2002 kssingvo@suse.de
- fixed build problem: $RPM_BUILD_ROOT was missing
* Wed Dec 04 2002 kssingvo@suse.de
- updated to 1.2.2.1
- rewrote many parts of spec file
- updated path in sarg.conf (bugzilla#21290)
* Wed Jul 25 2001 bodammer@suse.de
- initial package of sarg-1.1.1
openSUSE Build Service is sponsored by