From 69db236189b4ff0480b24d1d22b2b14612b783ed Mon Sep 17 00:00:00 2001 From: Andrej Kacian Date: Sun, 25 Mar 2007 19:25:17 +0000 Subject: [PATCH] Move logfile permission/ownership fix to separate logfix() function and call it from start(), and from logrotate script. Closes bug #170739, reported by Sergey Borodich . Remove bashism from the initscript, as suggested by Natanael Copa in bug #171755. Package-Manager: portage-2.1.2.2 --- app-antivirus/clamav/ChangeLog | 9 +++- app-antivirus/clamav/Manifest | 30 +++++------ app-antivirus/clamav/files/clamav.logrotate | 6 +-- app-antivirus/clamav/files/clamd.rc | 56 +++++++++++++-------- 4 files changed, 60 insertions(+), 41 deletions(-) diff --git a/app-antivirus/clamav/ChangeLog b/app-antivirus/clamav/ChangeLog index 4338e13fa984..c258946b063f 100644 --- a/app-antivirus/clamav/ChangeLog +++ b/app-antivirus/clamav/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for app-antivirus/clamav # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/ChangeLog,v 1.215 2007/03/20 12:05:57 ticho Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/ChangeLog,v 1.216 2007/03/25 19:25:17 ticho Exp $ + + 25 Mar 2007; Andrej Kacian files/clamav.logrotate, + files/clamd.rc: + Move logfile permission/ownership fix to separate logfix() function and call + it from start(), and from logrotate script. Closes bug #170739, reported by + Sergey Borodich . Remove bashism from the initscript, + as suggested by Natanael Copa in bug #171755. 20 Mar 2007; Andrej Kacian -clamav-0.88.5.ebuild, -clamav-0.88.6.ebuild, clamav-0.88.7.ebuild, clamav-0.90.ebuild, diff --git a/app-antivirus/clamav/Manifest b/app-antivirus/clamav/Manifest index 9898992cc636..f554d9ac32ae 100644 --- a/app-antivirus/clamav/Manifest +++ b/app-antivirus/clamav/Manifest @@ -13,18 +13,18 @@ AUX clamav-milter.README.gentoo 1124 RMD160 4fb1e2d9b444874838bcea1071969ca6862f MD5 08f7b320461c04bbb88555e389c2e544 files/clamav-milter.README.gentoo 1124 RMD160 4fb1e2d9b444874838bcea1071969ca6862fb15b files/clamav-milter.README.gentoo 1124 SHA256 5e7b142b68964bc3463b077e5698fa77cace45ea9612258b1e1849cee944dd11 files/clamav-milter.README.gentoo 1124 -AUX clamav.logrotate 357 RMD160 09bd90c7d918a91b45cdd9c48afd35edc7b30ecc SHA1 86a1b38dae0b4dc3aeb6d3924a521e392ca20228 SHA256 55dc096962262533f27b1f33d7bc07ed30fb1622a2cfddc08c68c4e012f2ec47 -MD5 d8e7954459db4d624a93f50e9c29f26a files/clamav.logrotate 357 -RMD160 09bd90c7d918a91b45cdd9c48afd35edc7b30ecc files/clamav.logrotate 357 -SHA256 55dc096962262533f27b1f33d7bc07ed30fb1622a2cfddc08c68c4e012f2ec47 files/clamav.logrotate 357 +AUX clamav.logrotate 187 RMD160 f95a8f690cf62711ec0e4e7562b374efcd051712 SHA1 3cf2badacf26c802e7266b08d03cc84cedceb750 SHA256 5b19d0ae9ec46dfde0d3f037a82c743d27323927ac9eff198d475b6588ef28f3 +MD5 9f2db10b4931e5e9dd6009afc0d94f9c files/clamav.logrotate 187 +RMD160 f95a8f690cf62711ec0e4e7562b374efcd051712 files/clamav.logrotate 187 +SHA256 5b19d0ae9ec46dfde0d3f037a82c743d27323927ac9eff198d475b6588ef28f3 files/clamav.logrotate 187 AUX clamd.conf 193 RMD160 abebb5e1607e6819859b51e1a41b583c8266c6df SHA1 5b27737aecf3bd90277988fc60526ede7d4be636 SHA256 cd867dc66af694282584fa2cfd40a662ac2a7c25d6f2288b9afdc657a07226e3 MD5 e29ee77ca9bfe28ed18dbf67a9c90e75 files/clamd.conf 193 RMD160 abebb5e1607e6819859b51e1a41b583c8266c6df files/clamd.conf 193 SHA256 cd867dc66af694282584fa2cfd40a662ac2a7c25d6f2288b9afdc657a07226e3 files/clamd.conf 193 -AUX clamd.rc 2433 RMD160 9fffcaae70e043d8557a7350f3857c2493720768 SHA1 e80fcd77e118ec1241657f3c608edf917b8d3fd8 SHA256 4f5eb3c9b464bb9334148d0d1c4aae13248b977f00fa45399d6bd0aebbd3ebdc -MD5 b4cbd6b5f9b01402429dd916a71cb848 files/clamd.rc 2433 -RMD160 9fffcaae70e043d8557a7350f3857c2493720768 files/clamd.rc 2433 -SHA256 4f5eb3c9b464bb9334148d0d1c4aae13248b977f00fa45399d6bd0aebbd3ebdc files/clamd.rc 2433 +AUX clamd.rc 2611 RMD160 1b7aca4e359965197e878f74ca5220146a9da179 SHA1 ac14080483affc3d66db38c86833e16f2c7120d0 SHA256 22ee3c3e3ff78884a4e8a25b0fde656594511c552094deeedd427d526ea91772 +MD5 0759b0e9f6a66bd869e9c7f439c54a8f files/clamd.rc 2611 +RMD160 1b7aca4e359965197e878f74ca5220146a9da179 files/clamd.rc 2611 +SHA256 22ee3c3e3ff78884a4e8a25b0fde656594511c552094deeedd427d526ea91772 files/clamd.rc 2611 DIST clamav-0.88.7.tar.gz 9510548 RMD160 14d7c6255df618b16b704fc1cb5ce2b1385fa0e8 SHA1 7d7833dc454437ed7044b1c734f0a13e4dc1ead2 SHA256 702cb5928bff3d0e647a4a6b505d434e3a0f10f2af74bddac5239a200b92d1e2 DIST clamav-0.90.1.tar.gz 11643310 RMD160 1fd343d6510fea337a676e32bb1e4e404da4bd6d SHA1 d51f279fce2d702c3e97b2e08fe3b4b863f0acc6 SHA256 08a0255b4f6bdc4312eea6c118e79ecf684aed10640b45037d9dc5890c7687be DIST clamav-0.90.tar.gz 11575374 RMD160 1b22144d3a41376093b73bbeb5302092a18ca685 SHA1 574b84429b878df3a9d862ea386c970326850158 SHA256 c39005318d4a7d27d9710c3d71396b8c500e0bc5a184cb7392051c9ca9dea60d @@ -52,10 +52,10 @@ EBUILD clamav-0.90.ebuild 3957 RMD160 0398abdaefb9ccb753da137aee215ecb80f2d797 S MD5 05cbcc7e93932c9c8d3ec518f9c9bc4b clamav-0.90.ebuild 3957 RMD160 0398abdaefb9ccb753da137aee215ecb80f2d797 clamav-0.90.ebuild 3957 SHA256 851c73716fdcf6be309d9362e884c32f2a5d538a0df317c259c0502523b78c0c clamav-0.90.ebuild 3957 -MISC ChangeLog 34024 RMD160 c2f5f61ecf27233d9acdfe1b76ac7d6320f12489 SHA1 ea9947f44699b954a7dfc362a47e68291c000223 SHA256 68e92b6b7bcc30961c12f4c84d9020cfcd2bf0bfb4f9210cfef504f0516f3604 -MD5 ab6dea25e4a5439ada291df514e88b14 ChangeLog 34024 -RMD160 c2f5f61ecf27233d9acdfe1b76ac7d6320f12489 ChangeLog 34024 -SHA256 68e92b6b7bcc30961c12f4c84d9020cfcd2bf0bfb4f9210cfef504f0516f3604 ChangeLog 34024 +MISC ChangeLog 34426 RMD160 1315b73249b10f098a67ef52d688ba1f793458d8 SHA1 925a5d48b7a211db2f406e86f8aabdb6a8525114 SHA256 c37b018ae4051624f4a2cf07d336163db4072992d56f39f413e30ab483b241c6 +MD5 6cfd0e759f5d6fb2963c3899ef84595b ChangeLog 34426 +RMD160 1315b73249b10f098a67ef52d688ba1f793458d8 ChangeLog 34426 +SHA256 c37b018ae4051624f4a2cf07d336163db4072992d56f39f413e30ab483b241c6 ChangeLog 34426 MISC metadata.xml 184 RMD160 c37bff1fc1cd7139c91dae9b0fa5082e1d81f153 SHA1 cc0a188d9ad2411e78747326c62dd046bd5413c8 SHA256 d51011aa837db802ef539a1321a4af0a4a00879d475b92fd58f3c01df7320b58 MD5 7e32edfd72887a57b16ecd73f0f7a1a0 metadata.xml 184 RMD160 c37bff1fc1cd7139c91dae9b0fa5082e1d81f153 metadata.xml 184 @@ -81,7 +81,7 @@ SHA256 be92b57874b8c81e9831142039d6ee58ab3aaf3feae75d26a4a5d1d821a21757 files/di -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) -iD8DBQFF/84tQlM6RnzZP+IRAhPJAJ9Wj1hFBhnp0bnBcOjM8Ox5NH/pxwCfbk/+ -oxOwFRQmK8FSdpk7YiePus4= -=8Rmu +iD8DBQFGBr6WQlM6RnzZP+IRAgnXAKCyU3HL60V/jL3V3AOCit5OELKwIwCfb9hW +u/IkxyIOdBwuweZZXcngMeQ= +=fQyP -----END PGP SIGNATURE----- diff --git a/app-antivirus/clamav/files/clamav.logrotate b/app-antivirus/clamav/files/clamav.logrotate index e79ce6e77ee8..8c4916470b48 100644 --- a/app-antivirus/clamav/files/clamav.logrotate +++ b/app-antivirus/clamav/files/clamav.logrotate @@ -1,15 +1,13 @@ /var/log/clamav/clamd.log { missingok - create 640 clamav clamav postrotate - /bin/kill -HUP `cat /var/run/clamav/clamd.pid 2> /dev/null` 2>/dev/null || true + /etc/init.d/clamd logfix endscript } /var/log/clamav/freshclam.log { missingok - create 640 clamav clamav postrotate - /bin/kill -HUP `cat /var/run/clamav/freshclam.pid 2> /dev/null` 2>/dev/null || true + /etc/init.d/clamd logfix endscript } diff --git a/app-antivirus/clamav/files/clamd.rc b/app-antivirus/clamav/files/clamd.rc index bed32bc0d49a..309a8fc8c924 100644 --- a/app-antivirus/clamav/files/clamd.rc +++ b/app-antivirus/clamav/files/clamd.rc @@ -1,7 +1,9 @@ #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/files/clamd.rc,v 1.11 2007/03/15 13:25:25 ticho Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/files/clamd.rc,v 1.12 2007/03/25 19:25:17 ticho Exp $ + +opts="logfix" depend() { use net @@ -10,18 +12,10 @@ depend() { start() { local clamd_socket=`awk '$1 == "LocalSocket" { print $2 }' /etc/clamd.conf` - if [ "${START_CLAMD}" = "yes" ]; then - # fix clamd log permissions - # (might be clobbered by logrotate or something) - local logfile=`awk '$1 == "LogFile" { print $2 }' /etc/clamd.conf` - local clamav_user=`awk '$1 == "User" { print $2 }' /etc/clamd.conf` - if [[ -n "${logfile}" && -n "${clamav_user}" ]]; then - if [ ! -f "${logfile}" ]; then - touch ${logfile} - fi - chown ${clamav_user} ${logfile} - fi + logfix + + if [ "${START_CLAMD}" = "yes" ]; then if [ -S "${clamd_socket:-/tmp/clamd}" ]; then rm -f ${clamd_socket:-/tmp/clamd} fi @@ -34,15 +28,6 @@ start() { if [ "${START_FRESHCLAM}" = "yes" ]; then ebegin "Starting freshclam" - # fix freshclam log permissions - # (might be clobbered by logrotate or something) - logfile=`awk '$1 == "UpdateLogFile" { print $2 }' /etc/freshclam.conf` - if [[ -n "${logfile}" && -n "${clamav_user}" ]]; then - if [ ! -f "${logfile}" ]; then - touch ${logfile} - fi - chown ${clamav_user} ${logfile} - fi start-stop-daemon --start --quiet \ --exec /usr/bin/freshclam -- -d retcode=$? @@ -82,3 +67,32 @@ stop() { eend $? "Failed to stop clamav-milter" fi } + +logfix() { + if [ "${START_CLAMD}" = "yes" ]; then + # fix clamd log permissions + # (might be clobbered by logrotate or something) + local logfile=`awk '$1 == "LogFile" { print $2 }' /etc/clamd.conf` + local clamav_user=`awk '$1 == "User" { print $2 }' /etc/clamd.conf` + if [ -n "${logfile}" ] && [ -n "${clamav_user}" ]; then + if [ ! -f "${logfile}" ]; then + touch ${logfile} + fi + chown ${clamav_user} ${logfile} + chmod 640 ${logfile} + fi + fi + + if [ "${START_FRESHCLAM}" = "yes" ]; then + # fix freshclam log permissions + # (might be clobbered by logrotate or something) + logfile=`awk '$1 == "UpdateLogFile" { print $2 }' /etc/freshclam.conf` + if [[ -n "${logfile}" && -n "${clamav_user}" ]]; then + if [ ! -f "${logfile}" ]; then + touch ${logfile} + fi + chown ${clamav_user} ${logfile} + chmod 640 ${logfile} + fi + fi +} -- 2.26.2