git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@613 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2004/06/16 05:45:28... | ... |
@@ -1,3 +1,10 @@ |
1 |
+Tue Jun 15 22:41:03 CEST 2004 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamscan, clamd, freshclam: call geteuid() instead of getuid() to avoid |
|
4 |
+ error messages when the parent process is running |
|
5 |
+ with unprivileged effective UID (thanks to Al |
|
6 |
+ Smith <ajs+clamav*aeschi.ch.eu.org>) |
|
7 |
+ |
|
1 | 8 |
Mon Jun 14 17:38:37 CEST 2004 (tk) |
2 | 9 |
---------------------------------- |
3 | 10 |
* doc: update |
... | ... |
@@ -199,7 +199,7 @@ void clamd(struct optstruct *opt) |
199 | 199 |
} |
200 | 200 |
|
201 | 201 |
/* drop priviledges */ |
202 |
- if(getuid() == 0 && (cpt = cfgopt(copt, "User"))) { |
|
202 |
+ if(geteuid() == 0 && (cpt = cfgopt(copt, "User"))) { |
|
203 | 203 |
if((user = getpwnam(cpt->strarg)) == NULL) { |
204 | 204 |
fprintf(stderr, "ERROR: Can't get information about user %s.\n", cpt->strarg); |
205 | 205 |
logg("!Can't get information about user %s.\n", cpt->strarg); |
... | ... |
@@ -74,7 +74,7 @@ int scanmanager(const struct optstruct *opt) |
74 | 74 |
|
75 | 75 |
/* njh@bandsman.co.uk: BeOS */ |
76 | 76 |
#if !defined(C_CYGWIN) && !defined(C_BEOS) |
77 |
- if(!getuid()) { |
|
77 |
+ if(!geteuid()) { |
|
78 | 78 |
if((user = getpwnam(UNPUSER)) == NULL) { |
79 | 79 |
mprintf("@Can't get information about user "UNPUSER".\n"); |
80 | 80 |
exit(60); /* this is critical problem, so we just exit here */ |
... | ... |
@@ -220,7 +220,7 @@ int scanmanager(const struct optstruct *opt) |
220 | 220 |
|
221 | 221 |
/* njh@bandsman.co.uk: BeOS */ |
222 | 222 |
#if !defined(C_CYGWIN) && !defined(C_BEOS) |
223 |
- if(!getuid()) { |
|
223 |
+ if(!geteuid()) { |
|
224 | 224 |
if((user = getpwnam(UNPUSER)) == NULL) { |
225 | 225 |
mprintf("@Can't get information about user %s\n", UNPUSER); |
226 | 226 |
exit(60); /* this is critical problem, so we just exit here */ |
... | ... |
@@ -481,7 +481,7 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us |
481 | 481 |
mprintf("@Can't fork.\n"); |
482 | 482 |
exit(61); |
483 | 483 |
case 0: /* read access denied */ |
484 |
- if(getuid()) { |
|
484 |
+ if(geteuid()) { |
|
485 | 485 |
if(!printinfected) |
486 | 486 |
mprintf("%s: Access denied to archive.\n", filename); |
487 | 487 |
} else { |
... | ... |
@@ -501,7 +501,7 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us |
501 | 501 |
} |
502 | 502 |
} |
503 | 503 |
|
504 |
- if(getuid()) |
|
504 |
+ if(geteuid()) |
|
505 | 505 |
if(checkaccess(filename, NULL, R_OK) != 1) { |
506 | 506 |
if(!printinfected) |
507 | 507 |
mprintf("%s: Access denied.\n", filename); |
... | ... |
@@ -902,7 +902,7 @@ int clamav_unpack(const char *prog, char **args, const char *tmpdir, const struc |
902 | 902 |
return -1; |
903 | 903 |
case 0: |
904 | 904 |
#ifndef C_CYGWIN |
905 |
- if(!getuid() && user) { |
|
905 |
+ if(!geteuid() && user) { |
|
906 | 906 |
|
907 | 907 |
#ifdef HAVE_SETGROUPS |
908 | 908 |
if(setgroups(1, &user->pw_gid)) { |
... | ... |
@@ -147,7 +147,7 @@ int freshclam(struct optstruct *opt) |
147 | 147 |
unpuser = UNPUSER; |
148 | 148 |
} |
149 | 149 |
|
150 |
- if(!getuid()) { |
|
150 |
+ if(!geteuid()) { |
|
151 | 151 |
if((user = getpwnam(unpuser)) == NULL) { |
152 | 152 |
mprintf("@Can't get information about user %s.\n", unpuser); |
153 | 153 |
exit(60); /* this is critical problem, so we just exit here */ |