Date: Tue, 18 Feb 2003 14:38:05 +0300 (MSK) From: "Alexey V. Neyman" <alex.neyman@auriga.ru> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/48418: mail/teapop: 2 problems Message-ID: <200302181138.h1IBc5T54104@ns.any.ru>
next in thread | raw e-mail | index | archive | help
>Number: 48418 >Category: ports >Synopsis: mail/teapop: 2 problems >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Feb 18 03:40:10 PST 2003 >Closed-Date: >Last-Modified: >Originator: Alexey V. Neyman >Release: FreeBSD 4.4-STABLE i386 >Organization: Auriga, Inc. >Environment: System: FreeBSD xxxx 4.4-STABLE FreeBSD 4.4-STABLE #0 teapop 0.3.5 (or any other version) >Description: If the user's mailbox file has S_ISUID/S_ISGID modes set, they are being cleared by the teapop POP3 server. However, these attributes have special meaning for the sendmail, thus clearing them will preserve sendmail from delivering new messages. The problem is that the kernel forcefully removes SUID/SGID bits from a file should a successful write to that file occur. Thus, teapop should remember the permission modes of the mailbox when it was started and restore them on exit. There is one more problem. When the teapop announces its capabilities with the CAPA command, it may output "EXPIRE NEVER" even if the auto-deletion was turned on (autodeletion=2, in case of -D option). It should output EXPIRE 0, just like it does for -d option. >How-To-Repeat: Install teapop. Change the mailbox permissions to, e.g. 4660. Fetch mail and delete some (not all) messages. Quit. Look at the mailbox permissions. >Fix: --- include/teapop.h.orig Tue Feb 18 09:21:54 2003 +++ include/teapop.h Tue Feb 18 09:29:20 2003 @@ -110,6 +110,7 @@ int nodns; int useuidl; int locktrack; + int mbxperm; char drachost[BIGSTRING]; char apopstr[BIGSTRING]; char userid[BIGSTRING]; --- teapop/pop_lock.c.orig Tue Feb 18 09:28:08 2003 +++ teapop/pop_lock.c Tue Feb 18 12:40:10 2003 @@ -55,6 +55,7 @@ POP_INFO *pinfo; int loop; { + struct stat sb; int retval = 0; int locks = 0; @@ -155,6 +156,9 @@ retval = pop_lock_lockf(pinfo); } + pinfo->mbxperm = fstat(fileno(pinfo->mbox), &sb) < 0 ? 0 : sb.st_mode; + pinfo->mbxperm &= (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO); + /* * Make sure we don't leave any locks (especially dotlocks) * lying around if any necessary lock failed... @@ -293,6 +297,10 @@ /* Block all signals to avoid this function being run twice */ sigprocmask(SIG_BLOCK, (sigset_t *)xpinfo->smask, NULL); + + fflush(xpinfo->mbox); + if (xpinfo->mbxperm) + fchmod(fileno(xpinfo->mbox), xpinfo->mbxperm); /* Only unlock each lock if it's locked */ --- teapop/pop_cmd_capa.c.orig Tue Feb 18 13:00:47 2003 +++ teapop/pop_cmd_capa.c Tue Feb 18 13:00:58 2003 @@ -52,7 +52,7 @@ pop_socket_send(pinfo->out, "LOGIN-DELAY 900"); pop_socket_send(pinfo->out, "UIDL"); pop_socket_send(pinfo->out, "EXPIRE %s", - (pinfo->autodelete == 1) ? "0" : "NEVER"); + (pinfo->autodelete > 0) ? "0" : "NEVER"); pop_socket_send(pinfo->out, "IMPLEMENTATION Teapop-%s", POP_VERSION); pop_socket_send(pinfo->out, "."); } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302181138.h1IBc5T54104>