clamd: redirect descriptors to /dev/null by default

git-svn: trunk@123
remotes/push_mirror/metadata
Tomasz Kojm 22 years ago
parent 3e14836a12
commit 96b02502de
  1. 5
      clamav-devel/ChangeLog
  2. 14
      clamav-devel/clamd/clamd.c
  3. 4
      clamav-devel/etc/clamav.conf
  4. 3
      clamav-devel/libclamav/str.c

@ -1,3 +1,8 @@
Sun Nov 23 23:40:53 CET 2003 (tk)
---------------------------------
* clamd: redirect the descriptors 1 and 2 to /dev/null by default, to
protect against a lock with Debug when Foreground is not enabled
Sat Nov 22 17:23:10 IST 2003 (njh)
----------------------------------
* clamav-milter: Drop root privileges and support quarantine

@ -22,6 +22,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <pwd.h>
#include <grp.h>
@ -222,8 +223,17 @@ void daemonize(void)
{
int i;
for(i = 0; i <= 2; i++)
close(i);
if((i = open("/dev/null", O_WRONLY)) == -1) {
logg("!Cannot open /dev/null. Only use Debug if Foreground is enabled.\n");
for(i = 0; i <= 2; i++)
close(i);
} else {
close(0);
dup2(i, 1);
dup2(i, 2);
}
chdir("/");

@ -2,7 +2,7 @@
## Example config file for the Clam AV daemon
## Please read the clamav.conf(5) manual before editing this file.
##
# Comment or remove the line below.
Example
@ -43,7 +43,7 @@ Example
# Default is the hardcoded directory (mostly /usr/local/share/clamav,
# it depends on installation options).
#DataDirectory /var/lib/clamav
# The daemon works in local or network mode. Currently the local mode is
# recommended for security reasons.

@ -120,6 +120,9 @@ void cli_chomp(char *string)
{
if(string[strlen(string) - 1] == 10 || string[strlen(string) - 1 ] == 13)
string[strlen(string) -1] = 0;
if(string[strlen(string) - 1] == '\r')
string[strlen(string) -1] = 0;
}
char *cli_tok(const char *line, int field, char delimiter)

Loading…
Cancel
Save