[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#4778: mailx use a bad file locking method




Package: mailx
Version: 8.5.5-1



The normal method in DEBIAN is to creates a
"/var/spool/mail/<user>.lock" to lock a user mailbox while
manipulating it.

But the mailx program do this locking by calls to flock. So think the
source code must be changed, this requires also the program to be made
set-gid mail. I do not know if it is safe in the case of mailx.

To see that mailx use flock, I've done:
> loic-~$mailx
> Mail version 5.5-kw 5/30/95.  Type ? for help.
> "/var/spool/mail/loic": 2 messages 2 unread
> >U  1 lprylli@mygale.org    Mon Oct 14 08:35  13/322  
>  U  2 lprylli@mygale.org    Mon Oct 14 08:35  13/322  
> & d1
> & q
> Held 1 message in /var/spool/mail/loic
> loic-~$

 and traced the program in another window:
>  [...]
>  read(0, "d1\n", 4096)                   = 3
>  write(1, "& ", 2)                       = 2
>  read(0, "q\n", 4096)                    = 2
>  sigaction(SIGHUP, {SIG_IGN}, {0x8007990, [], SA_RESTART}) = 0
>  sigaction(SIGINT, {SIG_IGN}, {0x8007890, [], SA_RESTART}) = 0
>  sigaction(SIGQUIT, {SIG_IGN}, {SIG_DFL}) = 0
>  open("/var/spool/mail/loic", O_RDONLY)  = 3
>  flock(3, LOCK_EX)                       = 0
>  fstat(3, {st_mode=S_IFREG|0660, st_size=644, ...}) = 0
>  open("/var/spool/mail/loic", O_RDWR)    = 7
>  fstat(7, {st_mode=S_IFREG|0660, st_size=644, ...}) = 0
>  brk(0x8020000)                          = 0x8020000
>  write(7, "From loic Mon Oct 14 08:35:55 19"..., 322) = 322
>  lseek(7, 0, SEEK_CUR)                   = 322
>  ftruncate(7, 322)                       = 0
>  close(7)                                = 0
>  stat("/var/spool/mail/loic", {st_mode=S_IFREG|0660, st_size=322, ...}) = 0
>  time(NULL)                              = 845275010
>  utime("/var/spool/mail/loic", [96/10/14-08:36:51, 96/10/14-08:36:50]) = 0
>  write(1, "Held 1 message in /var/spool/mai"..., 39) = 39
>  close(3)                                = 0
>  _exit(0)                                = ?


Loic Prylli

--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: