I am hooking clamscan into a procmail filter like this:

:0
CLAMAV=|/usr/bin/clamscan --disable-summary --stdout --mbox -

:0
* CLAMAV ?? .*: \/.* FOUND
{
  :0 fhw
  | /usr/bin/formail -a"X-ClamAV: ${MATCH}"
}


But clamscan seems to hang and never return. From strace it seem to be stuck in a loop:


rmdir("/tmp/3937bd6e877ca548") = -1 ENOTEMPTY (Directory not empty)
getdents(3, /* 3 entries */, 3933) = 60
lstat("/tmp/3937bd6e877ca548/document.scrIWpKmX", 0xbffff928) = -1 EACCES (Permission denied)
getdents(3, /* 0 entries */, 3933) = 0
lseek(3, 0, SEEK_SET) = 0
stat("/tmp/3937bd6e877ca548", {st_mode=S_IFDIR|0600, st_size=4096, ...}) = 0
rmdir("/tmp/3937bd6e877ca548") = -1 ENOTEMPTY (Directory not empty)
getdents(3, /* 3 entries */, 3933) = 60
lstat("/tmp/3937bd6e877ca548/document.scrIWpKmX", 0xbffff928) = -1 EACCES (Permission denied)
getdents(3, /* 0 entries */, 3933) = 0
lseek(3, 0, SEEK_SET) = 0
stat("/tmp/3937bd6e877ca548", {st_mode=S_IFDIR|0600, st_size=4096, ...}) = 0
--- repeat ---


It seems to be in a looping while cleaning up:

sudo ls -alF /tmp/3937bd6e877ca548/
total 36
drw------- 2 clamav clamav 4096 Feb 17 10:57 ./
drwxrwxrwt 6 root root 8192 Feb 17 12:32 ../
-rwx------ 1 root root 22529 Feb 17 10:57 document.scrIWpKmX*


In treewalk.c, if I comment out the changing of the user/group it all works:

int clamav_rmdirs(const char *dir)
{
#ifndef C_CYGWIN
        struct passwd *user;
#endif
        pid_t pid;
        int status;


switch(pid = fork()) { case -1: return -1; case 0: /* #ifndef C_CYGWIN if(!getuid()) { if((user = getpwnam(UNPUSER)) == NULL) return -3;

                setgroups(1, &user->pw_gid);
                setgid(user->pw_gid);
                setuid(user->pw_uid);
            }
#endif
          */
            rmdirs(dir);
            exit(0);
            break;
        default:
            waitpid(pid, &status, 0);
            if(WIFEXITED(status))
                return 0;
            else
                return -2;
    }
}

I am pretty sure the bug is writing out document.scrIWpKmX as the wrong user/group and not the cleanup code, right?

This ring a bell with anybody? Do I have something configured wrong?

Thanks,

Brian



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Clamav-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-users

Reply via email to