call geteuid() instead of getuid()

git-svn: trunk@613
remotes/push_mirror/metadata
Tomasz Kojm 21 years ago
parent 66f082ad40
commit 11f30313dd
  1. 7
      clamav-devel/ChangeLog
  2. 2
      clamav-devel/clamd/clamd.c
  3. 10
      clamav-devel/clamscan/manager.c
  4. 2
      clamav-devel/clamscan/others.c
  5. 2
      clamav-devel/clamscan/treewalk.c
  6. 2
      clamav-devel/freshclam/freshclam.c

@ -1,3 +1,10 @@
Tue Jun 15 22:41:03 CEST 2004 (tk)
----------------------------------
* clamscan, clamd, freshclam: call geteuid() instead of getuid() to avoid
error messages when the parent process is running
with unprivileged effective UID (thanks to Al
Smith <ajs+clamav*aeschi.ch.eu.org>)
Mon Jun 14 17:38:37 CEST 2004 (tk)
----------------------------------
* doc: update

@ -199,7 +199,7 @@ void clamd(struct optstruct *opt)
}
/* drop priviledges */
if(getuid() == 0 && (cpt = cfgopt(copt, "User"))) {
if(geteuid() == 0 && (cpt = cfgopt(copt, "User"))) {
if((user = getpwnam(cpt->strarg)) == NULL) {
fprintf(stderr, "ERROR: Can't get information about user %s.\n", cpt->strarg);
logg("!Can't get information about user %s.\n", cpt->strarg);

@ -74,7 +74,7 @@ int scanmanager(const struct optstruct *opt)
/* njh@bandsman.co.uk: BeOS */
#if !defined(C_CYGWIN) && !defined(C_BEOS)
if(!getuid()) {
if(!geteuid()) {
if((user = getpwnam(UNPUSER)) == NULL) {
mprintf("@Can't get information about user "UNPUSER".\n");
exit(60); /* this is critical problem, so we just exit here */
@ -220,7 +220,7 @@ int scanmanager(const struct optstruct *opt)
/* njh@bandsman.co.uk: BeOS */
#if !defined(C_CYGWIN) && !defined(C_BEOS)
if(!getuid()) {
if(!geteuid()) {
if((user = getpwnam(UNPUSER)) == NULL) {
mprintf("@Can't get information about user %s\n", UNPUSER);
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
mprintf("@Can't fork.\n");
exit(61);
case 0: /* read access denied */
if(getuid()) {
if(geteuid()) {
if(!printinfected)
mprintf("%s: Access denied to archive.\n", filename);
} else {
@ -501,7 +501,7 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us
}
}
if(getuid())
if(geteuid())
if(checkaccess(filename, NULL, R_OK) != 1) {
if(!printinfected)
mprintf("%s: Access denied.\n", filename);
@ -902,7 +902,7 @@ int clamav_unpack(const char *prog, char **args, const char *tmpdir, const struc
return -1;
case 0:
#ifndef C_CYGWIN
if(!getuid() && user) {
if(!geteuid() && user) {
#ifdef HAVE_SETGROUPS
if(setgroups(1, &user->pw_gid)) {

@ -73,7 +73,7 @@ int checkaccess(const char *path, const char *username, int mode)
struct passwd *user;
int ret = 0, status;
if(!getuid()) {
if(!geteuid()) {
if((user = getpwnam(username)) == NULL) {
return -1;

@ -156,7 +156,7 @@ int clamav_rmdirs(const char *dir)
return -1;
case 0:
#ifndef C_CYGWIN
if(!getuid()) {
if(!geteuid()) {
if((user = getpwnam(UNPUSER)) == NULL)
return -3;

@ -147,7 +147,7 @@ int freshclam(struct optstruct *opt)
unpuser = UNPUSER;
}
if(!getuid()) {
if(!geteuid()) {
if((user = getpwnam(unpuser)) == NULL) {
mprintf("@Can't get information about user %s.\n", unpuser);
exit(60); /* this is critical problem, so we just exit here */

Loading…
Cancel
Save