Package: teapop Version: 0.3.7-4.2 Severity: important Tags: patch Teapop fails to handle unlocking of non existing mboxes in pop_unlock_maildrop. This is rather annoying expecially in dotlock mode as the .lock file is not removed which in turn prevents more messages to be received and teapop to successfully remove it :p
The problem is located in pop_lock.c, function pop_unlock_maildrop. First the permissions on the mbox are reset. /* Reset permissions on mbox (which might get lost when writing) */ if (xpinfo->mboxtype == 0) { fflush(xpinfo->mbox); fchmod(fileno(xpinfo->mbox), xpinfo->mboxperm); } Then the lock is removed: /* Only unlock each lock if it's locked */ if (xpinfo->locktrack & LOCK_DOTLOCK) { [...] However, if the mbox file doesn't exist, xpinfo->mbox is NULL and the program segfaults on fileno(xpinfo->mbox). The dotlock is therfore never removed. Please consider applying the attached patch. Thanks, -aCaB -- System Information: Debian Release: 4.0 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.22-4-amd64 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
*** teapop/pop_lock.c Mon Mar 24 21:26:54 2008 --- ../../pop_lock.c Mon Mar 24 21:21:24 2008 *************** *** 331,337 **** sigprocmask(SIG_BLOCK, (sigset_t *)xpinfo->smask, NULL); /* Reset permissions on mbox (which might get lost when writing) */ ! if (xpinfo->mboxtype == 0) { fflush(xpinfo->mbox); fchmod(fileno(xpinfo->mbox), xpinfo->mboxperm); } --- 331,337 ---- sigprocmask(SIG_BLOCK, (sigset_t *)xpinfo->smask, NULL); /* Reset permissions on mbox (which might get lost when writing) */ ! if (xpinfo->mboxtype == 0 && xpinfo->mbox) { fflush(xpinfo->mbox); fchmod(fileno(xpinfo->mbox), xpinfo->mboxperm); } *************** *** 345,361 **** } if (xpinfo->locktrack & LOCK_FLOCK) { ! (void)flock(fileno(xpinfo->mbox), LOCK_UN); xpinfo->locktrack &= ~LOCK_FLOCK; } if (xpinfo->locktrack & LOCK_FCNTL) { lock_data.l_type = F_UNLCK; lock_data.l_whence = lock_data.l_start = lock_data.l_len = 0; ! (void)fcntl(fileno(xpinfo->mbox), F_SETLK, &lock_data); xpinfo->locktrack &= ~LOCK_FCNTL; } if (xpinfo->locktrack & LOCK_LOCKF) { ! (void)lockf(fileno(xpinfo->mbox), F_ULOCK, 0); xpinfo->locktrack &= ~LOCK_LOCKF; } --- 345,364 ---- } if (xpinfo->locktrack & LOCK_FLOCK) { ! if (xpinfo->mbox) ! (void)flock(fileno(xpinfo->mbox), LOCK_UN); xpinfo->locktrack &= ~LOCK_FLOCK; } if (xpinfo->locktrack & LOCK_FCNTL) { lock_data.l_type = F_UNLCK; lock_data.l_whence = lock_data.l_start = lock_data.l_len = 0; ! if (xpinfo->mbox) ! (void)fcntl(fileno(xpinfo->mbox), F_SETLK, &lock_data); xpinfo->locktrack &= ~LOCK_FCNTL; } if (xpinfo->locktrack & LOCK_LOCKF) { ! if (xpinfo->mbox) ! (void)lockf(fileno(xpinfo->mbox), F_ULOCK, 0); xpinfo->locktrack &= ~LOCK_LOCKF; }