git-svn: trunk@123
Tomasz Kojm authored on 2003/11/24 07:42:20... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Sun Nov 23 23:40:53 CET 2003 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * clamd: redirect the descriptors 1 and 2 to /dev/null by default, to |
|
4 |
+ protect against a lock with Debug when Foreground is not enabled |
|
5 |
+ |
|
1 | 6 |
Sat Nov 22 17:23:10 IST 2003 (njh) |
2 | 7 |
---------------------------------- |
3 | 8 |
* clamav-milter: Drop root privileges and support quarantine |
... | ... |
@@ -22,6 +22,7 @@ |
22 | 22 |
#include <sys/time.h> |
23 | 23 |
#include <sys/types.h> |
24 | 24 |
#include <sys/stat.h> |
25 |
+#include <fcntl.h> |
|
25 | 26 |
#include <time.h> |
26 | 27 |
#include <pwd.h> |
27 | 28 |
#include <grp.h> |
... | ... |
@@ -222,8 +223,17 @@ void daemonize(void) |
222 | 222 |
{ |
223 | 223 |
int i; |
224 | 224 |
|
225 |
- for(i = 0; i <= 2; i++) |
|
226 |
- close(i); |
|
225 |
+ |
|
226 |
+ if((i = open("/dev/null", O_WRONLY)) == -1) { |
|
227 |
+ logg("!Cannot open /dev/null. Only use Debug if Foreground is enabled.\n"); |
|
228 |
+ for(i = 0; i <= 2; i++) |
|
229 |
+ close(i); |
|
230 |
+ |
|
231 |
+ } else { |
|
232 |
+ close(0); |
|
233 |
+ dup2(i, 1); |
|
234 |
+ dup2(i, 2); |
|
235 |
+ } |
|
227 | 236 |
|
228 | 237 |
chdir("/"); |
229 | 238 |
|
... | ... |
@@ -2,7 +2,7 @@ |
2 | 2 |
## Example config file for the Clam AV daemon |
3 | 3 |
## Please read the clamav.conf(5) manual before editing this file. |
4 | 4 |
## |
5 |
- |
|
5 |
+ |
|
6 | 6 |
|
7 | 7 |
# Comment or remove the line below. |
8 | 8 |
Example |
... | ... |
@@ -43,7 +43,7 @@ Example |
43 | 43 |
# Default is the hardcoded directory (mostly /usr/local/share/clamav, |
44 | 44 |
# it depends on installation options). |
45 | 45 |
#DataDirectory /var/lib/clamav |
46 |
- |
|
46 |
+ |
|
47 | 47 |
# The daemon works in local or network mode. Currently the local mode is |
48 | 48 |
# recommended for security reasons. |
49 | 49 |
|
... | ... |
@@ -120,6 +120,9 @@ void cli_chomp(char *string) |
120 | 120 |
{ |
121 | 121 |
if(string[strlen(string) - 1] == 10 || string[strlen(string) - 1 ] == 13) |
122 | 122 |
string[strlen(string) -1] = 0; |
123 |
+ |
|
124 |
+ if(string[strlen(string) - 1] == '\r') |
|
125 |
+ string[strlen(string) -1] = 0; |
|
123 | 126 |
} |
124 | 127 |
|
125 | 128 |
char *cli_tok(const char *line, int field, char delimiter) |