Package: ipac-ng
Version: 1.31-2
Severity: grave
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all.

I run multi host configuration with 3 routers and ipac-ng on all. I
used to have this command in cron:

0 * * * *               /usr/local/sbin/ipacsum -r -H ... -s 61h59m55s -e 
60h59m55s >/dev/null

This worked when I had only one router, but then I introduced the second
two routers. Sum of data transfered through the other routers decreased.
I investigated what it could be and found that cron command.

Short bug description:

The bug is that ipacsum calls fetchipac to perform deletion of records,
such as:

DELETE 1146158101
DELETE 1146158401
DELETE 1146158701
DELETE 1146159001
DELETE 1146159301
DELETE 1146159601
DELETE 1146159776

This deletes records of all hostnames, not only those which should. I've
written patch for it which works on sql backend. I don't use plainfile
and I think it would be a bit difficult to write similar patch for it.

The patch causes DELETE command to erase only records with hostname
equivalent to that received on command line (or all if called w/o the
argument).

I'm reporting this in Debian BTS because I'm not sure the upstream
author is still maintaining the program and I don't want this patch to
get lost.

I CC'ed upstream mailing list though.



- -- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-ck3
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEVGKbi2PKBl+Ic14RAoXxAKCsfIchYHk5lgivvse/b/yncd3OKgCgzYBn
FHCzc0lek4XaXxy9qghF44o=
=FpDN
-----END PGP SIGNATURE-----
diff -urN ipac-ng-1.31/storage/sharedsql/sharedsql.c ipac-ng-1.31-new/storage/sharedsql/sharedsql.c
--- ipac-ng-1.31/storage/sharedsql/sharedsql.c	2004-08-24 20:38:58.000000000 +0200
+++ ipac-ng-1.31-new/storage/sharedsql/sharedsql.c	2006-04-30 08:32:07.000000000 +0200
@@ -464,6 +464,8 @@
 	char wh_exec[120];
 
 	sprintf (wh_exec, "DELETE FROM logs WHERE that_time = '%lu'", timestamp);
+	if (ahost)
+		sprintf (wh_exec+strlen (wh_exec), "AND hostname = '%s'", ahost);
 
 	DPRINTF ("sql_stor_delete_record\n");
 	return sql_execute_simple_query (wh_exec);

Reply via email to